Regenerate configure files
[external/binutils.git] / gold / ChangeLog
1 2015-07-27  H.J. Lu  <hongjiu.lu@intel.com>
2
3         * configure: Regenerated.
4
5 2015-07-26  Doug Kwan  <dougkwan@google.com>
6
7         * testsuite/arm_unaligned_reloc.{s,sh}: Make test less sensitive to
8           disassembler output format.
9
10 2015-07-23  Ian Coolidge  <icoolidge@google.com>
11         Plumb --pic-veneer option for gold.
12
13         * arm.cc (Reloc_stub::stub_type_for_reloc): Plumb to stub
14         generation.
15         * options.h (General_options): Add --pic-veneer option.
16
17 2015-07-22  H.J. Lu  <hongjiu.lu@intel.com>
18
19         PR gold/18663
20         * testsuite/Makefile.am (script_test_1_SOURCES): Set to
21         script_test_1a.cc script_test_1b.cc.
22         (script_test_11_r.o): Replace script_test_11.o with
23         script_test_11a.o script_test_11b.o.
24         (script_test_11.o): Removed.
25         (script_test_11a.o): New.
26         (script_test_11b.o): Likewise.
27         * testsuite/Makefile.in: Regenerated.
28         * testsuite/script_test_1.h: New file.
29         * testsuite/script_test_1b.cc: Likewise.
30         * testsuite/script_test_11.h: Likewise.
31         * testsuite/script_test_11b.c: Likewise.
32         * testsuite/script_test_1.cc: Renamed to ...
33         * testsuite/script_test_1a.cc: This.
34         Include "script_test_1.h".
35         (main): Call check_int and check_ptr.
36         * testsuite/script_test_11.c: Renamed to ...
37         * testsuite/script_test_11a.c: This.
38         Include "script_test_11.h".
39         (main): Call ptr_equal.
40
41 2015-07-22  H.J. Lu  <hongjiu.lu@intel.com>
42
43         PR gold/18628
44         * testsuite/ifuncdep2.c (global): Change protected to hidden.
45         * testsuite/ifuncmod1.c (global): Likewise.
46         * testsuite/ifuncmod5.c (global): Likewise.
47
48 2015-07-22  Alan Modra  <amodra@gmail.com>
49
50         * aarch64.cc (try_fix_erratum_843419_optimized): Warning fix.
51
52 2015-07-21  Cary Coutant  <ccoutant@gmail.com>
53
54         PR gold/18548
55         * symtab.cc (Symbol_table::do_define_in_output_data): Check for
56         forced local symbol even when oldsym != NULL.
57         (Symbol_table::do_define_in_output_segment): Likewise.
58         (Symbol_table::do_define_as_constant): Likewise.
59
60 2015-07-21  Cary Coutant  <ccoutant@gmail.com>
61
62         PR gold/18698
63         * archive.cc (Library_base::should_include_member): Don't use entry
64         point for relocatable links, or if target is not yet valid.
65         * parameters.cc (Parameters::entry): Check target_valid().
66
67 2015-07-20  Han Shen  <shenhan@google.com>
68
69         Optimize erratum 843419 fix.
70
71         * aarch64.cc (AArch64_insn_utilities::is_adr): New method.
72         (AArch64_insn_utilities::aarch64_adr_encode_imm): New method.
73         (AArch64_insn_utilities::aarch64_adrp_decode_imm): New method.
74         (E843419_stub): New sub-class of Erratum_stub.
75         (AArch64_relobj::try_fix_erratum_843419_optimized): New method.
76         (AArch64_relobj::section_needs_reloc_stub_scanning): Try optimized fix.
77         (AArch64_relobj::create_erratum_stub): Add 1 argument.
78         (Target_aarch64::scan_erratum_843419_span): Pass in adrp insn offset.
79
80 2015-07-20  Han Shen  <shenhan@google.com>
81
82         Fix arm elf header flags wrt hardfp bit.
83
84         * arm.cc (Target_arm::do_adjust_elf_header): Set flags into view.
85
86 2015-07-20  H.J. Lu  <hongjiu.lu@intel.com>
87
88         PR gold/18689
89         * layout.cc (Layout::layout): Clear the SHF_COMPRESSED flag bit
90         from input group section for relocatable link.
91         * testsuite/Makefile.am (check_SCRIPTS): Add pr18689.sh.
92         (check_DATA): Add pr18689.stdout.
93         (MOSTLYCLEANFILES): Add pr18689a.o pr18689b.o.
94         (pr18689.stdout): New rule.
95         (pr18689a.o): Likewise.
96         (pr18689b.o): Likewise.
97         (pr18689.o): Likewise.
98         * testsuite/pr18689.c: New file.
99         * testsuite/pr18689.sh: Likewise.
100         * testsuite/Makefile.in: Regenerated.
101
102 2015-07-20  Yiran Wang  <yiran@google.com>
103         Cary Coutant  <ccoutant@gmail.com>
104
105         PR gold/15574
106         * resolve.cc (Symbol_table): Remove warning about references
107         from shared objects to hidden symbols.
108         * testsuite/Makefile.am (hidden_test): Add hidden_test.syms.
109         * testsuite/Makefile.in: Regenerate.
110         * testsuite/hidden_test.sh: Check dynamic symbol table; update
111         expected error messages.
112
113 2015-07-14  H.J. Lu  <hongjiu.lu@intel.com>
114
115         * compressed_output.cc (Output_compressed_section::set_final_data_size):
116         Make --compress-debug-sections=zlib the same as
117         --compress-debug-sections=zlib-gabi.
118         * testsuite/Makefile.am (flagstest_compress_debug_sections.check):
119         Expect ".debug_.*" with the SHF_COMPRESSED bit, instead of
120         ".zdebug_".
121         * testsuite/Makefile.in: Regenerated.
122
123 2015-07-12  H.J. Lu  <hongjiu.lu@intel.com>
124
125         PR gold/18322
126         * compressed_output.cc (zlib_compress): Add argument for
127         compression header size.  Set header size to compression header
128         size if it isn't 0.  Don't write out the zlib header here.
129         (Output_compressed_section::set_final_data_size): Support
130         zlib-gnu and zlib-gabi compressions.  Pass compression header
131         size to zlib_compress and write out compression header.  Set
132         the SHF_COMPRESSED bit for zlib-gabi compression.  Otherwise
133         clear the SHF_COMPRESSED bit
134         * options.h (compress_debug_sections): Add zlib-gnu and
135         zlib-gabi.
136         * output.h (Output_section::set_flags): New.
137         * testsuite/Makefile.am (check_PROGRAMS): Add
138         flagstest_compress_debug_sections_none,
139         flagstest_compress_debug_sections_gnu and
140         flagstest_compress_debug_sections_gabi.
141         (check_DATA): Add flagstest_compress_debug_sections_none.stdout.
142         flagstest_compress_debug_sections.stdout,
143         flagstest_compress_debug_sections.cmp,
144         flagstest_compress_debug_sections.check,
145         flagstest_compress_debug_sections_gnu.stdout,
146         flagstest_compress_debug_sections_gnu.cmp,
147         flagstest_compress_debug_sections_gnu.check,
148         flagstest_compress_debug_sections_gabi.stdout,
149         flagstest_compress_debug_sections_gabi.cmp and
150         flagstest_compress_debug_sections_gabi.check.
151         (flagstest_compress_debug_sections_none): New.
152         (flagstest_compress_debug_sections_none.stdout): Likewise.
153         (flagstest_compress_debug_sections.stdout): Likewise.
154         (flagstest_compress_debug_sections.check): Likewise.
155         (flagstest_compress_debug_sections.cmp): Likewise.
156         (flagstest_compress_debug_sections_gnu): Likewise.
157         (flagstest_compress_debug_sections_gnu.stdout): Likewise.
158         (flagstest_compress_debug_sections_gnu.check): Likewise.
159         (flagstest_compress_debug_sections_gnu.cmp): Likewise.
160         (flagstest_compress_debug_sections_gabi): Likewise.
161         (flagstest_compress_debug_sections_gabi.stdout): Likewise.
162         (flagstest_compress_debug_sections_gnu.check): Likewise.
163         (flagstest_compress_debug_sections_gnu.cmp): Likewise.
164         * testsuite/Makefile.in: Regenerated.
165
166 2015-07-12  H.J. Lu  <hongjiu.lu@intel.com>
167
168         PR gold/18321
169         * compressed_output.h (decompress_input_section): Add arguments
170         for ELF class, big endian and sh_flags.
171         * compressed_output.cc (decompress_input_section): Likewise.
172         Support the SHF_COMPRESSED section.
173         * dynobj.h (Dynobj): Add elfsize and is_big_endian member
174         functions.
175         * plugin.h (Pluginobj): Likewise.
176         * layout.cc (Layout::get_output_section_flags): Also clear the
177         SHF_COMPRESSED bit.
178         * object.h (Compressed_section_info): Add flag to store sh_flags.
179         (Object): Add pure virtual elfsize and is_big_endian member
180         functions.
181         * object.cc (need_decompressed_section): Don't skip the ".zdebug"
182         prefix here.
183         (build_compressed_section_map): Check SHF_COMPRESSED for
184         uncompressed size.  Store sh_flags in Compressed_section_info.
185         Pass size, big_endian and sh_flags to decompress_input_section.
186         Skip the ".debug"/".zdebug" prefix when passing section name to
187         need_decompressed_section.
188         (Sized_relobj_file<size, big_endian>::do_find_special_section):
189         Don't check ".zdebug_*" sections.
190         (Object::decompressed_section_contents): Pass ELF class, big
191         endian and sh_flags to decompress_input_section.
192         * reloc.cc (Sized_relobj_file<size, big_endian>::write_sections):
193         Likewise.
194         * testsuite/Makefile.am (check_DATA): Add
195         debug_msg_cdebug_gabi.err and gdb_index_test_2_gabi.stdout.
196         (MOSTLYCLEANFILES): Add debug_msg_cdebug_gabi.err and
197         gdb_index_test_2_gabi.stdout.
198         (debug_msg_cdebug_gabi.o): New.
199         (odr_violation1_cdebug_gabi.o): Likewise.
200         (odr_violation2_cdebug_gabi.o): Likewise.
201         (debug_msg_cdebug_gabi.err): Likewise.
202         (check_SCRIPTS): Add gdb_index_test_2_gabi.sh.
203         (gdb_index_test_cdebug_gabi.o): Likewise.
204         (gdb_index_test_2_gabi): Likewise.
205         (gdb_index_test_2_gabi.stdout): Likewise.
206         * testsuite/gdb_index_test_2_gabi.sh: New file.
207         * testsuite/Makefile.in: Regenerated.
208
209 2015-07-09  Han Shen  <shenhan@google.com>
210
211         Use "gold_info" instead of "gold_warning" for erratum fix.
212
213         * aarch64.cc (Target_aarch64::scan_erratum_843419_span): Use
214         'gold_info'.
215         (Target_aarch64::scan_erratum_835769_span): USe 'gold_info'.
216
217 2015-07-09  Han Shen  <shenhan@google.com>
218
219         Drop missing symbol warning for arm/aarch64.
220
221         * aarch64.cc (AArch64_relobj::scan_errata): Drop missing symbol warning.
222         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Drop missing
223         symbol warning.
224
225 2015-07-07  Han Shen  <shenhan@google.com>
226
227         Make gold aarch64 accept long form of mapping symbols.
228
229         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Make legal
230         of mapping symbols.
231
232 2015-06-29  Doug Kwan  <dougkwan@google.com>
233
234         * testsuite/arm_bl_out_of_range.s: Align stub table so that it appears
235           at address expected by test.
236         * testsuite/arm_cortex_a8_b.s: Ditto.
237         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
238         * testsuite/arm_cortex_a8_bl.s: Ditto.
239         * testsuite/arm_cortex_a8_blx.s: Ditto.
240         * testsuite/arm_cortex_a8_local.s: Ditto.
241         * testsuite/arm_fix_v4bx.s: Ditto.
242         * testsuite/arm_unaligned_reloc.s: Ditto.
243         * testsuite/thumb_bl_out_of_range.s: Ditto.
244         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
245         * testsuite/thumb_blx_out_of_range.s: Ditto.
246
247 2015-06-29  Han Shen  <shenhan@google.com>
248
249         Patch for erratum 843419 internal error.
250
251         * aarch64.cc (Erratum_stub::Insn_utilities): New typedef.
252         (Erratum_stub::update_erratum_insn): New method.
253         (Stub_table::relocate_stubs): Modified to place relocated insn.
254         (AArch64_relobj::fix_errata): Modified gold_assert.
255
256 2015-06-12  Han Shen  <shenhan@google.com>
257
258         Fix erratum 835769.
259
260         * aarch64.cc (AArch64_insn_utilities::BYTES_PER_INSN): Move
261         defintion outside class definition.
262         (AArch64_insn_utilities::AARCH64_ZR): New static constant.
263         (AArch64_insn_utilities::aarch64_op31): New member.
264         (AArch64_insn_utilities::aarch64_ra): New member.
265         (AArch64_insn_utilities::aarch64_mac): New member.
266         (AArch64_insn_utilities::aarch64_mlxl): New member.
267         (ST_E_835769): New global enum member.
268         (Stub_table::relocate_stubs): Add 835769 handler.
269         (Stub_template_repertoire::Stub_template_repertoire): Install new
270         stub type.
271         (AArch64_relobj::scan_errata): This func is renamed from
272         scan_erratum_843419.
273         (AArch64_relobj::do_count_local_symbols): Add 835769 handler.
274         (AArch64_relobj::do_relocate_sections): Add 835769 handler.
275         (AArch64_relobj::scan_sections_for_stubs): Add 835769 handler.
276         (Target_aarch64::scan_erratum_835769_span): New method.
277         (Target_aarch64::create_erratum_stub): New method.
278         (Target_aarch64::is_erratum_835769_sequence): New method.
279         (Target_aarch64::scan_erratum_843419_sequence): Move part of the
280         code into create_erratum_stub.
281         * options.h (fix_cortex_a53_835769): New option.
282
283 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
284
285         * aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
286         outside class body.
287         (Reloc_stub::STUB_ADDR_ALIGN): Likewise.
288
289 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
290
291         PR gold/17731
292         * layout.cc (corresponding_uncompressed_section_name): New function.
293         (Layout::choose_output_section): Call it.
294         * layout.h (corresponding_uncompressed_section_name): New function.
295         * script-sections.cc (Input_section_info::set_section_name): Check
296         for compressed debug section (.zdebug style).
297
298 2015-06-11  Jing Yu  <jingyu@google.com>
299
300         * testsuite/Makefile.am: Add -O0 for script_test_12 test.
301         * testsuite/Makefile.in: Regenerate.
302
303 2015-06-11  Davide Italiano  <dccitaliano@gmail.com>
304
305         * gold.h (is_cident): Correct typo.
306
307 2015-06-10  Han Shen  <shenhan@google.com>
308         Patch for erratum-843419 (2 of 2 - fix erratum occurrences).
309
310         Now fixing for 843419 is fully functional.
311
312         The first part of the erratum fix CL is here -
313         https://sourceware.org/ml/binutils/2015-04/msg00229.html
314
315         * aarch64.cc(global enum): New constants representing stub types.
316         (Stub_template): New POD struct.
317         (Stub_template_repertoire): New class.
318         (Stub_base): New class.
319         (Erratum_stub): New class.
320         (Reloc_stub): Refactored to be a subclass of Stub_base.
321         (Reloc_stub::Stub_type): Removed.
322         (Reloc_stub::offset): Moved to Stub_base.
323         (Reloc_stub::set_offset): Moved to Stub_base.
324         (Reloc_stub::destination_address): Moved to Stub_base.
325         (Reloc_stub::set_destination_address): Moved to Stub_base.
326         (Reloc_stub::reset_destination_address): Moved to Stub_base.
327         (Reloc_stub::stub_type): Renamed and moved to Stub_base.
328         (Reloc_stub::stub_size): Renamed and moved to Stub_base.
329         (Reloc_stub::stub_insns): Renamed and moved to Stub_base.
330         (Reloc_stub::write): Moved to Stub_base.
331         (Reloc_stub::invalid_offset): Moved to Stub_base.
332         (Reloc_stub::invalid_address): Moved to Stub_base.
333         (Reloc_stub::stub_type_): Renamed and moved to Stub_base.
334         (Reloc_stub::stub_insns_): Moved to Stub_base.
335         (Reloc_stub::offset_): Moved to Stub_base.
336         (Reloc_stub::destination_address_): Moved to Stub_base.
337         (Stub_table::The_aarch64_relobj): New typedef.
338         (Stub_table::The_erratum_stub): New typedef.
339         (Stub_table::The_erratum_stub_less): New typedef.
340         (Stub_table::The_erratum_stub_set): New typedef.
341         (Stub_table::The_erratum_stub_set_iter): New typedef.
342         (Stub_table::empty): Added emptiness testing for erratum stubs.
343         (Stub_table::add_erratum_stub): New method to add an erratum stub.
344         (Stub_table::find_erratum_stub): New method.
345         (Stub_table::find_erratum_stubs_for_input_section): New method.
346         (Stub_table::erratum_stub_address): New method.
347         (Stub_table::update_date_size_changed_p): Modified to handle erratum stubs.
348         (Stub_table::do_addralign): Modified to handle erratum stubs.
349         (Stub_table::erratum_stubs_): New member.
350         (Stub_table::erratum_stub_size_): New member.
351         (Stub_table::relocate_stubs): Modified to handle erratum stubs.
352         (Stub_table::do_write): Modified to handle erratum stubs.
353         (AArch64_relobj::The_erratum_stub): New typedef.
354         (AArch64_relobj::Erratum_stub_set_iter): New typedef.
355         (AArch64_relobj::fix_errata): New method.
356         (Target_aarch64::The_reloc_stub_type): Removed.
357         (Target_aarch64::The_erratum_stub): New typede.
358         (AArch64_relocate_functions::construct_b): New method.
359
360 2015-06-08  Nick Clifton  <nickc@redhat.com>
361
362         * po/fr.po: New French Translation.
363
364 2015-06-07  Cary Coutant  <ccoutant@gmail.com>
365
366         PR gold/18288
367         * resolve.cc (symbol_to_bits): Remove type parameter; adjust all
368         callers. Don't use STT_COMMON to check for common symbols.
369         (Symbol_table::resolve): Warn if relocatable object has STT_COMMON
370         symbol that's not in a common section.
371         * symtab.h (Symbol::is_common): Don't use STT_COMMON to check for
372         common symbols.
373
374 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
375
376         PR gold/18200
377         * Makefile.am (diststuff): Add target.
378         * Makefile.in: Regenerate.
379
380 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
381
382         PR gold/17498
383         * object.cc (Sized_relobj_file::do_count_local_symbols): Discard
384         temporary locals in merge sections.
385         * options.cc (General_options::parse_discard_all): New method.
386         (General_options::parse_discard_locals): New method.
387         (General_options::parse_discard_none): New method.
388         (General_options::General_options): Initialize discard_locals_.
389         * options.h (--discard-all): Convert to special option.
390         (--discard-locals): Likewise.
391         (--discard-none): New option.
392         (General_options::discard_all): New method.
393         (General_options::discard_locals): New method.
394         (General_options::discard_sec_merge): New method.
395         (General_options::Discard_locals): New enum.
396         (General_options::discard_locals_): New data member.
397
398 2015-06-03  Cary Coutant  <cary@google.com>
399
400         * script-sections.cc (Script_sections::Script_sections): Initialize
401         segments_created_.
402         (Script_sections::create_note_and_tls_segments): Set flag when
403         segments are created.
404         (Script_sections::expected_segment_count): Count PT_INTERP.
405         (Script_sections::attach_sections_using_phdrs_clause): Set flag when
406         segments are created.
407         * script-sections.h (Script_sections::segments_created_): New data
408         member.
409
410 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
411
412         PR gold/15370
413         * script-sections.cc
414         (Output_section_element_input::set_section_addresses): When there
415         are several patterns with no sort spec, put all sections in the same
416         bin.
417         * testsuite/Makefile.am (script_test_12): New testcase.
418         (script_test_12i): New testcase.
419         * testsuite/Makefile.in: Regenerate.
420         * testsuite/script_test_12.t: New test linker script.
421         * testsuite/script_test_12i.t: New test linker script.
422         * testsuite/script_test_12a.c: New test source file.
423         * testsuite/script_test_12b.c: New test source file.
424
425 2015-06-02  Cary Coutant  <ccoutant@gmail.com>
426
427         * nacl.h (Sniff_file): Switch parameters to get_view to get an
428         aligned view.
429
430 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
431
432         PR gold/17819
433         * gold.cc (queue_final_tasks): When --build-id=tree, queue a
434         separate task to schedule the build id computation.
435         * layout.cc (Hash_task::Hash_task): Remove build_id_blocker,
436         add Output_file and offset.
437         (Hash_task::run): Get and release the input views.
438         (Hash_task::is_runnable): Always return NULL (always runnable).
439         (Layout::queue_build_id_tasks): Remove.
440         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
441         parameters; use them instead of class members.
442         (Build_id_task_runner::run): New function.
443         (Close_task_runner::run): Pass array_of_hashes and size_of_hashes
444         to write_build_id.
445         * layout.h (Layout::queue_build_id_tasks): Remove.
446         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
447         parameters.
448         (Layout::array_of_hashes_): Remove.
449         (Layout::size_of_array_of_hashes_): Remove.
450         (Layout::input_view_): Remove.
451         (Build_id_task_runner): New class.
452         (Close_task_runner::Close_task_runner): Add array_of_hashes and
453         size_of_hashes parameters.
454         (Close_task_runner::array_of_hashes_): New data member.
455         (Close_task_runner::size_of_hashes_): New data member.
456         * testsuite/Makefile.am
457         (flagstest_compress_debug_sections_and_build_id_tree): New test.
458         * testsuite/Makefile.in: Regenerate.
459
460 2015-06-01  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
461
462         * merge.cc (get_input_merge_map): Update for data structure change.
463         (get_or_make_input_merge_map): Update for data structure change.
464         * merge.h (Object_merge_map): Use a std::vector<std::pair>> instead of
465         a std::map. Remove first_shnum_, first_map_, second_shnum_, second_map_.
466
467 2015-05-16  Alan Modra  <amodra@gmail.com>
468
469         * reloc.cc (Sized_relobj_file::find_functions): Use function_location.
470         * powerpc.cc (Target_powerpc::do_calls_non_split): New function.
471         (addi_12_1, addis_2_12, addis_12_1, cmpld_7_12_0): New constants.
472         (lis_0): Rename from lis_0_0.
473
474 2015-04-29  Cary Coutant  <cary@google.com>
475             Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
476
477         * gc.h (Garbage_collection::is_section_garbage): Change Object*
478         to Relobj*.
479         (Garbage_collection::add_reference): Likewise.
480         (Garbage_collection::gc_process_relocs): Likewise. Don't push
481         object/shndx pair onto *secvec for dynamic objects. Don't follow
482         relocations pointing to dynamic objects for GC.
483         * icf.cc (Icf::find_identical_sections): Change Object* to Relobj*.
484         (Icf::unfold_section): Likewise.
485         (Icf::is_section_folded): Likewise.
486         (Icf::get_folded_section): Likewise.
487         * icf.h: (Icf::get_folded_section): Likewise.
488         (Icf::unfold_section): Likewise.
489         (Icf::is_section_folded): Likewise.
490         (Icf::section_has_function_pointers): Likewise.
491         (Icf::set_section_has_function_pointers): Likewise.
492         * object.h (Section_id): Likewise.
493         (Const_section_id): Likewise.
494         * output.cc (Output_section::update_section_layout): Likewise.
495         * output.h: (Output_section_lookup_maps::find_relaxed_input_section):
496         Likewise.
497         * plugin.cc (update_section_order): Likewise.
498         (unique_segment_for_sections): Likewise.
499         * powerpc.cc (Powerpc_relobj::add_reference): Likewise.
500         (Target_powerpc::do_gc_add_reference): Likewise.
501         (Target_powerpc::gc_process_relocs): Likewise.
502         (Target_powerpc::do_gc_add_reference): Likewise.
503         * symtab.cc (Symbol_table::is_section_folded): Likewise.
504         (Symbol_table::gc_mark_symbol): Likewise.
505         * symtab.h: (Symbol_table::is_section_folded): Likewise.
506         * target.h: (Sized_target::gc_add_reference): Likewise.
507         (Sized_target::do_gc_add_reference): Likewise.
508
509 2015-04-29  Nick Clifton  <nickc@redhat.com>
510
511         * po/fi.po: Updated Finnish translation.
512
513 2015-04-28  Alan Modra  <amodra@gmail.com>
514
515         * powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather
516         than unsigned int for find_global_entry result temp.  Compare
517         against invalid_address.
518         (Target_powerpc::do_plt_address_for_global): Likewise.
519         (Target_powerpc::Relocate::relocate): Likewise.  Don't assert
520         on plt call stub existence for debug info.  Do assert for plt
521         and global entry stub existence if an alloc section.
522
523 2015-04-28  Alan Modra  <amodra@gmail.com>
524
525         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert
526         on missing global entry stub due to bogus debug info.
527
528 2015-04-27  Han Shen  <shenhan@google.com>
529
530         * options.h (--fix-cortex-a53-843419): Rename option.
531         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Use renamed
532         option.
533         (AArch64_relobj::scan_sections_for_stubs): Use renamed option.
534
535 2015-04-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
536
537         PR gold/18327
538         * output.cc (Output_section::is_input_address_mapped): Assume a missing
539         entry is mapped.
540         * testsuite/Makefile.am: Add the eh_test test.
541         * testsuite/Makefile.in: Regenerate.
542         * testsuite/eh_test_a.cc: New test.
543         * testsuite/eh_test_b.cc: New test.
544
545 2015-04-23  Sriraman Tallam  <tmsriram@google.com>
546
547         * options.h (--weak-unresolved-symbols): New option.
548         * symtab.cc (Symbol_table::sized_write_globals): Change symbol
549         binding to weak with new option.
550         * symtab.h (is_weak_undefined): Check for new option.
551         (is_strong_undefined): Check for new option.
552         * testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
553         * testsuite/Makefile.in: Regenerate.
554         * testsuite/weak_unresolved_symbols_test.cc: New file.
555
556 2015-04-20  Ian Coolidge  <icoolidge@google.com>
557
558         * symtab.cc (Symbol::should_add_dynsym_entry): Return true for
559         GNU_UNIQUE.
560
561 2015-04-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
562
563         * gc.cc (Garbage_collection::do_transitive_closure): Use back and
564         push_back.
565         * gc.h (Garbage_collection): Use a std::vector instead of a std::queue.
566         * object.cc (Sized_relobj_file::do_layout): Use push_back.
567         * powerpc.cc (process_gc_mark): Use push_back.
568         (Target_powerpc::do_gc_mark_symbol): Use push_back.
569         * symtab.cc (Symbol_table::gc_mark_symbol): Use push_back.
570
571 2015-04-16  Han Shen  <shenhan@google.com>
572
573         * aarch64.cc (AArch64_insn_utilities): New utility class.
574         (AArch64_relobj::Mapping_symbol_position): New struct.
575         (AArch64_relobj::Mapping_symbol_info): New typedef.
576         (AArch64_relobj::do_count_local_symbols): New function overriding
577         parent's implementation.
578         (AArch64_relobj::mapping_symbol_info_): New member
579         (AArch64_relobj::scan_erratum_843419): New method.
580         (Target_aarch64::scan_erratum_843419_span): New method.
581         (Target_aarch64::is_erratum_843419_sequence): New method.
582         * options.h (fix_cortex_a53): New option.
583
584 2015-04-09  Cary Coutant  <ccoutant@google.com>
585
586         * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
587         in a PIE link.
588         * testsuite/Makefile.am (tls_pie_test.sh): New test.
589         * testsuite/Makefile.in: Regenerate.
590         * testsuite/tls_pie_test.sh: New.
591
592 2015-04-09  Cary Coutant  <ccoutant@google.com>
593
594         * debug.h (DEBUG_LOCATION): New.
595         (DEBUG_ALL): Include DEBUG_LOCATION.
596         (debug_string_to_enum): Add DEBUG_LOCATION.
597         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
598         output to print correct context.
599         (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
600         up to 4 more locations at the beginning of the function.
601         * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
602         result before sorting list of line numbers.
603         * testsuite/debug_msg.sh: Allow range of line numbers for
604         canonical results on optimized code.
605
606 2015-04-07  HC Yen <hc.yen@mediatek.com>
607
608         Add AArch32 support for gold linker.
609         gold/
610         * arm.cc: Add V8 arch combine table.
611
612 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
613
614         * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
615
616 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
617
618         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
619         to find by using the return value of insert.
620
621 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
622
623         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
624         constructor call.
625
626 2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>
627
628         PR gold/17641
629         * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
630         (Target_x86_64::Scan::local): Don't create GOT entry, when we
631         can convert mov to lea.
632         (Target_x86_64::Scan::global): Ditto.
633         (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
634         %reg to lea foo(%rip), %reg if possible.
635         * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
636         * testsuite/x86_64_mov_to_lea1.s: New.
637         * testsuite/x86_64_mov_to_lea2.s: Ditto.
638         * testsuite/x86_64_mov_to_lea3.s: Ditto.
639         * testsuite/x86_64_mov_to_lea4.s: Ditto.
640         * testsuite/x86_64_mov_to_lea.sh: Ditto.
641
642 2015-04-02  H.J. Lu  <hongjiu.lu@intel.com>
643
644         * configure: Regenerated.
645
646 2015-04-01  Ilya Tocar  <ilya.tocar@intel.com>
647
648         PR gold/17640
649         * i386.cc (Target_i386::can_convert_mov_to_lea): New.
650         (Target_i386::Scan::local): Don't create GOT entry, when we
651         can convert GOT to GOTOFF.
652         (Target_i386::Scan::global): Ditto.
653         (Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
654         lea foo@GOTOFF(%reg), %reg if possible.
655         * testsuite/Makefile.am (i386_mov_to_lea): New test.
656         * testsuite/i386_mov_to_lea1.s: New.
657         * testsuite/i386_mov_to_lea2.s: Ditto.
658         * testsuite/i386_mov_to_lea3.s: Ditto.
659         * testsuite/i386_mov_to_lea4.s: Ditto.
660         * testsuite/i386_mov_to_lea5.s: Ditto.
661         * testsuite/i386_mov_to_lea.sh: Ditto.
662
663 2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>
664
665         * Makefile.am (ZLIB): New.
666         (ZLIBINC): Likewise.
667         (AM_CFLAGS): Add $(ZLIBINC).
668         (AM_CXXFLAGS): Likewise.
669         (ldadd_varldadd_var): Add $(ZLIB).
670         (incremental_dump_LDADD): Likewise.
671         (dwp_LDADD): Likewise.
672         * compressed_output.cc: Don't check HAVE_ZLIB_H to include
673         <zlib.h>.
674         (zlib_compress): Don't check HAVE_ZLIB_H.
675         (zlib_decompress): Likewise.
676         * options.h (compress_debug_sections): Likewise.
677         * configure.ac (AM_CONDITIONAL): Removed.
678         * testsuite/Makefile.am (ZLIB): New.
679         (LDADD): Add $(ZLIB).
680         Don't check HAVE_ZLIB.
681         * Makefile.in: Regenerated.
682         * config.in: Likewise.
683         * configure: Likewise.
684         * testsuite/Makefile.in: Likewise.
685
686 2015-03-30  Jing Yu  <jingyu@google.com>
687
688         * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
689         TLSLD_ADD_DTPREL_LO12_NC.
690         * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
691         _TLS_MODULE_BASE_ point to the start of tls segment.
692         (Target_aarch64::optimize_tls_reloc): Add cases for
693         R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
694         R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
695         (Target_aarch64::Scan::local): Likewise.
696         (Target_aarch64::Scan::global): Likewise.
697         (Target_aarch64::Relocate::relocate): Likewise.
698         (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
699         subtracting tls segment size from symbol value for TLSLD_*_DTPREL
700         relocations.
701
702 2015-03-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
703
704         * merge.cc (Object_merge_map::add_mapping): call
705         Object_merge_map::Input_merge_map::add_mapping.
706         (Object_merge_map::Input_merge_map::add_mapping): New.
707         (Output_merge_data::do_add_input_section): Call
708         get_or_make_input_merge_map before a loop.
709         (Output_merge_string<Char_type>::finalize_merged_data): Call
710         get_or_make_input_merge_map before a loop.
711         * merge.h (Object_merge_map): Make Input_merge_map public.
712         * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
713         (Relobj::get_or_create_merge_map): New.
714         * object.h (Relobj::get_or_create_merge_map): New.
715
716 2015-03-24  Alan Modra  <amodra@gmail.com>
717
718         PR 18147
719         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
720         relocation errors for branches to strong undefined symbols.
721
722 2015-03-23  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
723
724         * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
725         (Object_merge_map::is_merge_section_for): Remove.
726         (Object_merge_map::find_merge_section): New.
727         * merge.h (Object_merge_map::is_merge_section_for): Remove.
728         (Object_merge_map::find_merge_section): New.
729         (Object_merge_map::get_input_merge_map): Add a const version.
730         * object.cc (Relobj::is_merge_section_for): Remove.
731         (Relobj::find_merge_section): New.
732         * object.h (Relobj::is_merge_section_for): Remove.
733         (Relobj::find_merge_section): New.
734         * output.cc
735         (Output_section::Input_section::is_merge_section_for): Remove.
736         (Output_section::add_merge_input_section): Don't call
737         add_merge_input_section.
738         (Output_section::find_merge_section): Return const. Use
739         object->find_merge_section.
740         (Output_section::build_lookup_maps): Don't build a map for
741         merge sections.
742         (Output_section::is_input_address_mapped): Return false if
743         section is not found.
744         (Output_section::find_starting_output_address): Use
745         find_merge_section instead of is_merge_section_for.
746         (Output_section::add_script_input_section):  Don't build a map for
747         merge sections.
748         * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
749         (Output_section_lookup_maps::find_merge_section): Remove.
750         (Output_section_lookup_maps::add_merge_input_section) Remove.
751         (Output_section::find_merge_section): Return const.
752
753 2015-03-22  Cary Coutant  <cary@google.com>
754
755         PR gold/18106
756         * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
757         non-SIB form of lea, with nop after the call.
758
759 2015-03-21  Cary Coutant  <cary@google.com>
760
761         PR gold/14217
762         * output.cc (Output_segment::is_first_section_relro): Don't ignore
763         .tdata section.
764         (Output_segment::set_section_addresses): Don't align size of relro
765         segment for .tbss.
766
767 2015-03-21  Cary Coutant  <cary@google.com>
768
769         PR gold/18010
770         * stringpool.cc (Stringpool_template): Don't optimize if section
771         alignment is greater than sizeof(char).
772
773 2015-03-21  Cary Coutant  <cary@google.com>
774
775         PR gold/18048
776         * script-c.h (script_include_directive): Add first_token parameter.
777         * script.cc (script_include_directive): Add first_token parameter, and
778         pass it to read_script_file.
779         * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
780         (PARSING_MEMORY_DEF): New tokens.
781         (top): Add new productions for INCLUDE files.
782         (file_cmd): Replace file_or_sections_cmd with copy of its productions.
783         Pass PARSING_LINKER_SCRIPT to script_include_directive.
784         (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
785         (section_cmd): Pass PARSING_SECTION_CMDS.
786         (file_or_sections_cmd): Remove.
787         (memory_def): Pass PARSING_MEMORY_DEF.
788         * testsuite/Makefile.am (memory_test_2): New test.
789         * testsuite/Makefile.in: Regenerate.
790         * testsuite/memory_test_inc.t: New script file.
791         * testsuite/memory_test_inc_1.t.src: New script file.
792         * testsuite/memory_test_inc_2.t.src: New script file.
793         * testsuite/memory_test_inc_3.t.src: New script file.
794
795 2015-03-21  Cary Coutant  <cary@google.com>
796
797         * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
798         (Sized_relobj_dwo::setup): Build compressed section map.
799         (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
800         * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
801         section map.
802         * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
803         compressed_sections_ field.
804         (build_compressed_section_map): Take Object instead of
805         Sized_relobj_file parameter; add decompress_if_needed parameter.
806         (Sized_relobj_file::do_find_special_sections): Store compressed
807         section map in parent Object.
808         (Sized_relobj_file::do_decompressed_section_contents): Move
809         implementation to Object::decompressed_section_contents.
810         (Sized_relobj_file::do_discard_decompressed_sections): Move
811         implementation to Object::discard_decompressed_sections.
812         * object.h (build_compressed_section_map): Declare.
813         (Object::Object): Add compressed_sections_ field.
814         (Object::section_is_compressed): Move implementation here.
815         (Object::decompressed_section_contents): De-virtualize.
816         (Object::discard_decompressed_sections): De-virtualize.
817         (Object::do_section_is_compressed): Delete.
818         (Object::do_decompressed_section_contents): Delete.
819         (Object::set_compressed_sections): New method.
820         (Object::compressed_sections): New method.
821         (Object::compressed_sections_): New data member.
822         (Compressed_section_info, Compressed_section_map): Move to top of file.
823         (Sized_relobj_file::do_section_is_compressed): Delete.
824         (Sized_relobj_file::do_decompressed_section_contents): Delete.
825         (Sized_relobj_file::do_discard_decompressed_sections): Delete.
826         (Sized_relobj_file::compressed_sections_): Move to Object class.
827
828 2015-03-21  Cary Coutant  <ccoutant@google.com>
829
830         PR gold/18152
831         * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
832         deferred objects.
833
834 2015-03-11  Cary Coutant  <ccoutant@google.com>
835
836         * options.cc (General_options::finalize): Don't allow -z relro
837         with incremental linking.
838         * testsuite/Makefile.am (incremental_test): Add -z norelro.
839         (incremental_test_2): Likewise.
840         (incremental_test_3): Likewise.
841         (incremental_test_4): Likewise.
842         (incremental_test_5): Likewise.
843         (incremental_test_6): Likewise.
844         (incremental_copy_test): Likewise.
845         (incremental_common_test_1): Likewise.
846         (incremental_comdat_test_1): Likewise.
847         * testsuite/Makefile.in: Regenerate.
848
849 2015-03-09  Cary Coutant  <ccoutant@google.com>
850
851         PR gold/14675
852         * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
853         return enum indicating whether .eh_frame section is empty, optimizable,
854         unrecognized, or an end marker. Adjust explicit instantiations.
855         * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
856         (Eh_frame::add_ehframe_input_section): Change return type.
857         * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
858         * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
859         to the .eh_frame output section until we see the end marker.
860         (Layout::finalize_eh_frame_section): New.
861         * layout.h: (Layout::finalize_eh_frame_section): New.
862
863 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
864
865         * output.cc (Relobj::initialize_input_to_output_map<size>):
866         Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
867
868 2015-03-04  Cary Coutant  <ccoutant@google.com>
869
870         * parameters.cc (Parameters::set_target_once): Call
871         Target::select_as_default_target just once from here...
872         (set_parameters_target): ...instead of from here.
873
874 2015-03-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
875
876         * ehframe.cc (Cie::set_output_offset): Pass in and use a
877         Output_section_data instead of a Merge_map.
878         (Eh_frame::Eh_frame): Don't initialize merge_map_.
879         (Eh_frame::read_cie): Use add_merge_mapping instead of
880         Merge_map::add_mapping.
881         (Eh_frame::read_fde): Ditto.
882         (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
883         (Eh_frame::do_output_offset): Use merge_output_offset istead of
884         merge_map_->get_output_offset.
885         (Eh_frame::do_is_merge_section_for): Delete.
886         * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
887         instead of a Merge_map.
888         (Cie::set_output_offset): Pass in a Output_section_data instead of a
889         Merge_map.
890         (Eh_frame::do_is_merge_section_for): Delete.
891         (Eh_frame::merge_map_): Delete.
892         * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
893         and use a Output_section_data instead of a Merge_map.
894         (Object_merge_map::add_mapping): Ditto.
895         (Object_merge_map::get_output_offset): Remove the merge_map argument.
896         (Object_merge_map::is_merge_section_for): Pass in and use a
897         Output_section_data instead of a Merge_map.
898         (Merge_map): Delete.
899         (Output_merge_base::do_output_offset): Use merge_output_offset instead
900         of merge_map_.get_output_offset.
901         (Output_merge_base::do_is_merge_section_for): Delete.
902         (Output_merge_data::do_add_input_section): Use
903         object->add_merge_mapping instead of add_mapping.
904         (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
905         * merge.h (Merge_map): Delete forward declaration.
906         (Object_merge_map::add_mapping): Pass in and use a Output_section_data
907         instead of a Merge_map.
908         (Object_merge_map::get_output_offset): Remove the merge_map argument.
909         (Object_merge_map::is_merge_section_for): Pass in and use a
910         Output_section_data instead of a Merge_map.
911         (Input_merge_map::Object_merge_map::merge_map): Replace with
912         output_data.
913         (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
914         Output_section_data instead of a Merge_map.
915         (Merge_map): Delete.
916         (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
917         (Output_merge_base::do_is_merge_section_for): Delete.
918         (Output_merge_base::add_mapping): Delete.
919         (Output_merge_base::merge_map_): Delete.
920         * object.cc (Relobj::initialize_input_to_output_map): New.
921         (Relobj::initialize_input_to_output_map): New.
922         (Relobj::merge_output_offset): New.
923         (Relobj::is_merge_section_for): New.
924         (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
925         bits.
926         * object.h (Relobj::merge_map): Delete.
927         (initialize_input_to_output_map): New.
928         (set_merge_map): Delete.
929         (add_merge_mapping): New.
930         (merge_output_offset): New.
931         (is_merge_section_for): New.
932         * output.cc (Output_section::Input_section::is_merge_section_for):
933         Use object->is_merge_section_for.
934         * output.h (Output_section_data::is_merge_section_for): Delete.
935         (Output_section_data::do_is_merge_section_for): Delete.
936         * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
937         Use object->initialize_input_to_output_map.
938         (Merged_symbol_value<size>::value_from_output_section): Use
939         object->merge_output_offset.
940
941 2015-03-02  Peter Collingbourne  <pcc@google.com>
942             Cary Coutant  <ccoutant@google.com>
943
944         * output.cc (Output_section::add_merge_input_section): Do not
945         attempt to merge sections with an entsize of 0.
946
947 2015-03-02  Khem Raj  <raj.khem@gmail.com>
948
949         * attributes.h (class Output_attributes_section_data ): Add
950         do_print_to_mapfile function.
951
952 2015-02-24  Alan Modra  <amodra@gmail.com>
953
954         PR 18010
955         * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
956         complain if value is not a multiple of four.
957         (Target_powerpc::Relocate::relocate): Correct handling of
958         R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
959
960 2015-02-21  H.J. Lu  <hongjiu.lu@intel.com>
961
962         * configure.ac (default_size): Set to 32 for x32.
963         * configure: Regenerated.
964
965 2015-02-18  Alan Modra  <amodra@gmail.com>
966
967         PR 17954
968         * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
969         visibility.
970
971 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
972
973         * gc.h (Garbage_collection::add_reference): Don't use find.
974
975 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
976
977         * object.cc (write_local_symbols): avoid std::vector copy.
978
979 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
980
981         * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
982
983 2015-02-09  Mark Wielaard  <mjw@redhat.com>
984
985         * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
986         DW_LANG_Fortran03 and DW_LANG_Fortran08.
987
988 2015-02-16  Cary Coutant  <ccoutant@google.com>
989
990         PR gold/13577
991         PR gold/16992
992         * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
993         DF_SYMBOLIC if --dynamic-list option is used.
994         * options.cc (General_options::finalize): --dynamic-list is not
995         mutually exclusive with -Bsymbolic.
996         * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
997         listed in --dynamic-list.
998         * testsuite/Makefile.am (dynamic_list_lib2.so): Add
999         -Bsymbolic-functions.
1000         * testsuite/Makefile.in: Regenerate.
1001
1002 2015-02-16  Cary Coutant  <ccoutant@google.com>
1003
1004         PR gold/17971
1005         * incremental.cc: Remove redundant include of "output.h".
1006
1007 2015-02-12  Jing Yu  <jingyu@google.com>
1008
1009         * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
1010         TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
1011         New relocation.
1012         * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
1013         TLSLE_MOVW_* relocations.
1014         (Target_aarch64::Scan::global): Likewise.
1015         (Target_aarch64::Relocate::relocate): Likewise.
1016         (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
1017         for new TLSLE_MOVW_* relocations.
1018
1019 2015-02-11  Will Newton  <will.newton@linaro.org>
1020
1021         PR gold/13321
1022         * arm.cc (Target_arm::make_plt_section): Create an ARM
1023         state mapping symbol at the start of the PLT.
1024
1025 2015-02-09  H.J. Lu  <hongjiu.lu@intel.com>
1026
1027         * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
1028         Replace two_file_shared_2.so with two_file_shared_1.so.
1029         * testsuite/Makefile.in: Regenerated.
1030
1031 2015-02-09  Alan Modra  <amodra@gmail.com>
1032
1033         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
1034         plugin_test_thin.a and defsym_test.
1035         * testsuite/Makefile.in: Regenerate.
1036
1037 2015-02-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1038
1039         * merge.cc (do_add_input_section): Combine loop epilogue into main loop
1040         body.
1041
1042 2015-02-04  Peter Collingbourne  <pcc@google.com>
1043
1044         * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
1045         forwarding symbols when computing symbol resolution info for plugins.
1046         * plugin.h (Plugin_manager::symtab): New method.
1047         (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
1048
1049 2015-02-03  Cary Coutant  <ccoutant@google.com>
1050             Peter Collingbourne  <pcc@google.com>
1051
1052         PR gold/15660
1053         * archive.cc (Thin_archive_object_unlocker): New class.
1054         (Archive::include_member): Unlock external members of thin archives.
1055         * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
1056         (plugin_test_2): Likewise.
1057         (plugin_test_3): Likewise.
1058         (plugin_test_4): Likewise.
1059         (plugin_test_5): Likewise.
1060         (plugin_test_6): Likewise.
1061         (plugin_test_7): Likewise.
1062         (plugin_test_8): Likewise.
1063         (plugin_test_9): Likewise.
1064         (plugin_test_10): Likewise.
1065         (plugin_test_11): New test case.
1066         * testsuite/Makefile.in: Regenerate.
1067         * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
1068         file to decide whether to claim file.
1069         (all_symbols_read_hook): Likewise.
1070         * testsuite/plugin_test_1.sh: Adjust expected output.
1071         * testsuite/plugin_test_2.sh: Likewise.
1072         * testsuite/plugin_test_3.sh: Likewise.
1073         * testsuite/plugin_test_6.sh: Likewise.
1074         * testsuite/plugin_test_tls.sh: Likewise.
1075         * testsuite/plugin_test_11.sh: New testcase.
1076
1077 2015-02-03  Cary Coutant  <ccoutant@google.com>
1078
1079         * descriptors.cc (Descriptors::open): Set artificially-low limit for
1080         file descriptors when debugging enabled. Add debug output.
1081         (Descriptors::release): Add debug output.
1082         (Descriptors::close_some_descriptor): Likewise.
1083         (Descriptors::close_all): Likewise.
1084         * fileread.cc (File_read::lock): Likewise.
1085         (File_read::unlock): Likewise.
1086
1087 2015-02-02  Cary Coutant  <ccoutant@google.com>
1088
1089         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
1090         executable output file.
1091
1092 2015-01-22  Han Shen  <shenhan@google.com>
1093
1094         * arm.cc (Target_arm::Target_arm): Add initialization for new members.
1095         (Target_arm::do_plt_address_for_global): New method.
1096         (Target_arm::do_plt_address_for_local): New method.
1097         (Target_arm::rel_irelative_section): New method.
1098         (Target_arm::make_data_plt): Add more parameters for plt ctor.
1099         (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
1100         (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
1101         (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
1102         (Target_arm::Scan::check_non_pic): Add ifunc support.
1103         (Target_arm::Scan::local): Add ifunc support.
1104         (Target_arm::Scan::global): Add ifunc support.
1105         (Target_arm::make_plt_section): New method.
1106         (Target_arm::make_plt_entry): Change to call to make_plt_section.
1107         (Target_arm::make_local_ifunc_plt_entry): New method.
1108         (Target_arm::got_irelative_): New member.
1109         (Target_arm::rel_irelative_): New member.
1110         (Target_arm::got_section): Add creation for got_irelative_.
1111         (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
1112         (Target_arm::Relocate::relocate): Properly set local ifunc address.
1113         (Target_arm::do_dynsym_value): Properly set global ifunc address.
1114         (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
1115         (Output_data_plt_arm::IRelative_data): New type.
1116         (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
1117         (Output_data_plt_arm::add_entry): Add more parameters.
1118         (Output_data_plt_arm::add_relocation): New method.
1119         (Output_data_plt_arm::add_local_ifunc_entry): New method.
1120         (Output_data_plt_arm::rel_irelative): New method.
1121         (Output_data_plt_arm::entry_count): Modified.
1122         (Output_data_plt_arm::address_for_global): New method.
1123         (Output_data_plt_arm::address_for_local): New method.
1124 gold/
1125         (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
1126         (Output_data_plt_arm::insert_irelative_data): New method.
1127         (Output_data_plt_arm::irelative_rel_): New member.
1128         (Output_data_plt_arm::got_): New member.
1129         (Output_data_plt_arm::got_irelative_): New member.
1130         (Output_data_plt_arm::irelative_count_): New member.
1131         (Output_data_plt_arm::IRelative_data_vec): New typedef.
1132         (Output_data_plt_arm::irelative_data_vec_): New member.
1133         (Output_data_plt_arm::do_write): Write out irelative entries.
1134         (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
1135         more parameters to ctor.
1136         (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
1137         more parameters to ctor.
1138         * output.h (Output_data_reloc::add_local_relative): New method.
1139         * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
1140
1141 2015-01-29  Alan Modra  <amodra@gmail.com>
1142
1143         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
1144         and GOT_TLSGD to LE optimization.
1145
1146 2015-01-28  Cary Coutant  <ccoutant@google.com>
1147
1148         * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
1149         for undef TLS symbols.
1150         (Target_x86_64::Relocate::relocate_tls): Likewise.
1151         (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
1152
1153 2015-01-25  Cary Coutant  <ccoutant@google.com>
1154
1155         * output.cc (Output_segment::set_section_addresses): Fix calculation
1156         of size of relro segment.
1157
1158 2015-01-22  Alan Modra  <amodra@gmail.com>
1159
1160         * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
1161         condition for need of ifunc plt entry.
1162         (Target_powerpc::Scan::global <got relocs>): Likewise.
1163
1164 2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1165
1166         * mips.cc (reloc_high): Add r_sym.
1167         (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
1168         reloc_high constructor.
1169         (Mips_relocate_functions::relgot16_local): Likewise.
1170         (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
1171         r_type to decide whether LO16 matches HI16.
1172         (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
1173         rello16 and relgot16_local.
1174
1175 2015-01-09  Cary Coutant  <ccoutant@google.com>
1176
1177         * layout.cc (Layout::set_segment_offsets): Don't align start of segment
1178         unless alignment is larger than page size.
1179
1180 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1181             Cary Coutant  <ccoutant@google.com>
1182
1183         PR gold/17729
1184         * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
1185         (DEFAULT_TARGET_X32): Set for x32.
1186         * x86_64.cc (cmp_insn_32): New.
1187         (lea_r10_insn_32): Likewise.
1188         (lea_r11_insn_32): Likewise.
1189         (cmp_insn_64): Likewise.
1190         (lea_r10_insn_64): Likewise.
1191         (lea_r11_insn_64): Likewise.
1192         (Target_x86_64<size>::do_calls_non_split): Handle x32.
1193         * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
1194         (check_DATA): Add split_x32 files.
1195         (split_x32_[1234n].o): New targets.
1196         (split_x32_[124]): New targets.
1197         (split_x32_[1234r].stdout): New targets.
1198         * testsuite/split_x32.sh: New file.
1199         * testsuite/split_x32_1.s: Likewise.
1200         * testsuite/split_x32_2.s: Likewise.
1201         * testsuite/split_x32_3.s: Likewise.
1202         * testsuite/split_x32_4.s: Likewise.
1203         * testsuite/split_x32_n.s: Likewise.
1204         * configure: Regenerated.
1205         * testsuite/Makefile.in: Likewise.
1206
1207 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1208
1209         PR gold/17809
1210         * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
1211         x32.
1212
1213 2015-01-02  Alan Modra  <amodra@gmail.com>
1214
1215         * version.cc (print_version): Just print current year.
1216         * dwp.cc (print_version): Likewise.
1217
1218 2015-01-01  Alan Modra  <amodra@gmail.com>
1219
1220         Update year range in copyright notice of all files.
1221
1222 2014-12-25  Alan Modra  <amodra@gmail.com>
1223
1224         * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
1225         new enums.
1226         (Target_arm::merge_object_attributes, ): Likewise.
1227
1228 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
1229
1230         * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
1231         as hard float only when Tag_ABI_VFP_args is 1, using new enum value
1232         AEABI_VFP_args_vfp to check that.
1233         (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
1234         value and replace hardcoded values by enum values.
1235
1236 2014-12-22  Cary Coutant  <ccoutant@google.com>
1237
1238         * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
1239
1240 2014-12-20  H.J. Lu  <hongjiu.lu@intel.com>
1241
1242         PR gold/14608
1243         * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
1244         to "return i * i * 3;".
1245
1246 2014-12-16  Cary Coutant  <ccoutant@google.com>
1247
1248         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
1249         (Mapfile::print_output_data): Use current_data_size() to avoid
1250         assert for sections requiring postprocessing; if address is not valid,
1251         print 0.
1252         (Mapfile::print_output_section): Use current_data_size(); print note
1253         that addresses and sizes are before compression.
1254
1255 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
1256
1257         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1258         Cast current_group_size to unsigned long when reporting error.
1259
1260 2014-12-10  Jing Yu  <jingyu@google.com>
1261
1262         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
1263         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
1264         Update error message.
1265         (Target_aarch64::do_relax): Use absolute value of option
1266         stub_group_size. Replace local variable with class member
1267         stub_group_size_.
1268
1269 2014-12-04  Alan Modra  <amodra@gmail.com>
1270
1271         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
1272         addend of PLTREL24 reloc when not generating a plt stub.  Make
1273         max_branch_offset an "Address".
1274         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
1275         (Target_powerpc::Relocate::relocate): Likewise.
1276
1277 2014-12-04  Alan Modra  <amodra@gmail.com>
1278
1279         PR 17670
1280         * symtab.cc (Symbol::set_undefined): Remove assertion.
1281         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1282         on symbols defined in discarded sections, instead return false.
1283         Rearrange params, update all callers.
1284         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
1285         branches to syms in discarded sections.
1286         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
1287         undefined and flag as discarded.
1288         (Target_powerpc::Relocate::relocate): Localize variable.
1289
1290 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
1291
1292         PR gold/17675
1293         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
1294         * testsuite/Makefile.in: Regenerated.
1295
1296 2014-12-03  Alan Modra  <amodra@gmail.com>
1297
1298         PR 17566
1299         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
1300         when adding dynamic relocations against section symbols.
1301
1302 2014-12-01  Dimitry Ivanov <dimitry@google.com>
1303
1304         * layout.cc (Layout::finish_dynamic_section): When '-z global'
1305         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
1306         * options.h (General_options): New -z option (global).
1307
1308 2014-12-01  Cary Coutant  <ccoutant@google.com>
1309
1310         PR gold/17578
1311         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
1312         is given.
1313         (Layout::create_executable_stack_info): Warn when -z noexecstack is
1314         given but some inputs require executable stack.
1315
1316 2014-11-26  Cary Coutant  <ccoutant@google.com>
1317
1318         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
1319         .debug_str_offsets; strip .debug_gnu_pubnames and
1320         .debug_gnu_pubtypes.
1321         (lines_only_debug_sections): Strip all four new sections.
1322
1323 2014-11-26  Jing Yu  <jingyu@google.com>
1324
1325         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
1326         register to be x0 when to relax TLSDESC_LD64_LO12.
1327
1328 2014-11-26  Alan Modra  <amodra@gmail.com>
1329
1330         * powerpc.cc (struct Stub_table_owner): New.
1331         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
1332         unsigned int vector.  Update all references.
1333         (powerpc_relobj::set_stub_table): Take an unsigned int param
1334         rather than a Stub_table.  Update callers.
1335         (Powerpc_relobj::clear_stub_table): New function.
1336         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
1337         stub_group_size_ vars.
1338         (Target_powerpc::new_stub_table): Delete.
1339         (max_branch_delta): New function, extracted from..
1340         (Target_powerpc::Relocate::relocate): ..here..
1341         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
1342         status on whether stub created successfully.
1343         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
1344         default sizing to..
1345         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
1346         reduce on relax failure.
1347         (Target_powerpc::group_sections): Add "no_size_errors" param.
1348         Use stub_group_size_.  Set up group info in a temp vector,
1349         before building Stub_table vector.  Account for input sections
1350         possibly already converted to relaxed sections.
1351         (Stub_table::init): Delete.  Merge into..
1352         (Stub_table::Stub_table): ..here.
1353         (Stub_table::can_reach_stub): New function.
1354         (Stub_table::add_plt_call_entry): Add "from" parameter and
1355         return true iff stub could be reached.
1356         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
1357         param too.
1358         (Stub_table::clear_stubs): Add "all" param.
1359
1360 2014-11-26  Alan Modra  <amodra@gmail.com>
1361
1362         * powerpc.cc (Stub_control::set_output_and_owner): New function.
1363         (Target_powerpc::group_sections): Use it.
1364
1365 2014-11-25  Cary Coutant  <ccoutant@google.com>
1366
1367         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
1368         (Binary_to_elf::write_symbol): Add st_size parameter.
1369         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
1370
1371 2014-11-25  Cary Coutant  <ccoutant@google.com>
1372
1373         PR gold/17639
1374         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
1375         (Sized_relobj_file::do_layout): Handle deferred sections properly
1376         during GC pass 1. Don't add reloc sections to deferred list twice.
1377         * object.h (Sized_relobj_file::is_deferred_layout): New function.
1378         (Sized_relobj_file::is_deferred_layout_): New data member.
1379
1380 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
1381
1382         PR gold/17619
1383         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
1384         Check PC-relative offset overflow in PLT entry.
1385
1386 2014-11-21  Alan Modra  <amodra@gmail.com>
1387
1388         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
1389         for undefined weaks.
1390
1391 2014-11-20  Alan Modra  <amodra@gmail.com>
1392
1393         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
1394         from --stub-group-size parameter divided by 1024.
1395         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
1396         template parameter.  Update all uses.
1397         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
1398         has_stub_value.  Set for long branches.  Don't report overflow for
1399         branch to undefined weak symbols.  Print info message on
1400         overflowing branch to stub.
1401
1402 2014-11-20  Alan Modra  <amodra@gmail.com>
1403
1404         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
1405
1406 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
1407
1408         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
1409         entry for R_X86_64_GOTPLT64.
1410         (Target_x86_64<size>::Relocate::relocate): Update comments for
1411         R_X86_64_GOTPLT64.
1412
1413 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
1414
1415         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
1416         * plugin.h: add lock definition
1417
1418 2014-10-29  Han Shen  <shenhan@google.com>
1419             Jing Yu   <jingyu@google.com>
1420
1421         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
1422         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1423         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
1424         Symbol::TLS_REF.
1425         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
1426         method.
1427         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
1428         (Target_aarch64::tls_ld_to_le): New method.
1429         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
1430         for 64bit targets.
1431         (Output_data_plt_aarch64::irelative_rel_): New data member.
1432         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
1433         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
1434         (Output_data_plt_aarch64::add_relocation): New method.
1435         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
1436         offset. Add got_irelative size to got size.
1437         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
1438         type string with the new typename.
1439         (AArch64_relocate_functions::update_adr): Replace parameter x with
1440         immed.
1441         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
1442         (AArch64_relocate_functions::reloc_common): New method.
1443         (AArch64_relocate_funcsions::rela_general): Extract common part out
1444         into reloc_common method.
1445         (AArch64_relocate_functions::rela_general): Likewise.
1446         (AArch64_relocate_functions::pcrela_general): Likewise.
1447         (AArch64_relocate_functions::adr): New method.
1448         (AArch64_relocate_functions::adrp): Calculate immed before calling
1449         update_adr.
1450         (AArch64_relocate_functions::adrp): Likewise.
1451         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
1452         comparing x to 0. Calculate immed from ~x when x < 0.
1453         (Target_aarch64::optimize_tls_reloc): Add new cases for
1454         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1455         TLSLD_MOVW_DTPREL_G0_NC.
1456         (Target_aarch64::possible_function_pointer_reloc): Implement this
1457         method.
1458         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
1459         comment.
1460         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
1461         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1462         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1463         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
1464         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1465         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1466         (Target_aarch64::make_plt_entry): Call add_entry with two more
1467         parameters.
1468         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1469         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
1470         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1471         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1472         (Target_aarch64::Relocate::relocate_tls): Add cases for
1473         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1474         TLSLD_MOVW_DTPREL_G0_NC.
1475         * testsuite/icf_safe_so_test.cc: Correct test comment.
1476         * testsuite/icf_safe_test.sh: Add AArch64 arch.
1477
1478 2014-10-22  Alan Modra  <amodra@gmail.com>
1479
1480         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
1481         thread_starter.
1482
1483 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
1484
1485         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
1486
1487 2014-10-17  Cary Coutant  <ccoutant@google.com>
1488
1489         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1490         Add "typename" keyword.
1491
1492 2014-10-15  Han Shen  <shenhan@google.com>
1493             Jing Yu   <jingyu@google.com>
1494
1495         Patch for gold aarch64 backend to support relaxation.
1496         * aarch64-reloc.def: Change format.
1497         * aarch64.cc (class Reloc_stub): New class.
1498         (class Stub_table): New class.
1499         (class AArch64_relobj): New class.
1500         (class AArch64_input_section): New class.
1501         (class AArch64_output_section): New class.
1502         (Target_aarch64::new_stub_table): New method.
1503         (Target_aarch64::new_aarch64_input_section): New method.
1504         (Target_aarch64::find_aarch64_input_section): New method.
1505         (Target_aarch64::scan_section_for_stubs): New method.
1506         (Target_aarch64::scan_reloc_section_for_stubs): New method.
1507         (Target_aarch64::relocate_stub): New method.
1508         (Target_aarch64::current_target): New method.
1509         (Target_aarch64::do_make_elf_object): New method.
1510         (Target_aarch64::do_may_relax): New method.
1511         (Target_aarch64::do_relax): New method.
1512         (Target_aarch64::group_sections): New method.
1513         (Target_aarch64::scan_reloc_for_stub): New method.
1514         (Target_aarch64::do_make_output_section): New method.
1515         (Target_aarch64::stub_tables_): New data member.
1516         (Target_aarch64::aarch64_input_section_map_): New data member.
1517         (AArch64_relocate_functions::maybe_apply_stub): New method.
1518
1519 2014-09-30  Cary Coutant  <ccoutant@google.com>
1520
1521         PR gold/17432
1522         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
1523
1524 2014-09-30  Kito Cheng  <kito@0xlab.org>
1525
1526         PR gold/13597
1527         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
1528         hash table before sysv-style hash table.
1529
1530 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
1531
1532         * options.h (--pic-executable): Add negative to alias to -no-pie.
1533
1534 2014-09-26  Cary Coutant  <ccoutant@google.com>
1535
1536         PR gold/16773
1537         * object.cc (Sized_relobj_file): Compute value of section symbols
1538         for TLS sections the same as TLS symbols.
1539
1540 2014-09-25  Cary Coutant  <ccoutant@google.com>
1541
1542         PR gold/17432
1543         * resolve.cc (Symbol_table::resolve): Override common placeholder
1544         symbols, but adjust sizes.
1545         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
1546         symbols to common lists.
1547
1548 2014-09-24  Alan Modra  <amodra@gmail.com>
1549
1550         * po/POTFILES.in: Regenerate.
1551
1552 2014-09-23  Taiju Tsuiki  <tzik@google.com>
1553             Cary Coutant  <ccoutant@google.com>
1554
1555         PR gold/14860
1556         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
1557         on input_sections_blocker.
1558         * layout.cc (Write_sections_task::locks): Unblock
1559         input_sections_blocker_.
1560         * layout.h (Write_sections_task::Write_sections_task): Add
1561         input_sections_blocker.
1562         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
1563         to DEPENDENCIES.
1564         * testsuite/Makefile.in: Regenerate.
1565
1566 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1567
1568         * testsuite/Makefile.am (plugin_test_10): New test.
1569         * testsuite/Makefile.in: Regenerate
1570         * testsuite/plugin_common_test_2.c (c1): Align to 8.
1571         * testsuite/plugin_test_10.sh: New file.
1572
1573 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1574
1575         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
1576         * resolve.cc (Symbol_table::resolve): Don't override common symbols
1577         during the replacement phase.
1578
1579 2014-09-17  Han Shen  <shenhan@google.com>
1580             Jing Yu  <jingyu@google.com>
1581
1582         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
1583         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
1584         * aarch64.cc (Target_aarch64): Add data members
1585         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
1586         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
1587         constructor.
1588         (Target_aarch64::do_reloc_symbol_index): New method.
1589         (Target_aarch64::do_reloc_addend): New method.
1590         (Target_aarch64::add_tlsdesc_info): New method.
1591         (Target_aarch64::do_dynsym_value): New method.
1592         (Target_aarch64::do_make_data_plt): Add new parameters: got,
1593         got_irelative. Pass them to Output_data_plt_aarch64_standard.
1594         (Target_aarch64::make_data_plt): Add new parameters: got,
1595         got_irelative. Pass them to do_make_data_plt.
1596         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
1597         (Target_aarch64::Relocate:tls_gd_to_le): New method.
1598         (Target_aarch64::Relocate:tls_ie_to_le): New method.
1599         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
1600         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
1601         (Target_aarch64::got_tlsdesc_section): New method.
1602         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1603         (Target_aarch64::define_tls_base_symbol): New method.
1604         (Target_aarch64::reserve_tlsdesc_entries): New method.
1605         (Target_aarch64::got_mod_index_entry): New method.
1606         (Target_aarch64::rela_tlsdesc_section): New method.
1607         (Target_aarch64::rela_irelative_section): New method.
1608         (Target_aarch64::Tlsdesc_info): New struct.
1609         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
1610         relocations and tlsdesc relocations.
1611         (Target_aarch64::optimize_tls_reloc): Implement method.
1612         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
1613         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
1614         in constructor.
1615         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
1616         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
1617         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
1618         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
1619         (Output_data_plt_aarch64::rela_tlsdesc): New method.
1620         (Output_data_plt_aarch64::rela_irelative): New method.
1621         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
1622         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
1623         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
1624         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
1625         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
1626         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
1627         (Output_data_plt_aarch64_standard): New member variables:
1628         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
1629         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
1630         New parameter: got, got_irelative.
1631         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
1632         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
1633         (Output_data_plt_aarch64::do_write): Replace got_address with
1634         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
1635         (AArch64_relocate_functions::update_movnz): New method.
1636         (AArch64_relocate_functions): Correct format.
1637         (AArch64_relocate_functions::movnz): New method.
1638         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
1639         before the switch. Add new cases to switch.
1640         Check ie_to_le relaxation on tlsie relocations. Add code handling
1641         tlsgd tlsdesc cases.
1642         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
1643         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
1644         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
1645         Call reloc_name_in_error_message to print unsupported reloc.
1646         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
1647         make_data_plt.
1648         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
1649         relocs. Fill in some more dynamic tags.
1650         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
1651         Skip call tls_get_addr when tlsgd is relaxed.
1652         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
1653         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
1654         tlsdesc->ie relaxation.
1655
1656 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1657
1658         * mips.cc (Target_mips_nacl): New class.
1659         (Target_selector_mips_nacl): New class.
1660         (target_selector_mips32): Rename from target_selector_mips32be and use
1661         Target_selector_mips_nacl instead of Target_selector_mips.
1662         (target_selector_mips32el): Rename from target_selector_mips32 and use
1663         Target_selector_mips_nacl instead of Target_selector_mips.
1664         (target_selector_mips64): Rename from target_selector_mips64be and use
1665         Target_selector_mips_nacl instead of Target_selector_mips.
1666         (target_selector_mips64el): Rename from target_selector_mips64 and use
1667         Target_selector_mips_nacl instead of Target_selector_mips.
1668         (Target_mips::mips_info): Add const attribute.
1669
1670 2014-09-02  Cary Coutant  <ccoutant@google.com>
1671
1672         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
1673         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
1674         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
1675         (Sized_incr_dynobj::do_section_name): Likewise.
1676         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
1677         (Sized_incr_dynobj::do_section_name): Likewise.
1678         * object.h (Object::section_name): Likewise.
1679         (Object::do_section_name): Likewise.
1680         (Sized_relobj_file::do_section_name): Likewise.
1681         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
1682         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
1683
1684 2014-09-02  Cary Coutant  <ccoutant@google.com>
1685
1686         PR gold/17005
1687         * ehframe.cc (Fde::write): Add output_offset parameter.
1688         (Cie::write): Likewise.
1689         (Eh_frame::set_final_data_size): Account for offset within output
1690         section.
1691         (Eh_frame::do_sized_write): Likewise.
1692         * ehframe.h (Fde::write): Add output_offset parameter.
1693         (Cie::write): Likewise.
1694         * output.cc (Output_section::Input_section_sort_entry): Remove
1695         section_has_name_; add output_section_name parameter. Use
1696         output section name for non-input sections.
1697         (Output_section::Input_section_sort_entry::section_has_name): Remove.
1698         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
1699         (Output_section::Input_section_sort_compare): Remove logic for
1700         sections without names.
1701         (Output_section::Input_section_sort_init_fini_compare): Likewise.
1702         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
1703         Likewise.
1704         (Output_section::Input_section_sort_section_name_compare): Likewise.
1705
1706 2014-08-29 Han Shen <shenhan@google.com>
1707            Jing Yu <jingyu@google.com>
1708
1709         * aarch64-reloc-property.cc
1710         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
1711         reference reloc property in the table.
1712         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
1713         3 other entries.
1714         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
1715         2 new overloaded methods.
1716         (Output_data_got_aarch64::do_write): Add code to write out
1717         static relocs.
1718         (class Output_data_got_aarch64::Static_reloc): New class to wrap
1719         static relocs.
1720         (Output_data_got_aarch64::static_relocs): New vector to
1721         hold static relocs.
1722         (Target_aarch64::TCB_SIZE): New const static memeber.
1723         (Target_aarch64::tcb_size): New method.
1724         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
1725         (Target_aarch64::Relocate::relocate_tls): New method.
1726         (Target_aarch64::Scan::local): Add code handling new reloc types.
1727         (Target_aarch64::Scan::global): Add code handling new reloc types.
1728
1729 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
1730
1731         * options.h (-no-pie): Add option.
1732
1733 2014-08-08  Jing Yu  <jingyu@google.com>
1734             Han Shen  <shenhan@google.com>
1735
1736         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
1737         (DEFFILES): add aarch64-reloc.def.
1738         (TARGETSOURCES): Add aarch64-reloc-property.cc.
1739         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
1740         * Makefile.in: Regenerate.
1741         * aarch64-reloc-property.cc: New file.
1742         * aarch64-reloc-property.h: New file.
1743         * aarch64-reloc.def: New file.
1744         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
1745         with tab to make the format consistent.
1746         (Output_data_got_aarch64::symbol_table_): New method.
1747         (Target_aarch64::do_plt_address_for_global): New method.
1748         (Target_aarch64::do_plt_address_for_local): New method.
1749         (Target_aarch64::do_select_as_default_target): New method.
1750         (Target_aarch64::do_make_data_plt): New method.
1751         (Target_aarch64::make_data_plt): New method.
1752         (Output_data_plt_aarch64::has_irelative_section): New method.
1753         (Output_data_plt_aarch64::address_for_global): New method.
1754         (Output_data_plt_aarch64::address_for_local): New method.
1755         (Output_data_plt_aarch64::irelative_rel_): New parameter.
1756         (Output_data_plt_aarch64::add_entry): Implement contents.
1757         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
1758         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
1759         the got_pov entry to plt0.
1760         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
1761         Implement contents.
1762         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
1763         (AArch64_howto): New struct.
1764         (aarch64_howto[]): New static const array.
1765         (AArch64_relocate_functions): New class.
1766         (Target_aarch64::Scan::get_reference_flags): Remove method.
1767         (Target_aarch64::Scan::local): Implement to support a few relocations.
1768         (Target_aarch64::Scan::global): Implement to support a few relocations.
1769         (Target_aarch64::make_plt_section): Implement contents.
1770         (Target_aarch64::make_plt_entry): Implement contents.
1771         (Target_aarch64::do_finalize_sections): Implement contents.
1772         (Target_aarch64::Relocate::relocate): Implement a few relocations.
1773         (Target_aarch64::relocate_section): Implement contents.
1774
1775 2014-08-06  Alan Modra  <amodra@gmail.com>
1776
1777         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
1778
1779 2014-08-06  Alan Modra  <amodra@gmail.com>
1780
1781         PR 13227
1782         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
1783
1784 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
1785
1786         * object.cc (Relobj::is_section_name_included): Add
1787         ".rodata.nptl_version" to not garbage collect this section.
1788
1789 2014-07-08  Cary Coutant  <ccoutant@google.com>
1790
1791         * expression.cc (struct Expression::Expression_eval_info): Add
1792         new fields type_pointer, vis_pointer, and nonvis_pointer.
1793         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
1794         nonvis_pointer parameters. Adjust all calls.
1795         (Symbol_expression::value): Update type, visibility, and nonvis bits
1796         in caller.
1797         * script.cc (Symbol_assignment::sized_finalize): Update type,
1798         visibility, and remaining st_other bits for new symbol.
1799         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
1800         vis_pointer, and nonvis_pointer parameters.
1801         * symtab.h (Symbol::set_type): New method.
1802
1803         * testsuite/Makefile.am (defsym_test): New test.
1804         * testsuite/Makefile.in: Regenerate.
1805         * testsuite/defsym_test.c: New file.
1806         * testsuite/defsym_test.sh: New file.
1807
1808 2014-07-08  Cary Coutant  <ccoutant@google.com>
1809
1810         PR gold/15639
1811         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
1812         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
1813         (Sized_dynobj::base_read_symbols): ...new method.
1814         * object.h (Sized_relobj_file::base_read_symbols): New method.
1815         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
1816         (Sized_relobj_file::base_read_symbols): ...new method.
1817         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
1818         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
1819         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
1820
1821 2014-07-04  Alan Modra  <amodra@gmail.com>
1822
1823         * po/POTFILES.in: Regenerate.
1824
1825 2014-07-02  Jing Yu  <jingyu@google.com>
1826
1827         * aarch64.cc: New file
1828         * Makefile.am (TARGETSOURCES): Add aarch64.cc
1829         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
1830         * Makefile.in: Regenerate.
1831         * configure.tgt: Add entries for aarch64*.
1832         * configure.ac:  Likewise.
1833         * configure: Likewise.
1834
1835 2014-06-27  Alan Modra  <amodra@gmail.com>
1836
1837         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
1838
1839 2014-06-24  Cary Coutant  <ccoutant@google.com>
1840
1841         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
1842         sections.
1843         (Dwo_file::sized_read_unit_index): Likewise.
1844
1845 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1846
1847         * mips.cc: New file.
1848         * Makefile.am (TARGETSOURCES): Add mips.cc
1849         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
1850         * configure.tgt: Add entries for mips*.
1851         * configure.ac: Likewise.
1852         * Makefile.in: Regenerate.
1853         * configure: Likewise.
1854
1855 2014-06-09  Cary Coutant  <ccoutant@google.com>
1856
1857         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
1858         unit_length is within section bounds.
1859
1860 2014-06-09  Cary Coutant  <ccoutant@google.com>
1861
1862         PR gold/16980
1863         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
1864         map.
1865
1866 2014-06-07  Alan Modra  <amodra@gmail.com>
1867
1868         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
1869
1870 2014-06-06  Cary Coutant  <ccoutant@google.com>
1871
1872         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
1873         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
1874         (Dwarf_pubnames_table::read_header): Likewise.
1875         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
1876         .debug_gnu_pubtypes.
1877
1878 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
1879
1880         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
1881         * Makefile.in, configure: Regenerate.
1882
1883 2014-06-03  Alan Modra  <amodra@gmail.com>
1884
1885         * powerpc.cc (addis_12_2): Define.
1886         (Stub_table::do_write): Support fusion on ELFv2 stubs.
1887
1888 2014-06-03  Alan Modra  <amodra@gmail.com>
1889
1890         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
1891         st_other output.
1892
1893 2014-06-02  Alan Modra  <amodra@gmail.com>
1894
1895         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
1896         Only ignore relocs on ELFv1.
1897         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
1898
1899 2014-05-30  Cary Coutant  <ccoutant@google.com>
1900
1901         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
1902         * testsuite/Makefile.in: Regenerate.
1903         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
1904
1905 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
1906
1907         PR gold/16945
1908         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
1909         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
1910
1911 2014-05-15  Alan Modra  <amodra@gmail.com>
1912
1913         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
1914         Compare FDE contents with DW_CFA_nop rather than 0.
1915
1916 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
1917
1918         * symtab.h (may_need_copy_reloc): Remove check for position independent
1919         code.
1920         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
1921         position independence before pc absolute may_need_copy_reloc call.
1922         Add check for executable output befor pc relative may_need_copy_reloc
1923         call.
1924         * i386.cc: Ditto.
1925         * arm.cc: Ditto.
1926         * sparc.cc: Ditto.
1927         * tilegx.cc: Ditto.
1928         * powerpc.cc: Add check for no position independence before
1929         may_need_copy_reloc calls.
1930         * testsuite/pie_copyrelocs_test.cc: New file.
1931         * testsuite/pie_copyrelocs_shared_test.cc: New file.
1932         * Makefile.am (pie_copyrelocs_test): New test.
1933         * Makefile.in: Regenerate.
1934
1935 2014-05-08  Martin Liška  <mliska@suse.cz>
1936
1937         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
1938
1939 2014-05-06  Cary Coutant  <ccoutant@google.com>
1940
1941         PR gold/16900
1942         * i386.cc (Output_data_got_plt_i386): New class.
1943         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
1944         parameter. Change all callers.
1945         (Output_data_plt_i386::layout_): Remove.
1946         (Output_data_plt_i386::got_plt_): Change type.
1947         (Target_i386::got_plt_): Change type. Change all references.
1948         (Target_i386::got_section): Create instance of new class.
1949         (Output_data_got_plt_i386::do_write): New function.
1950         * x86_64.cc (Output_data_got_plt_x86_64): New class.
1951         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
1952         parameter. Change all callers.
1953         (Output_data_plt_x86_64::layout_): Remove.
1954         (Output_data_plt_x86_64::got_plt_): Change type.
1955         (Target_x86_64::got_plt_): Change type. Change all references.
1956         (Target_x86_64::got_section): Create instance of new class.
1957         (Output_data_got_plt_x86_64::do_write): New function.
1958         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
1959         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
1960         class.
1961
1962 2014-05-05  Cary Coutant  <ccoutant@google.com>
1963
1964         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
1965         if we have pubnames/pubtypes.
1966
1967 2014-05-02  Cary Coutant  <ccoutant@google.com>
1968
1969         * defstd.cc (in_segment): Define __ehdr_start here...
1970         * layout.cc (Layout::finalize): ...Instead of here.  Set the
1971         output segment when known.
1972         * resolve.cc (Symbol::override_base_with_special): Remember
1973         the original binding.
1974         * symtab.cc (Symbol::set_output_segment): New function.
1975         (Symbol::set_undefined): New function.
1976         * symtab.h (Symbol::is_weak_undefined): Check original undef
1977         binding.
1978         (Symbol::is_strong_undefined): New function.
1979         (Symbol::set_output_segment): New function.
1980         (Symbol::set_undefined): New function.
1981         * target-reloc.h (is_strong_undefined): Remove.
1982         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
1983         Check for hidden undefs.
1984         (relocate_section): Call Symbol::is_strong_undefined.
1985
1986         * testsuite/Makefile.am (ehdr_start_test_1)
1987         (ehdr_start_test_2, ehdr_start_test_3)
1988         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
1989         * testsuite/Makefile.in: Regenerate.
1990         * testsuite/ehdr_start_def.cc: New source file.
1991         * testsuite/ehdr_start_test.cc: New source file.
1992         * testsuite/ehdr_start_test.t: New linker script.
1993         * testsuite/ehdr_start_test_4.sh: New shell script.
1994
1995 2014-04-23  Cary Coutant  <ccoutant@google.com>
1996
1997         PR gold/16870
1998         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
1999
2000 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2001
2002         * layout.cc (Layout::include_section): Allow a target to decide
2003         whether to include a section.
2004         * target.h (Target::should_include_section): New function.
2005         (Target::do_should_include_section): New function.
2006
2007 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2008
2009         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
2010         inline into ...
2011         (Copy_relocs::emit): ... here.
2012         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
2013         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
2014         (Copy_reloc_entry::entries_): Change from private to protected.
2015
2016 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
2017
2018         * icf.cc (get_section_contents): Replace copies of reloc
2019         vectors with const references.
2020
2021 2014-04-02  Cary Coutant  <ccoutant@google.com>
2022
2023         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
2024         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
2025         * configure: Regenerate.
2026         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
2027         -fno-use-linker-plugin.
2028         (LINK1, CXXLINK1): Add it to the link command.
2029         * testsuite/Makefile.in: Regenerate.
2030
2031 2014-03-12  Alan Modra  <amodra@gmail.com>
2032
2033         * Makefile.in: Regenerate.
2034
2035 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2036
2037         * symtab.h (Symbol::set_nonvis): New function.
2038
2039 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2040
2041         * symtab.cc (Sized_symbol<32>::init_output_data):
2042         Instantiate the template.
2043         (Sized_symbol<64>::init_output_data): Likewise.
2044
2045 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2046
2047         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
2048         adjust dynamic symbol value.
2049         * target.h (Target::adjust_dyn_symbol): New function.
2050         (Target::do_adjust_dyn_symbol): New function.
2051
2052 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2053
2054         * output.cc (Output_data_dynamic::Dynamic_entry::write):
2055         Get the value of DYNAMIC_CUSTOM dynamic entry.
2056         * output.h (Output_data_dynamic::add_custom): New function.
2057         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
2058         dynamic entry.
2059         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
2060         * target.h (Target::dynamic_tag_custom_value): New function.
2061         (Target::do_dynamic_tag_custom_value): New function.
2062
2063 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2064
2065         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
2066         dynsym indexes.
2067         * target.h (Target::has_custom_set_dynsym_indexes): New function.
2068         (Target::do_has_custom_set_dynsym_indexes): New function.
2069         (Target::set_dynsym_indexes): New function.
2070         (Target::do_set_dynsym_indexes): New function.
2071
2072 2014-03-07  Alan Modra  <amodra@gmail.com>
2073
2074         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
2075         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
2076         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
2077         (Powerpc_relocate_functions::has_overflow_bitfield,
2078         overflowed): Use the above.
2079         (Target_powerpc::Relocate::relocate): Correct overflow checking
2080         for a number of relocations.  Modify overflow test for 16-bit
2081         fields in instructions to signed/unsigned according to whether
2082         the field takes a signed or unsigned value.
2083
2084 2014-03-05  Alan Modra  <amodra@gmail.com>
2085
2086         Update copyright years.
2087
2088 2014-03-05  Alan Modra  <amodra@gmail.com>
2089
2090         * powerpc.cc (Target_powerpc::Scan::local, global): Support
2091         R_PPC64_ADDR64_LOCAL.
2092         (Target_powerpc::Relocate::relocate): Likewise.
2093
2094 2014-03-03  Alan Modra  <amodra@gmail.com>
2095
2096         * dwp.cc (print_version): Update copyright year to current.
2097
2098 2014-02-10  Alan Modra  <amodra@gmail.com>
2099
2100         * po/gold.pot: Regenerate.
2101
2102 2014-02-06  Cary Coutant  <ccoutant@google.com>
2103
2104         Fix problem where -u is ignored when a weak undef is seen.
2105
2106         * archive.cc (Library_base::should_include_member): Reorder
2107         code to check for -u option if a weak undef has already been seen.
2108         * testsuite/Makefile.am (weak_undef_test_2): New test case.
2109         * testsuite/Makefile.in: Regenerate.
2110         * testsuite/weak_undef_file3.cc: New file.
2111         * testsuite/weak_undef_file4.cc: New file.
2112         * testsuite/weak_undef_test_2.cc: New file.
2113
2114 2014-02-05  Cary Coutant  <ccoutant@google.com>
2115
2116         Fix issues with gold undefined symbol diagnostics.
2117
2118         PR binutils/15435
2119         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
2120         check to here.
2121         * target-reloc.h (is_strong_undefined): New function.
2122         (relocate_section): Move undef vtable symbol check from here.
2123         Check for is_strong_undefined.
2124
2125 2014-02-05  Cary Coutant  <ccoutant@google.com>
2126
2127         Fix problems with the --dynamic-list option.
2128
2129         PR gold/13577
2130         * options.cc (General_options::parse_dynamic_list):
2131         Set have_dynamic_list_.
2132         (General_options::General_options): Initialize have_dynamic_list_.
2133         (General_options::finalize): Turn off -Bsymbolic and
2134         -Bsymbolic-functions if --dynamic-list provided.
2135         * options.h (General_options::have_dynamic_list): New function.
2136         (General_options::have_dynamic_list_): New data member.
2137         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
2138         correctly.
2139
2140         PR gold/16530
2141         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
2142         in --dynamic-list, mark it.
2143
2144         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
2145         (dynamic_list_2): New test case.
2146         * testsuite/Makefile.in: Regenerate.
2147         * testsuite/dynamic_list_2.cc: New file.
2148         * testsuite/dynamic_list_2.t: New file.
2149         * testsuite/dynamic_list_lib1.cc: New file.
2150         * testsuite/dynamic_list_lib2.cc: New file.
2151         * testsuite/gc_dynamic_list_test.c: New file.
2152         * testsuite/gc_dynamic_list_test.sh: New file.
2153         * testsuite/gc_dynamic_list_test.t: New file.
2154
2155 2014-01-28  Cary Coutant  <ccoutant@google.com>
2156
2157         Add .gdb_index version 7 support.
2158
2159         * gold/dwarf_reader.cc: include <utility> (for make_pair).
2160         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
2161         debug sections.
2162         (Dwarf_ranges_table::read_ranges_table): Likewise.
2163         (Dwarf_pubnames_table::read_section): Check for GNU-style
2164         sections, and for compressed debug sections.
2165         (Dwarf_pubnames_table::read_header): Compute end address of table.
2166         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
2167         for end of list by offset, not by offset == 0.
2168         (Dwarf_info_reader::do_read_string_table): Check for compressed
2169         debug sections.
2170         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2171         Initialize new data members.
2172         (Dwarf_pubnames_table::next_name): return flag_byte.
2173         (Dwarf_pubnames_table::end_of_table_): New data member.
2174         (Dwarf_pubnames_table::is_gnu_style_): New data member.
2175         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
2176         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
2177         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
2178         read skeleton type unit DIEs.
2179         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
2180         (Gdb_index::do_write): Write flag_byte.
2181         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
2182         (Gdb_index::Cu_vector): Store flags along with cu indexes.
2183         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
2184         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
2185
2186 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
2187
2188         * version.cc (print_version): Update copyright year to 2014.
2189
2190 2013-12-19  Dimitry Andric  <dimitry@andric.com>
2191
2192         * stringpool.cc (Stringpool_template::reserve): Add
2193         HAVE_UNORDERED_MAP case.
2194         * stringpool.cc (Stringpool_template::print_stats): Likewise.
2195
2196 2013-12-18  Cary Coutant  <ccoutant@google.com>
2197
2198         * configure.ac: Check for <unordered_set> and <unordered_map>.
2199         * config.in: Regenerate.
2200         * configure: Regenerate.
2201         * system.h: Use <unordered_set> and <unordered_map> if available.
2202
2203 2013-12-10  Roland McGrath  <mcgrathr@google.com>
2204
2205         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
2206         with $(INSTALL_PROGRAM_ENV).
2207         * Makefile.in: Regenerate.
2208
2209 2013-11-22  Cary Coutant  <ccoutant@google.com>
2210
2211         * configure.ac: Add check for which library is needed for
2212         dlopen.
2213         * configure: Regenerate.
2214
2215 2013-11-22  Cary Coutant  <ccoutant@google.com>
2216
2217         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
2218         assembler.
2219         * testsuite/Makefile.in: Regenerate.
2220
2221 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
2222
2223         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
2224         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
2225         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
2226         (Target_x86_64<size>::Scan::local): Likewise.
2227         (Target_x86_64<size>::Scan::global): Likewise.
2228         (Target_x86_64<size>::Relocate::relocate): Likewise.
2229         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
2230         Likewise.
2231         (Target_x86_64<size>::Scan::check_non_pic(): Handle
2232         R_X86_64_PC32_BND.
2233
2234         * testsuite/Makefile.am (check_PROGRAMS): Add
2235         exception_x86_64_bnd_test.
2236         (exception_x86_64_bnd_test_SOURCES): New macro.
2237         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
2238         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
2239         (exception_x86_64_bnd_test_LDADD): Likewise.
2240         (exception_x86_64_bnd_1.o): New rule.
2241         (exception_x86_64_bnd_2.o): Likewise.
2242         * testsuite/Makefile.in: Regenerated.
2243
2244 2013-11-15  Alan Modra  <amodra@gmail.com>
2245
2246         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
2247         accessor.
2248         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
2249         Only call ppc64_local_entry_offset for 64-bit.  Restrict
2250         symval_for_branch lookup to ELFv1.
2251         (Stub_table::add_plt_call_entry): Use unsigned int off.
2252         (Output_data_glink::Address, invalid_address): New.
2253         (Output_data_glink::add_eh_frame): Move out of line.  Add
2254         support for ELFv2.
2255         (Output_data_glink::add_global_entry, find_global_entry,
2256         global_entry_address): New functions.
2257         (Output_data_glink::global_entry_stubs_, end_branch_table_,
2258         ge_size): New variables.
2259         (Output_data_glink::set_final_data_size): Add global entry
2260         stub sizing.
2261         (Output_data_glink::do_write): Write global entry stubs.
2262         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
2263         parameter.  Return true for ELFv2.  Adjust callers.
2264         (Target_powerpc::Scan::local, global): Restrict opd lookup to
2265         ELFv1.  Similarly for ifunc and dynamic relocation processing
2266         specific to ELFv1.  Recognize that symbols are defined on
2267         their plt entries for ELFv2.
2268         (Target_powerpc::symval_for_branch): Assert if called for
2269         ELFv2 or ppc32.
2270         (Target_powerpc::Relocate::relocate): Use global entry plt
2271         stub for symbol value if such exists on ELFv2.
2272         (Target_powerpc::Relocate::relocate): Don't call
2273         symval_for_branch when ELFv2.  Do adjust for local entry
2274         offset when ELFv2.
2275         (Target_powerpc::do_dynsym_value): Set symbols to global entry
2276         plt stub for ELFv2.
2277         (Target_powerpc::do_plt_address_for_global): Similarly.
2278
2279 2013-11-14  Cary Coutant  <ccoutant@google.com>
2280
2281         Revert patch -- this did not fix the problem, and there is
2282         no race there.
2283
2284         2013-11-14  Cary Coutant  <ccoutant@google.com>
2285
2286             PR gold/14860
2287             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2288             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2289             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2290             updating fde_offsets_.
2291             (Eh_frame_hdr::lock_): New data member.
2292
2293 2013-11-14  Cary Coutant  <ccoutant@google.com>
2294
2295         * dwp.cc (Dwo_file_entry): New type.
2296         (File_list): Use Dwo_file_entry.
2297         (Dwo_file::verify): New function.
2298         (Dwo_file::verify_dwo_list): New function.
2299         (Dwo_file::sized_verify_dwo_list): New function.
2300         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
2301         list.
2302         (Dwp_options): New enum type.
2303         (dwp_options): Add --verify-only.
2304         (usage): Likewise.
2305         (main): Likewise.
2306         * dwp.h (gold_info): Add declaration.
2307
2308 2013-11-14  Cary Coutant  <ccoutant@google.com>
2309
2310         PR gold/14860
2311         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2312         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2313         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2314         updating fde_offsets_.
2315         (Eh_frame_hdr::lock_): New data member.
2316
2317 2013-11-06  Cary Coutant  <ccoutant@google.com>
2318
2319         PR gold/15758
2320         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
2321         before reloc sections.
2322
2323 2013-11-04  Alan Modra  <amodra@gmail.com>
2324
2325         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
2326         (Symbol::needs_dynamic_reloc): Test new flag.
2327         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
2328         (Target_powerpc::Scan::get_reference_flags): Add target param.
2329         Return FUNC_DESC_ABI for 64-bit ELFv1.
2330         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
2331         call.
2332         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
2333         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
2334
2335 2013-10-31  Cary Coutant  <ccoutant@google.com>
2336
2337         Restore support for dwp v2 DWARF package file format.
2338
2339         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2340         tu_length parameter.  Adjust all callers.
2341         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2342         * dwp.cc: Include dwarf.h.
2343         (Section_bounds): New struct type.
2344         (Unit_set): New struct type.
2345         (Dwo_file::Dwo_file): Initialize new data member.
2346         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2347         Combine and rename to...
2348         (Dwo_file::read_unit_index): ...this.
2349         (Dwo_file::sized_read_compunit_index)
2350         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2351         (Dwo_file::sized_read_unit_index): ...this.
2352         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2353         parameters; add section_id parameter.
2354         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2355         (Dwo_file::add_unit_set): ...this.
2356         (Dwo_file::shndx_map_): Remove.
2357         (Dwo_file::sect_offsets_): New data member.
2358         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2359         (Dwp_output_file::add_section): Rename to...
2360         (Dwp_output_file::add_contribution): ...this.
2361         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2362         (Dwp_output_file::add_tu_set): Likewise.
2363         (Dwp_output_file::Contribution): New type.
2364         (Dwp_output_file::Section::contributions): New data member.
2365         (Dwp_output_file::Cu_or_tu_set): Remove.
2366         (Dwp_output_file::Section::Section): New ctor.
2367         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2368         (Dwp_output_file::Dwp_index::Section_table): New type.
2369         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2370         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2371         parameter.
2372         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2373         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2374         (Dwp_output_file::Dwp_index::section_table): New member function.
2375         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2376         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2377         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2378         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2379         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2380         (Dwp_output_file::Dwp_index::section_table_): New data member.
2381         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2382         (Dwp_output_file::add_output_section): New member function.
2383         (Dwp_output_file::write_new_section): New member function.
2384         (Dwp_output_file::write_contributions): New member function.
2385         (Dwp_output_file::section_id_map_): New data member.
2386         (class Dwo_id_info_reader): Remove.
2387         (class Unit_reader): New class.
2388         (get_dwarf_section_name): New function.
2389         (Dwo_file::read_executable): Adjust initializations of class data.
2390         (Dwo_file::read): Add support for v2 package file format.
2391         (Dwo_file::read_unit_index): Likewise.
2392         (Dwo_file::sized_read_unit_index): Likewise.
2393         (Dwo_file::copy_section): Likewise.
2394         (Dwo_file::add_unit_set): Likewise.
2395         (Dwp_output_file::add_output_section): Likewise.
2396         (Dwp_output_file::add_contribution): Likewise.
2397         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2398         for empty slot.
2399         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2400         file format.
2401         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2402         slot.
2403         (Dwp_output_file::initialize): Remove unused function.
2404         (Dwp_output_file::finalize): Add support for v2 package file format.
2405         (Dwp_output_file::write_index): Likewise.
2406         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2407         function prototype.
2408
2409 2013-10-31  Cary Coutant  <ccoutant@google.com>
2410
2411         * configure.ac: Fix check for -fmerge-constants.
2412         * configure.ac: Regenerate.
2413
2414 2013-10-30  Roland McGrath  <mcgrathr@google.com>
2415
2416         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
2417         Correct 9-byte nop sequence to match what the assembler generates.
2418
2419 2013-10-30  Alan Modra  <amodra@gmail.com>
2420
2421         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
2422         ppc64_local_entry_offset, ppc64_local_entry_offset,
2423         do_read_symbols): New functions.
2424         (Powerpc_relobj::e_flags_, st_other_): New vars.
2425         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
2426         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
2427         (Powerpc_relobj::e_flags_): New var.
2428         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
2429         and adjust for ELFv2.
2430         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
2431         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
2432         (Powerpc_dynobj::do_find_special_sections): Likewise.
2433         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
2434         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
2435         to ELFv2 local entry.
2436         (Target_powerpc::do_relax): No thread safe barriers needed for
2437         ELFv2.
2438         (Output_data_plt_powerpc::initial_plt_entry_size_,
2439         plt_entry_size): Delete.  Replace all uses with
2440         first_plt_entry_offset() and plt_entry_size().
2441         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
2442         reserved_size parm.  Update callers.
2443         (Output_data_plt_powerpc::entry_count): Update.
2444         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
2445         and use Target_powerpc::first_plt_entry_offset().
2446         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
2447         rename to plt_entry_size.
2448         (Output_data_plt_powerpc::add_ifunc_entry,
2449         add_local_ifunc_entry): Adjust reloc for ELFv2.
2450         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
2451         (glink_eh_frame_fde_64v2): New.
2452         (Stub_table::plt_call_size): Support ELFv2 sizing.
2453         (Output_data_glink::add_eh_frame): Use the new FDE.
2454         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
2455         (Stub_table::do_write): Write ELFv2 stubs and glink.
2456         (Target_powerpc::Relocate::relocate): Replaces nop after call
2457         with ld 2,24(1) and adjust local offset destination for ELFv2.
2458
2459 2013-10-30  Alan Modra  <amodra@gmail.com>
2460
2461         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
2462         (Target_powerpc::Scan::global, local): Likewise.
2463         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
2464         on all ppc64 @h and @ha relocs.
2465
2466 2013-10-14  Alan Modra  <amodra@gmail.com>
2467
2468         * output.h (Output_data_got::add_constant): Tidy.
2469         (Output_data_got::add_constant_pair): New function.
2470         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
2471         methods used so as to first call reserve_ent().
2472
2473 2013-10-11  Roland McGrath  <mcgrathr@google.com>
2474
2475         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
2476         add_got_entry and add_got_entry_pair.
2477
2478         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
2479         (HAVE_PUBNAMES): Likewise.
2480         * configure: Regenerate.
2481
2482         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
2483         * testsuite/Makefile.in: Regenerate.
2484
2485         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
2486         Remove const from declaration.
2487         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
2488         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
2489         * output.h (Output_file_header): Remove const from member target_
2490         and corresponding constructor argument.
2491         * output.cc (Output_file_header::Output_file_header): Update prototype.
2492         (Output_file_header::do_sized_write): Use this->target_ in place
2493         of parameters()->target().
2494
2495         * testsuite/undef_symbol.cc (Foo::get_a): New method.
2496
2497         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
2498         * configure: Regenerate.
2499         * Makefile.in: Regenerate.
2500         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
2501         * testsuite/merge_string_literals_2.c: Likewise.
2502         * testsuite/Makefile.am
2503         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
2504         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
2505         literal -fmerge-constants.
2506         * testsuite/Makefile.in: Regenerate.
2507
2508         * i386.cc (Target_i386): Remove unused member dynbss_.
2509         * arm.cc (Target_arm): Likewise.
2510         * powerpc.cc (Target_powerpc): Likewise.
2511         * sparc.cc (Target_sparc): Likewise.
2512         * tilegx.cc (Target_tilegx): Likewise.
2513         * x86_64.cc (Target_x86_64): Likewise.
2514         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
2515         type_signature_, type_offset_.
2516         * plugin.h (Plugin_hook): Remove unused member layout_.
2517         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
2518         mapfile_.
2519         (Read_member): Remove unused members input_objects_, symtab_,
2520         mapfile_, layout_.
2521         (Check_library): Remove unused member symtab_.
2522         * archive.h (Lib_group): Remove unused member lib_.
2523         * archive.cc (Lib_group::Lib_group): Update initializer.
2524         * incremental.h (Incremental_binary): Remove unused member target_.
2525         (Incremental_script_entry): Removed unused member script_.
2526         * layout.h (Write_symbols_task): Remove unused member input_objects_.
2527         * icf.h (Icf): Remove unused member num_tracked_relocs.
2528
2529         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
2530         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
2531         its only use.
2532         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
2533
2534         * archive.h: Use struct rather than class for forward declaration
2535         of Read_symbols_data.
2536
2537 2013-10-07  Cary Coutant  <ccoutant@google.com>
2538
2539         PR gold/16010
2540         * testsuite/Makefile.am (icf_test): Fix dependencies.
2541         (icf_safe_test): Likewise.
2542         (icf_safe_so_test): Likewise.
2543         (large_symbol_alignment): Add empty _LDADD rule.
2544         * testsuite/Makefile.in: Regenerate.
2545
2546 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
2547
2548         PR gold/15927
2549         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
2550         relocation for R_X86_64_32 on x32.
2551
2552 2013-08-27  Roland McGrath  <mcgrathr@google.com>
2553
2554         * output.cc (Output_segment::set_section_addresses): Take new
2555         Target* argument.  If target->isolate_execinstr() and the segment
2556         is executable and starts at a target->abi_pagesize() boundary,
2557         pad its end out to a target->abi_pagesize() boundary with code fill.
2558         * output.h (Output_segment::set_section_addresses): Update decl.
2559         * layout.h (Layout::check_output_data_for_reset_values): Take new
2560         argument RELAX_OUTPUTS.
2561         (Layout): New member relax_output_list_.
2562         (Layout::add_relax_output): New method.
2563         * layout.cc (Layout::Layout): Update constructor.
2564         (Layout::reset_relax_output): New method.
2565         (Layout::clean_up_after_relaxation): Call it.
2566         (Layout::prepare_for_relaxation): Update caller.
2567         (Layout::set_segment_offsets): Update callers of set_section_addresses.
2568         Call reset_relax_output before re-processing segments for
2569         isolate_execinstr case.
2570         (Layout::write_data): Handle relax_output_list_.
2571         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
2572         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
2573
2574 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
2575
2576         PR binutils/15834
2577         * object.h: Fix typos.
2578
2579 2013-08-16  Roland McGrath  <mcgrathr@google.com>
2580
2581         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
2582         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
2583
2584 2013-08-07  Cary Coutant  <ccoutant@google.com>
2585
2586         Revert support for v2 DWP files:
2587
2588         2013-03-01  Cary Coutant  <ccoutant@google.com>
2589
2590             Add dwp support for v2 DWARF package file format.
2591             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2592             tu_length parameter.  Adjust all callers.
2593             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2594             * dwp.cc: Include dwarf.h.
2595             (Section_bounds): New struct type.
2596             (Unit_set): New struct type.
2597             (Dwo_file::Dwo_file): Initialize new data member.
2598             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2599             Combine and rename to...
2600             (Dwo_file::read_unit_index): ...this.
2601             (Dwo_file::sized_read_compunit_index)
2602             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2603             (Dwo_file::sized_read_unit_index): ...this.
2604             (Dwo_file::copy_section): Remove section_name, is_str_offsets
2605             parameters; add section_id parameter.
2606             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2607             (Dwo_file::add_unit_set): ...this.
2608             (Dwo_file::shndx_map_): Remove.
2609             (Dwo_file::sect_offsets_): New data member.
2610             (Dwp_output_file::Dwp_output_file): Initialize new data members.
2611             (Dwp_output_file::add_section): Rename to...
2612             (Dwp_output_file::add_contribution): ...this.
2613             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2614             (Dwp_output_file::add_tu_set): Likewise.
2615             (Dwp_output_file::Contribution): New type.
2616             (Dwp_output_file::Section::contributions): New data member.
2617             (Dwp_output_file::Cu_or_tu_set): Remove.
2618             (Dwp_output_file::Section::Section): New ctor.
2619             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2620             (Dwp_output_file::Dwp_index::Section_table): New type.
2621             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2622             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2623             parameter.
2624             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2625             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2626             (Dwp_output_file::Dwp_index::section_table): New member function.
2627             (Dwp_output_file::Dwp_index::section_table_end): New member function.
2628             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2629             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2630             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2631             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2632             (Dwp_output_file::Dwp_index::section_table_): New data member.
2633             (Dwp_output_file::Dwp_index::section_mask_): New data member.
2634             (Dwp_output_file::add_output_section): New member function.
2635             (Dwp_output_file::write_new_section): New member function.
2636             (Dwp_output_file::write_contributions): New member function.
2637             (Dwp_output_file::section_id_map_): New data member.
2638             (class Dwo_id_info_reader): Remove.
2639             (class Unit_reader): New class.
2640             (get_dwarf_section_name): New function.
2641             (Dwo_file::read_executable): Adjust initializations of class data.
2642             (Dwo_file::read): Add support for v2 package file format.
2643             (Dwo_file::read_unit_index): Likewise.
2644             (Dwo_file::sized_read_unit_index): Likewise.
2645             (Dwo_file::copy_section): Likewise.
2646             (Dwo_file::add_unit_set): Likewise.
2647             (Dwp_output_file::add_output_section): Likewise.
2648             (Dwp_output_file::add_contribution): Likewise.
2649             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2650             for empty slot.
2651             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2652             file format.
2653             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2654             slot.
2655             (Dwp_output_file::initialize): Remove unused function.
2656             (Dwp_output_file::finalize): Add support for v2 package file format.
2657             (Dwp_output_file::write_index): Likewise.
2658             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2659             function prototype.
2660
2661 2013-07-31  Cary Coutant  <ccoutant@google.com>
2662
2663         * object.cc (Sized_relobj::do_output_section_address): New function.
2664         (Sized_relobj): Instantiate explicitly.
2665         * object.h (Object::output_section_address): New function.
2666         (Object::do_output_section_address): New function.
2667         (Sized_relobj::do_output_section_address): New function.
2668         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
2669
2670 2013-07-30  Cary Coutant  <ccoutant@google.com>
2671             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2672
2673         * parameters.cc (Parameters::entry): Return target-specific entry
2674         symbol name.
2675         * target.h (Target::entry_symbol_name): New function.
2676         (Target_info::entry_symbol_name): New data member.
2677
2678         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
2679         * i386.cc (Target_i386::i386_info): Likewise.
2680         (Target_i386_nacl::i386_nacl_info): Likewise.
2681         * sparc.cc (Target_sparc::sparc_info): Likewise.
2682         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
2683         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
2684         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
2685         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2686
2687 2013-07-22  Sterling Augustine  <saugustine@google.com>
2688
2689         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
2690         Convert parameter shndx to local variable. Add parameters symtab
2691         and symtab_size.  Scan over section names.  Find relocation
2692         section corresponding to current section.  Create and initialize
2693         reloc_mapper_ and reloc_type_.
2694         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
2695         unit_length to off_t.  Initialize member unit_length_.  Fill in field
2696         cu_offset_.
2697         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2698         Initialize new fields unit_length_ and cu_offset_.
2699         (Dwarf_pubnames_table::read_section): Update prototype.
2700         (Dwarf_pubnames_table::cu_offset): New member function.
2701         (Dwarf_pubnames_table::subsection_size): Likewise.
2702         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
2703         New fields.
2704         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
2705         member functions public.
2706         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
2707         Update comment.  Rework logic.  Move repeated parts to...
2708         (Gdb_index_info_reader::read_pubtable): ...here. New function.
2709         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
2710         pubtypes_table_, and stmt_list_offset.
2711         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2712         Gdb_index::find_pubtype_offset,
2713         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
2714         (Gdb_index::pubnames_read): Update prototype and rework logic.
2715         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
2716         Forward declare.
2717         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2718         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
2719         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
2720         Gdb_index::map_pubtable_to_dies):
2721         Declare functions.
2722         (Gdb_index::pubnames_read): Update declaration.
2723         (Gdb_index::Pubname_offset_map): New type.
2724         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
2725         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
2726         Gdb_index::stmt_list_offset): Declare.
2727         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
2728         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
2729         Gdb_index::pubtypes_offset_): Remove.
2730
2731 2013-07-19  Roland McGrath  <mcgrathr@google.com>
2732
2733         * options.h (General_options): Add -Trodata-segment option.
2734         * parameters.cc (Parameters::check_rodata_segment): New function.
2735         (Parameters::set_target_once): Call it.
2736         * parameters.h (Parameters): Declare it (private member function).
2737         * layout.cc (load_seg_unusable_for_headers): New function, broken
2738         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
2739         then validate rodata segment rather than text segment.
2740         (relaxation_loop_body): Call that.
2741         (is_text_segment): New function.  Don't admit a non-executable
2742         segment if TARGET->isolate_execinstr().
2743         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
2744
2745 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
2746
2747         PR gold/15070
2748         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
2749         * nacl.h (Sniff_file::View::View): Request aligned view.
2750
2751 2013-07-11  Cary Coutant  <ccoutant@google.com>
2752
2753         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
2754         correct BRLT entry size.
2755
2756 2013-07-03  Alan Modra  <amodra@gmail.com>
2757
2758         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
2759         comment.
2760
2761 2013-07-01  Cary Coutant  <ccoutant@google.com>
2762
2763         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
2764         reloc_type_.
2765         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
2766         (Dwarf_ranges_table::lookup_reloc): New function.
2767         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
2768         reloc_type_.
2769         (Dwarf_ranges_table::lookup_reloc): New function.
2770         (Dwarf_ranges_table::reloc_type_): New data member.
2771
2772 2013-06-27  Jing Yu  <jingyu@google.com>
2773
2774         PR gold/15662
2775         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
2776         function.
2777         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
2778         (Target_powerpc::do_relax): Call the above.
2779
2780 2013-06-27  Cary Coutant  <ccoutant@google.com>
2781
2782         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
2783         on garbage collected .opd section.
2784
2785 2013-06-27  Alan Modra  <amodra@gmail.com>
2786
2787         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
2788         is non-zero.
2789         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
2790         (Target_powerpc::do_function_location): Likewise for loc->shndx.
2791
2792 2013-06-14  Cary Coutant  <ccoutant@google.com>
2793
2794         * resolve.cc (Symbol::override_base): Don't override st_type
2795         from plugin placeholder symbols.
2796         (Symbol_table::resolve): Likewise.
2797         (Symbol_table::should_override): Don't complain about TLS mismatch
2798         if the TO symbol is a plugin placeholder.
2799         * testsuite/Makefile.am (plugin_test_tls): New test.
2800         * testsuite/Makefile.in: Regenerate.
2801         * testsuite/plugin_test_tls.sh: New test script.
2802         * testsuite/two_file_test_2_tls.cc: New test source.
2803         * testsuite/two_file_test_tls.cc: New test source.
2804
2805 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2806
2807         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
2808         the maximum segment alignment is larger than the page size.
2809         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
2810         correctly aligns the symbols with large alignemnt.
2811         * testsuite/Makefile.in: Regenerate.
2812         * testsuite/large_symbol_alignment.cc: New file.
2813
2814 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2815             Sriraman Tallam  <tmsriram@google.com>
2816
2817         * options.h (sort_section): New option.
2818         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
2819         Rename from Input_section_sort_section_name_special_ordering_compare.
2820         (Input_section_sort_section_name_compare): New struct.
2821         * output.cc (Output_section::Input_section_sort_section_name_compare::
2822         operator()): New function.
2823         (Output_section::sort_attached_input_sections): Use new sort function
2824         for .text if --sort-section=name is specified.
2825         * layout.cc (Layout::make_output_section):
2826         Add sorting by name when --sort-section=name is specified.
2827         * testsuite/Makefile.am (text_section_grouping): Test option
2828         --sort-section=name.
2829         * testsuite/Makefile.in: Regenerate.
2830         * testsuite/section_sorting_name.cc: New file.
2831         * testsuite/section_sorting_name.sh: New file.
2832
2833 2013-05-21  Cary Coutant  <ccoutant@google.com>
2834
2835         * symtab.h (Symbol::is_cxx_vtable): New function.
2836         * target-reloc.h (relocate_section): Check for vtable symbol.
2837         * testsuite/Makefile.am (missing_key_func.sh): New test case.
2838         * testsuite/Makefile.in: Regenerate.
2839         * testsuite/missing_key_func.cc: New test source.
2840         * testsuite/missing_key_func.sh: New test script.
2841
2842 2013-05-21  Cary Coutant  <ccoutant@google.com>
2843
2844         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
2845         type of enclosing symbol.
2846         (Relocate_info::location): Check symbol type when describing symbol.
2847         * object.h (Symbol_location_info): Remove unused line_number;
2848         add enclosing_symbol_type.
2849         * testsuite/debug_msg.sh: Adjust expected output.
2850
2851 2013-05-13  Cary Coutant  <ccoutant@google.com>
2852
2853         * configure.ac: Export DEFAULT_TARGET.
2854         * configure: Regenerate.
2855         * Makefile.in: Regenerate.
2856         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
2857         * testsuite/Makefile.in: Regenerate.
2858         * testsuite/debug_msg.sh: Delete duplicate tests.
2859         Don't check undef_int error message match for powerpc where the
2860         source file and line number aren't available.
2861
2862 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2863
2864         * options.h (General_options): Add --rosegment-gap option.
2865         * options.cc (finalize): --rosegment-gap implies --rosegment.
2866         * layout.cc (set_segment_offsets): Let user option override
2867         target->rosegment_gap().
2868
2869 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2870
2871         * options.h (General_options): Remove leading space from help
2872         messages for -nostdlib and --rosegment.
2873
2874 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
2875
2876         PR ld/15365
2877         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
2878
2879 2013-05-03  Alan Modra  <amodra@gmail.com>
2880
2881         * merge.cc (Output_merge_string::do_add_input_section): Correct
2882         scan for number of strings.  Rename vars to avoid shadowing.
2883         Include missing terminator in input_size_.
2884
2885 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
2886
2887         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
2888         Restore empty string handling.
2889
2890 2013-05-01  Cary Coutant  <ccoutant@google.com>
2891
2892         * stringpool.cc (Stringpool_template::new_key_offset): Fix
2893         uninitialized warning.
2894
2895 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2896
2897         * output.cc (Output_section::add_merge_input_section): Allow
2898         to merge sections if the alignment is more than character size.
2899         * merge.h (Output_merge_string::Output_merge_string): Remove
2900         assert.
2901         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
2902         only not-null strings. Check the alignment of strings.
2903         * stringpool.h
2904         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
2905         alignment as the argument.
2906         (Stringpool_template<Stringpool_char>::addralign_): New class member.
2907         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
2908         Align non-zero length strings according to the addralign_.
2909         (Stringpool_template<Stringpool_char>::set_string_offsets):
2910         Updating offsets according to the given alignment.
2911         * testsuite/Makefile.am (text_section_grouping): Test if string
2912         literals are getting merged.
2913         * testsuite/Makefile.in: Regenerate.
2914         * testsuite/merge_string_literals_1.c: New file.
2915         * testsuite/merge_string_literals_2.c: Ditto.
2916         * testsuite/merge_string_literals.sh: Ditto.
2917
2918 2013-04-26  Ian Lance Taylor  <iant@google.com>
2919
2920         * target-reloc.h (relocate_section): If the reloc offset is out of
2921         range, pass VIEW as NULL to relocate.relocate.
2922         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
2923         * i386.cc (Target_i386::Relocate::relocate): Likewise.
2924         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2925         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2926         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
2927         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2928
2929 2013-04-26  Geoff Pike  <gpike@chromium.org>
2930
2931         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
2932         * layout.cc (Hash_task): New class.
2933         (Layout::queue_build_id_tasks): New function.
2934         (Layout::write_build_id): Handle single-thread portion of build ID
2935         computation.  (In some cases, all of it is single-threaded.)  Replace
2936         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
2937         functionality in fewer lines of code.
2938         * layout.h (Layout::queue_build_id_tasks): New function declaration.
2939         * options.h (General_options): make "--build-id" default to tree
2940         rather than sha1.  Add two new options related to --build-id=tree:
2941         --build-id-chunk-size-for-treehash and
2942         --build-id-min-file-size-for-treehash.
2943         * Makefile.am: add testing of --build-id=tree and related new options
2944         (these tests will be invoked by "make check").
2945         * Makefile.in: Regenerate.
2946
2947 2013-04-25  Alan Modra  <amodra@gmail.com>
2948
2949         * configure.tgt: Add powerpcle and powerpc64le.
2950
2951 2013-04-22  Alan Modra  <amodra@gmail.com>
2952
2953         PR gold/15355
2954         * layout.cc (Layout::segment_precedes): Allow more than one
2955         segment with the same type and flags.
2956
2957 2013-04-15  Cary Coutant  <ccoutant@google.com>
2958
2959         * layout.cc (Layout::set_relocatable_section_offsets): Don't
2960         allocate space in file for BSS sections.
2961
2962 2013-04-15  Cary Coutant  <ccoutant@google.com>
2963
2964         * script-sections.cc (Orphan_output_section): Reset address
2965         to zero after each orphaned section for relocatable links.
2966
2967 2013-04-15  Cary Coutant  <ccoutant@google.com>
2968
2969         * symtab.cc (Symbol_table::sized_write_globals): Subtract
2970         section starting address for relocatable link.
2971         * testsuite/Makefile.am (script_test_11): New test.
2972         * testsuite/Makefile.in: Regenerate.
2973         * testsuite/script_test_11.c: New source file.
2974         * testsuite/script_test_11.t: New linker script.
2975
2976 2013-04-13  Alan Modra  <amodra@gmail.com>
2977
2978         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
2979         owner when sections are not adjacent and exceed group size.
2980         (Target_powerpc::group_sections): Handle corner case.
2981         (Target_powerpc::Branch_info::make_stub): Handle case where
2982         stub table doesn't exist due to branches in non-exec sections.
2983         (Target_powerpc::Relocate::relocate): Likewise.
2984
2985 2013-04-11  Alan Modra  <amodra@gmail.com>
2986
2987         PR gold/15354
2988         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
2989         .branch_lt to match bfd ld.  Adjust comments throughout file.
2990
2991 2013-04-04  Ian Lance Taylor  <iant@google.com>
2992
2993         GCC PR c++/56840
2994         * object.cc (do_layout_deferred_sections): Handle .eh_frame
2995         sections before checking whether they are included in the link.
2996
2997 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
2998
2999         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
3000         object before calling the plugin claim_file handler.  Pass the elf
3001         object of the archive to the plugin. Delete the elf object if the
3002         plugin claims the file.
3003
3004 2013-03-21  Alan Modra  <amodra@gmail.com>
3005
3006         * layout.cc (Layout::set_segment_offsets): Accept writable .text
3007         segment when omagic.
3008
3009 2013-03-21  Alan Modra  <amodra@gmail.com>
3010
3011         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
3012         comparison warning.
3013         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
3014         uninitialized" warning.
3015
3016 2013-03-20  Alan Modra  <amodra@gmail.com>
3017
3018         * symtab.h (Symbol::clear_version): New function.
3019         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
3020         is_needed by weak references.  Clear version for symbols defined
3021         in as-needed objects that are not needed.
3022
3023 2013-03-15  Alan Modra  <amodra@gmail.com>
3024
3025         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
3026         static and public.  Add report_err param.  Return false for data refs.
3027         (Target_powerpc::rela_dyn_section): New overloaded function.
3028         (Target_powerpc::plt_, iplt_): Elucidate.
3029         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
3030         (Output_data_plt_powerpc::do_write): Don't write .iplt.
3031         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
3032         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
3033         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
3034         push_branch and make_plt_entry for ifunc syms when
3035         reloc_needs_plt_for_ifunc.
3036         (Target_powerpc::Relocate::relocate): Don't use plt entry value
3037         for ifunc unless reloc_needs_plt_for_ifunc.
3038
3039 2013-03-15  Alan Modra  <amodra@gmail.com>
3040
3041         * gc.h (gc_process_relocs): Don't look through function descriptors.
3042         * icf.cc (get_section_contents): Do so here instead.
3043
3044 2013-03-13  Alan Modra  <amodra@gmail.com>
3045
3046         * powerpc.cc (is_branch_reloc): Forward declare.
3047         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
3048         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
3049         false for 64-bit, true for 32-bit non-branch relocs.
3050         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
3051         * testsuite/Makefile.am (icf_test): Use linker map file instead of
3052         nm output.
3053         (icf_safe_test): Generate linker map file as well as nm output.
3054         (icf_safe_so_test): Likewise.
3055         * testsuite/Makefile.in: Regenerate.
3056         * testsuite/icf_test.sh: Parse linker map file to determine
3057         section folding.
3058         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
3059         * testsuite/icf_safe_so_test.sh: Likewise.
3060         (X86_32_or_ARM_specific_safe_fold): Merge into..
3061         (arch_specific_safe_fold): ..this.
3062         (X86_64_specific_safe_fold): Delete unused function.
3063
3064 2013-03-12  Alan Modra  <amodra@gmail.com>
3065
3066         * gc.h (gc_process_relocs): Look through function descriptors
3067         to determine shndx, symvalue and addend used by ICF.  Tidy
3068         variable duplication.
3069
3070 2013-03-11  Alan Modra  <amodra@gmail.com>
3071
3072         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
3073         * layout.cc (Layout_task_runner::run): ..to here.
3074         * symtab.h (struct Symbol_location): Extract from..
3075         (class Symbol_table): ..here.
3076         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
3077         * target.h (class Target): Add function_location and
3078         do_function_location functions.
3079         (class Sized_target): Add do_function_location.
3080         * object.h (class Sized_relobj_file): Move find_shdr..
3081         (class Object): ..to here.
3082         * object.cc: Likewise.  Update to suit.  Instantiate.
3083         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
3084         * powerpc.cc (class Powerpc_dynobj): New.
3085         (Target_powerpc::do_function_location): New function.
3086         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
3087         (Powerpc_dynobj::do_read_symbols): New function.
3088         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
3089
3090 2013-03-08  Ian Lance Taylor  <iant@google.com>
3091
3092         * options.cc (General_options::string_to_object_format): Accept
3093         "default".
3094
3095 2013-03-08  Alan Modra  <amodra@gmail.com>
3096
3097         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
3098         pointer to Post_fde.
3099         (struct Post_fde): Move definition to here..
3100         * ehframe.cc (struct Post_fde): ..from here.
3101         (Cie::write): Don't alloc Post_fde.
3102         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
3103
3104 2013-03-07  Alan Modra  <amodra@gmail.com>
3105
3106         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
3107         relocation referencing .LC0.
3108         * testsuite/discard_locals_test.sh: Remove FIXMEs.
3109
3110 2013-03-07  Alan Modra  <amodra@gmail.com>
3111
3112         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
3113         always_inline.  Add assembly for powerpc to avoid GOT.
3114
3115 2013-03-07  Alan Modra  <amodra@gmail.com>
3116
3117         * testsuite/script_test_10.sh: Don't test .bss section
3118         header number.
3119
3120 2013-03-06  Alan Modra  <amodra@gmail.com>
3121
3122         * powerpc.cc (class Powerpc_relobj): Move some member functions.
3123         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
3124         all callers.  Handle folded sections.
3125         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
3126         to Powerpc_relobj.
3127         (Global_symbol_visitor_opd::operator()): Likewise.
3128
3129 2013-03-04  Alan Modra  <amodra@gmail.com>
3130
3131         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
3132         * testsuite/Makefile.in: Regenerate.
3133
3134 2013-03-01  Cary Coutant  <ccoutant@google.com>
3135
3136         Add dwp support for v2 DWARF package file format.
3137         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
3138         tu_length parameter.  Adjust all callers.
3139         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
3140         * dwp.cc: Include dwarf.h.
3141         (Section_bounds): New struct type.
3142         (Unit_set): New struct type.
3143         (Dwo_file::Dwo_file): Initialize new data member.
3144         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
3145         Combine and rename to...
3146         (Dwo_file::read_unit_index): ...this.
3147         (Dwo_file::sized_read_compunit_index)
3148         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
3149         (Dwo_file::sized_read_unit_index): ...this.
3150         (Dwo_file::copy_section): Remove section_name, is_str_offsets
3151         parameters; add section_id parameter.
3152         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
3153         (Dwo_file::add_unit_set): ...this.
3154         (Dwo_file::shndx_map_): Remove.
3155         (Dwo_file::sect_offsets_): New data member.
3156         (Dwp_output_file::Dwp_output_file): Initialize new data members.
3157         (Dwp_output_file::add_section): Rename to...
3158         (Dwp_output_file::add_contribution): ...this.
3159         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
3160         (Dwp_output_file::add_tu_set): Likewise.
3161         (Dwp_output_file::Contribution): New type.
3162         (Dwp_output_file::Section::contributions): New data member.
3163         (Dwp_output_file::Cu_or_tu_set): Remove.
3164         (Dwp_output_file::Section::Section): New ctor.
3165         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
3166         (Dwp_output_file::Dwp_index::Section_table): New type.
3167         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
3168         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
3169         parameter.
3170         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
3171         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
3172         (Dwp_output_file::Dwp_index::section_table): New member function.
3173         (Dwp_output_file::Dwp_index::section_table_end): New member function.
3174         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
3175         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
3176         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
3177         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
3178         (Dwp_output_file::Dwp_index::section_table_): New data member.
3179         (Dwp_output_file::Dwp_index::section_mask_): New data member.
3180         (Dwp_output_file::add_output_section): New member function.
3181         (Dwp_output_file::write_new_section): New member function.
3182         (Dwp_output_file::write_contributions): New member function.
3183         (Dwp_output_file::section_id_map_): New data member.
3184         (class Dwo_id_info_reader): Remove.
3185         (class Unit_reader): New class.
3186         (get_dwarf_section_name): New function.
3187         (Dwo_file::read_executable): Adjust initializations of class data.
3188         (Dwo_file::read): Add support for v2 package file format.
3189         (Dwo_file::read_unit_index): Likewise.
3190         (Dwo_file::sized_read_unit_index): Likewise.
3191         (Dwo_file::copy_section): Likewise.
3192         (Dwo_file::add_unit_set): Likewise.
3193         (Dwp_output_file::add_output_section): Likewise.
3194         (Dwp_output_file::add_contribution): Likewise.
3195         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
3196         for empty slot.
3197         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
3198         file format.
3199         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
3200         slot.
3201         (Dwp_output_file::initialize): Remove unused function.
3202         (Dwp_output_file::finalize): Add support for v2 package file format.
3203         (Dwp_output_file::write_index): Likewise.
3204         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
3205         function prototype.
3206
3207 2013-03-01  Cary Coutant  <ccoutant@google.com>
3208
3209         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
3210         function into class definition in header file.
3211         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
3212         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
3213         New function.
3214         (Dwarf_info_reader::check_buffer): Move here from .cc file.
3215
3216 2013-02-28  Alan Modra  <amodra@gmail.com>
3217
3218         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
3219         * target.cc (Target::do_plt_fde_location): New function.
3220         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
3221         accessor function, and constructor param.
3222         (struct Post_fde, Post_fdes): Declare.
3223         (Cie::write): Add post_fdes param.
3224         * ehframe.cc (Fde::write): Use plt_fde_location.
3225         (struct Post_fde): Define.
3226         (Cie::write): Stash FDEs added post merge mapping.
3227         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
3228         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
3229         (Eh_frame::do_sized_write): Arrange to write post map FDES after
3230         other FDEs.
3231         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
3232         (Target_powerpc::has_glink): New function.
3233         (Target_powerpc::do_relax): Add eh_frame info for stubs.
3234         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
3235         glink_eh_frame_fde_32, default_fde): New data.
3236         (Stub_table::eh_frame_added_): New var.
3237         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
3238         Make const.
3239         (Stub_table::add_eh_frame): New function.
3240         (Output_data_glink::add_eh_frame): New function.
3241         (Target_powerpc::make_glink_section): Call add_eh_frame.
3242
3243 2013-02-15  Ian Lance Taylor  <iant@google.com>
3244
3245         * options.h (DEFINE_uint64_alias): Define.
3246         (class General_options): Add -Ttext-segment as an alias for
3247         -Ttext.
3248
3249 2013-02-15  Alan Modra  <amodra@gmail.com>
3250
3251         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
3252         (Stub_table::do_write): ..here, two places.
3253         (Stub_table::plt_call_size): Use it here too.
3254
3255 2013-02-11  Ian Lance Taylor  <iant@google.com>
3256
3257         * descriptors.cc (Descriptors::close_all): New function.
3258         * descriptors.h (class Descriptors): Declare close_all.
3259         (close_all_descriptors): New inline function.
3260         * plugin.cc: Include "descriptors.h".
3261         (Plugin_manager::cleanup): Call close_all_descriptors.
3262
3263 2013-02-06  Alan Modra  <amodra@gmail.com>
3264
3265         * README: Update coding style link.
3266
3267 2013-01-28  Cary Coutant  <ccoutant@google.com>
3268
3269         * dwp.cc (File_list): New typedef.
3270         (Dwo_name_info_reader): New class.
3271         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
3272         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
3273         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
3274         (Dwo_file::read_executable): New function.
3275         (Dwo_file::read): Move common setup code to ...
3276         (Dwo_file::make_object): ... here.
3277         (dwp_options): Add --exec/-e.
3278         (usage): Likewise.
3279         (main): Likewise.
3280
3281 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
3282
3283         * layout.cc (Layout::layout): Check for option text_reorder.
3284         (Layout::make_output_section): Ditto.
3285         * options.h (text_reorder): New option.
3286         * output.cc (Input_section_sort_compare): Remove special ordering
3287         of section names.
3288         (Output_section::
3289          Input_section_sort_section_name_special_ordering_compare::
3290          operator()): New function.
3291         (Output_section::sort_attached_input_sections): Use new sort function
3292         for .text.
3293         * output.h (Input_section_sort_section_name_special_ordering_compare):
3294         New struct.
3295         * testsuite/Makefile.am (text_section_grouping): Test option
3296         --no-text-reorder
3297         * testsuite/Makefile.in: Regenerate.
3298         * testsuite/text_section_grouping.sh: Check order of functions without
3299         default text reordering.
3300
3301 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3302
3303         * options.h (General_options): Change default to true for new_dtags.
3304
3305 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3306
3307         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
3308         when enable_new_dtags is false.  Only add DT_RUNPATH when
3309         enable_new_dtags is true.
3310
3311 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
3312
3313         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
3314         used in declaration and definition consistent.
3315         (Target_powerpc::symval_for_branch): Ditto.
3316
3317 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3318
3319         * testsuite/plugin_final_layout.cc: Fix comment.
3320
3321 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3322
3323         * layout.cc (Layout::layout): Do not do default sorting for
3324         text sections when section ordering is specified.
3325         (make_output_section): Ditto.
3326         * testsuite/plugin_final_layout.cc: Name the function sections
3327         to catch reordering issues.
3328
3329 2013-01-15  Alan Modra  <amodra@gmail.com>
3330
3331         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
3332         plt-thread-safe.
3333
3334 2013-01-15  Alan Modra  <amodra@gmail.com>
3335
3336         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
3337         * testsuite/Makefile.in: Regenerate.
3338
3339 2013-01-14  Alan Modra  <amodra@gmail.com>
3340
3341         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
3342         * testsuite/Makefile.in: Regenerate.
3343
3344 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
3345
3346         PR bfd/14430
3347         Fix mingw gold build with plugins enabled
3348         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
3349         * configure.ac: Export DLOPEN_LIBS and add headers check.
3350         * plugin.cc: Handle non-dlfcn case.
3351         * Makefile.in: Regenerate.
3352         * config.in: Regenerate.
3353         * configure: Regenerate.
3354         * testsuite/Makefile.in: Regenerate.
3355
3356 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
3357
3358         * output.h (sort_attached_input_sections): Change to be public.
3359         * script-sections.cc
3360         (Output_section_definition::set_section_addresses): Sort
3361         attached input sections according to section order before linker
3362         script assigns section addresses.
3363         (Orphan_output_section::set_section_addresses): Sort
3364         attached input sections according to section order before linker
3365         script assigns section addresses.
3366         * Makefile.am (final_layout.sh): Use a simple linker script to
3367         check if section ordering still works.
3368         * Makefile.in: Regenerate.
3369
3370 2013-01-09  Ben Cheng  <bccheng@google.com>
3371
3372         * arm.cc (Target_arm::attributes_accept_div): New function.
3373         (Target_arm::attributes_forbid_div): New function.
3374         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
3375         attribute using the same new functions as what bfd/elf32_arm.c
3376         does.
3377
3378 2013-01-07  Cary Coutant  <ccoutant@google.com>
3379
3380         PR gold/14993
3381         * output.cc (Output_section::add_input_section): For incremental
3382         updates, don't track input sections that are allocated from patch
3383         space.
3384
3385 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3386             Ian Lance Taylor  <iant@google.com>
3387
3388         PR gold/14897
3389         * configure.ac (--enable-ld): Removed.
3390         (install_as_default): Set to yes only for --enable-gold=default
3391         or --disable-ld.
3392         * configure: Regenerated.
3393
3394 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3395
3396         * options.h (General_options): Add -fuse-ld= for GCC linker
3397         option compatibility.
3398
3399 2013-01-04  Cary Coutant  <ccoutant@google.com>
3400
3401         * configure.ac: Fix typo restoring CXXFLAGS.
3402         * configure: Regenerate.
3403
3404 2013-01-04  Cary Coutant  <ccoutant@google.com>
3405
3406         * testsuite/Makefile.am (CXXLINK_S): New macro.
3407         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
3408         * testsuite/Makefile.in: Regenerate.
3409
3410 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
3411
3412         * version.cc (print_version): Update copyright year to 2013.
3413
3414 2012-12-20  Ian Lance Taylor  <iant@google.com>
3415
3416         * layout.cc (Layout::special_ordering_of_input_section): New
3417         function.
3418         (Layout::layout): If input section requires special ordering, must
3419         sort input sections.
3420         (Layout::make_output_section): May sort .text input sections.
3421         (Layout::is_section_name_prefix_grouped): Remove.
3422         * layout.h (class Layout): Declare
3423         special_ordering_of_input_section.  Don't declare
3424         is_section_name_prefix_grouped.
3425         * output.cc (Output_section::add_input_section): Revert last
3426         change.
3427         (Output_section::Input_section_sort::match_file_name): Don't crash
3428         if called on output section data.
3429         (Output_section::Input_section_sort_compare): Sort based on
3430         special ordering.
3431         (Output_section::Input_section_sort_section_order_index_compare):
3432         Revert last patch.
3433         (Output_section::sort_attached_input_sections): Likewise.
3434
3435 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
3436
3437         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
3438         * layout.h (Layout::is_section_name_prefix_grouped): New function.
3439         * output.cc (Output_section::add_input_section): Check if section
3440         name contains special prefix.  Keep input sections to sort such
3441         sections.
3442         (Output_section::Input_section_sort_section_order_index_compare
3443          ::operator()): Group sections according to prefixes.
3444         (Output_section::sort_attached_input_sections): Add condition to
3445         Input_section_entry constructor call.
3446         * testsuite/Makefile.am (text_section_grouping): New test.
3447         * testsuite/Makefile.in: Regenerate.
3448         * testsuite/text_section_grouping.cc: New file.
3449         * testsuite/text_section_grouping.sh: New file.
3450
3451 2012-12-17  Nick Clifton  <nickc@redhat.com>
3452
3453         * Makefile.am: Add copyright notice.
3454         * NEWS: Likewise.
3455         * README: Likewise.
3456         * configure.ac: Likewise.
3457         * ftruncate.c: Likewise.
3458         * Makefile.in: Regenerate.
3459
3460 2012-12-14  Cary Coutant  <ccoutant@google.com>
3461
3462         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
3463         --no-as-needed flag.
3464         (exception_separate_shared_12_test): Likewise.
3465         (incremental_copy_test): Likewise.
3466         * testsuite/Makefile.in: Regenerate.
3467
3468 2012-12-14  Cary Coutant  <ccoutant@google.com>
3469
3470         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
3471         (Dwp_output_file::Dwp_index::enter_set): Add assert.
3472
3473 2012-12-12  Alan Modra  <amodra@gmail.com>
3474
3475         * powerpc.cc (class Track_tls): New.
3476         (class Relocate, class Scan): Inherit Track_tls.
3477         (Target_powerpc::Scan::local, global): Track tls optimization
3478         and avoid creating plt entry for __tls_get_addr if all uses
3479         are optimized away.
3480         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
3481
3482 2012-12-12  Alan Modra  <amodra@gmail.com>
3483
3484         * options.h (General_options): Add --toc-sort/--no-toc-sort.
3485         Replace no_toc_optimize with toc_optimize.
3486         * output.h (Output_section::input_sections): Provide non-const variant.
3487         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
3488         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
3489         accessors.
3490         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
3491         (class Sort_toc_sections): New.
3492         (Target_powerpc::do_finalize_sections): Sort toc sections.
3493         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
3494
3495 2012-12-10  Roland McGrath  <mcgrathr@google.com>
3496
3497         * testsuite/binary_unittest.cc (read_all): New function.
3498         (Sized_binary_test): Use it instead of ::read.
3499         * fileread.cc (do_read): Don't assume pread always reads the whole
3500         amount in a single call.
3501
3502 2012-12-10  Alan Modra  <amodra@gmail.com>
3503
3504         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
3505         Set EM_PPC64 or EM_PPC here.
3506         (Target_selector_powerpc::do_recognize): Delete.
3507
3508 2012-12-10  Alan Modra  <amodra@gmail.com>
3509
3510         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
3511         stub_table_.
3512         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
3513
3514 2012-12-07  Roland McGrath  <mcgrathr@google.com>
3515
3516         * testsuite/binary_unittest.cc (Sized_binary_test):
3517         Use open_descriptor rather than ::open.
3518
3519 2012-12-07  Alan Modra  <amodra@gmail.com>
3520
3521         * powerpc.cc (Stub_table::do_write): Delete redundant Address
3522         typedef and invalid_address constant.
3523         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
3524         instantiate constants.
3525
3526 2012-12-06  Roland McGrath  <mcgrathr@google.com>
3527
3528         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
3529         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
3530         * aclocal.m4: Regenerate.
3531         * configure: Regenerate.
3532         * Makefile.in: Regenerate.
3533         * testsuite/Makefile.in: Regenerate.
3534
3535 2012-12-07  Alan Modra  <amodra@gmail.com>
3536
3537         * options.h (General_options): Add no_toc_optimize.
3538         * powerpc.cc (ok_lo_toc_insn): New function.
3539         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
3540
3541 2012-12-06  Alan Modra  <amodra@gmail.com>
3542
3543         * options.h (General_options): Add plt_align, plt_static_chain,
3544         plt_thread_safe.  Update stub_group_size help text.
3545         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
3546         for new plt_thread_safe_ var.
3547         (use_plt_offset): Correct comments.
3548         (Target_powerpc::do_relax): Look for thread creation symbols to
3549         determine default plt_thread_safe value.  Clear plt call stubs
3550         as well as branch stubs each iteration.
3551         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
3552         insn constants.
3553         (l, hi, ha, write_insn): Move earlier.
3554         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
3555         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
3556         plt stubs too.
3557         (Stub_table::update_size): Adjust.
3558         (Stub_table::prev_size, set_prev_size): Delete.
3559         (Stub_table::stub_align): Let --plt-align affect result.
3560         (Stub_table::plt_call_size): Calculate sizes for various stubs.
3561         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
3562         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
3563         (Stub_table::do_write): Support more stub variants.
3564
3565 2012-12-04  Alan Modra  <amodra@gmail.com>
3566
3567         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
3568         (Target_powerpc::do_define_standard_symbols): New function.
3569
3570 2012-12-03  Alan Modra  <amodra@gmail.com>
3571
3572         * output.h: Formatting, whitespace.
3573
3574 2012-12-03  Alan Modra  <amodra@gmail.com>
3575
3576         * layout.h (Layout::get_executable_sections): Declare.
3577         * layout.cc (Layout::get_executable_sections): New function.
3578         * arm.cc (Target_arm::group_sections): Use it.
3579         (Arm_output_section::group_sections): Delete now redundant test.
3580         * output.cc (Output_reloc::Output_reloc): Add is_relative.
3581         param to handle relative relocs.
3582         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
3583         (Output_data_reloc::add_absolute): Adjust.
3584         (Output_data_reloc::add_relative): New function.
3585         (Output_data::reset_data_size): New function.
3586         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
3587         (Output_section::set_addralign): New function.
3588         (Output_section::checkpoint_set_addralign): New function.
3589         (Output_section::clear_section_offsets_need_adjustment): New function.
3590         (Output_section::input_sections): Make public.
3591         * powerpc.cc (class Output_data_brlt_powerpc): New.
3592         (class Stub_table, class Stub_control): New.
3593         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
3594         stub_table_, set_stub_table, stub_table): New vectors and accessor
3595         functions.
3596         (Target_powerpc::do_may_relax, do_relax, push_branch,
3597         new_stub_table, stub_tables, brlt_section, group_sections,
3598         add_branch_lookup_table, find_branch_lookup_table,
3599         write_branch_lookup_table, make_brlt_section): New functions.
3600         (Target_powerpc::struct Sort_sections, class Branch_info): New.
3601         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
3602         branch_info_): New vars.
3603         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
3604         make call stubs here.
3605         (Output_data_glink): Remove all call stub handling from this class.
3606         (Target_powerpc::Scan::local, global): Save interesting branch
3607         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
3608         (Target_powerpc::do_finalize_sections): Only make reg save/restore
3609         functions on final link.
3610         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
3611         Handle long branch destinations too.
3612         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
3613         do_plt_address_for_local): Adjust lookup of plt call stubs.
3614
3615 2012-11-30  Alan Modra  <amodra@gmail.com>
3616
3617         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
3618         relocs against protected symbols when building 32-bit shared libs.
3619
3620 2012-11-30  Alan Modra  <amodra@gmail.com>
3621
3622         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
3623         param.  Call got_section() to make .got.  Update all callers
3624         and their callers and so on.
3625
3626 2012-11-30  Alan Modra  <amodra@gmail.com>
3627
3628         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
3629         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
3630         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
3631         value if it already exists.
3632
3633 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
3634
3635         PR gold/14858
3636         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
3637
3638 2012-11-14  Roland McGrath  <mcgrathr@google.com>
3639
3640         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
3641         than bfc instruction for data sandboxing.
3642
3643 2012-11-08  Alan Modra  <amodra@gmail.com>
3644
3645         * po/POTFILES.in: Regenerate.
3646
3647 2012-11-05  Alan Modra  <amodra@gmail.com>
3648
3649         * configure.ac: Apply 2012-09-10 change to config.in here.
3650         * configure: Regenerate.
3651
3652 2012-11-05  Alan Modra  <amodra@gmail.com>
3653
3654         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
3655         (struct Opd_ent): Use "Address" rather than "Offset".
3656         (Output_data_got_powerpc::got_base_offset): Return Valtype.
3657         (Target_powerpc::got_section): Make public.
3658         (Target_powerpc::scan_relocs): Move code setting symbols..
3659         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
3660         Create _SDA_BASE_ only when referenced.
3661
3662 2012-11-02  Roland McGrath  <mcgrathr@google.com>
3663
3664         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
3665         from last change.
3666
3667 2012-11-01  Roland McGrath  <mcgrathr@google.com>
3668
3669         * target.h (Sized_target::relocate_relocs): Use Elf_Off
3670         for offset_in_output_section parameter.
3671         (Sized_target::relocate_special_relocatable): Likewise.
3672         * arm.cc (Target_arm::relocate_relocs): Likewise.
3673         (Target_arm::relocate_special_relocatable): Likewise.
3674         * i386.cc (Target_i386::relocate_relocs): Likewise.
3675         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
3676         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
3677         * target-reloc.h (relocate_relocs): Likewise.
3678         * testsuite/testfile.cc (Target_test): Likewise.
3679         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
3680         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
3681
3682         * system.h: Move inclusion of <clocale> to after <libintl.h> in
3683         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
3684
3685         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
3686         parameter, which is unused in the [!F_SETFD] case.
3687
3688         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
3689         SYMNDX to off_t before comparing it to this->data_size().
3690         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
3691         * incremental.cc (Output_section_incremental_inputs::do_write):
3692         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
3693
3694         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
3695
3696 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
3697
3698         * gold.cc (Target_arm::do_adjust_elf_header): Add the
3699         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
3700         in EABI_VER5.
3701
3702 2012-10-29  Cary Coutant  <ccoutant@google.com>
3703
3704         * dwp.cc (usage): Add file and exit status parameters;
3705         add --help and --version options.
3706         (print_version): New function.
3707         (main): Add --help and --version options.
3708
3709 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3710
3711         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
3712         final_layout_sequence.txt.
3713         * testsuite/Makefile.in: Regenerated.
3714
3715 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3716
3717         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
3718         COMPILE generated by automake.
3719         (LINK1): Likewise.
3720         (CXXCOMPILE1): Likewise.
3721         (CXXLINK1): Likewise.
3722         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
3723         (LINK): Likewise.
3724         (CXXCOMPILE): Likewise.
3725         (CXXLINK): Likewise.
3726         * testsuite/Makefile.in: Regenerated.
3727
3728 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3729
3730         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
3731         on bad fwrite return.
3732
3733 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3734
3735         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
3736         on val.
3737
3738 2012-10-23  Cary Coutant  <ccoutant@google.com>
3739
3740         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
3741         * testsuite/Makefile.in: Regenerate.
3742         * testsuite/dwp_test.h: New source file.
3743         * testsuite/dwp_test_1.cc: New source file.
3744         * testsuite/dwp_test_1.s: New source file.
3745         * testsuite/dwp_test_1.sh: New source file.
3746         * testsuite/dwp_test_1b.cc: New source file.
3747         * testsuite/dwp_test_1b.s: New source file.
3748         * testsuite/dwp_test_2.cc: New source file.
3749         * testsuite/dwp_test_2.s: New source file.
3750         * testsuite/dwp_test_2.sh: New source file.
3751         * testsuite/dwp_test_main.cc: New source file.
3752         * testsuite/dwp_test_main.s: New source file.
3753
3754 2012-10-23  Cary Coutant  <ccoutant@google.com>
3755
3756         * dwp.h: New header file.
3757         * dwp.cc: New source file.
3758         * gold.h: Move shared declarations to system.h.
3759         * system.h: New header file.
3760         * Makefile.am: Add dwp.
3761         * Makefile.in: Regenerate.
3762
3763 2012-10-23  Cary Coutant  <ccoutant@google.com>
3764
3765         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
3766         Dwarf_info_reader::read_from_pointer.
3767         (Dwarf_pubnames_table::read_header): Likewise.
3768         (Dwarf_pubnames_table::next_name): Likewise.
3769         (Dwarf_die::read_attributes): Likewise.
3770         (Dwarf_die::skip_attributes): Likewise.
3771         (Dwarf_info_reader::read_from_pointer): New function template.
3772         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
3773         (Dwarf_pubnames_table): Likewise.
3774         (Dwarf_info_reader::read_from_pointer): New function template.
3775         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
3776         Dwarf_pubnames_table ctor.
3777
3778 2012-10-23  Cary Coutant  <ccoutant@google.com>
3779
3780         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
3781         abbrev_shndx.
3782         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
3783         abbrev_shndx_.
3784         (Dwarf_info_reader::set_abbrev_shndx): New method.
3785         (Dwarf_info_reader::abbrev_shndx_): New data member.
3786
3787 2012-10-23  Cary Coutant  <ccoutant@google.com>
3788
3789         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
3790         from object, not parameters.
3791         (Dwarf_info_reader::parse): Likewise.
3792         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
3793         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
3794         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
3795         methods.
3796
3797 2012-10-23  Cary Coutant  <ccoutant@google.com>
3798
3799         * fileread.cc (Input_file::Input_file): New constructor.
3800         * fileread.h (class Input_file): Add new constructor.
3801
3802 2012-10-18  Alan Modra  <amodra@gmail.com>
3803
3804         PR gold/14727
3805         * object.cc (Relobj::is_section_name_included): Also match
3806         .sdata personality section.
3807
3808 2012-10-18  Alan Modra  <amodra@gmail.com>
3809
3810         * target-reloc.h (class Default_comdat_behavior): New, package up..
3811         (get_comdat_behaviour): ..this.
3812         (relocate_section): Add Relocate_comdat_behavior template arg,
3813         adjust code to suit.
3814         * arm.cc (Target_arm::relocate_section): Adjust to suit.
3815         (Target_arm::scan_reloc_section): Likewise.
3816         * i386.cc (Target_i386::relocate_section): Likewise.
3817         * sparc.cc (Target_sparc::relocate_section): Likewise.
3818         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
3819         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
3820         * powerpc.cc (class Relocate_comdat_behavior): New.
3821         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
3822         gold::relocate_section with new template arg.
3823
3824 2012-10-18  Alan Modra  <amodra@gmail.com>
3825
3826         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
3827         dynamic relocs for GOT_TPREL got entries, without symbol if
3828         resolving locally.
3829         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
3830         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
3831         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
3832
3833 2012-10-17  Alan Modra  <amodra@gmail.com>
3834
3835         PR gold/14726
3836         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
3837
3838 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
3839
3840         * layout.cc (Layout::include_section): Keep sections marked
3841         SHF_EXCLUDE when doing relocatable links.
3842
3843 2012-10-16  Alan Modra  <amodra@gmail.com>
3844
3845         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
3846         (Target_powerpc::do_finalize_sections): Call it.
3847         (Output_data_save_res): New class and supporting functions.
3848         (Target_powerpc::symval_for_branch): Only look up .opd entry for
3849         normal symbols defined in object files.
3850
3851 2012-10-12  Alan Modra  <amodra@gmail.com>
3852
3853         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
3854         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
3855         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
3856         section if scan_opd_relocs not yet called.
3857         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
3858
3859 2012-10-12  Alan Modra  <amodra@gmail.com>
3860
3861         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3862         add_local_ifunc_entry): Revert last change.
3863         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
3864
3865 2012-10-05  Alan Modra  <amodra@gmail.com>
3866
3867         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
3868         do_plt_address_for_global): New functions.
3869         (Output_data_got_powerpc::do_write): Don't segfault when linking
3870         statically.
3871         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3872         add_local_ifunc_entry): Return true on adding entry..
3873         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
3874         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
3875         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
3876         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
3877         set up symbols here.
3878         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
3879         syms here.  Do so even when no .iplt.  Don't segfault when linking
3880         statically.
3881         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
3882         new variants without reloc param.
3883         (Glink_sym_ent::Glink_sym_ent): Likewise.
3884         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
3885         reloc when refs will resolve to plt call stub.
3886         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
3887         R_PPC_PLTREL24 to resolve locally.
3888         (Target_powerpc::Scan::global): Correct ifunc handling.
3889         (Target_powerpc::Relocate::relocate): Correct local sym glink
3890         lookup.  Don't destroy "value" when we have a plt call stub,
3891         and when checking plt call validity.
3892         (Target_powerpc::do_dynsym_value): Simplify.
3893
3894 2012-10-05  Alan Modra  <amodra@gmail.com>
3895
3896         * i386.cc (Output_data_plt_i386::address_for_global,
3897         address_for_local): Add plt offset to returned value.  Adjust uses.
3898         * sparc.cc (Output_data_plt_sparc::address_for_global,
3899         address_for_local): Likewise.
3900         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
3901         address_for_local): Likewise.
3902         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
3903         address_for_local): Likewise.
3904         * target.h (Target::plt_address_for_global, plt_address_for_local):
3905         Update comment.
3906         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
3907         (Output_data_got::Got_entry::write): Nor here.
3908         * output.h: Comment fix.
3909
3910 2012-10-02  Jiong Wang  <jiwang@tilera.com>
3911
3912         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
3913         global_offset_table_ value for larget got.
3914         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
3915
3916 2012-09-29  Alan Modra  <amodra@gmail.com>
3917
3918         * powerpc.cc (Target_powerpc::iplt_): New output section.
3919         (Target_powerpc::iplt_section, make_iplt_section,
3920         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
3921         (Target_powerpc::make_plt_entry): Handle ifunc syms.
3922         Target_powerpc::plt_entry_count): Count iplt entries too.
3923         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
3924         reloc section in constructor.  New params.
3925         (Target_powerpc::make_plt_section): Create reloc section here instead.
3926         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
3927         functions.
3928         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
3929         (Output_data_glink::add_entry, find_entry): New functions to
3930         deal with local syms.
3931         (Glink_sym_ent): Add support for local syms.
3932         (Output_data_glink::do_write): Handle ifunc plt entries.
3933         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3934         (Target_powerpc::Scan::local, global): Handle ifunc syms.
3935         (Target_powerpc::Relocate::relocate): Likewise.
3936         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
3937
3938 2012-09-25  Alan Modra  <amodra@gmail.com>
3939
3940         * object.h (Sized_relobj_file::adjust_local_symbol,
3941         do_adjust_local_symbol): New functions.
3942         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
3943         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
3944         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
3945         and irregular opd entry spacing.
3946         (Powerpc_relobj::do_read_relocs): Add opd size checks.
3947         (Global_symbol_visitor_opd): New functor.
3948         (Target_powerpc::do_finalize_sections): Omit global symbols defined
3949         on deleted opd entries.
3950
3951 2012-09-15  Jiong Wang  <jiwang@tilera.com>
3952
3953         * tilegx.cc: New file.
3954         * Makefile.am (TARGETSOURCES): Add tilegx.cc
3955         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
3956         * configure.tgt: Add entries for tilegx*.
3957         * configure.ac: Likewise.
3958         * Makefile.in: Rebuild.
3959         * configure: Likewise.
3960         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
3961         tilegx.
3962
3963 2012-09-13  Alan Modra  <amodra@gmail.com>
3964
3965         * target-reloc.h (scan_relocs): Call scan.local for relocs
3966         against symbols in discarded sections.  Pass is_discarded
3967         param.
3968         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
3969         Add is_discarded param.
3970         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
3971         is_discarded to flag opd entry as discarded.  Don't emit dyn
3972         relocs on such entries.
3973         (Target_powerpc::Scan::global): Similarly detect and handle
3974         such opd entries.
3975         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
3976         opd_ent_.  Update all uses.
3977         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
3978         (Target_powerpc::relocate_section): Zero out discarded opd
3979         entry relocs.
3980
3981 2012-09-12  Ian Lance Taylor  <iant@google.com>
3982
3983         PR gold/14570
3984         * output.cc: Rename Output_data_got template parameter from size
3985         to got_size for all functions.  Compile all variants of
3986         Output_data_got.
3987         (Output_data_got::Got_entry::write): Correct use of size for
3988         symbol value.  Use local_is_tls rather than casting to
3989         Sized_relobj_file.
3990         * object.h (class Object): Add local_is_tls and do_local_is_tls.
3991         (class Sized_relobj_file): Add do_local_is_tls.
3992         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
3993
3994 2012-09-11  Alan Modra  <amodra@gmail.com>
3995
3996         PR gold/14566
3997         * layout.cc (Layout::set_segment_offsets): When using
3998         common-page-size alignment, ensure we are on a new max-page-size
3999         page.
4000         * output.cc (Output_segment::set_section_addresses): Use
4001         abi_pagesize, not common_pagesize for relro boundary.
4002         (Output_segment::set_offset): Likewise.
4003
4004 2012-09-11  Alan Modra  <amodra@gmail.com>
4005
4006         * output.h (Output_data_got::add_global_tls, add_local_tls,
4007         add_local_tls_pair): New functions.
4008         (Output_data_got::add_local_pair_with_rel): Remove second
4009         reloc param.  Expand comment.
4010         (Output_data_got::Got_entry): Rename use_plt_offset_ to
4011         use_plt_or_tls_offset_, similarly for constructor param.
4012         (Output_data_got::Got_entry::write): Add got_index param.
4013         * output.cc (Output_data_got::add_global_tls, add_local_tls,
4014         add_local_tls_pair): New functions.
4015         (Output_data_got::Got_entry::write): Handle tls symbols
4016         with use_plt_or_tls_offset_ set specially.
4017         (Output_data_got::add_local_pair_with_rel): Only one reloc.
4018         (Output_data_got::do_write): Replace iterator with index, pass
4019         index to entry write function.
4020         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
4021         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
4022         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
4023         call.
4024         * i386.cc (Target_i386::Scan::local): Likewise.
4025         * sparc.cc (Target_sparc::Scan::local): Likewise.
4026         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
4027         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
4028         do_tls_offset_for_global): New functions.
4029         (Target_powerpc::Scan::local): Correct TLS relocations and got
4030         entry values.
4031         (Target_powerpc::Scan::global): Don't emit unnecessary
4032         dynamic relocations on TLS GOT entries.
4033
4034 2012-09-10  Matthias Klose  <doko@ubuntu.com>
4035
4036         * config.in: Disable sanity check for kfreebsd.
4037
4038 2012-09-10  Sterling Augustine  <saugustine@google.com>
4039
4040         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
4041         (Gdb_index::pubtypes_read): New parameter.
4042         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
4043         to calls.
4044         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
4045         pubtypes_object_.
4046
4047 2012-09-09  Alan Modra  <amodra@gmail.com>
4048
4049         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
4050         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
4051         * gc.h (gc_process_relocs): Call target gc_add_reference.
4052         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
4053         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
4054         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
4055         unnecessary cast.
4056         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
4057         to cater for when we don't need code offset.  Update use.
4058         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
4059         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
4060         set_opd_valid): New functions.
4061         (Target_powerpc::do_gc_add_reference): New function.
4062         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
4063         stashed refs.
4064         (Target_powerpc::do_gc_mark_symbol): New function.
4065
4066 2012-09-06  Cary Coutant  <ccoutant@google.com>
4067
4068         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
4069         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
4070         (Dwarf_die::skip_attributes): Likewise.
4071         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
4072         * testsuite/gdb_index_test.cc (inline_func_1): New function.
4073         (main): Call it.
4074         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
4075
4076 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
4077
4078         * testsuite/script_test_3.t: Add .got.plt output section
4079         statement.
4080         * testsuite/script_test_4.t: Likewise.
4081
4082 2012-09-05  Alan Modra  <amodra@gmail.com>
4083
4084         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
4085         update all uses and lose "enum" when using type.
4086
4087 2012-09-05  Alan Modra  <amodra@gmail.com>
4088
4089         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
4090         * configure: Regenerate.
4091         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
4092         (plugin_final_layout.stdout): Likewise.
4093         (memory_test): Set page sizes to 0x1000.
4094         * testsuite/Makefile.in: Regenerate.
4095         * testsuite/discard_locals_test.sh: Add FIXME comment.
4096         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
4097         * testsuite/pr14265.t: Add .got output section statement.
4098         * testsuite/script_test_2.t: Likewise.
4099         * testsuite/script_test_3.t: Likewise.
4100         * testsuite/script_test_4.t: Likewise.
4101         * testsuite/script_test_5.t: Likewise.
4102         * testsuite/script_test_6.t: Likewise.
4103         * testsuite/script_test_7.t: Likewise.
4104         * testsuite/script_test_9.t: Likewise.
4105
4106 2012-09-05  Alan Modra  <amodra@gmail.com>
4107
4108         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
4109         (Powerpc_relocate_functions::Status): New typedef.
4110         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4111         (Target_powerpc::Scan::local): Handle REL64.
4112         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
4113         for REL32 and REL64.
4114         (Target_powerpc::symval_for_branch): New function, extracted from..
4115         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
4116         checks.  Report overflow errors.
4117
4118 2012-09-05  Alan Modra  <amodra@gmail.com>
4119
4120         * object.h (Sized_relobj_file::emit_relocs): Delete.
4121         (Sized_relobj_file::emit_relocs_reltype): Delete.
4122         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
4123         relocate_relocs for --emit-relocs.
4124         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
4125         * output.h: Update comment.
4126         (Output_segment::first_section): New function.
4127         (Output_segment::first_section_load_address): Use first_section.
4128         * output.cc (Output_segment::first_section): New function extracted..
4129         (Output_segment::first_section_load_address): ..from here.  Delete.
4130         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
4131         * target.h (Sized_target::relocate_for_relocatable): Likewise.
4132         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
4133         adjust call to target.h function.
4134         * i386.cc (Target_i386): Likewise.
4135         * sparc.cc (Target_sparc): Likewise.
4136         * x86_64.cc (Target_x86_64): Likewise.
4137         * powerpc.cc (Target_powerpc): Likewise.
4138         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
4139         first tls section has section symbol for optimised local dynamic
4140         output relocs.
4141         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
4142         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
4143         optimised tls code.
4144         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
4145         Rename to relocate_relocs.  Update error message.
4146
4147 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
4148
4149         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
4150         --just-symbols.
4151
4152 2012-08-31  Alan Modra  <amodra@gmail.com>
4153
4154         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
4155         (Powerpc_relobj::toc_base_offset): New stub function.
4156         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
4157         got_mod_index_offset to tlsld_got_offset.  Update all refs.
4158         (Target_powerpc::Relocate::enum skip_tls): New.
4159         (Target_powerpc::call_tls_get_addr_): New var.
4160         (Target_powerpc::is_branch_reloc): Move to file scope.
4161         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
4162         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
4163         New functions.
4164         (Target_powerpc::enum Got_type): Delete old values, add new ones.
4165         (powerpc_info): Correct common_pagesize for ppc64.
4166         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
4167         (Powerpc_relocate_functions): Add overflow check enums and functions.
4168         Add non-shift version of rela, rela_ua.  Delete all rel public
4169         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
4170         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
4171         addr16_ha3, addr14 functions.
4172         (Output_data_got_powerpc::add_constant_pair): New function.
4173         (Output_data_got_powerpc::got_base_offset): Likewise.
4174         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
4175         (instruction constants): Sort, add some more.
4176         (Output_data_glink::do_write): Add and use Address typedef.  Use
4177         object->toc_base_offset() stub for 64-bit.
4178         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
4179         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4180         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
4181         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
4182         Always treat .opd relocs as against locally defined symbol.
4183         Correct condition for RELATIVE relocs.
4184         (Target_powerpc::do_finalize_sections): Test for NULL sections.
4185         (Target_powerpc::Relocate::relocate): Use plt call stub as value
4186         for 32-bit syms with a plt entry.  Correct ppc64 toc base
4187         calculations.  Handle TLS relocs, and more.  Add overflow
4188         checking and adjust for Powerpc_relocate_functions changes.
4189         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
4190         Reinstate --emit-relocs code with FIXME.
4191
4192 2012-08-30  Alan Modra  <amodra@gmail.com>
4193
4194         * layout.cc (Layout::set_segment_offsets): Set p_align to
4195         abi_pagesize, not common_pagesize.
4196         (Layout::relaxation_loop_body): Similarly use abi_pagesize
4197         to determine whether file header can go in segment.
4198
4199 2012-08-30  Alan Modra  <amodra@gmail.com>
4200
4201         * output.h (Output_reloc::Output_reloc <output section>): Add
4202         is_relative param.  Adjust calls.
4203         (Output_reloc::add_output_section_relative): New functions.
4204         * output.cc (Output_reloc::Output_reloc <output section>): Handle
4205         is_relative.
4206         (Output_reloc::symbol_value): Handle SECTION_CODE.
4207
4208 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
4209
4210         * gold.cc (queue_middle_tasks): Call layout again when unique
4211         segments for sections is desired.
4212         * layout.cc (Layout::Layout): Initialize new members.
4213         (Layout::get_output_section_flags): New function.
4214         (Layout::choose_output_section): Call get_output_section_flags.
4215         (Layout::layout): Make output section for mapping to a unique segment.
4216         (Layout::insert_section_segment_map): New function.
4217         (Layout::attach_allocated_section_to_segment): Make unique segment for
4218         output sections marked so.
4219         (Layout::segment_precedes): Check for unique segments when sorting.
4220         * layout.h (Layout::Unique_segment_info): New struct.
4221         (Layout::Section_segment_map): New typedef.
4222         (Layout::insert_section_segment_map): New function.
4223         (Layout::get_output_section_flags): New function.
4224         (Layout::is_unique_segment_for_sections_specified): New function.
4225         (Layout::set_unique_segment_for_sections_specified): New function.
4226         (Layout::unique_segment_for_sections_specified_): New member.
4227         (Layout::section_segment_map_): New member.
4228         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
4229         Rename is_gc_pass_one to is_pass_one.
4230         Rename is_gc_pass_two to is_pass_two.
4231         Rename is_gc_or_icf to is_two_pass.
4232         Check for which pass based on whether symbols data is present.
4233         Make it two pass when unique segments for sections is desired.
4234         * output.cc (Output_section::Output_section): Initialize new
4235         members.
4236         * output.h (Output_section::is_unique_segment): New function.
4237         (Output_section::set_is_unique_segment): New function.
4238         (Output_section::is_unique_segment_): New member.
4239         (Output_section::extra_segment_flags): New function.
4240         (Output_section::set_extra_segment_flags): New function.
4241         (Output_section::extra_segment_flags_): New member.
4242         (Output_section::segment_alignment): New function.
4243         (Output_section::set_segment_alignment): New function.
4244         (Output_section::segment_alignment_): New member.
4245         (Output_segment::Output_segment): Initialize is_unique_segment_.
4246         (Output_segment::is_unique_segment): New function.
4247         (Output_segment::set_is_unique_segment): New function.
4248         (Output_segment::is_unique_segment_): New member.
4249         * plugin.cc (allow_unique_segment_for_sections): New function.
4250         (unique_segment_for_sections): New function.
4251         (Plugin::load): Add new functions to transfer vector.
4252         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
4253         * Makefile.in: Regenerate.
4254         * testsuite/plugin_final_layout.sh: Check if unique segment
4255         functionality works.
4256         * testsuite/plugin_section_order.c (onload): Check if new interfaces
4257         are available.
4258         (allow_unique_segment_for_sections): New global.
4259         (unique_segment_for_sections): New global.
4260         (claim_file_hook): Call allow_unique_segment_for_sections.
4261         (all_symbols_read_hook): Call unique_segment_for_sections.
4262
4263 2012-08-22  Cary Coutant  <ccoutant@google.com>
4264
4265         * layout.cc (Layout::include_section): Don't assert on GROUP
4266         sections with --emit-relocs.
4267
4268 2012-08-21  Cary Coutant  <ccoutant@google.com>
4269
4270         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
4271         if --export-dynamic-symbol names an undef symbol.
4272
4273 2012-08-18  Alan Modra  <amodra@gmail.com>
4274
4275         * powerpc.cc: Formatting and white space.
4276         (Powerpc_relobj): Rename got2_section_ to special_.
4277         Add opd_ent_shndx_ and opd_ent_off_ vectors.
4278         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
4279         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
4280         (Target_powerpc): Add Address typedef and invalid_address.  Use
4281         throughout.
4282         (Target_powerpc::is_branch_reloc): New function.
4283         (Powerpc_relocate_functions): Add Address typedef, use throughout.
4284         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
4285         for dst_mask, value and addend.
4286         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
4287         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
4288         (Output_data_glink::do_write): Correct toc base.  Don't try to use
4289         uint16_t for 24-bit offset.  Use get_output_section_offset and
4290         check return.
4291         (Target_powerpc::Scan::local): Handle more relocs.
4292         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
4293         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
4294         Plug in toc restoring insn after plt calls.  Translate branches
4295         to function descriptor symbols to corresponding entry point.
4296         (Target_powerpc::relocate_for_relocatable): Check return from
4297         get_output_section_offset.
4298         * symtab.h: Comment typo.
4299
4300 2012-08-14  Ian Lance Taylor  <iant@google.com>
4301
4302         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
4303         unsupported_relocal_local to call unsupported_reloc_global.
4304
4305 2012-08-14  Nick Clifton  <nickc@redhat.com>
4306
4307         PR ld/14265
4308         * script-sections.cc (Sections_element::output_section_name): Add
4309         keep return parameter.
4310         (Output_section_element::match_name): Add keep return parameter.
4311         Return the value of the keep_ member.
4312         * script-sections.h (class Output_section): Update
4313         output_section_name prototype.
4314         * layout.cc (Layout::keep_input_section): New public member
4315         function.
4316         (Layout::choose_output_section): Pass keep parameter to
4317         output_section_name.
4318         * layout.h (class Layout): Add keep_input_section.
4319         * object.cc (Sized_relobj_file::do_layout): Check for kept input
4320         sections.
4321         * testsuite/Makefile.am: Add a test.
4322         * testsuite/Makefile.in: Regenerate.
4323         * testsuite/pr14265.c: Source file for the test.
4324         * testsuite/pr14265.t: Linker script for the test.
4325         * testsuite/pr14265.sh: Shell script for the test.
4326
4327 2012-08-14  Alan Modra  <amodra@gmail.com>
4328
4329         * target.h (Target::output_section_name): New function.
4330         (Target::do_output_section_name): New function.
4331         * layout.cc (Layout::choose_output_section): Call the above.
4332         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
4333
4334 2012-08-14  Alan Modra  <amodra@gmail.com>
4335
4336         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
4337         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
4338         for replace_constant call.
4339         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
4340         (Output_data_glink::do_print_to_mapfile): New function.
4341         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
4342         (Target_powerpc::Relocate::relocate): Likewise.
4343
4344 2012-08-14  Alan Modra  <amodra@gmail.com>
4345
4346         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
4347         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
4348         (Output_data_glink::add_entry,find_entry): Remove shndx param.
4349         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
4350         all references to shndx_.  Handle special case for R_PPC_PLTREL24
4351         here.
4352         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
4353         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
4354         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
4355         here.
4356         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
4357         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
4358
4359 2012-08-12  Alan Modra  <amodra@gmail.com>
4360
4361         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
4362         (glink insn constants): Use uint32_t.
4363         (Output_data_glink::add_entry): Use insert, not [] operator.
4364
4365 2012-08-11  Alan Modra  <amodra@gmail.com>
4366
4367         * object.h (Sized_relobj_file::find_shdr): New function.
4368         (Sized_relobj_file::find_special_sections): New function.
4369         * object.cc (Sized_relobj_file::find_shdr): New function.
4370         (Sized_relobj_file::find_eh_frame): Use find_shdr.
4371         (Sized_relobj_file::find_special_sections): New function, split out..
4372         (Sized_relobj_file::do_read_symbols): ..from here.
4373         * output.h (Output_data_got::replace_constant): New function.
4374         (Output_data_got::num_entries): New function.
4375         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
4376         (Output_data_got::got_offset): Protected rather than private.
4377         (Output_data_got::replace_got_entry): New function.
4378         * output.cc (Output_data_got::replace_got_entry): New function.
4379         * powerpc.cc (class Powerpc_relobj): New.
4380         (class Powerpc_relocate_functions): Delete all psymval variants or
4381         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
4382         Implement _ha functions using corresponding _hi function.
4383         (Powerpc_relobj::find_special_sections): New function.
4384         (Target_powerpc::do_make_elf_object): New function.
4385         (class Output_data_got_powerpc): New.
4386         (class Output_data_glink): New.
4387         (class Powerpc_scan_relocatable_reloc): New.
4388         Many more changes througout file.
4389
4390 2012-08-09  Nick Clifton  <nickc@redhat.com>
4391
4392         * po/vi.po: Updated Vietnamese translation.
4393
4394 2012-08-07  Ian Lance Taylor  <iant@google.com>
4395
4396         * layout.cc (Layout::add_target_dynamic_tags): If
4397         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
4398         plt_rel.
4399
4400 2012-07-30  Nick Clifton  <nickc@redhat.com>
4401
4402         * po/gold.pot: Updated template.
4403         * po/es.po: Updated Spanish translation.
4404
4405 2012-07-18  Cary Coutant  <ccoutant@google.com>
4406
4407         PR gold/14344
4408         * configure.ac: Add check for -gpubnames support.
4409         * configure: Regenerate.
4410         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
4411         support; force -gno-pubnames.
4412         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
4413         support.
4414         (gdb_index_test_4): New test.
4415         * testsuite/Makefile.in: Regenerate.
4416         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
4417         * testsuite/gdb_index_test_2.sh: Likewise.
4418         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
4419         * testsuite/gdb_index_test_4.sh: New script.
4420         * testsuite/gdb_index_test_comm.sh: New script with common code;
4421         don't look for space after colon.
4422
4423 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
4424
4425         * gold.cc (queue_middle_tasks): Update function order only after
4426         deferred objects due to plugins are processed.
4427
4428 2012-07-11  Ian Lance Taylor  <iant@google.com>
4429
4430         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
4431         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
4432         (Target_arm::scan_reloc_for_stub): Likewise.
4433         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
4434         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
4435         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
4436         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
4437         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
4438
4439 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
4440             Ian Lance Taylor  <iant@google.com>
4441
4442         PR gold/14309
4443         * configure.ac: Test whether std::tr1::hash<off_t> works.
4444         * gold.h: Add a specialization for std::tr1::hash<off_t> if
4445         needed.
4446         * output.h (class Output_fill): Add virtual destructor.
4447         * configure, config.in: Rebuild.
4448
4449 2012-06-22  Roland McGrath  <mcgrathr@google.com>
4450
4451         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
4452
4453 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
4454
4455         * plugin.cc (Plugin::load): Handle position independent executables.
4456
4457 2012-06-06  Cary Coutant  <ccoutant@google.com>
4458
4459         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
4460         add .debug_macro.
4461         (lines_only_debug_sections): Likewise.
4462         (gdb_fast_lookup_sections): New static array.
4463         (is_gdb_debug_section): Rename formal parameter.
4464         (is_lines_only_debug_section): Likewise.
4465         (is_gdb_fast_lookup_section): New function.
4466         (Layout::include_section): Check for ".zdebug_" prefix; pass
4467         section name suffix to is_gdb_debug_section, et al.; check for
4468         fast-lookup sections when building .gdb_index.
4469         * options.h (--strip-debug-gdb): Update GDB version number.
4470
4471 2012-06-06  Cary Coutant  <ccoutant@google.com>
4472
4473         * configure.ac: Add check for fallocate.
4474         * configure: Regenerate.
4475         * config.in: Regenerate.
4476
4477         * options.h (class General_options): Add --mmap-output-file and
4478         --posix-fallocate options.
4479         * output.cc: (posix_fallocate): Remove; replace with...
4480         (gold_fallocate): New function.
4481         (Output_file::map_no_anonymous): Call gold_fallocate.
4482         (Output_file::map): Check --mmap-output-file option.
4483
4484 2012-06-05  Jing Yu  <jingyu@google.com>
4485
4486         * gold.h (textdomain): Add do {} to empty while(0).
4487         (bindtextdomain): Likewise.
4488
4489 2012-06-04  Cary Coutant  <ccoutant@google.com>
4490
4491         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
4492         has_dynsym_index.
4493
4494 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
4495
4496         * symtab.cc (Symbol_table::define_special_symbol):
4497         Initialize *poldsym to prevent uninitialized variable errors.
4498
4499 2012-05-23  Cary Coutant  <ccoutant@google.com>
4500
4501         * layout.cc (Layout::section_name_mapping): Add rules to handle
4502         exact match on .data.rel.ro.local or .data.rel.ro.
4503         (Layout::output_section_name): Check for exact matches.
4504
4505 2012-05-23  Cary Coutant  <ccoutant@google.com>
4506
4507         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
4508         more carefully.
4509
4510 2012-05-22  Cary Coutant  <ccoutant@google.com>
4511
4512         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
4513         object before exporting symbol.
4514
4515 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
4516
4517         * testsuite/tls_test.cc: Include "config.h" first.
4518         * testsuite/tls_test_c.c: Likewise.
4519
4520 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
4521             Nick Clifton  <nickc@redhat.com>
4522
4523         PR 14072
4524         * configure.in: Add check that sysdep.h has been included before
4525         any system header files.
4526         * configure: Regenerate.
4527         * config.in: Regenerate.
4528
4529 2012-05-14  Cary Coutant  <ccoutant@google.com>
4530
4531         * layout.cc (Layout::make_output_section): Mark .tdata section
4532         as RELRO.
4533         * testsuite/relro_test.cc: Add a TLS variable.
4534
4535 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
4536
4537         PR gold/14091
4538         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
4539         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
4540         R_X86_64_64.
4541
4542 2012-05-08  Cary Coutant  <ccoutant@google.com>
4543
4544         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
4545         (lines_only_debug_sections): Likewise.
4546
4547 2012-05-02  Roland McGrath  <mcgrathr@google.com>
4548
4549         * nacl.cc: New file.
4550         * nacl.h: New file.
4551         * Makefile.am (CCFILES, HFILES): Add them.
4552         * Makefile.in: Regenerate.
4553         * i386.cc (Output_data_plt_i386_nacl): New class.
4554         (Output_data_plt_i386_nacl_exec): New class.
4555         (Output_data_plt_i386_nacl_dyn): New class.
4556         (Target_i386_nacl): New class.
4557         (Target_selector_i386_nacl): New class.
4558         (target_selector_i386): Use it instead of Target_selector_i386.
4559         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
4560         (Target_x86_64_nacl): New class.
4561         (Target_selector_x86_64_nacl): New class.
4562         (target_selector_x86_64, target_selector_x32): Use it instead of
4563         Target_selector_x86_64.
4564         * arm.cc (Output_data_plt_arm_nacl): New class.
4565         (Target_arm_nacl): New class.
4566         (Target_selector_arm_nacl): New class.
4567         (target_selector_arm, target_selector_armbe): Use it instead of
4568         Target_selector_arm.
4569
4570         * target-select.cc (select_target): Take new Input_file* and off_t
4571         arguments, pass them on to recognize method of selector.
4572         * object.cc (make_elf_sized_object): Update caller.
4573         * parameters.cc (parameters_force_valid_target): Likewise.
4574         * incremental.cc (make_sized_incremental_binary): Likewise.
4575         * target-select.h: Update decl.
4576         (Target_selector::recognize): Take new Input_file* argument,
4577         pass it on to do_recognize.
4578         (Target_selector::do_recognize): Take new Input_file* argument.
4579         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
4580         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
4581         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
4582         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
4583
4584         * target.h (Target::Target_info): New members isolate_execinstr
4585         and rosegment_gap.
4586         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
4587         * arm.cc (Target_arm::arm_info): Update initializer.
4588         * i386.cc (Target_i386::i386_info): Likewise.
4589         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
4590         * sparc.cc (Target_sparc::sparc_info): Likewise.
4591         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4592         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
4593         * layout.cc (Layout::attach_allocated_section_to_segment):
4594         Take new const Target* argument.  If target->isolate_execinstr(), act
4595         like --rosegment.
4596         (Layout::find_first_load_seg): Take new const Target* argument;
4597         if target->isolate_execinstr(), reject PF_X segments.
4598         (Layout::relaxation_loop_body): Update caller.
4599         (Layout::set_segment_offsets): If target->isolate_execinstr(),
4600         reset file offset to zero when we hit LOAD_SEG, and then do a second
4601         loop over the segments before LOAD_SEG to reassign offsets after
4602         addresses have been determined.  Handle target->rosegment_gap().
4603         (Layout::attach_section_to_segment): Take new const Target* argument;
4604         pass it to attach_allocated_section_to_segment.
4605         (Layout::make_output_section): Update caller.
4606         (Layout::attach_sections_to_segments): Take new const Target* argument;
4607         pass it to attach_section_to_segment.
4608         * gold.cc (queue_middle_tasks): Update caller.
4609         * layout.h (Layout): Update method decls with new arguments.
4610
4611         * arm.cc (Target_arm::Target_arm): Take optional argument for the
4612         Target_info pointer to use.
4613         (Target_arm::do_make_data_plt): New virtual method.
4614         (Target_arm::make_data_plt): New method that calls it.
4615         (Target_arm::make_plt_entry): Use it.
4616         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
4617         for the section alignment.
4618         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
4619         method.
4620         (Output_data_plt_arm::first_plt_entry_offset): Call it.
4621         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
4622         method.
4623         (Output_data_plt_arm::get_plt_entry_size): Call it.
4624         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
4625         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
4626         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
4627         method.
4628         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
4629         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
4630         method instead of sizeof(plt_entry).
4631         (Output_data_plt_arm::add_entry): Likewise.
4632         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
4633         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
4634         than static method.
4635         (Target_arm::plt_entry_size): Likewise.
4636         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
4637         Move to ...
4638         (Output_data_plt_arm_standard): ... here, new class.
4639         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
4640         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
4641         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
4642
4643         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4644         Take additional argument for the PLT entry size.
4645         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
4646         Use get_plt_entry_size method rather than plt_entry_size variable.
4647         (Output_data_plt_x86_64::reserve_slot): Likewise.
4648         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
4649         (Output_data_plt_x86_64::add_entry): Likewise.
4650         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
4651         (Output_data_plt_x86_64::address_for_global): Likewise.
4652         (Output_data_plt_x86_64::address_for_local): Likewise.
4653         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4654         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
4655         Make method non-static.
4656         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
4657         method.
4658         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
4659         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
4660         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
4661         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
4662         virtual method.
4663         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
4664         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
4665         virtual method.
4666         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
4667         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
4668         virtual method.
4669         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
4670         (Output_data_plt_x86_64::plt_entry_size)
4671         (Output_data_plt_x86_64::first_plt_entry)
4672         (Output_data_plt_x86_64::plt_entry)
4673         (Output_data_plt_x86_64::tlsdesc_plt_entry)
4674         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
4675         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
4676         (Output_data_plt_x86_64_standard): ... here, new class.
4677         (Target_x86_64::Target_x86_64): Take optional argument for the
4678         Target_info pointer to use.
4679         (Target_x86_64::do_make_data_plt): New virtual method.
4680         (Target_x86_64::make_data_plt): New method to call it.
4681         (Target_x86_64::init_got_plt_for_update): Use that.
4682         Call this->plt_->add_eh_frame method here.
4683         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
4684         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
4685         rather than static method.
4686         (Target_x86_64::plt_entry_size): Likewise.
4687         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
4688         rather than plt_entry_size variable.  Move guts of PLT filling to...
4689         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
4690         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
4691         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
4692
4693         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
4694         additional argument for the section alignment.
4695         Don't do add_eh_frame_for_plt here.
4696         (Output_data_plt_i386::first_plt_entry_offset): Make the method
4697         non-static.  Use get_plt_entry_size method rather than plt_entry_size
4698         variable.
4699         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
4700         method.
4701         (Output_data_plt_i386::get_plt_entry_size): Call it.
4702         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
4703         (Output_data_plt_i386::add_eh_frame): New method to call it.
4704         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
4705         method.
4706         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
4707         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
4708         method.
4709         (Output_data_plt_i386::fill_plt_entry): New method to call it.
4710         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
4711         method instead of plt_entry_size.
4712         (Output_data_plt_i386::plt_entry_size)
4713         (Output_data_plt_i386::plt_eh_frame_fde_size)
4714         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
4715         (Output_data_plt_i386_standard): ... here, new class.
4716         (Output_data_plt_i386_exec): New class.
4717         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
4718         (Output_data_plt_i386_exec::first_plt_entry): ... here.
4719         (Output_data_plt_i386::exec_plt_entry): Move to ...
4720         (Output_data_plt_i386_exec::plt_entry): ... here.
4721         (Output_data_plt_i386_dyn): New class.
4722         (Output_data_plt_i386::first_plt_entry): Move to ...
4723         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
4724         (Output_data_plt_i386::dyn_plt_entry): Move to ...
4725         (Output_data_plt_i386_dyn::plt_entry): ... here.
4726         (Target_i386::Target_i386): Take optional argument for the Target_info
4727         pointer to use.
4728         (Target_i386::do_make_data_plt): New virtual method.
4729         (Target_i386::make_data_plt): New method to call it.
4730         (Target_i386::make_plt_section): Use that.
4731         Call this->plt_->add_eh_frame method here.
4732         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
4733         rather than plt_entry_size variable.
4734         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
4735         (Output_data_plt_i386::address_for_local): Likewise.
4736         (Output_data_plt_i386::do_write): Likewise.
4737         Move guts of PLT filling to...
4738         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
4739         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
4740         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
4741         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
4742
4743 2012-05-01  Cary Coutant  <ccoutant@google.com>
4744
4745         * dwarf_reader.cc (Dwarf_die::read_attributes)
4746         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
4747         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
4748         * reduced_debug_output.cc
4749         (Output_reduced_debug_info_section::get_die_end): Remove
4750         DW_FORM_GNU_ref_index.  Add default case.
4751
4752 2012-04-26  Mark Wielaard  <mjw@redhat.com>
4753
4754         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
4755         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
4756         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
4757         DW_AT_high_pc as offset from DW_AT_low_pc.
4758
4759         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
4760         * testsuite/Makefile.in: Regenerate.
4761         * testsuite/gdb_index_test_3.c: New test source file.
4762         * testsuite/gdb_index_test_3.sh: New test source file.
4763
4764 2012-04-25  Ian Lance Taylor  <iant@google.com>
4765
4766         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
4767         pointer.
4768         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
4769         as a class, not a struct.
4770         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
4771         (Target_arm::apply_cortex_a8_workaround): Likewise.
4772         * gc.h: Declare Reloc_types as a struct, not a class.
4773         * object.h: Declare Symbols_data as a struct.
4774         * reloc.h: Declare Read_relocs_data as a struct.
4775         * target.h: Declare Relocate_info as a struct.
4776
4777 2012-04-24  David S. Miller  <davem@davemloft.net>
4778
4779         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
4780         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
4781         and R_SPARC_WPLT30.
4782
4783 2012-04-24  Cary Coutant  <ccoutant@google.com>
4784
4785         * incremental-dump.cc (find_input_containing_global): Replace
4786         magic number with symbolic constant.
4787         (dump_incremental_inputs): Update version number.
4788         * incremental.cc (Output_section_incremental_inputs): Update version
4789         number; import symbolic constants from Incremental_inputs_reader.
4790         (Incremental_inputs::create_data_sections): Align relocations
4791         section correctly for 64-bit targets.
4792         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
4793         constants; add padding.
4794         (Output_section_incremental_inputs::write_header): Add assert for
4795         header_size.
4796         (Output_section_incremental_inputs::write_input_files): Add assert
4797         for input_entry_size.
4798         (Output_section_incremental_inputs::write_info_blocks): Add padding;
4799         add assert for object_info_size, input_section_entry_size,
4800         global_sym_entry_size.
4801         * incremental.h (Incremental_inputs_reader): Add symbolic constants
4802         for data structure sizes; use them.
4803         (Incremental_input_entry_reader): Import symbolic constants from
4804         Incremental_inputs_reader; use them.
4805
4806 2012-04-23  David S. Miller  <davem@davemloft.net>
4807
4808         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
4809         and elf_flags_set_.
4810         (Target_sparc::Target_sparc): Initialize new fields.
4811         (Target_sparc::do_make_elf_object): New function.
4812         (Target_sparc::do_adjust_elf_header): New function.
4813
4814 2012-04-23  Cary Coutant  <ccoutant@google.com>
4815
4816         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
4817         CU range table of gdb index.
4818
4819 2012-04-20  David S. Miller  <davem@davemloft.net>
4820
4821         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
4822         instead of false.
4823
4824 2012-04-16  David S. Miller  <davem@davemloft.net>
4825
4826         * sparc.cc (Target_sparc::got_address): New function.
4827         (Sparc_relocate_functions::gdop_hix22): New function.
4828         (Sparc_relocate_functions::gdop_lox10): New function.
4829         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
4830         relocs.
4831         (Target_sparc::Scan::local): Likewise if the global symbol is not
4832         preemptible and is not IFUNC.
4833         (Target_sparc::Relocate::relocate): Perform GOTDATA code
4834         transformations for local and non-preemptible non-IFUNC global
4835         symbols.
4836
4837         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
4838         writing out 64-bit part of ranges.
4839
4840         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
4841         -fpic and -fpie respectively.
4842         * Makefile.in: Regenerate.
4843
4844         * sparc.cc (class Target_sparc): Add rela_ifunc_.
4845         (Target_sparc::Target_sparc): Initialize new field.
4846         (Target_sparc::do_plt_section_for_global): New function.
4847         (Target_sparc::do_plt_section_for_local): New function.
4848         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
4849         (Target_sparc::make_plt_section): New function, broken out of
4850         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
4851         (Target_sparc::make_plt_entry): Call make_plt_section.
4852         (Target_sparc::make_local_ifunc_plt_entry): New function.
4853         (Target_sparc::rela_ifunc_section): New function.
4854         (Target_sparc::plt_section): Remove const.
4855         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
4856         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
4857         and ifunc_count_ fields.
4858         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
4859         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
4860         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
4861         (Output_data_plt_sparc::rela_ifunc): New function.
4862         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
4863         (Output_data_plt_sparc::has_ifunc_section): New function.
4864         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
4865         (Output_data_plt_sparc::address_for_global): New function.
4866         (Output_data_plt_sparc::address_for_local): New function.
4867         (Output_data_plt_sparc::plt_index_to_offset): New function.
4868         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
4869         and entry_count.
4870         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
4871         entry_count.
4872         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
4873         R_SPARC_JMP_IREL to switch.
4874         (Target_sparc::Scan::check_non_pic): Likewise.
4875         (Target_sparc::Scan::local): Handle IFUNC symbols.
4876         (Target_sparc::Scan::local): Likewise.
4877         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
4878         and plt_address_for_local.
4879         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
4880         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
4881
4882         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
4883         (class Output_data_reloc): Adjust calls to Output_reloc_type.
4884         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
4885         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
4886         global relocs too.
4887         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
4888         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
4889         calls.
4890         * sparc.cc (Target_sparc::Scan::global): Likewise.
4891         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4892
4893 2012-04-16  Cary Coutant  <ccoutant@google.com>
4894
4895         * archive.cc (Library_base::should_include_member): Check for
4896         --export-dynamic-symbol.
4897         * options.h (class General_options): Add --export-dynamic-symbol.
4898         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
4899         --export-dynamic-symbol.
4900         (Symbol_table::gc_mark_undef_symbols): Likewise.
4901         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
4902
4903 2012-04-12  David S. Miller  <davem@davemloft.net>
4904
4905         * sparc.cc (Reloc::wdisp10): New relocation method.
4906         (Reloc::h34): Likewise.
4907         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
4908         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
4909         R_SPARC_WDISP10.
4910         (Target_sparc::Scan::local): Likewise.
4911         (Target_sparc::Scan::global): Likewise.
4912         (Target_sparc::Relocate::relocate): Likewise.
4913
4914 2012-04-09  Cary Coutant  <ccoutant@google.com>
4915
4916         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
4917         low_pc == 0.
4918
4919 2012-04-06  Ian Lance Taylor  <iant@google.com>
4920
4921         * timer.cc: #include <unistd.h>.
4922
4923 2012-04-06  Roland McGrath  <mcgrathr@google.com>
4924
4925         * configure.in (AC_CHECK_HEADERS): Add locale.h.
4926         * config.in: Regenerate.
4927         * configure: Regenerate.
4928
4929 2012-04-05  Nick Clifton  <nickc@redhat.com>
4930
4931         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
4932         (AM_LC_MESSAGES): Add.
4933         * aclocal.m4: Regenerate.
4934         * config.in: Regenerate.
4935         * configure: Regenerate.
4936
4937 2012-03-21  Cary Coutant  <ccoutant@google.com>
4938
4939         * Makefile.am: Add gdb-index.cc, gdb-index.h.
4940         * Makefile.in: Regenerate.
4941         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
4942         (Sized_elf_reloc_mapper::symbol_section): New function.
4943         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
4944         (make_elf_reloc_mapper): New function.
4945         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
4946         (Dwarf_abbrev_table::do_read_abbrevs): New function.
4947         (Dwarf_abbrev_table::do_get_abbrev): New function.
4948         (Dwarf_ranges_table::read_ranges_table): New function.
4949         (Dwarf_ranges_table::read_range_list): New function.
4950         (Dwarf_pubnames_table::read_section): New function.
4951         (Dwarf_pubnames_table::read_header): New function.
4952         (Dwarf_pubnames_table::next_name): New function.
4953         (Dwarf_die::Dwarf_die): New function.
4954         (Dwarf_die::read_attributes): New function.
4955         (Dwarf_die::skip_attributes): New function.
4956         (Dwarf_die::set_name): New function.
4957         (Dwarf_die::set_linkage_name): New function.
4958         (Dwarf_die::attribute): New function.
4959         (Dwarf_die::string_attribute): New function.
4960         (Dwarf_die::int_attribute): New function.
4961         (Dwarf_die::uint_attribute): New function.
4962         (Dwarf_die::ref_attribute): New function.
4963         (Dwarf_die::child_offset): New function.
4964         (Dwarf_die::sibling_offset): New function.
4965         (Dwarf_info_reader::check_buffer): New function.
4966         (Dwarf_info_reader::parse): New function.
4967         (Dwarf_info_reader::do_parse): New function.
4968         (Dwarf_info_reader::do_read_string_table): New function.
4969         (Dwarf_info_reader::lookup_reloc): New function.
4970         (Dwarf_info_reader::get_string): New function.
4971         (Dwarf_info_reader::visit_compilation_unit): New function.
4972         (Dwarf_info_reader::visit_type_unit): New function.
4973         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
4974         Sized_elf_reloc_mapper.
4975         (Sized_dwarf_line_info::symbol_section): Remove function.
4976         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
4977         (Sized_dwarf_line_info::read_line_mappings): Remove object
4978         parameter, adjust callers.
4979         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
4980         * dwarf_reader.h: Include <sys/types.h>.
4981         (class Track_relocs): Remove forward declaration.
4982         (class Elf_reloc_mapper): New class.
4983         (class Sized_elf_reloc_mapper): New class.
4984         (class Dwarf_abbrev_table): New class.
4985         (class Dwarf_range_list): New class.
4986         (class Dwarf_ranges_table): New class.
4987         (class Dwarf_pubnames_table): New class.
4988         (class Dwarf_die): New class.
4989         (class Dwarf_info_reader): New class.
4990         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
4991         (Sized_dwarf_line_info::symbol_section): Remove member function.
4992         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
4993         base class.
4994         * gdb-index.cc: New source file.
4995         * gdb-index.h: New source file.
4996         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
4997         and .debug_types sections, call Layout::add_to_gdb_index.
4998         (Sized_relobj_incr::do_section_name): Implement.
4999         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
5000         return type; Implement.
5001         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
5002         return type.
5003         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
5004         parameter list and return type.
5005         (Sized_incr_dynobj::do_section_contents): Likewise.
5006         * layout.cc: Include gdb-index.h.
5007         (Layout::Layout): Initialize gdb_index_data_.
5008         (Layout::init_fixed_output_section): Check for .gdb_index section.
5009         (Layout::add_to_gdb_index): New function. Instantiate.
5010         * layout.h: Add forward declaration for class Gdb_index.
5011         (Layout::add_to_gdb_index): New member function.
5012         (Layout::gdb_index_data_): New data member.
5013         * main.cc: Include gdb-index.h.
5014         (main): Print statistics for gdb index.
5015         * object.cc (Object::section_contents): Move code into
5016         do_section_contents.
5017         (need_decompressed_section): Check for sections needed when building
5018         gdb index.
5019         (build_compressed_section_map): Likewise.
5020         (Sized_relobj_file::do_read_symbols): Need local symbols when building
5021         gdb index.
5022         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
5023         sections; call Layout::add_to_gdb_index.
5024         (Sized_relobj_file::do_decompressed_section_contents): Call
5025         do_section_contents directly.
5026         * object.h (Object::do_section_contents): Adjust parameter list and
5027         return type.
5028         (Object::do_decompressed_section_contents): Call do_section_contents
5029         directly.
5030         (Sized_relobj_file::do_section_contents): Adjust parameter list and
5031         return type.
5032         * options.h (class General_options): Add --gdb-index option.
5033         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
5034         list and return type.
5035         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
5036         * reloc.h (Track_relocs::checkpoint): New function.
5037         (Track_relocs::reset): New function.
5038
5039         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
5040         New test cases.
5041         * testsuite/Makefile.in: Regenerate.
5042         * testsuite/gdb_index_test.cc: New test source file.
5043         * testsuite/gdb_index_test_1.sh: New test source file.
5044         * testsuite/gdb_index_test_2.sh: New test source file.
5045
5046 2012-03-19  Doug Kwan  <dougkwan@google.com>
5047
5048         * arm.cc (Target_arm::do_define_standard_symbols): New method.
5049         (Target_arm::do_finalize_sections): Remove code which defines
5050         __exidx_start and __exidx_end.  Make symbol table parameter
5051         anonymous as it is not used.
5052         * gold.cc (queue_middle_tasks): Call target hook to define any
5053         target-specific symbols.
5054         * target.h (Target::define_standard_symbols): New method.
5055         (Target::do_define_standard_symbols): Same.
5056         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
5057         * testsuite/Makefile.in: Regenerate.
5058         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
5059         and __exidx_end.
5060         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
5061         relocations are generated for __exidx_start and __exidx_end.
5062
5063 2012-03-16  Doug Kwan  <dougkwan@google.com>
5064
5065         * testsuite/Makefile.am: Disable test initpri3b.
5066         * testsuite/Makefile.in: Regenerate.
5067
5068 2012-03-15  Doug Kwan  <dougkwan@google.com>
5069
5070         * arm.cc (Target_arm::got_section): Make .got section read-only
5071         if -z now is given.
5072
5073 2012-03-15  Ian Lance Taylor  <iant@google.com>
5074
5075         PR gold/13850
5076         * layout.cc (Layout::make_output_section): Correctly mark
5077         SHT_INIT_ARRAY, et. al., as relro.
5078
5079 2012-03-14  Doug Kwan  <dougkwan@google.com>
5080
5081         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
5082         dynamic relocations for protected symbols in shared objects.
5083
5084 2012-03-13  Ian Lance Taylor  <iant@google.com>
5085
5086         * resolve.cc (Symbol_table::resolve): When merging common symbols,
5087         keep the larger alignment.
5088
5089 2012-03-12  Cary Coutant  <ccoutant@google.com>
5090
5091         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
5092         handling of DW_LNE_define_file.
5093
5094 2012-03-12  Cary Coutant  <ccoutant@google.com>
5095
5096         * reduced_debug_output.cc
5097         (Output_reduced_debug_info_section::get_die_end): Add new FORM
5098         codes to switch.
5099
5100 2012-02-29  Cary Coutant  <ccoutant@google.com>
5101
5102         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
5103
5104 2012-02-29  Cary Coutant  <ccoutant@google.com>
5105
5106         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5107         Call Object::decompressed_section_contents.
5108         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
5109         New dtor.
5110         (Sized_dwarf_line_info::buffer_start_): New data member.
5111         * merge.cc (Output_merge_data::do_add_input_section): Call
5112         Object::decompressed_section_contents.
5113         (Output_merge_string::do_add_input_section): Likewise.
5114         * object.cc (need_decompressed_section): New function.
5115         (build_compressed_section_map): Decompress sections needed later.
5116         (Sized_relobj_file::do_decompressed_section_contents): New function.
5117         (Sized_relobj_file::do_discard_decompressed_sections): New function.
5118         * object.h (Object::decompressed_section_contents): New function.
5119         (Object::discard_decompressed_sections): New function.
5120         (Object::do_decompressed_section_contents): New function.
5121         (Object::do_discard_decompressed_sections): New function.
5122         (Compressed_section_info): New type.
5123         (Compressed_section_map): Include decompressed section contents.
5124         (Sized_relobj_file::do_decompressed_section_contents): New function.
5125         (Sized_relobj_file::do_discard_decompressed_sections): New function.
5126
5127 2012-02-16  Cary Coutant  <ccoutant@google.com>
5128
5129         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
5130         * testsuite/Makefile.in: Regenerate.
5131
5132 2012-02-14  Cary Coutant  <ccoutant@google.com>
5133
5134         * options.cc (General_options::finalize): Disallow -pie and -static.
5135
5136 2012-02-03  Doug Kwan  <dougkwan@google.com>
5137
5138         * arm.cc (Arm_relocate_functions::abs8,
5139         Arm_relocate_functions::abs16): Use
5140         Bits::has_signed_unsigned_overflow32.
5141         (Arm_relocate_functions::thm_abs8): Correct range of
5142         overflow check.
5143         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
5144         in assertions.
5145
5146 2012-02-02  Doug Kwan  <dougkwan@google.com>
5147
5148         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
5149         position independent outputs, not just shared objects.
5150
5151 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
5152
5153         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
5154         * configure: Regenerated.
5155
5156 2012-01-27  Ian Lance Taylor  <iant@google.com>
5157
5158         * reloc.h (Bits): New class with static functions, copied from
5159         namespace utils in arm.cc.
5160         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
5161         instead.
5162
5163 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5164
5165         * incremental.cc (write_info_blocks): Correct relocation offset.
5166
5167 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5168
5169         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
5170         (Relocate::tls_gd_to_le): Likewise.
5171
5172 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5173
5174         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
5175
5176 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5177
5178         * configure.ac: Check if -mcmodel=medium works.
5179         * configure: Regenerated.
5180
5181 2012-01-24  Cary Coutant  <ccoutant@google.com>
5182
5183         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
5184         definition and ...
5185         (read_unsigned_LEB_128_x): ... this new function.
5186         (read_signed_LEB_128): Replaced with inline definition and ...
5187         (read_signed_LEB_128_x): ... this new function.
5188         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
5189         (read_unsigned_LEB_128): Add inline definition.
5190         (read_signed_LEB_128_x): New function.
5191         (read_signed_LEB_128): Add inline definition.
5192         * testsuite/Makefile.am (leb128_unittest): New unit test.
5193         * testsuite/Makefile.in: Regenerate.
5194         * testsuite/leb128_unittest.cc: New unit test.
5195
5196 2012-01-23  Ian Lance Taylor  <iant@google.com>
5197
5198         PR gold/13617
5199         * i386.cc (Target_i386::do_code_fill): When using a jmp
5200         instruction, pad with nop instructions.
5201         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5202
5203 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
5204
5205         * x86_64.cc (gc_process_relocs): Add typename on types used in
5206         template.
5207         (scan_relocs): Likewise.
5208         (relocate_section): Likewise.
5209         (apply_relocation): Likewise.
5210
5211 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
5212
5213         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
5214         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
5215         under x32.
5216
5217 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
5218
5219         * x86_64.cc: Initial support for x32.
5220
5221 2012-01-03  Cary Coutant  <ccoutant@google.com>
5222
5223         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
5224         Use abstract base class for GOT.
5225         * gold/output.h (class Output_data_got_base): New abstract base class.
5226         (class Output_data_got): Derive from new base class, adjust ctors.
5227         (Output_data_got::reserve_slot): Make virtual; rename to
5228         do_reserve_slot; Adjust callers.
5229         * gold/target.h (Sized_target::init_got_plt_for_update): Return
5230         pointer to abstract base class.
5231         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
5232
5233 2011-12-18  Ian Lance Taylor  <iant@google.com>
5234
5235         * object.h (Relobj::local_symbol_value): New function.
5236         (Relobj::local_plt_offset): New function.
5237         (Relobj::local_has_got_offset): New function.
5238         (Relobj::local_got_offset): New function.
5239         (Relobj::set_local_got_offset): New function.
5240         (Relobj::do_local_symbol_value): New pure virtual function.
5241         (Relobj::do_local_plt_offset): Likewise.
5242         (Relobj::do_local_has_got_offset): Likewise.
5243         (Relobj::do_local_got_offset): Likewise.
5244         (Relobj::do_set_local_got_offset): Likewise.
5245         (Sized_relobj::do_local_has_got_offset): Rename from
5246         local_has_got_offset.
5247         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
5248         (Sized_relobj::do_set_local_got_offset): Rename from
5249         set_local_got_offset.
5250         (Sized_relobj_file::do_local_plt_offset): Rename from
5251         local_plt_offset.
5252         (Sized_relobj_file::do_local_symbol_value): New function.
5253         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
5254         local_plt_offset.
5255         * output.cc (Output_data_got::Got_entry::write): Change object to
5256         Relobj.  Use local_symbol_value.
5257         (Output_data_got::add_global_with_rel): Change rel_dyn to
5258         Output_data_reloc_generic*.  Use add_global_generic.
5259         (Output_data_got::add_global_with_rela): Remove.  Change all
5260         callers to use add_global_with_rel.
5261         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
5262         Output_data_reloc_generic*.  Use add_global_generic.
5263         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
5264         callers to use add_global_pair_with_rel.
5265         (Output_data_got::add_local): Change object to Relobj*.
5266         (Output_data_got::add_local_plt): Likewise.
5267         (Output_data_got::add_local_with_rel): Change object to Relobj*,
5268         change rel_dyn to Output_data_reloc_generic*.  Use
5269         add_local_generic.
5270         (Output_data_got::add_local_with_rela): Remove.  Change all
5271         callers to use all_local_with_rel.
5272         (Output_data_got::add_local_pair_with_rel): Change object to
5273         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
5274         add_output_section_generic.
5275         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
5276         callers to use add_local_pair_with_rel.
5277         (Output_data_got::reserve_local): Change object to Relobj*.
5278         * output.h: (class Output_data_reloc_generic): Add pure virtual
5279         declarations for add_global_generic, add_local_generic,
5280         add_output_section_generic.
5281         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
5282         functions for Output_data_reloc_generic.  Update declarations for
5283         changes listed in output.cc.
5284         (class Output_data_got): Change template parameter to got_size.
5285         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
5286         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
5287         function.
5288         (Sized_relobj_incr::do_local_plt_offset): New function.
5289         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
5290         add_global_generic.
5291
5292 2011-12-17  Cary Coutant  <ccoutant@google.com>
5293
5294         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
5295         * resolve.cc (Symbol_table::resolve): Likewise.
5296         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
5297         arrays.
5298         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5299
5300 2011-12-16  Ian Lance Taylor  <iant@google.com>
5301
5302         * output.h (Output_data_reloc_generic::add): Only call
5303         add_dynamic_reloc if this is a dynamic reloc section.
5304
5305 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
5306
5307         PR gold/13505
5308         * target-reloc.h (apply_relocation): Replace <64, false> with
5309         <size, big_endian>.
5310
5311 2011-11-25  Nick Clifton  <nickc@redhat.com>
5312
5313         * po/it.po: New Italian translation.
5314
5315 2011-11-17  Sterling Augustine  <saugustine@google.com>
5316
5317         * script.cc (script_include_directive): Implement.
5318         (read_script_file): New local variables name and search_path. Update
5319         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
5320         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
5321         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
5322
5323 2011-11-11  Sterling Augustine  <saugustine@google.com>
5324
5325         * yyscript.y (section_cmd): Add support for INCLUDE directive.
5326         (file_or_sections_cmd): Likewise.
5327
5328 2011-11-11  Doug Kwan  <dougkwan@google.com>
5329
5330         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
5331         if --just-symbols is given.
5332
5333 2011-11-10  Doug Kwan  <dougkwan@google.com>
5334
5335         PR gold/13362
5336         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
5337         when processing data relocs.
5338         * reloc.h (Relocate_functions::rel_unaligned): New method.
5339         (Relocate_functions::pcrel_unaligned): Ditto.
5340         (Relocate_functions::rel32_unaligned): Ditto.
5341         (Relocate_functions::pcrel32_unaligned): Ditto.
5342
5343 2011-11-09  Doug Kwan  <dougkwan@google.com>
5344
5345         PR gold/13362
5346         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
5347         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
5348         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
5349         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5350         (Relocate_functions::rel_unaligned): New.
5351         (Relocate_functions::rel32_unaligned): New.
5352         * target-reloc.h (relocate_for_relocatable): Add code to handle
5353         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5354         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
5355         arm_unaligned_reloc_r): New targets.
5356         * testsuite/Makefile.in: Regenerate.
5357         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
5358         linking.
5359
5360 2011-11-02  Ian Lance Taylor  <iant@google.com>
5361
5362         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
5363         NATIVE_LINKER.
5364         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
5365         * options.cc (General_options::finalize): Use library search path
5366         from configure script if specified.  If not native and no sysroot,
5367         only search TOOLLIBDIR.
5368         * options.h (Search_directory::Search_directory): Change name to
5369         const std::string&.
5370         (General_options::add_to_library_path_with_sysroot): Change arg to
5371         const std::string&.
5372         * configure, Makefile.in, config.in: Rebuild.
5373
5374 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5375
5376         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
5377         we are working around the ARM1176 Erratum.
5378         * options.h (General_options::fix_arm1176): Add option.
5379         * testsuite/Makefile.am: Add testcases, and keep current ones
5380         working.
5381         * testsuite/Makefile.in: Regenerate.
5382         * testsuite/arm_fix_1176.s: New file.
5383         * testsuite/arm_fix_1176.sh: Likewise.
5384
5385 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5386
5387         * arm.cc (Target_arm::Target_arm): Remove initialisation of
5388         may_use_blx_.
5389         (Target_arm::may_use_blx): Remove method.
5390         (Target_arm::set_may_use_blx): Likewise.
5391         (Target_arm::may_use_v4t_interworking): New method.
5392         (Target_arm::may_use_v5t_interworking): Likewise.
5393         (Target_arm::may_use_blx_): Remove member variable.
5394         (Arm_relocate_functions::arm_branch_common): Check for v5T
5395         interworking.
5396         (Arm_relocate_functions::thumb_branch_common): Likewise.
5397         (Reloc_stub::stub_type_for_reloc): Likewise.
5398         (Target_arm::do_finalize_sections): Correct interworking checks.
5399         * testsuite/Makefile.am: Add new tests.
5400         * testsuite/Makefile.in: Regenerate.
5401         * testsuite/arm_farcall_arm_arm.s: New test.
5402         * testsuite/arm_farcall_arm_arm.sh: Likewise.
5403         * testsuite/arm_farcall_arm_thumb.s: Likewise.
5404         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
5405         * testsuite/arm_farcall_thumb_arm.s: Likewise.
5406         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
5407         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
5408         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
5409
5410 2011-10-31  Cary Coutant  <ccoutant@google.com>
5411
5412         PR gold/13023
5413         * expression.cc (Expression::eval_with_dot): Add
5414         is_section_dot_assignment parameter.
5415         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
5416         absolute and assigning to dot within a section.
5417         * script-sections.cc
5418         (Output_section_element_assignment::set_section_addresses): Pass
5419         dot_section to set_if_absolute.
5420         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
5421         as is_section_dot_assignment flag to eval_with_dot.
5422         (Output_section_element_dot_assignment::set_section_addresses):
5423         Likewise.
5424         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
5425         parameter.  Also set value if relative to dot_section; set the
5426         symbol's output_section.
5427         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
5428         parameter.  Adjust all callers.
5429         (Expression::eval_maybe_dot): Likewise.
5430         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
5431         Adjust all callers.
5432         * testsuite/script_test_2.t: Test assignment of an absolute value
5433         to dot within an output section element.
5434
5435 2011-10-31  Cary Coutant  <ccoutant@google.com>
5436
5437         * options.h (class General_options): Add --[no-]gnu-unique options.
5438         * symtab.cc (Symbol_table::sized_write_globals): Convert
5439         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
5440
5441 2011-10-31  Cary Coutant  <ccoutant@google.com>
5442
5443         PR gold/13359
5444         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
5445         unnecessary assertion.
5446         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
5447
5448 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
5449
5450         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5451         gc_mark_symbol.
5452         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5453         gc_mark_symbol.
5454         Change to just keep the section associated with symbol.
5455         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
5456         they are externally visible and --export-dynamic is turned on.
5457         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
5458
5459 2011-10-19  Ian Lance Taylor  <iant@google.com>
5460
5461         PR gold/13163
5462         * script-sections.cc
5463         (Output_section_element_dot_assignment::needs_output_section): New
5464         function.
5465
5466 2011-10-19  Ian Lance Taylor  <iant@google.com>
5467
5468         PR gold/13204
5469         * layout.cc (Layout::segment_precedes): Don't assert failure if a
5470         --section-start option was seen.
5471         * options.h (General_options::any_section_start): New function.
5472
5473 2011-10-18  David S. Miller  <davem@davemloft.net>
5474
5475         PR binutils/13301
5476         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
5477         member to track relocation locations that have moved during TLS
5478         reloc optimizations.
5479         (Target_sparc::Relocate::Relocate): Initialize to NULL.
5480         (Target_sparc::Relocate::relocate): Adjust view down by 4
5481         bytes if it matches reloc_adjust_addr_.
5482         (Target_sparc::Relocate::relocate_tls): Always move the
5483         __tls_get_addr call delay slot instruction forward 4 bytes when
5484         performing relaxation.
5485
5486 2011-10-18  Cary Coutant  <ccoutant@google.com>
5487
5488         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
5489         (Output_file::map_no_anonymous): Check for non-zero
5490         return code from posix_fallocate.
5491
5492 2011-10-17  Cary Coutant  <ccoutant@google.com>
5493
5494         PR gold/13245
5495         * plugin.cc (is_visible_from_outside): Check for symbols
5496         referenced from dynamic objects.
5497         * resolve.cc (Symbol_table::resolve): Don't count references
5498         from dynamic objects as references from real ELF files.
5499         * testsuite/plugin_test_2.sh: Adjust expected result.
5500
5501 2011-10-17  Cary Coutant  <ccoutant@google.com>
5502
5503         * gold.cc: Include timer.h.
5504         (queue_middle_tasks): Stamp time.
5505         (queue_final_tasks): Likewise.
5506         * main.cc (main): Store timer in parameters.  Print timers
5507         for each pass.
5508         * parameters.cc (Parameters::Parameters): Initialize timer_.
5509         (Parameters::set_timer): New function.
5510         (set_parameters_timer): New function.
5511         * parameters.h (Parameters::set_timer): New function.
5512         (Parameters::timer): New function.
5513         (Parameters::timer_): New data member.
5514         (set_parameters_timer): New function.
5515         * timer.cc (Timer::stamp): New function.
5516         (Timer::get_pass_time): New function.
5517         * timer.h (Timer::stamp): New function.
5518         (Timer::get_pass_time): New function.
5519         (Timer::pass_times_): New data member.
5520
5521 2011-10-17  Cary Coutant  <ccoutant@google.com>
5522
5523         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
5524         task for members of lib groups.
5525
5526 2011-10-17  Cary Coutant  <ccoutant@google.com>
5527
5528         PR gold/13288
5529         * fileread.cc (File_read::find_view): Add assert.
5530         (File_read::make_view): Move bounds check (replace with assert)...
5531         (File_read::find_or_make_view): ... to here.
5532
5533 2011-10-12  Cary Coutant  <ccoutant@google.com>
5534
5535         * output.cc (Output_file::open_base_file): Handle case where
5536         ::read returns less than requested size.
5537
5538 2011-10-10  Cary Coutant  <ccoutant@google.com>
5539
5540         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
5541         Initialize defined_count_.
5542         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
5543         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
5544         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
5545         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
5546         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
5547         * incremental.h (Sized_relobj_incr::defined_count_): New data
5548         member.
5549         (Sized_incr_dynobj::defined_count_): New data member.
5550         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
5551         Return zeroes instead of internal error.
5552
5553 2011-10-10  Cary Coutant  <ccoutant@google.com>
5554
5555         PR gold/13249
5556         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
5557         (Output_reloc::symbol_value): Return PLT offset if flag is set.
5558         * output.h (class Output_reloc): Add use_plt_offset flag.
5559         (Output_reloc::type_): Adjust size of bit field.
5560         (Output_reloc::use_plt_offset_): New bit field.
5561         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
5562         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
5563         flag.  Adjust all callers.
5564         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
5565         creating RELATIVE relocations.
5566
5567 2011-10-10  Nick Clifton  <nickc@redhat.com>
5568
5569         * po/es.po: Updated Spanish translation.
5570         * po/fi.po: Updated Finnish translation.
5571
5572 2011-10-03   Diego Novillo  <dnovillo@google.com>
5573
5574         * options.cc (parse_uint): Fix dereference of RETVAL.
5575
5576 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
5577
5578         * layout.h (section_order_map_): New member.
5579         (get_section_order_map): New member function.
5580         * output.cc (Output_section::add_input_section): Check for patterns
5581         only when --section-ordering-file is specified.
5582         * gold.cc (queue_middle_tasks): Delay updating order of sections till
5583         output_sections have been formed.
5584         * layout.cc (Layout_Layout): Initialize section_order_map_.
5585         * plugin.cc (update_section_order): Store order in order_map. Do not
5586         update the order.
5587         * testsuite/Makefile.am: Add test case for plugin_final_layout.
5588         * testsuite/Makefile.in: Regenerate.
5589         * testsuite/plugin_section_order.c: New file.
5590         * testsuite/plugin_final_layout.cc: New file.
5591         * testsuite/plugin_final_layout.sh: New file.
5592
5593 2011-09-29  Cary Coutant  <ccoutant@google.com>
5594
5595         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5596         Check for NULL.
5597         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
5598         symbols during incremental update.
5599         (Symbol_table::add_from_dynobj): Likewise.
5600
5601 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5602             Ian Lance Taylor  <iant@google.com>
5603
5604         * symtab.cc (Symbol_table::define_special_symbol): Always
5605         canonicalize version string.
5606
5607 2011-09-26  Cary Coutant  <ccoutant@google.com>
5608
5609         * gold.cc (queue_initial_tasks): Move option checks ...
5610         * options.cc (General_options::finalize): ... to here. Disable
5611         some options; make others fatal.
5612
5613 2011-09-26  Cary Coutant  <ccoutant@google.com>
5614
5615         gcc PR lto/47247
5616         * plugin.cc (get_symbols_v2): New function.
5617         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
5618         (is_referenced_from_outside): New function.
5619         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
5620         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
5621         (get_symbols): Pass version parameter.
5622         (get_symbols_v2): New function.
5623         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
5624         parameter.
5625         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
5626         (onload): Add LDPT_GET_SYMBOLS_V2.
5627         (all_symbols_read_hook): Use get_symbols_v2; check for
5628         LDPR_PREVAILING_DEF_IRONLY_EXP.
5629         * testsuite/plugin_test_3.sh: Update expected results.
5630
5631 2011-09-23  Simon Baldwin  <simonb@google.com>
5632
5633         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5634         configuration options.
5635         * configure: Regenerate.
5636         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
5637         * Makefile.in: Regenerate.
5638         * testsuite/Makefile.in: Regenerate.
5639
5640 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
5641
5642         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
5643
5644 2011-09-19  Cary Coutant  <ccoutant@google.com>
5645
5646         * incremental.cc (can_incremental_update): Fix typo in comment.
5647         * incremental.h (can_incremental_update): Likewise.
5648
5649 2011-09-18  Cary Coutant  <ccoutant@google.com>
5650
5651         * incremental.cc (can_incremental_update): New function.
5652         * incremental.h (can_incremental_update): New function.
5653         * layout.cc (Layout::init_fixed_output_section): Call it.
5654         (Layout::make_output_section): Don't allow patch space in .eh_frame.
5655         * object.cc (Sized_relobj_file::do_layout): Call
5656         can_incremental_update.
5657
5658 2011-09-13  Cary Coutant  <ccoutant@google.com>
5659
5660         * configure.ac: Check for glibc support for gnu_indirect_function
5661         support with static linking, setting automake conditional
5662         IFUNC_STATIC.
5663         * Makefile.in: Regenerate.
5664         * configure: Regenerate.
5665
5666         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
5667         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
5668         for IFUNC_STATIC.
5669         * testsuite/Makefile.in: Regenerate.
5670
5671 2011-09-13  Cary Coutant  <ccoutant@google.com>
5672
5673         * incremental.cc (Sized_relobj_incr::do_layout): Call
5674         report_comdat_group for kept comdat sections.
5675         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
5676         * testsuite/Makefile.in: Regenerate.
5677         * testsuite/incr_comdat_test_1.cc: New source file.
5678         * testsuite/incr_comdat_test_2_v1.cc: New source file.
5679         * testsuite/incr_comdat_test_2_v2.cc: New source file.
5680         * testsuite/incr_comdat_test_2_v3.cc: New source file.
5681
5682 2011-09-13  Ian Lance Taylor  <iant@google.com>
5683
5684         * object.cc (Sized_relobj_file::do_layout): Remove unused local
5685         variable external_symbols_offset.
5686
5687 2011-09-12  Ian Lance Taylor  <iant@google.com>
5688
5689         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
5690         triggered if object has no symbols.
5691
5692 2011-09-09  David S. Miller  <davem@davemloft.net>
5693
5694         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
5695         (Output_fill_debug_line::do_write): Likewise.
5696
5697 2011-08-29  Cary Coutant  <ccoutant@google.com>
5698
5699         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
5700         casts to match formatting specs.
5701         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
5702
5703 2011-08-26  Cary Coutant  <ccoutant@google.com>
5704
5705         * layout.cc (Free_list::allocate): Provide guarantee of minimum
5706         remaining hole size when allocating.
5707         (Layout::make_output_section): Set fill methods for debug sections.
5708         * layout.h (Free_list::Free_list_node): Move from private to
5709         public.
5710         (Free_list::set_min_hole_size): New function.
5711         (Free_list::begin, Free_list::end): New functions.
5712         (Free_list::min_hole_): New data member.
5713         * output.cc: Include dwarf.h.
5714         (Output_fill_debug_info::do_minimum_hole_size): New function.
5715         (Output_fill_debug_info::do_write): New function.
5716         (Output_fill_debug_line::do_minimum_hole_size): New function.
5717         (Output_fill_debug_line::do_write): New function.
5718         (Output_section::Output_section): Initialize new data member.
5719         (Output_section::set_final_data_size): Ensure patch space is larger
5720         than minimum hole size.
5721         (Output_section::do_write): Fill holes in debug sections.
5722         * output.h (Output_fill): New class.
5723         (Output_fill_debug_info): New class.
5724         (Output_fill_debug_line): New class.
5725         (Output_section::set_free_space_fill): New function.
5726         (Output_section::free_space_fill_): New data member.
5727         * testsuite/Makefile.am (incremental_test_3): Add
5728         --incremental-patch option.
5729         (incremental_test_4): Likewise.
5730         (incremental_test_5): Likewise.
5731         (incremental_test_6): Likewise.
5732         (incremental_copy_test): Likewise.
5733         (incremental_common_test_1): Likewise.
5734         * testsuite/Makefile.in: Regenerate.
5735
5736 2011-08-26  Nick Clifton  <nickc@redhat.com>
5737
5738         * po/es.po: Updated Spanish translation.
5739
5740 2011-08-01  Cary Coutant  <ccoutant@google.com>
5741
5742         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
5743         * gold/testsuite/Makefile.in: Regenerate.
5744         * gold/testsuite/justsyms_exec.c: New source file.
5745         * gold/testsuite/justsyms_lib.c: New source file.
5746
5747 2011-08-01  Cary Coutant  <ccoutant@google.com>
5748
5749         * layout.cc (Layout::set_segment_offsets): Don't realign text
5750         segment if -Ttext was specified.
5751         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
5752         file type.
5753         * object.h (Sized_relobj_file::e_type): New function.
5754         (Sized_relobj_file::e_type_): New data member.
5755         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
5756         base address for ET_EXEC files.
5757         * target.cc (Target::do_make_elf_object_implementation): Allow
5758         ET_EXEC files with --just-symbols option.
5759
5760 2011-07-28  Cary Coutant  <ccoutant@google.com>
5761
5762         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
5763         Add thread_number parameter.
5764         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
5765         * workqueue-threads.cc
5766         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
5767         current thread if its thread number is greater than desired thread
5768         count.
5769         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
5770         Add thread_number parameter.
5771         (Workqueue::should_cancel_thread): Likewise.
5772         (Workqueue::find_runnable_or_wait): Pass thread_number to
5773         should_cancel_thread.
5774         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
5775         parameter.
5776
5777 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
5778
5779         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
5780         only after checking if it cannot be forced local.
5781         * symtab.h (is_externally_visible): Check if the symbol is not forced
5782         local.
5783
5784 2011-07-15  Ian Lance Taylor  <iant@google.com>
5785
5786         * options.h (class General_options): Add --print-output-format.
5787         Move -EL next to -EB, for  better --help output.
5788         * target-select.cc: Include <cstdio>, "options.h", and
5789         "parameters.h".
5790         (Target_selector::do_target_bfd_name): New function.
5791         (print_output_format): New function.
5792         * target-select.h (class Target_selector): Update declarations.
5793         (Target_selector::target_bfd_name): New function.
5794         (print_output_format): Declare.
5795         * main.cc: Include "target-select.h".
5796         (main): Handle --print-output-format.
5797         * gold.cc: Include "target-select.h".
5798         (queue_initial_tasks): Handle --print-output-format when there are
5799         no input files.
5800         * parameters.cc (parameters_force_valid_target): Give a better
5801         error message if -EB/-EL does not match target.
5802         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
5803         function.
5804
5805 2011-07-15  Ian Lance Taylor  <iant@google.com>
5806
5807         * i386.cc (class Output_data_plt_i386): Add layout_ field.
5808         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
5809         (Output_data_plt_i386::do_write): Write address of .dynamic
5810         section to first entry in .got.plt section.
5811         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
5812         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5813         Initialize layout_.
5814         (Output_data_plt_x86_64::do_write): Write address of .dynamic
5815         section to first entry in .got.plt section.
5816         * layout.h (Layout::dynamic_section): New function.
5817
5818 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
5819
5820         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
5821         to claim_file call.
5822         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
5823         input_section_position_, and input_section_glob_.
5824         (read_layout_from_file): Call function section_ordering_specified.
5825         * layout.h (is_section_ordering_specified): New function.
5826         (section_ordering_specified): New function.
5827         (section_ordering_specified_): New boolean member.
5828         * main.cc(main): Call load_plugins after layout object is defined.
5829         * output.cc (Output_section::add_input_section): Use
5830         function section_ordering_specified to check if section ordering is
5831         needed.
5832         * output.cc (Output_section::add_relaxed_input_section): Use
5833         function section_ordering_specified to check if section ordering is
5834         needed.
5835         (Output_section::update_section_layout): New function.
5836         (Output_section::sort_attached_input_sections): Check if input section
5837         must be reordered.
5838         * output.h (Output_section::update_section_layout): New function.
5839         * plugin.cc (get_section_count): New function.
5840         (get_section_type): New function.
5841         (get_section_name): New function.
5842         (get_section_contents): New function.
5843         (update_section_order): New function.
5844         (allow_section_ordering): New function.
5845         (Plugin::load): Add the new interfaces to the transfer vector.
5846         (Plugin_manager::load_plugins): New parameter.
5847         (Plugin_manager::all_symbols_read): New parameter.
5848         (Plugin_manager::claim_file): New parameter. Save the elf object for
5849         unclaimed objects.
5850         (Plugin_manager::get_elf_object): New function.
5851         (Plugin_manager::get_view): Change to directly use the bool to check
5852         if get_view is called from claim_file_hook.
5853         * plugin.h (input_objects): New function
5854         (Plugin__manager::load_plugins): New parameter.
5855         (Plugin_manager::claim_file): New parameter.
5856         (Plugin_manager::get_elf_object): New function.
5857         (Plugin_manager::in_claim_file_handler): New function.
5858         (Plugin_manager::in_claim_file_handler_): New member.
5859         (layout): New function.
5860         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
5861         handler with an extra parameter. Make the elf object before calling
5862         claim_file handler.
5863         * testsuite/plugin_test.c (get_section_count): New function pointer.
5864         (get_section_type): New function pointer.
5865         (get_section_name): New function pointer.
5866         (get_section_contents): New function pointer.
5867         (update_section_order): New function pointer.
5868         (allow_section_ordering): New function pointer.
5869         (onload): Check if the new interfaces exist.
5870
5871 2011-07-13  Ian Lance Taylor  <iant@google.com>
5872
5873         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
5874         relro section.
5875         * x86_64.cc (Target_x86_64::got_section): Likewise.
5876         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
5877         (relro_now_test_SOURCES): New variable.
5878         (relro_now_test_DEPENDENCIES): New variable.
5879         (relro_now_test_LDFLAGS): New variable.
5880         (relro_now_test_LDADD): New variable.
5881         (relro_now_test.so): New target.
5882         * testsuite/Makefile.in: Rebuild.
5883
5884 2011-07-12  Ian Lance Taylor  <iant@google.com>
5885
5886         PR gold/12980
5887         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
5888         GLOB_DAT relocation rather than a RELATIVE relocation for a
5889         protected symbol when creating a shared library.
5890         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5891         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
5892         * testsuite/protected_main_1.cc (main): Test that protected
5893         function has same address.
5894
5895 2011-07-11  Ian Lance Taylor  <iant@google.com>
5896
5897         PR gold/12979
5898         * options.h (class General_options): Add -Bgroup.
5899         * options.cc (General_options::finalize): If -Bgroup is set,
5900         default to --unresolved-symbols=report-all.
5901         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
5902         * target-reloc.h (issue_undefined_symbol_error): Handle
5903         --unresolved-symbols=report-all.
5904
5905 2011-07-08  Ian Lance Taylor  <iant@google.com>
5906
5907         PR gold/11985
5908         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
5909         if linker script discards key sections.
5910         (Layout::create_dynamic_symtab): Likewise.
5911         (Layout::assign_local_dynsym_offsets): Likewise.
5912         (Layout::sized_create_version_sections): Likewise.
5913         (Layout::create_interp): Likewise.
5914         (Layout::finish_dynamic_section): Likewise.
5915         (Layout::set_dynamic_symbol_size): Likewise.
5916
5917 2011-07-08  Ian Lance Taylor  <iant@google.com>
5918
5919         PR gold/12386
5920         * options.h (class General_options): Add --unresolved-symbols.
5921         * target-reloc.h (issue_undefined_symbol_error): Check
5922         --unresolved-symbols.  Add comments.
5923
5924 2011-07-08  Ian Lance Taylor  <iant@google.com>
5925
5926         * testsuite/odr_violation2.cc (Ordering::operator()): Make
5927         expression more complex.
5928
5929 2011-07-08  Ian Lance Taylor  <iant@google.com>
5930
5931         PR gold/11317
5932         * target-reloc.h (issue_undefined_symbol_error): New inline
5933         function, broken out of relocate_section.
5934         (relocate_section): Call issue_undefined_symbol_error.
5935         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5936         there is no TLS segment if we are about to issue an undefined
5937         symbol error.
5938         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5939
5940 2011-07-08  Ian Lance Taylor  <iant@google.com>
5941
5942         PR gold/12279
5943         * resolve.cc (Symbol_table::should_override): Add fromtype
5944         parameter.  Change all callers.  Give error when linking together
5945         TLS and non-TLS symbol.
5946         (Symbol_table::should_override_with_special): Add fromtype
5947         parameter.  Change all callers.
5948         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5949         there is no TLS segment if we have reported some errors.
5950         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5951
5952 2011-07-08  Ian Lance Taylor  <iant@google.com>
5953
5954         PR gold/12372
5955         * target.h (Target::plt_address_for_global): New function.
5956         (Target::plt_address_for_local): New function.
5957         (Target::plt_section_for_global): Remove.
5958         (Target::plt_section_for_local): Remove.
5959         (Target::do_plt_address_for_global): New virtual function.
5960         (Target::do_plt_address_for_local): New virtual function.
5961         (Target::do_plt_section_for_global): Remove.
5962         (Target::do_plt_section_for_local): Remove.
5963         (Target::register_global_plt_entry): Add Symbol_table and Layout
5964         parameters.
5965         * output.cc (Output_data_got::Got_entry::write): Use
5966         plt_address_for_global and plt_address_for_local.
5967         * layout.cc (Layout::add_target_dynamic_tags): Use size and
5968         address of output section.
5969         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
5970         got_irelative_, and irelative_count_ fields.  Update
5971         declarations.
5972         (Output_data_plt_i386::has_irelative_section): New function.
5973         (Output_data_plt_i386::entry_count): Add irelative_count_.
5974         (Output_data_plt_i386::set_final_data_size): Likewise.
5975         (class Target_i386): Add got_irelative_ and rel_irelative_
5976         fields.  Update declarations.
5977         (Target_i386::Target_i386): Initialize new fields.
5978         (Target_i386::do_plt_address_for_global): New function replacing
5979         do_plt_section_for_global.
5980         (Target_i386::do_plt_address_for_local): New function replacing
5981         do_plt_section_for_local.
5982         (Target_i386::got_section): Create got_irelative_.
5983         (Target_i386::rel_irelative_section): New function.
5984         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
5985         fields.  Don't define __rel_iplt_{start,end}.
5986         (Output_data_plt_i386::add_entry): Add symtab and layout
5987         parameters.  Change all callers.  Use different PLT and GOT for
5988         IFUNC symbols.
5989         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
5990         layout parameters.  Change all callers.  Use different PLT and
5991         GOT.
5992         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
5993         (Output_data_plt_i386::rel_irelative): New function.
5994         (Output_data_plt_i386::address_for_global): New function.
5995         (Output_data_plt_i386::address_for_local): New function.
5996         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
5997         IRELATIVE GOT when changing IFUNC GOT entries.
5998         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
5999         reloc.
6000         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
6001         if we didn't create an IRELATIVE GOT.
6002         (Target_i386::Relocate::relocate): Use plt_address_for_global and
6003         plt_address_for_local.
6004         (Target_i386::do_dynsym_value): Use plt_address_for_global.
6005         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
6006         got_irelative_, and irelative_count_ fields.  Update
6007         declarations.
6008         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
6009         Initialize new fields.  Remove symtab parameter.  Change all
6010         callers.
6011         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
6012         irelative_count_.
6013         (Output_data_plt_x86_64::has_irelative_section): New function.
6014         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
6015         (class Target_x86_64): Add got_irelative_ and rel_irelative_
6016         fields.  Update declarations.
6017         (Target_x86_64::Target_x86_64): Initialize new fields.
6018         (Target_x86_64::do_plt_address_for_global): New function replacing
6019         do_plt_section_for_global.
6020         (Target_x86_64::do_plt_address_for_local): New function replacing
6021         do_plt_section_for_local.
6022         (Target_x86_64::got_section): Create got_irelative_.
6023         (Target_x86_64::rela_irelative_section): New function.
6024         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
6025         all callers.  Don't create __rel_iplt_{start,end}.
6026         (Output_data_plt_x86_64::add_entry): Add symtab and layout
6027         parameters.  Change all callers.  Use different PLT and GOT for
6028         IFUNC symbols.
6029         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
6030         layout parameters.  Change all callers.  Use different PLT and
6031         GOT.
6032         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
6033         parameters.  Change all callers.  Use different PLT and GOT for
6034         IFUNC symbols.
6035         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
6036         (Output_data_plt_x86_64::rela_irelative): New function.
6037         (Output_data_plt_x86_64::address_for_global): New function.
6038         (Output_data_plt_x86_64::address_for_local): New function.
6039         (Output_data_plt_x86_64::set_final_data_size): Likewise.
6040         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
6041         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
6042         (Target_x86_64::register_global_plt_entry): Add symtab and layout
6043         parameters.
6044         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
6045         reloc.
6046         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
6047         symbols if we didn't create an IRELATIVE GOT.
6048         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
6049         plt_address_for_local.
6050         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
6051         * testsuite/ifuncvar1.c: New test file.
6052         * testsuite/ifuncvar2.c: New test file.
6053         * testsuite/ifuncvar3.c: New test file.
6054         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
6055         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
6056         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
6057         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
6058         * testsuite/Makefile.in: Rebuild.
6059
6060 2011-07-07  Cary Coutant  <ccoutant@google.com>
6061
6062         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
6063         (two_file_test_1_ndebug.o): Likewise.
6064         (two_file_test_1b_ndebug.o): Likewise.
6065         (two_file_test_2_ndebug.o): Likewise.
6066         (two_file_test_main_ndebug.o): Likewise.
6067         (incremental_test_2): Link with no-debug versions.
6068
6069 2011-07-06  Cary Coutant  <ccoutant@google.com>
6070
6071         * gold/incremental.cc
6072         (Output_section_incremental_inputs::write_info_blocks): Check for
6073         hidden and internal symbols.
6074
6075 2011-07-06  Cary Coutant  <ccoutant@google.com>
6076
6077         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
6078         Check disposition for startup file.
6079         (Incremental_inputs::report_command_line): Ignore
6080         --incremental-startup-unchanged option.
6081         * options.cc (General_options::parse_incremental_startup_unchanged):
6082         New function.
6083         (General_options::General_options): Initialize new data member.
6084         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
6085         (General_options): Add --incremental-startup-unchanged option.
6086         (General_options::incremental_startup_disposition): New function.
6087         (General_options::incremental_startup_disposition_): New data member.
6088
6089 2011-07-06  Cary Coutant  <ccoutant@google.com>
6090
6091         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
6092         input file index to Script_info ctor.
6093         (Sized_incremental_binary::do_file_has_changed): Find the
6094         command-line argument for files named in scripts.
6095         * incremental.h (Script_info::Script_info): New ctor
6096         with input file index.
6097         (Script_info::input_file_index): New function.
6098         (Script_info::input_file_index_): New data member.
6099         (Incremental_binary::get_library): Add const.
6100         (Incremental_binary::get_script_info): Add const.
6101         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
6102         * testsuite/Makefile.am (incremental_test_5): New test case.
6103         (incremental_test_6): New test case.
6104         * testsuite/Makefile.in: Regenerate.
6105
6106 2011-07-06  Cary Coutant  <ccoutant@google.com>
6107
6108         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
6109         debug output when command lines differ.
6110
6111 2011-07-06  Cary Coutant  <ccoutant@google.com>
6112
6113         * incremental.cc (Incremental_inputs::report_command_line): Ignore
6114         --incremental-patch option.
6115         * layout.cc (Free_list::allocate): Extend allocation beyond original
6116         end if enabled.
6117         (Layout::make_output_section): Mark sections that should get
6118         patch space.
6119         * options.cc (parse_percent): New function.
6120         * options.h (parse_percent): New function.
6121         (DEFINE_percent): New macro.
6122         (General_options): Add --incremental-patch option.
6123         * output.cc (Output_section::Output_section): Initialize new data
6124         members.
6125         (Output_section::add_input_section): Print section name when out
6126         of patch space.
6127         (Output_section::add_output_section_data): Likewise.
6128         (Output_section::set_final_data_size): Add patch space when
6129         doing --incremental-full.
6130         (Output_section::do_reset_address_and_file_offset): Remove patch
6131         space.
6132         (Output_segment::set_section_list_addresses): Print debug output
6133         only if --incremental-update.
6134         * output.h (Output_section::set_is_patch_space_allowed): New function.
6135         (Output_section::is_patch_space_allowed_): New data member.
6136         (Output_section::patch_space_): New data member.
6137         * parameters.cc (Parameters::incremental_full): New function.
6138         * parameters.h (Parameters::incremental_full): New function
6139         * testsuite/Makefile.am (incremental_test_2): Add test for
6140         --incremental-patch option.
6141         * testsuite/Makefile.in: Regenerate.
6142         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
6143         (t18): Remove function body.
6144
6145 2011-07-05  Doug Kwan  <dougkwan@google.com>
6146
6147         PR gold/12771
6148         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
6149         Arm_Address type for relocation result.
6150         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
6151         overflow check.
6152         (Arm_relocate_functions::abs32): Use unaligned access.
6153         (Arm_relocate_functions::rel32): Ditto.
6154         (Arm_relocate_functions::prel31): Ditto.
6155         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
6156         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
6157         static data relocations.
6158         * testsuite/Makefile.in: Regnerate.
6159         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
6160
6161 2011-07-05  Ian Lance Taylor  <iant@google.com>
6162
6163         PR gold/12392
6164         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
6165         symbols if necessary.
6166         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6167
6168 2011-07-05  Ian Lance Taylor  <iant@google.com>
6169
6170         PR gold/12952
6171         * resolve.cc (Symbol::override_base_with_special): Simply override
6172         version with special symbol version, ignoring previous version.
6173
6174 2011-07-05  Ian Lance Taylor  <iant@google.com>
6175
6176         * object.cc (Sized_relobj_file::include_section_group): Add
6177         information to comment about signature location.
6178
6179 2011-07-02  Ian Lance Taylor  <iant@google.com>
6180
6181         PR gold/12957
6182         * options.h (class General_options): Add -f and -F.
6183         * options.cc (General_options::finalize): Fatal error if -f/-F
6184         are used without -shared.
6185         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
6186
6187 2011-07-02  Ian Lance Taylor  <iant@google.com>
6188
6189         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
6190
6191 2011-07-01  Ian Lance Taylor  <iant@google.com>
6192
6193         PR gold/12525
6194         PR gold/12952
6195         * resolve.cc (Symbol::override_base_with_special): Don't override
6196         the version if the overriding symbol has a different name.
6197         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
6198         all callers.  If we give an error about an undefined version,
6199         define the base version if necessary.
6200         * dynobj.h (class Versions): Update declaration.
6201         * testsuite/weak_alias_test_5.cc: New file.
6202         * testsuite/weak_alias_test.script: New file.
6203         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
6204         and versioned_alias have the right value, and call t2.
6205         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
6206         weak_alias_test_5.so.
6207         (weak_alias_test_LDADD): Likewise.
6208         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
6209         * testsuite/Makefile.in: Rebuild.
6210
6211 2011-07-01  Ian Lance Taylor  <iant@google.com>
6212
6213         PR gold/12525
6214         * options.h (class General_options): Support -z notext.
6215         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
6216         -Wl,-z,notext.
6217         (two_file_shared_nonpic.so): Likewise.
6218         (two_file_shared_mixed.so): Likewise.
6219         (two_file_shared_mixed_1.so): Likewise.
6220         (weak_undef_lib_nonpic.so): Likewise.
6221         (alt/weak_undef_lib_nonpic.so): Likewise.
6222         (tls_test_shared_nonpic.so): Likewise.
6223         * testsuite/Makefile.in: Rebuild.
6224
6225 2011-07-01  Ian Lance Taylor  <iant@google.com>
6226
6227         PR gold/12525
6228         * configure.ac: Test whether static linking works, setting
6229         the automake conditional HAVE_STATIC.
6230         * testsuite/Makefile.am: Disable tests using -static if
6231         HAVE_STATIC is not true.
6232         * configure, testsuite/Makefile.in: Rebuild.
6233
6234 2011-07-01  Ian Lance Taylor  <iant@google.com>
6235
6236         PR gold/12525
6237         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
6238         Assert if we see DW_EH_PE_indirect.
6239         * target.h (Target::ehframe_datarel_base): New function.
6240         (Target::do_ehframe_datarel_base): New target function.
6241         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
6242         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
6243         function.
6244
6245 2011-07-01  Ian Lance Taylor  <iant@google.com>
6246
6247         PR gold/12571
6248         * options.h (class General_options): Add
6249         --ld-generated-unwind-info.
6250         * ehframe.cc (Fde::write): Add address parameter.  Change all
6251         callers.  If associated with PLT, fill in address and size.
6252         (Cie::set_output_offset): Only add merge mapping if there is an
6253         object.
6254         (Cie::write): Add address parameter.  Change all callers.
6255         (Eh_frame::add_ehframe_for_plt): New function.
6256         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
6257         input_offset_ fields into union u_, with new plt field.
6258         (Fde::Fde): Adjust for new union field.
6259         (Fde::Fde) [Output_data version]: New constructor.
6260         (Fde::add_mapping): Only add merge mapping if there is an object.
6261         (class Cie): Update declarations.
6262         (class Eh_frame): Declare add_ehframe_for_plt.
6263         * layout.cc (Layout::layout_eh_frame): Break out code into
6264         make_eh_frame_section, and call it.
6265         (Layout::make_eh_frame_section): New function.
6266         (Layout::add_eh_frame_for_plt): New function.
6267         * layout.h (class Layout): Update declarations.
6268         * merge.cc (Merge_map::add_mapping): Add assertion.
6269         * i386.cc: Include "dwarf.h".
6270         (class Output_data_plt_i386): Make first_plt_entry,
6271         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
6272         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6273         and plt_eh_frame_fde.
6274         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
6275         boundary.  Call add_eh_frame_for_plt if appropriate.
6276         * x86_64.cc: Include "dwarf.h".
6277         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
6278         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
6279         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6280         and plt_eh_frame_fde.
6281         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
6282         appropriate.
6283
6284 2011-06-29  Ian Lance Taylor  <iant@google.com>
6285
6286         PR gold/12629
6287         * object.cc (Sized_relobj_file::layout_section): Change shdr
6288         parameter to be const.
6289         (Sized_relobj_file::layout_eh_frame_section): New function, broken
6290         out of do_layout.
6291         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
6292         appropriate.  Call layout_eh_frame_section.
6293         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
6294         sections.
6295         * object.h (class Sized_relobj_file): Update declarations.
6296
6297 2011-06-29  Ian Lance Taylor  <iant@google.com>
6298
6299         PR gold/12652
6300         * script.cc (Token::integer_value): Accept trailing M/m/K/k
6301         modifier.
6302         (Lex::gather_token): Accept trailing M/m/K/k for integers.
6303
6304 2011-06-29  Ian Lance Taylor  <iant@google.com>
6305
6306         PR gold/12675
6307         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
6308         SHT_X86_64_UNWIND.
6309         * layout.cc (Layout::layout_eh_frame): Likewise.
6310
6311 2011-06-29  Ian Lance Taylor  <iant@google.com>
6312
6313         PR gold/12695
6314         * layout.cc (Layout::symtab_section_shndx): New function.
6315         * layout.h (class Layout): Declare symtab_section_shndx.
6316         * output.cc (Output_section::write_header): Call it.
6317
6318 2011-06-29  Ian Lance Taylor  <iant@google.com>
6319
6320         PR gold/12818
6321         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
6322         symbols which are not used in a relocation.
6323
6324 2011-06-28  Ian Lance Taylor  <iant@google.com>
6325
6326         PR gold/12898
6327         * layout.cc (Layout::segment_precedes): Don't crash if a linker
6328         script create indistinguishable segments.
6329         (Layout::set_segment_offsets): Use stable_sort when sorting
6330         segments.  Pass this to Compare_segments constructor.
6331         * layout.h (class Layout): Make segment_precedes non-static.
6332         (class Compare_segments): Change from struct to class.  Add
6333         layout_ field.  Add constructor.
6334         * script-sections.cc
6335         (Script_sections::attach_sections_using_phdrs_clause): Rename
6336         local orphan to is_orphan.  Don't report failure to put empty
6337         section in segment.  On attachment failure, report name of
6338         section, and attach to first PT_LOAD segment.
6339
6340 2011-06-28  Ian Lance Taylor  <iant@google.com>
6341
6342         PR gold/12934
6343         * target-select.cc (Target_selector::Target_selector): Add
6344         emulation parameter.  Change all callers.
6345         (select_target_by_bfd_name): Rename from select_target_by_name.
6346         Change all callers.
6347         (select_target_by_emulation): New function.
6348         (supported_emulation_names): New function.
6349         * target-select.h (class Target_selector): Add emulation_ field.
6350         Update declarations.
6351         (Target_selector::recognize_by_bfd_name): Rename from
6352         recognize_by_name.  Change all callers.
6353         (Target_selector::supported_bfd_names): Rename from
6354         supported_names.  Change all callers.
6355         (Target_selector::recognize_by_emulation): New function.
6356         (Target_selector::supported_emulations): New function.
6357         (Target_selector::emulation): New function.
6358         (Target_selector::do_recognize_by_bfd_name): Rename from
6359         do_recognize_by_name.  Change all callers.
6360         (Target_selector::do_supported_bfd_names): Rename from
6361         do_supported_names.  Change all callers.
6362         (Target_selector::do_recognize_by_emulation): New function.
6363         (Target_selector::do_supported_emulations): New function.
6364         (select_target_by_bfd_name): Change name in declaration.
6365         (select_target_by_emulation): Declare.
6366         (supported_emulation_names): Declare.
6367         * parameters.cc (parameters_force_valid_target): Try to find
6368         target based on emulation from -m option.
6369         * options.h (class General_options): Change doc string for -m.
6370         * options.cc (help): Print emulations.
6371         (General_options::parse_V): Likewise.
6372         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
6373         Add emulation parameter.  Change all callers.
6374
6375 2011-06-28  Ian Lance Taylor  <iant@google.com>
6376
6377         * target.h (class Target): Add osabi_ field.
6378         (Target::osabi): New function.
6379         (Target::set_osabi): New function.
6380         (Target::Target): Initialize osabi_.
6381         (Target::do_adjust_elf_header): Make pure virtual.
6382         (Sized_target::do_adjust_elf_header): Declare.
6383         * target.cc (Sized_target::do_adjust_elf_header): New function.
6384         (class Sized_target): Instantiate all versions.
6385         * freebsd.h (class Target_freebsd): Remove.
6386         (Target_selector_freebsd::do_recognize): Call set_osabi on
6387         Target.
6388         (Target_selector_freebsd::do_recognize_by_name): Likewise.
6389         (Target_selector_freebsd::set_osabi): Remove.
6390         * i386.cc (class Target_i386): Inherit from Sized_target rather
6391         than Target_freebsd.
6392         * x86_64.cc (class Target_x86_64): Likewise.
6393
6394 2011-06-28  Ian Lance Taylor  <iant@google.com>
6395
6396         * target.h (Target::can_check_for_function_pointers): Rewrite.
6397         Make non-virtual.
6398         (Target::can_icf_inline_merge_sections): Likewise.
6399         (Target::section_may_have_icf_unsafe_poineters): Likewise.
6400         (Target::Target_info): Add can_icf_inline_merge_sections field.
6401         (Target::do_can_check_for_function_pointers): New virtual
6402         function.
6403         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
6404         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
6405         from can_check_for_function_pointers, move in file.
6406         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
6407         section_may_have_icf_unsafe_poineters, move in file.
6408         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
6409         * i386.cc (Target_i386::do_can_check_for_function_pointers):
6410         Rename from can_check_for_function_pointers, move in file.
6411         (Target_i386::can_icf_inline_merge_sections): Remove.
6412         (Target_i386::i386_info): Initialize
6413         can_icf_inline_merge_sections.
6414         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6415         Initialize can_icf_inline_merge_sections.
6416         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
6417         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
6418         Rename from can_check_for_function_pointers, move in file.
6419         (Target_x86_64::can_icf_inline_merge_sections): Remove.
6420         (Target_x86_64::x86_64_info): Initialize
6421         can_icf_inline_merge_sections.
6422         * testsuite/testfile.cc (Target_test::test_target_info):
6423         Likewise.
6424         * icf.cc (get_section_contents): Correct formatting.
6425
6426 2011-06-27  Ian Lance Taylor  <iant@google.com>
6427
6428         * symtab.cc (Symbol::versioned_name): New function.
6429         (Symbol_table::add_to_final_symtab): Use versioned_name when
6430         appropriate.
6431         (Symbol_table::sized_write_symbol): Likewise.
6432         * symtab.h (class Symbol): Declare versioned_name.
6433         * stringpool.h (class Stringpool_template): Add variant of add
6434         which takes a std::basic_string.
6435         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
6436         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
6437         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
6438         (ver_test_12.o): New target.
6439         * testsuite/Makefile.in: Rebuild.
6440
6441 2011-06-27  Doug Kwan  <dougkwan@google.com>
6442
6443         * arm.cc (Arm_relocate_functions::thm_jump8,
6444         Arm_relocate_functions::thm_jump11): Use a wider signed
6445         type to compute offset.
6446         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
6447         arm_thm_jump8.
6448         * testsuite/Makefile.in: Regenerate.
6449         * testsuite/arm_branch_in_range.sh: Check test results of
6450         arm_thm_jump11 and arm_thm_jump8.
6451         * testsuite/arm_thm_jump11.s: New test source file.
6452         * testsuite/arm_thm_jump11.t: New linker script.
6453         * testsuite/arm_thm_jump8.s: New test source file.
6454         * testsuite/arm_thm_jump8.t: New linker script.
6455
6456 2011-06-24  Ian Lance Taylor  <iant@google.com>
6457
6458         * layout.cc: Include "object.h".
6459         (ctors_sections_in_init_array): New static variable.
6460         (Layout::is_ctors_in_init_array): New function.
6461         (Layout::layout): Add entry to ctors_sections_in_init_array if
6462         appropriate.
6463         * layout.h (class Layout): Declare is_ctors_in_init_array.
6464         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
6465         is_ctors_reverse_view is set.
6466         (Sized_relobj_file::write_sections): Add layout parameter.  Change
6467         all callers.  Set is_ctors_reverse_view field of View_size.
6468         (Sized_relobj_file::reverse_words): New function.
6469         * object.h (Sized_relobj_file::View_size): Add
6470         is_ctors_reverse_view field.
6471         (class Sized_relobj_file): Update declarations.
6472         * testsuite/initpri3.c: New test.
6473         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
6474         initpri3b.
6475         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
6476         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
6477         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
6478         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
6479         * testsuite/Makefile.in: Rebuild.
6480
6481 2011-06-24  Cary Coutant  <ccoutant@google.com>
6482
6483         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
6484         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
6485         (debug_msg_cdebug.err): New targets.
6486         * testsuite/Makefile.in: Regenerate.
6487         * testsuite/debug_msg.sh: Check output of link with compressed debug.
6488         Fix checks for link with shared library.
6489
6490 2011-06-24  Doug Kwan  <dougkwan@google.com>
6491
6492         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
6493         skip empty text sections.
6494         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
6495
6496 2011-06-22  Ian Lance Taylor  <iant@google.com>
6497
6498         PR gold/12910
6499         * options.h (class General_options): Add --ctors-in-init-array.
6500         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
6501         friends as SHT_PROGBITS for merging sections.
6502         (Layout::layout): Remove special handling of .init_array and
6503         friends.  Don't sort if doing relocatable link.  Sort for .ctors
6504         and .dtors if ctors_in_init_array.
6505         (Layout::make_output_section): Force correct section types for
6506         .init_array and friends.  Don't sort if doing relocatable link,
6507         Don't sort .ctors and .dtors if ctors_in_init_array.
6508         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
6509         (Layout::output_section_name): Add relobj parameter.  Change all
6510         callers.  Handle .ctors. and .dtors. in code rather than table.
6511         Handle .ctors and .dtors if ctors_in_init_array.
6512         (Layout::match_file_name): New function, moved from output.cc.
6513         * layout.h (class Layout): Update declarations.
6514         * output.cc: Include "layout.h".
6515         (Input_section_sort_entry::get_priority): New function.
6516         (Input_section_sort_entry::match_file_name): Just call
6517         Layout::match_file_name.
6518         (Output_section::Input_section_sort_init_fini_compare::operator()):
6519         Handle .ctors and .dtors.  Sort by explicit priority rather than
6520         by name.
6521         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
6522         * testsuite/initpri2.c: New test.
6523         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
6524         (check_PROGRAMS): Add initpri2.
6525         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
6526         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
6527         * configure, testsuite/Makefile.in: Rebuild.
6528
6529 2011-06-19  Ian Lance Taylor  <iant@google.com>
6530
6531         PR gold/12880
6532         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
6533         .interp section to a PT_INTERP segment even if we have seen a
6534         --dynamic-linker option.  Don't do it if we have seen a PHDRS
6535         clause in a linker script.
6536         (Layout::finalize): Don't create a .interp section if we've
6537         already create a PT_INTERP segment.
6538         (Layout::create_interp): Always call choose_output_section (revert
6539         patch of 2011-06-17).  Don't create PT_INTERP segment.
6540         * script-sections.cc
6541         (Script_sections::create_note_and_tls_segments): Add a .interp
6542         section to a PT_INTERP segment even if we have seen a
6543         --dynamic-linker option.
6544
6545 2011-06-18  Ian Lance Taylor  <iant@google.com>
6546
6547         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
6548         merely because a non-PT_LOAD segment has a dynamic reloc.
6549
6550 2011-06-18  Ian Lance Taylor  <iant@google.com>
6551
6552         * layout.cc (Layout::finish_dynamic_section): Don't create
6553         DT_FLAGS entry if not needed.
6554
6555 2011-06-18  Ian Lance Taylor  <iant@google.com>
6556
6557         PR gold/12745
6558         * layout.cc (Layout::layout_eh_frame): Correct handling of
6559         writable .eh_frame section.
6560
6561 2011-06-17  Ian Lance Taylor  <iant@google.com>
6562
6563         PR gold/12893
6564         * resolve.cc (Symbol_table::resolve): Don't give an error if a
6565         symbol is redefined with the exact same object and value.
6566
6567 2011-06-17  Ian Lance Taylor  <iant@google.com>
6568
6569         PR gold/12880
6570         * layout.h (class Layout): Add interp_segment_ field.
6571         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
6572         (Layout::attach_allocated_section_to_segment): If making shared
6573         library, put .interp section in PT_INTERP segment.
6574         (Layout::finalize): Also call create_interp if -dynamic-linker
6575         option was used.
6576         (Layout::create_interp): Assert that there is no PT_INTERP
6577         segment.  If not using a SECTIONS clause, use make_output_section.
6578         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
6579         * script-sections.cc
6580         (Script_sections::create_note_and_tls_segments): If making shared
6581         library, put .interp section in PT_INTERP segment.
6582
6583 2011-06-17  Ian Lance Taylor  <iant@google.com>
6584
6585         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
6586         when making a shared library.
6587
6588 2011-06-17  Ian Lance Taylor  <iant@google.com>
6589
6590         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
6591         parameter.  Change all callers.  Don't issue warning about PC32
6592         against locally defined symbol.
6593
6594 2011-06-16  Ian Lance Taylor  <iant@google.com>
6595
6596         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
6597         occurs in same object.
6598
6599 2011-06-14  Alan Modra  <amodra@gmail.com>
6600
6601         * po/POTFILES.in: Regenerate.
6602
6603 2011-06-09  Ian Lance Taylor  <iant@google.com>
6604
6605         * script-sections.cc
6606         (Orphan_output_section::set_section_addresses): For a relocatable
6607         link set address to 0.
6608
6609 2011-06-09  Cary Coutant  <ccoutant@google.com>
6610
6611         PR gold/12804
6612         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
6613         used with --compress-debug-sections.
6614         * gold/object.cc (Sized_relobj_file::do_layout): Report
6615         uncompressed size of compressed input sections.
6616
6617 2011-06-08  Cary Coutant  <ccoutant@google.com>
6618
6619         PR gold/12804
6620         * testsuite/two_file_test_2_v1.cc: Change initialization of
6621         v2 to keep it in .data.
6622
6623 2011-06-07  Cary Coutant  <ccoutant@google.com>
6624
6625         * common.cc (Symbol_table::do_allocate_commons_list): Call
6626         gold_fallback.
6627         * errors.cc (Errors::fatal): Adjust call to gold_exit.
6628         (Errors::fallback): New function.
6629         (gold_fallback): New function.
6630         * errors.h (Errors::fallback): New function.
6631         * gold.cc (gold_exit): Change status parameter to enum; adjust
6632         all callers.
6633         (queue_initial_tasks): Call gold_fallback.
6634         * gold.h: Include cstdlib.
6635         (Exit_status): New enum type.
6636         (gold_exit): Change status parameter to enum.
6637         (gold_fallback): New function.
6638         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
6639         (Layout::create_symtab_sections): Likewise.
6640         (Layout::create_shdrs): Likewise.
6641         * main.cc (main): Adjust call to gold_exit.
6642         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
6643         (Output_data_got::add_got_entry_pair): Likewise.
6644         (Output_section::add_input_section): Likewise.
6645         (Output_section::add_output_section_data): Likewise.
6646         (Output_segment::set_section_list_addresses): Likewise.
6647         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
6648
6649 2011-06-07  Cary Coutant  <ccoutant@google.com>
6650
6651         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
6652         for incremental links.
6653         * output.cc (Output_segment::set_section_list_addresses): Remove
6654         FIXME and test for TLS or BSS.
6655
6656 2011-06-07  Cary Coutant  <ccoutant@google.com>
6657
6658         * testsuite/Makefile.am: Add incremental_copy_test,
6659         incremental_common_test_1.
6660         * testsuite/Makefile.in: Regenerate.
6661         * testsuite/common_test_1_v1.c: New source file.
6662         * testsuite/common_test_1_v2.c: New source file.
6663         * testsuite/copy_test_v1.cc: New source file.
6664
6665 2011-06-07  Cary Coutant  <ccoutant@google.com>
6666
6667         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
6668         update, allocate common from bss section's free list.
6669         * incremental-dump.cc (dump_incremental_inputs): Print flag for
6670         linker-defined symbols.
6671         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
6672         Skip GOT and PLT entries that are no longer referenced.
6673         (Output_section_incremental_inputs::write_info_blocks): Mark
6674         linker-defined symbols.
6675         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
6676         * output.cc (Output_section::allocate): New function.
6677         * output.h (Output_section::allocate): New function.
6678         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
6679         linker-defined symbols.
6680         (Symbol::override_base_with_special): Copy is_predefined_ flag.
6681         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
6682         (Symbol::init_base_output_data): Likewise.
6683         (Symbol::init_base_output_segment): Likewise.
6684         (Symbol::init_base_constant): Likewise.
6685         (Sized_symbol::init_output_data): Likewise.
6686         (Sized_symbol::init_output_segment): Likewise.
6687         (Sized_symbol::init_constant): Likewise.
6688         (Symbol_table::do_define_in_output_data): Likewise.
6689         (Symbol_table::do_define_in_output_segment): Likewise.
6690         (Symbol_table::do_define_as_constant): Likewise.
6691         * symtab.h (Symbol::is_predefined): New function.
6692         (Symbol::init_base_output_data): Add is_predefined parameter.
6693         (Symbol::init_base_output_segment): Likewise.
6694         (Symbol::init_base_constant): Likewise.
6695         (Symbol::is_predefined_): New data member.
6696         (Sized_symbol::init_output_data): Add is_predefined parameter.
6697         (Sized_symbol::init_output_segment): Likewise.
6698         (Sized_symbol::init_constant): Likewise.
6699         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
6700
6701 2011-06-07  Cary Coutant  <ccoutant@google.com>
6702
6703         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
6704         instead of emit_copy_reloc.
6705         (Copy_relocs::emit_copy_reloc): Refactor.
6706         (Copy_relocs::make_copy_reloc): New function.
6707         (Copy_relocs::add_copy_reloc): Remove.
6708         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
6709         section.
6710         (Copy_relocs::make_copy_reloc): New function.
6711         (Copy_relocs::add_copy_reloc): Remove.
6712         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
6713         unchanged input files.
6714         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
6715         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
6716         Reserve BSS space for COPY relocations.
6717         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6718         (Output_section_incremental_inputs::write_info_blocks): Record
6719         whether a symbol is copied from a shared object.
6720         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
6721         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
6722         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
6723         (Incremental_input_entry_reader::get_output_symbol_index): Add
6724         is_copy parameter.
6725         (Incremental_binary::emit_copy_relocs): New function.
6726         (Incremental_binary::do_emit_copy_relocs): New function.
6727         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6728         new data member.
6729         (Sized_incremental_binary::add_copy_reloc): New function.
6730         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6731         (Sized_incremental_binary::Copy_reloc): New struct.
6732         (Sized_incremental_binary::Copy_relocs): New typedef.
6733         (Sized_incremental_binary::copy_relocs_): New data member.
6734         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
6735         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
6736         * target.h (Sized_target::emit_copy_reloc): New function.
6737         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
6738
6739 2011-06-02  Cary Coutant  <ccoutant@google.com>
6740
6741         PR gold/12163
6742         * gold/archive.cc (Archive::Archive): Initialize new data member.
6743         (Archive::include_all_members): Return if archive has already been
6744         included.
6745         * gold/archive.h (Archive::include_all_members_): New data member.
6746
6747 2011-06-02  Nick Clifton  <nickc@redhat.com>
6748
6749         * dynobj.h: Fix spelling mistake in comment.
6750         * output.cc: Likewise.
6751
6752 2011-05-31  Doug Kwan  <dougkwan@google.com>
6753             Asier Llano
6754
6755         PR gold/12826
6756         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
6757         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
6758         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
6759         redundant arm_exidx_test.so.
6760         * testsuite/Makefile.in: Regenerate.
6761         (check_SCRIPTS): Add pr12826.sh
6762         (check_DATA): Add pr12826.stdout
6763         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
6764         * testsuite/pr12826.sh: New file.
6765         * testsuite/pr12826_1.s: Ditto.
6766         * testsuite/pr12826_1.s: Ditto.
6767
6768 2011-05-30  Ian Lance Taylor  <iant@google.com>
6769
6770         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
6771         sections.
6772
6773 2011-05-29  Ian Lance Taylor  <iant@google.com>
6774
6775         PR gold/12804
6776         * testsuite/Makefile.am: Use different file name for two_file_test
6777         temporary file for each incremental test.
6778         * testsuite/Makefile.in: Rebuild.
6779
6780 2011-05-29  Ian Lance Taylor  <iant@google.com>
6781
6782         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
6783         binary input file is empty.
6784
6785 2011-05-27  Ian Lance Taylor  <iant@google.com>
6786
6787         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
6788         (ver_test_9.so): Likewise.
6789         * testsuite/Makefile.in: Rebuild.
6790
6791 2011-05-26 Cary Coutant  <ccoutant@google.com>
6792
6793         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
6794         * incremental.cc (Incremental_inputs::report_input_section): Fix
6795         comment, indentation.
6796         (Incremental_inputs::report_comdat_group): New function.
6797         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6798         of data for incremental input file entry.
6799         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
6800         group count, COMDAT group signatures.
6801         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
6802         an unchanged input file.
6803         * incremental.h (Incremental_object_entry::Incremental_object_entry):
6804         Initialize new data member.
6805         (Incremental_object_entry::add_comdat_group): New function.
6806         (Incremental_object_entry::get_comdat_group_count): New function.
6807         (Incremental_object_entry::get_comdat_signature_key): New function.
6808         (Incremental_object_entry::groups_): New data member.
6809         (Incremental_inputs::report_comdat_group): New function.
6810         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
6811         data for incremental input file entry.
6812         (Incremental_input_entry_reader::get_comdat_group_count): New function.
6813         (Incremental_input_entry_reader::get_input_section): Adjust size of
6814         data for incremental input file entry.
6815         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
6816         (Incremental_input_entry_reader::get_comdat_group_signature): New
6817         function.
6818         * object.cc (Sized_relobj::include_section_group): Report kept
6819         COMDAT groups for incremental links.
6820
6821 2011-05-24  David Meyer  <pdox@google.com>
6822
6823         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
6824         with name parameter.  Add found_name parameter.
6825         * fileread.cc (Input_file::find_file): Adjust code accordingly.
6826         * dirsearch.h (class Dirsearch): Update declaration.
6827
6828 2011-05-24  Ian Lance Taylor  <iant@google.com>
6829
6830         * archive.cc (Library_base::should_include_member): Pull in object
6831         from archive if it defines the entry symbol.
6832         * parameters.cc (Parameters::entry): New function.
6833         * parameters.h (class Parameters): Declare entry.
6834         * output.h (class Output_file_header): Remove entry_ field.
6835         * output.cc (Output_file_header::Output_file_header): Remove entry
6836         parameter.  Change all callers.
6837         (Output_file_header::entry): Use parameters->entry.
6838         * gold.cc (queue_middle_tasks): Likewise.
6839         * plugin.cc (Plugin_hook::run): Likewise.
6840
6841 2011-05-24 Cary Coutant  <ccoutant@google.com>
6842
6843         * gold.cc (queue_initial_tasks): Pass incremental base filename
6844         to Output_file::open_base_file; don't print error message.
6845         * incremental-dump.cc (main): Adjust call to
6846         Output_file::open_for_modification.
6847         * incremental-dump.cc (main): Likewise.
6848         * incremental.cc (Incremental_inputs::report_command_line):
6849         Ignore --incremental-base option when comparing command lines.
6850         Ignore parameter when given as separate argument.
6851         * options.h (class General_options): Add --incremental-base.
6852         * output.cc (Output_file::Output_file):
6853         (Output_file::open_base_file): Add base_name and writable parameters;
6854         read base file into new file; print error message here.
6855         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6856         callers.
6857         * output.h (Output_file::open_for_modification): Rename to...
6858         (Output_file::open_base_file): ...this; add base_name and
6859         writable parameters; adjust all callers.
6860         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6861         callers.
6862         * testsuite/Makefile.am (incremental_test_4): Test
6863         --incremental-base.
6864         * testsuite/Makefile.in: Regenerate.
6865
6866 2011-05-24 Cary Coutant  <ccoutant@google.com>
6867
6868         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
6869         incremental_test_4.
6870         * testsuite/Makefile.in: Regenerate.
6871         * testsuite/two_file_test_1_v1.cc: New test source file.
6872         * testsuite/two_file_test_1b_v1.cc: New test source file.
6873         * testsuite/two_file_test_2_v1.cc: New test source file.
6874
6875 2011-05-24 Cary Coutant  <ccoutant@google.com>
6876
6877         * dynobj.h (Dynobj::do_dynobj): New function.
6878         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
6879         flag and soname for shared objects.
6880         * incremental.cc (Incremental_inputs::report_object): Make
6881         either Incremental_object_entry or Incremental_dynobj_entry; add
6882         soname to string table.
6883         (Incremental_inputs::report_input_section): Add assertion.
6884         (Output_section_incremental_inputs::set_final_data_size): Adjust
6885         type of input file entry for shared libraries; adjust size of
6886         shared library info entry.
6887         (Output_section_incremental_inputs::write_input_files): Write
6888         as_needed flag for shared libraries.
6889         (Output_section_incremental_inputs::write_info_blocks): Adjust type
6890         of input file entry for shared libraries; write soname.
6891         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
6892         soname from incremental info.
6893         * incremental.h (enum Incremental_input_flags): Add
6894         INCREMENTAL_INPUT_AS_NEEDED.
6895         (Incremental_input_entry::Incremental_input_entry): Initialize new
6896         data member.
6897         (Incremental_input_entry::set_as_needed): New function.
6898         (Incremental_input_entry::as_needed): New function.
6899         (Incremental_input_entry::do_dynobj_entry): New function.
6900         (Incremental_input_entry::as_needed_): New data member.
6901         (Incremental_object_entry::Incremental_object_entry): Don't check
6902         for shared library.
6903         (Incremental_object_entry::do_type): Likewise.
6904         (class Incremental_dynobj_entry): New class.
6905         (Incremental_input_entry_reader::as_needed): New function.
6906         (Incremental_input_entry_reader::get_soname): New function.
6907         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
6908         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
6909         size of shared library info entry.
6910         * layout.cc (Layout::finish_dynamic_section): Don't test for
6911         incremental link when adding DT_NEEDED entries.
6912         * object.h (Object::Object): Initialize new data member.
6913         (Object::dynobj): New function.
6914         (Object::set_as_needed): New function.
6915         (Object::as_needed): New function.
6916         (Object::do_dynobj): New function.
6917         (Object::as_needed_): New data member.
6918
6919 2011-05-24 Cary Coutant  <ccoutant@google.com>
6920
6921         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
6922         info; adjust display of GOT entries.
6923         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6924         vector of input objects; remove file_status_.
6925         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
6926         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
6927         got_plt reader; call target hooks to reserve GOT entries.
6928         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6929         of input file info header and GOT info entry.
6930         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
6931         relocation info.
6932         (Got_plt_view_info::got_descriptor): Remove.
6933         (Got_plt_view_info::sym_index): New data member.
6934         (Got_plt_view_info::input_index): New data member.
6935         (Local_got_offset_visitor::visit): Write input file index.
6936         (Global_got_offset_visitor::visit): Write 0 for input file index.
6937         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
6938         with sym_index and input_index.
6939         (Output_section_incremental_inputs::write_got_plt): Adjust size of
6940         incremental info GOT entry; replace got_descriptor with input_index.
6941         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
6942         map from input file index to object.
6943         (Sized_relobj_incr::do_layout): Replace direct data member reference
6944         with accessor function.
6945         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
6946         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
6947         Adjust size of input file info header.
6948         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
6949         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
6950         (Incremental_input_entry_reader::get_input_section): Adjust size of
6951         input file info header.
6952         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
6953         of incremental info GOT entry.
6954         (Incremental_got_plt_reader::get_got_desc): Remove.
6955         (Incremental_got_plt_reader::get_got_symndx): New function.
6956         (Incremental_got_plt_reader::get_got_input_index): New function.
6957         (Sized_incremental_binary::Sized_incremental_binary): Remove
6958         file_status_; add input_objects_.
6959         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
6960         (Sized_incremental_binary::set_file_is_unchanged): Remove.
6961         (Sized_incremental_binary::file_is_unchanged): Remove.
6962         (Sized_incremental_binary::set_input_object): New function.
6963         (Sized_incremental_binary::input_object): New function.
6964         (Sized_incremental_binary::file_status_): Remove.
6965         (Sized_incremental_binary::input_objects_): New data member.
6966         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
6967         references.
6968         (Sized_relobj_incr::invalid_address): Move to base class.
6969         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
6970         class.
6971         (Sized_relobj_incr::do_output_section_offset): Likewise.
6972         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
6973         (Sized_relobj_incr::section_offsets_): Likewise.
6974         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
6975         function.
6976         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
6977         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
6978         with accessor function.
6979         (Sized_relobj_file::do_layout): Likewise.
6980         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
6981         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
6982         (Sized_relobj_file::compute_final_local_value): Replace refs to
6983         section_offsets_ with accessor function.
6984         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
6985         * object.h (Relobj::Relobj): Initialize new data members.
6986         (Relobj::add_dyn_reloc): New function.
6987         (Relobj::first_dyn_reloc): New function.
6988         (Relobj::dyn_reloc_count): New function.
6989         (Relobj::first_dyn_reloc_): New data member.
6990         (Relobj::dyn_reloc_count_): New data member.
6991         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
6992         references.
6993         (Sized_relobj::Address): New typedef.
6994         (Sized_relobj::invalid_address): Move here from child class.
6995         (Sized_relobj::Sized_relobj): Initialize new data members.
6996         (Sized_relobj::sized_relobj): New function.
6997         (Sized_relobj::is_output_section_offset_invalid): Move here from
6998         child class.
6999         (Sized_relobj::get_output_section_offset): Likewise.
7000         (Sized_relobj::local_has_got_offset): Likewise.
7001         (Sized_relobj::local_got_offset): Likewise.
7002         (Sized_relobj::set_local_got_offset): Likewise.
7003         (Sized_relobj::do_for_all_local_got_entries): Likewise.
7004         (Sized_relobj::clear_got_offsets): New function.
7005         (Sized_relobj::section_offsets): Move here from child class.
7006         (Sized_relobj::do_output_section_offset): Likewise.
7007         (Sized_relobj::do_set_section_offset): Likewise.
7008         (Sized_relobj::Local_got_offsets): Likewise.
7009         (Sized_relobj::local_got_offsets_): Likewise.
7010         (Sized_relobj::section_offsets_): Likewise.
7011         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
7012         references.
7013         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
7014         class.
7015         (Sized_relobj_file::sized_relobj): New function
7016         (Sized_relobj_file::local_has_got_offset): Move to base class.
7017         (Sized_relobj_file::local_got_offset): Likewise.
7018         (Sized_relobj_file::set_local_got_offset): Likewise.
7019         (Sized_relobj_file::get_output_section_offset): Likewise.
7020         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
7021         (Sized_relobj_file::do_output_section_offset): Likewise.
7022         (Sized_relobj_file::do_set_section_offset): Likewise.
7023         (Sized_relobj_file::Local_got_offsets): Likewise.
7024         (Sized_relobj_file::local_got_offsets_): Likewise.
7025         (Sized_relobj_file::section_offsets_): Likewise.
7026         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
7027         (all constructors).
7028         (set_needs_dynsym_index): Convert relobj to derived class pointer.
7029         (Output_reloc::get_symbol_index): Likewise.
7030         (Output_reloc::local_section_offset): Likewise.
7031         (Output_reloc::get_address): Likewise.
7032         (Output_reloc::symbol_value): Likewise.
7033         (Output_data_got::reserve_slot): Move to class definition.
7034         (Output_data_got::reserve_local): New function.
7035         (Output_data_got::reserve_slot_for_global): Remove.
7036         (Output_data_got::reserve_global): New function.
7037         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
7038         (all constructors, two instantiations).
7039         (Output_reloc::get_relobj): New function (two instantiations).
7040         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
7041         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
7042         (Output_data_reloc::add_global): Adjust type of relobj.
7043         (Output_data_reloc::add_global_relative): Likewise.
7044         (Output_data_reloc::add_symbolless_global_addend): Likewise.
7045         (Output_data_reloc::add_local): Likewise.
7046         (Output_data_reloc::add_local_relative): Likewise.
7047         (Output_data_reloc::add_symbolless_local_addend): Likewise.
7048         (Output_data_reloc::add_local_section): Likewise.
7049         (Output_data_reloc::add_output_section): Likewise.
7050         (Output_data_reloc::add_absolute): Likewise.
7051         (Output_data_reloc::add_target_specific): Likewise.
7052         (Output_data_got::reserve_slot): Move definition here.
7053         (Output_data_got::reserve_local): New function.
7054         (Output_data_got::reserve_global): New function.
7055         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
7056         section_offsets_ with accessor function.
7057         (Sized_relobj_file::write_sections): Likewise.
7058         (Sized_relobj_file::do_relocate_sections): Likewise.
7059         * target.h (Sized_target::reserve_local_got_entry): New function.
7060         (Sized_target::reserve_global_got_entry): New function.
7061         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
7062         (Target_x86_64::reserve_global_got_entry): New function.
7063         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
7064
7065 2011-05-23 Cary Coutant  <ccoutant@google.com>
7066
7067         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
7068         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
7069         bit when checking got_type.
7070         * incremental.cc (Sized_incremental_binary::setup_readers):
7071         Store symbol table and string table locations; initialize bit vector
7072         of file status flags.
7073         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
7074         unchanged files.
7075         (Sized_incremental_binary::do_process_got_plt): New function.
7076         (Sized_incremental_binary::get_symtab_view): Use stored locations.
7077         (Output_section_incremental_inputs::set_final_data_size): Record
7078         file index for each input file.
7079         (Output_section_incremental_inputs::write_got_plt): Store file index
7080         instead of input entry offset for each GOT entry.
7081         * incremental.h
7082         (Incremental_input_entry::Incremental_input_entry): Initialize new
7083         data member.
7084         (Incremental_input_entry::set_offset): Store file index.
7085         (Incremental_input_entry::get_file_index): New function.
7086         (Incremental_input_entry::file_index_): New data member.
7087         (Incremental_binary::process_got_plt): New function.
7088         (Incremental_binary::do_process_got_plt): New function.
7089         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7090         data members.
7091         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
7092         (Sized_incremental_binary::set_file_is_unchanged): New function.
7093         (Sized_incremental_binary::file_is_unchanged): New function.
7094         (Sized_incremental_binary::do_process_got_plt): New function.
7095         (Sized_incremental_binary::file_status_): New data member.
7096         (Sized_incremental_binary::main_symtab_loc_): New data member.
7097         (Sized_incremental_binary::main_strtab_loc_): New data member.
7098         * output.cc (Output_data_got::Got_entry::write): Add case
7099         RESERVED_CODE.
7100         (Output_data_got::add_global): Call add_got_entry.
7101         (Output_data_got::add_global_plt): Likewise.
7102         (Output_data_got::add_global_with_rel): Likewise.
7103         (Output_data_got::add_global_with_rela): Likewise.
7104         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
7105         (Output_data_got::add_global_pair_with_rela): Likewise.
7106         (Output_data_got::add_local): Call add_got_entry.
7107         (Output_data_got::add_local_plt): Likewise.
7108         (Output_data_got::add_local_with_rel): Likewise.
7109         (Output_data_got::add_local_with_rela): Likewise.
7110         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
7111         (Output_data_got::add_local_pair_with_rela): Likewise.
7112         (Output_data_got::reserve_slot): New function.
7113         (Output_data_got::reserve_slot_for_global): New function.
7114         (Output_data_got::add_got_entry): New function.
7115         (Output_data_got::add_got_entry_pair): New function.
7116         (Output_section::add_output_section_data): Edit FIXME.
7117         * output.h
7118         (Output_section_data_build::Output_section_data_build): New
7119         constructor with size parameter.
7120         (Output_data_space::Output_data_space): Likewise.
7121         (Output_data_got::Output_data_got): Initialize new data member; new
7122         constructor with size parameter.
7123         (Output_data_got::add_constant): Call add_got_entry.
7124         (Output_data_got::reserve_slot): New function.
7125         (Output_data_got::reserve_slot_for_global): New function.
7126         (class Output_data_got::Got_entry): Add RESERVED_CODE.
7127         (Output_data_got::add_got_entry): New function.
7128         (Output_data_got::add_got_entry_pair): New function.
7129         (Output_data_got::free_list_): New data member.
7130         * target.h (Sized_target::init_got_plt_for_update): New function.
7131         (Sized_target::register_global_plt_entry): New function.
7132         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
7133         Initialize new data member; call init; add constructor with PLT count.
7134         (Output_data_plt_x86_64::init): New function.
7135         (Output_data_plt_x86_64::add_relocation): New function.
7136         (Output_data_plt_x86_64::reserve_slot): New function.
7137         (Output_data_plt_x86_64::free_list_): New data member.
7138         (Target_x86_64::init_got_plt_for_update): New function.
7139         (Target_x86_64::register_global_plt_entry): New function.
7140         (Output_data_plt_x86_64::add_entry): Allocate from free list for
7141         incremental updates.
7142         (Output_data_plt_x86_64::add_relocation): New function.
7143         * testsuite/object_unittest.cc (Object_test): Set default options.
7144
7145 2011-05-16  Ian Lance Taylor  <iant@google.com>
7146
7147         * options.h (class General_options): Make -i a synonym for -r.
7148
7149 2011-05-16  Ian Lance Taylor  <iant@google.com>
7150
7151         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
7152
7153 2011-05-10 Cary Coutant  <ccoutant@google.com>
7154
7155         * object.cc (Sized_relobj::do_count_local_symbols): Check for
7156         strip_all (-s).
7157
7158 2011-05-06  Ian Lance Taylor  <iant@google.com>
7159
7160         * layout.cc (Layout::layout): If the output section flags change,
7161         update the ordering.
7162
7163 2011-04-25 Cary Coutant  <ccoutant@google.com>
7164
7165         * incremental-dump.cc (dump_incremental_inputs): Print local
7166         symbol info for each input file.
7167         * incremental.cc
7168         (Output_section_incremental_inputs::set_final_data_size): Add local
7169         symbol info to input file entries in incremental info.
7170         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7171         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
7172         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
7173         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
7174         implementation.
7175         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
7176         (Sized_incr_relobj::do_relocate): Write the local symbols.
7177         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
7178         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
7179         Adjust size of input file header.
7180         (Incremental_inputs_reader::get_local_symbol_offset): New function.
7181         (Incremental_inputs_reader::get_local_symbol_count): New function.
7182         (Incremental_inputs_reader::get_input_section): Adjust size of input
7183         file header.
7184         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
7185         (Sized_incr_relobj::This): New typedef.
7186         (Sized_incr_relobj::sym_size): New const data member.
7187         (Sized_incr_relobj::Local_symbol): New struct.
7188         (Sized_incr_relobj::do_output_local_symbol_count): New function.
7189         (Sized_incr_relobj::do_local_symbol_offset): New function.
7190         (Sized_incr_relobj::local_symbol_count_): New data member.
7191         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
7192         (Sized_incr_relobj::local_symbol_index_): New data member.
7193         (Sized_incr_relobj::local_symbol_offset_): New data member.
7194         (Sized_incr_relobj::local_dynsym_offset_): New data member.
7195         (Sized_incr_relobj::local_symbols_): New data member.
7196         * object.h (Relobj::output_local_symbol_count): New function.
7197         (Relobj::local_symbol_offset): New function.
7198         (Relobj::do_output_local_symbol_count): New function.
7199         (Relobj::do_local_symbol_offset): New function.
7200         (Sized_relobj::do_output_local_symbol_count): New function.
7201         (Sized_relobj::do_local_symbol_offset): New function.
7202
7203 2011-04-22  Vladimir Simonov  <sv@sw.ru>
7204
7205         * descriptors.cc (set_close_on_exec): New function.
7206         (Descriptors::open): Use set_close_on_exec.
7207         * output.cc (S_ISLNK): Define if not defined.
7208
7209 2011-04-22 Cary Coutant  <ccoutant@google.com>
7210
7211         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7212         global symbol map.
7213         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7214         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
7215         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
7216         relocations.
7217         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
7218         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
7219         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
7220         * incremental.h
7221         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
7222         function.
7223         (Incremental_binary::apply_incremental_relocs): New function.
7224         (Incremental_binary::do_apply_incremental_relocs): New function.
7225         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7226         data member.
7227         (Sized_incremental_binary::add_global_symbol): New function.
7228         (Sized_incremental_binary::global_symbol): New function.
7229         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7230         (Sized_incremental_binary::symbol_map_): New data member.
7231         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
7232         * target.h (Sized_target::apply_relocation): New function.
7233         * target-reloc.h (apply_relocation): New function.
7234         * x86_64.cc (Target_x86_64::apply_relocation): New function.
7235
7236 2011-04-22  Doug Kwan  <dougkwan@google.com>
7237
7238         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
7239         flag of a SHT_ARM_EXIDX section.
7240         * testsuite/Makefile.am (arm_exidx_test): New test rules.
7241         * testsuite/Makefile.in: Regenerate.
7242         * testsuite/arm_exidx_test.s: New file.
7243         * testsuite/arm_exidx_test.sh: Same.
7244
7245 2011-04-20 Cary Coutant  <ccoutant@google.com>
7246
7247         PR gold/12689
7248         * archive.h (Incremental_archive_entry::Archive_member):
7249         Initialize arg_serial_ (second constructor).
7250
7251 2011-04-17  Ian Lance Taylor  <iant@google.com>
7252
7253         * object.cc (Relocate_info::location): Simplify location string.
7254         * errors.cc (Errors::error_at_location): Don't print program
7255         name.
7256         (Errors::warning_at_location): Likewise.
7257         (Errors::undefined_symbol): Likewise.
7258         * testsuite/debug_msg.sh: Update accordingly.
7259
7260 2011-04-14 Cary Coutant  <ccoutant@google.com>
7261
7262         * gold/layout.cc (Layout::symtab_section_offset): New function.
7263         * gold/layout.h (Layout::symtab_section_offset): New function.
7264         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
7265
7266 2011-04-12  Ian Lance Taylor  <iant@google.com>
7267
7268         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
7269         with MREMAP_MAYMOVE.
7270         * output.h (class Output_file): Add map_is_allocated_ field.
7271         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
7272         not available, provide stubs.  If mremap is not available, #define
7273         it to gold_mremap.
7274         (MREMAP_MAYMOVE): Define if not defined.
7275         (Output_file::Output_file): Initialize map_is_allocated_.
7276         (Output_file::resize): Check map_is_allocated_.
7277         (Output_file::map_anonymous): If mmap fails, use malloc.
7278         (Output_file::unmap): Don't do anything for an anonymous map.
7279         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
7280         is not available, provide stubs.
7281         (File_read::View::~View): Use free rather than delete[].
7282         (File_read::make_view): Use malloc rather than new[].  If mmap
7283         fails, use malloc.
7284         (File_read::find_or_make_view): Use malloc rather than new[].
7285         * gold.h: Remove HAVE_REMAP code.
7286         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
7287         exists.  Rename mremap to gold_mremap.  If mmap is not available
7288         don't do anything.
7289         * configure, config.in: Rebuild.
7290
7291 2011-04-11  Ian Lance Taylor  <iant@google.com>
7292
7293         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
7294         initialize local variable v.
7295
7296 2011-04-11  Cary Coutant  <ccoutant@google.com>
7297
7298         * archive.cc (Archive::include_member): Adjust call to
7299         report_object.
7300         (Add_archive_symbols::run): Track argument serial numbers.
7301         (Lib_group::include_member): Likewise.
7302         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
7303         * archive.h (Incremental_archive_entry::Archive_member):
7304         Initialize arg_serial_.
7305         (Archive_member::arg_serial_): New data member.
7306         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
7307         (Sized_dynobj::do_add_symbols): Track symbols when doing an
7308         incremental link.
7309         (Sized_dynobj::do_for_all_local_got_entries): New function.
7310         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
7311         function.
7312         * fileread.cc (get_mtime): New function.
7313         * fileread.h (get_mtime): New function.
7314         * gold.cc (queue_initial_tasks): Check for incremental update.
7315         (process_incremental_input): New function.
7316         (queue_middle_tasks): Don't force valid target for incremental
7317         update.
7318         * incremental-dump.cc (find_input_containing_global): Adjust
7319         size of symbol info entry.
7320         (dump_incremental_inputs): Dump argument serial number and
7321         in_system_directory flag; bias shndx by 1; print symbol names
7322         when dumping per-file symbol lists; use new symbol info readers.
7323         * incremental.cc
7324         (Output_section_incremental_inputs:update_data_size): New function.
7325         (Sized_incremental_binary::setup_readers): Setup input readers
7326         for each input file; build maps for files added from libraries
7327         and scripts.
7328         (Sized_incremental_binary::check_input_args): New function.
7329         (Sized_incremental_binary::do_check_inputs): Build map of argument
7330         serial numbers to input arguments.
7331         (Sized_incremental_binary::do_file_has_changed): Rename
7332         do_file_is_unchanged to this; compare file modification times.
7333         (Sized_incremental_binary::do_init_layout): New function.
7334         (Sized_incremental_binary::do_reserve_layout): New function.
7335         (Sized_incremental_binary::do_get_input_reader): Remove.
7336         (Sized_incremental_binary::get_symtab_view): New function.
7337         (Incremental_checker::can_incrementally_link_output_file): Remove.
7338         (Incremental_inputs::report_command_line): Exclude --debug options.
7339         (Incremental_inputs::report_archive_begin): Add parameter; track
7340         argument serial numbers; don't put input file entry for archive
7341         before archive members.
7342         (Incremental_inputs::report_archive_end): Put input file entry
7343         for archive after archive members.
7344         (Incremental_inputs::report_object): Add parameter; track argument
7345         serial numbers and in_system_directory flag.
7346         (Incremental_inputs::report_script): Add parameter; track argument
7347         serial numbers.
7348         (Output_section_incremental_inputs::set_final_data_size): Adjust
7349         size of symbol info entry; check for forwarding symbols.
7350         (Output_section_incremental_inputs::write_input_files): Write
7351         in_system_directory flag and argument serial number.
7352         (Output_section_incremental_inputs::write_info_blocks): Map section
7353         indices between incremental info and original input file; store
7354         input section index for each symbol.
7355         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
7356         change operator() to visit().
7357         (class Global_got_offset_visitor): Likewise.
7358         (class Global_symbol_visitor_got_plt):
7359         (Output_section_incremental_inputs::write_got_plt): Use new visitor
7360         classes.
7361         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
7362         (Sized_incr_relobj::do_read_symbols): New function.
7363         (Sized_incr_relobj::do_layout): New function.
7364         (Sized_incr_relobj::do_layout_deferred_sections): New function.
7365         (Sized_incr_relobj::do_add_symbols): New function.
7366         (Sized_incr_relobj::do_should_include_member): New function.
7367         (Sized_incr_relobj::do_for_all_global_symbols): New function.
7368         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
7369         (Sized_incr_relobj::do_section_size): New function.
7370         (Sized_incr_relobj::do_section_name): New function.
7371         (Sized_incr_relobj::do_section_contents): New function.
7372         (Sized_incr_relobj::do_section_flags): New function.
7373         (Sized_incr_relobj::do_section_entsize): New function.
7374         (Sized_incr_relobj::do_section_address): New function.
7375         (Sized_incr_relobj::do_section_type): New function.
7376         (Sized_incr_relobj::do_section_link): New function.
7377         (Sized_incr_relobj::do_section_info): New function.
7378         (Sized_incr_relobj::do_section_addralign): New function.
7379         (Sized_incr_relobj::do_initialize_xindex): New function.
7380         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
7381         (Sized_incr_relobj::do_read_relocs): New function.
7382         (Sized_incr_relobj::do_gc_process_relocs): New function.
7383         (Sized_incr_relobj::do_scan_relocs): New function.
7384         (Sized_incr_relobj::do_count_local_symbols): New function.
7385         (Sized_incr_relobj::do_finalize_local_symbols): New function.
7386         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
7387         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
7388         (Sized_incr_relobj::do_relocate): New function.
7389         (Sized_incr_relobj::do_set_section_offset): New function.
7390         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
7391         (Sized_incr_dynobj::do_read_symbols): New function.
7392         (Sized_incr_dynobj::do_layout): New function.
7393         (Sized_incr_dynobj::do_add_symbols): New function.
7394         (Sized_incr_dynobj::do_should_include_member): New function.
7395         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
7396         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
7397         (Sized_incr_dynobj::do_section_size): New function.
7398         (Sized_incr_dynobj::do_section_name): New function.
7399         (Sized_incr_dynobj::do_section_contents): New function.
7400         (Sized_incr_dynobj::do_section_flags): New function.
7401         (Sized_incr_dynobj::do_section_entsize): New function.
7402         (Sized_incr_dynobj::do_section_address): New function.
7403         (Sized_incr_dynobj::do_section_type): New function.
7404         (Sized_incr_dynobj::do_section_link): New function.
7405         (Sized_incr_dynobj::do_section_info): New function.
7406         (Sized_incr_dynobj::do_section_addralign): New function.
7407         (Sized_incr_dynobj::do_initialize_xindex): New function.
7408         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
7409         (make_sized_incremental_object): New function.
7410         (Incremental_library::copy_unused_symbols): New function.
7411         (Incremental_library::do_for_all_unused_symbols): New function.
7412         * incremental.h (enum Incremental_input_flags): New type.
7413         (class Incremental_checker): Remove.
7414         (Incremental_input_entry::Incremental_input_entry): Add argument
7415         serial number.
7416         (Incremental_input_entry::arg_serial): New function.
7417         (Incremental_input_entry::set_is_in_system_directory): New function.
7418         (Incremental_input_entry::is_in_system_directory): New function.
7419         (Incremental_input_entry::arg_serial_): New data member.
7420         (Incremental_input_entry::is_in_system_directory_): New data member.
7421         (class Script_info): Move here from script.h.
7422         (Script_info::Script_info): Add filename parameter.
7423         (Script_info::filename): New function.
7424         (Script_info::filename_): New data member.
7425         (Incremental_script_entry::Incremental_script_entry): Add argument
7426         serial number.
7427         (Incremental_object_entry::Incremental_object_entry): Likewise.
7428         (Incremental_object_entry::add_input_section): Build list of input
7429         sections with map to original shndx.
7430         (Incremental_object_entry::get_input_section_index): New function.
7431         (Incremental_object_entry::shndx_): New data member.
7432         (Incremental_object_entry::name_key_): Rename; adjust all refs.
7433         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
7434         (Incremental_archive_entry::Incremental_archive_entry): Add argument
7435         serial number.
7436         (Incremental_inputs::report_archive_begin): Likewise.
7437         (Incremental_inputs::report_object): Likewise.
7438         (Incremental_inputs::report_script): Likewise.
7439         (class Incremental_global_symbol_reader): New class.
7440         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
7441         and store flags and input file type.
7442         (Incremental_input_entry_reader::arg_serial): New function.
7443         (Incremental_input_entry_reader::type): Extract type from flags.
7444         (Incremental_input_entry_reader::is_in_system_directory): New function.
7445         (Incremental_input_entry_reader::get_input_section_count): Call
7446         accessor function for type.
7447         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
7448         function for type; adjust size of global symbol entry.
7449         (Incremental_input_entry_reader::get_global_symbol_count): Call
7450         accessor function for type.
7451         (Incremental_input_entry_reader::get_object_count): Likewise.
7452         (Incremental_input_entry_reader::get_object_offset): Likewise.
7453         (Incremental_input_entry_reader::get_member_count): Likewise.
7454         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
7455         (Incremental_input_entry_reader::get_member_offset): Likewise.
7456         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
7457         (Incremental_input_entry_reader::Global_symbol_info): Remove.
7458         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
7459         (Incremental_input_entry_reader::get_global_symbol_reader): New
7460         function.
7461         (Incremental_input_entry_reader::get_output_symbol_index): New
7462         function.
7463         (Incremental_input_entry_reader::type_): Remove.
7464         (Incremental_input_entry_reader::flags_): New data member.
7465         (Incremental_inputs_reader::input_file_offset): New function.
7466         (Incremental_inputs_reader::input_file_index): New function.
7467         (Incremental_inputs_reader::input_file): Call input_file_offset.
7468         (Incremental_inputs_reader::input_file_at_offset): New function.
7469         (Incremental_relocs_reader::get_r_type): Reformat.
7470         (Incremental_relocs_reader::get_r_shndx): Reformat.
7471         (Incremental_relocs_reader::get_r_offset): Reformat.
7472         (Incremental_relocs_reader::data): New function.
7473         (Incremental_binary::Incremental_binary): Initialize new data members.
7474         (Incremental_binary::check_inputs): Add cmdline parameter.
7475         (Incremental_binary::file_is_unchanged): Remove.
7476         (Input_reader::arg_serial): New function.
7477         (Input_reader::get_unused_symbol_count): New function.
7478         (Input_reader::get_unused_symbol): New function.
7479         (Input_reader::do_arg_serial): New function.
7480         (Input_reader::do_get_unused_symbol_count): New function.
7481         (Input_reader::do_get_unused_symbol): New function.
7482         (Incremental_binary::input_file_count): New function.
7483         (Incremental_binary::get_input_reader): Change signature to use
7484         index instead of filename.
7485         (Incremental_binary::file_has_changed): New function.
7486         (Incremental_binary::get_input_argument): New function.
7487         (Incremental_binary::get_library): New function.
7488         (Incremental_binary::get_script_info): New function.
7489         (Incremental_binary::init_layout): New function.
7490         (Incremental_binary::reserve_layout): New function.
7491         (Incremental_binary::output_file): New function.
7492         (Incremental_binary::do_check_inputs): New function.
7493         (Incremental_binary::do_file_is_unchanged): Remove.
7494         (Incremental_binary::do_file_has_changed): New function.
7495         (Incremental_binary::do_init_layout): New function.
7496         (Incremental_binary::do_reserve_layout): New function.
7497         (Incremental_binary::do_input_file_count): New function.
7498         (Incremental_binary::do_get_input_reader): Change signature.
7499         (Incremental_binary::input_args_map_): New data member.
7500         (Incremental_binary::library_map_): New data member.
7501         (Incremental_binary::script_map_): New data member.
7502         (Sized_incremental_binary::Sized_incremental_binary): Initialize
7503         new data members.
7504         (Sized_incremental_binary::output_section): New function.
7505         (Sized_incremental_binary::inputs_reader): Add const.
7506         (Sized_incremental_binary::symtab_reader): Add const.
7507         (Sized_incremental_binary::relocs_reader): Add const.
7508         (Sized_incremental_binary::got_plt_reader): Add const.
7509         (Sized_incremental_binary::get_symtab_view): New function.
7510         (Sized_incremental_binary::Inputs_reader): New typedef.
7511         (Sized_incremental_binary::Input_entry_reader): New typedef.
7512         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
7513         (Sized_incremental_binary::do_file_is_unchanged): Remove.
7514         (Sized_incremental_binary::do_file_has_changed): New function.
7515         (Sized_incremental_binary::do_init_layout): New function.
7516         (Sized_incremental_binary::do_reserve_layout): New function.
7517         (Sized_input_reader::Inputs_reader): Remove.
7518         (Sized_input_reader::Input_entry_reader): Remove.
7519         (Sized_input_reader::do_arg_serial): New function.
7520         (Sized_input_reader::do_get_unused_symbol_count): New function.
7521         (Sized_input_reader::do_get_unused_symbol): New function.
7522         (Sized_incremental_binary::do_input_file_count): New function.
7523         (Sized_incremental_binary::do_get_input_reader): Change signature;
7524         use index instead of filename.
7525         (Sized_incremental_binary::section_map_): New data member.
7526         (Sized_incremental_binary::input_entry_readers_): New data member.
7527         (class Sized_incr_relobj): New class.
7528         (class Sized_incr_dynobj): New class.
7529         (make_sized_incremental_object): New function.
7530         (class Incremental_library): New class.
7531         * layout.cc (Free_list::num_lists): New static data member.
7532         (Free_list::num_nodes): New static data member.
7533         (Free_list::num_removes): New static data member.
7534         (Free_list::num_remove_visits): New static data member.
7535         (Free_list::num_allocates): New static data member.
7536         (Free_list::num_allocate_visits): New static data member.
7537         (Free_list::init): New function.
7538         (Free_list::remove): New function.
7539         (Free_list::allocate): New function.
7540         (Free_list::dump): New function.
7541         (Free_list::print_stats): New function.
7542         (Layout_task_runner::run): Resize output file for incremental updates.
7543         (Layout::Layout): Initialize new data members.
7544         (Layout::set_incremental_base): New function.
7545         (Layout::init_fixed_output_section): New function.
7546         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
7547         incremental updates.
7548         (Layout::create_gold_note): Do not create gold note section for
7549         incremental updates.
7550         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
7551         for incremental updates.
7552         (Layout::set_section_offsets): For incremental updates, allocate space
7553         from free list.
7554         (Layout::create_symtab_sections): Layout with offsets relative to
7555         start of section; for incremental updates, allocate space from free
7556         list.
7557         (Layout::create_shdrs): For incremental updates, allocate space from
7558         free list.
7559         (Layout::finish_dynamic_section): For incremental updates, do not
7560         check --as-needed (fixed in subsequent patch).
7561         * layout.h (class Free_list): New class.
7562         (Layout::set_incremental_base): New function.
7563         (Layout::incremental_base): New function.
7564         (Layout::init_fixed_output_section): New function.
7565         (Layout::allocate): New function.
7566         (Layout::incremental_base_): New data member.
7567         (Layout::free_list_): New data member.
7568         * main.cc (main): Print Free_list statistics.
7569         * object.cc (Relobj::finalize_incremental_relocs): Add
7570         clear_counts parameter; clear counts only when clear_counts is set.
7571         (Sized_relobj::Sized_relobj): Initialize new base class.
7572         (Sized_relobj::do_layout): Don't report special sections.
7573         (Sized_relobj::do_for_all_local_got_entries): New function.
7574         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
7575         symtab_off to all symbol table offsets.
7576         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
7577         * object.h (class Got_offset_list): Move to top of file.
7578         (Object::Object): Allow case where input_file == NULL.
7579         (Object::~Object): Likewise.
7580         (Object::input_file): Assert that input_file != NULL.
7581         (Object::lock): Allow case where input_file == NULL.
7582         (Object::unlock): Likewise.
7583         (Object::is_locked): Likewise.
7584         (Object::token): Likewise.
7585         (Object::release): Likewise.
7586         (Object::is_incremental): New function.
7587         (Object::get_mtime): New function.
7588         (Object::for_all_local_got_entries): New function.
7589         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
7590         (Object::set_is_in_system_directory): New function.
7591         (Object::is_in_system_directory): New function.
7592         (Object::do_is_incremental): New function.
7593         (Object::do_get_mtime): New function.
7594         (Object::do_for_all_local_got_entries): New function.
7595         (Object::is_in_system_directory_): New data member.
7596         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
7597         (class Sized_relobj_base): New class.
7598         (class Sized_relobj): Derive from Sized_relobj_base.
7599         (class Sized_relobj::Symbols): Redeclare from base class.
7600         (class Sized_relobj::local_got_offset_list): Remove.
7601         (class Sized_relobj::Output_sections): Redeclare from base class.
7602         (class Sized_relobj::do_for_all_local_got_entries): New function.
7603         (class Sized_relobj::write_local_symbols): Add offset parameter.
7604         (class Sized_relobj::local_symbol_offset_): Update comment.
7605         (class Sized_relobj::local_dynsym_offset_): Update comment.
7606         * options.cc (Input_arguments::add_file): Remove const.
7607         * options.h (Input_file_argument::Input_file_argument):
7608         Initialize arg_serial_ (all constructors).
7609         (Input_file_argument::set_arg_serial): New function.
7610         (Input_file_argument::arg_serial): New function.
7611         (Input_file_argument::arg_serial_): New data member.
7612         (Input_arguments::Input_arguments): Initialize file_count_.
7613         (Input_arguments::add_file): Remove const.
7614         (Input_arguments::number_of_input_files): New function.
7615         (Input_arguments::file_count_): New data member.
7616         (Command_line::number_of_input_files): Call
7617         Input_arguments::number_of_input_files.
7618         * output.cc (Output_segment_headers::Output_segment_headers):
7619         Set current size.
7620         (Output_section::Input_section::current_data_size): New function.
7621         (Output_section::Output_section): Initialize new data members.
7622         (Output_section::add_input_section): Don't do merge sections for
7623         an incremental link; allocate space from free list for an
7624         incremental update.
7625         (Output_section::add_output_section_data): Allocate space from
7626         free list for an incremental update.
7627         (Output_section::update_data_size): New function.
7628         (Output_section::set_fixed_layout): New function.
7629         (Output_section::reserve): New function.
7630         (Output_segment::set_section_addresses): Remove const.
7631         (Output_segment::set_section_list_addresses): Remove const; allocate
7632         space from free list for an incremental update.
7633         (Output_segment::set_offset): Adjust size of RELRO segment for an
7634         incremental update.
7635         * output.h (Output_data::current_data_size): Move here from
7636         child classes.
7637         (Output_data::pre_finalize_data_size): New function.
7638         (Output_data::update_data_size): New function.
7639         (Output_section_headers::update_data_size): new function.
7640         (Output_section_data_build::current_data_size): Move to Output_data.
7641         (Output_data_strtab::update_data_size): New function.
7642         (Output_section::current_data_size): Move to Output_data.
7643         (Output_section::set_fixed_layout): New function.
7644         (Output_section::has_fixed_layout): New function.
7645         (Output_section::reserve): New function.
7646         (Output_section::update_data_size): New function.
7647         (Output_section::has_fixed_layout_): New data member.
7648         (Output_section::free_list_): New data member.
7649         (Output_segment::set_section_addresses): Remove const.
7650         (Output_segment::set_section_list_addresses): Remove const.
7651         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
7652         New function.
7653         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
7654         New function.
7655         * readsyms.cc (Read_symbols::do_read_symbols): Add library
7656         parameter when calling Add_symbols constructor; store argument
7657         serial number for members of a lib group.
7658         (Add_symbols::locks): Allow case where token == NULL.
7659         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
7660         (Read_member::~Read_member): New function.
7661         (Read_member::is_runnable): New function.
7662         (Read_member::locks): New function.
7663         (Read_member::run): New function.
7664         (Check_script::~Check_script): New function.
7665         (Check_script::is_runnable): New function.
7666         (Check_script::locks): New function.
7667         (Check_script::run): New function.
7668         (Check_library::~Check_library): New function.
7669         (Check_library::is_runnable): New function.
7670         (Check_library::locks): New function.
7671         (Check_library::run): New function.
7672         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
7673         (Add_symbols::library_): New data member.
7674         (class Read_member): New class.
7675         (class Check_script): New class.
7676         (class Check_library): New class.
7677         * reloc.cc (Read_relocs::is_runnable): Allow case where
7678         token == NULL.
7679         (Read_relocs::locks): Likewise.
7680         (Scan_relocs::locks): Likewise.
7681         (Relocate_task::locks): Likewise.
7682         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
7683         to clear counters.
7684         (Sized_relobj::incremental_relocs_scan): Fix comment.
7685         (Sized_relobj::do_relocate): Pass output file offset to
7686         write_local_symbols.
7687         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
7688         from class declaration.
7689         * script.cc (read_input_script): Allocate Script_info; pass
7690         argument serial number to report_script.
7691         * script.h (class Script_info): Move to incremental.h.
7692         * symtab.cc (Symbol_table::add_from_incrobj): New function.
7693         * symtab.h (Symbol_table::add_from_incrobj): New function.
7694         (Symbol_table::set_file_offset): New function.
7695
7696 2011-04-05  Cary Coutant  <ccoutant@google.com>
7697
7698         * incremental-dump.cc (dump_incremental_inputs): Change signature
7699         to take a Sized_incremental_binary; change caller.  Use readers
7700         in Sized_incremental_binary.
7701         * incremental.cc
7702         (Sized_incremental_binary::find_incremental_inputs_sections):
7703         Rename do_find_incremental_inputs_sections to this.
7704         (Sized_incremental_binary::setup_readers): New function.
7705         (Sized_incremental_binary::do_check_inputs): Check
7706         has_incremental_info_ flag; move setup code to setup_readers;
7707         use input readers.
7708         (Sized_incremental_binary::do_file_is_unchanged): New function.
7709         (Sized_incremental_binary::do_get_input_reader): New function.
7710         * incremental.h (class Incremental_binary): Move to end of file.
7711         (Incremental_binary::file_is_unchanged): New function.
7712         (Incremental_binary::do_file_is_unchanged): New function.
7713         (Incremental_binary::Input_reader): New class.
7714         (Incremental_binary::get_input_reader): New function.
7715         (class Sized_incremental_binary): Move to end of file.
7716         (Sized_incremental_binary::Sized_incremental_binary): Setup the
7717         input section reader classes.
7718         (Sized_incremental_binary::has_incremental_info): New function.
7719         (Sized_incremental_binary::inputs_reader): New function.
7720         (Sized_incremental_binary::symtab_reader): New function.
7721         (Sized_incremental_binary::relocs_reader): New function.
7722         (Sized_incremental_binary::got_plt_reader): New function.
7723         (Sized_incremental_binary::do_file_is_unchanged): New function.
7724         (Sized_incremental_binary::Sized_input_reader): New class.
7725         (Sized_incremental_binary::get_input_reader): New function.
7726         (Sized_incremental_binary::find_incremental_inputs_sections):
7727         Rename do_find_incremental_inputs_sections to this.
7728         (Sized_incremental_binary::setup_readers): New function.
7729         (Sized_incremental_binary::has_incremental_info_): New data member.
7730         (Sized_incremental_binary::inputs_reader_): New data member.
7731         (Sized_incremental_binary::symtab_reader_): New data member.
7732         (Sized_incremental_binary::relocs_reader_): New data member.
7733         (Sized_incremental_binary::got_plt_reader_): New data member.
7734         (Sized_incremental_binary::current_input_file_): New data member.
7735
7736 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
7737
7738         PR gold/12640
7739         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
7740         violation.
7741
7742 2011-03-30  Cary Coutant  <ccoutant@google.com>
7743
7744         * archive.cc (Archive::include_member): Adjust call to report_object.
7745         (Add_archive_symbols::run): Add script_info to call to
7746         report_archive_begin.
7747         (Lib_group::include_member): Adjust call to report_object.
7748         (Add_lib_group_symbols::run): Adjust call to report_object.
7749         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
7750         blocks.  Add object count for script input files.
7751         * incremental.cc (Incremental_inputs::report_archive_begin): Add
7752         script_info parameter; change all callers.
7753         (Incremental_inputs::report_object): Add script_info parameter;
7754         change all callers.
7755         (Incremental_inputs::report_script): Store backpointer to
7756         incremental info entry.
7757         (Output_section_incremental_inputs::set_final_data_size): Record
7758         additional information for scripts.
7759         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7760         * incremental.h (Incremental_script_entry::add_object): New function.
7761         (Incremental_script_entry::get_object_count): New function.
7762         (Incremental_script_entry::get_object): New function.
7763         (Incremental_script_entry::objects_): New data member; adjust
7764         constructor.
7765         (Incremental_inputs::report_archive_begin): Add script_info parameter.
7766         (Incremental_inputs::report_object): Add script_info parameter.
7767         (Incremental_inputs_reader::get_object_count): New function.
7768         (Incremental_inputs_reader::get_object_offset): New function.
7769         * options.cc (Input_arguments::add_file): Return reference to
7770         new input argument.
7771         * options.h (Input_argument::set_script_info): New function.
7772         (Input_argument::script_info): New function.
7773         (Input_argument::script_info_): New data member; adjust all
7774         constructors.
7775         (Input_file_group::add_file): Return reference to new input argument.
7776         (Input_file_lib::add_file): Likewise.
7777         (Input_arguments::add_file): Likewise.
7778         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
7779         * script.cc (Parser_closure::Parser_closure): Add script_info
7780         parameter; adjust all callers.
7781         (Parser_closure::script_info): New function.
7782         (Parser_closure::script_info_): New data member.
7783         (read_input_script): Report scripts earlier to incremental info.
7784         (script_add_file): Set script_info in Input_argument.
7785         (script_add_library): Likewise.
7786         * script.h (Script_options::Script_info): Rewrite class.
7787
7788 2011-03-29  Cary Coutant  <ccoutant@google.com>
7789
7790         * archive.cc (Library_base::should_include_member): Move
7791         method here from class Archive.
7792         (Archive::Archive): Initialize base class.
7793         (Archive::should_include_member): Move to base class.
7794         (Archive::do_for_all_unused_symbols): New function.
7795         (Add_archive_symbols::run): Remove redundant access to
7796         incremental_inputs.
7797         (Lib_group::Lib_group): Initialize base class.
7798         (Lib_group::do_filename): New function.
7799         (Lib_group::include_member): Pass pointer to Lib_group to
7800         report_object.
7801         (Lib_group::do_for_all_unused_symbols): New function.
7802         (Add_lib_group_symbols::run): Report archive information for
7803         incremental links.
7804         * archive.h (class Library_base): New base class.
7805         (class Archive): Derive from Library_base.
7806         (Archive::filename): Move to base class.
7807         (Archive::set_incremental_info): Likewise.
7808         (Archive::incremental_info): Likewise.
7809         (Archive::Should_include): Likewise.
7810         (Archive::should_include_member): Likewise.
7811         (Archive::Armap_entry): Remove.
7812         (Archive::Unused_symbol_iterator): Remove.
7813         (Archive::unused_symbols_begin): Remove.
7814         (Archive::unused_symbols_end): Remove.
7815         (Archive::do_filename): New function.
7816         (Archive::do_get_mtime): New function.
7817         (Archive::do_for_all_unused_symbols): New function.
7818         (Archive::task_): Move to base class.
7819         (Archive::incremental_info_): Likewise.
7820         (class Lib_group): Derive from Library_base.
7821         (Lib_group::do_filename): New function.
7822         (Lib_group::do_get_mtime): New function.
7823         (Lib_group::do_for_all_unused_symbols): New function.
7824         (Lib_group::task_): Move to base class.
7825         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
7826         function.
7827         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
7828         function.
7829         * incremental.cc (Incremental_inputs::report_archive_begin):
7830         Use Library_base; call library's get_mtime; add incremental inputs
7831         entry before members.
7832         (class Unused_symbol_visitor): New class.
7833         (Incremental_inputs::report_archive_end): Use Library_base; use
7834         visitor class to record unused symbols; don't add incremental inputs
7835         entry after members.
7836         (Incremental_inputs::report_object): Use Library_base.
7837         * incremental.h
7838         (Incremental_archive_entry::Incremental_archive_entry): Remove
7839         unused Archive parameter.
7840         (Incremental_inputs::report_archive_begin): Use Library_base.
7841         (Incremental_inputs::report_archive_end): Likewise.
7842         (Incremental_inputs::report_object): Likewise.
7843         * object.cc (Sized_relobj::do_for_all_global_symbols): New
7844         function.
7845         * object.h (Object::for_all_global_symbols): New function.
7846         (Object::do_for_all_global_symbols): New function.
7847         (Sized_relobj::do_for_all_global_symbols): New function.
7848         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
7849         function.
7850         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
7851         function.
7852
7853 2011-03-27  Ian Lance Taylor  <iant@google.com>
7854
7855         * archive.cc (Archive::interpret_header): Return -1 if something
7856         goes wrong.  Change callers accordingly.
7857
7858 2011-03-25  Cary Coutant  <ccoutant@google.com>
7859
7860         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
7861         * testsuite/Makefile.in: Regenerate.
7862
7863 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
7864
7865         * plugin.cc (get_view): New.
7866         (Plugin::load): Pass get_view to the plugin.
7867         (Plugin_manager::get_view): New.
7868
7869 2011-03-21  Ian Lance Taylor  <iant@google.com>
7870
7871         * testsuite/final_layout.sh: Rewrite to not use dc.
7872         * testsuite/relro_test.sh: Fail if dc is not present.
7873
7874 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
7875
7876         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
7877         Change == to -eq.
7878         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
7879         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
7880         Change == to -eq.
7881         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
7882         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
7883
7884 2011-03-14  Ian Lance Taylor  <iant@google.com>
7885
7886         * script-sections.cc (Sort_output_sections::script_compare):
7887         Rename from is_before, change return type.
7888         (Sort_output_sections::operator()): Adjust accordingly.
7889
7890 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
7891
7892         PR gold/12572
7893         * testsuite/odr_violation2.cc: Add comment to make all error line
7894         numbers double digits.
7895         * testsuite/debug_msg.sh: Adjust expected errors.
7896
7897 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
7898
7899         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
7900         but mark earlier ones as non-canonical
7901         (offset_to_iterator): Update search target and example
7902         (do_addr2line): Return extra lines in a vector*
7903         (format_file_lineno): Extract from do_addr2line
7904         (one_addr2line): Add vector* out-param
7905         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
7906         when a lineno entry appeared last for its instruction
7907         (Dwarf_line_info): Add vector* out-param
7908         * object.cc (Relocate_info): Pass NULL for the vector* out-param
7909         * symtab.cc (Odr_violation_compare): Include the lineno in the
7910         comparison again.
7911         (linenos_from_loc): New. Combine the canonical line for an
7912         address with its other lines.
7913         (True_if_intersect): New. Helper functor to make
7914         std::set_intersection a query.
7915         (detect_odr_violations): Compare sets of lines instead of just
7916         one line for each function. This became less deterministic, but
7917         has fewer false positives.
7918         * symtab.h: Declarations.
7919         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
7920         mix an optimized and non-optimized object in the same binary
7921         (odr_violation2.so): Same.
7922         * testsuite/Makefile.in: Regenerate from Makefile.am.
7923         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
7924         * testsuite/debug_msg.sh: Update line numbers and add
7925         assertions.
7926         * testsuite/odr_violation1.cc: Use OdrDerived, in a
7927         non-optimized context.
7928         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
7929         isn't inlined, and use OdrDerived in an optimized context.
7930         * testsuite/odr_header1.h: Defines OdrDerived, where
7931         optimization will change the
7932         first-instruction-in-the-destructor's file and line number.
7933         * testsuite/odr_header2.h: Defines OdrBase.
7934
7935 2011-03-09  Ian Lance Taylor  <iant@google.com>
7936
7937         * fileread.cc (File_read::clear_views): Don't delete the whole
7938         file view.
7939
7940 2011-03-08  Ian Lance Taylor  <iant@google.com>
7941
7942         PR gold/12525
7943         * fileread.cc: #include <climits>.
7944         (GOLD_IOV_MAX): Define.
7945         (File_read::read_multiple): Limit number of entries by iov_max.
7946         * fileread.h (class File_read): Always set max_readv_entries to
7947         128.
7948
7949 2011-03-07  Ian Lance Taylor  <iant@google.com>
7950
7951         PR gold/12525
7952         * options.h (class General_options): Add -dy and -dn.
7953
7954 2011-03-02  Cary Coutant  <ccoutant@google.com>
7955
7956         * testsuite/script_test_9.t: Add TLS segment.
7957
7958 2011-03-02  Simon Baldwin  <simonb@google.com>
7959
7960         * configure.ac: Add check for gnu_indirect_function support in
7961         the toolchain building binutils.
7962         * configure: Rebuild.
7963
7964 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
7965
7966         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
7967         plugin only symbols.
7968         (Symbol_table::sized_finalize_symbol) Mark symbol only present
7969         in plugin files as not needed in the symbol table.
7970
7971 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
7972
7973         * output.cc (Output_section::add_input_section): Delay fill
7974         generation for section ordering.
7975
7976 2011-02-09  Ian Lance Taylor  <iant@google.com>
7977
7978         PR gold/12316
7979         * object.h (class Sized_relobj): Remove clear_local_symbols.
7980         * reloc.cc (Sized_relobj::do_relocate): Don't call
7981         clear_local_symbols.
7982
7983 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
7984
7985         * plugin.cc (is_visible_from_outside): Return true for symbols
7986         in the -u option.
7987
7988 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
7989
7990         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
7991         filename.
7992
7993 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
7994
7995         * icf.h (is_section_foldable_candidate): Change type of parameter
7996         to std::string.
7997         * icf.cc (Icf::find_identical_sections): Change type of local variable
7998         section_name to be std::string.
7999         (is_function_ctor_or_dtor): Change type of parameter to std::string.
8000
8001 2011-01-25  Ian Lance Taylor  <iant@google.com>
8002
8003         * script.cc (script_add_extern): Rewrite to use
8004         add_symbol_reference.
8005
8006 2011-01-25  Doug Kwan  <dougkwan@google.com>
8007
8008         * icf.cc (get_section_contents): Always lock section's object.
8009
8010 2011-01-24  Ian Lance Taylor  <iant@google.com>
8011
8012         * options.h (class General_options): Accept
8013         --no-detect-odr-violations.
8014
8015 2011-01-24  Ian Lance Taylor  <iant@google.com>
8016
8017         * version.cc (version_string): Bump to 1.11.
8018
8019 2011-01-24  Ian Lance Taylor  <iant@google.com>
8020
8021         * plugin.cc (class Plugin_rescan): Define new class.
8022         (Plugin_manager::claim_file): Set any_claimed_.
8023         (Plugin_manager::save_archive): New function.
8024         (Plugin_manager::save_input_group): New function.
8025         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
8026         necessary.
8027         (Plugin_manager::new_undefined_symbol): New function.
8028         (Plugin_manager::rescan): New function.
8029         (Plugin_manager::rescannable_defines): New function.
8030         (Plugin_manager::add_input_file): Set any_added_.
8031         * plugin.h (class Plugin_manager): define new fields rescannable_,
8032         undefined_symbols_, any_claimed_, and any_added_.  Declare
8033         Plugin_rescan as friend.  Declare new functions.
8034         (Plugin_manager::Rescannable): Define type.
8035         (Plugin_manager::Rescannable_list): Define type.
8036         (Plugin_manager::Undefined_symbol_list): Define type.
8037         (Plugin_manager::Plugin_manager): Initialize new fields.
8038         * archive.cc (Archive::defines_symbol): New function.
8039         (Add_archive_symbols::run): Pass archive to plugins if any.
8040         * archive.h (class Archive): Declare defines_symbol.
8041         * readsyms.cc (Input_group::~Input_group): New function.
8042         (Finish_group::run): Pass input_group to plugins if any.
8043         * readsyms.h (class Input_group): Declare destructor.
8044         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
8045         any.
8046
8047 2011-01-10  Ian Lance Taylor  <iant@google.com>
8048
8049         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
8050         section as relro.
8051         (Layout::set_segment_offsets): Reset increase_relro before calling
8052         set_section_addresses a second time.
8053
8054 2011-01-04  Cary Coutant  <ccoutant@google.com>
8055
8056         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
8057         sections before NOBITS sections.
8058
8059 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
8060
8061         * version.cc (print_version): Update copyright to 2011.
8062
8063 2010-12-23  Cary Coutant  <ccoutant@google.com>
8064
8065         * output.h (Output_data_reloc::add_output_section): Pass OD instead
8066         of OS to this->add.  Add OD parameter to second form of the function.
8067
8068 2010-12-20  Ian Lance Taylor  <iant@google.com>
8069
8070         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
8071         second of two consecutive entries with same offset.
8072
8073 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8074
8075         * testsuite/Makefile.am (ifuncmain2static_LDADD)
8076         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
8077         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
8078         to avoid unneeded links against $(LDADD).
8079         * testsuite/Makefile.in: Regenerate.
8080
8081 2010-12-15  Ian Lance Taylor  <iant@google.com>
8082
8083         PR gold/12324
8084         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
8085         for R_X86_64_32 and R_X86_64_PC32.
8086         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
8087         ver_matching_def_pic.o.
8088         (ver_matching_def_pic.o): New target.
8089
8090 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8091
8092         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
8093         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
8094         Move definition before File_read::View member definitions.
8095         (File_read::View::~View): Initialize and hold lock before
8096         updating current_mapped_bytes.
8097
8098 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8099
8100         * dwarf_reader.cc: Remove outdated comment.
8101         * gold-threads.cc: Fix typo in error message.
8102         * archive.cc: Fix typos in comments.
8103         * archive.h: Likewise.
8104         * arm-reloc-property.cc: Likewise.
8105         * arm-reloc-property.h: Likewise.
8106         * arm-reloc.def: Likewise.
8107         * arm.cc: Likewise.
8108         * attributes.h: Likewise.
8109         * cref.cc: Likewise.
8110         * ehframe.cc: Likewise.
8111         * fileread.h: Likewise.
8112         * gold.h: Likewise.
8113         * i386.cc: Likewise.
8114         * icf.cc: Likewise.
8115         * incremental.h: Likewise.
8116         * int_encoding.cc: Likewise.
8117         * layout.h: Likewise.
8118         * main.cc: Likewise.
8119         * merge.h: Likewise.
8120         * object.cc: Likewise.
8121         * object.h: Likewise.
8122         * options.cc: Likewise.
8123         * readsyms.cc: Likewise.
8124         * reduced_debug_output.cc: Likewise.
8125         * reloc.cc: Likewise.
8126         * script-sections.cc: Likewise.
8127         * sparc.cc: Likewise.
8128         * symtab.h: Likewise.
8129         * target-reloc.h: Likewise.
8130         * target.cc: Likewise.
8131         * target.h: Likewise.
8132         * timer.cc: Likewise.
8133         * timer.h: Likewise.
8134         * x86_64.cc: Likewise.
8135
8136 2010-12-09  Cary Coutant  <ccoutant@google.com>
8137
8138         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
8139         stack.
8140         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
8141         parameter; change all callers.
8142         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
8143         * options.h (warn_execstack): New option.
8144
8145 2010-12-07  Doug Kwan  <dougkwan@google.com>
8146
8147         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
8148         like function call relocations.
8149
8150 2010-12-07  Ian Lance Taylor  <iant@google.com>
8151
8152         * archive.cc (Archive::get_elf_object_for_member): Permit
8153         punconfigured to be NULL.
8154         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
8155         (Archive::include_member): Pass NULL to get_elf_object_for_member
8156         if we searched for the archive and this is the first included
8157         object.
8158
8159 2010-12-01  Ian Lance Taylor  <iant@google.com>
8160
8161         * dwarf_reader.h (class Sized_dwarf_line_info): Add
8162         track_relocs_type_ field.
8163         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8164         Set track_relocs_type_.
8165         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
8166         contents when using RELA relocs.
8167         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
8168         reloc_map_.
8169         * reloc.cc (Track_relocs::next_addend): New function.
8170         * reloc.h (class Track_relocs): Declare next_addend.
8171
8172 2010-12-01  Ian Lance Taylor  <iant@google.com>
8173
8174         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
8175         virtual destructor.
8176
8177 2010-12-01  Ian Lance Taylor  <iant@google.com>
8178
8179         * README: Update compilers known to work and fail.
8180
8181 2010-11-23  Matthias Klose  <doko@ubuntu.com>
8182
8183         * configure.in: For --enable-gold, handle value `default' instead of
8184         `both*'.  Always install ld as ld.bfd, install as ld if gold is
8185         not the default.
8186         * configure: Regenerate.
8187
8188 2010-11-18  Doug Kwan  <dougkwan@google.com>
8189
8190         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
8191         and right_alignment to be zero.  Store result alignment only if it is
8192         greater than existing alignment.
8193
8194 2010-11-16  Cary Coutant  <ccoutant@google.com>
8195
8196         PR gold/12220
8197         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8198         Check for ".zdebug_line".
8199
8200 2010-11-16  Doug Kwan  <dougkwan@google.com>
8201             Cary Coutant  <ccoutant@google.com>
8202
8203         * output.h (Output_segment::set_section_addresses): Pass increase_relro
8204         by reference; adjust all callers.
8205         * output.cc (Output_segment::set_section_addresses): Adjust references
8206         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
8207         list is empty.
8208         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
8209         end at page boundary.
8210
8211 2010-11-16  Cary Coutant  <ccoutant@google.com>
8212
8213         PR gold/12220
8214         * layout.cc (Layout::choose_output_section): Transform names of
8215         compressed sections even when using a script with a SECTIONS clause.
8216         (Layout::output_section_name): Remove code to transform
8217         compressed debug section names.
8218         * output.cc (Output_section::add_input_section): Use uncompressed
8219         section size when tracking input sections.
8220
8221 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
8222
8223         * symtab.h (Symbol::NON_PIC_REF): Remove.
8224         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
8225         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
8226         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
8227         (Symbol::use_plt_offset): Take a flags argument and pass it
8228         directly to needs_dynamic_reloc.  Restrict check for undefined
8229         weak symbols to function calls.
8230         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
8231         (Target_arm::Scan::global): Use it.
8232         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
8233         (Target_arm::Relocate::relocate): Likewise.
8234         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
8235         parameter with an r_type parameter.  Use get_reference_flags
8236         to get the flags.
8237         (Target_arm::Relocate::relocate): Update accordingly.
8238         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
8239         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
8240         (Target_i386::Scan::global): Likewise.
8241         (Target_i386::Relocate::relocate): Likewise.
8242         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
8243         parameter with an r_type parameter.  Use get_reference_flags
8244         to get the flags.
8245         (Target_i386::Relocate::relocate): Update accordingly.
8246         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
8247         (Target_powerpc::Scan::global): Use it.
8248         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
8249         (Target_powerpc::Relocate::relocate): Likewise.
8250         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
8251         (Target_sparc::Scan::global): Use it.
8252         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
8253         (Target_sparc::Relocate::relocate): Likewise.
8254         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
8255         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
8256         (Target_x86_64::Scan::global): Likewise.
8257         (Target_x86_64::Relocate::relocate): Likewise.
8258
8259 2010-11-08  Doug Kwan  <dougkwan@google.com>
8260             Cary Coutant  <ccoutant@google.com>
8261
8262         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
8263         (Arm_exidx_merge_section::section_contents_): New data member.
8264         (Arm_input_section::Arm_input_section): Initialize original_contents_.
8265         (Arm_input_section::~Arm_input_section): De-allocate memory.
8266         (Arm_input_section::original_contents_): New data member.
8267         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
8268         in parameters instead of calling Object::section_contents without
8269         locking.
8270         (Arm_output_section::group_section): New parameter TASK.  Pass it
8271         to callees that need locking objects.
8272         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
8273         to lock EXIDX input sections.  Fix a formatting issue.  Call
8274         Arm_exidx_merged_section::build_contents to create merged section
8275         contents.
8276         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
8277         to lock object of stub table owner.
8278         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
8279         TEXT_SIZE to initialize data member TEXT_SIZE_.
8280         (Arm_exidx_input_section::addralign): Fix typo in comment.
8281         (Arm_exidx_input_section::text_size): New method.
8282         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
8283         that require locking objects.  Lock objects before scanning for stubs
8284         and updating local symbols.
8285         (Arm_input_section<big_endian>::init): Copy contents of original
8286         input section.
8287         (Arm_input_section<big_endian>::do_write): Use saved contents of
8288         original input section instead of calling Object::section_contents
8289         without locking.
8290         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
8291         size without calling Object::section_size().
8292         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
8293         for size.  Allocate a buffer for merged EXIDX entries.
8294         (Arm_exidx_merged_section::build_contents): New method.
8295         (Arm_exidx_merged_section::do_write): Move merge section contents
8296         building code to Arm_exidx_merged_section::build_contetns.  Write
8297         out contetns in buffer instead of building it on the fly.
8298         (Arm_relobj::make_exidx_input_section): Also pass text section size
8299         to Arm_exidx_input_section constructor.
8300         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
8301         (Arm_dynobj::do_read_symbols): Fix memory leak.
8302         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
8303         * target.h: (class Task): Add forward declaration.
8304         (Target::relax): Add new parameter TASK and pass it to
8305         Target::do_relax().
8306         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
8307
8308 2010-11-05  Cary Coutant  <ccoutant@google.com>
8309
8310         PR gold/10708
8311         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
8312         object when reading from the file.
8313         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
8314         second layout pass.
8315         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
8316         when reading section contents.
8317         (get_section_contents): Likewise.
8318         (icf::find_identical_sections): Likewise.
8319         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
8320         object when reading from the file.
8321         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
8322         the object when doing deferred section layout.
8323
8324 2010-11-03  Nick Clifton  <nickc@redhat.com>
8325
8326         PR gold/12001
8327         * script.h (class Symbol_assignment: name): New member.  Returns
8328         the name of the symbol.
8329         * scrfipt.cc (Script_options::is_pending_assignment): New member.
8330         Returns true if the given symbol name is on the list of
8331         assignments wating to be processed.
8332         * archive.cc (should_incldue_member): If the symbol is undefined,
8333         check to see if it is on the list of symbols pending assignment.
8334
8335 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
8336
8337         * script-sections.cc (Script_sections::find_memory_region): Check
8338         for a NULL output section pointer.
8339
8340 2010-10-29  Doug Kwan  <dougkwan@google.com>
8341
8342         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
8343         Output_section::add_relaxed_input_section.
8344         * output.cc (Output_section::add_relaxed_input_section): Add new
8345         arguments LAYOUT and NAME.  Set section order index.
8346         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8347         Copy section order index.
8348         * output.h (Output_section::add_relaxed_input_section): Add new
8349         arguments LAYOUT and NAME.
8350
8351 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8352
8353         * testsuite/Makefile.am: Move gcctestdir/ld rule to
8354         NATIVE_OR_CROSS_LINKER.
8355         * testsuite/Makefile.in: Regenerate.
8356
8357 2010-10-20  Doug Kwan  <dougkwan@google.com>
8358
8359         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
8360         without SHF_LINK_ORDER flags.
8361         * layout.cc (Layout::choose_output_section): Do not filter
8362         SHF_LINK_ORDER flag in a relocatable link.
8363
8364 2010-10-17  Cary Coutant  <ccoutant@google.com>
8365
8366         * output.h (Output_segment::set_section_addresses): Change function
8367         signature.  Update all callers.
8368         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
8369         sections.
8370         (Output_segment::set_section_addresses): Align after last TLS
8371         section.  Add padding before last relro section instead of after.
8372
8373 2010-10-17  Doug Kwan  <dougkwan@google.com>
8374
8375         * gold/arm.cc (Target_arm::got_section): Use correct order and set
8376         GOT output section to be writable.
8377
8378 2010-10-14  Cary Coutant  <ccoutant@google.com>
8379
8380         * debug.h (DEBUG_INCREMENTAL): New flag.
8381         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
8382         * gold.cc (queue_initial_tasks): Check parameters for incremental link
8383         mode.
8384         * incremental.cc (report_command_line): Ignore all forms of
8385         --incremental.
8386         * layout.cc (Layout::Layout): Check parameters for incremental link
8387         mode.
8388         * options.cc (General_options::parse_incremental): New function.
8389         (General_options::parse_no_incremental): New function.
8390         (General_options::parse_incremental_full): New function.
8391         (General_options::parse_incremental_update): New function.
8392         (General_options::incremental_mode_): New data member.
8393         (General_options::finalize): Check incremental_mode_.
8394         * options.h (General_options): Update help text for --incremental.
8395         Add --no-incremental, --incremental-full, --incremental-update.
8396         (General_options::Incremental_mode): New enum type.
8397         (General_options::incremental_mode): New function.
8398         (General_options::incremental_mode_): New data member.
8399         * parameters.cc (Parameters::incremental_mode_): New data member.
8400         (Parameters::set_options): Set incremental_mode_.
8401         (Parameters::set_incremental_full): New function.
8402         (Parameters::incremental): New function.
8403         (Parameters::incremental_update): New function.
8404         (set_parameters_incremental_full): New function.
8405         * parameters.h (Parameters::set_incremental_full): New function.
8406         (Parameters::incremental): New function.
8407         (Parameters::incremental_update): New function.
8408         (Parameters::incremental_mode_): New data member.
8409         (set_parameters_incremental_full): New function.
8410         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
8411         incremental link mode.
8412         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
8413         (Sized_relobj::do_relocate_sections): Likewise.
8414         * testsuite/Makefile.am (incremental_test): Use --incremental-full
8415         option.
8416         * testsuite/Makefile.in: Regenerate.
8417         * testsuite/incremental_test.sh: Filter all forms of --incremental.
8418
8419 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8420
8421         * script-sections.h (class Script_sections): Make
8422         Sections_elements typedef public.
8423         * script-sections.cc (class Sort_output_sections): Add elements_
8424         field.  Add constructor which sets it; change all callers.
8425         (Sort_output_sections::is_before): New function.
8426         (Sort_output_sections::operator()): Call is_before.
8427         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
8428         conditional.
8429         * testsuite/script_test_10.sh: New test. Test script section
8430         order.
8431         * testsuite/script_test_10.t: Likewise.
8432         * testsuite/script_test_10.s: Likewise.
8433         * testsuite/Makefile.am: Wrap the cross linker tests and the
8434         common tests into NATIVE_OR_CROSS_LINKER.
8435         (check_SCRIPTS): Add script_test_10.sh.
8436         (check_DATA): Add script_test_10.stdout.
8437         (script_test_10.o, script_test_10): New targets.
8438         (script_test_10.stdout): New target.
8439         * configure, testsuite/Makefile.in: Regenerate.
8440
8441 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8442
8443         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
8444         error for the deprecated relocations.
8445         (Target_arm::Scan::global): Likewise.
8446         (Target_arm::Relocate::relocate): Likewise.
8447
8448 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
8449
8450         * fileread.cc (Input_file::find_file): Initialize *found_name
8451         and *namep when using the fallback search for case 4.
8452
8453 2010-10-11  Cary Coutant  <ccoutant@google.com>
8454
8455         * options.h (class General_options): Redefine -z lazy as an alias for
8456         the negation of -z now.
8457
8458 2010-10-11  Ian Lance Taylor  <iant@google.com>
8459
8460         * resolve.cc (symbol_to_bits): Report the value of the unsupported
8461         binding.
8462
8463 2010-10-06  Nick Clifton  <nickc@redhat.com>
8464
8465         * script-sections.cc(class Memory_region): Remove
8466         current_lma_offset_ field.  Rename current_vma_offset_ to
8467         current_offset_.  Add last_section_ field.
8468         (Memory_region::get_current_vma_address): Rename to
8469         get_current_address.
8470         (Memory_region::get_current_lma_address): Delete.
8471         (Memory_region::increment_vma_offset): Rename to
8472         increment_offset.
8473         (Memory_region::increment_lma_offset): Delete.
8474         (Memory_region::attributes_compatible): New method.  Returns
8475         true if the provided section is compatible with the region.
8476         (Memory_region::get_last_section): New method.  Returns the last
8477         section to use the region.
8478         (Memory_region::set_last_section): New method.  Stores the last
8479         section to use the region.
8480         (Script_sections::block_in_region): New method.  Returns true if
8481         a block of memory is contained within a region.
8482         (Script_sections::find_memory_region): New method.  Locates a
8483         memory region to be used to set a VMA or LMA address.
8484         (Output_section_definition::set_section_addresses): Add code to
8485         check for addresses set by memory regions.
8486         (Output_segment::set_section_addresses): Remove memory region
8487         walking code.
8488         (Script_sections::create_segment): Add a warning if a header
8489         segment is created outside of any region.
8490         * script-sections.h (class Script_sections): Add prototypes for
8491         find_memory_region and block_in_region methods.
8492         * testsuite/memory_test.s: Use .long instead of .word.
8493         * testsuite/memory_test.t: Add some more output sections.
8494         * testsuite/memory_test.sh: Update expected output.
8495
8496 2010-10-02  Doug Kwan  <dougkwan@google.com>
8497
8498         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
8499         defintion to symtab.h
8500         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
8501         declaration to defintion.
8502
8503 2010-10-01  Nick Clifton  <nickc@redhat.com>
8504
8505         * expression.cc (eval): Replace dummy argument with NULL.
8506         (eval_maybe_dot): Check for a NULL result section pointer.
8507         (Symbol_expression::value): Likewise.
8508         (Dot_expression::value): Likewise.
8509         (BINARY_EXPRESSION): Likewise.
8510         (Max_expression::value): Likewise.
8511         (Min_expression::value): Likewise.
8512         (Absolute_expression::value): Likewise.
8513         (Addr_expression::value_from_output_section): Likewise.
8514         (Loaddddr_expression::value_from_output_section): Likewise.
8515         (Segment_start_expression::value): Likewise.
8516         * script-sections.cc
8517         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
8518         argument with NULL.
8519         (Sections_elememt_dot_assignment::set_section_addresses):
8520         Likewise.
8521         (Output_data_expression::do_write_to_buffer): Likewise.
8522         (Output_section_definition::finalize_symbols): Likewise.
8523         (Output_section_definition::set_section_addresses): Likewise.
8524
8525 2010-09-30  Doug Kwan  <dougkwan@google.com>
8526
8527         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
8528
8529 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
8530
8531         * target.h (Target::can_icf_inline_merge_sections): New virtual
8532         function.
8533         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
8534         virtual function.
8535         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
8536         virtual function.
8537         * icf.cc (get_section_contents): Inline merge sections only when
8538         target allows it.
8539
8540 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8541
8542         * configure: Regenerate.
8543
8544 2010-09-17  Ian Lance Taylor  <iant@google.com>
8545
8546         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
8547         * testsuite/Makefile.am (memory_test.o): New target.
8548         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
8549         memory_test.t.
8550         * testsuite/Makefile.in: Rebuild.
8551
8552 2010-09-17  Doug Kwan  <dougkwan@google.com>
8553
8554         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
8555         defintion if relocation uses GOT entries of the symbol.
8556         * testsuite/icf_safe_test.sh: Fix test.
8557         * testsuite/icf_safe_so_test.sh: Fix test.
8558
8559 2010-09-16  Cary Coutant  <ccoutant@google.com>
8560
8561         * script_sections.cc (class Memory_region): Remove "NULL" from
8562         vector initializations.
8563
8564 2010-09-15  Cary Coutant  <ccoutant@google.com>
8565
8566         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
8567         Resolve forwarding symbols.
8568
8569 2010-09-15  Doug Kwan  <dougkwan@google.com>
8570
8571         * gold/testsuite/script_test_3.t: Add ARM special sections.
8572         * gold/testsuite/script_test_4.t: Same.
8573         * gold/testsuite/script_test_5.t: Same.
8574         * gold/testsuite/script_test_6.t: Same.
8575         * gold/testsuite/script_test_7.t: Same.
8576         * gold/testsuite/script_test_7.t: Same.
8577         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
8578
8579 2010-09-14  Cary Coutant  <ccoutant@google.com>
8580
8581         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
8582         (Target_x86_64::Relocate::relocate_tls): Replace check for
8583         saw_tls_block_reloc_ with test for executable section.
8584
8585 2010-09-12  Cary Coutant  <ccoutant@google.com>
8586
8587         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
8588         position-independent executables to shared libraries need dynamic
8589         relocations.
8590         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
8591         position-independent executables.
8592         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
8593         * testsuite/Makefile.in: Regenerate.
8594
8595 2010-09-10  Nick Clifton  <nickc@redhat.com>
8596
8597         PR gold/11997
8598         * testsuite/memory_test.t: Discard any sections that are not
8599         needed.
8600
8601 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
8602
8603         PR gold/11996
8604         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8605         "This::" to work around a bug in gcc 4.2.
8606
8607         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
8608
8609 2010-09-09  Rafael Espindola  <espindola@google.com>
8610
8611         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
8612         sections with different PF_X flags in the same segment.
8613         (Layout::find_first_load_seg): Search all segments to find the first
8614         one.
8615         * options.h (rosegment): New.
8616
8617 2010-09-08  Rafael Espindola  <espindola@google.com>
8618
8619         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
8620
8621 2010-09-08  Doug Kwan  <dougkwan@google.com>
8622
8623         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
8624         (Arm_relobj::do_relocate_sections): Add new parameter for output
8625         file to match the parent.
8626         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
8627         of local symbols instead of input values.  Update code to track
8628         changes in gold::relocate_section.
8629         * object.cc (Sized_relobj::compute_final_local_value): New methods.
8630         (Sized_relobj::compute_final_local_value_internal): New methods.
8631         (Sized_relobj::do_finalize_local_symbols): Move code from loop
8632         body into private version of Sized_relobj::compute_final_local_value.
8633         Call the inline method.
8634         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
8635         merged symbol value if there is one.
8636         (Symbol_value::has_output_value): New method defintiion.
8637         (Sized_relobj::Compute_final_local_value_status): New enum type.
8638         (Sized_relobj::compute_final_local_value): New methods.
8639         (Sized_relobj::compute_final_local_value_internal): New methods.
8640         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
8641         and arm_cortex_a8.sh.
8642         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
8643         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
8644         New tests.
8645         * Makefile.in: Regenerate.
8646         * testsuite/arm_bl_out_of_range.s: Update test.
8647         * testsuite/thumb_bl_out_of_range.s: Ditto.
8648         * testsuite/thumb_blx_out_of_range.s: Ditto.
8649         * testsuite/arm_branch_out_of_range.sh: New file.
8650         * testsuite/arm_cortex_a8.sh: Ditto.
8651         * testsuite/arm_cortex_a8_b.s: Ditto.
8652         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
8653         * testsuite/arm_cortex_a8_b_local.s: Ditto.
8654         * testsuite/arm_cortex_a8_bl.s: Ditto.
8655         * testsuite/arm_cortex_a8_blx.s: Ditto.
8656         * testsuite/arm_cortex_a8_local.s: Ditto.
8657         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
8658         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
8659
8660 2010-09-08  Rafael Espindola  <espindola@google.com>
8661
8662         * Makefile.am (memory_test.stdout): Run readelf with -W.
8663         * Makefile.in: Regenerate.
8664         * testsuite/memory_test.sh: Make the regexps accept both 32 and
8665         64 bit output.
8666
8667 2010-09-08  Rafael Espindola  <espindola@google.com>
8668
8669         * script-sections.cc (Script_sections::add_memory_region): Convert
8670         field precision to int.
8671         * script.cc (script_set_section_region, script_set_section_region):
8672         Convert field precision to int.
8673
8674 2010-09-08  Rafael Espindola  <espindola@google.com>
8675
8676         * arm.cc (do_finalize_sections): Create the __exidx_start and
8677         __exdix_end symbols even when the section is missing.
8678
8679 2010-09-08  Nick Clifton  <nickc@redhat.com>
8680
8681         * README: Remove claim that MEMORY is not supported.
8682         * expression.cc (script_exp_function_origin)
8683         (script_exp_function_length): Move from here to ...
8684         * script.cc: ... here.
8685         (script_set_section_region, script_add_memory)
8686         (script_parse_memory_attr, script_include_directive): New
8687         functions.
8688         * script-sections.cc
8689         (class Memory_region): New class.
8690         (class Output_section_definition): Add set_memory_region,
8691         set_section_vma, set_section_lma and get_section_name methods.
8692         (class Script_Sections): Add add_memory_region,
8693         find_memory_region, find_memory_region_origin,
8694         find_memory_region_length and set_memory_region methods.
8695         Have set_section_addresses method walk the list of set memory
8696         regions.
8697         Extend the print methos to display memory regions.
8698         * script-sections.h: Add prototypes for new methods.
8699         Add enum for MEMORY region attributes.
8700         * yyscript.y: Add support for parsing MEMORY regions.
8701         * script-c.h: Add prototypes for new functions.
8702         * testsuite/Makefile.am: Add test of MEMORY region functionality.
8703         * testsuite/Makefile.in: Regenerate.
8704         * testsuite/memory_test.sh: New script.
8705         * testsuite/memory_test.s: New assembler source file.
8706         * testsuite/memory_test.t: New linker script.
8707
8708 2010-08-27  Doug Kwan  <dougkwan@google.com>
8709
8710         * gold/resolve.cc (Symbol_table::should_override): Let a weak
8711         reference override an existing dynamic weak reference.
8712         * testsuite/Makefile.am: Add new test dyn_weak_ref.
8713         * testsuite/Makefile.in: Regenerate.
8714         * testsuite/dyn_weak_ref.sh: New file.
8715         * testsuite/dyn_weak_ref_1.c: Ditto.
8716         * testsuite/dyn_weak_ref_2.c: Ditto.
8717
8718 2010-08-27  Ian Lance Taylor  <iant@google.com>
8719
8720         * incremental.h (class Incremental_input_entry): Add virtual
8721         destructor.
8722
8723 2010-08-27  Ian Lance Taylor  <iant@google.com>
8724
8725         * testsuite/start_lib_test_3.c: Mark t3 as used.
8726
8727 2010-08-27  Nick Clifton  <nickc@redhat.com>
8728
8729         * options.cc (version_script): Fix small typo in previous
8730         whitespace tidyup.
8731
8732 2010-08-25  Nick Clifton  <nickc@redhat.com>
8733
8734         * archive.cc: Formatting fixes: Remove whitespace between
8735         typename and following asterisk.  Remove whitespace between
8736         function name and opening parenthesis.
8737         * archive.h: Likewise.
8738         * arm.cc: Likewise.
8739         * attributes.cc: Likewise.
8740         * attributes.h: Likewise.
8741         * common.cc: Likewise.
8742         * copy-relocs.cc: Likewise.
8743         * dirsearch.h: Likewise.
8744         * dynobj.cc: Likewise.
8745         * ehframe.cc: Likewise.
8746         * ehframe.h: Likewise.
8747         * expression.cc: Likewise.
8748         * fileread.cc: Likewise.
8749         * fileread.h: Likewise.
8750         * gc.h: Likewise.
8751         * gold-threads.cc: Likewise.
8752         * gold.cc: Likewise.
8753         * i386.cc: Likewise.
8754         * icf.h: Likewise.
8755         * incremental-dump.cc: Likewise.
8756         * incremental.cc: Likewise.
8757         * layout.cc: Likewise.
8758         * layout.h: Likewise.
8759         * main.cc: Likewise.
8760         * merge.cc: Likewise.
8761         * merge.h: Likewise.
8762         * object.cc: Likewise.
8763         * object.h: Likewise.
8764         * options.cc: Likewise.
8765         * options.h: Likewise.
8766         * output.cc: Likewise.
8767         * output.h: Likewise.
8768         * plugin.cc: Likewise.
8769         * plugin.h: Likewise.
8770         * powerpc.cc: Likewise.
8771         * reloc.cc: Likewise.
8772         * script-c.h: Likewise.
8773         * script-sections.cc: Likewise.
8774         * script.cc: Likewise.
8775         * stringpool.cc: Likewise.
8776         * symtab.cc: Likewise.
8777         * symtab.h: Likewise.
8778         * target.cc: Likewise.
8779         * timer.cc: Likewise.
8780         * timer.h: Likewise.
8781         * version.cc: Likewise.
8782         * x86_64.cc: Likewise.
8783
8784 2010-08-24  Nick Clifton  <nickc@redhat.com>
8785
8786         PR 11899
8787         * layout.cc (segment_precedes): Sort segments by their physical
8788         addresses, if they have been set.
8789
8790 2010-08-23  Cary Coutant  <ccoutant@google.com>
8791
8792         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
8793         symbols data.
8794         (Lib_group::include_member): Unlock object after deleting its
8795         symbols data.
8796         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
8797         the bug fixed here.
8798
8799 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
8800             Cary Coutant  <ccoutant@google.com>
8801
8802         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
8803         constructor, and set_blocker.
8804         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
8805         readsyms_blocker_.
8806         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
8807         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
8808         * testsuite/Makefile.am (start_lib_test): New test case.
8809         * testsuite/Makefile.in: Regenerate.
8810         * testsuite/start_lib_test_main.c: New file.
8811         * testsuite/start_lib_test_1.c: New file.
8812         * testsuite/start_lib_test_2.c: New file.
8813         * testsuite/start_lib_test_3.c: New file.
8814
8815 2010-08-19  Ian Lance Taylor  <iant@google.com>
8816
8817         * Makefile.in: Rebuild with automake 1.11.1.
8818         * aclocal.m4: Likewise.
8819         * testsuite/Makefile.in: Likewise.
8820
8821 2010-08-19  Ian Lance Taylor  <iant@google.com>
8822
8823         PR 10893
8824         * i386.cc (class Output_data_plt_i386): Update declarations.
8825         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
8826         local_ifuncs_ fields.
8827         (Target_i386::do_plt_section_for_global): New function.
8828         (Target_i386::do_plt_section_for_local): New function.
8829         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
8830         parameter; change all callers.  Initialize global_ifuncs_ and
8831         local_ifuncs_.  If doing a static link define __rel_iplt_start and
8832         __rel_iplt_end.
8833         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
8834         (Output_data_plt_i386::add_local_ifunc_entry): New function.
8835         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
8836         symbols.
8837         (Target_i386::make_plt_section): New function, broken out of
8838         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
8839         (Target_i386::make_plt_entry): Call make_plt_section.
8840         (Target_i386::make_local_ifunc_plt_entry): New function.
8841         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
8842         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
8843         R_386_IRELATIVE to switch.
8844         (Target_i386::Scan::global): Likewise.
8845         (Target_i386::Relocate::relocate): Likewise.
8846         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
8847         switch.
8848         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
8849         (Target_x86_64::do_plt_section_for_global): New function.
8850         (Target_x86_64::do_plt_section_for_local): New function.
8851         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
8852         parameter; change all callers.  If doing a static link define
8853         __rela_iplt_start and __rela_iplt_end.
8854         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
8855         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
8856         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
8857         to point to .plt.
8858         (Target_x86_64::make_local_ifunc_plt_entry): New function.
8859         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
8860         switch.
8861         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
8862         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
8863         R_X86_64_IRELATIVE to switch.
8864         (Target_x86_64::Scan::global): Likewise.
8865         (Target_x86_64::Relocate::relocate): Likewise.
8866         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
8867         switch.
8868         * target.h (class Target): Add plt_section_for_global and
8869         plt_section_for_local functions.  Add do_plt_section_for_global
8870         and do_plt_section_for_local virtual functions.
8871         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
8872         clarifying comments.
8873         (Symbol::use_plt_offset): Handle IFUNC symbol.
8874         * object.cc (Sized_relobj::Sized_relobj): Initialize
8875         local_plt_offsets_.
8876         (Sized_relobj::local_has_plt_offset): New function.
8877         (Sized_relobj::local_plt_offset): New function.
8878         (Sized_relobj::set_local_plt_offset): New function.
8879         (Sized_relobj::do_count): Handle IFUNC symbol.
8880         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
8881         a bit away from input_shndx_ field.  Add set_is_func_symbol and
8882         is_ifunc_symbol functions.
8883         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
8884         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
8885         local_plt_offsets_ field.
8886         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
8887         * output.h (class Output_section_data): Add non-const
8888         output_section function.
8889         (class Output_data_got): Update declarations.
8890         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
8891         Add use_plt_offset parameter to global and local constructors.
8892         Change all callers.  Change local_sym_index_ field to 31 bits.
8893         Change GSYM_CODE and CONSTANT_CODE accordingly.
8894         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
8895         doing a static link don't set sh_link field.
8896         (Output_data_got::Got_entry::write): Use PLT offset if
8897         appropriate.
8898         (Output_data_got::add_global_plt): New function.
8899         (Output_data_got::add_local_plt): New function.
8900         * target-reloc.h (relocate_section): Handle IFUNC symbol.
8901         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
8902         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
8903         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
8904         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
8905         IFUNC conditional.
8906         * testsuite/ifunc-sel.h: New file.
8907         * testsuite/ifuncmain1.c: New file.
8908         * testsuite/ifuncmain1vis.c: New file.
8909         * testsuite/ifuncmod1.c: New file.
8910         * testsuite/ifuncdep2.c: New file.
8911         * testsuite/ifuncmain2.c: New file.
8912         * testsuite/ifuncmain3.c: New file.
8913         * testsuite/ifuncmod3.c: New file.
8914         * testsuite/ifuncmain4.c: New file.
8915         * testsuite/ifuncmain5.c: New file.
8916         * testsuite/ifuncmod5.c: New file.
8917         * testsuite/ifuncmain6pie.c: New file.
8918         * testsuite/ifuncmod6.c: New file.
8919         * testsuite/ifuncmain7.c: New file.
8920         * configure, testsuite/Makefile.in: Rebuild.
8921
8922 2010-08-18  Ian Lance Taylor  <iant@google.com>
8923
8924         * incremental.cc
8925         (Output_section_incremental_inputs::write_input_files): Add cast
8926         to avoid signed/unsigned comparison warning.
8927         (Output_section_incremental_inputs::write_info_blocks): Likewise.
8928
8929 2010-08-12  Cary Coutant  <ccoutant@google.com>
8930
8931         * common.cc (Sort_commons::operator()): Remove unnecessary code.
8932
8933 2010-08-13  Ian Lance Taylor  <iant@google.com>
8934
8935         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
8936
8937 2010-08-12  Cary Coutant  <ccoutant@google.com>
8938             Doug Kwan  <dougkwan@google.com>
8939
8940         * resolve.cc (Symbol_table::should_override): When a weak dynamic
8941         defintion overrides non-weak undef, remember that the original undef
8942         is not weak.
8943         * symtab.cc (Symbol_table::sized_write_global): For undef without
8944         an original weak binding, set binding to global in output.
8945         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
8946         * testsuite/Makefile.in: Regenerate.
8947         * testsuite/strong_ref_weak_def.sh: New file.
8948         * testsuite/strong_ref_weak_def_1.c: Ditto.
8949         * testsuite/strong_ref_weak_def_2.c: Ditto.
8950
8951 2010-08-12  Cary Coutant  <ccoutant@google.com>
8952
8953         * testsuite/incremental_test.sh: Rewrite.
8954         * testsuite/incremental_test_1.c: Rewrite.
8955         * testsuite/incremental_test_2.c: Rewrite.
8956
8957 2010-08-12  Cary Coutant  <ccoutant@google.com>
8958
8959         * arm.cc (Target_arm::got_size): Add const.
8960         (Target_arm::got_entry_count): New function.
8961         (Target_arm::plt_entry_count): New function.
8962         (Target_arm::first_plt_entry_offset): New function.
8963         (Target_arm::plt_entry_size): New function.
8964         (Output_data_plt_arm::entry_count): New function.
8965         (Output_data_plt_arm::first_plt_entry_offset): New function.
8966         (Output_data_plt_arm::get_plt_entry_size): New function.
8967         * i386.cc (Target_i386::got_size): Add const.
8968         (Target_i386::got_entry_count): New function.
8969         (Target_i386::plt_entry_count): New function.
8970         (Target_i386::first_plt_entry_offset): New function.
8971         (Target_i386::plt_entry_size): New function.
8972         (Output_data_plt_i386::entry_count): New function.
8973         (Output_data_plt_i386::first_plt_entry_offset): New function.
8974         (Output_data_plt_i386::get_plt_entry_size): New function.
8975         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
8976         find_incremental_inputs_sections.  Dump incremental_got_plt section.
8977         * incremental.cc: Include target.h.
8978         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
8979         parameter.  Adjust all callers.  Find incremental_got_plt section.
8980         (Incremental_inputs::create_data_sections): Create incremental_got_plt
8981         section.
8982         (Output_section_incremental_inputs::set_final_data_size): Calculate
8983         size of incremental_got_plt section.
8984         (Output_section_incremental_inputs::do_write): Write the
8985         incremental_got_plt section.
8986         (Got_plt_view_info): New struct.
8987         (Local_got_offset_visitor): New class.
8988         (Global_got_offset_visitor): New class.
8989         (Global_symbol_visitor_got_plt): New class.
8990         (Output_section_incremental_inputs::write_got_plt): New function.
8991         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
8992         Add parameter.  Adjust all callers.
8993         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8994         (Incremental_inputs::got_plt_section): New function.
8995         (Incremental_inputs::got_plt_section_): New data member.
8996         (Incremental_got_plt_reader): New class.
8997         * layout.cc (Layout::create_incremental_info_sections): Add the
8998         incremental_got_plt section.
8999         * object.h (Got_offset_list::get_list): New function.
9000         (Got offset_list::for_all_got_offsets): New function.
9001         (Sized_relobj::local_got_offset_list): New function.
9002         * powerpc.cc (Target_powerpc::got_size): Add const.
9003         (Target_powerpc::got_entry_count): New function.
9004         (Target_powerpc::plt_entry_count): New function.
9005         (Target_powerpc::first_plt_entry_offset): New function.
9006         (Target_powerpc::plt_entry_size): New function.
9007         (Output_data_plt_powerpc::entry_count): New function.
9008         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
9009         (Output_data_plt_powerpc::get_plt_entry_size): New function.
9010         * sparc.cc (Target_sparc::got_size): Add const.
9011         (Target_sparc::got_entry_count): New function.
9012         (Target_sparc::plt_entry_count): New function.
9013         (Target_sparc::first_plt_entry_offset): New function.
9014         (Target_sparc::plt_entry_size): New function.
9015         (Output_data_plt_sparc::entry_count): New function.
9016         (Output_data_plt_sparc::first_plt_entry_offset): New function.
9017         (Output_data_plt_sparc::get_plt_entry_size): New function.
9018         * symtab.h (Symbol::got_offset_list): New function.
9019         (Symbol_table::for_all_symbols): New function.
9020         * target.h (Sized_target::got_entry_count): New function.
9021         (Sized_target::plt_entry_count): New function.
9022         (Sized_target::plt_entry_size): New function.
9023         * x86_64.cc (Target_x86_64::got_size): Add const.
9024         (Target_x86_64::got_entry_count): New function.
9025         (Target_x86_64::plt_entry_count): New function.
9026         (Target_x86_64::first_plt_entry_offset): New function.
9027         (Target_x86_64::plt_entry_size): New function.
9028         (Output_data_plt_x86_64::entry_count): New function.
9029         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
9030         (Output_data_plt_x86_64::get_plt_entry_size): New function.
9031
9032 2010-08-12  Cary Coutant  <ccoutant@google.com>
9033
9034         * archive.cc: Include incremental.h.
9035         (Archive::Archive): Initialize incremental_info_.
9036         (Archive::include_member): Record archive members in incremental info.
9037         (Add_archive_symbols::run): Record begin and end of an archive in
9038         incremental info.
9039         (Lib_group::include_member): Record objects in incremental info.
9040         * archive.h (Incremental_archive_entry): Forward declaration.
9041         (Archive::set_incremental_info): New member function.
9042         (Archive::incremental_info): New member function.
9043         (Archive::Unused_symbol_iterator): New class.
9044         (Archive::unused_symbols_begin): New member function.
9045         (Archive::unused_symbols_end): New member function.
9046         (Archive::incremental_info_): New data member.
9047         * incremental-dump.cc (find_input_containing_global): New function.
9048         (dump_incremental_inputs): Dump new incremental info sections.
9049         * incremental.cc: Include symtab.h.
9050         (Output_section_incremental_inputs): New class.
9051         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
9052         new incremental info sections.
9053         (Sized_incremental_binary::do_check_inputs): Likewise.
9054         (Incremental_inputs::report_archive): Remove.
9055         (Incremental_inputs::report_archive_begin): New function.
9056         (Incremental_inputs::report_archive_end): New function.
9057         (Incremental_inputs::report_object): New function.
9058         (Incremental_inputs::finalize_inputs): Remove.
9059         (Incremental_inputs::report_input_section): New function.
9060         (Incremental_inputs::report_script): Rewrite.
9061         (Incremental_inputs::finalize): Do nothing but finalize string table.
9062         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9063         (Incremental_inputs::sized_create_inputs_section_data): Remove.
9064         (Incremental_inputs::create_data_sections): New function.
9065         (Incremental_inputs::relocs_entsize): New function.
9066         (Output_section_incremental_inputs::set_final_data_size): New function.
9067         (Output_section_incremental_inputs::do_write): New function.
9068         (Output_section_incremental_inputs::write_header): New function.
9069         (Output_section_incremental_inputs::write_input_files): New function.
9070         (Output_section_incremental_inputs::write_info_blocks): New function.
9071         (Output_section_incremental_inputs::write_symtab): New function.
9072         * incremental.h (Incremental_script_entry): Forward declaration.
9073         (Incremental_object_entry): Forward declaration.
9074         (Incremental_archive_entry): Forward declaration.
9075         (Incremental_inputs): Forward declaration.
9076         (Incremental_inputs_header_data): Remove.
9077         (Incremental_inputs_header): Remove.
9078         (Incremental_inputs_header_write): Remove.
9079         (Incremental_inputs_entry_data): Remove.
9080         (Incremental_inputs_entry): Remove.
9081         (Incremental_inputs_entry_write): Remove.
9082         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
9083         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
9084         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9085         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
9086         Likewise.
9087         (Incremental_input_entry): New class.
9088         (Incremental_script_entry): New class.
9089         (Incremental_object_entry): New class.
9090         (Incremental_archive_entry): New class.
9091         (Incremental_inputs::Incremental_inputs): Initialize new data members.
9092         (Incremental_inputs::report_inputs): Remove.
9093         (Incremental_inputs::report_archive): Remove.
9094         (Incremental_inputs::report_archive_begin): New function.
9095         (Incremental_inputs::report_archive_end): New function.
9096         (Incremental_inputs::report_object): Change prototype.
9097         (Incremental_inputs::report_input_section): New function.
9098         (Incremental_inputs::report_script): Change prototype.
9099         (Incremental_inputs::get_reloc_count): New function.
9100         (Incremental_inputs::set_reloc_count): New function.
9101         (Incremental_inputs::create_data_sections): New function.
9102         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9103         (Incremental_inputs::inputs_section): New function.
9104         (Incremental_inputs::symtab_section): New function.
9105         (Incremental_inputs::relocs_section): New function.
9106         (Incremental_inputs::get_stringpool): Add const.
9107         (Incremental_inputs::command_line): Add const.
9108         (Incremental_inputs::inputs): Remove.
9109         (Incremental_inputs::command_line_key): New function.
9110         (Incremental_inputs::input_file_count): New function.
9111         (Incremental_inputs::input_files): New function.
9112         (Incremental_inputs::relocs_entsize): New function.
9113         (Incremental_inputs::sized_create_inputs_section_data): Remove.
9114         (Incremental_inputs::finalize_inputs): Remove.
9115         (Incremental_inputs::Input_info): Remove.
9116         (Incremental_inputs::lock_): Remove.
9117         (Incremental_inputs::inputs_): Change type.
9118         (Incremental_inputs::inputs_map_): Remove.
9119         (Incremental_inputs::current_object_entry_): New data member.
9120         (Incremental_inputs::inputs_section_): New data member.
9121         (Incremental_inputs::symtab_section_): New data member.
9122         (Incremental_inputs::relocs_section_): New data member.
9123         (Incremental_inputs::reloc_count_): New data member.
9124         (Incremental_inputs_reader): New class.
9125         (Incremental_symtab_reader): New class.
9126         (Incremental_relocs_reader): New class.
9127         * layout.cc (Layout::finalize): Move finalization of incremental info
9128         and creation of incremental info sections to follow finalization of
9129         symbol table.  Set offsets for postprocessing sections.
9130         (Layout::create_incremental_info_sections): Call
9131         Incremental_inputs::create_data_sections.  Add incremental symtab
9132         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
9133         sections to layout after input sections.
9134         * layout.h (struct Timespec): Forward declaration.
9135         (Layout::incremental_inputs): Add const.
9136         (Layout::create_incremental_info_sections): Add parameter.
9137         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
9138         * object.cc: Include incremental.h.
9139         (Relobj::finalize_incremental_relocs): New function.
9140         (Sized_relobj::do_layout): Record input sections in incremental info.
9141         * object.h (Object::output_section): New function.
9142         (Object::output_section_offset): Moved from Relobj.
9143         (Object::get_incremental_reloc_base): New function.
9144         (Object::get_incremental_reloc_count): New function.
9145         (Object::do_output_section): New function.
9146         (Object::do_output_section_offset): Moved from Relobj.
9147         (Object::do_get_incremental_reloc_base): New function.
9148         (Object::do_get_incremental_reloc_count): New function.
9149         (Object::Object): Initialize new data members.
9150         (Relobj::output_section): Renamed do_output_section and moved to
9151         protected.
9152         (Relobj::output_section_offset): Moved to Object.
9153         (Relobj::do_get_incremental_reloc_base): New function.
9154         (Relobj::do_get_incremental_reloc_count): New function.
9155         (Relobj::allocate_incremental_reloc_counts): New function.
9156         (Relobj::count_incremental_reloc): New function.
9157         (Relobj::finalize_incremental_relocs): New function.
9158         (Relobj::next_incremental_reloc_index): New function.
9159         (Relobj::reloc_counts_): New data member.
9160         (Relobj::reloc_bases_): New data member.
9161         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
9162         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
9163         (Sized_relobj::incremental_relocs_scan): New function.
9164         (Sized_relobj::incremental_relocs_scan_reltype): New function.
9165         (Sized_relobj::incremental_relocs_write): New function.
9166         (Sized_relobj::incremental_relocs_write_reltype): New function.
9167         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
9168         incremental link.
9169         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
9170         archives and object files elsewhere.
9171         (Add_symbols::run): Report object files here.
9172         (Finish_group::run): Report end of archive at end of group.
9173         * reloc.cc: Include layout.h, incremental.h.
9174         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
9175         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
9176         (Sized_relobj::incremental_relocs_scan): New function.
9177         (Sized_relobj::incremental_relocs_scan_reltype): New function.
9178         (Sized_relobj::do_relocate_sections): Write incremental relocations.
9179         (Sized_relobj::incremental_relocs_write): New function.
9180         (Sized_relobj::incremental_relocs_write_reltype): New function.
9181         * script.cc (read_input_script): Rewrite test for incremental link.
9182         Change call to Incremental_inputs::report_script.
9183         * symtab.h (Symbol_table::first_global_index): New function.
9184         (Symbol_table::output_count): New function.
9185
9186 2010-08-12  Doug Kwan  <dougkwan@google.com>
9187
9188         * arm.cc (Target_arm::merge_object_attributes): Check command line
9189         options --no-wchar-size-warning and --no-enum-size-warning.
9190         * options.h (General_options): Add ld-compatible options
9191         --no-enum-size-warning and --no-wchar-size-warning.
9192
9193 2010-08-04  Ian Lance Taylor  <iant@google.com>
9194
9195         * x86_64.cc (Target_x86_64::Scan::local): Use
9196         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
9197         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
9198         (Target_x86_64::Scan::global): Likewise.
9199         (Target_x86_64::Relocate::relocate): Likewise.
9200         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
9201         Likewise.
9202
9203 2010-08-03  Cary Coutant  <ccoutant@google.com>
9204
9205         * merge.cc (Output_merge_string::do_add_input_section): Count strings
9206         to reserve space in merged_strings vector. Keep total input size
9207         for stats.
9208         (Output_merge_string::do_print_merge_stats): Print total input size.
9209         * merge.h (Output_merge_string): Add input_size_ field.
9210         * stringpool.cc (Stringpool_template::string_length): Move
9211         implementations out of Stringpool_template class and place in
9212         stringpool.h.
9213         * stringpool.h (string_length): Move out of Stringpool_template.
9214
9215 2010-08-03  Ian Lance Taylor  <iant@google.com>
9216
9217         PR 11712
9218         * layout.cc (relaxation_loop_body): If address of load segment is
9219         set, adjust address to include headers if possible.
9220
9221 2010-08-03  Ian Lance Taylor  <iant@google.com>
9222
9223         * version.cc (version_string): Bump to 1.10.
9224
9225 2010-08-03  Ian Lance Taylor  <iant@google.com>
9226
9227         PR 11805
9228         * layout.h (enum Output_section_order): Define.
9229         (class Layout): Update declarations.
9230         * layout.cc (Layout::get_output_section): Add order parameter.
9231         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
9232         is_first_non_relro parameters.  Change all callers.
9233         (Layout::choose_output_section): Likewise.
9234         (Layout::add_output_section_data): Likewise.
9235         (Layout::make_output_section): Likewise.  Set order.
9236         (Layout::default_section_order): New function.
9237         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
9238         * output.cc (Output_section::Output_section): Initialize order_.
9239         Don't initialize deleted fields.
9240         (Output_segment::Output_segment): Don't initialize deleted
9241         fields.
9242         (Output_segment::add_output_section_to_load): New function
9243         replacing add_output_section.  Change all callers to call this or
9244         add_output_section_to_nonload.
9245         (Output_segment::add_output_section_to_nonload): New function.
9246         (Output_segment::remove_output_section): Rewrite.
9247         (Output_segment::add_initial_output_data): Likewise.
9248         (Output_segment::has_any_data_sections): Likewise.
9249         (Output_segment::is_first_section_relro): Likewise.
9250         (Output_segment::maximum_alignment): Likewise.
9251         (Output_segment::has_dynamic_reloc): New function replacing
9252         dynamic_reloc_count.  Change all callers.
9253         (Output_segment::has_dynamic_reloc_list): New function replacing
9254         dynamic_reloc_count_list.  Change all callers.
9255         (Output_segment::set_section_addresses): Rewrite.
9256         (Output_segment::set_offset): Rewrite.
9257         (Output_segment::find_first_and_last_list): Remove.
9258         (Output_segment::set_tls_offsets): Rewrite.
9259         (Output_segment::first_section_load_address): Likewise.
9260         (Output_segment::output_section_count): Likewise.
9261         (Output_segment::section_with_lowest_load_address): Likewise.
9262         (Output_segment::write_section_headers): Likewise.
9263         (Output_segment::print_sections_to_map): Likewise.
9264         * output.h (class Output_data): Remove dynamic_reloc_count_
9265         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
9266         (Output_data::add_dynamic_reloc): Rewrite.
9267         (Output_data::has_dynamic_reloc): New function.
9268         (Output_data::dynamic_reloc_count): Remove.
9269         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
9270         is_last_relro_, is_first_non_relro_, is_interp_,
9271         is_dynamic_linker_section_ fields.  Add order and set_order
9272         functions.  Remove is_relro_local, set_is_relro_local,
9273         is_last_relro, set_is_last_relro, is_first_non_relro,
9274         set_is_first_non_relro functions, is_interp, set_is_interp,
9275         is_dynamic_linker_section, and set_is_dynamic_linker_section
9276         functions.
9277         (class Output_segment): Change Output_data_list from std::list to
9278         std:;vector.  Add output_lists_ field.  Remove output_data_ and
9279         output_bss_ fields.  Update declarations.
9280
9281 2010-08-02  Ian Lance Taylor  <iant@google.com>
9282
9283         * arm.cc (Target_arm::gc_process_relocs): Use typename.
9284         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
9285         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
9286
9287 2010-08-02  Ian Lance Taylor  <iant@google.com>
9288
9289         PR 11855
9290         * script.cc (Script_options::Script_options): Initialize
9291         symbol_definitions_ and symbol_references_.
9292         (Script_options::add_symbol_assignment): Update
9293         symbol_definitions_ and symbol_references_.
9294         (Script_options::add_symbol_reference): New function.
9295         (script_symbol): New function.
9296         * script.h (class Script_options): Add symbol_definitions_ and
9297         symbol_references_ fields.
9298         (Script_options::referenced_const_iterator): New type.
9299         (Script_options::referenced_begin): New function.
9300         (Script_options::referenced_end): New function.
9301         (Script_options::is_referenced): New function.
9302         (Script_options::any_unreferenced): New function.
9303         * script-c.h (script_symbol): Declare.
9304         * yyscript.y (exp): Call script_symbol.
9305         * symtab.cc: Include "script.h".
9306         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
9307         Change all callers.  Check symbols referenced by scripts.
9308         (Symbol_table::add_undefined_symbols_from_command_line): Add
9309         layout parameter.  Change all callers.
9310         (Symbol_table::do_add_undefined_symbols_from_command_line):
9311         Likewise.  Break out loop body.  Check symbols referenced by
9312         scripts.
9313         (Symbol_table::add_undefined_symbol_from_command_line): New
9314         function broken out of
9315         do_add_undefined_symbols_from_command_line.
9316         * symtab.h (class Symbol_table): Update declarations.
9317         * archive.cc: Include "layout.h".
9318         (Archive::should_include_member): Add layout parameter.  Change
9319         all callers.  Check for symbol mentioned in expression.
9320         * archive.h (class Archive): Update declaration.
9321         * object.cc (Sized_relobj::do_should_include_member): Add layout
9322         parameter.
9323         * object.h (Object::should_include_member): Add layout parameter.
9324         Change all callers.
9325         (Object::do_should_include_member): Add layout parameter.
9326         (class Sized_relobj): Update declaration.
9327         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
9328         parameter.
9329         * dynobj.h (class Sized_dynobj): Update declaration.
9330         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
9331         layout parameter.
9332         * plugin.h (class Sized_pluginobj): Update declaration.
9333
9334 2010-08-02  Ian Lance Taylor  <iant@google.com>
9335
9336         PR 11866
9337         * output.cc (Output_segment::set_offset): Search for the first and
9338         last sections rather than assuming that the list is in order.
9339         (Output_segment::find_first_and_last_list): New function.
9340         * output.h (class Output_segment): Update declarations.
9341         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
9342         (relro_strip_test_SOURCES): New variable.
9343         (relro_strip_test_DEPENDENCIES): New variable.
9344         (relro_strip_test_LDFLAGS): New variable.
9345         (relro_strip_test_LDADD): New variable.
9346         (relro_strip_test.so): New target.
9347
9348 2010-08-02  Ian Lance Taylor  <iant@google.com>
9349
9350         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
9351         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
9352         (Target_i386::got_tlsdesc_section): New function.
9353         (Target_i386::got_section): Create space for GOT entries for
9354         TLSDESC relocations.
9355         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
9356         R_386_TLS_GOTDESC.
9357         (Target_i386::Scan::global): Likewise.
9358         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
9359         using TLSDESC GOT.
9360         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
9361         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
9362         (Target_x86_64::got_tlsdesc_section): New function.
9363         (Target_x86_64::got_section): Create space for GOT entries for
9364         TLSDESC relocations.
9365         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
9366         R_386_TLS_GOTDESC.
9367         (Target_x86_64::Scan::global): Likewise.
9368         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
9369         using TLSDESC GOT.
9370
9371 2010-08-02  Ian Lance Taylor  <iant@google.com>
9372
9373         * testsuite/final_layout.sh: Use dc to convert from hex to
9374         decimal.
9375
9376 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
9377
9378         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
9379         paramter to the call to gold::gc_process_relocs.
9380         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
9381         paramter to the call to gold::gc_process_relocs.
9382         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
9383         parameter to the call to gold::gc_process_relocs.
9384         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
9385         template parameter to the call to gold::gc_process_relocs.
9386         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
9387         paramter to the call to gold::gc_process_relocs.
9388         * gc.h (get_embedded_addend_size): New function.
9389         (gc_process_relocs): Save the size of the reloc for use by ICF.
9390         * icf.cc (get_section_contents): Get the addend from the text section
9391         for SHT_REL relocation sections.
9392         * icf.h (Icf::Reloc_addend_size_info): New typedef.
9393         (Icf::Reloc_info): Add new member reloc_addend_size_info.
9394         * int_encoding.h (read_from_pointer): New overloaded function.
9395         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
9396         * testsuite/icf_sht_rel_addend_test.sh: New file.
9397         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
9398         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
9399
9400 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9401
9402         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
9403         * Makefile.in: Regenerate.
9404         * testsuite/Makefile.in: Regenerate.
9405
9406 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
9407
9408         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
9409         * gold/testsuite/debug_msg.cc: Likewise.
9410         * gold/testsuite/odr_violation1.cc
9411         * gold/testsuite/odr_violation2.cc
9412
9413 2010-07-21  Cary Coutant  <ccoutant@google.com>
9414
9415         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
9416         string, and length fields.
9417         (Output_merge_string::Merged_strings_list): New type.
9418         (Output_merge_string::Merged_strings_lists): New typedef.
9419         (Output_merge_string): Replace merged_strings_ with
9420         merged_strings_lists_.
9421         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
9422         Merged_strings_list per input object and section.  Don't store pointer
9423         to the string.  Don't store length with each merged string entry.
9424         (Output_merge_string::finalize_merged_data): Loop over list of merged
9425         strings lists.  Recompute length of each merged string.
9426
9427 2010-07-15  Cary Coutant  <ccoutant@google.com>
9428
9429         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
9430         here.
9431
9432 2010-07-14  Ian Lance Taylor  <iant@google.com>
9433
9434         * descriptors.cc (Descriptors::open): Report correct name in error
9435         message.
9436
9437 2010-07-13  Doug Kwan  <dougkwan@google.com>
9438
9439         * arm.cc (Arm_input_section::Arm_input_section): For a
9440         SHT_ARM_EXIDX section, always keeps the input sections.
9441         (Arm_input_section::set_exidx_section_link): New method.
9442         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
9443         has_errors_ to false.
9444         (Arm_exidx_input_section::has_errors,
9445         Arm_exidx_input_section::set_has_errors): New methods.
9446         (Arm_exidx_input_section::has_errors_): New data member.
9447         (Arm_relobj::get_exidx_shndx_list): New method.
9448         (Arm_output_section::append_text_sections_to_list): Do not skip
9449         section without SHF_EXECINSTR.
9450         (Arm_output_section::fix_exidx_coverage): Skip input sections with
9451         errors.
9452         (Arm_relobj::make_exidx_input_section): Add new parameter for text
9453         section header.  Make error messages more verbose.  Check for
9454         a non-executable section linked to an EXIDX section.
9455         (Arm_relobj::do_read_symbols): Remove error checking, which has been
9456         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
9457         check that there is no deferred EXIDX section if we exit early.
9458         Instead of not making an EXIDX section in case of an error, make one
9459         and set the has_errors flag of it.
9460         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
9461         in a relocatable link.
9462         (Target_arm::do_relax): Look for the EXIDX output section instead of
9463         assuming that it is called .ARM.exidx.
9464         (Target_arm::fix_exidx_coverage): Add a new parameter for input
9465         section list.  Do not check for SHF_EXECINSTR section flags but
9466         skip any input section with errors.
9467         * output.cc (Output_section::Output_section): Initialize
9468         always_keeps_input_sections_ to false.
9469         (Output_section::add_input_section): Check for
9470         always_keeps_input_sections_.
9471         *  output.h (Output_section::always_keeps_input_sections,
9472         Output_section::set_always_keeps_input_sections): New methods.
9473         (Output_section::always_keeps_input_sections): New data member.
9474
9475 2010-07-13  Rafael Espindola  <espindola@google.com>
9476
9477         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
9478         * fileread.h (Input_file): Add try_extra_search_path and find_file.
9479
9480 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
9481             Ian Lance Taylor  <iant@google.com>
9482
9483         * output.h (Output_section_lookup_maps::add_merge_section):
9484         Correct check of whether value was inserted.
9485         (Output_section_lookup_maps::add_merge_input_section): Likewise.
9486         (Output_section_lookup_maps::add_relaxed_input_section):
9487         Likewise.
9488         * arm.cc (Target_arm::got_section): Remove used local os.
9489         * i386.cc (Target_i386::got_section): Likewise.
9490         * x86_64.cc (Target_x86_64::got_section): Likewise.
9491         * sparc.cc (Target_sparc::got_section): Likewise.
9492         (Target_sparc::relocate): Remove unused local have_got_offset.
9493         * powerpc.cc (Target_powerpc::relocate): Likewise.
9494
9495 2010-07-13  Ian Lance Taylor  <iant@google.com>
9496
9497         * compressed_output.cc (zlib_decompress): Fix signature in
9498         !HAVE_ZLIB_H case.
9499
9500         * archive.cc (Archive::include_member): Unlock an external member
9501         of a thin archive.  Don't bother to delete an object we know is
9502         NULL.
9503
9504 2010-07-12  Cary Coutant  <ccoutant@google.com>
9505
9506         * compressed_output.cc (zlib_decompress): New function.
9507         (get_uncompressed_size): New function.
9508         (decompress_input_section): New function.
9509         * compressed_output.h (get_uncompressed_size): New function.
9510         (decompress_input_section): New function.
9511         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
9512         Handle compressed debug sections.
9513         * layout.cc (is_compressed_debug_section): New function.
9514         (Layout::output_section_name): Map compressed section names to
9515         canonical names.
9516         * layout.h (is_compressed_debug_section): New function.
9517         (is_debug_info_section): Recognize compressed debug sections.
9518         * merge.cc: Include compressed_output.h.
9519         (Output_merge_data::do_add_input_section): Handle compressed
9520         debug sections.
9521         (Output_merge_string::do_add_input_section): Handle compressed
9522         debug sections.
9523         * object.cc: Include compressed_output.h.
9524         (Sized_relobj::Sized_relobj): Initialize new data members.
9525         (build_compressed_section_map): New function.
9526         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
9527         * object.h (Object::section_is_compressed): New method.
9528         (Object::do_section_is_compressed): New method.
9529         (Sized_relobj::Compressed_section_map): New type.
9530         (Sized_relobj::do_section_is_compressed): New method.
9531         (Sized_relobj::compressed_sections_): New data member.
9532         * output.cc (Output_section::add_input_section): Handle compressed
9533         debug sections.
9534         * reloc.cc: Include compressed_output.h.
9535         (Sized_relobj::write_sections): Handle compressed debug sections.
9536
9537 2010-07-08  Cary Coutant  <ccoutant@google.com>
9538
9539         * resolve.cc (Symbol_table::resolve): Remember whether undef was
9540         weak when resolving to a dynamic def.
9541         (Symbol_table::should_override): Add adjust_dyndef flag; set it
9542         for weak undef/dynamic def cases. Adjust callers.
9543         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
9544         undef_binding_weak_.
9545         (Symbol_table::sized_write_globals): Adjust symbol binding.
9546         (Symbol_table::sized_write_symbol): Add binding parameter.
9547         * symtab.h (Symbol::set_undef_binding): New method.
9548         (Symbol::is_undef_binding_weak): New method.
9549         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
9550         (Symbol_table::should_override): Add new parameter.
9551         (Symbol_table::sized_write_symbol): Add new parameter.
9552
9553         * testsuite/weak_undef_file1.cc: Add new test case.
9554         * testsuite/weak_undef_file2.cc: Fix header comment.
9555         * testsuite/weak_undef_test.cc: Add new test case.
9556
9557 2010-06-29  Doug Kwan  <dougkwan@google.com>
9558
9559         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
9560         Initialize USE_SYMBOL_.
9561         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
9562         definition.
9563         (Arm_reloc_property::uses_symbol_): New data member declaration.
9564         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
9565         uses symbol value and symbol is undefined but not weakly undefined.
9566
9567 2010-06-28  Rafael Espindola  <espindola@google.com>
9568
9569         * plugin.cc (Plugin::load): Use dlerror.
9570
9571 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
9572
9573         * symtab.cc (detect_odr_violations): When reporting an ODR
9574         violation, report an object where the symbol is defined.
9575
9576 2010-06-25  Doug Kwan  <dougkwan@google.com>
9577
9578         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
9579         (Target_arm::section_may_have_icf_unsafe_pointers): New method
9580         definition.
9581         (Target_arm::Scan::local_reloc_may_be_function_pointer,
9582         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
9583         target hook to detect function points.
9584         (Target_arm::Scan::possible_function_pointer_reloc): New method.
9585         * icf.h (Icf::check_section_for_function_pointers): Change type of
9586         parameter SECTION_NAME to const reference to std::string.  Use
9587         target hook to determine if section may have unsafe pointers.
9588         * target.h (Target::section_may_have_icf_unsafe_pointers): New
9589         method definition.
9590
9591 2010-06-21  Rafael Espindola  <espindola@google.com>
9592
9593         * fileread.cc (Input_file::find_fie): New
9594         (Input_file::open): Use Input_file::find_fie.
9595         * fileread.h (Input_file::find_fie): New
9596         * plugin.cc (set_extra_library_path): New.
9597         (Plugin::load): Add set_extra_library_path to the transfer vector.
9598         (Plugin_manager::set_extra_library_path): New.
9599         (Plugin_manager::add_input_file): Use the extra search path if set.
9600         (set_extra_library_path(): New.
9601         * plugin.h (Plugin_manager): Add set_extra_library_path and
9602         extra_search_path_.
9603
9604 2010-06-19  Cary Coutant  <ccoutant@google.com>
9605
9606         * layout.cc (gdb_sections): Add .debug_types.
9607         (lines_only_debug_sections): Likewise.
9608
9609 2010-06-18  Rafael Espindola  <espindola@google.com>
9610
9611         * plugin.cc (add_input_file,add_input_library)
9612         (Plugin_manager::add_input_file): Make filename arguments const.
9613         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
9614         const.
9615
9616 2010-06-16  Doug Kwan  <dougkwan@google.com>
9617
9618         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
9619         .ARM.attributes section if we have not merged any input
9620         attributes sections.
9621
9622 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9623
9624         * arm.cc: Allow combining objects with no EABI version
9625         information.
9626
9627 2010-06-15  Rafael Espindola  <espindola@google.com>
9628
9629         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
9630
9631 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9632
9633         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
9634         (struct iovec): Correct !HAVE_READV definition.
9635
9636 2010-06-10  Cary Coutant  <ccoutant@google.com>
9637
9638         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
9639         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
9640         reloc sections.
9641         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
9642
9643         PR 11683
9644         * symtab.h (Symbol::is_placeholder): New member function.
9645         * target-reloc.h (relocate_section): Check for placeholder symbols.
9646
9647         * testsuite/Makefile.am (plugin_test_8): New test.
9648         (plugin_test_9): New test.
9649         * testsuite/Makefile.in: Regenerate.
9650
9651 2010-06-09  Nick Clifton  <nickc@redhat.com>
9652
9653         * yyscript.y (input_list_element): Allow strings prefixed with
9654         the '-' character.  Treat these as libraries.
9655         * script.cc (script_add_library): New function.  Adds a library
9656         specified by "-l<name>" found in an input script.
9657         * script-c.h: Add prototype for script_add_library.
9658
9659 2010-06-07  Doug Kwan  <dougkwan@google.com>
9660
9661         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
9662         Restrict stub-group size to be within long conditional branch
9663         range when working around cortex-A8 erratum.
9664
9665 2010-06-07  Damien Diederen  <dd@crosstwine.com>
9666
9667         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
9668         #ifdef typo.
9669
9670 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
9671
9672         PR gold/11658
9673         * output.cc
9674         (Output_section::Input_section_sort_entry::compare_section_ordering):
9675         Change to return non-zero correctly.
9676         (Output_section::Input_section_sort_section_order_index_compare
9677         ::operator()): Change to fix ambiguity in comparisons.
9678
9679 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
9680
9681         * gold.h (is_wildcard_string): New function.
9682         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
9683         (Layout::layout_eh_frame): Ditto.
9684         (Layout::find_section_order_index): New method.
9685         (Layout::read_layout_from_file): New method.
9686         * layout.h (Layout::find_section_order_index): New method.
9687         (Layout::read_layout_from_file): New method.
9688         (Layout::input_section_position_): New private member.
9689         (Layout::input_section_glob_): New private member.
9690         * main.cc (main): Call read_layout_from_file here.
9691         * options.h (--section-ordering-file): New option.
9692         * output.cc (Output_section::input_section_order_specified_): New
9693         member.
9694         (Output_section::Output_section): Initialize new member.
9695         (Output_section::add_input_section): Add new parameter.
9696         Keep input sections when --section-ordering-file is used.
9697         (Output_section::set_final_data_size): Sort input sections when
9698         section ordering file is specified.
9699         (Output_section::Input_section_sort_entry): Add new parameter.
9700         Check sorting type.
9701         (Output_section::Input_section_sort_entry::compare_section_ordering):
9702         New method.
9703         (Output_section::Input_section_sort_compare::operator()): Change to
9704         consider section_order_index.
9705         (Output_section::Input_section_sort_init_fini_compare::operator()):
9706         Change to consider section_order_index.
9707         (Output_section::Input_section_sort_section_order_index_compare
9708         ::operator()): New method.
9709         (Output_section::sort_attached_input_sections): Change to sort
9710         according to section order when specified.
9711         (Output_section::add_input_section<32, true>): Add new parameter.
9712         (Output_section::add_input_section<64, true>): Add new parameter.
9713         (Output_section::add_input_section<32, false>): Add new parameter.
9714         (Output_section::add_input_section<64, false>): Add new parameter.
9715         * output.h (Output_section::add_input_section): Add new parameter.
9716         (Output_section::input_section_order_specified): New
9717         method.
9718         (Output_section::set_input_section_order_specified): New method.
9719         (Input_section::Input_section): Initialize section_order_index_.
9720         (Input_section::section_order_index): New method.
9721         (Input_section::set_section_order_index): New method.
9722         (Input_section::section_order_index_): New member.
9723         (Input_section::Input_section_sort_section_order_index_compare): New
9724         struct.
9725         (Output_section::input_section_order_specified_): New member.
9726         * script-sections.cc (is_wildcard_string): Delete and move modified
9727         method to gold.h.
9728         (Output_section_element_input::Output_section_element_input): Modify
9729         call to is_wildcard_string.
9730         (Output_section_element_input::Input_section_pattern
9731         ::Input_section_pattern): Ditto.
9732         (Output_section_element_input::Output_section_element_input): Ditto.
9733         * testsuite/Makefile.am (final_layout): New test case.
9734         * testsuite/Makefile.in: Regenerate.
9735         * testsuite/final_layout.cc: New file.
9736         * testsuite/final_layout.sh: New file.
9737
9738 2010-06-01  Rafael Espindola  <espindola@google.com>
9739
9740         * plugin.cc (Plugin::load): Pass the output name to the plugin.
9741
9742 2010-06-01  Rafael Espindola  <espindola@google.com>
9743
9744         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
9745         visibility of symbols.
9746
9747 2010-05-27  Doug Kwan  <dougkwan@google.com>
9748
9749         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
9750         from start of output section instead of address for a local symbol
9751         in a merged or relaxed section when doing a relocatable link.
9752
9753 2010-05-26  Rafael Espindola  <espindola@google.com>
9754
9755         PR 11604
9756         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
9757         adding sections the garbage collector removed.
9758         * gold/testsuite/Makefile.am: Add test.
9759         * gold/testsuite/Makefile.in: Regenerate.
9760         * gold/testsuite/plugin_test_7.sh: New.
9761         * gold/testsuite/plugin_test_7_1.c: New.
9762         * gold/testsuite/plugin_test_7_2.c: New.
9763
9764 2010-05-26  Rafael Espindola  <espindola@google.com>
9765
9766         * script-sections.cc (Output_section_definition::set_section_addresses):
9767         Check for --section-start.
9768
9769 2010-05-26  Doug Kwan  <dougkwan@google.com>
9770
9771         * arm.cc (Arm_scan_relocatable_relocs): New class.
9772         (Target_arm::relocate_special_relocatable): New method.
9773         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
9774         (Arm_relocate_functions::thumb_branch_common): Same.
9775         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
9776         instead of Default_scan_relocatable_relocs.
9777         * target-reloc.h (relocate_for_relocatable): Let target handle
9778         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
9779         * target.h (Sized_target::relocate_special_relocatable): New method.
9780
9781 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9782
9783         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
9784
9785 2010-05-23  Doug Kwan  <dougkwan@google.com>
9786
9787         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
9788         instead of a cast.
9789         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
9790         with a direct branch, not a conditional branch, to a stub.
9791         * merge.cc (Output_merge_base::record_input_section): New method
9792         defintion.
9793         (Output_merge_data::do_add_input_section): Record input section if
9794         keeps-input-sections flag is set.
9795         (Output_merge_string::do_add_input_section): Ditto.
9796         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
9797         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
9798         INPUT_SECTIONS_.
9799         (Output_merge_base::keeps_input_sections,
9800         Output_merge_base::set_keeps_input_sections,
9801         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
9802         method definitions.
9803         (Output_merge_base::Input_sections): New type declaration.
9804         (Output_merge_base::input_sections_begin,
9805         Output_merge_base::input_sections_end,
9806         Output_merge_base::do_set_keeps_input_sections): New method definitions.
9807         (Output_merge_base::bool keeps_input_sections_,
9808         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
9809         Output_merge_base::input_sections_): New data members.
9810         (Output_merge_data::do_set_keeps_input_sections): New method
9811         defintion.
9812         (Output_merge_string::do_set_keeps_input_sections): Ditto.
9813         * output.cc (Output_section::Input_section::relobj): Move method
9814         defintion from class declaration to here and handle merge sections.
9815         (Output_section::Input_section::shndx): Ditto.
9816         (Output_section::Output_section): Remove initializations of removed
9817         data members and initialize new data member LOOKUP_MAPS_.
9818         (Output_section::add_input_section): Set keeps-input-sections flag
9819         for a newly created merge output section as appropriate.  Adjust code
9820         to use Output_section_lookup_maps class.
9821         (Output_section::add_relaxed_input_section): Adjst code for lookup
9822         maps code refactoring.
9823         (Output_section::add_merge_input_section): Add a new parameter
9824         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
9825         class.  If adding input section to a newly created merge output
9826         section fails, remove the new merge section.
9827         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
9828         Adjust code for use of the Output_section_lookup_maps class.
9829         (Output_section::find_merge_section): Ditto.
9830         (Output_section::build_lookup_maps): New method defintion.
9831         (Output_section::find_relaxed_input_section): Adjust code to use
9832         Output_section_lookup_maps class.
9833         (Output_section::get_input_sections): Export merge sections.  Adjust
9834         code to use Output_section_lookup_maps class.
9835         (Output_section:::add_script_input_section): Adjust code to use
9836         Output_section_lookup_maps class.  Update lookup maps for merge
9837         sections also.
9838         (Output_section::discard_states): Use Output_section_lookup_maps.
9839         (Output_section::restore_states): Same.
9840         * output.h (Merge_section_properties): Move class defintion out of
9841         Output_section.
9842         (Output_section_lookup_maps): New class.
9843         (Output_section::Input_section::is_merge_section): New method
9844         defintion.
9845         (Output_section::Input_section::relobj): Move defintion out of class
9846         defintion.  Declare method only.
9847         (Output_section::Input_section::shndx): Ditto.
9848         (Output_section::Input_section::output_merge_base): New method defintion.
9849         (Output_section::Input_section::u2_.pomb): New union field.
9850         (Output_section::Merge_section_by_properties_map,
9851         Output_section::Output_section_data_by_input_section_map,
9852         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
9853         Remove types.
9854         (Output_section::add_merge_input_section): Add new parameter
9855         KEEPS_INPUT_SECTIONS.
9856         (Output_section::build_lookup_maps): New method declaration.
9857         (Output_section::merge_section_map_,
9858         Output_section::merge_section_by_properties_map_,
9859         Output_section::relaxed_input_section_map_,
9860         Output_section::is_relaxed_input_section_map_valid_): Remove data
9861         members.
9862         (Output_section::lookup_maps_): New data member.
9863
9864 2010-05-21  Doug Kwan  <dougkwan@google.com>
9865
9866         PR gold/11619
9867         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
9868         avoid a compilation error.
9869
9870 2010-05-19  Rafael Espindola  <espindola@google.com>
9871
9872         * script-sections.cc (Output_section_definition::allocate_to_segment):
9873         Update the phdrs_list even when the output section is NULL.
9874         * testsuite/Makefile.am: Add test.
9875         * testsuite/Makefile.in: Regenerate.
9876         * testsuite/script_test_9.cc: New.
9877         * testsuite/script_test_9.sh: New.
9878         * testsuite/script_test_9.t: New.
9879
9880 2010-05-19  Doug Kwan  <dougkwan@google.com>
9881
9882         * arm.cc (Arm_input_section::original_size): New method.
9883         (Arm_input_section::do_addralign): Add a cast.
9884         (Arm_input_section::do_output_offset): Remove static cast.
9885         (Arm_input_section::original_addralign,
9886          Arm_input_section::original_size_): Change type to uint32_t.
9887         (Arm_input_section::init): Add safe casts for section alignment
9888         and size.
9889         (Arm_input_section::set_final_data_size): Do not set address and
9890         offset of stub table.
9891         (Arm_output_section::fix_exidx_coverage): Change use of of
9892         Output_section::Simple_input_section to that of
9893         Output_section::Input_section.
9894         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
9895         except for the first pass.
9896         * output.cc (Output_section::get_input_sections): Change type of
9897         input_sections to std::list<Input_section>.
9898         (Output_section::add_script_input_section): Rename from
9899         Output_section::add_simple_input_section.  Change type of SIS
9900         parameter from Simple_input_section to Input_section.
9901         * output.h (Output_section::Simple_input_section): Remove class.
9902         (Output_section::Input_section): Change class visibility to public.
9903         (Output_section::Input_section::addralign): Use stored alignments
9904         for special input sections if set.
9905         (Output_section::Input_section::set_addralign): New method.
9906         (Output_section::get_input_sections): Change parameter type from
9907         list of Simple_input_section to list of Input_section.
9908         (Output_section::add_script_input_section): Rename from
9909         Output_section::add_simple_input_section. Change first parameter's
9910         type from Simple_input_section to Input_section and remove the
9911         second and third parameters.
9912         * script-sections.cc (Input_section::Input_section_list): Change
9913         type to list of Output_section::Input_section/
9914         (Input_section_info::Input_section_info): Change parameter type of
9915         INPUT_SECTION to Output_section::Input_section.
9916         (Input_section_info::input_section): Change return type.
9917         (Input_section_info::input_section_): Change type to
9918         Output_section::Input_section.
9919         (Output_section_element_input::set_section_addresses): Adjust code
9920         to use Output_section::Input_section instead of
9921         Output_section::Simple_input_section.  Adjust code for renaming
9922         of Output_section::add_simple_input_section.
9923         (Orphan_output_section::set_section_addresses): Ditto.
9924
9925 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9926
9927         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
9928         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
9929
9930 2010-05-18  Rafael Espindola  <espindola@google.com>
9931
9932         * options.cc (General_options::finalize): Handle -nostdlib.
9933         * options.h (nostdlib): New option.
9934         * script.cc (script_add_search_dir): Handle -nostdlib.
9935
9936 2010-05-12  Doug Kwan  <dougkwan@google.com>
9937
9938         * arm.cc (Target_arm::do_finalize_sections): Create an empty
9939         attributes section only if there no attributes section after merging.
9940         (Target_arm::merge_object_attributes): Move value of
9941         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
9942         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
9943         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
9944         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
9945         and arm_attr_merge_7.stdout.
9946         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
9947         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
9948         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
9949         arm_attr_merge_7b.o): New rules.
9950         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
9951         arm_attr_merge_7
9952         * testsuite/Makefile.in: Regenerate.
9953         * testsuite/arm_attr_merge.sh: New file.
9954         * testsuite/arm_attr_merge_[67][ab].s: Same.
9955
9956 2010-05-05  Nick Clifton  <nickc@redhat.com>
9957
9958         * po/es.po: Updated Spanish translation.
9959
9960 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9961
9962         * Makefile.am (install-exec-local): Properly install gold as
9963         default cross linker.
9964         * Makefile.in: Regenerated.
9965
9966 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9967             Nick Clifton  <nickc@redhat.com>
9968
9969         * configure.ac (install_as_default): Define and set to false
9970         unless --enable-gold or --enable-gold=both/gold has been
9971         specified.
9972         * configure: Regenerate.
9973
9974         * Makefile.am (install-exec-local): Install the executable as
9975         'ld.gold'.  If install_as_default is true then also install it as
9976         'ld'.
9977         * Makefile.in: Regenerated.
9978
9979 2010-04-24  Ian Lance Taylor  <iant@google.com>
9980
9981         * layout.cc (Layout::layout_reloc): In relocatable link don't
9982         combine reloc sections for grouped sections.
9983
9984 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
9985
9986         * gc.h (gc_process_relocs): Pass information on relocs pointing to
9987         sections that are not ordinary to icf.
9988         * icf.cc (get_section_contents): Handle relocation pointing to section
9989         with no object or shndx information.
9990         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
9991         * testsuite/Makefile.in: Regenerate.
9992         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
9993         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
9994
9995 2010-04-22  Ian Lance Taylor  <iant@google.com>
9996
9997         * expression.cc (Expression::Expression_eval_info): Add
9998         result_alignment_pointer field.
9999         (Expression::eval_with_dot): Add result_alignment_pointer
10000         parameter.  Change all callers.
10001         (Expression::eval_maybe_dot): Likewise.
10002         (class Binary_expression): Add alignment_pointer parameter to
10003         left_value and right_value.  Change all callers.
10004         (BINARY_EXPRESSION): Set result alignment.
10005         (class Trinary_expression): Add alignment_pointer parameter to
10006         arg2_value and arg3_value.  Change all callers.
10007         (Trinary_cond::value): Set result alignment.
10008         (Max_expression::value, Min_expression::value): Likewise.
10009         (Align_expression::value): Likewise.
10010         * script-sections.cc (class Sections_element): Add dot_alignment
10011         parameter to set_section_addresses virtual function.  Update
10012         instantiations.
10013         (class Output_section_element): Likewise.
10014         (Script_sections::create_segments): Add dot_alignment parameter.
10015         Change all callers.
10016         (Script_sections::create_segments_from_phdrs_clause): Likewise.
10017         (Script_sections::set_phdrs_clause_addresses): Likewise.
10018         * script-sections.h: Update declarations.
10019         * script.h: Update declarations.
10020         * output.h (Output_segment::set_minimum_p_align): Don't decrease
10021         min_p_align.
10022         * testsuite/script_test_3.t: Set large alignment.
10023         * testsuite/script_test_3.sh: Make sure that at least one LOAD
10024         segment has expected alignment.
10025
10026 2010-04-22  Nick Clifton  <nickc@redhat.com>
10027
10028         * po/gold.pot: Updated by the Translation project.
10029         * po/vi.po: Updated Vietnamese translation.
10030
10031 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
10032
10033         * testsuite/Makefile.am (check_PROGRAMS): Add
10034         icf_virtual_function_folding_test.
10035         * testsuite/Makefile.in: Regenerated.
10036
10037 2010-04-15  Andrew Haley  <aph@redhat.com>
10038
10039         * options.h (merge_exidx_entries): New option.
10040         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
10041         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
10042         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
10043         (Target_arm::merge_exidx_entries): New function.
10044         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
10045         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
10046         to Arm_exidx_fixup constructor.
10047         Add new arg, merge_exidx_entries.
10048         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
10049         Arm_output_section::fix_exidx_coverage.
10050
10051 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
10052
10053         * icf.cc (get_section_contents): Check for preemptible functions.
10054         Ignore addend when appropriate.
10055         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
10056         section folded.
10057         (add_from_relobj): Check for section folded.
10058         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
10059         * symtab.h (should_add_dynsym_entry): Add new parameter.
10060         * target-reloc.h (scan_relocs): Check for section folded.
10061         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
10062         Check reloc types for function pointers in shared objects.
10063         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
10064         case.
10065         (icf_preemptible_functions_test): New test case.
10066         (icf_string_merge_test): New test case.
10067         * testsuite.Makefile.in: Regenerate.
10068         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
10069         bar_glob.  Refactor code.
10070         * testsuite/icf_preemptible_functions_test.cc: New file.
10071         * testsuite/icf_preemptible_functions_test.sh: New file.
10072         * testsuite/icf_string_merge_test.cc: New file.
10073         * testsuite/icf_string_merge_test.sh: New file.
10074         * testsuite/icf_virtual_function_folding_test.cc: New file.
10075         * testsuite/icf_virtual_function_folding_test.sh: New file.
10076
10077 2010-04-14  Doug Kwan  <dougkwan@google.com>
10078
10079         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
10080         for local symbol recounting if we remove a section due to ICF.
10081         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
10082         there are no regular objects in input.
10083
10084 2010-04-13  Doug Kwan  <dougkwan@google.com>
10085
10086         * arm.cc (Arm_input_section::set_final_data_size): Compute
10087         accurate final data size instead of using current data size.
10088
10089 2010-04-09  Doug Kwan  <dougkwan@google.com>
10090
10091         * layout.cc (Layout::choose_output_section): Handle script section
10092         types.
10093         (Layout::make_output_section_for_script): Add section type parameter.
10094         Handle script section types.
10095         * layout.h (Layout::make_output_section_for_script): Add section
10096         type parameter.
10097         * output.cc (Output_section::Output_section): Initialize data member
10098         is_noload_.
10099         (Output_section::do_reset_address_and_file_offset): Do not set address
10100         to 0 if section is a NOLOAD section.
10101         * output.h (Output_section::is_noload): New method.
10102         (Output_section::set_is_noload): Ditto.
10103         (Output_section::is_noload_): New data member.
10104         * script-c.h (Script_section_type): New enum type.
10105         (struct Parser_output_section_header): Add new file section_type.
10106         * script-sections.cc (Sections_element::output_section_name): Add
10107         parameter for returning script section type.
10108         (Output_section_definition::output_section_name): Ditto.
10109         (Output_section_definition::section_type)P; New method.
10110         (Output_section_definiton::script_section_type_name): Ditto.
10111         (Output_section_definition::script_section_type_): New data member.
10112         (Output_section_definition::Output_section_definition): Initialize
10113         data member Output_section_definition::script_section_type_.
10114         (Output_section_definition::create_sections): Pass script section type
10115         to Layout::make_output_section_for_script.
10116         (Output_section_definition::output_section_name): Return script
10117         section type to caller.
10118         (Output_section_definition::set_section_address): Do not advance
10119         dot value and load address if section type is NOLOAD.  Set address
10120         of NOLOAD sections regardless of section flags.
10121         (Output_section_definition::print): Print section type if it is
10122         not SCRIPT_SECTION_TYPE_NONE.
10123         (Output_section_definition::section_type): New method.
10124         (Output_section_definition::script_section_type_name): Ditto.
10125         (Script_sections::output_section_name): Add new parameter
10126         PSECTION_TYPE for returning script section type.  Pass it to
10127         section elements.  Handle discard sections.
10128         (Sort_output_sections::operator()): Handle NOLOAD sections.
10129         * script-sections.h (Script_sections::Section_type): New enum type.
10130         (Script_sections::output_section_name): Add a new parameter for
10131         returning script section type.
10132         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
10133         INFO and NOLOAD.
10134         * yyscript.y (union): Add new field SECTION_TYPE.
10135         (COPY, DSECT, INFO, NOLOAD): New tokens.
10136         (opt_address_and_section_type): Change type to output_section_header.
10137         (section_type): New non-terminal
10138         (section_header): Handle section type.
10139         (opt_address_and_section_type): Return section type value.
10140
10141 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
10142
10143         * testsuite/plugin_common_test_1.c (foo): Add prototype.
10144         * testsuite/plugin_common_test_2.c (foo): Likewise.
10145
10146 2010-04-08  Doug Kwan  <dougkwan@google.com>
10147
10148         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
10149         Output_merge_data.
10150         * output.cc (Output_section::add_merge_input_section): Simplify
10151         code and return status of Output_merge_base::add_input_section.
10152         Update merge section map only if Output_merge_base::add_input_section
10153         returns true.
10154
10155 2010-04-07  Doug Kwan  <dougkwan@google.com>
10156
10157         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
10158         if section is marked as containing instructions but has no mapping
10159         symbols.
10160         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
10161         correct section index.
10162         (Arm_relobj::find_linked_text_section): Ditto.
10163
10164 2010-04-07  Cary Coutant  <ccoutant@google.com>
10165
10166         * archive.cc (include_member): Destroy Read_symbols_data object before
10167         releasing file.
10168         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
10169         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
10170         (Read_symbols_data::~Read_symbols_data) New destructor.
10171         (Section_relocs::Section_relocs) New constructor.
10172         (Section_relocs::~Section_relocs) New destructor.
10173         (Read_relocs_data::Read_relocs_data) New constructor.
10174         (Read_relocs_data::~Read_relocs_data) New destructor.
10175         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
10176         pointers to NULL after deleting.
10177
10178 2010-04-07  Doug Kwan  <dougkwan@google.com>
10179
10180         * arm.cc: Replace "endianity" with "endianness" in comments.
10181         (Arm_exidx_cantunwind): Ditto.
10182         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
10183         (Arm_relobj::merge_flags_and_attributes): New method.
10184         (Arm_relobj::merge_flags_and_attributes_): New data member.
10185         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
10186         (Arm_relobj::scan_sections_for_stubs): Ditto.
10187         (Arm_relobj::do_read_symbols): Check to see if we really want to
10188         merge processor-specific flags and attributes.  Exit early if
10189         an object is empty except for section names and the undefined symbol.
10190         (Target_arm::do_finalize_sections): Move check for ELF format to
10191         Arm_relobj::do_read_symbols.  Merge processor specific flags and
10192         attributes from a regular object only when we have determined that
10193         it is aapropriate.  Do not create an .ARM.attributes section in
10194         output if there is no regular input object.
10195         (Target_arm::merge_processor_specific_flags): Check
10196         --warn-mismatch before printing any error.
10197         (Target_arm::merge_object_attributes): Ditto.
10198         * gold.cc (queue_middle_tasks): Handle the case in which there is
10199         no regular object in input.
10200         * options.cc (General_options::parse_EB): New method.
10201         (General_options::parse_EL): Same.
10202         (General_options::General_options): Initialize endianness_.
10203         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
10204         New options.
10205         (General_options::Endianness): New enum.
10206         (General_options::endianness): New method.
10207         (General_options::endianness_): New data member.
10208         * parameters.cc (Parameters::set_options): Check target endianness.
10209         (Parameters::set_target_once): Ditto.
10210         (Parameters::check_target_endianness): New method.
10211         (parameters_force_valid_target): If either -EL or -EB is specified,
10212         use it to define endianness of default target.
10213         * parameters.h (Parameters::check_target_endianness): New method
10214         declaration.
10215         * target.h (class Target): Change "endianity" to "endianness"
10216         in comments.
10217
10218 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10219
10220         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
10221         * configure: Regenerate.
10222         * Makefile.in: Regenerate.
10223         * testsuite/Makefile.in: Regenerate.
10224
10225 2010-04-06  Cary Coutant  <ccoutant@google.com>
10226
10227         gcc PR lto/42757
10228         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
10229         prevailing definitions of common symbols.
10230         * testsuite/plugin_test_6.sh: New test case.
10231         * testsuite/plugin_common_test_1.c: New test case.
10232         * testsuite/plugin_common_test_2.c: New test case.
10233         * testsuite/Makefile.am (plugin_test_6): New test case.
10234         * testsuite/Makefile.in: Regenerate.
10235
10236 2010-04-06  Nick Clifton  <nickc@redhat.com>
10237
10238         * po/vi.po: New Vietnamese translation.
10239
10240 2010-03-30  Doug Kwan  <dougkwan@google.com>
10241
10242         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
10243
10244 2010-03-25  Doug Kwan  <dougkwan@google.com>
10245
10246         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
10247         to avoid a conversion warning on a 32-bit host.
10248
10249 2010-03-24  Ian Lance Taylor  <iant@google.com>
10250
10251         * testsuite/script_test_3.t: Add a TLS segment.
10252         * testsuite/Makefile.am (check_PROGRAMS): Add
10253         tls_phdrs_script_test.
10254         (tls_phdrs_script_test_SOURCES): Define.
10255         (tls_phdrs_script_test_DEPENDENCIES): Define.
10256         (tls_phdrs_script_test_LDFLAGS): Define.
10257         (tls_phdrs_script_test_LDADD): Define.
10258         * testsuite/Makefile.in: Rebuild.
10259
10260 2010-03-23  Cary Coutant  <ccoutant@google.com>
10261
10262         * fileread.cc (find_or_make_view): Fix comment.
10263
10264 2010-03-23  Ian Lance Taylor  <iant@google.com>
10265
10266         * script-sections.cc (class Orphan_section_placement): Define
10267         PLACE_TLS and PLACE_TLS_BSS.
10268         (Orphan_section_placement::Orphan_section_placement): Initialize
10269         new places.
10270         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
10271         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
10272         (tls_script_test_SOURCES): Define.
10273         (tls_script_test_DEPENDENCIES): Define.
10274         (tls_script_test_LDFLAGS): Define.
10275         (tls_script_test_LDADD): Define.
10276         * testsuite/Makefile.in: Rebuild.
10277
10278 2010-03-22  Doug Kwan  <dougkwan@google.com>
10279
10280         * arm.cc (Arm_relocate_functions::abs8,
10281         Arm_relocate_functions::abs16): Use correct check for overflow
10282         specified in the ARM ELF specs.
10283         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
10284         target of a BLX instruction specially.
10285         (Reloc_stub::stub_type_for_reloc): Ditto.
10286         (Relocate::relocate): Use symbolic names instead of numeric relocation
10287         codes to report error.
10288         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
10289         workaround.
10290         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
10291         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
10292         thumb2_blx_out_of_range.stdout
10293         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
10294         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
10295         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
10296         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
10297         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
10298         thumb2_blx_in_range, thumb2_blx_in_range.o,
10299         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
10300         thumb2_blx_out_of_range.o): New rules.
10301         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
10302         thumb2_blx_in_range and thumb2_blx_out_of_range.
10303         * testsuite/Makefile.in: Regenerate.
10304         * arm_branch_in_range.sh: Add tests for THUMB BLX.
10305         * testsuite/thumb_blx_in_range.s: New file.
10306         * testsuite/thumb_blx_out_of_range.s: New file.
10307
10308 2010-03-22  Rafael Espindola  <espindola@google.com>
10309
10310         * archive.cc (Should_include): Move to archive.h.
10311         (should_include_member): Make it a member of Archive.
10312         (Lib_group): New.
10313         (Add_lib_group_symbols): New.
10314         * archive.h: Include options.h.
10315         (Archive_member): Moved from Archive.
10316         (Should_include): Moved from archive.cc.
10317         (Lib_group): New.
10318         (Add_lib_group_symbols): New.
10319         * dynobj.cc (do_should_include_member): New.
10320         * dynobj.h (do_should_include_member): New.
10321         * gold.cc (queue_initial_tasks): Update call to queue.
10322         * main.cc (main): Print lib group stats.
10323         * object.cc (do_should_include_member): New.
10324         * object.h: Include archive.h.
10325         (Object::should_include_member): New.
10326         (Object::do_should_include_member): New.
10327         (Sized_relobj::do_should_include_member): New.
10328         * options.cc (General_options::parse_start_lib): New.
10329         (General_options::parse_end_lib): New.
10330         (Input_arguments::add_file): Handle lib groups.
10331         (Input_arguments::start_group): Check we are not in a lib.
10332         (Input_arguments::start_lib): New.
10333         (Input_arguments::end_lib): New.
10334         * options.h (General_options): Add start_lib and end_lib.
10335         (Input_argument::lib_): New.
10336         (Input_argument::lib): New.
10337         (Input_argument::is_lib): New.
10338         (Input_file_lib): New.
10339         (Input_arguments::in_lib_): New.
10340         (Input_arguments::in_lib): New.
10341         (Input_arguments::start_lib): New.
10342         (Input_arguments::end_lib_): New.
10343         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
10344         in unused members as preempted.
10345         (Sized_pluginobj::do_should_include_member): New.
10346         * plugin.h (Sized_pluginobj::do_should_include_member): New.
10347         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
10348         return the blocker.
10349         (Read_symbols::do_whole_lib_group): New.
10350         (Read_symbols::do_lib_group): New.
10351         (Read_symbols::do_read_symbols): Handle lib groups.
10352         (Read_symbols::get_name): Handle lib groups.
10353         * readsyms.h (Read_symbols): Add an archive member pointer.
10354         (Read_symbols::do_whole_lib_group): New.
10355         (Read_symbols::do_lib_group): New.
10356         (Read_symbols::member_): New.
10357         * script.cc (read_input_script): Update call to queue_soon.
10358
10359 2010-03-19  Doug Kwan  <dougkwan@google.com>
10360
10361         * arm.cc (Stub_table::Stub_table): Initialize new data members
10362         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10363         (Stub_table::add_reloc_stub): Assign stub offset and update
10364         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10365         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
10366         New data members.
10367         (Stub_table::update_data_size_and_addralign): Use
10368         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
10369         instead of going over all reloc stubs.
10370         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
10371         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10372         Stringpool_template::offset_ to size of Stringpool_char.
10373         (Stringpool_template::new_key_offset): Remove code to initialize
10374         Stringpool_template::offset_.
10375         * stringpool.h (Stringpool_template::set_no_zero_null): Set
10376         Stringpool_template::offset_ to zero.
10377
10378 2010-03-15  Doug Kwan  <dougkwan@google.com>
10379
10380         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10381         offset_.
10382         (Stringpool_template::new_key_offset): New method.
10383         (Stringpool_template::add_string): Assign offsets when adding new
10384         strings.
10385         (Stringpool_template::set_string_offsets): Do not set string offsets
10386         when not optimizing.
10387         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
10388         member size_.
10389         (Chunked_vector::clear): Clear size_.
10390         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
10391         (Chunked_vector::size): Return size_.
10392         (Chunked_vector::push_back): Use size_ to find insert position.
10393         (Chunked_vector::size_): New data member.
10394         (Stringpool_template::set_no_zero_null): Assert string set is empty.
10395         (Stringpool_template::new_key_offset): New method declaration.
10396         (Stringpool_template::offset_): New data member.
10397
10398 2010-03-15   Rafael Espindola  <espindola@google.com>
10399
10400         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
10401         Add_symbols' constructor.
10402         * readsyms.h (Add_symbols): Remove the input_group member.
10403
10404 2010-03-10  Ian Lance Taylor  <iant@google.com>
10405
10406         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
10407         target to ask whether a reference to a symbol requires a stack
10408         split.
10409         * target.h (Target::is_call_to_non_split): New function.
10410         (Target::do_is_call_to_non_split): Declare virtual function.
10411         * target.cc: Include "symtab.h".
10412         (Target::do_is_call_to_non_split): New function.
10413         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
10414
10415 2010-03-10  Cary Coutant  <ccoutant@google.com>
10416
10417         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
10418         (File_read::open[1]): Remove initial mapping of whole_file_view_.
10419         (File_read::open[2]): Add whole_file_view_ to list of views.
10420         (File_read::make_view): Remove test of whole_file_view_.
10421         (File_read::find_or_make_view): Create whole_file_view_ if
10422         necessary.
10423         (File_read::clear_views): Replace bool parameter with enum;
10424         adjust all callers.  Don't delete views with permanent data;
10425         do delete cached views and views from archives if
10426         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
10427         if clearing the corresponding view.
10428         * fileread.h (File_read::Clear_views_mode): New enum.
10429         (File_read::View::is_permanent_view): New method.
10430         (File_read::clear_views): Replace bool parameter
10431         with enum; adjust all callers.
10432         * options.h (General_options): Change keep_files_mapped option;
10433         add map_whole_files.
10434         * readsyms.cc (Add_symbols::run): Delete sd_ object before
10435         releasing the file.
10436         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
10437         the file.
10438
10439 2010-03-10  David S. Miller  <davem@davemloft.net>
10440
10441         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
10442
10443 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
10444
10445         * icf.cc (get_section_contents): Add '@' marker after processing the
10446         merge reloc.
10447
10448 2010-03-08  Doug Kwan  <dougkwan@google.com>
10449
10450         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
10451         due to a conversion warning.
10452         (Arm_relobj::update_output_local_symbol_count): Check for local
10453         symbol with unset output index.
10454
10455 2010-03-05  Ian Lance Taylor  <iant@google.com>
10456
10457         * options.h (class General_options): Add --spare-dynamic-tags.
10458         * output.cc (Output_data_dynamic::set_final_data_size): Implement
10459         --spare-dynamic-tags.
10460
10461 2010-03-05  Ian Lance Taylor  <iant@google.com>
10462
10463         * incremental.cc: Include "libiberty.h".
10464
10465 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
10466
10467         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
10468         function, is_info_ member.
10469         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
10470         (Versions::Versions): Update caller.
10471         (Versions::define_base_version): Likewise.
10472         (Versions::add_def): Likewise.
10473
10474 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
10475
10476         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
10477         (Scan::possible_function_pointer_reloc): New function.
10478         (Scan::local_reloc_may_be_function_pointer): Change to call
10479         possible_function_pointer_reloc.
10480         (Scan::global_reloc_may_be_function_pointer): Ditto.
10481         * icf.h (Icf::check_section_for_function_pointers): Change to reject
10482         relocations in ".data.rel.ro._ZTV" section.
10483         * testsuite/icf_safe_so_test.sh: Change to pass i386.
10484         * testsuite/icf_safe_so_test.cc: Ditto.
10485         * testsuite/icf_safe_test.cc: Ditto.
10486         * testsuite/icf_safe_test.sh: Ditto.
10487
10488 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10489             Ian Lance Taylor  <iant@google.com>
10490
10491         * target-reloc.h (relocate_section): Check the symbol table index
10492         for -1U before setting the local symbol index.
10493         (scan_relocatable_relocs): If copying the relocation, record that
10494         the local symbol is required.
10495         * object.h (Symbol_value::is_output_symtab_index_set): New
10496         function.
10497         (Symbol_value::may_be_discarded_from_output_symtab): New
10498         function.
10499         (Symbol_value::has_output_symtab_entry): New function.
10500         (Symbol_value::needs_output_symtab_entry): Remove.
10501         (Symbol_value::output_symtab_index): Make sure the symbol index is
10502         set.
10503         (Symbol_value::set_output_symtab_index): Make sure the symbol
10504         index is not set.  Make sure the new index is valid.
10505         (Symbol_value::set_must_have_output_symtab_entry): New function.
10506         (Symbol_value::has_output_dynsym_entry): New function.
10507         (Symbol_value::set_output_dynsym_index): Make sure the new index
10508         is valid.
10509         (Sized_relobj::set_must_have_output_symtab_entry): New function.
10510         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
10511         local symbol if permitted.
10512         (Sized_relobj::do_finalize_local_symbols): Call
10513         is_output_symtab_index_set rather than needs_output_symtab_entry.
10514         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
10515         rather than needs_output_symtab_entry.  Call
10516         has_output_dynsym_entry rather than needs_output_dynsym_entry.
10517         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
10518         is_output_symtab_index_set rather than needs_output_symtab_entry.
10519         * testsuite/discard_locals_relocatable_test.c: New file.
10520         * testsuite/discard_locals_test.sh: Test -r.
10521         * testsuite/Makefile.am (check_DATA): Add
10522         discard_locals_relocatable_test1.syms,
10523         discard_local_relocatable_test2.syms.
10524         (MOSTLYCLEANFILES): Likewise.  Also add
10525         discard_locals_relocatable_test1.lout and
10526         discard_locals_relocatable_test2.out.
10527         (discard_locals_relocatable_test1.syms): New target.
10528         (discard_locals_relocatable_test.o): New target.
10529         (discard_locals_relocatable_test1.out): New target.
10530         (discard_locals_relocatable_test2.syms): New target.
10531         (discard_locals_relocatable_test2.out): New target.
10532         (various): Add missing ../ld-new dependencies.
10533         * testsuite/Makefile.in: Rebuild.
10534
10535 2010-03-03  Nick Clifton  <nickc@redhat.com>
10536
10537         * po/fi.po: New Finnish translation.
10538
10539 2010-03-01  Doug Kwan  <dougkwan@google.com>
10540
10541         * layout.cc (Layout::Layout): Force section types of .init_array*,
10542         .preinit_array* and .fini_array* sections.
10543         * output.cc (Output_section::Input_section_sort_entry::has_priority):
10544         Fix check of return value of std::string::find.().
10545         (Output_section::Input_section_sort_compare::operator()): Remove
10546         comment about .init_array.
10547         (Output_section::Input_section_sort_init_fini_compare::operator()):
10548         New method.
10549         (Output_section::sort_attached_input_sections): Handle .init_array
10550         and .fini_array specially.
10551         * output.h (Output_section::Inut_section_sort_compare): Update
10552         comment.
10553         (Output_section::Input_section_sort_init_fini_compare): New struct.
10554
10555 2010-02-26  Doug Kwan  <dougkwan@google.com>
10556
10557         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
10558         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
10559         * testsuite/debug_msg.sh: Avoid matching source line number for
10560         use of global variable undef_int.
10561
10562 2010-02-26  Doug Kwan  <dougkwan@google.com>
10563
10564         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
10565         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
10566         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
10567         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
10568         * options.cc (General_options::General_options): Initialize member
10569         fix_v4bx_.
10570         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
10571         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
10572         and rm_no_fix_v4bx.stdout
10573         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
10574         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
10575         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
10576         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
10577         and arm_no_fix_v4bx.
10578         * Makefile.in: Regenerate.
10579         * testsuite/arm_fix_v4bx.s: New file.
10580         * testsuite/arm_fix_v4bx.sh: Ditto.
10581
10582 2010-02-24  Doug Kwan  <dougkwan@google.com>
10583
10584         * arm.cc (Target_arm::got_section): Make the .got section the first
10585         non RELRO section in the data segment.
10586         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
10587         suffixes of section names.
10588
10589 2010-02-24  Doug Kwan  <dougkwan@google.com>
10590
10591         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
10592         flags and attributes merging if an input file is a binary file.
10593         * fileread.cc (Input_file::open): Record format of original file.
10594         * fileread.h (Input_file::Format): New enum type.
10595         (Input_file::Input_file): Initialize data member format_.
10596         (Input_file::format): New method definition.
10597         (Input_file::format_):: New data member.
10598
10599 2010-02-24  Doug Kwan  <dougkwan@google.com>
10600
10601         * arm.cc (Arm_output_data_got): New class.
10602         (ARM_TCB_SIZE): New constant
10603         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
10604         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10605         If user uses a script with a SECTIONS clause, issue only a warning
10606         for a misplaced EXIDX input section.  Otherwise, issue an error.
10607         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
10608         garbage collection.
10609         (Target_arm::got_mode_index_entry): Handle static linking.
10610         (Target_arm::Scan::local): Ditto.
10611         (Target_arm::Scan::global): Ditto.
10612         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
10613         all incorrectly implemented relocations.
10614         (Target_arm::fix_exidx_coverage): Pass layout to
10615         Arm_output_section::fix_exidx_coverage.
10616         * layout.cc (Layout::section_name_mapping): Remove trailing dots
10617         from ".ARM.exidx." and ".ARM.extab.".
10618
10619 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10620
10621         * arm.cc (Target_arm::do_finalize_sections): Create attribute
10622         section if it does not already exist.
10623         * attributes.cc (Attributes_section_data::Attributes_section_data):
10624         Don't crash if size is zero.
10625
10626 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10627             Ian Lance Taylor  <iant@google.com>
10628
10629         * gold.cc (queue_middle_tasks): If no input files were opened,
10630         exit.
10631         * workqueue.h (Task_function::Task_function): Assert that there is
10632         a blocker.
10633
10634 2010-02-22  Doug Kwan  <dougkwan@google.com>
10635
10636         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
10637         * icf.cc (get_section_contents): Cast snprintf arguments to long long
10638         types to avoid warnings due to different uint64_t implementations
10639         on different hosts.
10640
10641 2010-02-21  Doug Kwan  <dougkwan@google.com>
10642
10643         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
10644         handling of the maximum backward branch offset.
10645         (Arm_relocate_functions::thumb_branch_common): Ditto.
10646         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
10647         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
10648         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
10649         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
10650         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
10651         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
10652         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
10653         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
10654         thumb_bl_out_of_range thumb_bl_out_of_range.o,
10655         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
10656         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
10657         thumb2_bl_out_of_range.o): New rules.
10658         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
10659         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
10660         thumb2_bl_out_of_range
10661         * testsuite/Makefile.in: Regenerate.
10662         * testsuite/arm_bl_in_range.s: New file.
10663         * testsuite/arm_bl_out_of_range.s: Ditto.
10664         * testsuite/arm_branch_in_range.sh: Ditto.
10665         * testsuite/arm_branch_range.t: Ditto.
10666         * testsuite/thumb2_branch_range.t: Ditto.
10667         * testsuite/thumb_bl_in_range.s: Ditto.
10668         * testsuite/thumb_bl_out_of_range.s: Ditto.
10669         * testsuite/thumb_branch_range.t: Ditto.
10670
10671 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
10672
10673         * gc.h (gc_process_relocs): Change vectors to point to the new list.
10674         Add reloc offset information.
10675         * icf.cc (get_section_contents): Change iterators to point to the new
10676         vectors. Add reloc offset information to the contents.
10677         * icf.h (Icf::Sections_reachable_info): New typedef.
10678         (Icf::Sections_reachable_list): New typedef.
10679         (Icf::Offset_info): New typedef.
10680         (Icf::Reloc_info): New struct typedef.
10681         (Icf::Reloc_info_list): New typedef.
10682         (Icf::symbol_reloc_list): Delete method.
10683         (Icf::addend_reloc_list): Delete method.
10684         (Icf::section_reloc_list): Delete method.
10685         (Icf::reloc_info_list): New method.
10686         (Icf::reloc_info_list_): New member.
10687
10688 2010-02-19  Doug Kwan  <dougkwan@google.com>
10689
10690         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
10691         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
10692         * arm.cc (Arm_relocation_functions): New forward declaration.
10693         (Target_arm::Target_arm): Initialize new data members
10694         got_mod_index_offset_ and tls_base_symbol_defined_.
10695         (Target_arm::Relocate::relocate_tls): New method.
10696         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
10697          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
10698         New methods.
10699         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
10700         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
10701         (Target_arm::got_mod_index_offset_,
10702         Target_arm::tls_base_symbol_defined_): New data members.
10703         (Target_arm::Scan::local, Target::Scan::global,
10704         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
10705         relocations.
10706
10707 2010-02-18  Doug Kwan  <dougkwan@google.com>
10708
10709         * arm.cc (Arm_relobj::find_linked_text_section): New method.
10710         (Arm_relobj::make_exidx_input_section): Pass section index of linked
10711         text section as a parameter becuase some broken tools may not set
10712         the link in section header.
10713         (Target_arm::has_got_section): New method.
10714         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
10715         without any mapping symbol as data only.  Remove warning.
10716         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
10717         link in its section header, try to discover the link by inspecting the
10718         REL31 relocation at the beginning of the section.
10719         (Target_arm::Scan::check_non_pic): Report name of offending relocation
10720         in error message.
10721         (Target_arm::Scan::global): Treat any reference to the symbol
10722         _GLOBAL_OFFSET_TABLE_ as a GOT access.
10723
10724 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
10725
10726         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
10727         (Scan::global_reloc_may_be_function_pointer): New function.
10728         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10729         (Scan::global_reloc_may_be_function_pointer): New function.
10730         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10731         (Scan::global_reloc_may_be_function_pointer): New function.
10732         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
10733         (Scan::global_reloc_may_be_function_pointer): New function.
10734         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
10735         (Scan::global_reloc_may_be_function_pointer): New function.
10736         (Scan::possible_function_pointer_reloc): New function.
10737         (Target_x86_64::can_check_for_function_pointers): New function.
10738         * gc.h (gc_process_relocs): Scan relocation types to determine if
10739         function pointers were taken for targets that support it.
10740         * icf.cc (Icf::find_identical_sections): Include functions for
10741         folding in safe ICF whose pointer is not taken.
10742         * icf.h (Secn_fptr_taken_set): New typedef.
10743         (fptr_section_id_): New member.
10744         (section_has_function_pointers): New function.
10745         (set_section_has_function_pointers): New function.
10746         (check_section_for_function_pointers): New function.
10747         * options.h: Fix comment for safe ICF option.
10748         * target.h (can_check_for_function_pointers): New function.
10749         * testsuite/Makefile.am: Add icf_safe_so_test test case.
10750         Modify icf_safe_test for X86-64.
10751         * testsuite/Makefile.in: Regenerate.
10752         * testsuite/icf_safe_so_test.cc: New file.
10753         * testsuite/icf_safe_so_test.sh: New file.
10754         * testsuite/icf_safe_test.cc (kept_func_3): New function.
10755         (main): Change to take pointer to function kept_func_3.
10756         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
10757         folding is done correctly for X86-64.
10758
10759 2010-02-12  David S. Miller  <davem@davemloft.net>
10760
10761         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
10762         is_symbolless parameter.
10763         (Output_reloc<SHT_REL>::is_symbolless): New.
10764         (Output_reloc<SHT_REL>::is_symbolless_): New.
10765         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
10766         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
10767         (Output_reloc<SHT_RELA>::is_symbolless): New.
10768         (Output_data_reloc::add_global): Handle is_symbolless.
10769         (Output_data_reloc::add_global_relative): Likewise.
10770         (Output_data_reloc::add_local): Likewise.
10771         (Output_data_reloc::add_local_relative): Likewise.
10772         (Output_data_reloc::add_symbolless_global_addend): New.
10773         (Output_data_reloc::add_symbolless_local_addend): New.
10774         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
10775         is_symbolless.
10776         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
10777         instead of ->is_relative_
10778         (Output_reloc::write): Likewise.
10779         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
10780         (Output_reloc::write_rel): Simplify.
10781
10782         * sparc.cc (Target_sparc::Scan::local): Use
10783         ->add_symbolless_local_addend as needed.
10784         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
10785         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
10786         based upon relocation offset.
10787
10788 2010-02-11  Doug Kwan  <dougkwan@google.com>
10789
10790         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
10791         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
10792         beginning of function.
10793         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
10794         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
10795         parameter is_32bit in calls to should_apply_static_reloc.
10796         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
10797         (check_DATA): Add arm_abs_global.stdout.
10798         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
10799         arm_abs_global.stdout): New rules.
10800         (MOSTLLYCLEANFILES): Add arm_abs_global
10801         * Makefile.in: Regenerate.
10802         * testsuite/arm_abs_global.s: New file.
10803         * testsuite/arm_abs_global.sh: Ditto.
10804         * testsuite/arm_abs_lib.s: Ditto.
10805
10806 2010-02-11  Ian Lance Taylor  <iant@google.com>
10807
10808         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
10809         Read_relocs task.
10810         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
10811         Allocate_commons_task first.
10812         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
10813         task, rather than symtab_lock_.
10814         (Gc_process_relocs::~Gc_process_relocs): New function.
10815         (Gc_process_relocs::is_runnable): Check this_blocker_.
10816         (Gc_process_relocs::locks): Use next_blocker_ rather than
10817         blocker_.
10818         (Scan_relocs::~Scan_relocs): New function.
10819         (Scan_relocs::is_runnable): Check this_blocker_ rather than
10820         symtab_lock_.
10821         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
10822         next_blocker_.
10823         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
10824         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
10825         constructor accordingly.
10826         (class Gc_process_relocs): Likewise.
10827         (class Scan_relocs): Likewise.
10828         * common.h (class Allocate_commons_task): Remove symtab_lock_
10829         field, and corresponding constructor parameter.
10830         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
10831         symtab_lock_.
10832         (Allocate_commons_task::locks): Likewise.
10833
10834 2010-02-11  Ian Lance Taylor  <iant@google.com>
10835
10836         * gold-threads.h (class Once): Define.
10837         (class Initialize_lock): Rewrite as child of Once.
10838         * gold-threads.cc (class Once_initialize): Define.
10839         (once_pointer_control): New static variable.
10840         (once_pointer, once_arg): New static variables.
10841         (c_run_once): New static function.
10842         (Once::Once, Once::run_once, Once::internal_run): New functions.
10843         (class Initialize_lock_once): Remove.
10844         (initialize_lock_control): Remove.
10845         (initialize_lock_pointer): Remove.
10846         (initialize_lock_once): Remove.
10847         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
10848         (Initialize_lock::initialize): Rewrite.
10849         (Initialize_lock::do_run_once): New function.
10850         * archive.cc (Archive::interpret_header): Only clear name if it is
10851         not already empty.
10852         * fileread.cc: Include "gold-threads.h"
10853         (file_counts_lock): New static variable.
10854         (file_counts_initialize_lock): Likewise.
10855         (File_read::release): Only increment counts when using --stats.
10856         Use a lock around the increment.
10857         * parameters.cc (class Set_parameters_target_once): Define.
10858         (set_parameters_target_once): New static variable.
10859         (Parameters::Parameters): Move here from parameters.h.
10860         (Parameters::set_target): Rewrite.
10861         (Parameters::set_target_once): New function.
10862         (Parameters::clear_target): Move here and rewrite.
10863         * parameters.h (class Parameters): Update declarations.  Add
10864         set_parameters_target_once_ field.
10865         (Parameters::Parameters): Move to parameters.cc.
10866         (Parameters::clear_target): Likewise.
10867         * readsyms.cc (Read_symbols::do_group): Create a Start_group
10868         task.
10869         (Start_group::~Start_group): New function.
10870         (Start_group::is_runnable): New function.
10871         (Start_group::locks, Start_group::run): New functions.
10872         (Finish_group::run): Change saw_undefined to size_t.
10873         * readsyms.h (class Start_group): Define.
10874         (class Finish_group): Change saw_undefined_ field to size_t.
10875         (Finish_group::Finish_group): Remove saw_undefined and
10876         this_blocker parameters.  Change all callers.
10877         (Finish_group::set_saw_undefined): New function.
10878         (Finish_group::set_blocker): New function.
10879         * symtab.h (class Symbol_table): Change saw_undefined to return
10880         size_t.  Change saw_undefined_ field to size_t.
10881         * target-select.cc (Set_target_once::do_run_once): New function.
10882         (Target_selector::Target_selector): Initialize set_target_once_
10883         field.  Don't initialize lock_ and initialize_lock_ fields.
10884         (Target_selector::instantiate_target): Rewrite.
10885         (Target_selector::set_target): New function.
10886         * target-select.h (class Set_target_once): Define.
10887         (class Target_selector): Update declarations.  Make
10888         Set_target_once a friend.  Remove lock_ and initialize_lock_
10889         fields.  Add set_target_once_ field.
10890
10891 2010-02-10  Ian Lance Taylor  <iant@google.com>
10892
10893         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
10894         queueing any tasks.
10895         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
10896         (queue_middle_tasks): Add all blockers before queueing any tasks.
10897         (queue_final_tasks): Likewise.
10898         * token.h (Task_token::add_blockers): New function.
10899         * object.h (Input_objects::number_of_relobjs): New function.
10900
10901 2010-02-10  Ian Lance Taylor  <iant@google.com>
10902
10903         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
10904         shared, not if not position independent.
10905         * x86_64.cc (Relocate::relocate_tls): Likewise.
10906         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
10907         (tls_pie_pic_test): New target.
10908         * testsuite/Makefile.in: Rebuild.
10909
10910         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
10911         (tls_test_main_pie.o, tls_test_pie.o): New targets.
10912         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
10913         * testsuite/Makefile.in: Rebuild.
10914
10915 2010-02-09  David S. Miller  <davem@davemloft.net>
10916
10917         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
10918         R_SPARC_RELATIVE using ->add_local_relative().
10919         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
10920
10921         * output.h (Output_data_dynamic::add_section_size): New method
10922         that takes two Output_data objects.
10923         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
10924         entry param.  Handle it in initializers.
10925         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
10926         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
10927         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
10928         arg.
10929         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
10930         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
10931         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
10932         for dynrel_includes_plt.
10933         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10934         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10935         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
10936         before .rela.plt
10937         (Target_sparc::do_finalize_sections): Update to pass true for
10938         dynrel_includes_plt.
10939         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
10940         output before .rela.plt
10941         (Target_powerpc::do_finalize_sections): Update to pass true for
10942         dynrel_includes_plt when 32-bit.
10943
10944 2010-02-08  Doug Kwan  <dougkwan@google.com>
10945
10946         * arm.cc (Arm_relobj::simple_input_section_output_address): New
10947         method.
10948         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
10949         Arm_relobj::scan_section_for_cortex_a8_stubs,
10950         Arm_relobj::do_relocation_section): Instead of calling
10951         Output_section::output_address, use faster
10952         Arm_relobj::simple_input_section_output_address.
10953
10954 2010-02-08  David S. Miller  <davem@davemloft.net>
10955
10956         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
10957         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
10958         relocation helper function.
10959
10960         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
10961         just like R_SPARC_GOT{10,13,22}.
10962         (Target_sparc::Scan::local): Likewise.
10963         (Target_sparc::Relocate:relocate): Likewise.
10964
10965 2010-02-06  Ian Lance Taylor  <iant@google.com>
10966
10967         * configure.ac: Rewrite targetobjs duplicate removal code to use
10968         only shell constructs.
10969         * configure: Rebuild.
10970
10971 2010-02-05  Doug Kwan  <dougkwan@google.com>
10972
10973         PR 11247
10974         * arm.cc (Arm_relobj::section_is_scannable): New method.
10975         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
10976         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
10977
10978 2010-02-04  Doug Kwan  <dougkwan@google.com>
10979
10980         PR 11247
10981         * arm-reloc-property.cc (cstdio): Include.
10982         * configure.ac (targetobjs): Remove duplicates.
10983         * configure: Regenerate.
10984         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
10985         big and little endian version for a given address size.
10986
10987 2010-02-03  Doug Kwan  <dougkwan@google.com>
10988
10989         * arm-reloc-property.cc
10990         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10991         definition.
10992         * arm-reloc-property.h
10993         (Arm_reloc_property_table::get_implemented_static_reloc_property):
10994         New method definition.
10995         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10996         declaration.
10997         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
10998         overflow to N.
10999         (GOT_PREL): Change implemented to Y.
11000         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
11001         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
11002         (Arm_relocate_functions::movw_abs_nc): Remove method.
11003         (Arm_relocate_functions::movt_abs): Ditto.
11004         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
11005         (Arm_relocate_functions::thm_movt_abs): Ditto.
11006         (Arm_relocate_functions::movw_rel_nc): Ditto.
11007         (Arm_relocate_functions::movw_rel): Ditto.
11008         (Arm_relocate_functions::movt_rel): Ditto.
11009         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
11010         (Arm_relocate_functions:thm_movw_rel): Ditto.
11011         (Arm_relocate_functions:thm_movt_rel): Ditto.
11012         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
11013         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
11014         New method definitions.
11015         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
11016         (Arm_relocation_functions::arm_grp_ldr): Ditto.
11017         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
11018         (Arm_relocation_functions::arm_grp_ldc): Ditto.
11019         (Target_arm::Relocate::relocate): Check for non-static or
11020         unimplemented relocation code and exit early.  Change calls to
11021         Target_arm::reloc_uses_thumb_bit and
11022         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
11023         instead.  Refactor code to handle similar relocations to increase
11024         code sharing.  Remove check for unsupported relocation code in switch
11025         statement.
11026         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
11027         relocation property table to find out size.  Change error message to
11028         print out the name of a relocation code instead of the numeric value.
11029         (Target_arm::scan_reloc_for_stub): Use relocation property table
11030         instead of calling Target_arm::reloc_uses_thumb_bit().
11031
11032 2010-02-02  Doug Kwan  <dougkwan@google.com>
11033
11034         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
11035         types of relaxed input section.
11036
11037 2010-02-02  Doug Kwan  <dougkwan@google.com>
11038
11039         * Makefile.am (HFILES): Add arm-reloc-property.h.
11040         (DEFFILES): New.
11041         (TARGETSOURCES): Add arm-reloc-property.cc
11042         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
11043         (libgold_a_SOURCES): $(DEFFILES)
11044         * Makefile.in: Regenerate.
11045         * arm-reloc-property.cc: New file.
11046         * arm-reloc-property.h: New file.
11047         * arm-reloc.def: New file.
11048         * arm.cc: Update comments.
11049         (arm-reloc-property.h): New included header.
11050         (arm_reloc_property_table): New global variable.
11051         (Target_arm::do_select_as_default_target): New method definition.
11052         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
11053         arm-reloc-property to targ_extra_obj.
11054         * parameters.cc (set_parameters_target): Call
11055         Target::select_as_default_target().
11056         * target.h (Target::select_as_default_target): New method definition.
11057         (Target::do_select_as_default_target): Same.
11058
11059 2010-02-01  Doug Kwan  <dougkwan@google.com>
11060
11061         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
11062         first_output_text_section_.
11063         (Arm_exidx_fixup::first_output_text_section): New method definition.
11064         (Arm_exidx_fixup::first_output_text_section_): New data member.
11065         (Arm_exidx_fixup::process_exidx_section): Record the first text
11066         output section seen.
11067         (Arm_output_section::fix_exidx_coverage): Set correct linked section
11068         and entsize in output section header.
11069
11070 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11071
11072         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
11073         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
11074         (Arm_relocate_functions::thm_alu11): New Method.
11075         (Arm_relocate_functions::thm_pc8): New Method.
11076         (Arm_relocate_functions::thm_pc12): New Method.
11077         (Target_arm::Scan::local): Handle the relocations.
11078         (Target_arm::Scan::global): Likewise.
11079         (Target_arm::Relocate::relocate): Likewise.
11080         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11081
11082 2010-01-29  Doug Kwan  <dougkwan@google.com>
11083
11084         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
11085         of relocation types as ld.
11086
11087 2010-01-29  Doug Kwan  <dougkwan@google.com>
11088
11089         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
11090         to public.
11091         (Arm_relocate_functions::thumb_branch_common): Ditto.
11092         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
11093         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
11094         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
11095         Arm_relocate_functions::jump24): Remove.
11096         (Target_arm::Relocate::relocate): Adjust code to call
11097         Arm_relocation_functions::arm_branch_common and
11098         Arm_relocation_functions::thumb_branch_common instead of their removed
11099         wrappers.  Merge switch-cases together to reduce source code size.
11100
11101 2010-01-29  Doug Kwan  <dougkwan@google.com>
11102
11103         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
11104         output_local_symbol_count_needs_update_.
11105         (Arm_relobj::output_local_symbol_count_needs_update,
11106          Arm_relobj::set_output_local_symbol_count_needs_update,
11107          Arm_relobj::update_output_local_symbol_count): New methods.
11108         (Arm_relobj::output_local_symbol_count_needs_update_): New data
11109         member.
11110         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
11111         of pointed function as in a R_ARM_PREL31 relocation.
11112         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
11113         for output local symbol count updating.
11114         (Target_arm::do_relax): Update output local symbol counts in objects
11115         if necessary.
11116         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
11117
11118 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11119
11120         * arm.cc: Added support for the ARM relocations:
11121         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
11122         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
11123         (Arm_relocate_functions::movw_rel_nc): Renamed (was
11124         movw_prel_nc).
11125         (Arm_relocate_functions::movw_rel): New method.
11126         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
11127         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
11128         thm_movw_prel_nc).
11129         (Arm_relocate_functions::thm_movw_rel): New method.
11130         (Arm_relocate_functions::thm_movt_rel): Renamed (was
11131         thm_movt_prel).
11132         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
11133         relocations.
11134         (Target_arm::Scan::global): Likewise.
11135         (Target_arm::Relocate::relocate): Likewise.
11136         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11137         Likewise.
11138
11139 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11140
11141         * arm.cc: Added support for ARM group relocations.
11142         (Target_arm::reloc_needs_sym_origin): New method.
11143         (Arm_relocate_functions::calc_grp_kn): New method.
11144         (Arm_relocate_functions::calc_grp_residual): New method.
11145         (Arm_relocate_functions::calc_grp_gn): New method.
11146         (Arm_relocate_functions::arm_grp_alu): New Method.
11147         (Arm_relocate_functions::arm_grp_ldr): New Method.
11148         (Arm_relocate_functions::arm_grp_ldrs): New Method.
11149         (Arm_relocate_functions::arm_grp_ldc): New Method.
11150         (Target_arm::Scan::local): Handle the ARM group relocations.
11151         (Target_arm::Scan::global): Likewise.
11152         (Target_arm::Relocate::relocate): Likewise.
11153         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11154         Likewise.
11155
11156 2010-01-26  Doug Kwan  <dougkwan@google.com>
11157
11158         * arm.cc (set): Include.
11159         (class Arm_exidx_fixup): Change type of last_input_section_ to const
11160         pointer type.
11161         (Arm_output_section::Text_section_list): New type.
11162         (Arm_output_section::append_text_sections_to_list): New method.
11163         (Arm_output_section::fix_exidx_coverage): Ditto.
11164         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
11165         (Arm_relobj::convert_input_section_to_relaxed_section): Use
11166         Relobj::set_section_offset() instead of
11167         Sized_relobj::invalidate_section_offset().
11168         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
11169         parameter for section headers. Ignore relocation sections for
11170         unallocated sections and EXIDX sections.
11171         (Target_arm::fix_exidx_coverage): New method.
11172         (Target_arm::output_section_address_less_than): New type.
11173         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
11174         linked text section instead of the EXIDX section.
11175         (Arm_output_section::create_stub_group): Add an assertion to check
11176         that this is not an EXIDX output section.
11177         (Arm_output_section::append_text_sections_to_list): New method.
11178         (Arm_output_section::fix_exidx_coverage): Ditto.
11179         (Arm_relobj::scan_sections_for_stubs): Adjust call to
11180         Arm_relobj::section_needs_reloc_stub_scanning.
11181         (Target_arm::do_relax): Fix EXIDX output section coverage in the
11182         first pass.
11183         (Target_arm::fix_exidx_coverage): New method.
11184         * object.h (Relobj::set_output_section): New method.
11185         (Sized_relobj::invalidate_section_offset): Remove method.
11186         (Sized_relobj::do_invalidate_section_offset): Remove method.
11187         (Sized_relobj::do_set_section_offset): Handle offset value -1.
11188
11189 2010-01-25  Doug Kwan  <dougkwan@google.com>
11190
11191         * arm.cc (Arm_exidx_merged_section::do_output_offset):
11192         Fix warning due to signed and unsigned comparison on a 32-bit host.
11193
11194 2010-01-22  Doug Kwan  <dougkwan@google.com>
11195
11196         * arm.cc (Target_arm::do_relax): Record an output section for section
11197         offset adjustment it contains any stub table that has changed.
11198         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
11199         offsets in an output section if necessary.
11200         * output.cc (Output_section::Output_section): Initialize
11201         section_offsets_need_adjustments_.
11202         (Output_section::add_input_section_for_script): Renamed to
11203         Output_section::add_simple_input_section.
11204         (Output_section::save_states): Add a comment.
11205         (Output_section::discard_states): New method defintion.
11206         (Output_section::adjust_section_offsets): Same.
11207         * output.h (Output_section::add_input_section_for_script): Renamed to
11208         Output_section::add_simple_input_section.
11209         (Output_section::discard_states): New method declaration.
11210         (Output_section::adjust_section_offsets): Same.
11211         (Output_section::section_offsets_need_adjustment,
11212         Output_section::set_section_offsets_need_adjustment): New method
11213         definitions.
11214         (Output_section::section_offsets_need_adjustment_): New data member.
11215         * script-sections.cc
11216         (Output_section_element_input::set_section_address): Adjust code for
11217         renaming of Output_section::add_input_section_for_script.
11218         (Orphan_output_section::set_section_address): Same.
11219
11220 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11221
11222         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
11223         Fix_v4bx enum values .
11224         * gold/options.h (General_options): New option definitions.
11225         (General_options::fix_v4bx): New method.
11226         (General_options::Fix_v4bx): New enum.
11227         * gold/options.cc (General_options::parse_fix_v4bx): New method.
11228         (General_options::parse_fix_v4bx_interworking): New method.
11229
11230 2010-01-22  Doug Kwan  <dougkwan@google.com>
11231
11232         * arm.cc (Arm_exidx_fixup): New class.
11233
11234 2010-01-21  Doug Kwan  <dougkwan@google.com>
11235
11236         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
11237         classes.
11238         (Arm_exidx_section_offset_map): New type.
11239
11240 2010-01-21  Doug Kwan  <dougkwan@google.com>
11241
11242         * arm.cc (Arm_exidx_input_section): New class.
11243         (Arm_relobj::exidx_input_section_by_link,
11244         Arm_relobj::exidx_input_section_by_shndx,
11245         Arm_relobj::make_exidx_input_section): New methods.
11246         (read_arm_attributes_section): Remove.
11247         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
11248         information about them.
11249         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
11250         to here.
11251
11252 2010-01-20  Doug Kwan  <dougkwan@google.com>
11253
11254         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
11255         Input_section_specifier to Section_id.
11256         (Target_arm::new_arm_input_section: Adjust code for change of key
11257         type.
11258         (Target_arm::find_arm_input_section): Ditto.
11259         * gc.h (object.h): Include for Section_id nand Section_id_hash.
11260         (Section_id): Remove.
11261         (Garbage_collection::Section_id_hash): Remove.
11262         * icf.h (object.h): Include for Section_id nand Section_id_hash.
11263         (Section_id): Remove.
11264         (Icf::Section_id_hash): Remove.
11265         * object.h (Section_id, Const_section_id, Section_id_hash,
11266         Const_section_id_hash): New type definitions.
11267         * output.cc (Output_section::add_relaxed_input_section): Change to
11268         use Const_section_id instead of Input_section_specifier as key type.
11269         (Output_section::add_merge_input_section): Ditto.
11270         (Output_section::build_relaxation_map): Change to use Section_id
11271         instead of Input_section_specifier as key type.
11272         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11273         Ditto.
11274         (Output_section::convert_input_sections_to_relaxed_sections): Change
11275         to use Const_section_id instead of Input_section_specifier as key type.
11276         (Output_section::find_merge_section): Ditto.
11277         (Output_section::find_relaxed_input_section): Ditto.
11278         * output.h (Input_section_specifier): Remove class.
11279         (Output_section::Output_section_data_by_input_section_map): Change
11280         key type to Const_section_id.
11281         (Output_section::Output_relaxed_input_section_by_input_section_map):
11282         Ditto.
11283         (Output_section::Relaxation_map): Change key type to Section_id.
11284
11285 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11286
11287         * gold/arm.cc: Added support for R_ARM_V4BX relocation
11288         (class Arm_v4bx_stub): New class.
11289         (DEF_STUBS): Updated definition to support v4_veneer_bx.
11290         (Stub_factory::make_arm_v4bx_stub): New method.
11291         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
11292         (Stub_table::empty): Handle v4bx stubs.
11293         (Stub_table::add_arm_v4bx_stub): New method.
11294         (Stub_table::find_arm_v4bx_stub): New method.
11295         (Arm_relocate_functions::v4bx): New method.
11296         (Target_arm::fix_v4bx): New method.
11297         (Target_arm::Target_arm): Handle R_ARM_V4BX.
11298         (Stub_table::relocate_stubs): Likewise.
11299         (Stub_table::do_write): Likewise.
11300         (Stub_table::update_data_size_and_addralign): Likewise.
11301         (Stub_table::finalize_stubs):  Likewise.
11302         (Target_arm::Scan::local): Likewise.
11303         (Target_arm::Scan::global): Likewise.
11304         (Target_arm::do_finalize_sections): Likewise.
11305         (Target_arm::Relocate::relocate): Likewise.
11306         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11307         Likewise.
11308         (Target_arm::scan_reloc_for_stub): Likewise.
11309         (Target_arm::scan_reloc_section_for_stubs): Likewise.
11310
11311 2010-01-19  Ian Lance Taylor  <iant@google.com>
11312
11313         * output.cc (Output_section_headers::do_sized_write): Write large
11314         segment count to sh_info field.
11315         (Output_file_header::do_sized_write): For large segment count,
11316         write PN_XNUM to e_phnum field.
11317
11318 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11319
11320         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
11321         (Arm_relocate_functions::thm_jump8): New function.
11322         (Arm_relocate_functions::thm_jump11): New function.
11323         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
11324         R_ARM_THM_JUMP11.
11325         (Target_arm::Scan::global): Likewise.
11326         (Target_arm::Relocate::relocate): Likewise.
11327         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11328         Likewise.
11329
11330 2010-01-14  Doug Kwan  <dougkwan@google.com>
11331
11332         * arm.cc (map, utility): Include headers.
11333         (Target_arm::apply_cortex_a8_workaround): New method.
11334         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
11335         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
11336         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
11337         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
11338         the --[no-]fix-cortex-a8 command line options.
11339         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
11340         (Target_arm::relocate_stub): Use addend in instruction template.
11341         * options.h (DEFINE_bool): Set the user-set flag.
11342         (General_options): Add --[no-]-fix-cortex options.
11343         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
11344         : Update fast look-up map after conversion.
11345
11346 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
11347
11348         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
11349         in the first pass of do_layout.
11350
11351 2010-01-13  Doug Kwan  <dougkwan@google.com>
11352
11353         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11354         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
11355         apparent compiler problem of not folding static constant integral
11356         data members of elfcpp::Elf_sizes<32>.
11357
11358 2010-01-13  Doug Kwan  <dougkwan@google.com>
11359
11360         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11361         Arm_relobj::section_needs_cortex_a8_stub_scanning,
11362         Arm_relobj::scan_section_for_cortex_a8_erratum,
11363         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
11364         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
11365         sections to scan for relocation stubs into a new method
11366         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
11367         relocation and Cortex-A8 stub scanning.
11368         (Target_arm::do_relax): Force stubs to be after stubbed sections
11369         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
11370         the beginning of a new relaxation pass.  Update a comment.
11371         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
11372
11373 2010-01-12  Ian Lance Taylor  <iant@google.com>
11374
11375         * target-reloc.h (visibility_error): New inline function.
11376         (relocate_section): Call visibility_error.
11377         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
11378         (MOSTLYCLEANFILES): Likewise.
11379         (protected_4_pic.o, protected_3.err): New targets.
11380         * testsuite/protected_4.cc: New file.
11381
11382 2010-01-12  Doug Kwan  <dougkwan@google.com>
11383
11384         * arm.cc (Cortex_a8_reloc): New class.
11385         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
11386         and cortex_a8_relocs_info_.
11387         (Target_arm::fix_cortex_a8): New method definition.
11388         (Target_arm::Cortex_a8_relocs_info): New type.
11389         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
11390         New data member declarations.
11391         (Target_arm::scan_reloc_for_stub): Record information about
11392         relocations for THUMB branches that might be exempted from the
11393         Cortex-A8 workaround.
11394         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
11395         at the beginning of a relaxation pass.
11396
11397 2010-01-12  Doug Kwan  <dougkwan@google.com>
11398
11399         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
11400         (Arm_relobj::Mapping_symbol_position,
11401          Arm_reloj::Mapping_symbol_position_less,
11402          Arm_relobj::Mapping_symbols_info): New types.
11403         (Target_arm::is_mapping_symbol_name): New method definition.
11404         (Arm_relobj::do_count_local_symbols): Save information about mapping
11405         symbols.
11406
11407 2010-01-11  Doug Kwan  <dougkwan@google.com>
11408
11409         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
11410         Arm_relocate_functions::thumb32_branch_upper,
11411         Arm_relocate_functions::thumb32_branch_lower,
11412         Arm_relocate_functions::thumb32_cond_branch_offset,
11413         Arm_relocate_functions::thumb32_cond_branch_upper,
11414         Arm_relocate_functions::thumb32_cond_branch_lower,
11415         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
11416         branch offset encoding.
11417         (Arm_relocate_functions::thumb_branch_common): Use new branch
11418         offset encoding methods to avoid code duplication.
11419         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
11420         (Stub_addend_reader::operator()): Use new branch encoding method
11421         to avoid code duplication.
11422
11423 2010-01-11  Doug Kwan  <dougkwan@google.com>
11424
11425         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
11426         (Target_arm::do_finalize_sections): Define special EXIDX section
11427         symbols only if referenced.
11428         * gc.h (Garbage_collection::add_reference): New method.
11429         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
11430         code duplication.
11431
11432 2010-01-11  Ian Lance Taylor  <iant@google.com>
11433
11434         * script.cc (Version_script_info::build_expression_list_lookup):
11435         Change complaing about duplicate wildcard match from error to
11436         warning.
11437
11438         * script.cc (class Lazy_demangler): Recreate--revert part of patch
11439         of 2009-12-30.
11440         (Version_script_info::Version_script_info): Initialize globs_,
11441         default_version_, default_is_global_, and exact_.  Don't
11442         initialize globals_ or locals_.
11443         (Version_script_info::build_lookup_tables): Build local symbols
11444         first.
11445         (Version_script_info::unquote): New function.
11446         (Version_script_info::add_exact_match): New function.
11447         (Version_script_info::build_expression_list_lookup): Remove lookup
11448         parameter.  Add is_global parameter.  Change all callers.  Handle
11449         wildcard pattern specially.  Unquote pattern.  Call
11450         add_exact_match.
11451         (Version_script_info::get_name_to_match): New function.
11452         (Version_script_info::get_symbol_version): New function.
11453         (Version_script_info::get_symbol_version_helper): Remove.
11454         (Version_script_info::check_unmatched_names): Call unquote.
11455         * script.h (class Version_script_info): Change get_symbol_version
11456         to be non-inline and add is_global parameter; change all callers.
11457         Rewrite symbol_is_local.  Update declarations.  Define struct
11458         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
11459         Remove globals_ and locals_ members.  Add exact_, globs_,
11460         default_version_, is_global_.
11461         (Version_script_info::Glob): Remove pattern, add expression and
11462         is_global.  Update constructor.  Change all callers.
11463         * dynobj.cc (Versions::finalize): Mark the version symbol as the
11464         default version.
11465         (Versions::symbol_section_contents): If a symbol is undefined, or
11466         defined in a dynamic object, set the version index to
11467         VER_NDX_LOCAL.
11468         * symtab.cc (Symbol_table::add_from_relobj): Don't call
11469         symbol_is_local.
11470         (Symbol_table::add_from_pluginobj): Likewise.
11471         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
11472
11473 2010-01-11  Doug Kwan  <dougkwan@google.com>
11474
11475         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
11476         (incremental_dump_LDADD): Add linking option for libintl.
11477         * Makefile.in: Regenerate.
11478
11479 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
11480
11481         PR gold/11144
11482         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
11483         instead of -Ds.
11484         * testsuite/Makefile.in: Regenerated.
11485
11486 2010-01-10  Doug Kwan  <dougkwan@google.com>
11487
11488         * options.h (DEFINE_var): Use parentheses around argument varname__
11489         in macro body to avoid any unintended subsequent substitutions.
11490
11491 2010-01-10  Ian Lance Taylor  <iant@google.com>
11492
11493         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
11494         candidates before doing symbol resolution.
11495
11496         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
11497         ODR candidates if only one is weak.
11498
11499 2010-01-08  Ian Lance Taylor  <iant@google.com>
11500
11501         * script.cc (Version_script_info::build_expression_list_lookup):
11502         Don't warn about ambiguous version, just record the ambiguity.
11503         (Version_script_info::get_symbol_version_helper): Give error if
11504         version is ambiguous.
11505
11506 2010-01-08  Doug Kwan  <dougkwan@google.com>
11507
11508         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
11509         prev_data_size_ and prev_addralign_.  Remove initializer for
11510         deleted data member has_been_changed_.
11511         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
11512         to determine if the table is empty.
11513         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
11514         Remove.
11515         (Stub_table::add_reloc_stub): Define method in class definition
11516         instead of just declaring it there.
11517         (Stub_table::add_cortex_a8_stub): New method definition.
11518         (Stub_table::update_data_size_and_addralign): Ditto.
11519         (Stub_table::finalize_stubs): Ditto.
11520         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
11521         (Stub_table::do_addralign_): Return address alignment in the
11522         (Stub_table::do_reset_address_and_file_offset): Define method in
11523         class definition instead of declaring it there.  Set current data
11524         size to be the data size of the previous pass.
11525         (Stub_table::set_final_data_size): Use current data size as the
11526         final data size.
11527         (Stub_table::relocate_stub): Change parameter type of stub from
11528         Reloc_stub pointer to Stub pointer.
11529         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
11530         (Stub_table::Cortex_a8_stub_list): New typedef.
11531         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
11532          Stub_table::prev_addralign_): New data member.
11533         (Arm_relobj::Arm_relobj): Initialize data member
11534         section_has_cortex_a8_workaround_.
11535         (Arm_relobj::section_has_cortex_a8_workaround,
11536          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
11537          definitions.
11538         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
11539         declarations.
11540         (Target_arm::relocate_stub): Change parameter type of stub from
11541         Reloc_stub pointer to Stub pointer.
11542         (Insn_template::size, Insn_template::alignment): Handle
11543         THUMB16_SPECIAL_TYPE.
11544         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
11545          Stub_table::update_data_size_and_addralign,
11546          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
11547         definitions.
11548         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
11549         (Stub_table::do_write): Ditto.
11550         (Target_arm::do_relax): Adjust code for changes in Stub_table.
11551
11552 2010-01-08  Ian Lance Taylor  <iant@google.com>
11553
11554         PR 11108
11555         * symtab.h (class Symbol): Remove fields is_target_special_ and
11556         has_plt_offset_.  Add field is_defined_in_discarded_section_.
11557         (Symbol::is_defined_in_discarded_section): New function.
11558         (Symbol::set_is_defined_in_discarded_section): New function.
11559         (Symbol::has_plt_offset): Rewrite.
11560         (Symbol::set_plt_offset): Verify that new offset is not -1U.
11561         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
11562         Don't initialize is_target_special_ or has_plt_offset_.
11563         Initialize is_defined_in_discarded_section_.
11564         (Symbol_table::add_from_relobj): If appropriate, set
11565         is_defined_in_discarded_section.
11566         * resolve.cc (Symbol::override_base_with_special): Don't test
11567         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
11568         * target-reloc.h (relocate_section): Do special handling for
11569         symbols defined in discarded sections for global symbols as well
11570         as local symbols.
11571
11572 2010-01-08  Ian Lance Taylor  <iant@google.com>
11573
11574         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
11575         the SHT_SYMTAB case.
11576
11577 2010-01-08  Ian Lance Taylor  <iant@google.com>
11578
11579         * object.cc (Sized_relobj::do_layout): Don't get confused if
11580         layout_eh_frame returns NULL.
11581
11582 2010-01-08  Ian Lance Taylor  <iant@google.com>
11583
11584         PR 11084
11585         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
11586         dynamic symbol table, use the normal symbol table.
11587         (Sized_dynobj::do_read_symbols): Remove assertion about type of
11588         symbol table.
11589
11590 2010-01-08  Ian Lance Taylor  <iant@google.com>
11591
11592         PR 11072
11593         * layout.cc (Layout::include_section): Remove .gnu_debuglink
11594         sections.
11595
11596 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
11597
11598         * version.cc (print_version): Change to "Copyright 2010".
11599
11600 2010-01-08  Ian Lance Taylor  <iant@google.com>
11601
11602         PR 10287
11603         PR 11063
11604         * i386.cc (class Target_i386): Change return type of plt_section
11605         to be non-const.
11606         (class Output_data_plt_i386): Add tls_desc_rel_ field.
11607         (Output_data_plt_i386::Output_data_plt_i386): Initialize
11608         tls_desc_rel_ field.
11609         (Output_data_plt_i386::rel_tls_desc): New function.
11610         (Target_i386::rel_tls_desc_section): New function.
11611         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
11612         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
11613         R_386_TLS_DESC reloc in rel_tls_desc_section.
11614         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
11615         Define struct Tlsdesc_info.
11616         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
11617         (Target_x86_64::do_reloc_symbol_index): New function.
11618         (Target_x86_64::add_tlsdesc_info): New function.
11619         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
11620         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
11621         tlsdesc_rel_ field.
11622         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
11623         all callers.
11624         (Output_data_plt_x86_64::rela_tlsdesc): New function.
11625         (Target_x86_64::rela_tlsdesc_section): New function.
11626         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
11627         handling.
11628         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
11629         (Target_x86_64::do_reloc_addend): New function.
11630         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
11631         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
11632         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
11633         (Output_reloc::type): New function.
11634         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
11635         (Output_reloc::is_target_specific): New function.
11636         (Output_reloc::target_arg): New function.
11637         (class Output_reloc) [SHT_RELA]: Add four new constructors for
11638         absolute relocs and target specific relocs.
11639         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
11640         add_target_specific.
11641         (class Output_data_reloc) [SHT_RELA]: Likewise.
11642         * output.cc (Output_reloc::Output_reloc): Add four new versions
11643         for absolute relocs and target specific relocs.
11644         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
11645         (Output_reloc::get_symbol_index): Likewise.
11646         (Output_reloc::local_section_offset): Check that local_sym_index_
11647         is not TARGET_CODE or 0.
11648         (Output_reloc::symbol_value): Likewise.
11649         (Output_reloc::write) [SHT_RELA]: Call target for target specific
11650         reloc.
11651         * target.h (class Target): Add reloc_symbol_index and reloc_addend
11652         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
11653         functions.
11654         * layout.cc (add_target_dynamic_tags): Use output section for
11655         DT_PLTRELSZ and DT_JMPREL.
11656
11657 2010-01-07  Ian Lance Taylor  <iant@google.com>
11658
11659         PR 11061
11660         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
11661         function.
11662         (class Output_data_reloc_generic): Define.
11663         (class Output_data_reloc_base): Change base class to
11664         Output_data_reloc_generic.  Change add() method to call
11665         bump_relative_reloc_count for a relative reloc.  Remove
11666         sort_relocs_ field.
11667         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
11668         to sort_relocs().
11669         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
11670         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
11671         appropriate.
11672         * layout.h (class Layout): Update declaration.
11673
11674 2010-01-07  Ian Lance Taylor  <iant@google.com>
11675
11676         * output.h (class Output_data): Add const version of
11677         output_section and do_output_section.
11678         (class Output_section_data): Add const version of
11679         do_output_section.
11680         (class Output_section): Likewise.
11681         * layout.cc (Layout::add_target_dynamic_tags): New function.
11682         * layout.h (class Layout): Update declarations.
11683         * arm.cc (Target_arm::do_finalize_sections): Use
11684         add_target_dynamic_tags.
11685         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11686         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11687         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11688         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11689
11690 2010-01-07  Ian Lance Taylor  <iant@google.com>
11691
11692         PR 11042
11693         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
11694         object as needed.
11695
11696 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
11697             Ian Lance Taylor  <iant@google.com>
11698
11699         PR 11019
11700         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
11701         Xindex::read_symtab_xindex.
11702
11703 2010-01-07  Doug Kwan  <dougkwan@google.com>
11704
11705         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
11706         (Insn_template::thumb16_bcond_insn): New method declaration.
11707         (Insn_template): Fix spelling.
11708         (Stub::thumb16_special): New method declaration.
11709         (Stub::do_write): Define virtual method which was previously pure
11710         virtual.
11711         (Stub::do_thumb16_special): New method declaration.
11712         (Stub::do_fixed_endian_write): New template member.
11713         (Reloc_stub::do_write): Remove.
11714         (Reloc_stub::do_fixed_endian_write): Remove.
11715         (Cortex_a8_stub): New class definition.
11716         (Stub_factory::make_cortex_a8_stub): New method definition.
11717         (Stub_factory::Stub_factory): Add missing static storage class
11718         qualifier for elf32_arm_stub_a8_veneer_blx.
11719
11720 2010-01-07  Ian Lance Taylor  <iant@google.com>
11721
11722         PR 10980
11723         * options.h (class General_options): Add --warn-unresolved-symbols
11724         and --error-unresolved-symbols.
11725         * errors.cc (Errors::undefined_symbol): Implement
11726         --warn-unresolved-symbols.
11727
11728         * options.h (class General_options): Add -z text and -z textoff.
11729         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
11730
11731 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
11732
11733         * gc.h (Garbage_collection::Cident_section_map): New typedef.
11734         (Garbage_collection::cident_sections): New function.
11735         (Garbage_collection::add_cident_section): New function.
11736         (Garbage_collection::cident_sections_): New member.
11737         (gc_process_relocs): Add references to sections whose names are C
11738         identifiers.
11739         * gold.h (cident_section_start_prefix): New constant.
11740         (cident_section_stop_prefix): New constant.
11741         (is_cident): New function.
11742         * layout.cc (Layout::define_section_symbols): Replace string constants
11743         with the newly defined constants.
11744         * object.cc (Sized_relobj::do_layout): Track sections whose names are
11745         C identifiers.
11746         * testsuite/Makefile.am: Add gc_orphan_section_test.
11747         * testsuite/Makefile.in: Regenerate.
11748         * testsuite/gc_orphan_section_test.cc: New file.
11749         * testsuite/gc_orphan_section_test.sh: New file.
11750
11751 2010-01-06  Ian Lance Taylor  <iant@google.com>
11752
11753         PR 10980
11754         * options.h (class General_options): Add --warn-shared-textrel.
11755         * layout.cc (Layout::finish_dynamic_section): Implement
11756         --warn-shared-textrel.
11757
11758         PR 10980
11759         * options.h (class General_options): Add --warn-multiple-gp.
11760
11761 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11762
11763         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
11764         $(THREADSLIB) and $(LIBDL).
11765         * Makefile.in: Rebuild.
11766
11767 2010-01-06  Ian Lance Taylor  <iant@google.com>
11768
11769         PR 10980
11770         * options.cc (General_options::parse_section_start): New function.
11771         (General_options::section_start): New function.
11772         (General_options::General_options): Initialize all members.
11773         * options.h: Include <map>
11774         (class General_options): Add --section-start.  Add section_starts_
11775         member.
11776         * layout.cc (Layout::attach_allocated_section_to_segment): If
11777         --section-start was used, set the address of the segment.  Remove
11778         local sort_sections.
11779         (Layout::relaxation_loop_body): If the address of the load segment
11780         has been set by --section-start, don't use it.
11781         * output.h (Output_segment::update_flags_for_output_section): New
11782         function.
11783         * output.cc (Output_segment::add_output_section): Call
11784         update_flags_for_output_section.
11785
11786 2010-01-05  Ian Lance Taylor  <iant@google.com>
11787
11788         PR 10980
11789         * options.h (class General_options): Add --undefined-version.
11790         * script.cc (struct Version_expression): Add was_matched_by_symbol
11791         field.
11792         (Version_script_info::matched_symbol): New function.
11793         (Version_script_info::get_symbol_version_helper): Call
11794         matched_symbol.
11795         (Version_script_info::check_unmatched_names): New function.
11796         * script.h (class Version_script_info): Update declarations.
11797         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
11798
11799         * options.h (class General_options): Use DEFINE_bool_alias for
11800         allow_multiple_definition.
11801         * resolve.cc (Symbol_table::should_override): Don't test
11802         allow_multiple_definition.
11803
11804         PR 10980
11805         * options.h (class General_options): Add --cref.
11806         * main.cc (main): Print cref table if --cref.  Don't close mapfile
11807         until after printing cref table.
11808         * cref.cc: Include "symtab.h".
11809         (class Cref_inputs): Define Cref_table_compare and Cref_table.
11810         (Cref_table_compare::operator()): New function.
11811         (Cref_inputs::gather_cref): New function.
11812         (filecol): New static const.
11813         (Cref_inputs::print_cref): New function.
11814         (Cref::print_cref): New function.
11815         * cref.h: Include <cstdio>.
11816         (class Cref): Update declarations.
11817         * mapfile.h (Mapfile::file): New function.
11818         * object.h (class Object): Define Symbols.  Declare virtual
11819         do_get_global_symbols.
11820         (Object::get_global_symbols): New function.
11821         * object.cc (Input_objects::add_object): Pass object to cref_ if
11822         --cref.
11823         (Input_objects::archive_start): Likewise.
11824         (Input_objects::archive_stop): Likewise.
11825         (Input_objects::print_cref): New function.
11826         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
11827         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
11828         --cref.
11829         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
11830         function.
11831         * plugin.h (class Sized_pluginobj): Update declarations.
11832
11833 2010-01-05  Ian Lance Taylor  <iant@google.com>
11834
11835         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
11836         to is_default_version.  Rename insdef to insdefault.
11837         (Symbol_table::add_from_relobj): Rename def to is_default_version
11838         and local to is_forced_local.
11839         (Symbol_table::add_from_pluginobj): Likewise.
11840         (Symbol_table::add_from_dynobj): Likewise.
11841         (Symbol_table::define_special_symbol): Rename insdef to
11842         insdefault.
11843
11844 2010-01-04  Ian Lance Taylor  <iant@google.com>
11845
11846         PR 10980
11847         * options.h (class General_options): Add
11848         --allow-multiple-definition and -z muldefs.
11849         * resolve.cc (Symbol_table::should_override): Don't warn about a
11850         multiple symbol definition if --allow-multiple-definition or -z
11851         muldefs.
11852
11853         PR 10980
11854         * options.h (class General_options): Add --add-needed and
11855         --copy-dt-needed-entries.  Tweak --as-needed help entry.
11856         * object.cc (Input_objects::check_dynamic_dependencies): Give an
11857         error if --copy-dt-needed-entries aka --add-needed is used and
11858         would cause a change in behaviour.
11859
11860         PR 10980
11861         * options.h (class General_options): Add -G as a short version of
11862         --shared.  Add no-op options -assert, -g, and -i.
11863
11864 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
11865
11866         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
11867         check for .text or .gnu.linkonce.t sections.
11868         * icf.cc (Icf::find_identical_sections): Ditto.
11869         Change the detection for mangled function name within the section
11870         name.
11871         * icf.h (is_section_foldable_candidate): New function.
11872
11873 2009-12-30  Ian Lance Taylor  <iant@google.com>
11874
11875         PR 10980
11876         * options.h (class General_options): Permit two dashes with
11877         --retain-symbols-file.
11878
11879 2009-12-30  Ian Lance Taylor  <iant@google.com>
11880
11881         PR 10979
11882         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
11883         don't put the file header and segment headers in the text
11884         segment.
11885
11886         PR 10979
11887         * common.cc (Sort_commons::operator()): Stabilize sort when both
11888         entries are NULL.
11889         (Symbol_table::do_allocate_commons_list): When allocating common
11890         symbols, skip a symbol which is no longer common.
11891         * symtab.h (Symbol::is_common): Test whether the symbol comes from
11892         an object before checking its type.
11893         * testsuite/common_test_2.c: New file.
11894         * testsuite/common_test_3.c: New file.
11895         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
11896         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
11897         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
11898         (common_test_2_pic.o, common_test_2.so): New targets.
11899         (common_test_3_pic.o, common_test_3.so): New targets.
11900         * testsuite/Makefile.in: Rebuild.
11901
11902         PR 10979
11903         * script.cc (read_input_script): If we see a new SECTIONS clause,
11904         and we have added an input section, give an error.
11905         * layout.h (class Layout): Add have_added_input_section function.
11906         Add have_added_input_section_ field.
11907         * layout.cc (Layout::Layout): Initialize
11908         have_added_input_section_.
11909         (Layout::layout): Set have_added_input_section_.
11910         (Layout::layout_eh_frame): Likewise.
11911
11912 2009-12-30  Ian Lance Taylor  <iant@google.com>
11913
11914         PR 10931
11915         * options.h (class General_options): Add --sort-common option.
11916         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
11917         * common.cc (Sort_common): Add sort_order parameter to
11918         constructor.  Add sort_order_ field.
11919         (Sort_commons::operator): Check sort_order_.
11920         (Symbol_table::allocate_commons): Determine the sort order.
11921         (Symbol_table::do_allocate_commons): Add sort_order parameter.
11922         Change all callers.
11923         (Symbol_table::do_allocate_commons_list): Likewise.
11924
11925 2009-12-30  Ian Lance Taylor  <iant@google.com>
11926
11927         PR 10916
11928         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
11929         symbols from this object, don't change the visibility of an
11930         undefined symbol.
11931         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
11932
11933 2009-12-30  Ian Lance Taylor  <iant@google.com>
11934
11935         PR 10861
11936         * script.h (class Version_script_info): Define Language enum.
11937         Update declarations.  Define Glob, Exact, and Lookup types.  Add
11938         new fields globals_, locals_, and is_finalized_.
11939         * script.cc: Various formatting fixes.
11940         (class Parser_closure): Change language_stack_ from a vector of
11941         std::string to one of Version_script_info::Language.  Adjust all
11942         uses accordingly.
11943         (class Lazy_demangler): Remove.
11944         (struct Version_expression): Change language from std::string to
11945         Version_script_info::Language.
11946         (Version_script_info::Version_script_info): New function.
11947         (Version_script_info::~Version_script_info): Don't call clear.
11948         (Version_script_info::finalize): New function.
11949         (Version_script_info::build_lookup_tables): New function.
11950         (Version_script_info::build_expression_list_lookup): New
11951         function.
11952         (Version_script_info::get_symbol_version_helper): Rewrite to use
11953         lookup tables.
11954         (Version_script_info::print_expression_list): Adjust to use
11955         Version_script_info::Language.
11956         (script_push_lex_into_version_mode): Check that the version script
11957         has not been finalized.
11958         (version_script_push_lang): Change language string to
11959         Version_script_info::Language.
11960         * options.cc (Command_line::version_script): New function.
11961         * options.h (class General_options): Add finalize_dynamic_list
11962         function.  Change version_script from declaration to definition.
11963         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
11964         * testsuite/version_script.map: Remove duplicate def of foo.
11965         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
11966         version_script.map.
11967         * testsuite/Makefile.in: Rebuild.
11968
11969 2009-12-30  Ian Lance Taylor  <iant@google.com>
11970
11971         PR 10843
11972         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
11973         if the input symbol index is 0, make the output symbol index 0.
11974
11975 2009-12-30  Ian Lance Taylor  <iant@google.com>
11976
11977         PR 10670
11978         * options.h (class General_options): Add -x/--discard-all.
11979         * object.cc (Sized_relobj::do_count_local_symbols): Handle
11980         --discard-all.  If the local symbol needs a dynamic entry, check
11981         that before handling --discard-locals.
11982
11983 2009-12-30  Ian Lance Taylor  <iant@google.com>
11984
11985         PR 10450
11986         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
11987         flags to PF_R.
11988         (Output_segment::add_output_section): Don't change the flags if
11989         the type is PT_TLS.
11990
11991         PR 10450
11992         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
11993         GNU hash table if they need a dynamic value.  Otherwise, don't add
11994         them if they are defined in a dynamic object or are forced local.
11995
11996 2009-12-29  Ian Lance Taylor  <iant@google.com>
11997
11998         PR 10450
11999         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
12000         .gnu.hash table for a 32-bit target.
12001
12002         PR 10450
12003         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
12004         regular and a dynamic object only needs a dynamic symbol table
12005         entry if it is externally visible.
12006
12007         PR 10450
12008         * i386.cc (class Target_i386): Initialize global_offset_table_ in
12009         constructor.  Add global_offset_table_ field.
12010         (Target_i386::got_section): Set global_offset_table_.
12011         (Target_i386::do_finalize_sections): Set global_offset_table_
12012         size.
12013         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
12014         in constructor.  Add global_offset_table_ field.
12015         (Target_x86_64::got_section): Set global_offset_table_.
12016         (Target_x86_64::do_finalize_sections): Set global_offset_table_
12017         size.
12018
12019         * layout.cc (Layout::Layout): Initialize increase_relro_.
12020         (Layout::get_output_section): Add is_relro, is_last_relro, and
12021         is_first_non_relro parameters.  Change all callers.
12022         (Layout::choose_output_section): Likewise.
12023         (Layout::add_output_section_data): Likewise.
12024         (Layout::make_output_section): Likewise.
12025         (Layout::set_segment_offsets): Clear increase_relro when using a
12026         linker script.
12027         * layout.h (class Layout): Add increase_relro method.  Add
12028         increase_relro_ field.  Update declarations.
12029         * output.cc (Output_section::Output_section): Initialize
12030         is_last_relro_ and is_first_non_relro_.
12031         (Output_segment::add_output_section): Group relro sections is
12032         do_sort is true.  Handle is_last_relro and is_first_non_relro.
12033         (Output_segment::maximum_alignment): Remove relro handling.
12034         (Output_segment::set_section_addresses): Add increase_relro
12035         parameter.  Change all callers.  Add initial alignment to align
12036         relro sections on separate page.  Remove old relro handling.
12037         (Output_segment::set_section_list_addresses): Remove in_relro
12038         parameter.  Change all callers.
12039         (Output_segment::set_offset): Add increase parameter.  Change all
12040         callers.  Remove old relro handling.
12041         * output.h (class Output_section): Add new methods: is_last_relro,
12042         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
12043         Add is_last_relro_ and is_first_non_relro_ fields.
12044         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
12045         Create separate .got.plt section.  Call increase_relro.
12046         * x86_64.cc (Target_x86_64::got_section): Likewise.
12047         * testsuite/relro_script_test.t: Add .got.plt.
12048
12049         PR 10450
12050         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
12051         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
12052         (Layout::finalize): Call set_dynamic_symbol_size.
12053         (Layout::set_dynamic_symbol_size): New function.
12054         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
12055         set_dynamic_symbol_size.
12056
12057         PR 10450
12058         * output.h (class Output_section): Add is_entsize_zero_ field.
12059         * output.cc (Output_section::Output_section): Initialize
12060         is_entsize_zero_.
12061         (Output_section::set_entsize): If two different entsizes are
12062         requested, force it to zero.
12063         (Output_section::add_input_section): Set flags for .debug_str
12064         before updating section flags.  Set entsize.
12065         (Output_section::update_flags_for_input_section): Set SHF_MERGE
12066         and SHF_STRING if all input sections have those flags.
12067
12068 2009-12-29   Rafael Espindola  <espindola@google.com>
12069
12070         * main.cc (main): Fix the sys time reporting.
12071         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
12072         reporting.
12073
12074 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
12075
12076         * options.cc (General_options::parse_version): Allow -v to exit
12077         without an error if there is nothing to link.
12078
12079 2009-12-29  Ian Lance Taylor  <iant@google.com>
12080
12081         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
12082         using a version of gcc before 4.1.
12083         * configure: Rebuild.
12084
12085 2009-12-28  Chris Demetriou  <cgd@google.com>
12086
12087         * attributes.cc (Output_attributes_section_data::do_write): Use
12088         std::vector::front rather than std::vector::data.
12089
12090 2009-12-28  Ian Lance Taylor  <iant@google.com>
12091
12092         * symtab.h (class Symbol_table): Add enum Defined.
12093         * resolve.cc (Symbol_table::should_override): Add defined
12094         parameter.  Change all callers.  Test whether object is NULL
12095         before calling a method on it.
12096         (Symbol_table::report_resolve_problem): Add defined parameter.
12097         Change all callers.
12098         (Symbol_table::should_override_with_special): Likewise.
12099         * symtab.cc (Symbol_table::define_in_output_data): Add defined
12100         parameter.  Change all callers.
12101         (Symbol_table::do_define_in_output_data): Likewise.
12102         (Symbol_table::define_in_output_segment): Likewise.
12103         (Symbol_table::do_define_in_output_segment): Likewise.
12104         (Symbol_table::define_as_constant): Likewise.
12105         (Symbol_table::do_define_as_constant): Likewise.
12106         * script.h (class Symbol_assignment): Add is_defsym parameter to
12107         constructor; change all callers.
12108         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
12109         parameter.  Change all callers.  Add is_defsym_ field.
12110         (class Parser_closure): Add parsing_defsym parameter to
12111         constructor; change all callers.  Add parsing_defsym accessor
12112         function.  Add parsing_defsym_ field.
12113
12114 2009-12-28  Ian Lance Taylor  <iant@google.com>
12115
12116         * gold.cc (queue_middle_tasks): Fix formatting.
12117         * object.cc (Relobj::is_section_name_included): Likewise.
12118
12119 2009-12-23  Ian Lance Taylor  <iant@google.com>
12120
12121         * i386.cc (Target_i386::do_calls_non_split): Recognize
12122         -fsplit-stack prologue for a function with a static chain.
12123         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
12124         -fsplit-stack prologue when using %r11.
12125
12126 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
12127
12128         * options.cc (General_options::parse_version): Make -v continue and do
12129         the link like GNU ld does.
12130
12131 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
12132
12133         * Makefile.am (CCFILES): Add timer.cc.
12134         (HFILES): Add timer.h.
12135         * configure.ac: Check for sysconf and times.
12136         * main.cc: include timer.h.
12137         (main): Use Timer instead of get_run_time.
12138         * timer.cc: New.
12139         * timer.h: New.
12140         * workqueue.cc: include timer.h.
12141         (Workqueue::find_and_run_task):
12142         Report user, sys and wall time.
12143         * Makefile.in: Regenerate.
12144         * config.in: Regenerate.
12145         * configure: Regenerate.
12146
12147 2009-12-16  Doug Kwan  <dougkwan@google.com>
12148
12149         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
12150         sections.
12151         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
12152         relaxed input sections.
12153         * output.cc (Output_section::find_relaxed_input_section): Change
12154         return type to Output_relaxed_input_section pointer.  Adjust code
12155         for new type of relaxed_input_section_map_.
12156         * output.h (Output_section::find_relaxed_input_section): Change
12157         return type to Output_relaxed_input_section pointer.
12158         (Output_section::Output_relaxed_input_section_by_input_section_map):
12159         New type.
12160         (Output_section::relaxed_input_section_map_): Change type to
12161         Output_section::Output_relaxed_input_section_by_input_section_map.
12162         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
12163         input section.
12164
12165 2009-12-15  Ian Lance Taylor  <iant@google.com>
12166
12167         * layout.cc (Layout::create_shstrtab): Only write out after input
12168         sections if we are compressing debug sections.
12169
12170 2009-12-15  Ian Lance Taylor  <iant@google.com>
12171
12172         * archive.cc (Archive::add_symbols): Only look up a symbol without
12173         a version if there is, in fact, a version.
12174
12175 2009-12-14  Ian Lance Taylor  <iant@google.com>
12176
12177         Revert -Wshadow changes, all changes from:
12178         2009-12-11  Doug Kwan  <dougkwan@google.com>
12179         2009-12-11  Nick Clifton  <nickc@redhat.com>
12180         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
12181
12182 2009-12-11  Doug Kwan  <dougkwan@google.com>
12183
12184         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
12185         due to -Wshadow.
12186         * attributes.cc (Object_attribute::size): Ditto.
12187         (Attributes_section_data::size): Ditto.
12188         (Attributes_section_data::Attributes_section_data): Ditto.
12189         (Output_attributes_section_data::do_write): Ditto.
12190         * attributes.h (Object_attribute::set_type): Ditto.
12191         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
12192
12193 2009-12-11  Nick Clifton  <nickc@redhat.com>
12194
12195         * archive.cc: Fix shadowed variable warnings.
12196         * arm.cc: Likewise.
12197         * compressed_output.cc: Likewise.
12198         * compressed_output.h: Likewise.
12199         * configure: Likewise.
12200         * dwarf_reader.cc: Likewise.
12201         * dynobj.cc: Likewise.
12202         * dynobj.h: Likewise.
12203         * ehframe.cc: Likewise.
12204         * ehframe.h: Likewise.
12205         * errors.cc: Likewise.
12206         * expression.cc: Likewise.
12207         * fileread.cc: Likewise.
12208         * fileread.h: Likewise.
12209         * freebsd.h: Likewise.
12210         * i386.cc: Likewise.
12211         * icf.cc: Likewise.
12212         * incremental.h: Likewise.
12213         * layout.cc: Likewise.
12214         * layout.h: Likewise.
12215         * mapfile.cc: Likewise.
12216         * merge.cc: Likewise.
12217         * merge.h: Likewise.
12218         * object.cc: Likewise.
12219         * object.h: Likewise.
12220         * options.h: Likewise.
12221         * output.cc: Likewise.
12222         * output.h: Likewise.
12223         * parameters.cc: Likewise.
12224         * plugin.cc: Likewise.
12225         * powerpc.cc: Likewise.
12226         * reduced_debug_output.cc: Likewise.
12227         * reduced_debug_output.h: Likewise.
12228         * reloc.cc: Likewise.
12229         * reloc.h: Likewise.
12230         * resolve.cc: Likewise.
12231         * script-sections.cc: Likewise.
12232         * script.cc: Likewise.
12233         * script.h: Likewise.
12234         * sparc.cc: Likewise.
12235         * symtab.cc: Likewise.
12236         * symtab.h: Likewise.
12237         * target-select.cc: Likewise.
12238         * target-select.h: Likewise.
12239         * token.h: Likewise.
12240         * workqueue.cc: Likewise.
12241         * workqueue.h: Likewise.
12242         * x86_64.cc: Likewise.
12243
12244 2009-12-10  Doug Kwan  <dougkwan@google.com>
12245
12246         * arm.cc (attributes.h): New include.
12247         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
12248         (Arm_relobj::~Arm_relobj): Delete object pointed by
12249         attributes_section_data_.
12250         (Arm_relobj::attributes_section_data): New method definition.
12251         (Arm_relobj::attributes_section_data_): New data member declaration.
12252         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
12253         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
12254         attributes_section_data_.
12255         (Arm_dynobj::attributes_section_data): New method definition.
12256         (Arm_dynobj::attributes_section_data_): New data member declaration.
12257         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
12258         initialization value of may_use_blx_ to false.
12259         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
12260         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
12261         object attributes to compute results instead of hard-coding.
12262         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
12263         Target_arm::get_secondary_compatible_arch,
12264         Target_arm::set_secondary_compatible_arch
12265         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12266         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
12267         New method declarations.
12268         (Target_arm::get_aeabi_object_attribute): New method definition.
12269         (Target_arm::attributes_section_data_): New data member declaration.
12270         (read_arm_attributes_section): New template definition.
12271         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
12272         (Arm_dynobj::do_read_symbols): Ditto.
12273         (Target_arm::do_finalize_sections): Merge attributes sections from
12274         input.  Check for BLX use after attributes section merging.
12275         Fix __exidx_start and __exidx_end visibility.  Create an
12276         .ARM.attributes section if necessary.
12277         (Target_arm::get_secondary_compatible_arch,
12278         Target_arm::set_secondary_compatible_arch,
12279         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12280         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
12281         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
12282         New method definitions.
12283
12284 2009-12-09  Ian Lance Taylor  <iant@google.com>
12285
12286         * plugin.cc (Plugin::load): Don't cast from void* to a function
12287         pointer.
12288
12289 2009-12-09  Ian Lance Taylor  <iant@google.com>
12290
12291         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
12292         information fields.
12293
12294 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
12295
12296         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
12297         Replace two_file_shared_1.so with two_file_shared_2.so.
12298         * testsuite/Makefile.in: Regenerated.
12299
12300 2009-12-08  Doug Kwan  <dougkwan@google.com>
12301
12302         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
12303         (HFILES): Add attributes.h and int_encoding.h.
12304         * Makefile.in: Regenerate.
12305         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
12306         function definitions to int_encoding.cc
12307         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
12308         prototypes to int_encoding.h
12309         * reduced_debug_output.cc (int_encoding.h): New include.
12310         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
12311         function definitions to int_encoding.cc
12312         (insert_into_vector, read_from_pointer): Move template definitions to
12313         int_encoding.h
12314         * attributes.cc: New file.
12315         * attributes.h: New file.
12316         * int_encoding.cc: New file.
12317         * int_encoding.h: New file.
12318
12319 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
12320
12321         PR gold/11055
12322         * incremental-dump.cc (dump_incremental_inputs): New.
12323         (main): Use dump_incremental_inputs.
12324
12325 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
12326
12327         PR gold/10893
12328         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
12329         checking elfcpp::STT_FUNC.
12330         (Target_i386::Relocate::relocate): Likewise.
12331         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
12332
12333         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
12334         symbols from shared libraries into normal FUNC symbols.
12335
12336         * symtab.h (Symbol): Add is_func and use it.
12337
12338 2009-12-05  Doug Kwan  <dougkwan@google.com>
12339
12340         * arm.cc (Target_arm::arm_info): Initialize new fields
12341         attributes_section and attributes_vendor.
12342         * i386.cc (Target_i386::i386_info): Same.
12343         * object.cc (Sized_relobj::do_layout): Skip attribute section.
12344         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
12345         fields attributes_section and attributes_vendor.
12346         * sparc.cc (Target_sparc::sparc_info): Same.
12347         * target.h (Target::attributes_section, Target::attributes_vendor,
12348         Target::is_attributes_section, Target::attribute_arg_type,
12349         Target::attributes_order): New method definitions.
12350         (Target::Target_info::attributes_section,
12351         Target::Target_info::attributes_vendor): New fields.
12352         (Target::do_attribute_arg_type, Target::do_attributes_order): New
12353         virtual method definitions.
12354         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
12355         attributes_section and attributes_vendor.
12356         * testsuite/testfile.cc (Target_test::test_target_info): Same.
12357
12358 2009-12-05  Doug Kwan  <dougkwan@google.com>
12359
12360         * arm.cc: Update comments about interworking and stub generation.
12361         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
12362         considered as non-PIC.
12363         (Arm_relocate_functions::base_abs): Fix formatting.
12364         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
12365         of function to use GOT entry address instead of offset.
12366         (Target_arm::Scan::global): Issue an error if a symbol would need a
12367         PLT does not get one because it is untyped.  Remove code to create
12368         dynamic symbols for relative branches.
12369         (Target_arm::Relocate::relocate: Use 0 instead of false since function
12370         takes unsigned integer instead of boolean.
12371
12372 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
12373
12374         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
12375         (two_file_test_LDADD): Likewise.
12376         (common_test_1_LDADD): Likewise.
12377         (exception_test_LDADD) Likewise.
12378         (weak_test_LDADD): Likewise.
12379         (many_sections_test_LDADD): Likewise.
12380         (initpri1_LDADD): Likewise.
12381         (script_test_1_LDADD): Likewise.
12382         (script_test_2_LDADD): Likewise.
12383         (justsyms_LDADD): Likewise.
12384         (binary_test_LDADD): Likewise.
12385         (large_LDADD): Likewise.
12386         * testsuite/Makefile.in: Regenerated.
12387
12388 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
12389
12390         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
12391         (Symbol_table::override_with_special): Likewise.
12392         (Symbol_table::add_from_object): Likewise.
12393
12394 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12395
12396         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12397         Don't set the data_offset twice.
12398
12399 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12400
12401         * testsuite/Makefile.in: Regenerate.
12402
12403 2009-12-03  Doug Kwan  <dougkwan@google.com>
12404
12405         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
12406         (Target_arm::do_finalize_sections): Add parameter for symbol table
12407         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
12408         * i386.cc (Target_i386::do_finalize_sections): Add an additional
12409         parameter for symbol table pointer.
12410         * layout.cc (Layout::finalize): Call Target::finalize_sections with
12411         an additional parameter for a pointer to symbol table.
12412         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
12413         parameter for a symbol table pointer.
12414         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
12415         * target.h (Target::finalize_sections, Target::do_finalize_sections):
12416         Ditto.
12417         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
12418         parameter for a symbol table pointer.
12419
12420 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
12421
12422         * incremental.cc (Incremental_inputs_header)
12423         (Incremental_inputs_header_write, Incremental_inputs_entry)
12424         (Incremental_inputs_entry_write): Move ...
12425         * incremental.h (Incremental_inputs_header)
12426         (Incremental_inputs_header_write, Incremental_inputs_entry)
12427         (Incremental_inputs_entry_write): here.
12428
12429 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12430
12431         * incremental.cc (make_sized_incremental_binary): Set the target.
12432         Error if it is incompatible.
12433         * output.h (Output_file): Add filename method.
12434
12435 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12436
12437         * incremental.cc (Incremental_inputs_entry): Remove unused argument
12438         from the get_* methods.
12439
12440 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12441
12442         * incremental-dump.cc (main): Check that the offeset of a script is 0.
12443         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12444         Write 0 for the data_offset of scripts.
12445
12446 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12447
12448         * testsuite/Makefile.am: Add the incremental_test.sh test.
12449         * testsuite/incremental_test.sh: New.
12450         * testsuite/incremental_test_1.c: New.
12451         * testsuite/incremental_test_2.c: New.
12452
12453 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
12454
12455         * incremental-dump.cc (main): Fix typos.
12456
12457 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
12458
12459         PR gold/11025
12460         * incremental-dump.cc (main): Use llu to print 64 bit values.
12461
12462 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
12463             H.J. Lu  <hongjiu.lu@intel.com>
12464
12465         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
12466         $(LIBDL).
12467         (incremental_dump_LDADD): Likewise.
12468         * Makefile.in: Regenerated.
12469
12470 2009-11-25  Doug Kwan  <dougkwan@google.com>
12471
12472         Revert:
12473
12474         2009-11-25  Doug Kwan  <dougkwan@google.com>
12475
12476                 * arm.cc (Target_arm::Target_arm): Move method definition
12477                 outside of class definition.  Add code to handle
12478                 --target1-rel, --target1-abs and --target2= options.
12479                 (Target_arm::get_reloc_reloc_type): Change method to be
12480                 non-static and const.
12481                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
12482                 New data member declaration.
12483                 (Target_arm::Scan::local, Target_arm::Scan::global,
12484                 Target_arm::Relocate::relocate,
12485                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12486                 Adjust call to Target_arm::get_real_reloc_type.
12487                 (Target_arm::get_real_reloc_type): Use command line options
12488                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12489                 * options.h (--target1-rel, --target1-abs, --target2): New
12490                 ARM-only options.
12491
12492 2009-11-25  Doug Kwan  <dougkwan@google.com>
12493
12494         * arm.cc (Target_arm::Target_arm): Move method definition outside of
12495         class definition.  Add code to handle --target1-rel, --target1-abs
12496         and --target2= options.
12497         (Target_arm::get_reloc_reloc_type): Change method to be non-static
12498         and const.
12499         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
12500         member declaration.
12501         (Target_arm::Scan::local, Target_arm::Scan::global,
12502         Target_arm::Relocate::relocate,
12503         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
12504         call to Target_arm::get_real_reloc_type.
12505         (Target_arm::get_real_reloc_type): Use command line options to
12506         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12507         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
12508         options.
12509
12510 2009-11-25  Doug Kwan  <dougkwan@google.com>
12511
12512         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
12513         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
12514         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
12515         formatting.
12516         (Arm_relocate_functions::thm_call): Replace body with a call to
12517         Arm_relocate_functions::thumb_branch_common.
12518         (Arm_relocate_functions::thm_jump24,
12519         Arm_relocate_functions::thm_xpc22): New method definitions.
12520         (Arm_relocate_functions::thumb_branch_common): New method definition.
12521         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
12522         operator.
12523         (Target_arm::Relocate::relocate): Adjust call to thm_call.
12524         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
12525
12526 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12527
12528         * Makefile.am: Build incremental-dump
12529         * Makefile.in: Regenerate.
12530         * incremental-dump.cc: New.
12531         * incremental.cc (Incremental_inputs_header_data,
12532         Incremental_inputs_entry_data): Move to incremental.h
12533         * incremental.h: (Incremental_inputs_header_data,
12534         Incremental_inputs_entry_data): Move from incremental.cc
12535
12536 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12537
12538         * incremental.cc (Incremental_inputs_header,
12539         Incremental_inputs_header_write, Incremental_inputs_entry,
12540         Incremental_inputs_entry_write): Add a typedef with the data type.
12541
12542 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12543
12544         * incremental.cc (Incremental_inputs_header,
12545         Incremental_inputs_header_write, Incremental_inputs_entry,
12546         Incremental_inputs_entry_write): Update comment about which
12547         type has the filed descriptions.
12548
12549 2009-11-15  Doug Kwan  <dougkwan@google.com>
12550
12551         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
12552         (Arm_relocate_functions::arm_branch_common): Change method defintion
12553         in class definition to a method declaration and update list of formal
12554         parameters.
12555         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
12556         Arm_relocation_functions::jump24): Adjust call to
12557         Arm_relocate_functions::arm_branch_common.  Update list of formal
12558         parameters.
12559         (Arm_relocate_functions::xpc25): New method definition.
12560         (Arm_relocate_functions::arm_branch_common): Move method defintion
12561         out from class definition.  Use stubs for mode-switching and extending
12562         branch ranges.
12563         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
12564         specially.  Change code to enable use of stubs in ARM branches.
12565
12566 2009-11-10  Doug Kwan  <dougkwan@google.com>
12567
12568         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
12569         in method declaration.
12570         (Target_arm::relocate_stub): New method declaration.
12571         (Target_arm::default_target): Change to return a pointer instead of
12572         a const reference.
12573         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
12574         Target_arm::default_target.
12575         (Arm_Relobj::do_relocate_sections): Remove options paramater in
12576         method definition.
12577         (Target_arm::relocate_section): Adjust view.
12578         (Target_arm::relocate_stub): New method definition.
12579
12580 2009-11-10  Doug Kwan  <dougkwan@google.com>
12581
12582         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
12583         a format warning.
12584         * incremental.cc (open_incremental_binary): Initialized local
12585         variables to avoid warnings.
12586         * object.cc (make_elf_object): Ditto.
12587         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
12588         a format warning.
12589
12590 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
12591
12592         PR gold/10930
12593         * testsuite/plugin_test.c: Include "config.h".
12594
12595 2009-11-09  Doug Kwan  <dougkwan@google.com>
12596
12597         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
12598         (arm_symbol_value): Remove.
12599         (Arm_relocate_functions::arm_branch_common,
12600         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
12601         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
12602         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
12603         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
12604         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12605         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12606         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12607         Arm_relocate_functions::thm_mobw_abs_nc,
12608         Arm_relocate_functions::thm_mov_abs,
12609         Arm_relocate_functions::movw_prel_nc,
12610         Arm_relocate_functions::thm_movt_abs,
12611         Arm_relocate_functions::movt_prel,
12612         Arm_relocate_functions::thm_movw_prel_nc,
12613         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
12614         (Target_arm::Relocate::relocate): Only decompose address into two
12615         parts if relocation type uses the thumb-bit and pass the actual
12616         bit instead of a flag indicating that the thumb-bit is used.  Adjust
12617         calls to methods in Arm_relocate_functions for this change.
12618
12619 2009-11-08  Ian Lance Taylor  <iant@google.com>
12620
12621         PR 10925
12622         * reloc.cc: Instantiate
12623         Sized_relobj::initialize_input_to_output_maps and
12624         Sized_relobj:free_input_to_output_maps.
12625
12626 2009-11-06  Ian Lance Taylor  <iant@google.com>
12627
12628         PR 10876
12629         * defstd.cc (in_segment): Set only_if_ref true for "end".
12630
12631 2009-11-06  Doug Kwan  <dougkwan@google.com>
12632
12633         * arm.cc (class Reloc_stub): Correct a comment.
12634         (Target_arm::Target_arm): Initialize arm_input_section_map_.
12635         (Target_arm::scan_section_for_stubs): New method declaration.
12636         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
12637         Change methods from private to protected.
12638         (Target_arm::do_may_relax): New method definition.
12639         (Target_arm::do_relax, Target_arm::group_sections,
12640         Target_arm::scan_reloc_for_stub,
12641         Target_arm::scan_reloc_section_for_stubs): New method declarations.
12642         (Target_arm::arm_input_section_map_): New data member declaration.
12643         (Target_arm::scan_reloc_for_stub,
12644         Target_arm::scan_reloc_section_for_stubs,
12645         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
12646         Target_arm::do_relax): New method definitions.
12647
12648 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
12649
12650         * configure.ac: Check for (struct stat)::st_mtim
12651         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
12652         * config.in: Regenerate.
12653         * configure: Regenerate.
12654
12655 2009-11-05  Ian Lance Taylor  <iant@google.com>
12656
12657         PR 10910
12658         * output.cc (Output_segment::add_output_section): Add missing
12659         return statement.
12660
12661 2009-11-04  Ian Lance Taylor  <iant@google.com>
12662
12663         PR 10880
12664         * object.h (class Object): Add is_needed and set_is_needed
12665         methods.  Add is_needed_ field.  Make bool fields into bitfields.
12666         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
12667         defined in a dynamic object and referenced by a regular object,
12668         set is_needed for the dynamic object.
12669         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
12670         if the file is marked with as_needed and it is not needed.
12671
12672 2009-11-04  Ian Lance Taylor  <iant@google.com>
12673
12674         PR 10887
12675         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
12676         tags if data is discarded by linker script.
12677         * i386.cc (Target_i386::do_finalize_sections): Likewise.
12678         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12679         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12680         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12681
12682 2009-11-04  Ian Lance Taylor  <iant@google.com>
12683
12684         * layout.cc (Layout::get_output_section): Add is_interp and
12685         is_dynamic_linker_section parameters.  Change all callers.
12686         (Layout::choose_output_section): Likewise.
12687         (Layout::make_output_section): Likewise.
12688         (Layout::add_output_section_data): Add is_dynamic_linker_section
12689         parameter.  Change all callers.
12690         * layout.h (class Layout): Update declarations.
12691         * output.h (class Output_section): Add is_interp, set_is_interp,
12692         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
12693         Add is_interp_, is_dynamic_linker_section_ fields.  Change
12694         generate_code_fills_at_write_ to a bitfield.
12695         * output.cc (Output_section::Output_sections): Initialize new
12696         fields.
12697         (Output_segment::add_output_section): Add do_sort parameter.
12698         Change all callers.
12699
12700 2009-11-03  Ian Lance Taylor  <iant@google.com>
12701
12702         PR 10860
12703         * options.h (class General_options): Add --warn-common.
12704         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
12705         merging two common symbols.
12706         (Symbol_table::should_override): Handle --warn-common when merging
12707         a common symbol with a defined symbol.  Use report_resolve_problem
12708         for multiple definitions.
12709         (Symbol_table::report_resolve_problem): New function.
12710         * symtab.h (class Symbol_table): Declare report_resolve_problem.
12711
12712 2009-11-03  Doug Kwan  <dougkwan@google.com>
12713
12714         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
12715         stub_factory_.
12716         (Target_arm::stub_factory): New method definition.
12717         (Target_arm::new_arm_input_section,
12718         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
12719         Target_arm::reloc_uses_thumb_bit): New method declarations.
12720         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
12721         New type definitions.
12722         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
12723         member declarations.
12724         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
12725         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
12726         New method definitions.
12727
12728 2009-11-03  Ian Lance Taylor  <iant@google.com>
12729
12730         * options.h (class General_options): Add --warn_constructors.
12731
12732 2009-11-03  Ian Lance Taylor  <iant@google.com>
12733
12734         PR 10893
12735         * defstd.cc (in_section): Add entries for __rel_iplt_start,
12736         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
12737
12738 2009-11-03  Ian Lance Taylor  <iant@google.com>
12739
12740         PR 10895
12741         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
12742         --msgid-bugs-address.
12743         (install-pdf): New target.
12744         (install-data_yes): Look up one directory to find mkinstalldirs.
12745
12746 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
12747
12748         * po/Make-in (.po.gmo): Don't generate .gmo files in source
12749         tree.
12750
12751 2009-10-30  Doug Kwan  <dougkwan@google.com>
12752
12753         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
12754
12755 2009-10-30  Doug Kwan  <dougkwan@google.com>
12756
12757         * arm.cc (Stub_addend_reader): New struct template definition
12758         and partial specializations.
12759         (Stub_addend_reader::operator()): New method definition for a
12760         partially specialized template.
12761
12762 2009-10-30  Doug Kwan  <dougkwan@google.com>
12763
12764         * arm.cc (Arm_relobj::processor_specific_flags): New method
12765         definition.
12766         (Arm_relobj::do_read_symbols): New method declaration.
12767         (Arm_relobj::processor_specific_flags_): New data member declaration.
12768         (Arm_dynobj): New class definition.
12769         (Target_arm::do_finalize_sections): Add input_objects parameter.
12770         (Target_arm::do_adjust_elf_header): New method declaration.
12771         (Target_arm::are_eabi_versions_compatible,
12772         (Target_arm::merge_processor_specific_flags): New method declaration.
12773         (Target_arm::do_make_elf_object): New overloaded method definitions
12774         and declaration.
12775         (Arm_relobj::do_read_symbols): New method definition.
12776         (Arm_dynobj::do_read_symbols): Ditto.
12777         (Target_arm::do_finalize_sections): Add input_objects parameters.
12778         Merge processor-specific flags from all input objects.
12779         (Target_arm::are_eabi_versions_compatible,
12780         Target_arm::merge_processor_specific_flags,
12781         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
12782         New method definitions.
12783         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
12784         Input_objects pointer type parameter.
12785         * layout.cc (Layout::finalize): Pass input objects to target's.
12786         finalize_sections function.
12787         * output.cc (Output_file_header::do_sized_write): Set ELF file
12788         header's processor-specific flags.
12789         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
12790         Input_objects pointer type parameter.
12791         * sparc.cc (Target_sparc::do_finalize_sections): Same.
12792         * target.h (Input_objects): New forward class declaration.
12793         (Target::processor_specific_flags,
12794         Target::are_processor_specific_flags_sect): New method definitions.
12795         (Target::finalize_sections): Add input_objects parameter.
12796         (Target::Target): Initialize processor_specific_flags_ and
12797         are_processor_specific_flags_set_.
12798         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
12799         parameter.
12800         (Target::set_processor_specific_flags): New method definition.
12801         (Target::processor_specific_flags_,
12802         Target::are_processor_specific_flags_set_): New data member
12803         declarations.
12804         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
12805         Input_objects pointer type parameter.
12806
12807 2009-10-30  Doug Kwan  <dougkwan@google.com>
12808
12809         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
12810
12811 2009-10-28  Ian Lance Taylor  <iant@google.com>
12812
12813         * object.h (class Relobj): Drop options parameter from
12814         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
12815         do_scan_relocs, do_relocate.  Change all callers.
12816         (class Sized_relobj): Drop options parameters from
12817         do_gc_process_relocs, do_scan_relocs, do_relocate,
12818         do_relocate_sections, relocate_sections, emit_relocs_scan,
12819         emit_relocs_scan_reltype.  Change all callers.
12820         (struct Relocate_info): Remove options field and all references to
12821         it.
12822         * reloc.h (class Read_relocs): Remove options constructor
12823         parameter and options_ field.  Change all callers.
12824         (class Gc_process_relocs, class Scan_relocs): Likewise.
12825         (class Relocate_task): Likewise.
12826         * target-reloc.h (scan_relocs): Remove options parameter.  Change
12827         all callers.
12828         (scan_relocatable_relocs): Likewise.
12829         * target.h (class Sized_target): Remove options parameter from
12830         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
12831         all callers.
12832         * gc.h (gc_process_relocs): Remove options parameter.  Change all
12833         callers.
12834         * arm.cc: Update functions to remove options parameters.
12835         * i386.cc: Likewise.
12836         * powerpc.cc: Likewise.
12837         * sparc.cc: Likewise.
12838         * x86_64.cc: Likewise.
12839         * testsuite/testfile.cc: Likewise.
12840
12841 2009-10-28  Doug Kwan  <dougkwan@google.com>
12842
12843         * arm.cc (Arm_relobj): New class definition.
12844         (Arm_relobj::scan_sections_for_stubs,
12845         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
12846         New method definitions.
12847
12848 2009-10-28  Cary Coutant  <ccoutant@google.com>
12849
12850         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
12851         (Plugin::cleanup_done_): New member.
12852         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
12853         (Plugin_manager::cleanup_done_): Remove.
12854         (Plugin_manager::add_input_file): Edit error message.
12855         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
12856         (Plugin_manager::cleanup): Remove use of cleanup_done_.
12857
12858 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
12859
12860         * fileread.cc: (File_read::View::~View): Use the new
12861         data_ownership_ filed.
12862         (File_read::~File_read): Dispose the new whole_file_view_.
12863         (File_read::open): Mmap the whole file if needed.
12864         (File_read::open): Use whole_file_view_ instead of contents_.
12865         (File_read::find_view): Use whole_file_view_ if applicable.
12866         (File_read::do_read): Use whole_file_view_ instead of contents_.
12867         (File_read::make_view): Use whole_file_view_ instead of contents_,
12868         update File_read::View::View call.
12869         (File_read::find_or_make_view): Update File_read::View::View
12870         call.
12871         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
12872         remove contents_
12873         (File_read::View::Data_ownership): New enum.
12874         (File_read::View::View): Replace bool mapped_ with Data_ownership
12875         argument.
12876         (File_read::View::mapped_): Remove (replaced by data_ownership_).
12877         (File_read::View::data_ownership_): New field.
12878         (File_read::contents_): Remove (replaced by whole_file_view_).
12879         (File_read::whole_file_view_): New field.
12880         * options.h (class General_options): Add --keep-files-mapped.
12881
12882 2009-10-27  Cary Coutant  <ccoutant@google.com>
12883
12884         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
12885         * testsuite/Makefile.am (plugin_test_5): New test case.
12886         * testsuite/Makefile.in: Regenerate.
12887
12888 2009-10-25  Doug Kwan  <dougkwan@google.com>
12889
12890         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
12891         from private to protected to allow access by child class.
12892         (Sized_relobj::do_relocate_sections): New method declaration.
12893         (Sized_relobj::relocate_sections): Virtualize.
12894         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
12895         Sized_relobj::relocate_sections.  Instantiate template explicitly
12896         for different target sizes and endianity.
12897
12898 2009-10-24  Doug Kwan  <dougkwan@google.com>
12899
12900         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
12901         (Arm_input_section::as_arm_input_section): New method.
12902         (Arm_output_section): New class definition.
12903         (Arm_output_section::create_stub_group,
12904         Arm_output_section::group_sections): New method definitions.
12905
12906 2009-10-22  Doug Kwan  <dougkwan@google.com>
12907
12908         * arm.cc (Arm_input_section): New class definition.
12909         (Arm_input_section::init, Arm_input_section:do_write,
12910         Arm_input_section::set_final_data_size,
12911         Arm_input_section::do_reset_address_and_file_offset): New method
12912         definitions.
12913
12914 2009-10-21  Doug Kwan  <dougkwan@google.com>
12915
12916         * arm.cc (Stub_table, Arm_input_section): New forward class
12917         declarations.
12918         (Stub_table): New class defintion.
12919         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
12920         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
12921         New method definition.
12922
12923 2009-10-21  Doug Kwan  <dougkwan@google.com>
12924
12925         * arm.cc: Update copyright comments.
12926         (Target_arm): New forward class template declaration.
12927         (Arm_address): New type.
12928         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
12929         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
12930         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
12931         constants.
12932         (Insn_template): Same.
12933         (DEF_STUBS): New macro.
12934         (Stub_type): New enum type.
12935         (Stub_template): New class definition.
12936         (Stub): Same.
12937         (Reloc_stub): Same.
12938         (Stub_factory): Same.
12939         (Target_arm::Target_arm): Initialize may_use_blx_ and
12940         should_force_pic_veneer_.
12941         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
12942         Target_arm::should_force_pic_veneer,
12943         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
12944         Target_arm::using_thumb_only, Target_arm:;default_target): New
12945         method defintions.
12946         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
12947         New data member declarations.
12948         (Insn_template::size, Insn_template::alignment): New method defintions.
12949         (Stub_template::Stub_template): New method definition.
12950         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
12951         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
12952         (Stub_factory::Stub_factory): New method definition.
12953         * gold.h (string_hash): New template.
12954         * output.h (Input_section_specifier::hash_value): Use
12955         gold::string_hash.
12956         (Input_section_specifier::string_hash): Remove.
12957         * stringpool.cc (Stringpool_template::string_hash): Use
12958         gold::string_hash.
12959
12960 2009-10-20  Doug Kwan  <dougkwan@google.com>
12961
12962         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
12963         symbols of relaxed input sections.
12964         * output.h (Output_section::find_relaxed_input_section): Make
12965         method public.
12966
12967 2009-10-16  Doug Kwan  <dougkwan@google.com>
12968
12969         * dynobj.cc (Versions::Versions): Initialize version_script_.
12970         Only insert base version symbol definition for a shared object
12971         if version script defines any version versions.
12972         (Versions::define_base_version): New method definition.
12973         (Versions::add_def): Check that base version is not needed.
12974         (Versions::add_need): Define base version lazily.
12975         * dynobj.h (Versions::define_base_version): New method declaration.
12976         (Versions::needs_base_version_): New data member declaration.
12977         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
12978         (check_DATA): Add no_version_test.stdout.
12979         (libno_version_test.so, no_version_test.o no_version_test.stdout):
12980         New make rules.
12981         * testsuite/Makefile.in: Regenerate.
12982         * testsuite/no_version_test.c: New file.
12983         * testsuite/no_version_test.sh: Ditto.
12984
12985 2009-10-16  Doug Kwan  <dougkwan@google.com>
12986
12987         * expression.cc (class Segment_start_expression): New class definition.
12988         (Segment_start_expression::value): New method definition.
12989         (script_exp_function_segment_start): Return a new
12990         Segment_start_expression.
12991         * gold/script-c.h (script_saw_segment_start_expression): New function
12992         prototype.
12993         * script-sections.cc (Script_sections::Script_sections): Initialize
12994         SAW_SEGMENT_START_EXPRESSION_ to false.
12995         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
12996         and -Tbbs options to specify section addresses if given in
12997         command line and no SEGMENT_START expression is seen in a script.
12998         * script-sections.h (Script_sections::saw_segment_start_expression,
12999         Script_sections::set_saw_segment_start_expression): New method
13000         definition.
13001         (Script_sections::saw_segment_start_expression_): New data member
13002         declaration.
13003         * script.cc (script_saw_segment_start_expression): New function.
13004         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
13005         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
13006         script_test_7.sh and script_test_8.sh.
13007         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
13008         script_test_8.stdout.
13009         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
13010         (script_test_6, script_test_6.stdout, script_test_7,
13011         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
13012         * Makefile.in: Regenerate.
13013         * testsuite/script_test_6.sh: New file.
13014         * testsuite/script_test_6.t: Same.
13015         * testsuite/script_test_7.sh: Same.
13016         * testsuite/script_test_7.t: Same.
13017         * testsuite/script_test_8.sh: Same.
13018
13019 2009-10-16  Doug Kwan  <dougkwan@google.com>
13020
13021         * output.cc (Output_segment::set_section_list_address): Cast
13022         expressions to unsigned long long type to avoid format warnings.
13023
13024 2009-10-15  Ian Lance Taylor  <iant@google.com>
13025
13026         * script.cc (Script_options::add_symbol_assignment): Always add a
13027         dot assignment to script_sections_.
13028         * script-sections.cc (Script_sections::add_dot_assignment):
13029         Initialize if necessary.
13030
13031         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
13032         program headers with no load segment if there is a linker script.
13033
13034         * layout.cc (Layout::set_segment_offsets): Align the file offset
13035         to the segment aligment for -N or -n with no load segment.
13036         * output.cc (Output_segment::add_output_section): Don't crash if
13037         the first section is a TLS section.
13038         (Output_segment::set_section_list_addresses): Print an error
13039         message if the address moves backward in a linker script.
13040         * script-sections.cc
13041         (Output_section_element_input::set_section_addresses): Don't
13042         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
13043         (Orphan_output_section::set_section_addresses): Likewise.
13044
13045 2009-10-15  Doug Kwan  <dougkwan@google.com>
13046
13047         * layout.cc (Layout::finish_dynamic_section): Generate tags
13048         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
13049         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
13050         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
13051
13052 2009-10-14  Ian Lance Taylor  <iant@google.com>
13053
13054         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
13055         fields.
13056         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
13057         data_shdr fields of relinfo.
13058         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
13059         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
13060         R_386_TLS_LDO_32, adjust based on section flags.
13061         (Target_i386::Relocate::fix_up_ldo): Remove.
13062
13063 2009-10-13  Ian Lance Taylor  <iant@google.com>
13064
13065         Add support for -pie.
13066         * options.h (class General_options): Add -pie and
13067         --pic-executable.
13068         (General_options::output_is_position_independent): Test -pie.
13069         (General_options::output_is_executable): Return true if not shared
13070         and not relocatable.
13071         (General_options::output_is_pie): Remove.
13072         * options.cc (General_options::finalize): Reject incompatible uses
13073         of -pie.
13074         * gold.cc (queue_middle_tasks): A -pie link is not static.
13075         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
13076         * symtab.cc (Symbol::final_value_is_known): Return false if
13077         output_is_position_independent.
13078         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
13079         output_is_position_independent.
13080         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
13081         output_is_position_independent.
13082         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
13083         output_is_position_independent.
13084         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
13085         two_file_pie_test.
13086         (basic_pie_test.o, basic_pie_test): New targets.
13087         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
13088         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
13089         (two_file_pie_test): New target.
13090         * testsuite/Makefile.in: Rebuild.
13091         * README: Remove note saying that -pie is not supported.
13092
13093 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
13094
13095         * options.h (class General_options): Add -init and -fini.
13096         * layout.cc (Layout::finish_dynamic_section): Emit
13097         given init and fini functions.
13098
13099 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
13100
13101         * gc.h (gc_process_relocs): Check if icf is enabled using new
13102         function.
13103         * gold.cc (queue_initial_tasks): Likewise.
13104         (queue_middle_tasks): Likewise.
13105         * object.cc (do_layout): Likewise.
13106         * symtab.cc (is_section_folded): Likewise.
13107         * main.cc (main): Likewise.
13108         * reloc.cc (Read_relocs::run): Likewise.
13109         (Sized_relobj::do_scan_relocs): Likewise.
13110         * icf.cc (is_function_ctor_or_dtor): New function.
13111         (Icf::find_identical_sections): Check if function is ctor or dtor when
13112         safe icf is chosen.
13113         * options.h (General_options::icf): Change option to be an enum.
13114         (Icf_status): New enum.
13115         (icf_enabled): New method.
13116         (icf_safe_folding): New method.
13117         (set_icf_status): New method.
13118         (icf_status_): New variable.
13119         * (options.cc) (General_options::finalize): Set icf_status_.
13120         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
13121         icf_test and icf_keep_unique_test to use the --icf enum flag.
13122         * testsuite/icf_safe_test.sh: New file.
13123         * testsuite/icf_safe_test.cc: New file.
13124
13125 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
13126
13127         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
13128         includes to gc.h and icf.h.
13129         * arm.cc: Include gc.h.
13130         * gold.cc: Likewise.
13131         * i386.cc: Likewise.
13132         * powerpc.cc: Likewise.
13133         * sparc.cc: Likewise.
13134         * x86_64.cc: Likewise.
13135         * gc.h: Include icf.h.
13136
13137 2009-10-11  Ian Lance Taylor  <iant@google.com>
13138
13139         * plugin.cc: Include "gold.h" before other header files.
13140
13141 2009-10-10  Chris Demetriou  <cgd@google.com>
13142
13143         * options.h (Input_file_argument::Input_file_type): New enum.
13144         (Input_file_argument::is_lib_): Replace with...
13145         (Input_file_argument::type_): New member.
13146         (Input_file_argument::Input_file_argument): Take Input_file_type
13147         'type' rather than boolean 'is_lib' as second argument.
13148         (Input_file_argument::is_lib): Use type_.
13149         (Input_file_argument::is_searched_file): New function.
13150         (Input_file_argument::may_need_search): Handle is_searched_file.
13151         * options.cc (General_options::parse_library): Support -l:filename.
13152         (General_options::parse_just_symbols): Update for Input_file_argument
13153         changes.
13154         (Command_line::process): Likewise.
13155         * archive.cc (Archive::get_file_and_offset): Likewise.
13156         * plugin.cc (Plugin_manager::release_input_file): Likewise.
13157         * script.cc (read_script_file, script_add_file): Likewise.
13158         * fileread.cc (Input_file::Input_file): Likewise.
13159         (Input_file::will_search_for): Handle is_searched_file.
13160         (Input_file::open): Likewise.
13161         * readsyms.cc (Read_symbols::get_name): Likewise.
13162         * testsuite/Makefile.am (searched_file_test): New test.
13163         * testsuite/Makefile.in: Regenerate.
13164         * testsuite/searched_file_test.cc: New file.
13165         * testsuite/searched_file_test_lib.cc: New file.
13166
13167 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13168             Ian Lance Taylor  <iant@google.com>
13169
13170         * descriptor.cc: Include <cstdio> and "binary-io.h".
13171         (Descriptors::open): Open the files in binary mode always.
13172         * script.cc (Lex::get_token): Treat \r as whitespace.
13173
13174 2009-10-09  Ian Lance Taylor  <iant@google.com>
13175
13176         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
13177
13178 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13179             Ian Lance Taylor  <iant@google.com>
13180
13181         * configure.ac: Check for readv function also.
13182         * fileread.cc (readv): Define if not HAVE_READV.
13183         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
13184         does not exist.
13185         * config.in: Regenerate.
13186         * configure: Regenerate.
13187
13188 2009-10-09  Doug Kwan  <dougkwan@google.com>
13189
13190         * layout.cc (Layout::make_output_section): Call target hook to make
13191         ordinary output section.
13192         (Layout::finalize): Adjust parameter list of call the
13193         Target::may_relax().
13194         * layout.h (class Layout::section_list): New method.
13195         * merge.h (Output_merge_base::entsize): Change visibility to public.
13196         (Output_merge_base::is_string, Output_merge_base::do_is_string):
13197         New methods.
13198         (Output_merge_string::do_is_string): New method.
13199         * object.cc (Sized_relobj::do_setup): renamed from
13200         Sized_relobj::set_up.
13201         * object.h (Sized_relobj::adjust_shndx,
13202         Sized_relobj::initializ_input_to_output_maps,
13203         Sized_relobj::free_input_to_output_maps): Change visibilities to
13204         protected.
13205         (Sized_relobj::setup): Virtualize.
13206         (Sized_relobj::do_setup): New method declaration.
13207         (Sized_relobj::invalidate_section_offset,
13208         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
13209         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
13210         * options.cc (parse_int): New function.
13211         * options.h (parse_int): New declaration.
13212         (DEFINE_int): New macro.
13213         (stub_group_size): New option.
13214         * output.cc (Output_section::Output_section): Initialize memebers
13215         merge_section_map_, merge_section_by_properties_map_,
13216         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
13217         (Output_section::add_input_section): Handled deferred code-fill
13218         generation and remove an old comment.
13219         (Output_section::add_relaxed_input_section): New method definition.
13220         (Output_section::add_merge_input_section): Use merge section by
13221         properties map to speed to search.  Update merge section maps
13222         as appropriate.
13223         (Output_section::build_relaxation_map): New method definition.
13224         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
13225         Same.
13226         (Output_section::relax_input_section): Renamed to
13227         Output_section::convert_input_sections_to_relaxed_sections and change
13228         interface to take a vector of pointers to relaxed sections.
13229         (Output_section::find_merge_section,
13230         Output_section::find_relaxed_input_section): New method definitions.
13231         (Output_section::is_input_address_mapped,
13232         Output_section::output_offset, Output_section::output_address):
13233         Use output section data maps to speed up searching.
13234         (Output_section::find_starting_output_address): Add comments.
13235         (Output_section::do_write,
13236         Output_section::write_to_postprocessing_buffer): Do code-fill
13237         generation as appropriate.
13238         (Output_section::get_input_sections): Invalidate relaxed input section
13239         map.
13240         (Output_section::restore_states): Adjust type of checkpoint .
13241         Invalidate relaxed input section map.
13242         * output.h (Output_merge_base): New class declaration.
13243         (Input_section_specifier): New class defintion.
13244         (class Output_relaxed_input_section) Change base class to
13245         Output_section_data_build.
13246         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
13247         base class initializer.
13248         (Output_section::add_relaxed_input_section): New method declaration.
13249         (Output_section::Input_section): Change visibility to protected.
13250         (Output_section::Input_section::relobj,
13251         Output_section::Input_section::shndx): Handle relaxed input sections.
13252         Output_section::input_sections) Change visibility to protected.  Also
13253         define overload to return a non-const pointer.
13254         (Output_section::Merge_section_properties): New class defintion.
13255         (Output_section::Merge_section_by_properties_map,
13256         Output_section::Output_section_data_by_input_section_map,
13257         Output_section::Relaxation_map): New types.
13258         (Output_section::relax_input_section): Rename method to
13259         Output_section::convert_input_sections_to_relaxed_sections and change
13260         interface to take a vector of relaxed section pointers.
13261         (Output_section::find_merge_section,
13262         Output_section::find_relaxed_input_section,
13263         Output_section::build_relaxation_map,
13264         Output_section::convert_input_sections_in_list_to_relaxed_sections):
13265         New method declarations.
13266         (Output_section::merge_section_map_
13267         Output_section::merge_section_by_properties_map_,
13268         Output_section::relaxed_input_section_map_,
13269         Output_section::is_relaxed_input_section_map_valid_,
13270         Output_section::generate_code_fills_at_write_): New data members.
13271         * script-sections.cc
13272         (Output_section_element_input::set_section_addresses): Call
13273         current_data_size and addralign methods of relaxed input sections.
13274         (Orphan_output_section::set_section_addresses): Call current_data_size
13275         and addralign methods of relaxed input sections.
13276         * symtab.cc (Symbol_table::compute_final_value): Extract template
13277         from the body of Symbol_table::sized_finalize_symbol.
13278         (Symbol_table::sized_finalized_symbol): Call
13279         Symbol_table::compute_final_value.
13280         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
13281         (Symbol_table::compute_final_value): New templated method declaration.
13282         * target.cc (Target::do_make_output_section): New method defintion.
13283         * target.h (Target::make_output_section): New method declaration.
13284         (Target::relax): Add more parameters for input objects, symbol table
13285         and layout.  Adjust call to do_relax.
13286         (Target::do_make_output_section): New method declaration.
13287         (Target::do_relax): Add parameters for input objects, symbol table
13288         and layout.
13289
13290 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13291
13292         * pread.c: Include stdio.h.
13293
13294 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13295
13296         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
13297         defined.
13298
13299 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13300
13301         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
13302         Change read_shndx type to unsigned int.
13303         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13304         int.
13305         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13306         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
13307         Change read_shndx type to unsigned int.
13308         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13309         int.
13310         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13311         * layout.cc (Layout::create_symtab_sections): Cast the result of
13312         local_symcount * symsize to off_t in the gold_assert.
13313
13314 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13315
13316         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
13317         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
13318         R_ARM_BASE_ABS.
13319         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
13320         (Arm_relocate_functions::thm_abs5): New function.
13321         (Arm_relocate_functions::abs12): New function.
13322         (Arm_relocate_functions::abs16): New function.
13323         (Arm_relocate_functions::base_abs): New function.
13324         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
13325         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
13326         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
13327         R_ARM_BASE_ABS.
13328         (Scan::global): Likewise.
13329         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
13330         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
13331         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
13332         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
13333         R_ARM_BASE_ABS.
13334
13335 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13336
13337         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
13338         (Arm_relocate_functions::movt_prel): New function.
13339         (Arm_relocate_functions::thm_movw_prel_nc): New function.
13340         (Arm_relocate_functions::thm_movt_prel): New function.
13341         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
13342         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
13343         (Scan::global, Relocate::relocate): Likewise.
13344         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13345
13346 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13347
13348         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
13349         Incremental_checker.
13350         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
13351         unsigned int.
13352         (class Incremental_inputs_header): New class.
13353         (Incremental_inputs_header_writer): Edit comment.
13354         (Incremental_inputs_entry): New class.
13355         (Incremental_inputs_entry_writer): Edit comment.
13356         (Sized_incremental_binary::do_find_incremental_inputs_section):
13357         Add *strtab_shndx parameter, fill it.
13358         (Sized_incremental_binary::do_check_inputs): New method.
13359         (Incremental_checker::can_incrementally_link_output_file): Use
13360         Sized_incremental_binary::check_inputs.
13361         (Incremental_inputs::report_command_line): Save command line in
13362         command_line_.
13363         * incremental.h:
13364         (Incremental_binary::find_incremental_inputs_section): New
13365         method.
13366         (Incremental_binary::do_find_incremental_inputs_section): Add
13367         strtab_shndx parameter.
13368         (Incremental_binary::do_check_inputs): New pure virtual method.
13369         (Sized_incremental_binary::do_check_inputs): Declare.
13370         (Incremental_checker::Incremental_checker): Add incremental_inputs
13371         parameter, use it to initialize incremental_inputs_.
13372         (Incremental_checker::incremental_inputs_): New field.
13373         (Incremental_checker::command_line): New method.
13374         (Incremental_checker::inputs): New method.
13375         (Incremental_checker::command_line_): New field.
13376
13377 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13378
13379         * incremental.cc: Include <cstdarg> and "target-select.h".
13380         (vexplain_no_incremental): New function.
13381         (explain_no_incremental): New function.
13382         (Incremental_binary::error): New method.
13383         (Sized_incremental_binary::do_find_incremental_inputs_section): New
13384         method.
13385         (make_sized_incremental_binary): New function.
13386         (open_incremental_binary): New function.
13387         (can_incrementally_link_file): Add checks if output is ELF and has
13388         inputs section.
13389         * incremental.h: Include "elfcpp_file.h" and "output.h".
13390         (Incremental_binary): New class.
13391         (Sized_incremental_binary): New class.
13392         (open_incremental_binary): Declare.
13393         * object.cc (is_elf_object): Use
13394         elfcpp::Elf_recognizer::is_elf_file.
13395         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
13396         * output.h (Output_file::filesize): New method.
13397
13398 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13399
13400         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
13401         New function.
13402         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
13403         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
13404         function.
13405         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
13406         function.
13407         (Arm_relocate_functions::movw_abs_nc): New function.
13408         (Arm_relocate_functions::movt_abs): New function.
13409         (Arm_relocate_functions::thm_movw_abs_nc): New function.
13410         (Arm_relocate_functions::thm_movt_abs): New function.
13411         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
13412         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
13413         (Scan::global): Likewise.
13414         (Relocate::relocate): Likewise.
13415         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13416
13417 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13418
13419         * arm.cc (Arm_relocate_functions::got_prel) New function.
13420         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
13421         (Relocate::relocate): Likewise.
13422         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13423
13424 2009-10-06  Ian Lance Taylor  <iant@google.com>
13425
13426         * options.h (class General_options): Define
13427         split_stack_adjust_size parameter.
13428         * object.h (class Object): Add uses_split_stack_ and
13429         has_no_split_stack_ fields.  Add uses_split_stack and
13430         has_no_split_stack accessor functions.  Declare
13431         handle_split_stack_section.
13432         (class Reloc_symbol_changes): Define.
13433         (class Sized_relobj): Define Function_offsets.  Declare
13434         split_stack_adjust, split_stack_adjust_reltype, and
13435         find_functions.
13436         * object.cc (Object::handle_split_stack_section): New function.
13437         (Sized_relobj::do_layout): Call handle_split_stack_section.
13438         * dynobj.cc (Sized_dynobj::do_layout): Call
13439         handle_split_stack_section.
13440         * reloc.cc (Sized_relobj::relocate_sections): Call
13441         split_stack_adjust for executable sections in split_stack
13442         objects.  Pass reloc_map to relocate_section.
13443         (Sized_relobj::split_stack_adjust): New function.
13444         (Sized_relobj::split_stack_adjust_reltype): New function.
13445         (Sized_relobj::find_functions): New function.
13446         * target-reloc.h: Include "object.h".
13447         (relocate_section): Add reloc_symbol_changes parameter.  Change
13448         all callers.
13449         * target.h (class Target): Add calls_non_split method.  Declare
13450         do_calls_non_split virtual method.  Declare match_view and
13451         set_view_to_nop.
13452         * target.cc: Include "elfcpp.h".
13453         (Target::do_calls_non_split): New function.
13454         (Target::match_view): New function.
13455         (Target::set_view_to_nop): New function.
13456         * gold.cc (queue_middle_tasks): Give an error if mixing
13457         split-stack and non-split-stack objects with -r.
13458         * i386.cc (Target_i386::relocate_section): Add
13459         reloc_symbol_changes parameter.
13460         (Target_i386::do_calls_non_split): New function.
13461         * x86_64.cc (Target_x86_64::relocate_section): Add
13462         reloc_symbol_changes parameter.
13463         (Target_x86_64::do_calls_non_split): New function.
13464         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
13465         parameter.
13466         * powerpc.cc (Target_powerpc::relocate_section): Add
13467         reloc_symbol_changes parameter.
13468         * sparc.cc (Target_sparc::relocate_section): Add
13469         reloc_symbol_changes parameter.
13470         * configure.ac: Call AM_CONDITIONAL for the default target.
13471         * configure: Rebuild.
13472         * testsuite/Makefile.am (TEST_AS): New variable.
13473         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
13474         (check_DATA): Add split_i386 and split_x86_64 files.
13475         (SPLIT_DEFSYMS): Define.
13476         (split_i386_[1234n].o): New targets.
13477         (split_i386_[124]): New targets.
13478         (split_i386_[1234r].stdout): New targets.
13479         (split_x86_64_[1234n].o): New targets.
13480         (split_x86_64_[124]): New targets.
13481         (split_x86_64_[1234r].stdout): New targets.
13482         (MOSTLYCLEANFILES): Add new executables.
13483         * testsuite/split_i386.sh: New file.
13484         * testsuite/split_x86_64.sh: New file.
13485         * testsuite/split_i386_1.s: New file.
13486         * testsuite/split_i386_2.s: New file.
13487         * testsuite/split_i386_3.s: New file.
13488         * testsuite/split_i386_4.s: New file.
13489         * testsuite/split_i386_n.s: New file.
13490         * testsuite/split_x86_64_1.s: New file.
13491         * testsuite/split_x86_64_2.s: New file.
13492         * testsuite/split_x86_64_3.s: New file.
13493         * testsuite/split_x86_64_4.s: New file.
13494         * testsuite/split_x86_64_n.s: New file.
13495         * testsuite/testfile.cc (Target_test): Update relocation_section
13496         function.
13497         * testsuite/Makefile.in: Rebuild.
13498
13499 2009-10-06  Ian Lance Taylor  <iant@google.com>
13500
13501         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
13502         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
13503         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
13504         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
13505         the address on ldo_addrs_.
13506         (Target_i386::Relocate::fix_up_ldo): New function.
13507
13508 2009-10-06   Rafael Espindola  <espindola@google.com>
13509
13510         * plugin.cc (add_input_library): New.
13511         (Plugin::load): Add add_input_library to tv.
13512         (Plugin_manager::add_input_file): Add the is_lib argument.
13513         (add_input_file): Update call to Plugin_manager::add_input_file.
13514         (add_input_library): New.
13515         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
13516
13517 2009-09-30  Doug Kwan  <dougkwan@google.com>
13518
13519         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
13520         symbol and call Symbol::may_need_copy_reloc to determine if
13521         a copy reloc is needed.
13522         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
13523         nocopyreloc is given in command line.
13524         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
13525         given in command line.
13526         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
13527         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
13528         of the removed Target_i386::may_need_copy_reloc.
13529         * options.h (copyreloc): New option with default value false.
13530         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13531         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
13532         instead of the removed Target_powerpc::may_need_copy_reloc.
13533         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13534         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
13535         instead of the removed Target_sparc::may_need_copy_reloc.
13536         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
13537         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
13538         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
13539         instead of the removed Target_x86_64::may_need_copy_reloc.
13540
13541 2009-09-30  Ian Lance Taylor  <iant@google.com>
13542
13543         * object.h (class Object): Remove target_ field, and target,
13544         sized_target, and set_target methods.
13545         (Object::sized_target): Remove.
13546         (class Sized_relobj): Update declarations.  Remove sized_target.
13547         * object.cc (Sized_relobj::setup): Remove target parameter.
13548         Change all callers.
13549         (Input_objects::add_object): Don't do anything with the target.
13550         (make_elf_sized_object): Add punconfigured parameter.  Change all
13551         callers.  Set or test parameter target.
13552         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
13553         Change all callers.
13554         * parameters.cc (Parameters::set_target): Change parameter type to
13555         be non-const.
13556         (Parameters::default_target): Remove.
13557         (set_parameters_target): Change parameter type to be non-const.
13558         (parameters_force_valid_target): New function.
13559         (parameters_clear_target): New function.
13560         * parameters.h (class Parameters): Update declarations.  Remove
13561         default_target method.  Add sized_target and clear_target
13562         methods.  Change target_ to be non-const.
13563         (set_parameters_target): Update declaration.
13564         (parameters_force_valid_target): Declare.
13565         (parameters_clear_target): Declare.
13566         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
13567         as NULL if we aren't searching.
13568         (Add_symbols::run): Don't check for compatible target.
13569         * fileread.cc (Input_file::open_binary): Call
13570         parameters_force_valid_target.
13571         * gold.cc (queue_middle_tasks): Likewise.
13572         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
13573         set_target on object.
13574         * dynobj.h (class Sized_dynobj): Update declarations.
13575         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
13576         make_elf_object returns NULL.
13577         (Archive::include_member): Don't check whether object target is
13578         compatible.
13579         * output.cc (Output_section::add_input_section): Get target from
13580         parameters.
13581         (Output_section::relax_input_section): Likewise.
13582         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
13583         parameters.
13584         (Sized_relobj::do_scan_relocs): Likewise.
13585         (Sized_relobj::relocate_sections): Likewise.
13586         * resolve.cc (Symbol_table::resolve): Likewise.
13587         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
13588         parameter.  Change all callers.
13589         (Symbol_table::add_from_object): Get target from parameters.
13590         (Symbol_table::add_from_relobj): Don't check object target.
13591         (Symbol_table::add_from_dynobj): Likewise.
13592         (Symbol_table::define_special_symbol): Get target from
13593         parameters.
13594         * symtab.h (class Symbol_table): Update declaration.
13595         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
13596         parameter.  Change all callers.  Clear parameter target.
13597         (Binary_test): Test target here.
13598         * testsuite/object_unittest.cc (gold_testsuite): Remove
13599         target_test_pointer parameter.  Change all callers.
13600         (Object_test): Test target here.
13601
13602 2009-09-26  Ian Lance Taylor  <iant@google.com>
13603
13604         * testsuite/initpri1.c: Don't try to use constructor priorities if
13605         compiling with gcc before 4.3.
13606
13607 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
13608
13609         * testsuite/retain_symbols_file_test.sh (check_present): Change
13610         output file name to retain_symbols_file_test.stdout.
13611         (check_absent): Likewise.
13612
13613 2009-09-18  Craig Silverstein  <csilvers@google.com>
13614
13615         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
13616         * options.cc: Include <cerrno> and <fstream>.
13617         (General_options::finalize): Parse -retain-symbols-file tag.
13618         * options.h: New flag.
13619         (General_options): New method should_retain_symbol, new
13620         variable symbols_to_retain.
13621         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
13622         should_retain_symbol map.
13623         * testsuite/Makefile.am (retain_symbols_file_test): New test.
13624         * testsuite/Makefile.in: Regenerate.
13625         * testsuite/retain_symbols_file_test.sh: New file.
13626
13627 2009-09-18  Nick Clifton  <nickc@redhat.com>
13628
13629         * po/es.po: Updated Spanish translation.
13630
13631 2009-09-17  Doug Kwan  <dougkwan@google.com>
13632
13633         * debug.h (DEBUG_RELAXATION): New constant.
13634         (DEBUG_ALL): Add DEBUG_RELAXATION.
13635         (debug_string_to_enum): Add relaxation debug option.
13636         * layout.cc
13637         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
13638         Layout::Relaxation_debug_check::read_sections,
13639         Layout::Relaxation_debug_check::read_sections): New method definitions.
13640         (Layout::Layout): Initialize data members
13641         record_output_section_data_from_scrips_,
13642         script_output_section_data_list_ and relaxation_debug_check_.
13643         (Layout::save_segments, Layout::restore_segments,
13644         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13645         Layout::relaxation_loop_body): New method definitions.
13646         (Layout::finalize): Support relaxation.  Move section layout code to
13647         Layout::relaxation_loop_body.
13648         (Layout::set_asection_address_from_script): Move code for orphan
13649         section placement out.
13650         (Layout::place_orphan_sections_in_script): New method definition.
13651         * layout.h (Output_segment_headers, Output_file_header):
13652         New forward class declarations.
13653         (Layout::~Layout): Define.
13654         (Layout::new_output_section_data_from_script): New method definition.
13655         (Layout::place_orphan_sections_in_script): New method declaration.
13656         (Layout::Segment_states): New type declaration.
13657         (Layout::save_segments, Layout::restore_segments,
13658         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13659         Layout::relaxation_loop_body): New method declarations.
13660         (Layout::Output_section_data_list): New type declaration.
13661         (Layout::Relaxation_debug_check): New class definition.
13662         (Layout::record_output_section_data_from_script_,
13663         Layout::script_output_section_data_list_, Layout::segment_states_,
13664         Layout::relaxation_debug_check_): New data members.
13665         * output.cc: (Output_section_headers::do_size): New method definition.
13666         (Output_section_headers::Output_section_headers): Move size
13667         computation to Output_section_headers::do_size.
13668         (Output_segment_headers::do_size): New method definition.
13669         (Output_file_header::Output_file_header): Move size computation to
13670         Output_file_header::do_size and call it.
13671         (Output_file_header::do_size): New method definition.
13672         (Output_data_group::Output_data_group): Adjust call to
13673         Output_section_data.
13674         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
13675         (Output_symtab_xindex::do_write): Add array bound check.
13676         (Output_section::Input_section::print_to_mapfile): Handle
13677         RELAXED_INPUT_SECTION_CODE.
13678         (Output_section::Output_section): Initialize data member checkpoint_.
13679         (Output_section::~Output_section): Delete checkpoint object pointed
13680         by checkpoint_.
13681         (Output_section::add_input_section): Always add an Input_section if
13682         relaxing.
13683         (Output_section::add_merge_input_section): Add assert.
13684         (Output_section::relax_input_section): New method definition.
13685         (Output_section::set_final_data_size): Set load address to zero for
13686         an unallocated section.
13687         (Output_section::do_address_and_file_offset_have_reset_values):
13688         New method definition.
13689         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
13690         Handle relaxed input section.
13691         (Output_section::sort_attached_input_sections): Checkpoint input
13692         section list lazily.
13693         (Output_section::get_input_sections): Change type of input_sections to
13694         list of Simple_input_section pointers.  Checkpoint input section list
13695         lazily.  Also handle relaxed input sections.
13696         (Output_section::add_input_section_for_script): Take a reference to
13697         a Simple_input_section object instead of Relobj pointer and section
13698         index as parameter.  Handle relaxed input sections.
13699         (Output_section::save_states, Output_section::restore_states): New
13700         method definitions.
13701         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
13702         (Output_data::is_data_size_fixed): New method definition.
13703         (Output_data::reset_addresss_and_file_offset): Do not reset data size
13704         if it is fixed.
13705         (Output_data::address_and_file_offset_have_reset_values): New method
13706         definition.
13707         (Output_data::do_address_and_file_offset_have_reset_values): New method
13708         definition.
13709         (Output_data::set_data_size): Check that data size is not fixed.
13710         (Output_data::fix_data_size): New method definition.
13711         (Output_data::is_data_size_fixed_): New data member.
13712         (Output_section_headers::set_final_data_size): New method definition.
13713         (Output_section_headers::do_size): New method declaration.
13714         (Output_segment_headers::set_final_data_size): New method definition.
13715         (Output_segment_headers::do_size): New method declaration.
13716         (Output_file_header::set_final_data_size)::New method definition.
13717         (Output_file_header::do_size)::New method declaration.
13718         (Output_section_data::Output_section_data): Add new parameter
13719         is_data_size_fixed and use it to fix data size.
13720         (Output_data_const::Output_data_const): Adjust call to base class
13721         constructor and fix data size.
13722         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
13723         base class constructor and fix data size.
13724         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
13725         base class constructor and fix data size.
13726         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
13727         class constructor and fix data size.
13728         (Output_data_group::set_final_data_size): New method definition.
13729         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
13730         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
13731         class constructor and fix data size.
13732         (Output_relaxed_input_section): New class definition.
13733         (Output_section::Simple_input_section): New class definition.
13734         (Output_section::get_input_sections): Adjust parameter list.
13735         (Output_section::add_input_section_for_script): Same.
13736         (Output_section::save_states, Output_section::restore_states,
13737         Output_section::do_address_and_file_offset_have_reset_values,
13738         (Output_section::Input_section::Input_section): Handle
13739         RELAXED_INPUT_SECTION_CODE.  Add new overload for
13740         Output_relaxed_input_section.
13741         (Output_section::Input_section::is_input_section,
13742         Output_section::Input_section::set_output_section): Handle relaxed
13743         input section.
13744         (Output_section::Input_section::is_relaxed_input_section,
13745         Output_section::Input_section::output_section_data,
13746         Output_section::Input_section::relaxed_input_section): New method
13747         definitions.
13748         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
13749         value.
13750         (Output_section::Input_section::u1_): Update comments.
13751         (Output_section::Input_section::u2_): Add new union member poris.
13752         (Output_section::Checkpoint_output_section): New classs definition.
13753         (Output_section::relax_input_section): New method declaration.
13754         (Output_section::checkpoint_): New data member.
13755         (Output_segment): Update comments.
13756         (Output_segment::Output_segment): Un-privatize copy constructor.
13757         (Output_segment::operator=): Un-privatize.
13758         * script-sections.cc (Output_section_element::Input_section_list):
13759         Change element type to Output_section::Simple_input_section.
13760         (Output_section_element_dot_assignment::set_section_addresses):
13761         Register output section data for relaxation clean up.
13762         (Output_data_exression::Output_data_expression): Adjust call to base
13763         constructor to fix data size.
13764         (Output_section_element_data::set_section_addresses): Register
13765         Output_data_expression object for relaxation clean up.
13766         (struct Input_section_info): Replace Relobj pointer and section index
13767         pair with Output_section::Simple_input_section and Convert struct to a
13768         class.
13769         (Input_section_sorter::operator()): Adjust access to
13770         Input_section_info data member to use accessors.
13771         (Output_section_element_input::set_section_addresses): Use layout
13772         parameter.  Adjust code to use Output_section::Simple_input_section
13773         and Input_secction_info classes.  Register filler for relaxation
13774         clean up.
13775         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
13776         and section index pair with Output_section::Simple_input_section
13777         class.  Adjust code accordingly.
13778         (Phdrs_element::release_segment): New method definition.
13779         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
13780         segment list.
13781         (Script_sections::release_segments): New method definition.
13782         * gold/script-sections.h (Script_sections::release_segments): New
13783         method declaration.
13784         * gold/target.h (Target::may_relax, Target::relax,
13785         Target::do_may_relax, Target::do_relax): New method definitions.
13786
13787 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13788
13789         * arm.cc (has_signed_unsigned_overflow): New function.
13790         (Arm_relocate_functions::abs8): New function.
13791         (Target_arm::Scan::local): Handle R_ARM_ABS8.
13792         (Target_arm::Scan::global): Likewise.
13793         (Target_arm::relocate::relocate): Likewise.
13794         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
13795         Likewise.
13796
13797 2009-09-16  Cary Coutant  <ccoutant@google.com>
13798
13799         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
13800         * testsuite/Makefile.in: Regenerate.
13801
13802 2009-09-11  Nick Clifton  <nickc@redhat.com>
13803
13804         * po/gold.pot: Updated by the Translation project.
13805
13806 2009-09-08  Cary Coutant  <ccoutant@google.com>
13807
13808         * output.cc (Output_file::open): Add execute permission to empty file.
13809         * testsuite/Makefile.am (permission_test): New test.
13810         * testsuite/Makefile.in: Regenerate.
13811
13812 2009-09-02  Ian Lance Taylor  <iant@google.com>
13813
13814         * output.cc (Output_file::resize): Call map_no_anonymous rather
13815         than map.
13816
13817 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
13818
13819         * gold.cc: Include "incremental.h".
13820         (queue_initial_tasks): Call Incremental_checker methods.
13821         * incremental.cc: Include "output.h".
13822         (Incremental_checker::can_incrementally_link_output_file): New
13823         method.
13824         * incremental.h (Incremental_checker): New class.
13825
13826         * output.cc (Output_file::open_for_modification): New method.
13827         (Output_file::map_anonymous): Changed return type to bool.  Record
13828         map in base_ field.
13829         (Output_file::map_no_anonymous): New method, broken out of map.
13830         (Output_file::map): Use map_no_anonymous and map_anonymous.
13831         * output.h (class Output_file): Update declarations.
13832
13833 2009-08-24  Cary Coutant  <ccoutant@google.com>
13834
13835         * options.h (Command_line::Pre_options): New class.
13836         (Command_line::pre_options): New member.
13837         * options.cc (gold::options::ready_to_register): New variable.
13838         (One_option::register_option): Do nothing if not registering options.
13839         Assert if same short option registered twice.
13840         (General_options::General_options): Turn off option registration when
13841         done constructing.
13842         (Command_line::Pre_options::Pre_options): New constructor.
13843
13844 2009-08-24  Cary Coutant  <ccoutant@google.com>
13845
13846         * options.h (General_options::no_keep_memory): Remove incorrect
13847         short option.
13848
13849 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13850
13851         * Makefile.am (am__skiplex, am__skipyacc): New.
13852         * Makefile.in: Regenerate.
13853
13854 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13855
13856         * Makefile.am (AM_CPPFLAGS): Renamed from ...
13857         (INCLUDES): ... this.
13858         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
13859         (AM_CPPFLAGS): Renamed from ...
13860         (INCLUDE): ... this.
13861         * Makefile.in, testsuite/Makefile.in: Regenerate.
13862
13863         * Makefile.in: Regenerate.
13864         * aclocal.m4: Likewise.
13865         * config.in: Likewise.
13866         * configure: Likewise.
13867         * testsuite/Makefile.in: Likewise.
13868
13869         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13870         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13871         * Makefile.in: Regenerate.
13872         * testsuite/Makefile.in: Regenerate.
13873
13874 2009-08-19  Cary Coutant  <ccoutant@google.com>
13875
13876         * resolve.cc (Symbol_table::resolve): Don't complain about defined
13877         symbols in shared libraries overridden by hidden or internal symbols
13878         in the main program.
13879
13880 2009-08-19  Chris Demetriou  <cgd@google.com>
13881
13882         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
13883         checking source file names in error messages.
13884
13885 2009-08-18  Doug Kwan  <dougkwan@google.com>
13886
13887         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
13888         an elcpp::Ehdr as parameter.  Adjust call to set_target.
13889         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
13890         an elfcpp::Ehdr as parameter.
13891         * object.cc (Object::set_target): Remove the version that looks up
13892         a target and sets it.
13893         (Sized_relobj::setup): Take a Target object instead of
13894         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
13895         (make_elf_sized_object): Find target and ask target to
13896         make an ELF object.
13897         * object.h: (Object::set_target): Remove the version that looks up
13898         a target and sets it.
13899         (Sized_relobj::setup): Take a Target object instead of
13900         an elfcpp:Ehdr as parameter.
13901         * target.cc: Include dynobj.h.
13902         (Target::do_make_elf_object_implementation): New.
13903         (Target::do_make_elf_object): New.
13904         * target.h (Target::make_elf_object): New template declaration.
13905         (Target::do_make_elf_object): New method declarations.
13906         (Target::do_make_elf_object_implementation): New template declaration.
13907
13908 2009-08-14  Ian Lance Taylor  <iant@google.com>
13909
13910         * gold.h (FUNCTION_NAME): Define.
13911         (gold_unreachable): Use FUNCTION_NAME.
13912
13913 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13914
13915         * icf.cc (Icf::find_identical_sections): Issue a warning when a
13916         symbol in the --keep-unique list is not found.
13917
13918 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13919
13920         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
13921         been maked as --keep-unique.
13922         (Icf::unfold_section): New function.
13923         * icf.h (Icf::unfold_section): New function.
13924         * options.h (General_options::keep_unique): New option.
13925         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
13926         * testsuite/Makefile.in: Regenerate.
13927         * testsuite/icf_keep_unique_test.sh: New file.
13928         * testsuite/icf_keep_unique_test.cc: New file.
13929
13930 2009-08-12  Cary Coutant  <ccoutant@google.com>
13931
13932         PR 10471
13933         * resolve.cc (Symbol_table::resolve): Check for references from
13934         dynamic objects to hidden and internal symbols.
13935         * testsuite/Makefile.am (hidden_test.sh): New test.
13936         * testsuite/Makefile.in: Regenerate.
13937         * testsuite/hidden_test.sh: New script.
13938         * testsuite/hidden_test_1.c: New test source.
13939         * testsuite/hidden_test_main.c: New test source.
13940
13941 2009-08-11  Doug Kwan  <dougkwan@google.com>
13942
13943         * arm.cc: Update comments.
13944         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
13945         segment to locate the .ARM.exidx section if present.
13946
13947 2009-08-09  Doug Kwan  <dougkwan@google.com>
13948
13949         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
13950         patch.
13951
13952 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
13953         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
13954         compiler warnings.
13955
13956 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
13957
13958         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
13959         valid tls_segment only for non-debug-section relocations.
13960         * testsuite/Makefile.am: Add gc_tls_test.
13961         * testsuite/Makefile.in: Regenerate.
13962         * testsuite/gc_tls_test.cc: New file.
13963         * testsuite/gc_tls_test.sh: New file.
13964
13965 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
13966
13967         * icf.cc: New file.
13968         * icf.h: New file.
13969         * Makefile.am (CCFILES): Add icf.cc.
13970         (HFILES): Add icf.h
13971         * Makefile.in: Regenerate.
13972         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
13973         * gc.h (gc_process_relocs): Populate lists used by icf to contain
13974         section, symbol and addend information for the relocs.
13975         * gold.cc (queue_middle_tasks): Call identical code folding.
13976         * gold.h: Add defines for multimap.
13977         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
13978         to the call of finalize_local_symbols.
13979         * main.cc (main): Create object of class Icf.
13980         * object.cc (Sized_relobj::do_layout): Allow this function to be
13981         called twice during icf.
13982         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
13983         to sections marked as identical by icf.
13984         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
13985         when available.
13986         (Sized_relobj::do_section_entsize): New function.
13987         * object.h (Object::section_entsize): New function.
13988         (Object::do_section_entsize): New pure virtual function.
13989         (Relobj::finalize_local_symbols): Add new parameter.
13990         (Relobj::do_section_entsize): New function.
13991         * options.h (General_options::icf): New option.
13992         (General_options::icf_iterations): New option.
13993         (General_options::print_icf_sections): New option.
13994         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
13995         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
13996         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
13997         icf.
13998         * symtab.cc (Symbol_table::is_section_folded): New function.
13999         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
14000         to sections marked as identical by icf.
14001         * symtab.h (Symbol_table::set_icf): New function.
14002         (Symbol_table::icf): New function.
14003         (Symbol_table::is_section_folded): New function.
14004         (Symbol_table::icf_): New data member.
14005         * target-reloc.h (relocate_section): Ignore sections folded by icf.
14006         * testsuite/Makefile.am: Add commands to build icf_test.
14007         * testsuite/Makefile.in: Regenerate.
14008         * testsuite/icf_test.sh: New file.
14009         * testsuite/icf_test.cc: New file.
14010
14011 2009-07-24  Chris Demetriou  <cgd@google.com>
14012
14013         * layout.cc (is_compressible_debug_section): Fix incorrect
14014         comment about compressed section names.
14015
14016 2009-07-20  Ian Lance Taylor  <ian@airs.com>
14017
14018         PR 10419
14019         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
14020
14021 2009-07-16  Ian Lance Taylor  <iant@google.com>
14022
14023         PR 10400
14024         * layout.h: #include <map>.
14025         (class Kept_section): Change from struct to class.  Add accessors
14026         and setters.  Add section size to Comdat_group mapping.  Change
14027         Comdat_group to std::map.  Add is_comdat_ field.  Add
14028         linkonce_size field in union.
14029         (class Layout): Update declaration of find_or_add_kept_section.
14030         Don't declare find_kept_object.
14031         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
14032         parameter.  Add object, shndx, is_comdat, and is_group_name
14033         parameters.  Change all callers.  Adjust for new Kept_section.
14034         (Layout::find_kept_object): Remove.
14035         * object.cc (Sized_relobj::include_section_group): Update use of
14036         Kept_section.  Rename secnum to shndx.  Only record
14037         Kept_comdat_section if sections are the same size.
14038         (Sized_relobj::include_linkonce_section): Update use of
14039         Kept_section.  Only record Kept_comdat_section if sections are the
14040         same size.  Set size of linkonce section.
14041         (Sized_relobj::map_to_kept_section): Update call to
14042         get_kept_comdat_section.
14043         * object.h (class Sized_relobj): Rename fields in
14044         Kept_comdat_section to drop trailing underscores; change object
14045         field to Relobj*.  Change Kept_comdat_section_table to store
14046         struct rather than pointer.
14047         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
14048         Add kept_object and kept_shndx parameters.  Change all callers.
14049         (Sized_relobj::get_kept_comdat_section): Change return type to
14050         bool.  Add kept_object and kept_shndx parameters.  Change all
14051         callers.
14052         * plugin.cc (Pluginobj::include_comdat_group): Update call to
14053         Layout::find_or_add_kept_section.
14054
14055 2009-07-09  Ian Lance Taylor  <iant@google.com>
14056
14057         * merge.cc (Object_merge_map::initialize_input_to_output_map):
14058         Reserve space in the hash table.
14059
14060 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
14061
14062         * fileread.cc (File_read::get_mtime): New method.
14063         * fileread.h (Timespec): New structure.
14064         (File_read::get_mtime): New method.
14065         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
14066         Renamed from timestamp_nsec.
14067         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
14068         Elf_Xword.
14069         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
14070         timestamp_nsec.
14071         (Incremental_inputs::report_archive): Save mtime; style fix.
14072         (Incremental_inputs::report_obejct): Save mtime; style fix.
14073         (Incremental_inputs::report_script): Save mtime; style fix.
14074         (Incremental_inputs::finalize_inputs): Style fix.
14075         (Incremental_inputs::finalize): Style fix.
14076         (Incremental_inputs::create_input_section_data): Store inputs
14077         mtime.
14078         * incremental.h (Incremental_inputs::report_script): Add mtime
14079         argument.
14080         (Incremental_inputs::Input_info::Input_info): Intialize only one
14081         union member.
14082         (Incremental_inputs::Input_info::archive): Move to nameless
14083         union.
14084         (Incremental_inputs::Input_info::obejct): Move to nameless union.
14085         (Incremental_inputs::Input_info::script): Move to nameless union.
14086         (Incremental_inputs::mtime): New field.
14087         * script.cc (read_input_script): Pass file mtime to
14088         Incremental_input.
14089         * script.h (Script_info::inputs): Style fix.
14090
14091 2009-07-01  Ian Lance Taylor  <ian@airs.com>
14092
14093         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
14094         instead of 32.
14095
14096 2009-06-24  Ian Lance Taylor  <iant@google.com>
14097
14098         PR 10156
14099         * layout.cc (Layout::choose_output_section): If we find an
14100         existing section, update the flags.
14101         (Layout::create_notes): New function, broken out of
14102         Layout::finalize.
14103         (Layout::finalize): Don't create note sections.
14104         (Layout::create_note): Don't crash if linker script discards
14105         section.
14106         (Layout::create_gold_note): Likewise.
14107         (Layout::create_build_id): Likewise.  Don't set
14108         after_input_sections on the section.
14109         (Layout::create_executable_stack_info): Remove target parameter.
14110         Change caller.
14111         * layout.h (class Layout): Declare create_notes.  Update
14112         declaration of create_executable_stack_info.
14113         * gold.cc (queue_middle_tasks): Call create_notes.
14114         * output.cc (Output_section::update_flags_for_input_section): Move
14115         here from output.h.  If SHF_ALLOC flag is newly set, mark address
14116         invalid.
14117         * output.h (Output_data::mark_address_invalid): New function.
14118         (class Output_section): Only declare, not define,
14119         update_flags_for_input_section.  Remove set_flags.
14120
14121 2009-06-24  Ian Lance Taylor  <iant@google.com>
14122
14123         * script-sections.cc (Output_section_definition::
14124         set_section_addresses): Rename shadowing local load_address to
14125         laddr.
14126
14127 2009-06-24  Ian Lance Taylor  <iant@google.com>
14128
14129         PR 10244
14130         * reloc.cc (relocate_sections): Skip empty relocation sections.
14131
14132 2009-06-23  Ian Lance Taylor  <iant@google.com>
14133
14134         PR 10156
14135         * layout.cc (Layout::create_note): Use choose_output_section
14136         rather than make_output_section.
14137
14138 2009-06-23  Ian Lance Taylor  <iant@google.com>
14139
14140         PR 10237
14141         * options.cc (General_options::parse_V): Set printed_version_.
14142         (General_options::General_options): Initialize printed_version_.
14143         * options.h (class General_options): Add printed_version_ field.
14144         * gold.cc (queue_initial_tasks): If there are no input files,
14145         don't give a fatal error if we printed the version information.
14146         (queue_middle_tasks): If using -r with a shared object, give a
14147         fatal error rather than an ordinary error.
14148
14149 2009-06-23  Ian Lance Taylor  <iant@google.com>
14150
14151         PR 10219
14152         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
14153         (Layout::make_output_section): Set have_stabstr_section_ if we see
14154         a .stab*str section.
14155         (Layout::finalize): Call link_stabs_sections.
14156         (Layout::link_stabs_sections): New file.
14157         * layout.h (class Layout): Add have_stabstr_section_ field.
14158         Declare link_stabs_sections.
14159
14160 2009-06-23  Doug Kwan  <dougkwan@google.com>
14161
14162         * Makefile.am (libgold_a_LIBADD): New.
14163         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
14164         * Makefile.in: Regenerate.
14165         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
14166         * configure: Regenerate.
14167         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
14168         * fileread.cc: Include sys/state.h
14169         * gold.h: Declare memmem and strndup if found missing.
14170         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
14171
14172 2009-06-23  Ian Lance Taylor  <iant@google.com>
14173
14174         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
14175         * configure: Rebuild.
14176
14177 2009-06-23  Ian Lance Taylor  <iant@google.com>
14178
14179         PR 10147
14180         * object.cc (Object::section_contents): Don't try to get a view if
14181         the section has length zero.
14182         (Object::handle_gnu_warning_section): If the section is empty, use
14183         the name of the section as the warning.
14184
14185 2009-06-23  Ian Lance Taylor  <iant@google.com>
14186
14187         PR 10133
14188         * stringpool.h (class Stringpool_template): Add optimize_ field.
14189         (Stringpool_template::set_optimize): New function.
14190         * stringpool.cc (Stringpool_template::Stringpool_template):
14191         Initialize optimize_ field.
14192         (Stringpool_template::set_string_offsets): Test local optimize
14193         fild rather than parameter.
14194         * layout.cc (Layout::Layout): Call set_optimize on the section
14195         name stringpool.
14196
14197 2009-06-22  Ian Lance Taylor  <iant@google.com>
14198
14199         PR 10030
14200         * yyscript.y: Parse TARGET.
14201         * script.cc (script_set_target): New function.
14202         * script-c.h (script_set_target): Declare.
14203         * options.cc (General_options::string_to_object_format): Rename
14204         from string_to_object_format in anonymous namespace.  Change
14205         callers.
14206         * options.h (class General_options): Declare
14207         string_to_object_format.
14208
14209 2009-06-22  Ian Lance Taylor  <iant@google.com>
14210
14211         * script-sections.cc (Script_sections::create_segments): Don't put
14212         program headers in a PT_LOAD segment if -n or -N.
14213
14214 2009-06-22  Ian Lance Taylor  <iant@google.com>
14215
14216         PR 10141
14217         * options.h (class General_options): Add -z lazy and -z now.  Sort
14218         -z options into alphabetical order.
14219         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
14220
14221 2009-06-21  Ian Lance Taylor  <iant@google.com>
14222
14223         * layout.cc (Layout::make_output_section): Call
14224         Target::new_output_section.
14225         (Layout::attach_allocated_section_to_segment): Put large section
14226         sections in a separate load segment with the large segment flag
14227         set.
14228         (Layout::segment_precedes): Sort large data segments after other
14229         load segments.
14230         (align_file_offset): New static function.
14231         (Layout::set_segment_offsets): Use align_file_offset.
14232         * output.h (class Output_section): Add is_small_section_ and
14233         is_large_section_ fields.
14234         (Output_section::is_small_section): New function.
14235         (Output_section::set_is_small_section):  New function.
14236         (Output_section::is_large_section): New function.
14237         (Output_section::set_is_large_section): New function.
14238         (Output_section::is_large_data_section): New function.
14239         (class Output_segment): Add is_large_data_segment_ field.
14240         (Output_segment::is_large_data_segment): New function.
14241         (Output_segment::set_is_large_data_segment): New function.
14242         * output.cc (Output_section::Output_section): Initialize new
14243         fields.
14244         (Output_segment::Output_segment): Likewise.
14245         (Output_segment::add_output_section): Add assertion that large
14246         data sections always go in large data segments.  Force small data
14247         sections to the end of the list of data sections.  Force small BSS
14248         sections to the start of the list of BSS sections.  For large BSS
14249         sections to the end of the list of BSS sections.
14250         * symtab.h (class Symbol): Declare is_common_shndx.
14251         (Symbol::is_defined): Check Symbol::is_common_shndx.
14252         (Symbol::is_common): Likewise.
14253         (class Symbol_table): Define enum Commons_section_type.  Update
14254         declarations.  Add small_commons_ and large_commons_ fields.
14255         * symtab.cc (Symbol::is_common_shndx): New function.
14256         (Symbol_table::Symbol_table): Initialize new fields.
14257         (Symbol_table::add_from_object): Put small and large common
14258         symbols in the right list.
14259         (Symbol_table::sized_finalized_symbol): Check
14260         Symbol::is_common_shndx.
14261         (Symbol_table::sized_write_globals): Likewise.
14262         * common.cc (Symbol_table::do_allocate_commons): Allocate new
14263         common symbol lists.  Don't call do_allocate_commons_list if the
14264         list is empty.
14265         (Symbol_table::do_allocate_commons_list): Remove is_tls
14266         parameter.  Add comons_section_type parameter.  Change all
14267         callers.  Handle small and large common symbols.
14268         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
14269         Symbol::is_common_shndx.
14270         * resolve.cc (symbol_to_bits): Likewise.
14271         * target.h (Target::small_common_shndx): New function.
14272         (Target::small_common_section_flags): New function.
14273         (Target::large_common_shndx): New function.
14274         (Target::large_common_section_flags): New function.
14275         (Target::new_output_section): New function.
14276         (Target::Target_info): Add small_common_shndx, large_common_shndx,
14277         small_common_section_flags, and large_common_section_flags
14278         fields.
14279         (Target::do_new_output_section): New virtual function.
14280         * arm.cc (Target_arm::arm_info): Initialize new fields.
14281         * i386.cc (Target_i386::i386_info): Likewise.
14282         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
14283         Likewise.
14284         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
14285         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14286         (Target_x86_64::do_new_output_section): New function.
14287         * configure.ac: Define conditional MCMODEL_MEDIUM.
14288         * testsuite/Makefile.am (check_PROGRAMS): Add large.
14289         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
14290         (large_LDFLAGS): Define.
14291         * testsuite/large.c: New file.
14292         * testsuite/testfile.cc (Target_test::test_target_info):
14293         Initialize new fields.
14294         * configure, testsuite/Makefile.in: Rebuild.
14295
14296 2009-06-05  Doug Kwan  <dougkwan@google.com>
14297
14298         * Makefile.am (CCFILES): Add target.cc.
14299         * Makefile.in: Regenerate.
14300         * i386.cc (class Target_i386): Define new virtual method to
14301         override do_is_local_label_name in parent.
14302         * object.cc (Sized_relobj::do_count_local_symbols): Discard
14303         local symbols if --discard-locals or -X is given.
14304         * options.h (class General_options): Declare new options
14305         '--discard-locals' and '-X' for discarding locals.
14306         * target.h (class Target): Define new methods is_local_label_name.
14307         Declare new virtual method do_is_local_label_name.
14308         * target.cc: New file.
14309         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
14310         (check_SCRIPTS): Add discard_locals_test.sh.
14311         (check_DATA): Add discard_local_tests.syms.
14312         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
14313         (discard_local_tests.syms, discard_locals_test.o): New make rules.
14314         * testsuite/Makefile.in: Regenerate.
14315         * testsuite/discard_locals_test.c: New file.
14316         * testsuite/discard_locals_test.sh: Same.
14317
14318 2009-06-05  Doug Kwan  <dougkwan@google.com>
14319
14320         * object.cc (Sized_relobj::Sized_relobj): Initialize
14321         discarded_eh_frame_shndx_ to -1U.
14322         (Sized_relobj::do_layout): Record index of a discard .eh_frame
14323         section.
14324         (Sized_relobj::do_count_local_symbols): Skip local symbols in
14325         a discarded .eh_frame section.
14326         (Sized_relobj::do_finalize_local_symbols): Ditto.
14327         * object.h (class Sized_relobj): Declare new member
14328         discarded_eh_frame_shndx_.
14329         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
14330         (local_labels_test.o, local_labels_test): New rules.
14331         * testsuite/Makefile.in: Regenerate.
14332
14333 2009-06-04  Doug Kwan  <dougkwan@google.com>
14334
14335         * layout.cc (Layout::section_name_mapping): Add mapping for
14336         special ARM sections.
14337
14338 2009-06-03  Doug Kwan  <dougkwan@google.com>
14339
14340         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
14341         (utils::has_overflow): Same.
14342
14343 2009-06-03  Ian Lance Taylor  <iant@google.com>
14344
14345         * layout.cc (Layout::section_name_mapping): New array, replacing
14346         Layout::linkonce_mapping.
14347         (Layout::section_name_mapping_count): New variable, replacing
14348         Layout::linkonce_mapping_count.
14349         (Layout::linkonce_output_name): Remove.
14350         (Layout::output_section_name): Rewrite.
14351         * layout.h (class Layout): Rename Linkonce_mapping to
14352         Section_name_mapping, linkonce_mapping to section_name_mapping,
14353         linkonce_mapping_count to section_name_mapping_count.  Don't
14354         declare linkonce_output_name.
14355
14356 2009-06-03  Doug Kwan  <dougkwan@google.com>
14357
14358         * gold/arm.cc (namespace utils): New.
14359         (Target_arm::reloc_is_non_pic): Define new method.
14360         (class Arm_relocate_functions): New.
14361         (Target_arm::Relocate::relocate): Handle relocation types used by
14362         Android.
14363
14364 2009-06-03  Ian Lance Taylor  <iant@google.com>
14365
14366         * arm.cc (Target_arm::scan::global): Use || instead of |.
14367
14368 2009-06-02  Doug Kwan  <dougkwan@google.com>
14369
14370         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
14371         issued_non_pic_error_.
14372         (class Target_arm::Scan): Declare new method check_non_pic.
14373         Define new method symbol_needs_plt_entry.
14374         Declare new data member issued_non_pic_error_.
14375         (class Target_arm::Relocate): Declare new method
14376         should_apply_static_reloc.
14377         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
14378         (Target_arm::Scan::check_non_pic): Define new method.
14379         (Target_arm::Scan::local): Handle a small subset of reloc types used
14380         by Android.
14381         (Target_arm::Scan::local): Same.
14382         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
14383
14384 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
14385
14386         * incremental.cc (Incremental_inputs::report_command_line): Filter
14387         out --incremental-* options.
14388
14389 2009-05-29  Doug Kwan  <dougkwan@google.com>
14390
14391         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
14392         template class.
14393         (class Target_arm): Update comment.
14394         (Target_arm::Target_arm): Initialize new data members GOT_,
14395         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
14396         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
14397         and Target_arm::rel_dyn_section.
14398         Declare new_enum Target_arm::Got_type.
14399         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
14400         and DYNBSS_.
14401         Update commments for member do_dynsym_value.
14402         (Target_arm::got_size, Target_arm::plt_section,
14403         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
14404         new methods inside class defintion.
14405         (Target_arm::got_section): Define new method.
14406         (Target_arm::rel_dyn_section): Same.
14407         (Output_data_plt_arm): New template class.
14408         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
14409         (Output_data_plt_arm:do_adjust_output_section): Define new method.
14410         (Output_data_plt_arm::add_entry): Same.
14411         (Output_data_plt_arm::first_plt_entry): Define new
14412         static data member for PLT instruction template.
14413         (Output_data_plt_arm::plt_entry): Same.
14414         (Output_data_plt_arm::do_write): Define new method.
14415         (Target_arm::make_plt_entry): Same.
14416         (Target_arm::do_finalize_sections): Same.
14417         (Target_arm::do_dynsym_value): Same.
14418
14419 2009-05-28  Doug Kwan  <dougkwan@google.com>
14420
14421         * Makefile.am (TARGETSOURCES): Add arm.cc.
14422         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
14423         * Makefile.in: Regenerate.
14424         * arm.cc: New file.
14425         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
14426
14427 2009-05-26  Doug Kwan  <dougkwan@google.com>
14428
14429         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
14430         (General_options::check_excluded_libs): Strip off directories in
14431         archive name before matching like GNU ld does.
14432         * testsuite/Makefile.am (MOSTLYCLEANFILES,
14433         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
14434         (exclude_libs_test_LDFLAGS): Add linker option
14435         -Wl,--exclude-libs,libexclude_libs_test_3
14436         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
14437         an explicit archive without using -l.
14438         (alt/libexclude_libs_test_3.a): New make rule.
14439         * testsuite/Makefile.in: Regenerate.
14440         * testsuite/exclude_libs_test.c : Declare lib3_default().
14441         (main): Call it.
14442         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
14443         * exclude_libs_test_3.c: New file.
14444
14445 2009-05-26  Nick Clifton  <nickc@redhat.com>
14446
14447         * po/id.po: New Indonesian translation.
14448         * po/gold.pot: Updated template file.
14449
14450 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
14451
14452         * testsuite/Makefile.am: Add -ffunction-sections to compile
14453         gc_comdat_test files.  Add -Wl,--gc-sections to build
14454         gc_comdat_test.
14455         * testsuite/Makefile.in: Regenerate.
14456         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
14457
14458 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
14459
14460         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
14461         kept comdat section was garbage collected.
14462         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
14463         * testsuite/Makefile.in: Regenerate.
14464         * testsuite/gc_comdat_test.sh: New file.
14465         * testsuite/gc_comdat_test_1.cc: New file.
14466         * testsuite/gc_comdat_test_2.cc: New file.
14467
14468 2009-05-19  Doug Kwan  <dougkwan@google.com>
14469
14470         * archive.cc (Archive::Archive): Move constructor from archive.h
14471         to here.  Initialize no_export_.
14472         (Archive::get_elf_object_for_member): Set no_export flag of object.
14473         * archive.h (Archive::Archive): Move constructor body to
14474         archive.cc.
14475         (Archive::no_export): New method.
14476         (Archive::no_export_): New field.
14477         * object.h (Object::Object): Initialize no_export_ to false.
14478         (Object::no_export, Object::set_no_export): New methods.
14479         (Object::no_export_): New field.
14480         * options.cc (General_options::parse_exclude_libs): New method.
14481         (General_options::check_excluded_libs) Same.
14482         * options.h (exclude_libs): New option.
14483         (General_options::check_excluded_libs): New method declaration.
14484         (General_options::excluded_libs_): New field.
14485         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
14486         default or protected visibility if an object has no-export flag set.
14487         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
14488         (check_SCRIPTS): Add exclude_libs_test.sh.
14489         (check_DATA): Add exclude_libs_test.syms.
14490         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
14491         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
14492         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
14493         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
14494         (exclude_libs_test.syms, libexclude_libs_test_1.a,
14495         libexclude_libs_test_2.a): New rules.
14496         * testsuite/Makefile.in: Regenerate.
14497         * testsuite/exclude_libs_test.c: New file.
14498         * testsuite/exclude_libs_test.sh: Ditto.
14499         * testsuite/exclude_libs_test_1.c: Ditto.
14500         * testsuite/exclude_libs_test_2.c: Ditto.
14501
14502 2009-05-15  Ian Lance Taylor  <iant@google.com>
14503
14504         * configure.ac: Check for declarations for cases where libiberty.h
14505         checks HAVE_DECL_xxx.
14506         * configure, config.in: Rebuild.
14507
14508 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
14509
14510         * gold.h (Incremental_argument_list): Remove (invalid) forward
14511         declaration.
14512         * incremental.cc (Incremental_inputs::report_achive): New method.
14513         (Incremental_inputs::report_object): New method.
14514         (Incremental_inputs::report_script): New method.
14515         (Incremental_inputs::finalize_inputs): New method.
14516         (Incremental_inputs::finalize): Call finalize_inputs().
14517         (Incremental_inputs::sized_create_incremental_inputs_section_data):
14518         Create inputs entries.
14519         * incremental.h (Incremental_input_type): New enum.
14520         (Incremental_inputs::Incremental_input): Initialize new fields.
14521         (Incremental_inputs::report_inputs): New method.
14522         (Incremental_inputs::report_achive): New method.
14523         (Incremental_inputs::report_object): New method.
14524         (Incremental_inputs::report_script): New method.
14525         (Incremental_inputs::finalize_inputs): New method.
14526         (Incremental_inputs::Input_info): New struct.
14527         (Incremental_inputs::Input_info_map): New typedef.
14528         (Incremental_inputs::lock_): New field.
14529         (Incremental_inputs::Inputs_): New field.
14530         (Incremental_inputs::Inputs_map): New field.
14531         * main.cc (main): Call Incremental_input::report_inputs.
14532         * options.h (Input_argument_list): Typedef moved from
14533         Input_arguments.
14534         (Input_file_group::Files): Remove, use ::Input_argument_list.
14535         (Input_file_group::Input_argument_list): Remove, use
14536         ::Input_argument_list.
14537         * plugin.cc (Plugin_manager::add_input_file): Add error in
14538         incremental build.
14539         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
14540         functions.
14541         * script.cc (read_input_script): Call
14542         Incremental_input::report_script.
14543         * script.h (Script_info): New class.
14544
14545 2009-04-27  Ian Lance Taylor  <iant@google.com>
14546
14547         * x86_64.cc (do_adjust_output_section): Set entsize to
14548         plt_entry_size.
14549
14550 2009-04-23  Elliott Hughes  <enh@google.com>
14551
14552         * output.cc (Output_file::close): After short writes, continue
14553         writing from the correct offset in the buffer being written.
14554
14555 2009-04-23  Chris Demetriou  <cgd@google.com>
14556
14557         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
14558         * configure: Regenerate.
14559         * config.in: Regenerate.
14560         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
14561         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
14562
14563 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
14564
14565         * incremental.cc (Incremental_inputs_header_data): Renamed from
14566         Incremental_input_header_data.
14567         (Incremental_inputs_header_data::data_size): New field.
14568         (Incremental_inputs_header_data::put_input_file_count): Renamed
14569         from input_file_count.
14570         (Incremental_inputs_header_data::put_command_line_offset): Renamed
14571         from command_line_offset.
14572         (Incremental_inputs_header_data::put_reserved): Renamed from
14573         put_reserved.
14574         (Incremental_inputs_entry_data): Renamed from
14575         Incremental_input_entry_data.
14576         (Incremental_inputs_entry_data::data_size): New field.
14577         (Incremental_inputs::report_command_line): New method.
14578         (Incremental_inputs::finalize): New method.
14579         (Incremental_inputs::create_incremental_inputs_data): New method.
14580         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
14581         * incremental.h: New file.
14582         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
14583         (Layout::finalize): Create incremental inputs section in
14584         incremental builds.
14585         (Layout::create_incremental_info_sections): New method.
14586         * layout.h (Layout::incremental_inputs): New method.
14587         (Layout::create_incremental_info_sections): New method.
14588         (Layout::incremental_inputs_): New field.
14589         * main.cc (main): Notify Incremental_input of the command line.
14590
14591 2009-04-01  Ian Lance Taylor  <iant@google.com>
14592             Mikolaj Zalewski  <mikolajz@google.com>
14593
14594         * gold.h (reserve_unordered_map): Define, three versions, one for
14595         each version of Unordered_map.
14596         * layout.cc (Layout::Layout): Remove options parameter.  Add
14597         number_of_input_files parameter.  Don't initialize options_.
14598         Initialize number_of_input_files_ and resized_signatures_.  Move
14599         sections_are_attached_.
14600         (Layout::layout_group): Reserve space for group_signatures_.
14601         (Layout::find_or_add_kept_section): Change name parameter to be a
14602         reference.  Resize signatures_ map when it gets large enough.
14603         (Layout::layout_eh_frame): Use parameters->options() instead of
14604         this->options_.
14605         (Layout::make_output_section): Likewise.
14606         (Layout::attach_allocated_section_to_segment): Likewise.
14607         (Layout::finalize, Layout::create_executable_stack): Likewise.
14608         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
14609         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
14610         * layout.h (class Layout): Update declarations.  Remove options_
14611         field.  Add number_of_input_files_ and resized_signatures_
14612         fields.  Move sections_are_attached_ field.
14613         * main.cc (main): Pass number of input files to Layout
14614         constructor.  Don't pass options.
14615
14616 2009-03-30  Ian Lance Taylor  <iant@google.com>
14617
14618         * ffsll.c (ffsll): Correct implementation.
14619
14620 2009-03-27  Ian Lance Taylor  <iant@google.com>
14621
14622         * ffsll.c: New file.
14623         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
14624         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
14625         * ftruncate.c (ftruncate): Declare before definition.
14626         * mremap.c (mremap): Likewise.
14627         * pread.c (pread): Likewise.
14628         * configure, Makefile.in, config.in: Rebuild.
14629
14630         * mremap.c: New file.
14631         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
14632         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
14633         (mremap): Declare if HAVE_MREMAP is not defined.
14634         * configure, Makefile.in, config.in: Rebuild.
14635
14636 2009-03-27  Cary Coutant  <ccoutant@google.com>
14637
14638         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
14639         position independent.
14640         * sparc.cc (Target_sparc::check_non_pic): Likewise.
14641         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
14642
14643 2009-03-24  Cary Coutant  <ccoutant@google.com>
14644
14645         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
14646         an executable.
14647         (needs_dynamic_reloc): Likewise.
14648
14649 2009-03-24  Ian Lance Taylor  <iant@google.com>
14650
14651         * yyscript.y (file_cmd): Recognize EXTERN.
14652         (extern_name_list, extern_name_list_body): New nonterminals.
14653         * script.cc (script_add_extern): Define.
14654         * script-c.h (script_add_extern): Declare.
14655
14656 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
14657
14658         * object.cc (is_elf_object): Define.
14659         * object.h (is_elf_object): Declare.
14660         * archive.cc (Archive::get_elf_object_for_member): Call
14661         is_elf_object.
14662         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
14663
14664 2009-03-24  Elliott Hughes  <enh@google.com>
14665
14666         * output.cc (Output_file::map_anonymous): Define.
14667         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
14668         try an anonymous one.  Report the size if the mmap fails.
14669         * output.h (class Output_file): Declare map_anonymous.
14670
14671 2009-03-24  Ian Lance Taylor  <iant@google.com>
14672
14673         * target-select.cc (instantiate_target): Don't acquire the lock if
14674         the instantiated_target_ field has already been set.
14675
14676 2009-03-23  Ian Lance Taylor  <iant@google.com>
14677
14678         * gold-threads.h (class Initialize_lock): Define.
14679         * gold-threads.cc (class Initialize_lock_once): Define.
14680         (initialize_lock_control): New static variable.
14681         (initialize_lock_pointer): New static variable.
14682         (initialize_lock_once): New static function.
14683         (Initialize_lock::Initialize_lock): Define.
14684         (Initialize_lock::initialize): Define.
14685         * target-select.h: Include "gold-threads.h".
14686         (class Target_selector): Add lock_ and initialize_lock_ fields.
14687         Don't define instantiate_target, just declare it.
14688         * target-select.cc (Target_selector::Target_selector): Initialize
14689         new fields.
14690         (Target_selector::instantiate_target): Define.
14691         * descriptors.h: Include "gold-threads.h".
14692         (class Descriptors): Add initialize_lock_ field.
14693         * descriptors.cc (Descriptors::Descriptors): Initialize new
14694         field.
14695         (Descriptors::open): Use initialize_lock_ field
14696         * errors.h (class Errors): Add initialize_lock_ field.
14697         * errors.cc (Errors::Errors): Initialize new field.
14698         (Errors::initialize_lock): Use initialize_lock_ field.
14699         * powerpc.cc (class Target_selector_powerpc): Remove
14700         instantiated_target_ field.  In do_recognize call
14701         instantiate_target rather than do_instantiate_target.  In
14702         do_instantiate_target just allocate a new target.
14703         * sparc.cc (class Target_selector_sparc): Likewise.
14704
14705         * freebsd.h: New file.
14706         * i386.cc: Include "freebsd.h".
14707         (Target_i386): Derive from Target_freebsd rather than
14708         Sized_target.
14709         (Target_selector_i386): Derive from Target_selector_freebsd rather
14710         than Target_selector.
14711         * x86_64.cc: Include "freebsd.h".
14712         (Target_x86_64): Derive from Target_freebsd rather than
14713         Sized_target.
14714         (Target_selector_x86_64): Derive from Target_selector_freebsd
14715         rather than Target_selector.
14716         * target.h (class Target): Add adjust_elf_header and
14717         do_adjust_elf_header.
14718         * output.cc (Output_file_header:: do_sized_write): Call target
14719         adjust_elf_header routine.
14720         * configure.tgt: Set targ_osabi.
14721         * configure.ac: Define GOLD_DEFAULT_OSABI.
14722         * parameters.cc (Parameters::default_target): Pass
14723         GOLD_DEFAULT_OSABI to select_target.
14724         * target-select.h (class Target_selector): Make instantiate_target
14725         protected rather than private.
14726         * Makefile.am (HFILES): Add freebsd.h.
14727         * configure, Makefile.in, config.in: Rebuild.
14728
14729         * merge.cc (do_add_input_section): Correct pend value.  Change
14730         message about last entry not being null terminated from error to
14731         warning.
14732
14733 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
14734
14735         * incremental.cc: New file.
14736         * Makefile.am (CCFILES): Add incremental.cc.
14737         * Makefile.in: Rebuild.
14738
14739 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
14740
14741         * layout.cc (Layout::output_section_name): Preserve names
14742         of '.note.' sections.
14743
14744 2009-03-19  Ian Lance Taylor  <iant@google.com>
14745
14746         * descriptors.cc (Descriptors::open): Check that the options are
14747         valid before using them.
14748
14749 2009-03-18  Ian Lance Taylor  <iant@google.com>
14750
14751         * script-sections.h: Include <list>.
14752         (class Script_sections): Change Sections_elements from std::vector
14753         to std::list.  Typedef public Elements_iterator.  Add
14754         orphan_section_placement_, data_segment_align_start_, and
14755         saw_data_segment_align_ fields.  Remove data_segment_align_index_
14756         field.
14757         * script-sections.cc (class Orphan_section_placement): New class.
14758         (class Sections_element): Add virtual functions is_relro and
14759         orphan_section_init.  Remove virtual function place_orphan_here.
14760         (class Output_section_definition): Add is_relro and
14761         orphan_section_init.  Remove place_orphan_here.
14762         (class Orphan_output_section): Likewise.
14763         (Script_sections::Script_sections): Update for field changes.
14764         (Script_sections::data_segment_align): Set saw_data_segment_align_
14765         and data_segment_align_start_, not data_segment_align_index.
14766         (Script_sections::data_segment_relro_end): Check
14767         saw_data_segment_align_.  Use data_segment_align_start_ rather
14768         than data_segment_align_index_.
14769         (Script_sections::place_orphan): Rewrite to use
14770         Orphan_section_placement.
14771
14772 2009-03-17  Ian Lance Taylor  <iant@google.com>
14773
14774         * archive.cc (Archive::add_symbols): Check for a version attached
14775         to the symbol name in the archive map.
14776         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
14777         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
14778         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
14779         (ver_test_11.a): New target.
14780         * testsuite/Makefile.in: Rebuild.
14781
14782         * configure.ac: Check for chsize and posix_fallocate.  Replace
14783         ftruncate.
14784         * ftruncate.c: New file, from gnulib.
14785         * output.cc (posix_fallocate): Define dummy version if not
14786         HAVE_POSIX_FALLOCATE.
14787         (Output_file::map): Call posix_fallocate rather than lseek and
14788         write.
14789         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
14790         * configure, Makefile.in, config.in: Rebuild.
14791
14792 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
14793
14794         * layout.h (Layout::create_note): Add section_name parameter.
14795         * layout.cc (Layout::create_note): Likewise.
14796         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
14797
14798 2009-03-17  Ian Lance Taylor  <iant@google.com>
14799
14800         * descriptors.cc: Include "options.h".
14801         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
14802         (Descriptors::open): Always use O_CLOEXEC when opening a new
14803         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
14804         then set FD_CLOEXEC.
14805
14806         * sparc.cc (class Target_sparc): Add has_got_section.
14807         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
14808         make sure we have a GOT section.
14809
14810         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
14811         (Target_sparc::Scan::local): Likewise.
14812         (Target_sparc::Scan::global): Likewise.
14813         (Target_sparc::Relocate::relocate): Likewise.
14814         (Target_sparc::Relocate::relocate_tls): Likewise.
14815
14816         * symtab.cc (Symbol_table::define_default_version): New function,
14817         broken out of add_from_object.
14818         (Symbol_table::add_from_object): Call define_default_version.
14819         (Symbol_table::define_special_symbol): Add resolve_oldsym
14820         parameter.  Change all callers.  If the version for a symbol comes
14821         from a version script, resolve it with the symbol with the same
14822         name with no version.  Also add the symbol without a version if
14823         appropriate.
14824         (do_define_in_output_data): If resolving with oldsym, don't delete
14825         sym.
14826         (do_define_in_output_segment): Likewise.
14827         (do_define_as_constant): Likewise.
14828         * symtab.h (class Symbol_table): Update declarations.
14829
14830 2009-03-13  Ian Lance Taylor  <iant@google.com>
14831
14832         * readsyms.cc (Read_symbols::incompatible_warning): New function.
14833         (Read_symbols::requeue): New function.
14834         (Read_symbols::do_read_symbols): If make_elf_object fails because
14835         the target type is not configured, and the file was searched for,
14836         issue a warning and retry with the next directory.
14837         (Add_symbols::run): If the file has an incompatible format, and
14838         it was searched for, requeue the Read_symbols task.  On error,
14839         release the object.
14840         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
14841         dirindex parameter to constructor.  Change all callers.  Declare
14842         incompatible_warning and requeue.
14843         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
14844         input_argument_ and input_group_ fields.  Add them to
14845         constructor.  Change all callers.
14846         (class Read_script): Add dirindex_ field.  Add it to constructor.
14847         Change all callers.
14848         * archive.cc (Archive::setup): Remove input_objects parameter.
14849         Change all callers.
14850         (Archive::get_file_and_offset): Likewise.
14851         (Archive::read_all_symbols): Likewise.
14852         (Archive::read_symbols): Likewise.
14853         (Archive::get_elf_object_for_member): Remove input_objects
14854         parameter.  Add punconfigured parameter.  Change all callers.
14855         (Archive::add_symbols): Change return type to bool.  Check return
14856         value of include_member.
14857         (Archive::include_all_members): Likewise.
14858         (Archive::include_member): Change return type to bool.  Return
14859         false if first included object has incompatible target.  Set
14860         included_member_ field.
14861         (Add_archive_symbols::run): If add_symbols returns false, requeue
14862         Read_symbols task.
14863         * archive.h (class Archive): Add included_member_ field.
14864         Initialize it in constructor.  Add input_file and searched_for
14865         methods.  Update declarations.
14866         (class Add_archive_symbols): Add dirpath_, dirindex_, and
14867         input_argument_ fields.  Add them to constructor.  Change all
14868         callers.
14869         * script.cc: Include "target-select.h".
14870         (class Parser_closure): Add skip_on_incompatible_target_ and
14871         found_incompatible_target_ fields.  Add
14872         skip_on_incompatible_target parameter to constructor.  Change all
14873         callers.  Add methods skip_on_incompatible_target,
14874         clear_skip_on_incompatible_target, found_incompatible_target, and
14875         set_found_incompatible_target.
14876         (read_input_script): Add dirindex parameter.  Change all callers.
14877         If parser finds an incompatible target, requeue Read_symbols
14878         task.
14879         (script_set_symbol): Clear skip_on_incompatible_target in
14880         closure.
14881         (script_add_assertion, script_parse_option): Likewise.
14882         (script_start_sections, script_add_phdr): Likewise.
14883         (script_check_output_format): New function.
14884         * script.h (read_input_script): Update declaration.
14885         * script-c.h (script_check_output_format): Declare.
14886         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
14887         (ignore_cmd): Remove OUTPUT_FORMAT.
14888         * fileread.cc (Input_file::Input_file): Add explicit this.
14889         (Input_file::will_search_for): New function.
14890         (Input_file::open): Add pindex parameter.  Change all callers.
14891         * fileread.h (class Input_file): Add input_file_argument method.
14892         Declare will_search_for.  Update declarations.
14893         * object.cc (make_elf_object): Add punconfigured parameter.
14894         Change all callers.
14895         * object.h (class Object): Make input_file public.  Add
14896         searched_for method.
14897         (make_elf_object): Update declaration.
14898         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
14899         restart search.
14900         * dirsearch.h (class Dirsearch): Update declaration.
14901         * options.h (class General_options): Add --warn-search-mismatch.
14902         * parameters.cc (Parameters::is_compatible_target): New function.
14903         * parameters.h (class Parameters): Declare is_compatible_target.
14904         * workqueue.cc (Workqueue::add_blocker): New function.
14905         * workqueue.h (class Workqueue): Declare add_blocker.
14906
14907         * fileread.cc (Input_file::open): Remove options parameter.
14908         Change all callers.
14909         (Input_file::open_binary): Likewise.
14910         * script.cc (read_input_script): Likewise.
14911         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
14912         options parameter from constructor.  Change all callers.
14913         (class Read_script): Likewise.
14914         * fileread.h (class Input_file): Update declarations.
14915         * script.h (read_input_script): Update declaration.
14916
14917 2009-03-10  Nick Clifton  <nickc@redhat.com>
14918
14919         * po/es.po: New Spanish translation.
14920
14921 2009-03-06  Cary Coutant  <ccoutant@google.com>
14922
14923         * options.cc (parse_short_option): Keep dash_z from registering itself.
14924
14925 2009-03-03  Ian Lance Taylor  <iant@google.com>
14926
14927         PR 9918
14928         * target-reloc.h (relocate_section): Pass output_section to
14929         relocate.
14930         * i386.cc (Target_i386::should_apply_static_reloc): Add
14931         output_section parameter.  Change all callers.
14932         (Target_i386::Relocate::relocate): Add output_section parameter.
14933         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14934         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
14935         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
14936         * testsuite/two_file_shared.sh: New script.
14937         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
14938         (check_DATA): Add two_file_shared.dbg.
14939         (two_file_shared.dbg): New target.
14940         * testsuite/Makefile.in: Rebuild.
14941
14942 2009-03-01  Ian Lance Taylor  <iant@google.com>
14943
14944         * configure.ac: Check for byteswap.h.
14945         * configure: Rebuild.
14946         * config.in: Rebuild.
14947
14948 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
14949
14950         * layout.cc (Layout::find_or_add_kept_section): New function.
14951         (Layout::add_comdat): Removed.
14952         * layout.h (struct Kept_section): Move out of class Layout.
14953         Remove trailing underscores from field names.  Add group_sections
14954         field.  Rename group_ field to is_group.  Change all uses.
14955         (class Layout): Declare find_or_add_kept_section, not add_comdat.
14956         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
14957         comdat_groups_ field.
14958         (Sized_relobj::include_section_group): Use
14959         find_or_add_kept_section and Kept_section::group_sections.
14960         (Sized_relobj::include_linkonce_section): Likewise.
14961         * object.cc (class Sized_relobj): Don't define Comdat_group or
14962         Comdat_group_table.  Remove find_comdat_group and
14963         add_comdat_group.  Remove comdat_groups_ field.
14964         * plugin.cc (include_comdat_group): Use
14965         Layout::find_or_add_kept_section.
14966
14967 2009-02-28  Ian Lance Taylor  <iant@google.com>
14968
14969         * README: --gc-sections and map files are now supported.  Document
14970         some build requirements.
14971
14972         PR 6992
14973         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
14974         relocatable link set the value of the section symbol to zero.
14975         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
14976         relocatable link don't include the section address in the local
14977         symbol value.
14978
14979 2009-02-27  Ian Lance Taylor  <iant@google.com>
14980
14981         PR 6811
14982         * options.h (class Search_directory): Add is_system_directory.
14983         (class General_options): Declare is_in_system_directory.
14984         * options.cc (get_relative_sysroot): Make static.
14985         (get_default_sysroot): Make static.
14986         (General_optoins::is_in_system_directory): New function.
14987         * fileread.cc (Input_file::is_in_system_directory): New function.
14988         * fileread.h (class Input_file): Declare is_in_system_directory.
14989         * object.h (class Object): Add is_in_system_directory.
14990         (class Input_objects): Remove system_library_directory_ field.
14991         * object.cc (Input_objects::add_object): Don't set
14992         system_library_directory_.
14993         (input_objects::found_in_system_library_directory): Remove.
14994         * symtab.cc (Symbol_table::write_globals): Remove input_objects
14995         parameter.  Change all callers.
14996         (Symbol_table::sized_write_globals): Likewise.
14997         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
14998         Call Object::is_in_system_directory.
14999         * symtab.h (class Symbol_table): Update declarations.
15000
15001         PR 5990
15002         * descriptors.h (Open_descriptor): Add is_on_stack field.
15003         * descriptors.cc (Descriptors::open): If the descriptor is on the
15004         top of the stack, remove it.  Initialize is_on_stack field.
15005         (Descriptors::release): Only add pod to stack if it is not on the
15006         stack already.
15007         (Descriptors::close_some_descriptor): Clear stack_next and
15008         is_on_stack fields.
15009
15010         PR 7091
15011         * output.cc (Output_section::find_starting_output_address): Rename
15012         from starting_output_address; add PADDR parameter; change return
15013         type.
15014         * output.h (class Output_section): Declare
15015         find_starting_output_address instead of starting_output_address.
15016         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
15017         section symbol for which we can't find a merge section.
15018
15019         PR 9836
15020         * symtab.cc (Symbol_table::add_from_object): If the visibility is
15021         hidden or internal, force the symbol to be local.
15022         * resolve.cc (Symbol::override_visibility): Define.
15023         (Symbol::override_base): Use override_visibility.
15024         (Symbol_table::resolve): Likewise.
15025         (Symbol::override_base_with_special): Likewise.
15026         (Symbol_table::override_with_special): If the visibility is hidden
15027         or internal, force the symbol to be local.
15028         * symtab.h (class Symbol): Add set_visibility and
15029         override_visibility.
15030         * testsuite/ver_test_1.sh: New file.
15031         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
15032         (check_DATA): Add ver_test_1.syms.
15033         (ver_test_1.syms): New target.
15034         * testsuite/Makefile.in: Rebuild.
15035
15036 2009-02-25  Cary Coutant  <ccoutant@google.com>
15037
15038         * layout.cc (Layout::choose_output_section): Don't rename sections
15039         when using a linker script that has a SECTIONS clause.
15040         * Makefile.in: Regenerate.
15041
15042         * testsuite/Makefile.am (script_test_5.sh): New test case.
15043         * testsuite/Makefile.in: Regenerate.
15044         * testsuite/script_test_5.cc: New file.
15045         * testsuite/script_test_5.sh: New file.
15046         * testsuite/script_test_5.t: New file.
15047
15048 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
15049
15050         * archive.cc (Archive::include_member): Update calls to add_symbols.
15051         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
15052         the Layout argument.
15053         * dynobj.h (do_add_symbols): Add the Layout argument.
15054         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
15055         Layout argument.
15056         * object.h (Object::add_symbols): Add the Layout argument.
15057         (Object::do_add_symbols): Add the Layout argument.
15058         (Sized_relobj::do_add_symbols): Add the Layout argument.
15059         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
15060         Unify the two versions.
15061         (Add_plugin_symbols): Remove.
15062         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
15063         (Sized_pluginobj::do_add_symbols): Unify the two versions.
15064         (Add_plugin_symbols): Remove.
15065         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
15066         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
15067         (Add_symbols::run): Make it work with Pulginobj.
15068
15069 2009-02-06  Ian Lance Taylor  <iant@google.com>
15070
15071         * object.cc (Sized_relobj::do_layout): Make info message start
15072         with lower case letter.
15073
15074 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
15075
15076         * binary.cc: Fix file comment.
15077
15078         * options.h (enum Incremental_disposition): Define.
15079         (class General_options): Add new options: --incremental,
15080         --incremental_changed, --incremental_unchanged,
15081         --incremental_unknown.  Add incremental_disposition_ and
15082         implicit_incremental_ fields.
15083         (General_options::incremental_disposition): New function.
15084         (class Position_dependent_options): Add incremental_disposition
15085         option.
15086         (Position_dependent_options::copy_from_options): Set incremental
15087         dispositions.
15088         * options.cc (General_options::parse_incremental_changed): New
15089         function.
15090         (General_options::parse_incremental_unchanged): New function.
15091         (General_options::parse_incremental_unknown): New function.
15092         (General_options::General_options): Initialize new fields
15093         incremental_disposition_ and implicit_incremental_.
15094         (General_options::finalize): Check for uasge of --incremental-*
15095         without --incremental.
15096
15097 2009-02-06  Chris Demetriou  <cgd@google.com>
15098
15099         * gold.h (gold_undefined_symbol): Change to take only a Symbol
15100         pointer and to report location as the file name associated with
15101         the symbol.
15102         (gold_undefined_symbol_at_location): New function to replace the
15103         old gold_undefined_symbol functionality.
15104         * target-reloc.h (relocate_section): Update to use
15105         gold_undefined_symbol_at_location.
15106         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15107         Call gold_undefined_symbol function rather than gold_error.
15108         * errors.h (Errors::undefined_symbol): Take location as a
15109         string, rather than calculating it from a relocation.
15110         * errors.cc (Errors::fatal): Print "fatal error:" before the
15111         formatted message.
15112         (Errors::error, Errors::error_at_location): Print "error: "
15113         before the formatted message.
15114         (Errors::undefined_symbol): Take location as a string, rather
15115         than calculating it from a relocation.
15116         (gold_undefined_symbol_at_location): New function akin to
15117         old gold_undefined_symbol, calculates location from relocation.
15118         (gold_undefined_symbol): Change to take only a Symbol pointer
15119         and to report location as the file name associated with the symbol.
15120         * testsuite/debug_msg.sh: Update for changed error messages.
15121         * testsuite/undef_symbol.sh: Likewise.
15122
15123 2009-02-04  Duncan Sands  <baldrick@free.fr>
15124
15125         PR 9812
15126         * reduced_debug_output.h
15127         (Output_reduced_debug_abbrev_section::failed): Use format for
15128         gold_warning.
15129         (Output_reduced_debug_info_section::faild): Likewise.
15130
15131 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
15132
15133         * script.cc (Lazy_demangler): New class.
15134         (Version_script_info::get_symbol_version_helper): Demangle a
15135         symbol only once.
15136
15137 2009-01-29  Cary Coutant  <ccoutant@google.com>
15138
15139         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
15140         to __tls_get_addr.
15141         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15142
15143 2009-01-28  Ian Lance Taylor  <iant@google.com>
15144
15145         * version.cc (version_string): Bump to 1.9.
15146
15147         * gold.h: Include <cstring> and <stdint.h>.
15148         * version.cc: Include <cstdio>.
15149         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
15150         warning.
15151         * reduced_debug_output.cc (insert_into_vector): Rename from
15152         Insert_into_vector; change all callers.  Use Swap_unaligned to
15153         avoid aliasing issue; remove union since it is unnecessary.
15154
15155 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
15156
15157         * Makefile.am (CCFILES): Add gc.cc.
15158         (HFILES): Add gc.h.
15159         * Makefile.in: Regenerate.
15160         * gold.cc (Gc_runner): New class.
15161         (queue_initial_tasks): Call garbage collection related tasks
15162         when corresponding options are invoked.
15163         (queue_middle_gc_tasks): New function.
15164         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
15165         processed early before laying out sections during garbage collection.
15166         * gold.h (queue_middle_gc_tasks): New function.
15167         (is_prefix_of): Move from "layout.cc".
15168         * i386.cc (Target_i386::gc_process_relocs): New function.
15169         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
15170         * main.cc (main): Create object of class "Garbage_collection".
15171         * object.cc (Relobj::copy_symbols_data): New function.
15172         (Relobj::is_section_name_included): New function.
15173         (Sized_relobj::do_layout): Allow this function to be called twice
15174         during garbage collection and defer layout of section during the
15175         first call.
15176         * object.h (Relobj::get_symbols_data): New function.
15177         (Relobj::is_section_name_included): New function.
15178         (Relobj::copy_symbols_data): New function.
15179         (Relobj::set_symbols_data): New function.
15180         (Relobj::get_relocs_data): New function.
15181         (Relobj::set_relocs_data): New function.
15182         (Relobj::is_output_section_offset_invalid): New pure virtual function.
15183         (Relobj::gc_process_relocs): New function.
15184         (Relobj::do_gc_process_relocs): New pure virtual function.
15185         (Relobj::sd_): New data member.
15186         (Sized_relobj::is_output_section_offset_invalid): New function.
15187         (Sized_relobj::do_gc_process_relocs): New function.
15188         * options.h (General_options::gc_sections): Modify to not be a no-op.
15189         (General_options::print_gc_sections): New option.
15190         * plugin.cc (Plugin_finish::run): Remove function call to
15191         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
15192         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
15193         * reloc.cc (Read_relocs::run): Add task to process relocs and
15194         determine unreferenced sections when doing garbage collection.
15195         (Gc_process_relocs): New class.
15196         (Sized_relobj::do_gc_process_relocs): New function.
15197         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
15198         sections that are garbage collected.
15199         * reloc.h (Gc_process_relocs): New class.
15200         * sparc.cc (Target_sparc::gc_process_relocs): New function.
15201         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
15202         symbols whose corresponding sections are garbage collected.
15203         (Symbol_table::Symbol_table): Add new parameter for the garbage
15204         collection object.
15205         (Symbol_table::gc_mark_undef_symbols): New function.
15206         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15207         (Symbol_table::gc_mark_dyn_syms): New function.
15208         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
15209         as garbage.
15210         (Symbol_table::add_from_object): Likewise.
15211         (Symbol_table::add_from_relobj): When building shared objects, do not
15212         treat externally visible symbols as garbage.
15213         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
15214         table information for static and relocatable links.
15215         * symtab.h (Symbol_table::set_gc): New function.
15216         (Symbol_table::gc): New function.
15217         (Symbol_table::gc_mark_undef_symbols): New function.
15218         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15219         (Symbol_table::gc_mark_dyn_syms): New function.
15220         (Symbol_table::gc_): New data member.
15221         * target.h (Sized_target::gc_process_relocs): New pure virtual
15222         function.
15223         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
15224         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
15225
15226 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
15227
15228         * options.h (General_options::gc_sections): Define as a no-op for now.
15229         (General_options::no_keep_memory): Ditto.
15230         (General_options::Bshareable): Define.
15231         * options.cc (General_options::finalize): Honor -Bshareable.
15232
15233 2009-01-20  Andreas Schwab  <schwab@suse.de>
15234
15235         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
15236         read the value in the contents, since we don't use it.  Use the
15237         template endianness when writing.
15238         (Relocate::relocate): Use it for R_PPC_REL16_HA.
15239
15240 2009-01-19  Andreas Schwab  <schwab@suse.de>
15241
15242         * configure.tgt (powerpc64-*): Fix targ_obj.
15243
15244 2009-01-15  Ian Lance Taylor  <iant@google.com>
15245
15246         * object.cc (Sized_relobj::write_local_symbols): Don't write out
15247         local symbols when stripping all symbols.
15248
15249 2009-01-14  Cary Coutant  <ccoutant@google.com>
15250
15251         * output.cc (Output_reloc): Add explicit instantiations.
15252
15253 2009-01-14  Cary Coutant  <ccoutant@google.com>
15254
15255         * archive.cc (Archive::get_elf_object_for_member): Remove call
15256         to File_read::claim_for_plugin.
15257         * descriptors.cc (Descriptors::open): Remove reference to
15258         is_claimed.
15259         (Descriptors::claim_for_plugin): Remove.
15260         * descriptors.h (Descriptors::claim_for_plugin): Remove.
15261         (Descriptors::is_claimed): Remove.
15262         (claim_descriptor_for_plugin): Remove.
15263         * fileread.cc (File_read::claim_for_plugin): Remove.
15264         * fileread.h (File_read::claim_for_plugin): Remove.
15265         (File_read::descriptor): Reopen descriptor if necessary.
15266         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
15267         (Plugin_manager::all_symbols_read): Add task parameter. Change
15268         all callers.
15269         (Plugin_manager::get_input_file): New function.
15270         (Plugin_manager::release_input_file): New function.
15271         (Pluginobj::Pluginobj): Add filesize parameter and initialize
15272         corresponding data member.
15273         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
15274         and pass to base constructor. Change all callers.
15275         (get_input_file, release_input_file): New functions.
15276         (make_sized_plugin_object): Add filesize parameter. Change all callers.
15277         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
15278         (Plugin_manager::all_symbols_read): Add task parameter.
15279         (Plugin_manager::get_input_file): New function.
15280         (Plugin_manager::release_input_file): New function.
15281         (Plugin_manager::task_): New data member.
15282         (Pluginobj::Pluginobj): Add filesize parameter.
15283         (Pluginobj::filename): New function.
15284         (Pluginobj::descriptor): New function.
15285         (Pluginobj::filesize): New function.
15286         (Pluginobj::filesize_): New data member.
15287         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
15288         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
15289         File_read::claim_for_plugin; use Object::unlock to unlock the file.
15290
15291         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
15292         with archive libraries.
15293         * testsuite/Makefile.in: Regenerate.
15294         * testsuite/plugin_test.c (struct sym_info): New type.
15295         (get_input_file, release_input_file): New static variables.
15296         (onload): Capture new transfer vector entries.
15297         (claim_file_hook): Stop reading at end of file according to filesize.
15298         Factor out parsing of readelf output into separate function.
15299         (all_symbols_read_hook): Exercise get_input_file and release_input_file
15300         APIs and get the source file name from the symbol table.  Convert
15301         source file name to corresponding object file name.  Print info
15302         message when adding new input files.
15303         (parse_readelf_line): New function.
15304         * testsuite/plugin_test_1.sh: Add checks for new info messages.
15305         * testsuite/plugin_test_2.sh: Likewise.
15306         * testsuite/plugin_test_3.sh: Likewise.
15307         * testsuite/plugin_test_4.sh: New test case.
15308
15309 2009-01-07  Ian Lance Taylor  <iant@google.com>
15310
15311         * version.cc (version_string): Bump to 1.8.
15312
15313 2008-12-23  Cary Coutant  <ccoutant@google.com>
15314
15315         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
15316         * plugin.cc (Plugin_manager::finish): Rename as
15317         layout_deferred_objects.  Move cleanup to separate function.
15318         (Plugin_manager::cleanup): New function.
15319         (Plugin_finish::run): Call layout_deferred_objects and cleanup
15320         separately.
15321         * plugin.h (Plugin_manager::finish): Rename as
15322         layout_deferred_objects.
15323         (Plugin_manager::cleanup): New function.
15324         (Plugin_manager::cleanup_done): New field.
15325
15326 2008-12-23  Cary Coutant  <ccoutant@google.com>
15327
15328         * plugin.cc (is_visible_from_outside): New function.
15329         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
15330         so we don't return "IR only" status for exported symbols or -r links.
15331
15332         * testsuite/Makefile.am (plugin_test_3): New test case.
15333         * testsuite/Makefile.in: Regenerate.
15334         * testsuite/plugin_test_3.sh: New file.
15335
15336 2008-12-22  Cary Coutant  <ccoutant@google.com>
15337
15338         * object.cc (Sized_relobj::layout_section): New function.
15339         (Sized_relobj::do_layout): Defer layout of input sections until after
15340         plugin has provided replacement files.
15341         (Sized_relobj::do_layout_deferred_sections): New function.
15342         * object.h (Relobj::set_section_offset): Remove virtual keyword.
15343         (Relobj::layout_deferred_sections): New function.
15344         (Relobj::do_layout_deferred_sections): New function.
15345         (Sized_relobj::do_layout_deferred_sections): New function.
15346         (Sized_relobj::layout_section): New function.
15347         (Sized_relobj::Deferred_layout): New structure.
15348         (Sized_relobj::deferred_layout_): New field.
15349         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
15350         Change all callers.  Layout deferred sections.
15351         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
15352         references.
15353         (Plugin_hook::run): Move code from do_plugin_hook inline.
15354         (Plugin_hook::do_plugin_hook): Remove.
15355         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
15356         (Plugin_manager::finish): Renamed, was cleanup.
15357         (Plugin_manager::should_defer_layout): New function.
15358         (Plugin_manager::add_deferred_layout_object): New function.
15359         (Plugin_manager::Deferred_layout_list): New type.
15360         (Plugin_manager::deferred_layout_objects_): New field.
15361         (Plugin_hook::do_plugin_hook): Remove.
15362
15363 2008-12-17  Ian Lance Taylor  <iant@google.com>
15364
15365         * options.h (class General_options): Add --no case for
15366         --export-dynamic.
15367
15368 2008-12-16  Cary Coutant  <ccoutant@google.com>
15369
15370         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
15371         vector.
15372         (Plugin_manager::claim_file): Create plugin object even if
15373         plugin did not call the add_symbols callback.
15374         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
15375         asking for more symbols than were added.
15376         * testsuite/Makefile.am (plugin_test_1): Add test case with
15377         no global symbols.
15378         (empty.syms): New target.
15379         * testsuite/Makefile.in: Regenerate.
15380         * testsuite/plugin_test.c (claim_file_hook): Add new debug
15381         message. Don't call add_symbols if no globals.
15382         (all_symbols_read_hook): Don't provide replacement for empty
15383         claimed file.
15384
15385 2008-12-12  Ian Lance Taylor  <iant@google.com>
15386
15387         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
15388         r_type == 0 for a local symbol with r_sym == 0.
15389         (scan_relocatable_relocs): Pass r_sym to
15390         local_non_section_strategy.
15391         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
15392         r_sym parameter.
15393
15394         * configure.ac: Update test for TLS descriptors: they are
15395         supported as of glibc 2.9.
15396         * configure: Rebuild.
15397
15398 2008-12-11  Ian Lance Taylor  <iant@google.com>
15399
15400         PR 7091
15401         * target-reloc.h (Default_scan_relocatable_relocs): For each
15402         function, map r_type == 0 to RELOC_DISCARD.
15403
15404 2008-12-10  Cary Coutant  <ccoutant@google.com>
15405
15406         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
15407         object to override a kept COMDAT group from a plugin object.
15408
15409 2008-12-09  Ian Lance Taylor  <iant@google.com>
15410
15411         PR 7088
15412         * yyscript.y (file_cmd): Handle INPUT.
15413
15414         * testsuite/initpri1.c: Change all declarations to be full
15415         prototypes by adding void, to avoid compiler warnings.
15416
15417 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
15418
15419         * options.cc (General_options::parse_plugin_opt): New.
15420         (General_options::add_plugin): The argument now is just the filename.
15421         (General_options::add_plugin_option): New.
15422         * options.h (plugin_opt): New.
15423         (add_plugin): Change argument name.
15424         (add_plugin_option): New.
15425         * plugin.cc (Plugin::load): Don't parse the plugin option.
15426         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
15427         (Plugin::add_option): New.
15428         (Plugin::args_): Change type.
15429         (Plugin::filename_): New.
15430         (Plugin_manager::add_plugin_option): New.
15431         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
15432         * testsuite/Makefile.in: Regenerate.
15433
15434 2008-12-05  Cary Coutant  <ccoutant@google.com>
15435
15436         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
15437         Handle --strip-lto-sections option.
15438         * options.h (strip_lto_sections): New option.
15439
15440 2008-12-01  Cary Coutant  <ccoutant@google.com>
15441
15442         * plugin.cc (ld_plugin_message): Change format parameter to const.
15443         Fix mismatch between new[] and delete.
15444
15445 2008-11-14  Cary Coutant  <ccoutant@google.com>
15446
15447         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
15448         instead of -1U.
15449
15450 2008-11-05  Craig Silverstein  <csilvers@google.com>
15451
15452         * options.cc (General_options::parse_dynamic_list): New function.
15453         * options.h (General_options): New flags dynamic_list,
15454         dynamic_list_data, dynamic_list_cpp_new, and
15455         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
15456         (General_options::in_dynamic_list): New function.
15457         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
15458         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
15459         (Lex::can_continue_name): Likewise.
15460         (yylex): Likewise.
15461         (read_script_file): New parameter script_options.
15462         (read_dynamic_list): New function.
15463         (Script_options::define_dynamic_list): New function.
15464         (dynamic_list_keyword_parsecodes): New variable.
15465         (dynamic_list_keywords): New variable.
15466         * script.h (Script_options::define_dynamic_list): New function
15467         prototype.
15468         (read_dynamic_list): New function prototype.
15469         * symtab.cc (strprefix): New macro.
15470         (Symbol::should_add_dynsym_entry): Support dynamic_list,
15471         dynamic_list_data, dynamic_list_cpp_new, and
15472         dynamic_list_cpp_typeinfo.
15473         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
15474         (dynamic_list_expr): New rule.
15475         (dynamic_list_nodes): Likewise.
15476         (dynamic_list_node): Likewise.
15477         * testsuite/Makefile.am (dynamic_list): New test.
15478         * testsuite/Makefile.in: Regenerated.
15479         * testsuite/dynamic_list.t: New file.
15480         * testsuite/dynamic_list.sh: New file.
15481
15482 2008-11-05  Craig Silverstein  <csilvers@google.com>
15483
15484         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
15485         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
15486         (t11_last): Likewise.
15487         * testsuite/ver_test_6.c (main): Likewise.
15488
15489 2008-10-07  Cary Coutant  <ccoutant@google.com>
15490
15491         * options.c (General_options::finalize): Add check for -static and
15492         -shared.
15493         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
15494         is not empty.
15495
15496 2008-10-02  Cary Coutant  <ccoutant@google.com>
15497
15498         * plugin.cc (make_sized_plugin_object): Fix conditional
15499         compilation to work when not all targets are enabled.
15500
15501 2008-09-29  Cary Coutant  <ccoutant@google.com>
15502
15503         * archive.cc (Archive::get_file_and_offset): Use filename instead
15504         of name to get library path.
15505         (Archive::include_member): Unlock external member of a thin archive.
15506
15507         * testsuite/Makefile.am (TEST_AR): New variable.
15508         (thin_archive_test_1): New test.
15509         (thin_archive_test_2): New test.
15510         * testsuite/Makefile.in: Regenerate.
15511         * testsuite/thin_archive_main.cc: New file.
15512         * testsuite/thin_archive_test_1.cc: New file.
15513         * testsuite/thin_archive_test_2.cc: New file.
15514         * testsuite/thin_archive_test_3.cc: New file.
15515         * testsuite/thin_archive_test_4.cc: New file.
15516
15517 2008-09-29  Cary Coutant  <ccoutant@google.com>
15518
15519         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
15520         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
15521         instead of -1U.
15522         (Sized_relobj::do_finalize_local_symbols): Likewise.
15523         (Sized_relobj::map_to_kept_section): Likewise.
15524         * object.h (Sized_relobj::invalid_address): New constant.
15525         (Sized_relobj::do_output_section_offset): Check for invalid_address
15526         and return -1ULL.
15527         * output.cc (Output_reloc::local_section_offset): Use constant
15528         invalid_address instead of -1U.
15529         (Output_reloc::get_address): Likewise.
15530         (Output_section::output_address): Change -1U to -1ULL.
15531         * output.h (Output_reloc::invalid_address): New constant.
15532         * reloc.cc (Sized_relobj::write_sections): Use constant
15533         invalid_address instead of -1U.
15534         (Sized_relobj::relocate_sections): Likewise.
15535         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
15536         values for merge sections.
15537         * target-reloc.h (relocate_for_relocatable): Use constant
15538         invalid_address instead of -1U.
15539
15540 2008-09-19  Cary Coutant  <ccoutant@google.com>
15541
15542         Add plugin functionality for link-time optimization (LTO).
15543         * configure.ac (plugins): Add --enable-plugins option.
15544         * configure: Regenerate.
15545         * config.in: Regenerate.
15546         * Makefile.am (LIBDL): New variable.
15547         (CCFILES): Add plugin.cc.
15548         (HFILES): Add plugin.h.
15549         (ldadd_var): Add LIBDL.
15550         * Makefile.in: Regenerate.
15551
15552         * archive.cc: Include "plugin.h".
15553         (Archive::setup): Don't preread archive symbols when using a plugin.
15554         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
15555         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
15556         files.
15557         (Archive::include_member): Add symbols from plugin objects.
15558         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
15559         * descriptors.cc (Descriptors::open): Check for file descriptors
15560         abandoned by plugins.
15561         (Descriptors::claim_for_plugin): New function.
15562         * descriptors.h (Descriptors::claim_for_plugin): New function.
15563         (Open_descriptor::is_claimed): New field.
15564         (claim_descriptor_for_plugin): New function.
15565         * fileread.cc (File_read::claim_for_plugin): New function.
15566         * fileread.h (File_read::claim_for_plugin): New function.
15567         (File_read::descriptor): New function.
15568         * gold.cc: Include "plugin.h".
15569         (queue_initial_tasks): Add task to call plugin hooks for generating
15570         new object files.
15571         * main.cc: Include "plugin.h".
15572         (main): Load plugin libraries.
15573         * object.h (Pluginobj): Declare.
15574         (Object::pluginobj): New function.
15575         (Object::do_pluginobj): New function.
15576         (Object::set_target): New function.
15577         * options.cc: Include "plugin.h".
15578         (General_options::parse_plugin): New function.
15579         (General_options::General_options): Initialize plugins_ field.
15580         (General_options::add_plugin): New function.
15581         * options.h (Plugin_manager): Declare.
15582         (General_options): Add --plugin option.
15583         (General_options::has_plugins): New function.
15584         (General_options::plugins): New function.
15585         (General_options::add_plugin): New function.
15586         (General_options::plugins_): New field.
15587         * plugin.cc: New file.
15588         * plugin.h: New file.
15589         * readsyms.cc: Include "plugin.h".
15590         (Read_symbols::do_read_symbols): Check for archive before checking
15591         for ELF file.  Call plugin hooks to claim files.
15592         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
15593         from a real object file; force override when processing replacement
15594         files.
15595         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
15596         (Symbol::init_base_object): Likewise.
15597         (Symbol::init_base_output_data): Likewise.
15598         (Symbol::init_base_output_segment): Likewise.
15599         (Symbol::init_base_constant): Likewise.
15600         (Symbol::init_base_undefined): Likewise.
15601         (Symbol::output_section): Assert that object is not a plugin.
15602         (Symbol_table::add_from_pluginobj): New function.
15603         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15604         undefined.
15605         (Symbol_table::sized_write_globals): Likewise.
15606         (Symbol_table::add_from_pluginobj): Instantiate template.
15607         * symtab.h (Sized_pluginobj): Declare.
15608         (Symbol::in_real_elf): New function.
15609         (Symbol::set_in_real_elf): New function.
15610         (Symbol::in_real_elf_): New field.
15611         (Symbol_table::add_from_pluginobj): New function.
15612
15613         * testsuite/Makefile.am (AM_CFLAGS): New variable.
15614         (LIBDL): New variable.
15615         (LDADD): Add LIBDL.
15616         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
15617         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
15618         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
15619         (MOSTLYCLEANFILES): Likewise.
15620         * testsuite/Makefile.in: Regenerate.
15621         * testsuite/plugin_test.c: New file.
15622         * testsuite/plugin_test_1.sh: New file.
15623         * testsuite/plugin_test_2.sh: New file.
15624
15625 2008-09-16  Ian Lance Taylor  <iant@google.com>
15626
15627         * target-reloc.h (relocate_section): Check whether a symbol is
15628         defined by the ABI before reporting an undefined symbol error.
15629         * target.h (Target::is_defined_by_abi): Make parameter const.
15630         (Target::do_is_defined_by_abi): Likewise.
15631         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
15632         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
15633         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
15634         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
15635         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
15636         * testsuite/Makefile.in: Rebuild.
15637
15638         * fileread.cc (make_view): Add casts to avoid warning.
15639
15640 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15641
15642         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
15643         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15644
15645 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15646
15647         * options.h (General_options::output_is_executable): New.
15648         (General_options::output_is_pie): New.
15649         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
15650         for shared libraries.
15651         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15652
15653 2008-09-11  Chris Demetriou  <cgd@google.com>
15654
15655         * options.h (origin): New -z option.
15656         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
15657         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
15658         in DT_FLAGS_1.
15659
15660 2008-09-05  Cary Coutant  <ccoutant@google.com>
15661
15662         * fileread.cc (File_read::make_view): Add check for attempt to map
15663         beyond end of file.
15664
15665 2008-09-05  Cary Coutant  <ccoutant@google.com>
15666
15667         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
15668         explicit instantiations.
15669
15670 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
15671
15672         PR gold/6858
15673         * options.cc (General_options::finalize): Allow undefined symbols
15674         in shlibs if linking -shared.
15675
15676         PR gold/6859
15677         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
15678         symbols as not needing a dynsym entry.
15679
15680 2008-08-20  Craig Silverstein  <csilvers@google.com>
15681
15682         * fileread.cc (File_read::open): Do not lock the file unless it
15683         was successfully opened.
15684
15685 2008-08-14  Cary Coutant  <ccoutant@google.com>
15686
15687         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
15688         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
15689         * testsuite/tls_test.cc (struct int128): 128-bit struct
15690         for testing TLS relocs with non-zero addend.
15691         (v12): New TLS variable.
15692         (t12): New test.
15693         (t_last): Add check for v12.
15694         * testsuite/tls_test.h (t12): New function.
15695         * testsuite/tls_test_main.cc (thread_routine): Call new test.
15696
15697 2008-08-13  Ian Lance Taylor  <iant@google.com>
15698
15699         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
15700         set tls_segment_ or relro_segment_.
15701         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
15702         when appropriate.
15703         * output.h (Output_section::clear_is_relro): New function.
15704         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
15705         sections specially even when output_data_ is empty.
15706         (Output_segment::maximum_alignment): When first section is relro,
15707         only force alignment for PT_LOAD segments.
15708         * script.cc (script_data_segment_align): New function.
15709         (script_data_segment_relro_end): New function.
15710         * script-c.h (script_data_segment_align): Declare.
15711         (script_data_segment_relro_end): Declare.
15712         * script-sections.h (class Script_sections): Declare
15713         data_segment_align and data_segment_relro_end.  Add fields
15714         segment_align_index_ and saw_relro_end_.
15715         * script-sections.cc (class Sections_element): Add set_is_relro
15716         virtual function.  Add new bool* parameter to place_orphan_here.
15717         Add get_output_section virtual function.
15718         (class Output_section_definition): Add set_is_relro.  Add new
15719         bool* parameter to place_orphan_here.  Add get_output_section.
15720         Add is_relro_ field.
15721         (Output_section_definition::Output_section_definition): Initialize
15722         evaluated_address_, evaluated_load_address, evaluated_addralign_,
15723         and is_relro_ fields.
15724         (Output_section_definition::place_orphan_here): Add is_relro
15725         parameter.
15726         (Output_section_definition::set_section_addresses): Set relro for
15727         output section.
15728         (Output_section_definition::alternate_constraint): Likewise.
15729         (class Orphan_output_section): Add new bool* parameter to
15730         place_orphan_here.  Add get_output_section.
15731         (Orphan_output_section::place_orphan_here): Add is_relro
15732         parameter.
15733         (Script_sections::Script_sections): Initialize
15734         data_segment_align_index_ and saw_relro_end_.
15735         (Script_sections::data_segment_align): New function.
15736         (Script_sections::data_segment_relro_end): New function.
15737         (Script_sections::place_orphan): Set or clear is_relro.
15738         (Script_sections::set_section_addresses): Force alignment of first
15739         TLS section.
15740         * yyscript.y (exp): Call script_data_segment_align and
15741         script_data_segment_relro_end.
15742         * testsuite/relro_script_test.t: New file.
15743         * testsuite/relro_test.cc (using_script): Declare.
15744         (t1, t2): Test using_script.
15745         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
15746         (relro_script_test_SOURCES): Define.
15747         (relro_script_test_DEPENDENCIES): Define.
15748         (relro_script_test_LDFLAGS): Define.
15749         (relro_script_test_LDADD): Define.
15750         (relro_script_test.so): New target.
15751         * testsuite/Makefile.in: Rebuild.
15752
15753 2008-08-06  Cary Coutant <ccoutant@google.com>
15754
15755         * archive.cc (Archive::total_archives, Archive::total_members)
15756         (Archive::total_members_loaded): New variables.
15757         (Archive::setup): Add parameter.  Add option to preread
15758         archive symbols.
15759         (Archive::read_armap): Add counter.
15760         (Archive::get_file_and_offset): New function.
15761         (Archive::get_elf_object_for_member): New function.
15762         (Archive::read_all_symbols): New function.
15763         (Archive::read_symbols): New function.
15764         (Archive::add_symbols): Add counters.
15765         (Archive::include_all_members): Use armap to find members if it's
15766         already built.
15767         (Archive::include_member): Skip reading symbols if already read.
15768         Factored code into Archive::get_file_and_offset and
15769         Archive::get_elf_object_for_member.  Changed call to
15770         Mapfile::report_include_archive_member.
15771         (Archive::print_stats): New function.
15772         * archive.h: Declare Object and Read_symbols_data classes.
15773         (Archive::Archive): Add initializers for new members.
15774         (Archive::setup): Add parameter.
15775         (Archive::print_stats): New function.
15776         (Archive::total_archives, Archive::total_members)
15777         (Archive::total_members_loaded): New variables.
15778         (Archive::get_file_and_offset): New function.
15779         (Archive::get_elf_object_for_member): New function.
15780         (Archive::read_all_symbols): New function.
15781         (Archive::read_symbols): New function.
15782         (Archive::Archive_member): New class.
15783         (Archive::members_): New member.
15784         (Archive::num_members_): New member.
15785         * main.cc: Include archive.h.
15786         (main): Call Archive::print_stats.
15787         * mapfile.cc (Mapfile::report_include_archive_member): Delete
15788         archive parameter; member_name is now the fully-decorated name.
15789         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
15790         * options.h: (General_options): Add --preread-archive-symbols option.
15791         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
15792         Archive::setup.
15793
15794 2008-08-04  Ian Lance Taylor  <iant@google.com>
15795
15796         * symtab.h (Symbol::use_plt_offset): New function.
15797         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
15798         * powerpc.cc (Relocate::relocate): Likewise.
15799         * sparc.cc (Relocate::relocate): Likewise.
15800         * x86_64.cc (Relocate::relocate): Likewise.
15801         * testsuite/weak_plt.sh: New test.
15802         * testsuite/weak_plt_main.cc: New test.
15803         * testsuite/weak_plt_shared.cc: New test.
15804         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
15805         (check_PROGRAMS): Add weak_plt.
15806         (check_DATA): Add weak_plt_shared.so.
15807         (weak_plt_main_pic.o, weak_plt): New targets.
15808         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
15809         * testsuite/Makefile.in: Rebuild.
15810
15811         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
15812         gcctestdir/ld.
15813         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
15814         * testsuite/Makefile.in: Rebuild.
15815
15816 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
15817
15818         * Makefile.am (POTFILES.in): Set LC_ALL=C.
15819         * Makefile.in: Regenerate.
15820         * po/POTFILES.in: Regenerate.
15821
15822 2008-07-29  Ian Lance Taylor  <iant@google.com>
15823
15824         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
15825         symbols before other symbols.
15826         * testsuite/script_test_2.cc (test_addr): Declare.
15827         (test_addr_alias): Declare.
15828         (main): Check that test_addr and test_addr_alias have the right
15829         values.
15830         * testsuite/script_test_2.t: Define test_addr_alias and
15831         test_addr.
15832
15833 2008-07-24  Ian Lance Taylor  <iant@google.com>
15834
15835         PR 5990
15836         * descriptors.cc: New file.
15837         * descriptors.h: New file.
15838         * gold-threads.h (class Hold_optional_lock): New class.
15839         * fileread.cc: Include "descriptors.h".
15840         (File_read::~File_read): Release descriptor rather than closing
15841         it.
15842         (File_read::open) [file]: Call open_descriptor rather than open.
15843         Set is_descriptor_opened_.
15844         (File_read::open) [memory]: Assert that descriptor is not open.
15845         (File_read::reopen_descriptor): New function.
15846         (File_read::release): Release descriptor.
15847         (File_read::do_read): Make non-const.  Reopen descriptor.
15848         (File_read::read): Make non-const.
15849         (File_read::make_view): Reopen descriptor.
15850         (File_read::do_readv): Likewise.
15851         * fileread.h (class File_read): Add is_descriptor_opened_ field.
15852         Update declarations.
15853         * layout.cc: Include "descriptors.h".
15854         (Layout::create_build_id): Use open_descriptor rather than open.
15855         * output.cc: Include "descriptors.h".
15856         (Output_file::open): Use open_descriptor rather than open.
15857         * archive.cc (Archive::const_iterator): Change Archive to be
15858         non-const.
15859         (Archive::begin, Archive::end): Make non-const.
15860         (Archive::count_members): Likewise.
15861         * archive.h (class Archive): Update declarations.
15862         * object.h (Object::read): Make non-const.
15863         * Makefile.am (CCFILES): Add descriptors.cc.
15864         (HFILES): Add descriptors.h.
15865         * Makefile.in: Rebuild.
15866
15867         PR 6716
15868         * gold.h: Always include <clocale>.  Add Solaris workarounds
15869         following code in binutils/sysdep.h.
15870
15871         PR 6048
15872         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
15873         this->eh_frame_hdr_ is NULL before using it.
15874
15875         * dynobj.cc (Versions::Versions): Update comment.
15876
15877         * dynobj.cc (Versions::Versions): If there is an soname, use it as
15878         the base version name.
15879
15880         * stringpool.cc (Stringpool_template::add_with_length): Set key to
15881         array size plus one.
15882         (Stringpool_template::set_string_offsets): Subtract one from key
15883         before using it as an array index.
15884         (Stringpool_template::get_offset_with_length): Likewise.
15885         (Stringpool_template::write_to_buffer): Likewise.
15886         * stringpool.h (Stringpool_template::get_offset_from_key):
15887         Likewise.
15888
15889 2008-07-23  Ian Lance Taylor  <iant@google.com>
15890
15891         PR 6658
15892         * object.h (Merged_symbol_value::value): Do our best to handle a
15893         negative addend.
15894
15895         PR 6647
15896         * script.cc (Version_script_info::get_versions): Don't add empty
15897         version tag to return value.
15898         (Version_script_info::get_symbol_version_helper): Change return
15899         type to bool.  Add pversion parameter.  Change all callers.
15900         (script_register_vers_node): Don't require a non-NULL tag.
15901         * script.h (class Version_script_info): Update declarations.
15902         (Version_script_info::get_symbol_version): Change return type to
15903         bool.  Add version parameter.  Change all callers.
15904         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
15905         handling.  Handle an empty version from a version script.
15906         (Symbol_table::define_special_symbol): Likewise.
15907         * testsuite/ver_test_10.script: New file.
15908         * testsuite/ver_test_10.sh: New file.
15909         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
15910         (check_DATA): Add ver_test_10.syms.
15911         (ver_test_10.syms, ver_test_10.so): New target.
15912         * testsuite/Makefile.in: Rebuild.
15913
15914 2008-07-23  Simon Baldwin  <simonb@google.com>
15915
15916         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
15917         to zero for undefined symbols from dynamic libraries.
15918
15919 2008-07-23  Ian Lance Taylor  <iant@google.com>
15920
15921         * symtab.cc (Symbol_table::resolve): Remove version parameter.
15922         Change all callers.
15923         * symtab.h (class Symbol_table): Update declaration.
15924         * testsuite/ver_test_9.cc: New file.
15925         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
15926         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
15927         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
15928         (ver_test_9.so, ver_test_9.o): New targets.
15929         * testsuite/Makefile.in: Rebuild.
15930
15931 2008-07-22  Ian Lance Taylor  <iant@google.com>
15932
15933         * options.h (class General_options): Define --check-sections.
15934         * layout.cc (Layout::set_segment_offsets): Handle
15935         --check-sections.
15936
15937         * options.h (class General_options): Define -n/--nmagic and
15938         -N/--omagic.
15939         * options.cc (General_options::finalize): For -n/--nmagic or
15940         -N/--omagic, set -static.
15941         * layout.cc (Layout::attach_allocated_section_to_segment): If
15942         -N/--omagic, don't put read-only and read-write sections in
15943         different segments.
15944         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
15945         finding a read-only segment.
15946         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
15947         don't set the minimum segment alignment to the common page size,
15948         and don't set the file offset to the address modulo the page size.
15949         * script-sections.cc (Script_sections::create_segments): If
15950         -n/--omagic, don't put read-only and read-write sections in
15951         different segments.
15952
15953         * cref.cc: New file.
15954         * cref.h: New file.
15955         * options.h (class General_options): Add --print-symbol-counts.
15956         * main.cc (main): Issue defined symbol report if requested.
15957         * archive.cc (Archive::interpret_header): Make into a const member
15958         function.
15959         (Archive::add_symbols): Call Input_objects::archive_start and
15960         archive_stop.
15961         (Archive::const_iterator): Define new class.
15962         (Archive::begin, Archive::end): New functions.
15963         (Archive::include_all_members): Rewrite to use iterator.
15964         (Archive::count_members): New function.
15965         * archive.h (class Archive): Update declarations.
15966         (Archive::filename): New function.
15967         * object.cc: Include "cref.h".
15968         (Sized_relobj::Sized_relobj): Initialize defined_count_.
15969         (Sized_relobj::do_get_global_symbol_counts): New function.
15970         (Input_objects::add_object): Add object to cross-referencer.
15971         (Input_objects::archive_start): New function.
15972         (Input_objects::archive_stop): New function.
15973         (Input_objects::print_symbol_counts): New function.
15974         * object.h: Declare Cref and Archive.
15975         (Object::get_global_symbol_counts): New function.
15976         (Object::do_get_global_symbol_counts): New pure virtual function.
15977         (class Sized_relobj): Add defined_count_ field.  Update
15978         declarations.
15979         (class Input_objects): Add cref_ field.  Update constructor.
15980         Update declarations.
15981         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
15982         defined_count_.
15983         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
15984         symbol counts.
15985         (Sized_dynobj::do_get_global_symbol_counts): New function.
15986         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
15987         defined_count_.  Update declarations.  Define Symbols typedef.
15988         * symtab.cc (Symbol_table::add_from_relobj): Add defined
15989         parameter.  Change all callers.
15990         (Symbol_table::add_from_dynobj): Add sympointers and defined
15991         parameters.  Change all callers.
15992         * symtab.h (class Symbol_table): Update declarations.
15993         * Makefile.am (CCFILES): Add cref.cc.
15994         (HFILES): Add cref.h.
15995         * Makefile.in: Rebuild.
15996
15997 2008-07-22  Simon Baldwin  <simonb@google.com>
15998
15999         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
16000         to zero when writing undefined symbols.
16001
16002 2008-07-22  Ian Lance Taylor  <iant@google.com>
16003
16004         * output.cc (Output_section::add_input_section): Don't try to
16005         merge empty merge sections.
16006
16007 2008-07-21  Craig Silverstein  <csilvers@google.com>
16008
16009         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
16010         Include symbol version in error message.
16011
16012 2008-07-20  Chris Demetriou  <cgd@google.com>
16013
16014         * configure.ac (gold_cv_c_random_seed): New configured variable.
16015         (RANDOM_SEED_CFLAGS): New substituted variable.
16016         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
16017         * configure: Rebuild.
16018         * Makefile.in: Likewise.
16019         * testsuite/Makefile.in: Likewise.
16020
16021 2008-07-18  Ian Lance Taylor  <iant@google.com>
16022
16023         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
16024         where we see NAME/NULL and NAME/VERSION  as separate symbols.
16025         * testsuite/ver_test_main.cc (main): Call t4.
16026         (t4, t4_2a): Define.
16027         * testsuite/ver_test_2.cc (t4_2): Define.
16028         * testsuite/ver_test_2.script: Put t4_2a in VER2.
16029         * testsuite/ver_test_4.cc (t4_2a): Define.
16030         * testsuite/ver_test_4.script: Put t4_2a in VER2.
16031         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
16032
16033 2008-07-17  Ian Lance Taylor  <iant@google.com>
16034
16035         * dynobj.cc (Versions::add_def): If we give an error about a
16036         missing version, go ahead and create the version anyhow.
16037
16038 2008-07-10  Ian Lance Taylor  <iant@google.com>
16039
16040         Handle output sections with more than 0x7fffffff bytes.
16041         * object.h (class Relobj): Change map_to_output_ to
16042         output_sections_, and just keep a section pointer.  Change all
16043         uses.  Move comdat group support to Sized_relobj.
16044         (Relobj::is_section_specially_mapped): Remove.
16045         (Relobj::output_section): Remove poff parameter.  Change all
16046         callers.
16047         (Relobj::output_section_offset): New function.
16048         (Relobj::set_section_offset): Rewrite.
16049         (Relobj::map_to_output): Remove.
16050         (Relobj::output_sections): New function.
16051         (Relobj::do_output_section_offset): New pure virtual function.
16052         (Relobj::do_set_section_offset): Likewise.
16053         (class Sized_relobj): Add section_offsets_ field.  Add comdat
16054         group support from Relobj.  Update declarations.
16055         (Sized_relobj::get_output_section_offset): New function.
16056         (Sized_relobj::do_output_section_offset): New function.
16057         (Sized_relobj::do_set_section_offset): New function.
16058         * object.cc (Relobj::output_section_address): Remove.
16059         (Sized_relobj::Sized_relobj): Initialize new fields.
16060         (Sized_relobj::include_section_group): Cast find_kept_object to
16061         Sized_relobj.
16062         (Sized_relobj::include_linkonce_section): Likewise.
16063         (Sized_relobj::do_layout): Use separate arrays for output section
16064         and output offset.
16065         (Sized_relobj::do_count_local_symbols): Change map_to_output to
16066         output_sections.
16067         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
16068         output_sections and section_offsets.
16069         (Sized_relobj::write_local_symbols): Likewise.
16070         (map_to_kept_section): Compute output address directly.
16071         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
16072         output_sections and section_offsets.
16073         (Sized_relobj::write_sections): Likewise.
16074         (Sized_relobj::relocate_sections): Likewise.
16075         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
16076         * output.h (class Output_reloc): Update declarations.  Change
16077         u2_.relobj to Sized_relobj*.
16078         (class Output_data_reloc): Change add functions to use
16079         Sized_relobj*.
16080         * output.cc (Output_reloc::Output_reloc): Change relobj to
16081         Sized_relobj*.
16082         (Output_reloc::local_section_offset): Change return type to
16083         Elf_Addr.  Use get_output_section_offset.
16084         (Output_reloc::get_address): Likewise.
16085         (Output_section::is_input_address_mapped): Don't call
16086         is_section_specially_mapped.
16087         (Output_section::output_offset): Likewise.
16088         (Output_section::output_address): Likewise.
16089         (Output_section::starting_output_address): Likewise.
16090         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
16091         parameter to Sized_relobj*.
16092         (Copy_relocs::need_copy_reloc): Likewise.
16093         (Copy_relocs::save): Likewise.
16094         * copy-relocs.h (class Copy_relocs): Update declarations.
16095         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
16096         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
16097         * target-reloc.h (relocate_for_relocatable): Change
16098         offset_in_output_section type to Elf_Addr.  Change code that uses
16099         it as well.
16100         * layout.cc (Layout::layout): Always set *off.
16101         * mapfile.cc (Mapfile::print_input_section): Use
16102         output_section_offset.
16103         * i386.cc (Target_i386::copy_reloc): Change object parameter to
16104         Sized_relobj*.
16105         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
16106         * sparc.cc (Target_sparc::copy_reloc): Likewise.
16107         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
16108
16109 2008-07-03  Ian Lance Taylor  <iant@google.com>
16110
16111         * layout.cc (Layout::include_section): Do not discard unrecognized
16112         SHT_STRTAB sections.
16113
16114 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
16115
16116         * script.cc (Lex::can_continue_name): Make '?' allowable in
16117         version-script names.
16118         * testsuite/version_script.map: Change glob pattern to use '?'
16119
16120 2008-06-30  Manish Singh  <yosh@gimp.org>
16121
16122         PR 6585
16123         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
16124         Correct typo.
16125
16126 2008-06-30  Ian Lance Taylor  <iant@google.com>
16127
16128         PR 6660
16129         PR 6682
16130         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
16131         versions]: Don't try to read the value in the contents, since we
16132         don't use it.  Use the template endianness when writing.
16133
16134 2008-06-25  Cary Coutant  <ccoutant@google.com>
16135
16136         * fileread.cc (File_read::make_view): Assert on zero-length view.
16137         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
16138         symbol table when there are no symbols to read.
16139
16140 2008-06-23  Craig Silverstein  <csilvers@google.com>
16141
16142         * version.cc (version_string): Bump to 1.7
16143
16144 2008-06-18  Craig Silverstein  <csilvers@google.com>
16145
16146         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
16147         constant 0xFFFF to type Valtype.
16148         (Powerpc_relocate_functions::rel16_ha): Likewise.
16149
16150 2008-06-17  Ian Lance Taylor  <iant@google.com>
16151
16152         * output.h (Output_section::Input_section): Initialize p2align_ to
16153         zero for Output_section_data constructors.
16154         (Output_section::Input_section::addralign): If not an input
16155         section, return the alignment of the Output_section_data.
16156         * testsuite/copy_test.cc: New file.
16157         * testsuite/copy_test_1.cc: New file.
16158         * testsuite/copy_test_2.cc: New file.
16159         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
16160         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
16161         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
16162         (copy_test_1_pic.o, copy_test_1.so): New targets.
16163         (copy_test_2_pic.o, copy_test_2.so): New targets.
16164         * testsuite/Makefile.in: Rebuild.
16165
16166         * script-sections.cc (Script_sections::place_orphan): Initialize
16167         local variable exact.
16168
16169 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
16170
16171         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
16172
16173 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
16174             David S. Miller  <davem@davemloft.net>
16175
16176         * powerpc.cc: New file.
16177         * Makefile.am (TARGETSOURCES): Add powerpc.cc
16178         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
16179         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
16180         * Makefile.in: Rebuild.
16181
16182 2008-06-09  Ian Lance Taylor  <iant@google.com>
16183
16184         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
16185         <exception>.
16186         (throwing, orig_terminate): New static variables.
16187         (terminate_handler): New static function.
16188         (t2): Set terminate handler.
16189
16190 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
16191
16192         PR 6584
16193         * binary.cc (Binary_to_elf::sized_convert): Fix .data
16194         alignment.
16195
16196 2008-05-30  Cary Coutant  <ccoutant@google.com>
16197
16198         * archive.cc (Archive::include_all_members) Correct to step
16199         over symbol table and extended name table in thin archives.
16200
16201 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
16202
16203         PR 6407
16204         * target-reloc.h (relocate_for_relocatable): Fix new_offset
16205         calculation.
16206
16207 2008-05-28  Caleb Howe  <cshowe@google.com>
16208
16209         * reduced_debug_output.cc: New file.
16210         * reduced_debug_output.h: New file.
16211         * options.h (class General_options): Add --strip-debug-non-line.
16212         * options.cc (General_options::finalize): Add strip_debug_non_line
16213         to the strip heirarchy.
16214         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
16215         fields.
16216         * layout.cc: Include "reduced_debug_output.h".
16217         (Layout::Layout): Initialize new fields.
16218         (line_only_debug_sections): New static array.
16219         (is_lines_only_debug_sections): New static inline function.
16220         (Layout::include_section): Handle --strip-debug-non-line.
16221         (Layout::make_output_section): If --strip-debug-non-line, build
16222         new output sections for .debug_abbrev and .debug_info.
16223         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
16224         gold.  Warn about possible overflow.
16225         (read_signed_LEB_128): Likewise.
16226         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
16227         (read_signed_LEB_128): Declare.
16228         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
16229         (HFILES): Add reduced_debug_output.h.
16230         * Makefile.in: Rebuild.
16231
16232 2008-05-21  Ian Lance Taylor  <iant@google.com>
16233
16234         * mapfile.cc: New file.
16235         * mapfile.h: New file.
16236         * options.h (class General_options): Add -M/--print-map and -Map.
16237         * options.cc (General_options::finalize): Make -M equivalent to
16238         -Map -.
16239         * main.cc: Include <cstdio> and "mapfile.h".
16240         (main): Open mapfile if requested.
16241         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
16242         constructor.  Change caller.
16243         (queue_initial_tasks): Add mapfile parameter.  Change caller.
16244         (queue_middle_tasks): Likewise.
16245         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
16246         declarations.
16247         * archive.cc: Include "mapfile.h".
16248         (Archive::add_symbols): Add mapfile parameter.  Change all
16249         callers.  Pass mapfile, symbol, and reason to include_member.
16250         (Archive::include_all_members): Add mapfile parameter.  Change all
16251         callers.
16252         (Archive::include_member): Add mapfile, sym, and why parameters.
16253         Change all callers.  Report inclusion to map file.
16254         * archive.h: Include "fileread.h".
16255         (class Archive): Update declarations.
16256         (Archive::file): New const method.
16257         (class Add_archive_symbols): Add mapfile_ field.  Update
16258         constructor.  Change all callers.
16259         * readsyms.h (class Read_symbols): Likewise.
16260         (class Finish_group): Likewise.
16261         (class Read_script): Likewise.
16262         * common.cc: Include "mapfile.h".
16263         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
16264         all callers.
16265         (Symbol_table::do_allocate_commons): Likewise.
16266         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
16267         symbol allocation to mapfile.
16268         * common.h (class Allocate_commons_task): Add mapfile_ field.
16269         Update constructor.  Change all callers.
16270         * symtab.h (class Symbol_table): Update declarations.
16271         * layout.cc: Include "mapfile.h".
16272         (Layout_task_runner::run): Print information to mapfile.
16273         (Layout::create_gold_note): Change Output_data_fixed_space to
16274         Output_data_zero_fill.
16275         (Layout::create_build_id): Likewise.
16276         (Layout::print_to_mapfile): New function.
16277         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
16278         constructor.  Change caller.
16279         (class Layout): Declare print_to_mapfile.
16280         * output.cc (Output_section::Input_section::print_to_mapfile): New
16281         function.
16282         (Output_section::add_input_section): If producing a map, always
16283         add to input_sections_ list.
16284         (Output_section::do_print_to_mapfile): New function.
16285         (Output_segment::print_sections_to_mapfile): New function.
16286         (Output_segment::print_section_list_to_mapfile): New function.
16287         * output.h: Include "mapfile.h".
16288         (Output_data::print_to_mapfile): New function.
16289         (Output_data::do_print_to_mapfile): New virtual function.
16290         (Output_segment_headers::do_print_to_mapfile): New function.
16291         (Output_file_header::do_print_to_mapfile): New function.
16292         (Output_data_const::do_print_to_mapfile): New function.
16293         (class Output_data_const_buffer): Add map_name_ field.  Update
16294         constructor.  Change all callers.  Add do_print_to_mapfile
16295         function.
16296         (class Output_data_fixed_space): Likewise.
16297         (class Output_data_space): Likewise.
16298         (class Output_data_zero_fill): New class.
16299         (Output_data_strtab::do_print_to_mapfile): New function.
16300         (Output_data_reloc_base::do_print_to_mapfile): New function.
16301         (Output_relocatable_relocs::do_print_to_mapfile): New function.
16302         (Output_data_group::do_print_to_mapfile): New function.
16303         (Output_data_got::do_print_to_mapfile): New function.
16304         (Output_data_dynamic::do_print_to_mapfile): New function.
16305         (Output_symtab_xindex::do_print_to_mapfile): New function.
16306         (class Output_section): Declare do_print_to_mapflie.  Declare
16307         print_to_mapfile in Input_section.
16308         (class Output_segment): Declare new functions.
16309         * object.h (Sized_relobj::symbol_count): New function.
16310         * script-sections.cc
16311         (Output_section_element_dot_assignment::set_section_addresses):
16312         Change Output_data_fixed_space to Output_data_zero_fill.
16313         (Output_data_expression::do_print_to_mapfile): New function.
16314         * script.cc (read_input_script): Add mapfile parameter.  Change
16315         all callers.
16316         * script.h (read_input_script): Update declaration.
16317         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
16318         (Eh_frame::do_print_to_mapfile): New function.
16319         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
16320         (Output_merge_string::do_print_to_mapfile): New function.
16321         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
16322         function.
16323         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
16324         function.
16325         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
16326         function.
16327         * Makefile.am (CCFILES): Add mapfile.cc.
16328         (HFILES): Add mapfile.h.
16329         * Makefile.in: Rebuild.
16330
16331 2008-05-19  Ian Lance Taylor  <iant@google.com>
16332
16333         * options.h (class General_options): Add -z relro.
16334         * layout.cc (Layout::Layout): Initialize relro_segment_.
16335         (Layout::add_output_section_data): Return the output section.
16336         (Layout::make_output_section): Rcognize relro sections and mark
16337         them appropriately.
16338         (Layout::attach_allocated_section_to_segment): Put relro sections
16339         in a PT_GNU_RELRO segment.
16340         (Layout::create_initial_dynamic_sections): Mark the .dynamic
16341         section as relro.
16342         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
16343         PT_TLS segments.
16344         (Layout::linkonce_mapping): Map d.rel.ro.local to
16345         .data.rel.ro.local.
16346         (Layout::output_section_name): Us .data.rel.ro.local for any
16347         section which begins with that.
16348         * layout.h (class Layout): Update add_output_section_data
16349         declaration.  Add relro_segment_ field.
16350         * output.cc (Output_section::Output_section): Initialize is_relro_
16351         and is_relro_local_ fields.
16352         (Output_segment::add_output_section): Group relro sections.
16353         (Output_segment::is_first_section_relro): New function.
16354         (Output_segment::maximum_alignment): If there is a relro section,
16355         align the segment to the common page size.
16356         (Output_segment::set_section_addresses): Track whether we are
16357         looking at relro sections.  If the last section is a relro
16358         section, align to the common page size.
16359         (Output_segment::set_section_list_addresses): Add in_relro
16360         parameter.  Change all callers.  Align to the page size when
16361         moving from relro to non-relro section.
16362         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
16363         segment.
16364         * output.h (class Output_section): Add is_relro_ and
16365         is_relro_local_ fields.
16366         (Output_section::is_relro): New function.
16367         (Output_section::set_is_relro): New function.
16368         (Output_section::is_relro_local): New function.
16369         (Output_section::set_is_relro_local): New function.
16370         (class Output_segment): Update declarations.
16371         * i386.cc (Target_i386::got_section): Mark .got section as relro.
16372         * sparc.cc (Target_sparc::got_section): Likewise.
16373         * x86_64.cc (Target_x86_64::got_section): Likewise.
16374         * testsuite/relro_test_main.cc: New file.
16375         * testsuite/relro_test.cc: New file.
16376         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
16377         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
16378         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
16379         (relro_test.so, relro_test_pic.o): New targets.
16380         * testsuite/Makefile.in: Rebuild.
16381
16382 2008-05-16  Ian Lance Taylor  <iant@google.com>
16383
16384         * output.cc (Output_segment::add_output_section): Remove front
16385         parameter.
16386         * output.h (class Output_segment): Remove
16387         add_initial_output_section and overloaded add_output_section.
16388         Update declaration of remaining add_output_section.
16389         * layout.cc (Layout::create_interp): Call add_output_section
16390         rather than add_initial_output_section.
16391         (Layout::finish_dynamic_section): Likewise.
16392
16393         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
16394         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
16395         know the dynamic type.
16396         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
16397         field.  Initialize it in constructor.
16398         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
16399         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
16400         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
16401         reloc.
16402
16403         * output.cc (Output_reloc::get_address): Change return type to
16404         Elf_Addr.
16405         * output.h (class Output_reloc): Update get_address declaration.
16406         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
16407         for section addresses.
16408
16409 2008-05-09  Ian Lance Taylor  <iant@google.com>
16410
16411         PR 6493
16412         * gold.cc (gold_nomem): Use return value of write.
16413
16414 2008-05-08  Ian Lance Taylor  <iant@google.com>
16415
16416         * symtab.c (Symbol::init_base_output_data): Add version
16417         parameter.  Change all callers.
16418         (Symbol::init_base_output_segment): Likewise.
16419         (Symbol::init_base_constant): Likewise.
16420         (Symbol::init_base_undefined): Likewise.
16421         (Sized_symbol::init_output_data): Likewise.
16422         (Sized_symbol::init_output_segment): Likewise.
16423         (Sized_symbol::init_constant): Likewise.
16424         (Sized_symbol::init_undefined): Likewise.
16425         (Symbol_table::do_define_in_output_data): If the new symbol has a
16426         version, mark it as the default.
16427         (Symbol_table::do_define_in_output_segment): Likewise.
16428         (Symbol_table::do_define_as_constant): Likewise.
16429         * symtab.h (class Symbol): Update declarations.
16430         (class Sized_symbol): Likewise.
16431         * resolve.cc (Symbol::override_version): New function.
16432         (Symbol::override_base): Call override_version.
16433         (Symbol::override_base_with_special): Likewise.
16434         * testsuite/ver_script_8.script: New file.
16435         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
16436         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
16437         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
16438         (ver_test_8_1.so, ver_test_8_2.so): New targets.
16439
16440 2008-05-06  Ian Lance Taylor  <iant@google.com>
16441
16442         PR 6049
16443         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
16444         functions.
16445         (class General_options): Remove existing --undefined, and add
16446         --no-undefined instead.  Add new --undefined as synonym for -u.
16447         * archive.cc (Archive::add_symbols): Check whether symbol was
16448         named with -u.
16449         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
16450         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
16451         all uses.  Add IS_UNDEFINED.  Update declarations to split
16452         different versions of init_base.  Declare init_base_undefined.
16453         (Symbol::is_defined): Handle IS_UNDEFINED.
16454         (Symbol::is_undefined): Likewise.
16455         (Symbol::is_weak_undefined): Call is_undefined.
16456         (Symbol::is_absolute): Handle IS_CONSTANT.
16457         (class Sized_symbol): Update declarations to split different
16458         versions of init.  Declare init_undefined.
16459         (class Symbol_table): Declare new functions.
16460         * symtab.cc (Symbol::init_base_object): Rename from init_base.
16461         Change all callers.
16462         (Symbol::init_base_output_data): Likewise.
16463         (Symbol::init_base_output_segment): Likewise.
16464         (Symbol::init_base_constant): Likewise.
16465         (Symbol::init_base_undefined): New function.
16466         (Sized_symbol::init_object): Rename from init.  Change all
16467         callers.
16468         (Sized_symbol::init_output_data): Likewise.
16469         (Sized_symbol::init_output_segment): Likewise.
16470         (Sized_symbol::init_constant): Likewise.
16471         (Sized_symbol::init_undefined): New function.
16472         (Symbol_table::add_undefined_symbols_from_command_line): New
16473         function.
16474         (Symbol_table::do_add_undefined_symbols_from_command_line): New
16475         function.
16476         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
16477         (Symbol::output_section): Likewise.
16478         (Symbol::set_output_section): Likewise.
16479         (Symbol_table::sized_finalize_symbol): Likewise.
16480         (Symbol_table::sized_write_globals): Likewise.
16481         * resolve.cc (Symbol_table::should_override): Likewise.
16482         (Symbol::override_base_with_special): Likewise.
16483
16484         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
16485         symbol, change it to have default visibility.
16486         * testsuite/protected_1.cc: New file.
16487         * testsuite/protected_2.cc: New file.
16488         * testsuite/protected_3.cc: New file.
16489         * testsuite/protected_main_1.cc: New file.
16490         * testsuite/protected_main_2.cc: New file.
16491         * testsuite/protected_main_3.cc: New file.
16492         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
16493         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
16494         (protected_1_LDFLAGS, protected_1_LDADD): Define.
16495         (protected_1.so): New target.
16496         (protected_1_pic.o, protected_2_pic.o): New targets.
16497         (protected_3_pic.o): New target.
16498         (check_PROGRAMS): Add protected_2.
16499         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
16500         (protected_2_LDFLAGS, protected_2_LDADD): Define.
16501         * testsuite/Makefile.in: Rebuild.
16502
16503         * options.h (DEFINE_var): Add set_user_set_##varname__.
16504         (DEFINE_bool_alias): New macro.
16505         (class General_options): Define -Bstatic using DEFINE_bool_alias
16506         rather than DEFINE_special.  Add --undefined as an alias for -z
16507         defs.
16508         * options.cc (General_options::parse_Bstatic): Remove.
16509
16510         * options.h (class General_options): Add --fatal-warnings.
16511         * main.cc (main): Implement --fatal-warnings.
16512         * errors.h (Errors::warning_count): New function.
16513
16514         * options.h (class General_options): Add -Bsymbolic-functions.
16515         * symtab.h (Symbol::is_preemptible): Check for
16516         -Bsymbolic-functions.
16517
16518 2008-05-05  Ian Lance Taylor  <iant@google.com>
16519
16520         * options.h (DEFINE_bool): For DASH_Z, create the negative option
16521         as noVARNAME rather than no-VARNAME.
16522         (class General_options): Add option -z combreloc.
16523         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
16524         get_address.
16525         (Output_reloc::sort_before) [SHT_REL]: New function.
16526         (Output_reloc::sort_before) [SHT_RELA]: New function.
16527         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
16528         Sort_relocs_comparison.
16529         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
16530         parameter.  Change all callers.
16531         (Output_data_reloc::Output_data_reloc) [both versions]: Add
16532         sort_relocs parameter.  Change all callers.
16533         * output.cc (Output_reloc::get_address): New function, broken out
16534         of write_rel.
16535         (Output_reloc::write_rel): Call it.
16536         (Output_reloc::compare): New function.
16537         (Output_data_reloc_base::do_write): Optionally sort relocs.
16538
16539         * configure.ac: If targ_extra_obj is set, link it in.
16540         * configure.tgt: Initialize all variables.
16541         (x86_64*): Set targ_extra_obj and targ_extra_size.
16542         * configure: Rebuild.
16543
16544         * object.cc (Sized_relobj::include_section_group): Adjust section
16545         indexes read from group data.  Build vector to pass to
16546         layout_group.
16547         * layout.cc (Layout::layout_group): Add flags and shndxes
16548         parameters.  Remove contents parameter.  Change caller.  Update
16549         explicit instantiations.
16550         * layout.h (class Layout): Update layout_group declaration.
16551         * output.cc (Output_data_group::Output_data_group): Add flags and
16552         input_shndxes parameters.  Remove contents parameter.  Change
16553         caller.
16554         (Output_data_group::do_write): Change input_sections_ to
16555         input_shndxes_.
16556         * output.h (class Output_data_group): Update constructor
16557         declaration.  Rename input_sections_ to input_shndxes_.
16558         * testsuite/many_sections_test.cc: Add template.
16559
16560 2008-04-30  Cary Coutant  <ccoutant@google.com>
16561
16562         * target-reloc.h (relocate_section): Fix dead-pointer bug.
16563
16564         * layout.cc (Layout::include_section): Refactored check for debug
16565         info section.
16566         (Layout::add_comdat): Add new parameters.  Change type
16567         of signature parameter.  Add object and shndx to signatures table.
16568         (Layout::find_kept_object): New function.
16569         * layout.h: Include <cstring>.
16570         (Layout::is_debug_info_section): New function.
16571         (Layout::add_comdat): Add new parameters.
16572         (Layout::find_kept_object): New function.
16573         (Layout::Kept_section): New struct.
16574         (Layout::Signatures): Change type of map range.
16575         * object.cc (Relobj::output_section_address): New function.
16576         (Sized_relobj::include_section_group): Add new parameters.  Change
16577         calls to Layout::add_comdat.  Change to build table of kept comdat
16578         groups and table mapping discarded sections to kept sections.
16579         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
16580         (Sized_relobj::do_layout): Change calls to include_section_group and
16581         include_linkonce_section.
16582         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
16583         value to zero when section is discarded.
16584         (Sized_relobj::map_to_kept_section): New function.
16585         * object.h (Relobj::output_section_address): New function.
16586         (Relobj::Comdat_group): New type.
16587         (Relobj::find_comdat_group): New function.
16588         (Relobj::Comdat_group_table): New type.
16589         (Relobj::Kept_comdat_section): New type.
16590         (Relobj::Kept_comdat_section_table): New type.
16591         (Relobj::add_comdat_group): New function.
16592         (Relobj::set_kept_comdat_section): New function.
16593         (Relobj::get_kept_comdat_section): New function.
16594         (Relobj::comdat_groups_): New field.
16595         (Relobj::kept_comdat_sections_): New field.
16596         (Symbol_value::input_value): Update comment.
16597         (Sized_relobj::map_to_kept_section) New function.
16598         (Sized_relobj::include_linkonce_section): Add new parameter.
16599         * target-reloc.h (Comdat_behavior): New type.
16600         (get_comdat_behavior): New function.
16601         (relocate_section): Add code to map a discarded section to the
16602         corresponding kept section when applying a relocation.
16603
16604 2008-04-30  Craig Silverstein  <csilvers@google.com>
16605
16606         * dwarf_reader.cc (next_generation_count): New static var.
16607         (Addr2line_cache_entry): New struct.
16608         (addr2line_cache): New static var.
16609         (Dwarf_line_info::one_addr2line): Added caching.
16610         (Dwarf_line_info::clear_addr2line_cache): New function.
16611         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
16612         cache-size parameter.
16613         (Dwarf_line_info::one_addr2line_cache): New function.
16614         * symtab.cc (Symbol_table::detect_odr_violations): Pass
16615         new cache-size argument to one_addr2line(), and clear cache.
16616
16617 2008-04-28  Cary Coutant  <ccoutant@google.com>
16618
16619         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
16620         R_386_PC8 relocations.
16621
16622 2008-04-23  Ian Lance Taylor  <iant@google.com>
16623
16624         * object.cc (Sized_relobj::include_section_group): Check for
16625         invalid section group.
16626
16627         * object.cc (make_elf_object): Correct test for 64-bit ELF file
16628         header size.
16629
16630         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
16631         than read for file header.
16632         * archive.cc (Archive::include_member): Likewise.
16633
16634 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
16635
16636         * aclocal.m4: Regenerate.
16637         * configure: Regenerate.
16638
16639 2008-04-19  Ian Lance Taylor  <iant@google.com>
16640
16641         * version.cc (version_string): Bump to 1.6.
16642
16643         * testsuite/Makefile.am (many_sections_r_test): New target.
16644         (many_sections_r_test_SOURCES): Remove.
16645         (many_sections_r_test_DEPENDENCIES): Remove.
16646         (many_sections_r_test_LDFLAGS): Remove.
16647         (many_sections_r_test_LDADD): Remove.
16648
16649         * object.cc (Sized_relobj::do_add_symbols): Always pass
16650         local_symbol_count_ to add_from_relobj.
16651
16652         * testsuite/Makefile.am (many_sections_check.h): Only check one in
16653         every thousand variables.
16654         * testsuite/Makefile.in: Rebuild.
16655
16656         * object.cc (Xindex::initialize_symtab_xindex): New function.
16657         (Xindex::read_symtab_xindex): New function.
16658         (Xindex::sym_xindex_to_shndx): New function.
16659         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
16660         available.
16661         (Sized_relobj::do_initialize_xindex): New function.
16662         (Sized_relobj::do_read_symbols): Adjust section links.
16663         (Sized_relobj::symbol_section_and_value): Add is_ordinary
16664         parameter.  Change all callers.
16665         (Sized_relobj::include_section_group): Adjust section links and
16666         symbol section indexes.
16667         (Sized_relobj::do_layout): Adjust section links.
16668         (Sized_relobj::do_count_local_symbols): Adjust section links and
16669         symbol section indexes.
16670         (Sized_relobj::do_finalize_local_symbols): Distinguish between
16671         ordinary and special symbols.
16672         (Sized_relobj::write_local_symbols): Add symtab_xindex and
16673         dynsym_xindex parameters.  Change all callers.  Adjust section
16674         links.  Use SHN_XINDEX when needed.
16675         (Sized_relobj::get_symbol_location_info): Adjust section links.
16676         Don't get fooled by special symbols.
16677         * object.h (class Xindex): Define.
16678         (class Object): Add xindex_ parameter.  Declare virtual functoin
16679         do_initialize_xindex.
16680         (Object::adjust_sym_shndx): New function.
16681         (Object::set_xindex): New protected function.
16682         (class Symbol_value): Add is_ordinary_shndx_ field.
16683         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
16684         (Symbol_value::value): Assert ordinary section.
16685         (Symbol_value::initialize_input_to_output_map): Likewise.
16686         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
16687         Change all callers.
16688         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
16689         all callers.
16690         (class Sized_relobj): Update declarations.
16691         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
16692         parameter.  Change all callers.
16693         (Sized_relobj::adjust_shndx): New function.
16694         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
16695         field.
16696         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
16697         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
16698         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
16699         (Sized_dynobj::read_dynsym_section): Adjust section links.
16700         (Sized_dynobj::read_dynamic): Likewise.
16701         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
16702         section links.
16703         (Sized_dynobj::do_initialize_xindex): New function.
16704         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
16705         do_initialize_xindex.
16706         (Sized_dynobj::adjust_shndx): New function.
16707         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
16708         dynsym_xindex_ fields.
16709         (Layout::finalize): Add a call to set_section_indexes before
16710         creating the symtab sections.
16711         (Layout::set_section_indexes): Don't do anything if the section
16712         already has a section index.
16713         (Layout::create_symtab_sections): Add shnum parameter.  Change
16714         caller.  Create .symtab_shndx section if needed.
16715         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
16716         caller.
16717         (Layout::allocated_output_section_count): New function.
16718         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
16719         needed.
16720         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
16721         fields.  Update declarations.
16722         (Layout::symtab_xindex): New function.
16723         (Layout::dynsym_xindex): New function.
16724         (class Write_symbols_task): Add layout_ field.
16725         (Write_symbols_task::Write_symbols_task): Add layout parameter.
16726         Change caller.
16727         * output.cc (Output_section_headers::Output_section_headers): Add
16728         shstrtab_section parameter.  Change all callers.
16729         (Output_section_headers::do_sized_write): Store overflow values
16730         for section count and section string table section index in
16731         section header zero.
16732         (Output_file_header::do_sized_write): Check for overflow of
16733         section count and section string table section index.
16734         (Output_symtab_xindex::do_write): New function.
16735         (Output_symtab_xindex::endian_do_write): New function.
16736         * output.h (class Output_section_headers): Add shstrtab_section_.
16737         Update declarations.
16738         (class Output_symtab_xindex): Define.
16739         (Output_section::has_out_shndx): New function.
16740         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
16741         field.
16742         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
16743         Change all callers.
16744         (Sized_symbol::init): Likewise.
16745         (Symbol::output_section): Check for ordinary symbol.
16746         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
16747         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
16748         callers.
16749         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
16750         Change all callers.  Simplify handling of symbols from sections
16751         not included in the link.
16752         (Symbol_table::add_from_dynobj): Handle ordinary symbol
16753         distinction.
16754         (Weak_alias_sorter::operator()): Assert that symbols are
16755         ordinary.
16756         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
16757         distinction.
16758         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
16759         parameters.  Change all callers.
16760         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
16761         symbol distinction.  Use SHN_XINDEX when needed.
16762         (Symbol_table::write_section_symbol): Add symtab_xindex
16763         parameter.  Change all callers.
16764         (Symbol_table::sized_write_section_symbol): Likewise.  Use
16765         SHN_XINDEX when needed.
16766         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
16767         declarations.
16768         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
16769         (Symbol::is_defined): Check is_ordinary.
16770         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
16771         (Symbol::is_absolute, Symbol::is_common): Likewise.
16772         (class Sized_symbol): Update declarations.
16773         (class Symbol_table): Update declarations.
16774         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
16775         parameters.  Change all callers.
16776         (Sized_symbol::override): Likewise.
16777         (Symbol_table::override): Likewise.
16778         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
16779         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
16780         is_ordinary, and orig_st_shndx parameters.  Change all callers.
16781         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
16782         to be in an ordinary section.
16783         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
16784         object and is_ordinary parameters.  Change all callers.
16785         (Sized_dwarf_line_info::read_relocs): Add object parameter.
16786         Change all callers.  Don't add undefined or non-ordinary symbols
16787         to reloc_map_.
16788         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
16789         Change all callers.
16790         * dwarf_reader.h (class Sized_dwarf_line_info): Update
16791         declarations.
16792         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
16793         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
16794         (Sized_relobj::relocate_sections): Likewise.
16795         * target-reloc.h (scan_relocs): Adjust section symbol index.
16796         (scan_relocatable_relocs): Likewise.
16797         * i386.cc (Scan::local): Check for ordinary symbols.
16798         * sparc.cc (Scan::local): Likewise.
16799         * x86_64.cc (Scan::local): Likewise.
16800         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
16801         to symbol_section_and_value.
16802         * testsuite/many_sections_test.cc: New file.
16803         * testsuite/Makefile.am (BUILT_SOURCES): Define.
16804         (check_PROGRAMS): Add many_sections_test.
16805         (many_sections_test_SOURCES): Define.
16806         (many_sections_test_DEPENDENCIES): Define.
16807         (many_sections_test_LDFLAGS): Define.
16808         (BUILT_SOURCES): Add many_sections_define.h.
16809         (many_sections_define.h): New target.
16810         (BUILT_SOURCES): Add many_sections_check.h.
16811         (many_sections_check.h): New target.
16812         (check_PROGRAMS): Add many_sections_r_test.
16813         (many_sections_r_test_SOURCES): Define.
16814         (many_sections_r_test_DEPENDENCIES): Define.
16815         (many_sections_r_test_LDFLAGS): Define.
16816         (many_sections_r_test_LDADD): Define.
16817         (many_sections_r_test.o): New target.
16818         * testsuite/Makefile.in: Rebuild.
16819
16820 2008-04-17  Cary Coutant  <ccoutant@google.com>
16821
16822         * errors.cc (Errors::info): New function.
16823         (gold_info): New function.
16824         * errors.h (Errors::info): New function.
16825         * gold.h (gold_info): New function.
16826         * object.cc (Input_objects::add_object): Print trace output.
16827         * options.cc (options::parse_set): New function.
16828         (General_options::parse_wrap): Deleted.
16829         (General_options::General_options): Deleted initializer.
16830         * options.h (options::String_set): New typedef.
16831         (options::parse_set): New function.
16832         (DEFINE_set): New macro.
16833         (General_options::wrap): Changed to use DEFINE_set. Changed
16834         callers of any_wrap_symbols and is_wrap_symbol.
16835         (General_options::trace, General_options::trace_symbol):
16836         New options.
16837         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
16838         (General_options::wrap_symbols_): Deleted.
16839         * symtab.cc (Symbol_table::add_from_object): Print trace output.
16840
16841 2008-04-17  David S. Miller  <davem@davemloft.net>
16842
16843         * options.cc (General_options::parse_V): New function.
16844         * options.h: Add entries for -V and -Qy.
16845
16846 2008-04-17  Ian Lance Taylor  <iant@google.com>
16847
16848         * common.cc (Symbol_table::allocate_commons): Remove options
16849         parameter.  Change caller.
16850         (Symbol_table::do_allocate_commons): Remove options parameter.
16851         Change caller.  Just call do_allocate_commons_list twice.
16852         (Symbol_table::do_allocate_commons_list): New function, broken out
16853         of do_allocate_commons.
16854         * common.h (class Allocate_commons_task): Remove options_ field.
16855         Update constructor.
16856         * symtab.cc (Symbol_table::Symbol_table): Initialize
16857         tls_commons_.
16858         (Symbol_table::add_from_object): Put TLS common symbols on
16859         tls_commons_ list.
16860         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
16861         which are IN_OUTPUT_DATA.
16862         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
16863         allocate_commons and do_allocate_commons declarations.  Declare
16864         do_allocate_commons_list.
16865         * gold.cc (queue_middle_tasks): Update creation of
16866         Allocate_commons_task to not pass options.
16867         * testsuite/Makefile.am (INCLUDES): Add -I.. .
16868         (TLS_TEST_C_FLAGS): New variable.
16869         (tls_test_c_pic.o): New target.
16870         (tls_test_shared.so): Link in tls_test_c_pic.o.
16871         (tls_test_c_pic_ie.o): New target.
16872         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
16873         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
16874         (tls_test_c.o): New target.
16875         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
16876         (tls_pic_test_LDADD): Likewise.
16877         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
16878         (tls_shared_gd_to_ie_test_LDADD): Likewise.
16879         (tls_test_c_gnu2.o): New target.
16880         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
16881         tls_test_c_gnu2.o.
16882         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
16883         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
16884         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
16885         * testsuite/tls_test.cc: Include "config.h".
16886         (t_last): Call t11_last.
16887         * testsuite/tls_test.h (t11, t11_last): Declare.
16888         * testsuite/tls_test_c.c: New file.
16889         * testsuite/tls_test_main.cc (thread_routine): Call t11.
16890         * configure.ac: Check for OpenMP support.
16891         * configure, config.in, Makefile.in: Rebuild.
16892         * testsuite/Makefile.in: Rebuild.
16893
16894 2008-04-16  Cary Coutant  <ccoutant@google.com>
16895
16896         * i386.cc (Target_i386::define_tls_base_symbol): New function.
16897         (Target_i386::tls_base_symbol_defined_): New field.
16898         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16899         (Target_i386::Scan::global): Likewise.
16900         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
16901         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
16902         (Target_x86_64::tls_base_symbol_defined_): New field.
16903         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16904         (Target_x86_64::Scan::global): Likewise.
16905
16906 2008-04-16  Cary Coutant  <ccoutant@google.com>
16907
16908         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
16909         (Symbol::needs_plt_entry): Allow weak undefined symbols.
16910         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
16911         building shared libraries.
16912         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
16913         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
16914         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
16915         * testsuite/Makefile.in: Rebuild.
16916         * testsuite/weak_undef.h: New file.
16917         * testsuite/weak_undef_file1.cc: Add extra test cases.
16918         * testsuite/weak_undef_file2.cc: Likewise.
16919         * testsuite/weak_undef_test.cc: Likewise.
16920
16921 2008-04-16  David S. Miller  <davem@davemloft.net>
16922
16923         * sparc.cc (Target_sparc::Scan): Change from struct to class.
16924         Add issued_non_pic_error_ field.  Declare check_non_pic.
16925         (Target_sparc::Scan::check_non_pic): New function.
16926         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
16927         (Target_sparc::Scan::global): Likewise.
16928
16929         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
16930         * configure: Rebuild.
16931
16932         * options.h (DEFINE_enable): New macro.
16933         (new_dtags): New enable option.
16934         (initfirst, interpose, loadfltr, nodefaultlib,
16935         nodelete, nodlopen, nodump): New -z options.
16936         * layout.cc (Layout:finish_dynamic_section): If new
16937         dtags enabled, emit DT_RUNPATH.  Also, emit a
16938         DT_FLAGS_1 containing any specified -z flags.
16939
16940 2008-04-16  Ian Lance Taylor  <iant@google.com>
16941
16942         * copy-relocs.cc: New file.
16943         * copy-relocs.h: New file.
16944         * reloc.cc: Remove Copy_relocs code.
16945         * reloc.h: Likewise.
16946         * reloc-types.h (struct Reloc_types) [both versions]: Add
16947         get_reloc_addend_noerror.
16948         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
16949         variants of add_global which take an addend which must be zero.
16950         * i386.cc: Include "copy-relocs.h".
16951         (class Target_i386): Change type of copy_relocs_ to variable,
16952         update initializer.
16953         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
16954         Change all callers.
16955         (Target_i386::do_finalize_sections): Change handling of
16956         copy_relocs_.
16957         * sparc.cc: Include "copy-relocs.h".
16958         (class Target_sparc): Change type of copy_relocs_ to variable,
16959         update initializer.
16960         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
16961         Change all callers.
16962         (Target_sparc::do_finalize_sections): Change handling of
16963         copy_relocs_.
16964         * x86_64.cc: Include "copy-relocs.h".
16965         (class Target_x86_64): Change type of copy_relocs_ to variable,
16966         update initializer.
16967         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
16968         class.  Change all callers.
16969         (Target_x86_64::do_finalize_sections): Change handling of
16970         copy_relocs_.
16971         * Makefile.am (CCFILES): Add copy-relocs.cc.
16972         (HFILES): Add copy-relocs.h.
16973
16974         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
16975
16976         * testsuite/script_test_4.sh: Permit leading zeroes.
16977
16978 2008-04-15  Ian Lance Taylor  <iant@google.com>
16979
16980         * script-sections.cc (Script_sections::create_segments): Use
16981         header_size_adjustment even when there is enough room for the
16982         headers.
16983         * testsuite/script_test_4.sh: New file.
16984         * testsuite/script_test_4.t: New file.
16985         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
16986         (check_DATA): Add script_test_4.stdout.
16987         (MOSTLYCLEANFILES): Likewise.
16988         (script_test_4): New target.
16989         (script_test_4.stdout): New target.
16990         * testsuite/Makefile.in: Rebuild.
16991
16992         * sparc.cc: Add definitions for Output_data_plt_sparc class
16993         constants.
16994
16995 2008-04-14  David S. Miller  <davem@davemloft.net>
16996
16997         * sparc.cc: New file.
16998         * Makefile.am (TARGETSOURCES): Add sparc.cc
16999         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
17000         * configure.tgt: Document targ_extra_size and
17001         targ_extra_big_endian.  Add entries for sparc-* and
17002         sparc64-*.
17003         * configure.ac: Handle targ_extra_size and
17004         targ_extra_big_endian.
17005         * Makefile.in: Rebuild.
17006         * configure: Likewise.
17007         * po/POTFILES.in: Likewise.
17008         * po/gold.pot: Likewise.
17009
17010 2008-04-14  Ian Lance Taylor  <iant@google.com>
17011
17012         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
17013         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
17014         in the name/type/flags to section mapping.  Don't call
17015         allocate_output_section.
17016         (Layout::choose_output_section): Change parameter from adjust_name
17017         to is_input_section.  Don't permit input sections after sections
17018         are attached to segments.  Don't call allocate_output_section.
17019         (Layout::layout_eh_frame): Call update_flags_for_input_section,
17020         not write_enable_output_section.
17021         (Layout::make_output_section): Don't push to
17022         unattached_section_list_ nor call attach_to_segment.  Call
17023         attach_section_to_segment if sections are attached.
17024         (Layout::attach_sections_to_segments): New function.
17025         (Layout::attach_section_to_segment): New function.
17026         (Layout::attach_allocated_section_to_segment): Rename from
17027         attach_to_segment.  Remove flags parameter.
17028         (Layout::allocate_output_section): Remove function.
17029         (Layout::write_enable_output_section): Remove function.
17030         * layout.h (class Layout): Update for above changes.  Add new
17031         field sections_are_attached_.
17032         * output.h (Output_section::update_flags_for_input_section): New
17033         function.
17034         * output.cc (Output_section::add_input_section): Call
17035         update_flags_for_input_section.
17036         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
17037
17038 2008-04-11  Cary Coutant  <ccoutant@google.com>
17039
17040         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
17041         thought unnecessary.
17042         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
17043
17044 2008-04-11  Ian Lance Taylor  <iant@google.com>
17045
17046         * output.h (class Output_section_data): Remove inline definition
17047         of set_addralign.
17048         * output.cc (Output_section_data::set_addralign): New function.
17049
17050 2008-04-11  Cary Coutant  <ccoutant@google.com>
17051
17052         Add support for TLS descriptors for i386 and x86_64.
17053         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
17054         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
17055         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
17056         GOT_TYPE_TLS_DESC.
17057         (Target_i386::got_mod_index_entry): Remove unnecessary code.
17058         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
17059         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
17060         relocations.
17061         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
17062         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
17063         Fix problem with initial-exec relocations.
17064         (Target_i386::Relocate::relocate_tls): Likewise.
17065         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
17066         relaxation.
17067         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
17068         support for section-plus-offset dynamic table entries.
17069         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
17070         (Output_data_dynamic::Dynamic_entry): Add support for
17071         section-plus-offset dynamic table entries.
17072         (Output_data_dynamic::Classification): Likewise.
17073         (Output_data_dynamic::classification_): Renamed offset_.
17074         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
17075         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
17076         (Target_x86_64::make_plt_section): New function.
17077         (Target_x86_64::reserve_tlsdesc_entries): New function.
17078         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
17079         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
17080         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
17081         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
17082         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
17083         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
17084         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
17085         add extra PLT entry for TLS descriptors.
17086         (Output_data_plt_x86_64::got_): New field.
17087         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
17088         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
17089         fields.
17090         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
17091         descriptors.
17092         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
17093         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
17094         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
17095         R_386_TLS_DESC_CALL relocations.
17096         (Target_x86_64::Scan::global): Likewise.
17097         (Target_x86_64::do_finalize_sections): Add dynamic table entries
17098         for TLS descriptors.
17099         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
17100         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
17101         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
17102         GD-to-IE relaxation.
17103         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
17104         and TLS_DESCRIPTORS.
17105         * Makefile.in: Rebuild.
17106         * configure: Rebuild.
17107         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
17108         (tls_test_shared2.so): New target.
17109         (tls_shared_gd_to_ie_test_SOURCES): New variable.
17110         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
17111         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
17112         (tls_shared_gd_to_ie_test_LDADD): New variable.
17113         (tls_shared_gnu2_gd_to_ie_test): New target.
17114         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
17115         New targets.
17116         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
17117         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
17118         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
17119         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
17120         (tls_shared_gnu2_test): New target.
17121         (tls_test_gnu2_shared.so): New target.
17122         (tls_shared_gnu2_test_SOURCES): New variable.
17123         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
17124         (tls_shared_gnu2_test_LDFLAGS): New variable.
17125         (tls_shared_gnu2_test_LDADD): New variable.
17126         * testsuite/Makefile.in: Rebuild.
17127         * testsuite/Makefile.
17128
17129 2008-04-11  Ian Lance Taylor  <iant@google.com>
17130
17131         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
17132         justsyms.t.
17133         * testsuite/Makefile.in: Rebuild.
17134
17135         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
17136         long.
17137         * testsuite/script_test_2.cc (main): Adjust test.
17138
17139 2008-04-11  David S. Miller  <davem@davemloft.net>
17140             Ian Lance Taylor  <iant@google.com>
17141
17142         * options.h (General_options): Add entries for '-Y' and
17143         '-relax'.
17144         * options.cc (General_options:finalize): If -Y was used, add those
17145         entries to the library path instead of the default "/lib" and
17146         "/usr/lib".
17147
17148 2008-04-11  David S. Miller  <davem@davemloft.net>
17149
17150         * testsuite/justsyms.t: Start at 0x100.
17151         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
17152         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
17153         long.
17154         * testsuite/script_test_2.cc: Adjust string and section length
17155         checks.
17156
17157 2008-04-09  Ian Lance Taylor  <iant@google.com>
17158
17159         PR gold/5996
17160         * script-sections.cc (Sections_element::allocate_to_segment): Add
17161         orphan parameter.
17162         (Output_section_definition::allocate_to_segment): Likewise.
17163         (Orphan_output_section::allocate_to_segment): Likewise.
17164         (Script_sections::attach_sections_using_phdrs_clause): Don't
17165         propagate non-PT_LOAD segments to orphan sections.
17166         * testsuite/Makefile.am (script_test_3.stdout): Generate using
17167         readelf rather than objdump.
17168         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
17169         .interp section and PT_INTERP segment are the same size.
17170         * testsuite/Makefile.in: Rebuild.
17171
17172         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
17173         aliases for symbols defined in the same object.
17174         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
17175         (weak_alias_test_SOURCES): New variable.
17176         (weak_alias_test_DEPENDENCIES): New variable.
17177         (weak_alias_test_LDFLAGS): New variable.
17178         (weak_alias_test_LDADD): New variable.
17179         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
17180         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
17181         (weak_alias_test_3.o): New target.
17182         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
17183         * testsuite/weak_alias_test_main.cc: New file.
17184         * testsuite/weak_alias_test_1.cc: New file.
17185         * testsuite/weak_alias_test_2.cc: New file.
17186         * testsuite/weak_alias_test_3.cc: New file.
17187
17188 2008-04-08  Ian Lance Taylor  <iant@google.com>
17189
17190         * options.h (class General_options): Add --noinhibit-exec option.
17191         * main.cc (main): Check --noinhibit-exec.
17192
17193         * options.h (class General_options): Define --wrap as a special
17194         option.  Add wrap_symbols_ field.
17195         (General_options::any_wrap_symbols): New function.
17196         (General_options::is_wrap_symbol): New function.
17197         * options.cc (General_options::parse_wrap): New function.
17198         (General_options::General_options): Initialize wrap_symbols_.
17199         * symtab.cc (Symbol_table::wrap_symbol): New function.
17200         (Symbol_table::add_from_object): Handle --wrap.
17201         * symtab.h (class Symbol_table): Declare wrap_symbol.
17202         * target.h (Target::wrap_char): New function.
17203         (Target::Target_info): Add wrap_char field.
17204         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
17205         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
17206         * testsuite/testfile.cc (Target_test::test_target_info):
17207         Likewise.
17208
17209         * errors.cc (Errors::undefined_symbol): Mention symbol version if
17210         there is one.
17211
17212         * layout.h (class Layout): Add added_eh_frame_data_ field.
17213         * layout.cc (Layout::Layout): Initialize new field.
17214         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
17215         output section until we find a section we merged successfully.
17216         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
17217         that the size be non-zero.
17218
17219         * merge.cc (Object_merge_map::get_output_offset): Remove inline
17220         qualifier.
17221
17222 2008-04-08  Craig Silverstein  <csilvers@google.com>
17223
17224         * configure.ac: Export new conditional variable HAVE_ZLIB.
17225         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
17226         on HAVE_ZLIB.
17227         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
17228         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17229
17230 2008-04-07  Ian Lance Taylor  <iant@google.com>
17231
17232         * version.cc (version_string): Set to "1.5".
17233
17234         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
17235         Add issued_non_pic_error_ field.  Declare check_non_pic.
17236         (Target_x86_64::Scan::check_non_pic): New function.
17237         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
17238         (Target_x86_64::Scan::global): Likewise.
17239
17240         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
17241         addend parameter.  Change caller.  Handle merge sections.
17242         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
17243         Address to Addend.  Don't add in the result of
17244         local_section_offset, pass down the addend and use the returned
17245         value.
17246         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
17247         Update declarations of local_section_offset and symbol_value.
17248         * testsuite/two_file_test_1.cc (t18): New function.
17249         * testsuite/two_file_test_2.cc (f18): New function.
17250         * testsuite/two_file_test_main.cc (main): Call t18.
17251         * testsuite/two_file_test.h (t18, f18): Declare.
17252
17253         * configure.ac: Don't test for objdump, c++filt, or readelf.
17254         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
17255         conditionals.
17256         (TEST_READELF): New variable.
17257         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
17258         (check_PROGRAMS): Add two_file_strip_test.
17259         (two_file_strip_test): New target.
17260         (check_PROGRAMS): Add two_file_same_shared_strip_test.
17261         (two_file_same_shared_strip_test_SOURCES): New variable.
17262         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
17263         (two_file_same_shared_strip_test_LDFLAGS): New variable.
17264         (two_file_same_shared_strip_test_LDADD): New variable.
17265         (two_file_shared_strip.so): New target.
17266         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
17267         (ver_test_5.syms, ver_test_7.syms): Likewise.
17268         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
17269         (strip_test_3.stdout): Use TEST_OBJDUMP.
17270         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17271
17272 2008-04-04  Cary Coutant  <ccoutant@google.com>
17273
17274         * symtab.h (Symbol::is_weak_undefined): New function.
17275         (Symbol::is_strong_undefined): New function.
17276         (Symbol::is_absolute): New function.
17277         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
17278         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
17279         absolute symbols.
17280         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
17281         (weak_undef_test): New target.
17282         * testsuite/Makefile.in: Rebuild.
17283         * testsuite/weak_undef_file1.cc: New file.
17284         * testsuite/weak_undef_file2.cc: New file.
17285         * testsuite/weak_undef_test.cc: New file.
17286
17287 2008-04-03  Craig Silverstein  <csilvers@google.com>
17288
17289         * compressed_output.h (class Output_compressed_section): Use
17290         unsigned buffer.
17291         * compressed_output.cc (zlib_compress): Use unsigned buffers,
17292         add zlib header.
17293         (zlib_compressed_suffix): Removed.
17294         (Output_compressed_section::set_final_data_size): Use unsigned
17295         buffers.
17296         * testsuite/Makefile.am (flagstest_compress_debug_sections):
17297         Fix linker invocation.
17298         (flagstest_o_specialfile_and_compress_debug_sections):
17299         Likewise.
17300         * testsuite/Makefile.in: Regenerated.
17301
17302 2008-04-02  David S. Miller  <davem@davemloft.net>
17303
17304         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
17305         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
17306
17307 2008-04-02  Craig Silverstein  <csilvers@google.com>
17308
17309         * TODO: New file.
17310
17311 2008-04-02  Ian Lance Taylor  <iant@google.com>
17312
17313         * fileread.cc (File_read::find_view): Add byteshift and vshifted
17314         parameters.  Update for new key type to views_.  Change all
17315         callers.
17316         (File_read::read): Adjust for byteshift in returned view.
17317         (File_read::add_view): New function, broken out of
17318         find_and_make_view.
17319         (File_read::make_view): New function, broken out of
17320         find_and_make_view.
17321         (File_read::find_or_make_view): Add offset and aligned
17322         parameters.  Rewrite accordingly.  Change all callers.
17323         (File_read::get_view): Add offset and aligned parameters.  Adjust
17324         for byteshift in return value.
17325         (File_read::get_lasting_view): Likewise.
17326         * fileread.h (class File_read): Update declarations.
17327         (class File_read::View): Add byteshift_ field.  Add byteshift to
17328         constructor.  Add byteshift method.
17329         * archive.h (Archive::clear_uncached_views): New function.
17330         (Archive::get_view): Add aligned parameter.  Change all callers.
17331         * object.h (Object::get_view): Add aligned parameter.  Change all
17332         callers.
17333         (Object::get_lasting_view): Likewise.
17334
17335         * fileread.cc (File_read::release): Don't call clear_views if
17336         there are multiple objects.
17337         * fileread.h (File_read::clear_uncached_views): New function.
17338         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
17339         on the archive.
17340
17341 2008-03-31  Cary Coutant  <ccoutant@google.com>
17342
17343         Add thin archive support.
17344         * archive.cc (Archive::armagt): New const.
17345         (Archive::setup): Remove task parameter and calls to unlock.
17346         (Archive::unlock_nested_archives): New function.
17347         (Archive::read_header): Add nested_off parameter. Change
17348         all callers.
17349         (Archive::interpret_header): Likewise.
17350         (Archive::include_all_members): Change to handle thin
17351         archives.
17352         (Archive::include_member): Likewise.
17353         * archive.h (Archive::Archive): Add new parameters and
17354         initializers.
17355         (Archive::armagt): New const.
17356         (Archive::setup): Remove task parameter.
17357         (Archive::unlock_nested_archives): New function.
17358         (Archive::read_header): Add nested_off parameter.
17359         (Archive::interpret_header): Likewise.
17360         (Archive::Nested_archive_table): New typedef.
17361         (Archive::is_thin_archive_): New field.
17362         (Archive::nested_archives_): New field.
17363         (Archive::options_): New field.
17364         (Archive::dirpath_): New field.
17365         (Archive::task_): New field.
17366         * readsyms.cc (Read_symbols::do_read_symbols): Add check
17367         for thin archives.  Pass additional parameters to
17368         Archive::Archive.  Unlock the archive file after calling
17369         Archive::setup.
17370
17371 2008-03-29  Ian Lance Taylor  <iant@google.com>
17372
17373         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
17374         version symbol to be local.
17375         * testsuite/ver_test_4.sh: New file.
17376         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
17377         (check_DATA): Add ver_test_4.syms.
17378         (ver_test_4.syms): New target.
17379         * testsuite/Makefile.in: Rebuild.
17380
17381         * output.cc
17382         (Output_section::Input_section_sort_entry::has_priority): New
17383         function.
17384         (Output_section::Input_section_sort_entry::match_file_name): New
17385         function.
17386         (Output_section::Input_section_sort_entry::match_section_name):
17387         Remove.
17388         (Output_section::Input_section_sort_entry::match_section_name_prefix):
17389         Remove.
17390         (Output_section::Input_section_sort_entry::match_section_file):
17391         Remove.
17392         (Output_section::Input_section_sort_compare::operator()): Rewrite
17393         using new Input_section_sort_entry functions.  Sort crtbegin and
17394         crtend first.  Sort sections with no priority before sections with
17395         a priority.
17396         * testsuite/initpri1.c (d3): Check j != 4.
17397         (cd5): New constructor/destructor function.
17398         (main): Check j != 2.
17399
17400         * symtab.cc (Symbol_table::add_from_object): If we don't use the
17401         new symbol when resolving, don't call set_is_default.
17402         * testsuite/ver_test_7.cc: New file.
17403         * testsuite/ver_test_7.sh: New file.
17404         * testsuite/Makefile.am (ver_test_7.so): New target.
17405         (ver_test_7.o): New target.
17406         (check_SCRIPTS): Add ver_test_7.sh.
17407         (check_DATA): Add ver_test_7.syms.
17408         (ver_test_7.syms): New target.
17409
17410 2008-03-28  Ian Lance Taylor  <iant@google.com>
17411
17412         * layout.cc (Layout::layout): If we see an input section with a
17413         name that needs sorting, set the must_sort flag for the output
17414         section.
17415         (Layout::make_output_section): If the name of the output section
17416         indicates that it might require sorting, set the may_sort flag.
17417         * output.h (Output_section::may_sort_attached_input_sections): New
17418         function.
17419         (Output_section::set_may_sort_attached_input_sections): New
17420         function.
17421         (Output_section::must_sort_attached_input_sections): New
17422         function.
17423         (Output_section::set_must_sort_attached_input_sections): New
17424         function.
17425         (class Output_section): Declare Input_section_sort_entry.  Define
17426         Input_section_sort_compare.  Declare
17427         sort_attached_input_sections.  Add new fields:
17428         may_sort_attached_input_sections_,
17429         must_sort_attached_input_sections_,
17430         attached_input_sections_are_sorted_.
17431         * output.cc (Output_section::Output_section): Initialize new
17432         fields.
17433         (Output_section::add_input_section): Add an entry to
17434         input_sections_ if may_sort or must_sort are true.
17435         (Output_section::set_final_data_size): Call
17436         sort_attached_input_sections if necessary.
17437         (Output_section::Input_section_sort_entry): Define new class.
17438         (Output_section::Input_section_sort_compare::operator()): New
17439         function.
17440         (Output_section::sort_attached_input_sections): New function.
17441         * configure.ac: Check whether the compiler supports constructor
17442         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
17443         * testsuite/initpri1.c: New file.
17444         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
17445         CONSTRUCTOR_PRIORITY.
17446         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
17447         (initpri1_LDFLAGS): New variable.
17448         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17449
17450 2008-03-27  Ian Lance Taylor  <iant@google.com>
17451
17452         * common.cc (Sort_commons::operator): Correct sorting algorithm.
17453         * testsuite/common_test_1.c: New file.
17454         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
17455         (common_test_1_SOURCES): New variable.
17456         (common_test_1_DEPENDENCIES): New variable.
17457         (common_test_1_LDFLAGS): New variable.
17458
17459         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
17460         and commons_ correctly when NAME/VERSION does not override
17461         NAME/NULL.
17462         * testsuite/ver_test_6.c: New file.
17463         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
17464         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
17465         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
17466
17467 2008-03-26  Ian Lance Taylor  <iant@google.com>
17468
17469         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
17470         of an undefined symbol from a version script.
17471         * testsuite/Makefile.am (ver_test_5.so): New target.
17472         (ver_test_5.o): New target.
17473         (check_SCRIPTS): Add ver_test_5.sh.
17474         (check_DATA): Add ver_test_5.syms.
17475         (ver_test_5.syms): New target.
17476         * testsuite/ver_test_5.cc: New file.
17477         * testsuite/ver_test_5.script: New file.
17478         * testsuite/ver_test_5.sh: New file.
17479         * Makefile.in, testsuite/Makefile.in: Rebuild.
17480
17481         PR gold/5986
17482         Fix problems building gold with gcc 4.3.0.
17483         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
17484         (gold_error_at_location, gold_warning_at_location): Use it.
17485         * configure.ac: Check whether we can compile and use a template
17486         function with a printf attribute.
17487         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
17488         when jumping over bytes.
17489         * object.cc: Instantiate Object::read_section_data.
17490         * debug.h: Include <cstring>
17491         * dwarf_reader.cc: Include <algorithm>
17492         * main.cc: Include <cstring>.
17493         * options.cc: Include <cstring>.
17494         * output.cc: Include <cstring>.
17495         * script.cc: Include <cstring>.
17496         * script.h: Include <string>.
17497         * symtab.cc: Include <cstring> and <algorithm>.
17498         * target-select.cc: Include <cstring>.
17499         * version.cc: Include <string>.
17500         * testsuite/testmain.cc: Include <cstdlib>.
17501         * configure, config.in: Rebuild.
17502
17503 2008-03-25  Ian Lance Taylor  <iant@google.com>
17504
17505         * options.cc: Include "../bfd/bfdver.h".
17506         (options::help): Print bug reporting address.
17507
17508         * version.cc (print_version): Adjust output for current value of
17509         BFD_VERSION_STRING.
17510
17511         * NEWS: New file.
17512
17513         * options.cc (options::help): Print list of supported targets.
17514         * target-select.h: Include <vector>.
17515         (class Target_selector): Make machine_, size_, and is_big_endian_
17516         fields const.  Add bfd_name_ and instantiated_target_ fields.
17517         (Target_selector::Target_selector): Add bfd_name parameter.
17518         (Target_selector::recognize): Make non-virtual, call
17519         do_recognize.
17520         (Target_selector::recognize_by_name): Make non-virtual, call
17521         do_recognize_by_name.
17522         (Target_selector::supported_names): New function.
17523         (Target_selector::bfd_name): New function.
17524         (Target_selector::do_instantiate_target): New pure virtual
17525         function.
17526         (Target_selector::do_recognize): New virtual function.
17527         (Target_selector::do_recognize_by_name): New virtual function.
17528         (Target_selector::instantiate_target): New private function.
17529         (supported_target_names): Declare.
17530         * target-select.cc (Target_selector::Target_selector): Update for
17531         new parameter and fields.
17532         (select_target_by_name): Check that the name matches before
17533         calling recognize_by_name.
17534         (supported_target_names): New function.
17535         * i386.cc (class Target_selector_i386): Update Target_selector
17536         constructor call.  Remove recognize and recognize_by_name.  Add
17537         do_instantiate_target.
17538         * x86_64.cc (class Target_selector_x86_64): Likewise.
17539         * testsuite/testfile.cc (class Target_selector_test): Update for
17540         changes to Target_selector.
17541
17542         * README: Rewrite, with some notes on unsupported features.
17543
17544 2008-03-24  Cary Coutant  <ccoutant@google.com>
17545
17546         * i386.cc (Target_i386::Got_type): New enum declaration.
17547         (Target_i386::Scan::local): Updated callers of Output_data_got
17548         member functions.
17549         (Target_i386::Scan::global): Likewise.
17550         (Target_i386::Relocate::relocate): Likewise.
17551         (Target_i386::Relocate::relocate_tls): Likewise.
17552         * object.h (Got_offset_list): New class.
17553         (Sized_relobj::local_has_got_offset): Added got_type parameter.
17554         (Sized_relobj::local_got_offset): Likewise.
17555         (Sized_relobj::set_local_got_offset): Likewise.
17556         (Sized_relobj::local_has_tls_got_offset): Removed.
17557         (Sized_relobj::local_tls_got_offset): Removed.
17558         (Sized_relobj::set_local_tls_got_offset): Removed.
17559         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
17560         * output.cc (Output_data_got::add_global): Added got_type parameter.
17561         (Output_data_got::add_global_with_rel): Likewise.
17562         (Output_data_got::add_global_with_rela): Likewise.
17563         (Output_data_got::add_global_pair_with_rel): New function.
17564         (Output_data_got::add_global_pair_with_rela): New function.
17565         (Output_data_got::add_local): Added got_type parameter.
17566         (Output_data_got::add_local_with_rel): Likewise.
17567         (Output_data_got::add_local_with_rela): Likewise.
17568         (Output_data_got::add_local_pair_with_rel): New function.
17569         (Output_data_got::add_local_pair_with_rela): New function.
17570         (Output_data_got::add_global_tls): Removed.
17571         (Output_data_got::add_global_tls_with_rel): Removed.
17572         (Output_data_got::add_global_tls_with_rela): Removed.
17573         (Output_data_got::add_local_tls): Removed.
17574         (Output_data_got::add_local_tls_with_rel): Removed.
17575         (Output_data_got::add_local_tls_with_rela): Removed.
17576         * output.h (Output_data_got::add_global): Added got_type parameter.
17577         (Output_data_got::add_global_with_rel): Likewise.
17578         (Output_data_got::add_global_with_rela): Likewise.
17579         (Output_data_got::add_global_pair_with_rel): New function.
17580         (Output_data_got::add_global_pair_with_rela): New function.
17581         (Output_data_got::add_local): Added got_type parameter.
17582         (Output_data_got::add_local_with_rel): Likewise.
17583         (Output_data_got::add_local_with_rela): Likewise.
17584         (Output_data_got::add_local_pair_with_rel): New function.
17585         (Output_data_got::add_local_pair_with_rela): New function.
17586         (Output_data_got::add_global_tls): Removed.
17587         (Output_data_got::add_global_tls_with_rel): Removed.
17588         (Output_data_got::add_global_tls_with_rela): Removed.
17589         (Output_data_got::add_local_tls): Removed.
17590         (Output_data_got::add_local_tls_with_rel): Removed.
17591         (Output_data_got::add_local_tls_with_rela): Removed.
17592         * resolve.cc (Symbol::override_base_with_special): Removed
17593         reference to has_got_offset_ field.
17594         * symtab.cc (Symbol::init_fields): Replaced initialization
17595         of got_offset_ with got_offsets_.  Removed initialization
17596         of has_got_offset_
17597         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
17598         (Symbol::got_offset): Likewise.
17599         (Symbol::set_got_offset): Likewise.
17600         (Symbol::has_tls_got_offset): Removed.
17601         (Symbol::tls_got_offset): Removed.
17602         (Symbol::set_tls_got_offset): Removed.
17603         (Symbol::got_offset_): Removed.
17604         (Symbol::tls_mod_got_offset_): Removed.
17605         (Symbol::tls_pair_got_offset_): Removed.
17606         (Symbol::got_offsets_): New field.
17607         (Symbol::has_got_offset): Removed.
17608         (Symbol::has_tls_mod_got_offset): Removed.
17609         (Symbol::has_tls_pair_got_offset): Removed.
17610         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
17611         (Target_x86_64::Scan::local): Updated callers of Output_data_got
17612         member functions.
17613         (Target_x86_64::Scan::global): Likewise.
17614         (Target_x86_64::Relocate::relocate): Likewise.
17615         (Target_x86_64::Relocate::relocate_tls): Likewise.
17616
17617 2008-03-25  Ben Elliston  <bje@au.ibm.com>
17618
17619         * yyscript.y: Fix spelling error in comment.
17620
17621 2008-03-24  Ian Lance Taylor  <iant@google.com>
17622
17623         * options.h (class General_options): Define build_id option.
17624         * layout.h (class Layout): Declare write_build_id, create_note,
17625         create_build_id.  Add build_id_note_ member.
17626         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
17627         "libiberty.h", "md5.h", "sha1.h".
17628         (Layout::Layout): Initialize eh_frame_data_,
17629         eh_frame_hdr_section_, and build_id_note_.
17630         (Layout::finalize): Call create_build_id.
17631         (Layout::create_note): New function, broken out of
17632         Layout::create_gold_note.
17633         (Layout::create_gold_note): Call create_note.
17634         (Layout::create_build_id): New function.
17635         (Layout::write_build_id): New function.
17636         (Close_task_runner::run): Call write_build_id.
17637
17638         * x86_64.cc: Correct license to GPLv3.
17639
17640 2008-03-23  Ian Lance Taylor  <iant@google.com>
17641
17642         * options.cc: Include "demangle.h".
17643         (parse_optional_string): New function.
17644         (parse_long_option): Handle takes_optional_argument.
17645         (parse_short_option): Update dash_z initializer.  Handle
17646         takes_optional_argument.
17647         (General_options::General_options): Initialize do_demangle_.
17648         (General_options::finalize): Set do_demangle_.  Handle demangling
17649         style.
17650         * options.h (parse_optional_string): Declare.
17651         (struct One_option): Add optional_arg field.  Update constructor.
17652         Update call constructor calls.  Add takes_optional_argument
17653         function.
17654         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
17655         (DEFINE_optional_string): Define.
17656         (General_options::demangle): Change from DEFINE_bool to
17657         DEFINE_optional_string.
17658         (General_options::no_demangle): New function.
17659         (General_options::do_demangle): New function.
17660         (General_options::set_do_demangle): New function.
17661         (General_options::execstack_status_): Move definition to end of
17662         class definition.
17663         (General_options::static_): Likewise.
17664         (General_options::do_demangle_): New field.
17665         * object.cc (big_endian>::get_symbol_location_info): Call
17666         Options::do_demangle, not Options::demangle.
17667         * symtab.cc (demangle): Likewise.
17668
17669 2008-03-22  Ian Lance Taylor  <iant@google.com>
17670
17671         * gold.h: Include <cstddef> and <sys/types.h>
17672         * options.h: Include <cstring>.
17673
17674 2008-03-21  Ian Lance Taylor  <iant@google.com>
17675
17676         * Added source code to GNU binutils.
17677 \f
17678 Copyright (C) 2008-2015 Free Software Foundation, Inc.
17679
17680 Copying and distribution of this file, with or without modification,
17681 are permitted in any medium without royalty provided the copyright
17682 notice and this notice are preserved.
17683
17684 Local Variables:
17685 mode: change-log
17686 left-margin: 8
17687 fill-column: 74
17688 version-control: never
17689 End: