71bee61cf01f9df418e7e92c182d0e246f6b6046
[external/binutils.git] / gold / ChangeLog
1 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
2
3         PR gold/18959
4         * stringpool.cc (Stringpool_template::new_key_offset): Align all
5         strings, even zero-length.
6         (Stringpool_template::set_string_offsets): Likewise.
7
8 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
9
10         * s390.cc: New file.
11         * Makefile.am (TARGETSOURCES): Add s390.cc.
12         (ALL_TARGETOBJS): Add s390.o.
13         * Makefile.in: Regenerate.
14         * configure.ac: Add s390 support.
15         * configure: Regenerate.
16         * configure.tgt: Add s390-*-* and s390x-*-*.
17         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Add s390
18         support.
19
20 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
21
22         * archive.cc (Archive::sym64name): New const.
23         (Archive::setup): Add support for SYM64 armap.
24         (Archive::read_armap): Likewise.
25         (Archive::interpret_header): Likewise.
26         (Archive::const_iterator::read_next_header): Likewise.
27         * archive.h (Archive::sym64name): New const.
28         (Archive::read_armap): Add mapsize template parameter.
29
30 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
31
32         * dynobj.cc (Dynobj::create_elf_hash_table): Create hash table with
33         target-specific entry size.
34         (Dynobj::sized_create_elf_hash_table): Add size template parameter.
35         * dynobj.h (Dynobj::sized_create_elf_hash_table): Likewise.
36         * layout.cc (Layout::create_dynamic_symtab): Set entsize to
37         hash_entry_size.
38         * target.h (Target::hash_entry_size): New method.
39         (Target::Target_info::hash_entry_size): New data member.
40
41         * aarch64.cc (Target_aarch64::aarch64_info): Add hash_entry_size.
42         * arm.cc (Target_arm::arm_info): Likewise.
43         (Target_arm_nacl::arm_nacl_info): Likewise.
44         * i386.cc (Target_i386::i386_info): Likewise.
45         (Target_i386_nacl::i386_nacl_info): Likewise.
46         (Target_iamcu::iamcu_info): Likewise.
47         * mips.cc (Target_mips::mips_info): Likewise.
48         (Target_mips_nacl::mips_nacl_info): Likewise.
49         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
50         * sparc.cc (Target_sparc::sparc_info): Likewise.
51         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
52         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
53         (Target_x86_64_nacl::x86_64_nacl_info): Likewise.
54         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
55
56 2015-10-28  H.J. Lu  <hongjiu.lu@intel.com>
57
58         PR gold/19177
59         * i386.cc (Target_i386::Relocate::relocate): Check R_386_GOT32
60         and R_386_GOT32X relocations without base register.
61
62 2015-10.27  Han Shen  <shenhan@google.com>
63
64         PR gold/19042 - unsupported reloc 311/312.
65
66         * aarch64.cc (Target_aarch64::Scan::local): Add support for
67         reloc 311/312.
68
69 2015-10-22  H.J. Lu  <hongjiu.lu@intel.com>
70
71         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
72         Treat R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX the same
73         as R_X86_64_GOTPCREL.
74         (Target_x86_64<size>::Scan::local): Likewise.
75         (Target_x86_64<size>::Scan::possible_function_pointer_reloc):
76         Likewise.
77         (Target_x86_64<size>::Scan::global): Likewise.
78         (Target_x86_64<size>::Relocate::relocate): Likewise.
79         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
80         Likewise.
81
82 2015-10-22  H.J. Lu  <hongjiu.lu@intel.com>
83
84         * i386.cc (Target_i386::Scan::get_reference_flags(): Treat
85         R_386_GOT32X the same as R_386_GOT32.
86         (Target_i386::Scan::local): Likewise.
87         (Target_i386::Scan::possible_function_pointer_reloc): Likewise.
88         (Target_i386::Scan::global): Likewise.
89         (Target_i386::Relocate::relocate): Likewise.
90         (Target_i386::Relocatable_size_for_reloc::get_size_for_reloc):
91         Likewise.
92
93 2015-10-20  H.J. Lu  <hongjiu.lu@intel.com>
94
95         * testsuite/Makefile.am (x86_64_mov_to_lea11): Replace
96         x86_64_mov_to_lea1.o with x86_64_mov_to_lea2.o.
97         (x86_64_mov_to_lea12): Replace x86_64_mov_to_lea2.o with
98         x86_64_mov_to_lea1.o.
99         * testsuite/Makefile.in: Regenerated.
100
101 2015-10-16  H.J. Lu  <hongjiu.lu@intel.com>
102
103         PR gold/19119
104         * options.h (General_options): Remove "obsolete" from -m.
105         * parameters.cc (set_parameters_target): Check if input target
106         is compatible with output emulation set by "-m emulation".
107
108 2015-10-13  H.J. Lu  <hongjiu.lu@intel.com>
109
110         PR gold/19118
111         * i386.cc (Target_iamcu): New class.
112         (Target_selector_iamcu): Likewise.
113         (Target_iamcu::iamcu_info): New variable.
114         (target_selector_iamcu): Likewise.
115
116 2015-10-07  Andreas Schwab  <schwab@suse.de>
117
118         * aarch64.cc (aarch64_info): Set abi_pagesize to 64K.
119
120 2015-10-06  Cary Coutant  <ccoutant@gmail.com>
121
122         PR gold/18855
123         * sparc.cc (Sparc_relocate_functions::gdop_hix22): Remove addend
124         parameter.
125         (Sparc_relocate_functions::gdop_lox10): Likewise.
126         (Target_sparc::Relocate::relocate): Use addend when computing
127         symbol value for R_SPARC_GOTDATA_OP*.
128
129 2015-09-07  Cary Coutant  <ccoutant@gmail.com>
130
131         PR gold/18930
132         PR gold/18886
133         * resolve.cc (Symbol::override_base): Don't convert IFUNC symbols here.
134         * symtab.cc (Symbol_table::add_from_dynobj): Convert them here instead.
135
136 2015-09-02  H.J. Lu  <hongjiu.lu@intel.com>
137
138         PR gold/18886
139         * resolve.cc (Symbol::override_base): Turn IFUNC symbols from
140         shared libraries into normal FUNC symbols.
141         * symtab.cc (Symbol_table::sized_write_symbol): Assert IFUNC
142         symbols aren't from shared libraries.
143
144 2015-09-02  Alan Modra  <amodra@gmail.com>
145
146         PR 18878
147         * powerpc.cc (Target_powerpc): Add savres_section_ and accessor.
148         (Target_powerpc::Branch_info::make_stub): Determine whether long
149         branch stub is for save/restore function.
150         (Branch_stub_ent): Add save_res_, and extra parm to constructor.
151         (Stub_table): Add need_save_res_.
152         (Stub_table:clear_stubs): Clear need_save_res_.
153         (Stub_table:set_address_and_size): Add save/restore section size.
154         (Stub_table::add_long_branch_entry): Add save_res param.  Set
155         need_save_res_, but don't add space for save/restore stubs.
156         (Stub_table::find_long_branch_entry): Return offset to local copy
157         of save/restore func.
158         (Stub_table::do_write): Don't output save/restore stubs.  Instead
159         copy the save/restore functions.
160         (Output_data_save_res:contents): New accessor.
161         (Target_powerpc::define_save_restore_funcs): Set savres_section_.
162
163 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
164
165         PR gold/18847
166         * script-sections.cc (Memory_region::set_address): New method.
167         (Script_sections::find_memory_region): Add explicit_only parameter.
168         (Output_section_definition::set_section_addresses): Handle case where
169         script specifies both address and vma region.
170         * script-sections.h (Script_sections::find_memory_region): Add
171         explicit_only parameter.
172
173 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
174
175         PR gold/18859
176         * object.cc (Input_objects::add_object): Store objects in a map,
177         indexed by soname; update as-needed flag when necessary.
178         * object.h (Object::clear_as_needed): New method.
179         (Input_objects::so_names_): Change from set to map.
180
181 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
182
183         PR gold/14746
184         * expression.cc (Expression::Expression_eval_info): Add
185         is_valid_pointer field.
186         (Expression::eval_maybe_dot): Add is_valid_pointer parameter.
187         Adjust all callers.
188         (Addr_expression::value_from_output_section): Check whether address
189         is valid.
190         * script.cc (Symbol_assignment::set_if_absolute): Defer assignment
191         if evaluation failed due to address that is not yet valid.
192         * script.h: (Expression::eval_maybe_dot): Add is_valid_pointer
193         parameter.
194
195 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
196
197         PR gold/18866
198         PR gold/18703
199         * symtab.cc (Symbol_table): Reorder conditions to avoid internal error.
200
201 2015-08-20  Alan Modra  <amodra@gmail.com>
202
203         PR gold/18846
204         * target-reloc.h (relocate_relocs <RELOC_ADJUST_FOR_SECTION_RELA>):
205         Subtract os->address() from addend.
206         * powerpc.cc (relocate_relocs): Likewise.
207
208 2015-08-12  Simon Dardis  <simon.dardis@imgtec.com>
209
210         * mips.cc (plt0_entry_o32, plt0_entry_n32, plt0_entry_n64,
211         lazy_stub_normal_1, lazy_stub_normal_1_n64,
212         lazy_stub_normal_2, lazy_stub_normal_2_n64, lazy_stub_big,
213         lazy_stub_big_n64, lazy_stub_micromips32_normal_1_n64,
214         lazy_stub_micromips32_normal_2_n64, lazy_stub_micromips32_big,
215         lazy_stub_micromips32_big_n64): Update to use 'or' for move instead
216         of 'addu/daddu'.
217
218 2015-07-27  H.J. Lu  <hongjiu.lu@intel.com>
219
220         * configure: Regenerated.
221
222 2015-07-26  Doug Kwan  <dougkwan@google.com>
223
224         * testsuite/arm_unaligned_reloc.{s,sh}: Make test less sensitive to
225           disassembler output format.
226
227 2015-07-23  Ian Coolidge  <icoolidge@google.com>
228         Plumb --pic-veneer option for gold.
229
230         * arm.cc (Reloc_stub::stub_type_for_reloc): Plumb to stub
231         generation.
232         * options.h (General_options): Add --pic-veneer option.
233
234 2015-07-22  H.J. Lu  <hongjiu.lu@intel.com>
235
236         PR gold/18663
237         * testsuite/Makefile.am (script_test_1_SOURCES): Set to
238         script_test_1a.cc script_test_1b.cc.
239         (script_test_11_r.o): Replace script_test_11.o with
240         script_test_11a.o script_test_11b.o.
241         (script_test_11.o): Removed.
242         (script_test_11a.o): New.
243         (script_test_11b.o): Likewise.
244         * testsuite/Makefile.in: Regenerated.
245         * testsuite/script_test_1.h: New file.
246         * testsuite/script_test_1b.cc: Likewise.
247         * testsuite/script_test_11.h: Likewise.
248         * testsuite/script_test_11b.c: Likewise.
249         * testsuite/script_test_1.cc: Renamed to ...
250         * testsuite/script_test_1a.cc: This.
251         Include "script_test_1.h".
252         (main): Call check_int and check_ptr.
253         * testsuite/script_test_11.c: Renamed to ...
254         * testsuite/script_test_11a.c: This.
255         Include "script_test_11.h".
256         (main): Call ptr_equal.
257
258 2015-07-22  H.J. Lu  <hongjiu.lu@intel.com>
259
260         PR gold/18628
261         * testsuite/ifuncdep2.c (global): Change protected to hidden.
262         * testsuite/ifuncmod1.c (global): Likewise.
263         * testsuite/ifuncmod5.c (global): Likewise.
264
265 2015-07-22  Alan Modra  <amodra@gmail.com>
266
267         * aarch64.cc (try_fix_erratum_843419_optimized): Warning fix.
268
269 2015-07-21  Cary Coutant  <ccoutant@gmail.com>
270
271         PR gold/18548
272         * symtab.cc (Symbol_table::do_define_in_output_data): Check for
273         forced local symbol even when oldsym != NULL.
274         (Symbol_table::do_define_in_output_segment): Likewise.
275         (Symbol_table::do_define_as_constant): Likewise.
276
277 2015-07-21  Cary Coutant  <ccoutant@gmail.com>
278
279         PR gold/18698
280         * archive.cc (Library_base::should_include_member): Don't use entry
281         point for relocatable links, or if target is not yet valid.
282         * parameters.cc (Parameters::entry): Check target_valid().
283
284 2015-07-20  Han Shen  <shenhan@google.com>
285
286         Optimize erratum 843419 fix.
287
288         * aarch64.cc (AArch64_insn_utilities::is_adr): New method.
289         (AArch64_insn_utilities::aarch64_adr_encode_imm): New method.
290         (AArch64_insn_utilities::aarch64_adrp_decode_imm): New method.
291         (E843419_stub): New sub-class of Erratum_stub.
292         (AArch64_relobj::try_fix_erratum_843419_optimized): New method.
293         (AArch64_relobj::section_needs_reloc_stub_scanning): Try optimized fix.
294         (AArch64_relobj::create_erratum_stub): Add 1 argument.
295         (Target_aarch64::scan_erratum_843419_span): Pass in adrp insn offset.
296
297 2015-07-20  Han Shen  <shenhan@google.com>
298
299         Fix arm elf header flags wrt hardfp bit.
300
301         * arm.cc (Target_arm::do_adjust_elf_header): Set flags into view.
302
303 2015-07-20  H.J. Lu  <hongjiu.lu@intel.com>
304
305         PR gold/18689
306         * layout.cc (Layout::layout): Clear the SHF_COMPRESSED flag bit
307         from input group section for relocatable link.
308         * testsuite/Makefile.am (check_SCRIPTS): Add pr18689.sh.
309         (check_DATA): Add pr18689.stdout.
310         (MOSTLYCLEANFILES): Add pr18689a.o pr18689b.o.
311         (pr18689.stdout): New rule.
312         (pr18689a.o): Likewise.
313         (pr18689b.o): Likewise.
314         (pr18689.o): Likewise.
315         * testsuite/pr18689.c: New file.
316         * testsuite/pr18689.sh: Likewise.
317         * testsuite/Makefile.in: Regenerated.
318
319 2015-07-20  Yiran Wang  <yiran@google.com>
320         Cary Coutant  <ccoutant@gmail.com>
321
322         PR gold/15574
323         * resolve.cc (Symbol_table): Remove warning about references
324         from shared objects to hidden symbols.
325         * testsuite/Makefile.am (hidden_test): Add hidden_test.syms.
326         * testsuite/Makefile.in: Regenerate.
327         * testsuite/hidden_test.sh: Check dynamic symbol table; update
328         expected error messages.
329
330 2015-07-14  H.J. Lu  <hongjiu.lu@intel.com>
331
332         * compressed_output.cc (Output_compressed_section::set_final_data_size):
333         Make --compress-debug-sections=zlib the same as
334         --compress-debug-sections=zlib-gabi.
335         * testsuite/Makefile.am (flagstest_compress_debug_sections.check):
336         Expect ".debug_.*" with the SHF_COMPRESSED bit, instead of
337         ".zdebug_".
338         * testsuite/Makefile.in: Regenerated.
339
340 2015-07-12  H.J. Lu  <hongjiu.lu@intel.com>
341
342         PR gold/18322
343         * compressed_output.cc (zlib_compress): Add argument for
344         compression header size.  Set header size to compression header
345         size if it isn't 0.  Don't write out the zlib header here.
346         (Output_compressed_section::set_final_data_size): Support
347         zlib-gnu and zlib-gabi compressions.  Pass compression header
348         size to zlib_compress and write out compression header.  Set
349         the SHF_COMPRESSED bit for zlib-gabi compression.  Otherwise
350         clear the SHF_COMPRESSED bit
351         * options.h (compress_debug_sections): Add zlib-gnu and
352         zlib-gabi.
353         * output.h (Output_section::set_flags): New.
354         * testsuite/Makefile.am (check_PROGRAMS): Add
355         flagstest_compress_debug_sections_none,
356         flagstest_compress_debug_sections_gnu and
357         flagstest_compress_debug_sections_gabi.
358         (check_DATA): Add flagstest_compress_debug_sections_none.stdout.
359         flagstest_compress_debug_sections.stdout,
360         flagstest_compress_debug_sections.cmp,
361         flagstest_compress_debug_sections.check,
362         flagstest_compress_debug_sections_gnu.stdout,
363         flagstest_compress_debug_sections_gnu.cmp,
364         flagstest_compress_debug_sections_gnu.check,
365         flagstest_compress_debug_sections_gabi.stdout,
366         flagstest_compress_debug_sections_gabi.cmp and
367         flagstest_compress_debug_sections_gabi.check.
368         (flagstest_compress_debug_sections_none): New.
369         (flagstest_compress_debug_sections_none.stdout): Likewise.
370         (flagstest_compress_debug_sections.stdout): Likewise.
371         (flagstest_compress_debug_sections.check): Likewise.
372         (flagstest_compress_debug_sections.cmp): Likewise.
373         (flagstest_compress_debug_sections_gnu): Likewise.
374         (flagstest_compress_debug_sections_gnu.stdout): Likewise.
375         (flagstest_compress_debug_sections_gnu.check): Likewise.
376         (flagstest_compress_debug_sections_gnu.cmp): Likewise.
377         (flagstest_compress_debug_sections_gabi): Likewise.
378         (flagstest_compress_debug_sections_gabi.stdout): Likewise.
379         (flagstest_compress_debug_sections_gnu.check): Likewise.
380         (flagstest_compress_debug_sections_gnu.cmp): Likewise.
381         * testsuite/Makefile.in: Regenerated.
382
383 2015-07-12  H.J. Lu  <hongjiu.lu@intel.com>
384
385         PR gold/18321
386         * compressed_output.h (decompress_input_section): Add arguments
387         for ELF class, big endian and sh_flags.
388         * compressed_output.cc (decompress_input_section): Likewise.
389         Support the SHF_COMPRESSED section.
390         * dynobj.h (Dynobj): Add elfsize and is_big_endian member
391         functions.
392         * plugin.h (Pluginobj): Likewise.
393         * layout.cc (Layout::get_output_section_flags): Also clear the
394         SHF_COMPRESSED bit.
395         * object.h (Compressed_section_info): Add flag to store sh_flags.
396         (Object): Add pure virtual elfsize and is_big_endian member
397         functions.
398         * object.cc (need_decompressed_section): Don't skip the ".zdebug"
399         prefix here.
400         (build_compressed_section_map): Check SHF_COMPRESSED for
401         uncompressed size.  Store sh_flags in Compressed_section_info.
402         Pass size, big_endian and sh_flags to decompress_input_section.
403         Skip the ".debug"/".zdebug" prefix when passing section name to
404         need_decompressed_section.
405         (Sized_relobj_file<size, big_endian>::do_find_special_section):
406         Don't check ".zdebug_*" sections.
407         (Object::decompressed_section_contents): Pass ELF class, big
408         endian and sh_flags to decompress_input_section.
409         * reloc.cc (Sized_relobj_file<size, big_endian>::write_sections):
410         Likewise.
411         * testsuite/Makefile.am (check_DATA): Add
412         debug_msg_cdebug_gabi.err and gdb_index_test_2_gabi.stdout.
413         (MOSTLYCLEANFILES): Add debug_msg_cdebug_gabi.err and
414         gdb_index_test_2_gabi.stdout.
415         (debug_msg_cdebug_gabi.o): New.
416         (odr_violation1_cdebug_gabi.o): Likewise.
417         (odr_violation2_cdebug_gabi.o): Likewise.
418         (debug_msg_cdebug_gabi.err): Likewise.
419         (check_SCRIPTS): Add gdb_index_test_2_gabi.sh.
420         (gdb_index_test_cdebug_gabi.o): Likewise.
421         (gdb_index_test_2_gabi): Likewise.
422         (gdb_index_test_2_gabi.stdout): Likewise.
423         * testsuite/gdb_index_test_2_gabi.sh: New file.
424         * testsuite/Makefile.in: Regenerated.
425
426 2015-07-09  Han Shen  <shenhan@google.com>
427
428         Use "gold_info" instead of "gold_warning" for erratum fix.
429
430         * aarch64.cc (Target_aarch64::scan_erratum_843419_span): Use
431         'gold_info'.
432         (Target_aarch64::scan_erratum_835769_span): USe 'gold_info'.
433
434 2015-07-09  Han Shen  <shenhan@google.com>
435
436         Drop missing symbol warning for arm/aarch64.
437
438         * aarch64.cc (AArch64_relobj::scan_errata): Drop missing symbol warning.
439         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Drop missing
440         symbol warning.
441
442 2015-07-07  Han Shen  <shenhan@google.com>
443
444         Make gold aarch64 accept long form of mapping symbols.
445
446         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Make legal
447         of mapping symbols.
448
449 2015-06-29  Doug Kwan  <dougkwan@google.com>
450
451         * testsuite/arm_bl_out_of_range.s: Align stub table so that it appears
452           at address expected by test.
453         * testsuite/arm_cortex_a8_b.s: Ditto.
454         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
455         * testsuite/arm_cortex_a8_bl.s: Ditto.
456         * testsuite/arm_cortex_a8_blx.s: Ditto.
457         * testsuite/arm_cortex_a8_local.s: Ditto.
458         * testsuite/arm_fix_v4bx.s: Ditto.
459         * testsuite/arm_unaligned_reloc.s: Ditto.
460         * testsuite/thumb_bl_out_of_range.s: Ditto.
461         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
462         * testsuite/thumb_blx_out_of_range.s: Ditto.
463
464 2015-06-29  Han Shen  <shenhan@google.com>
465
466         Patch for erratum 843419 internal error.
467
468         * aarch64.cc (Erratum_stub::Insn_utilities): New typedef.
469         (Erratum_stub::update_erratum_insn): New method.
470         (Stub_table::relocate_stubs): Modified to place relocated insn.
471         (AArch64_relobj::fix_errata): Modified gold_assert.
472
473 2015-06-12  Han Shen  <shenhan@google.com>
474
475         Fix erratum 835769.
476
477         * aarch64.cc (AArch64_insn_utilities::BYTES_PER_INSN): Move
478         defintion outside class definition.
479         (AArch64_insn_utilities::AARCH64_ZR): New static constant.
480         (AArch64_insn_utilities::aarch64_op31): New member.
481         (AArch64_insn_utilities::aarch64_ra): New member.
482         (AArch64_insn_utilities::aarch64_mac): New member.
483         (AArch64_insn_utilities::aarch64_mlxl): New member.
484         (ST_E_835769): New global enum member.
485         (Stub_table::relocate_stubs): Add 835769 handler.
486         (Stub_template_repertoire::Stub_template_repertoire): Install new
487         stub type.
488         (AArch64_relobj::scan_errata): This func is renamed from
489         scan_erratum_843419.
490         (AArch64_relobj::do_count_local_symbols): Add 835769 handler.
491         (AArch64_relobj::do_relocate_sections): Add 835769 handler.
492         (AArch64_relobj::scan_sections_for_stubs): Add 835769 handler.
493         (Target_aarch64::scan_erratum_835769_span): New method.
494         (Target_aarch64::create_erratum_stub): New method.
495         (Target_aarch64::is_erratum_835769_sequence): New method.
496         (Target_aarch64::scan_erratum_843419_sequence): Move part of the
497         code into create_erratum_stub.
498         * options.h (fix_cortex_a53_835769): New option.
499
500 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
501
502         * aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
503         outside class body.
504         (Reloc_stub::STUB_ADDR_ALIGN): Likewise.
505
506 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
507
508         PR gold/17731
509         * layout.cc (corresponding_uncompressed_section_name): New function.
510         (Layout::choose_output_section): Call it.
511         * layout.h (corresponding_uncompressed_section_name): New function.
512         * script-sections.cc (Input_section_info::set_section_name): Check
513         for compressed debug section (.zdebug style).
514
515 2015-06-11  Jing Yu  <jingyu@google.com>
516
517         * testsuite/Makefile.am: Add -O0 for script_test_12 test.
518         * testsuite/Makefile.in: Regenerate.
519
520 2015-06-11  Davide Italiano  <dccitaliano@gmail.com>
521
522         * gold.h (is_cident): Correct typo.
523
524 2015-06-10  Han Shen  <shenhan@google.com>
525         Patch for erratum-843419 (2 of 2 - fix erratum occurrences).
526
527         Now fixing for 843419 is fully functional.
528
529         The first part of the erratum fix CL is here -
530         https://sourceware.org/ml/binutils/2015-04/msg00229.html
531
532         * aarch64.cc(global enum): New constants representing stub types.
533         (Stub_template): New POD struct.
534         (Stub_template_repertoire): New class.
535         (Stub_base): New class.
536         (Erratum_stub): New class.
537         (Reloc_stub): Refactored to be a subclass of Stub_base.
538         (Reloc_stub::Stub_type): Removed.
539         (Reloc_stub::offset): Moved to Stub_base.
540         (Reloc_stub::set_offset): Moved to Stub_base.
541         (Reloc_stub::destination_address): Moved to Stub_base.
542         (Reloc_stub::set_destination_address): Moved to Stub_base.
543         (Reloc_stub::reset_destination_address): Moved to Stub_base.
544         (Reloc_stub::stub_type): Renamed and moved to Stub_base.
545         (Reloc_stub::stub_size): Renamed and moved to Stub_base.
546         (Reloc_stub::stub_insns): Renamed and moved to Stub_base.
547         (Reloc_stub::write): Moved to Stub_base.
548         (Reloc_stub::invalid_offset): Moved to Stub_base.
549         (Reloc_stub::invalid_address): Moved to Stub_base.
550         (Reloc_stub::stub_type_): Renamed and moved to Stub_base.
551         (Reloc_stub::stub_insns_): Moved to Stub_base.
552         (Reloc_stub::offset_): Moved to Stub_base.
553         (Reloc_stub::destination_address_): Moved to Stub_base.
554         (Stub_table::The_aarch64_relobj): New typedef.
555         (Stub_table::The_erratum_stub): New typedef.
556         (Stub_table::The_erratum_stub_less): New typedef.
557         (Stub_table::The_erratum_stub_set): New typedef.
558         (Stub_table::The_erratum_stub_set_iter): New typedef.
559         (Stub_table::empty): Added emptiness testing for erratum stubs.
560         (Stub_table::add_erratum_stub): New method to add an erratum stub.
561         (Stub_table::find_erratum_stub): New method.
562         (Stub_table::find_erratum_stubs_for_input_section): New method.
563         (Stub_table::erratum_stub_address): New method.
564         (Stub_table::update_date_size_changed_p): Modified to handle erratum stubs.
565         (Stub_table::do_addralign): Modified to handle erratum stubs.
566         (Stub_table::erratum_stubs_): New member.
567         (Stub_table::erratum_stub_size_): New member.
568         (Stub_table::relocate_stubs): Modified to handle erratum stubs.
569         (Stub_table::do_write): Modified to handle erratum stubs.
570         (AArch64_relobj::The_erratum_stub): New typedef.
571         (AArch64_relobj::Erratum_stub_set_iter): New typedef.
572         (AArch64_relobj::fix_errata): New method.
573         (Target_aarch64::The_reloc_stub_type): Removed.
574         (Target_aarch64::The_erratum_stub): New typede.
575         (AArch64_relocate_functions::construct_b): New method.
576
577 2015-06-08  Nick Clifton  <nickc@redhat.com>
578
579         * po/fr.po: New French Translation.
580
581 2015-06-07  Cary Coutant  <ccoutant@gmail.com>
582
583         PR gold/18288
584         * resolve.cc (symbol_to_bits): Remove type parameter; adjust all
585         callers. Don't use STT_COMMON to check for common symbols.
586         (Symbol_table::resolve): Warn if relocatable object has STT_COMMON
587         symbol that's not in a common section.
588         * symtab.h (Symbol::is_common): Don't use STT_COMMON to check for
589         common symbols.
590
591 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
592
593         PR gold/18200
594         * Makefile.am (diststuff): Add target.
595         * Makefile.in: Regenerate.
596
597 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
598
599         PR gold/17498
600         * object.cc (Sized_relobj_file::do_count_local_symbols): Discard
601         temporary locals in merge sections.
602         * options.cc (General_options::parse_discard_all): New method.
603         (General_options::parse_discard_locals): New method.
604         (General_options::parse_discard_none): New method.
605         (General_options::General_options): Initialize discard_locals_.
606         * options.h (--discard-all): Convert to special option.
607         (--discard-locals): Likewise.
608         (--discard-none): New option.
609         (General_options::discard_all): New method.
610         (General_options::discard_locals): New method.
611         (General_options::discard_sec_merge): New method.
612         (General_options::Discard_locals): New enum.
613         (General_options::discard_locals_): New data member.
614
615 2015-06-03  Cary Coutant  <cary@google.com>
616
617         * script-sections.cc (Script_sections::Script_sections): Initialize
618         segments_created_.
619         (Script_sections::create_note_and_tls_segments): Set flag when
620         segments are created.
621         (Script_sections::expected_segment_count): Count PT_INTERP.
622         (Script_sections::attach_sections_using_phdrs_clause): Set flag when
623         segments are created.
624         * script-sections.h (Script_sections::segments_created_): New data
625         member.
626
627 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
628
629         PR gold/15370
630         * script-sections.cc
631         (Output_section_element_input::set_section_addresses): When there
632         are several patterns with no sort spec, put all sections in the same
633         bin.
634         * testsuite/Makefile.am (script_test_12): New testcase.
635         (script_test_12i): New testcase.
636         * testsuite/Makefile.in: Regenerate.
637         * testsuite/script_test_12.t: New test linker script.
638         * testsuite/script_test_12i.t: New test linker script.
639         * testsuite/script_test_12a.c: New test source file.
640         * testsuite/script_test_12b.c: New test source file.
641
642 2015-06-02  Cary Coutant  <ccoutant@gmail.com>
643
644         * nacl.h (Sniff_file): Switch parameters to get_view to get an
645         aligned view.
646
647 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
648
649         PR gold/17819
650         * gold.cc (queue_final_tasks): When --build-id=tree, queue a
651         separate task to schedule the build id computation.
652         * layout.cc (Hash_task::Hash_task): Remove build_id_blocker,
653         add Output_file and offset.
654         (Hash_task::run): Get and release the input views.
655         (Hash_task::is_runnable): Always return NULL (always runnable).
656         (Layout::queue_build_id_tasks): Remove.
657         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
658         parameters; use them instead of class members.
659         (Build_id_task_runner::run): New function.
660         (Close_task_runner::run): Pass array_of_hashes and size_of_hashes
661         to write_build_id.
662         * layout.h (Layout::queue_build_id_tasks): Remove.
663         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
664         parameters.
665         (Layout::array_of_hashes_): Remove.
666         (Layout::size_of_array_of_hashes_): Remove.
667         (Layout::input_view_): Remove.
668         (Build_id_task_runner): New class.
669         (Close_task_runner::Close_task_runner): Add array_of_hashes and
670         size_of_hashes parameters.
671         (Close_task_runner::array_of_hashes_): New data member.
672         (Close_task_runner::size_of_hashes_): New data member.
673         * testsuite/Makefile.am
674         (flagstest_compress_debug_sections_and_build_id_tree): New test.
675         * testsuite/Makefile.in: Regenerate.
676
677 2015-06-01  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
678
679         * merge.cc (get_input_merge_map): Update for data structure change.
680         (get_or_make_input_merge_map): Update for data structure change.
681         * merge.h (Object_merge_map): Use a std::vector<std::pair>> instead of
682         a std::map. Remove first_shnum_, first_map_, second_shnum_, second_map_.
683
684 2015-05-16  Alan Modra  <amodra@gmail.com>
685
686         * reloc.cc (Sized_relobj_file::find_functions): Use function_location.
687         * powerpc.cc (Target_powerpc::do_calls_non_split): New function.
688         (addi_12_1, addis_2_12, addis_12_1, cmpld_7_12_0): New constants.
689         (lis_0): Rename from lis_0_0.
690
691 2015-04-29  Cary Coutant  <cary@google.com>
692             Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
693
694         * gc.h (Garbage_collection::is_section_garbage): Change Object*
695         to Relobj*.
696         (Garbage_collection::add_reference): Likewise.
697         (Garbage_collection::gc_process_relocs): Likewise. Don't push
698         object/shndx pair onto *secvec for dynamic objects. Don't follow
699         relocations pointing to dynamic objects for GC.
700         * icf.cc (Icf::find_identical_sections): Change Object* to Relobj*.
701         (Icf::unfold_section): Likewise.
702         (Icf::is_section_folded): Likewise.
703         (Icf::get_folded_section): Likewise.
704         * icf.h: (Icf::get_folded_section): Likewise.
705         (Icf::unfold_section): Likewise.
706         (Icf::is_section_folded): Likewise.
707         (Icf::section_has_function_pointers): Likewise.
708         (Icf::set_section_has_function_pointers): Likewise.
709         * object.h (Section_id): Likewise.
710         (Const_section_id): Likewise.
711         * output.cc (Output_section::update_section_layout): Likewise.
712         * output.h: (Output_section_lookup_maps::find_relaxed_input_section):
713         Likewise.
714         * plugin.cc (update_section_order): Likewise.
715         (unique_segment_for_sections): Likewise.
716         * powerpc.cc (Powerpc_relobj::add_reference): Likewise.
717         (Target_powerpc::do_gc_add_reference): Likewise.
718         (Target_powerpc::gc_process_relocs): Likewise.
719         (Target_powerpc::do_gc_add_reference): Likewise.
720         * symtab.cc (Symbol_table::is_section_folded): Likewise.
721         (Symbol_table::gc_mark_symbol): Likewise.
722         * symtab.h: (Symbol_table::is_section_folded): Likewise.
723         * target.h: (Sized_target::gc_add_reference): Likewise.
724         (Sized_target::do_gc_add_reference): Likewise.
725
726 2015-04-29  Nick Clifton  <nickc@redhat.com>
727
728         * po/fi.po: Updated Finnish translation.
729
730 2015-04-28  Alan Modra  <amodra@gmail.com>
731
732         * powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather
733         than unsigned int for find_global_entry result temp.  Compare
734         against invalid_address.
735         (Target_powerpc::do_plt_address_for_global): Likewise.
736         (Target_powerpc::Relocate::relocate): Likewise.  Don't assert
737         on plt call stub existence for debug info.  Do assert for plt
738         and global entry stub existence if an alloc section.
739
740 2015-04-28  Alan Modra  <amodra@gmail.com>
741
742         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert
743         on missing global entry stub due to bogus debug info.
744
745 2015-04-27  Han Shen  <shenhan@google.com>
746
747         * options.h (--fix-cortex-a53-843419): Rename option.
748         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Use renamed
749         option.
750         (AArch64_relobj::scan_sections_for_stubs): Use renamed option.
751
752 2015-04-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
753
754         PR gold/18327
755         * output.cc (Output_section::is_input_address_mapped): Assume a missing
756         entry is mapped.
757         * testsuite/Makefile.am: Add the eh_test test.
758         * testsuite/Makefile.in: Regenerate.
759         * testsuite/eh_test_a.cc: New test.
760         * testsuite/eh_test_b.cc: New test.
761
762 2015-04-23  Sriraman Tallam  <tmsriram@google.com>
763
764         * options.h (--weak-unresolved-symbols): New option.
765         * symtab.cc (Symbol_table::sized_write_globals): Change symbol
766         binding to weak with new option.
767         * symtab.h (is_weak_undefined): Check for new option.
768         (is_strong_undefined): Check for new option.
769         * testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
770         * testsuite/Makefile.in: Regenerate.
771         * testsuite/weak_unresolved_symbols_test.cc: New file.
772
773 2015-04-20  Ian Coolidge  <icoolidge@google.com>
774
775         * symtab.cc (Symbol::should_add_dynsym_entry): Return true for
776         GNU_UNIQUE.
777
778 2015-04-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
779
780         * gc.cc (Garbage_collection::do_transitive_closure): Use back and
781         push_back.
782         * gc.h (Garbage_collection): Use a std::vector instead of a std::queue.
783         * object.cc (Sized_relobj_file::do_layout): Use push_back.
784         * powerpc.cc (process_gc_mark): Use push_back.
785         (Target_powerpc::do_gc_mark_symbol): Use push_back.
786         * symtab.cc (Symbol_table::gc_mark_symbol): Use push_back.
787
788 2015-04-16  Han Shen  <shenhan@google.com>
789
790         * aarch64.cc (AArch64_insn_utilities): New utility class.
791         (AArch64_relobj::Mapping_symbol_position): New struct.
792         (AArch64_relobj::Mapping_symbol_info): New typedef.
793         (AArch64_relobj::do_count_local_symbols): New function overriding
794         parent's implementation.
795         (AArch64_relobj::mapping_symbol_info_): New member
796         (AArch64_relobj::scan_erratum_843419): New method.
797         (Target_aarch64::scan_erratum_843419_span): New method.
798         (Target_aarch64::is_erratum_843419_sequence): New method.
799         * options.h (fix_cortex_a53): New option.
800
801 2015-04-09  Cary Coutant  <ccoutant@google.com>
802
803         * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
804         in a PIE link.
805         * testsuite/Makefile.am (tls_pie_test.sh): New test.
806         * testsuite/Makefile.in: Regenerate.
807         * testsuite/tls_pie_test.sh: New.
808
809 2015-04-09  Cary Coutant  <ccoutant@google.com>
810
811         * debug.h (DEBUG_LOCATION): New.
812         (DEBUG_ALL): Include DEBUG_LOCATION.
813         (debug_string_to_enum): Add DEBUG_LOCATION.
814         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
815         output to print correct context.
816         (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
817         up to 4 more locations at the beginning of the function.
818         * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
819         result before sorting list of line numbers.
820         * testsuite/debug_msg.sh: Allow range of line numbers for
821         canonical results on optimized code.
822
823 2015-04-07  HC Yen <hc.yen@mediatek.com>
824
825         Add AArch32 support for gold linker.
826         gold/
827         * arm.cc: Add V8 arch combine table.
828
829 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
830
831         * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
832
833 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
834
835         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
836         to find by using the return value of insert.
837
838 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
839
840         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
841         constructor call.
842
843 2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>
844
845         PR gold/17641
846         * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
847         (Target_x86_64::Scan::local): Don't create GOT entry, when we
848         can convert mov to lea.
849         (Target_x86_64::Scan::global): Ditto.
850         (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
851         %reg to lea foo(%rip), %reg if possible.
852         * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
853         * testsuite/x86_64_mov_to_lea1.s: New.
854         * testsuite/x86_64_mov_to_lea2.s: Ditto.
855         * testsuite/x86_64_mov_to_lea3.s: Ditto.
856         * testsuite/x86_64_mov_to_lea4.s: Ditto.
857         * testsuite/x86_64_mov_to_lea.sh: Ditto.
858
859 2015-04-02  H.J. Lu  <hongjiu.lu@intel.com>
860
861         * configure: Regenerated.
862
863 2015-04-01  Ilya Tocar  <ilya.tocar@intel.com>
864
865         PR gold/17640
866         * i386.cc (Target_i386::can_convert_mov_to_lea): New.
867         (Target_i386::Scan::local): Don't create GOT entry, when we
868         can convert GOT to GOTOFF.
869         (Target_i386::Scan::global): Ditto.
870         (Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
871         lea foo@GOTOFF(%reg), %reg if possible.
872         * testsuite/Makefile.am (i386_mov_to_lea): New test.
873         * testsuite/i386_mov_to_lea1.s: New.
874         * testsuite/i386_mov_to_lea2.s: Ditto.
875         * testsuite/i386_mov_to_lea3.s: Ditto.
876         * testsuite/i386_mov_to_lea4.s: Ditto.
877         * testsuite/i386_mov_to_lea5.s: Ditto.
878         * testsuite/i386_mov_to_lea.sh: Ditto.
879
880 2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>
881
882         * Makefile.am (ZLIB): New.
883         (ZLIBINC): Likewise.
884         (AM_CFLAGS): Add $(ZLIBINC).
885         (AM_CXXFLAGS): Likewise.
886         (ldadd_varldadd_var): Add $(ZLIB).
887         (incremental_dump_LDADD): Likewise.
888         (dwp_LDADD): Likewise.
889         * compressed_output.cc: Don't check HAVE_ZLIB_H to include
890         <zlib.h>.
891         (zlib_compress): Don't check HAVE_ZLIB_H.
892         (zlib_decompress): Likewise.
893         * options.h (compress_debug_sections): Likewise.
894         * configure.ac (AM_CONDITIONAL): Removed.
895         * testsuite/Makefile.am (ZLIB): New.
896         (LDADD): Add $(ZLIB).
897         Don't check HAVE_ZLIB.
898         * Makefile.in: Regenerated.
899         * config.in: Likewise.
900         * configure: Likewise.
901         * testsuite/Makefile.in: Likewise.
902
903 2015-03-30  Jing Yu  <jingyu@google.com>
904
905         * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
906         TLSLD_ADD_DTPREL_LO12_NC.
907         * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
908         _TLS_MODULE_BASE_ point to the start of tls segment.
909         (Target_aarch64::optimize_tls_reloc): Add cases for
910         R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
911         R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
912         (Target_aarch64::Scan::local): Likewise.
913         (Target_aarch64::Scan::global): Likewise.
914         (Target_aarch64::Relocate::relocate): Likewise.
915         (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
916         subtracting tls segment size from symbol value for TLSLD_*_DTPREL
917         relocations.
918
919 2015-03-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
920
921         * merge.cc (Object_merge_map::add_mapping): call
922         Object_merge_map::Input_merge_map::add_mapping.
923         (Object_merge_map::Input_merge_map::add_mapping): New.
924         (Output_merge_data::do_add_input_section): Call
925         get_or_make_input_merge_map before a loop.
926         (Output_merge_string<Char_type>::finalize_merged_data): Call
927         get_or_make_input_merge_map before a loop.
928         * merge.h (Object_merge_map): Make Input_merge_map public.
929         * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
930         (Relobj::get_or_create_merge_map): New.
931         * object.h (Relobj::get_or_create_merge_map): New.
932
933 2015-03-24  Alan Modra  <amodra@gmail.com>
934
935         PR 18147
936         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
937         relocation errors for branches to strong undefined symbols.
938
939 2015-03-23  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
940
941         * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
942         (Object_merge_map::is_merge_section_for): Remove.
943         (Object_merge_map::find_merge_section): New.
944         * merge.h (Object_merge_map::is_merge_section_for): Remove.
945         (Object_merge_map::find_merge_section): New.
946         (Object_merge_map::get_input_merge_map): Add a const version.
947         * object.cc (Relobj::is_merge_section_for): Remove.
948         (Relobj::find_merge_section): New.
949         * object.h (Relobj::is_merge_section_for): Remove.
950         (Relobj::find_merge_section): New.
951         * output.cc
952         (Output_section::Input_section::is_merge_section_for): Remove.
953         (Output_section::add_merge_input_section): Don't call
954         add_merge_input_section.
955         (Output_section::find_merge_section): Return const. Use
956         object->find_merge_section.
957         (Output_section::build_lookup_maps): Don't build a map for
958         merge sections.
959         (Output_section::is_input_address_mapped): Return false if
960         section is not found.
961         (Output_section::find_starting_output_address): Use
962         find_merge_section instead of is_merge_section_for.
963         (Output_section::add_script_input_section):  Don't build a map for
964         merge sections.
965         * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
966         (Output_section_lookup_maps::find_merge_section): Remove.
967         (Output_section_lookup_maps::add_merge_input_section) Remove.
968         (Output_section::find_merge_section): Return const.
969
970 2015-03-22  Cary Coutant  <cary@google.com>
971
972         PR gold/18106
973         * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
974         non-SIB form of lea, with nop after the call.
975
976 2015-03-21  Cary Coutant  <cary@google.com>
977
978         PR gold/14217
979         * output.cc (Output_segment::is_first_section_relro): Don't ignore
980         .tdata section.
981         (Output_segment::set_section_addresses): Don't align size of relro
982         segment for .tbss.
983
984 2015-03-21  Cary Coutant  <cary@google.com>
985
986         PR gold/18010
987         * stringpool.cc (Stringpool_template): Don't optimize if section
988         alignment is greater than sizeof(char).
989
990 2015-03-21  Cary Coutant  <cary@google.com>
991
992         PR gold/18048
993         * script-c.h (script_include_directive): Add first_token parameter.
994         * script.cc (script_include_directive): Add first_token parameter, and
995         pass it to read_script_file.
996         * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
997         (PARSING_MEMORY_DEF): New tokens.
998         (top): Add new productions for INCLUDE files.
999         (file_cmd): Replace file_or_sections_cmd with copy of its productions.
1000         Pass PARSING_LINKER_SCRIPT to script_include_directive.
1001         (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
1002         (section_cmd): Pass PARSING_SECTION_CMDS.
1003         (file_or_sections_cmd): Remove.
1004         (memory_def): Pass PARSING_MEMORY_DEF.
1005         * testsuite/Makefile.am (memory_test_2): New test.
1006         * testsuite/Makefile.in: Regenerate.
1007         * testsuite/memory_test_inc.t: New script file.
1008         * testsuite/memory_test_inc_1.t.src: New script file.
1009         * testsuite/memory_test_inc_2.t.src: New script file.
1010         * testsuite/memory_test_inc_3.t.src: New script file.
1011
1012 2015-03-21  Cary Coutant  <cary@google.com>
1013
1014         * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
1015         (Sized_relobj_dwo::setup): Build compressed section map.
1016         (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
1017         * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
1018         section map.
1019         * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
1020         compressed_sections_ field.
1021         (build_compressed_section_map): Take Object instead of
1022         Sized_relobj_file parameter; add decompress_if_needed parameter.
1023         (Sized_relobj_file::do_find_special_sections): Store compressed
1024         section map in parent Object.
1025         (Sized_relobj_file::do_decompressed_section_contents): Move
1026         implementation to Object::decompressed_section_contents.
1027         (Sized_relobj_file::do_discard_decompressed_sections): Move
1028         implementation to Object::discard_decompressed_sections.
1029         * object.h (build_compressed_section_map): Declare.
1030         (Object::Object): Add compressed_sections_ field.
1031         (Object::section_is_compressed): Move implementation here.
1032         (Object::decompressed_section_contents): De-virtualize.
1033         (Object::discard_decompressed_sections): De-virtualize.
1034         (Object::do_section_is_compressed): Delete.
1035         (Object::do_decompressed_section_contents): Delete.
1036         (Object::set_compressed_sections): New method.
1037         (Object::compressed_sections): New method.
1038         (Object::compressed_sections_): New data member.
1039         (Compressed_section_info, Compressed_section_map): Move to top of file.
1040         (Sized_relobj_file::do_section_is_compressed): Delete.
1041         (Sized_relobj_file::do_decompressed_section_contents): Delete.
1042         (Sized_relobj_file::do_discard_decompressed_sections): Delete.
1043         (Sized_relobj_file::compressed_sections_): Move to Object class.
1044
1045 2015-03-21  Cary Coutant  <ccoutant@google.com>
1046
1047         PR gold/18152
1048         * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
1049         deferred objects.
1050
1051 2015-03-11  Cary Coutant  <ccoutant@google.com>
1052
1053         * options.cc (General_options::finalize): Don't allow -z relro
1054         with incremental linking.
1055         * testsuite/Makefile.am (incremental_test): Add -z norelro.
1056         (incremental_test_2): Likewise.
1057         (incremental_test_3): Likewise.
1058         (incremental_test_4): Likewise.
1059         (incremental_test_5): Likewise.
1060         (incremental_test_6): Likewise.
1061         (incremental_copy_test): Likewise.
1062         (incremental_common_test_1): Likewise.
1063         (incremental_comdat_test_1): Likewise.
1064         * testsuite/Makefile.in: Regenerate.
1065
1066 2015-03-09  Cary Coutant  <ccoutant@google.com>
1067
1068         PR gold/14675
1069         * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
1070         return enum indicating whether .eh_frame section is empty, optimizable,
1071         unrecognized, or an end marker. Adjust explicit instantiations.
1072         * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
1073         (Eh_frame::add_ehframe_input_section): Change return type.
1074         * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
1075         * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
1076         to the .eh_frame output section until we see the end marker.
1077         (Layout::finalize_eh_frame_section): New.
1078         * layout.h: (Layout::finalize_eh_frame_section): New.
1079
1080 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
1081
1082         * output.cc (Relobj::initialize_input_to_output_map<size>):
1083         Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
1084
1085 2015-03-04  Cary Coutant  <ccoutant@google.com>
1086
1087         * parameters.cc (Parameters::set_target_once): Call
1088         Target::select_as_default_target just once from here...
1089         (set_parameters_target): ...instead of from here.
1090
1091 2015-03-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1092
1093         * ehframe.cc (Cie::set_output_offset): Pass in and use a
1094         Output_section_data instead of a Merge_map.
1095         (Eh_frame::Eh_frame): Don't initialize merge_map_.
1096         (Eh_frame::read_cie): Use add_merge_mapping instead of
1097         Merge_map::add_mapping.
1098         (Eh_frame::read_fde): Ditto.
1099         (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
1100         (Eh_frame::do_output_offset): Use merge_output_offset istead of
1101         merge_map_->get_output_offset.
1102         (Eh_frame::do_is_merge_section_for): Delete.
1103         * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
1104         instead of a Merge_map.
1105         (Cie::set_output_offset): Pass in a Output_section_data instead of a
1106         Merge_map.
1107         (Eh_frame::do_is_merge_section_for): Delete.
1108         (Eh_frame::merge_map_): Delete.
1109         * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
1110         and use a Output_section_data instead of a Merge_map.
1111         (Object_merge_map::add_mapping): Ditto.
1112         (Object_merge_map::get_output_offset): Remove the merge_map argument.
1113         (Object_merge_map::is_merge_section_for): Pass in and use a
1114         Output_section_data instead of a Merge_map.
1115         (Merge_map): Delete.
1116         (Output_merge_base::do_output_offset): Use merge_output_offset instead
1117         of merge_map_.get_output_offset.
1118         (Output_merge_base::do_is_merge_section_for): Delete.
1119         (Output_merge_data::do_add_input_section): Use
1120         object->add_merge_mapping instead of add_mapping.
1121         (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
1122         * merge.h (Merge_map): Delete forward declaration.
1123         (Object_merge_map::add_mapping): Pass in and use a Output_section_data
1124         instead of a Merge_map.
1125         (Object_merge_map::get_output_offset): Remove the merge_map argument.
1126         (Object_merge_map::is_merge_section_for): Pass in and use a
1127         Output_section_data instead of a Merge_map.
1128         (Input_merge_map::Object_merge_map::merge_map): Replace with
1129         output_data.
1130         (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
1131         Output_section_data instead of a Merge_map.
1132         (Merge_map): Delete.
1133         (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
1134         (Output_merge_base::do_is_merge_section_for): Delete.
1135         (Output_merge_base::add_mapping): Delete.
1136         (Output_merge_base::merge_map_): Delete.
1137         * object.cc (Relobj::initialize_input_to_output_map): New.
1138         (Relobj::initialize_input_to_output_map): New.
1139         (Relobj::merge_output_offset): New.
1140         (Relobj::is_merge_section_for): New.
1141         (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
1142         bits.
1143         * object.h (Relobj::merge_map): Delete.
1144         (initialize_input_to_output_map): New.
1145         (set_merge_map): Delete.
1146         (add_merge_mapping): New.
1147         (merge_output_offset): New.
1148         (is_merge_section_for): New.
1149         * output.cc (Output_section::Input_section::is_merge_section_for):
1150         Use object->is_merge_section_for.
1151         * output.h (Output_section_data::is_merge_section_for): Delete.
1152         (Output_section_data::do_is_merge_section_for): Delete.
1153         * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
1154         Use object->initialize_input_to_output_map.
1155         (Merged_symbol_value<size>::value_from_output_section): Use
1156         object->merge_output_offset.
1157
1158 2015-03-02  Peter Collingbourne  <pcc@google.com>
1159             Cary Coutant  <ccoutant@google.com>
1160
1161         * output.cc (Output_section::add_merge_input_section): Do not
1162         attempt to merge sections with an entsize of 0.
1163
1164 2015-03-02  Khem Raj  <raj.khem@gmail.com>
1165
1166         * attributes.h (class Output_attributes_section_data ): Add
1167         do_print_to_mapfile function.
1168
1169 2015-02-24  Alan Modra  <amodra@gmail.com>
1170
1171         PR 18010
1172         * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
1173         complain if value is not a multiple of four.
1174         (Target_powerpc::Relocate::relocate): Correct handling of
1175         R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
1176
1177 2015-02-21  H.J. Lu  <hongjiu.lu@intel.com>
1178
1179         * configure.ac (default_size): Set to 32 for x32.
1180         * configure: Regenerated.
1181
1182 2015-02-18  Alan Modra  <amodra@gmail.com>
1183
1184         PR 17954
1185         * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
1186         visibility.
1187
1188 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1189
1190         * gc.h (Garbage_collection::add_reference): Don't use find.
1191
1192 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1193
1194         * object.cc (write_local_symbols): avoid std::vector copy.
1195
1196 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1197
1198         * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
1199
1200 2015-02-09  Mark Wielaard  <mjw@redhat.com>
1201
1202         * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
1203         DW_LANG_Fortran03 and DW_LANG_Fortran08.
1204
1205 2015-02-16  Cary Coutant  <ccoutant@google.com>
1206
1207         PR gold/13577
1208         PR gold/16992
1209         * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
1210         DF_SYMBOLIC if --dynamic-list option is used.
1211         * options.cc (General_options::finalize): --dynamic-list is not
1212         mutually exclusive with -Bsymbolic.
1213         * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
1214         listed in --dynamic-list.
1215         * testsuite/Makefile.am (dynamic_list_lib2.so): Add
1216         -Bsymbolic-functions.
1217         * testsuite/Makefile.in: Regenerate.
1218
1219 2015-02-16  Cary Coutant  <ccoutant@google.com>
1220
1221         PR gold/17971
1222         * incremental.cc: Remove redundant include of "output.h".
1223
1224 2015-02-12  Jing Yu  <jingyu@google.com>
1225
1226         * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
1227         TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
1228         New relocation.
1229         * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
1230         TLSLE_MOVW_* relocations.
1231         (Target_aarch64::Scan::global): Likewise.
1232         (Target_aarch64::Relocate::relocate): Likewise.
1233         (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
1234         for new TLSLE_MOVW_* relocations.
1235
1236 2015-02-11  Will Newton  <will.newton@linaro.org>
1237
1238         PR gold/13321
1239         * arm.cc (Target_arm::make_plt_section): Create an ARM
1240         state mapping symbol at the start of the PLT.
1241
1242 2015-02-09  H.J. Lu  <hongjiu.lu@intel.com>
1243
1244         * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
1245         Replace two_file_shared_2.so with two_file_shared_1.so.
1246         * testsuite/Makefile.in: Regenerated.
1247
1248 2015-02-09  Alan Modra  <amodra@gmail.com>
1249
1250         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
1251         plugin_test_thin.a and defsym_test.
1252         * testsuite/Makefile.in: Regenerate.
1253
1254 2015-02-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1255
1256         * merge.cc (do_add_input_section): Combine loop epilogue into main loop
1257         body.
1258
1259 2015-02-04  Peter Collingbourne  <pcc@google.com>
1260
1261         * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
1262         forwarding symbols when computing symbol resolution info for plugins.
1263         * plugin.h (Plugin_manager::symtab): New method.
1264         (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
1265
1266 2015-02-03  Cary Coutant  <ccoutant@google.com>
1267             Peter Collingbourne  <pcc@google.com>
1268
1269         PR gold/15660
1270         * archive.cc (Thin_archive_object_unlocker): New class.
1271         (Archive::include_member): Unlock external members of thin archives.
1272         * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
1273         (plugin_test_2): Likewise.
1274         (plugin_test_3): Likewise.
1275         (plugin_test_4): Likewise.
1276         (plugin_test_5): Likewise.
1277         (plugin_test_6): Likewise.
1278         (plugin_test_7): Likewise.
1279         (plugin_test_8): Likewise.
1280         (plugin_test_9): Likewise.
1281         (plugin_test_10): Likewise.
1282         (plugin_test_11): New test case.
1283         * testsuite/Makefile.in: Regenerate.
1284         * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
1285         file to decide whether to claim file.
1286         (all_symbols_read_hook): Likewise.
1287         * testsuite/plugin_test_1.sh: Adjust expected output.
1288         * testsuite/plugin_test_2.sh: Likewise.
1289         * testsuite/plugin_test_3.sh: Likewise.
1290         * testsuite/plugin_test_6.sh: Likewise.
1291         * testsuite/plugin_test_tls.sh: Likewise.
1292         * testsuite/plugin_test_11.sh: New testcase.
1293
1294 2015-02-03  Cary Coutant  <ccoutant@google.com>
1295
1296         * descriptors.cc (Descriptors::open): Set artificially-low limit for
1297         file descriptors when debugging enabled. Add debug output.
1298         (Descriptors::release): Add debug output.
1299         (Descriptors::close_some_descriptor): Likewise.
1300         (Descriptors::close_all): Likewise.
1301         * fileread.cc (File_read::lock): Likewise.
1302         (File_read::unlock): Likewise.
1303
1304 2015-02-02  Cary Coutant  <ccoutant@google.com>
1305
1306         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
1307         executable output file.
1308
1309 2015-01-22  Han Shen  <shenhan@google.com>
1310
1311         * arm.cc (Target_arm::Target_arm): Add initialization for new members.
1312         (Target_arm::do_plt_address_for_global): New method.
1313         (Target_arm::do_plt_address_for_local): New method.
1314         (Target_arm::rel_irelative_section): New method.
1315         (Target_arm::make_data_plt): Add more parameters for plt ctor.
1316         (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
1317         (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
1318         (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
1319         (Target_arm::Scan::check_non_pic): Add ifunc support.
1320         (Target_arm::Scan::local): Add ifunc support.
1321         (Target_arm::Scan::global): Add ifunc support.
1322         (Target_arm::make_plt_section): New method.
1323         (Target_arm::make_plt_entry): Change to call to make_plt_section.
1324         (Target_arm::make_local_ifunc_plt_entry): New method.
1325         (Target_arm::got_irelative_): New member.
1326         (Target_arm::rel_irelative_): New member.
1327         (Target_arm::got_section): Add creation for got_irelative_.
1328         (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
1329         (Target_arm::Relocate::relocate): Properly set local ifunc address.
1330         (Target_arm::do_dynsym_value): Properly set global ifunc address.
1331         (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
1332         (Output_data_plt_arm::IRelative_data): New type.
1333         (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
1334         (Output_data_plt_arm::add_entry): Add more parameters.
1335         (Output_data_plt_arm::add_relocation): New method.
1336         (Output_data_plt_arm::add_local_ifunc_entry): New method.
1337         (Output_data_plt_arm::rel_irelative): New method.
1338         (Output_data_plt_arm::entry_count): Modified.
1339         (Output_data_plt_arm::address_for_global): New method.
1340         (Output_data_plt_arm::address_for_local): New method.
1341 gold/
1342         (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
1343         (Output_data_plt_arm::insert_irelative_data): New method.
1344         (Output_data_plt_arm::irelative_rel_): New member.
1345         (Output_data_plt_arm::got_): New member.
1346         (Output_data_plt_arm::got_irelative_): New member.
1347         (Output_data_plt_arm::irelative_count_): New member.
1348         (Output_data_plt_arm::IRelative_data_vec): New typedef.
1349         (Output_data_plt_arm::irelative_data_vec_): New member.
1350         (Output_data_plt_arm::do_write): Write out irelative entries.
1351         (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
1352         more parameters to ctor.
1353         (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
1354         more parameters to ctor.
1355         * output.h (Output_data_reloc::add_local_relative): New method.
1356         * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
1357
1358 2015-01-29  Alan Modra  <amodra@gmail.com>
1359
1360         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
1361         and GOT_TLSGD to LE optimization.
1362
1363 2015-01-28  Cary Coutant  <ccoutant@google.com>
1364
1365         * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
1366         for undef TLS symbols.
1367         (Target_x86_64::Relocate::relocate_tls): Likewise.
1368         (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
1369
1370 2015-01-25  Cary Coutant  <ccoutant@google.com>
1371
1372         * output.cc (Output_segment::set_section_addresses): Fix calculation
1373         of size of relro segment.
1374
1375 2015-01-22  Alan Modra  <amodra@gmail.com>
1376
1377         * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
1378         condition for need of ifunc plt entry.
1379         (Target_powerpc::Scan::global <got relocs>): Likewise.
1380
1381 2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1382
1383         * mips.cc (reloc_high): Add r_sym.
1384         (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
1385         reloc_high constructor.
1386         (Mips_relocate_functions::relgot16_local): Likewise.
1387         (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
1388         r_type to decide whether LO16 matches HI16.
1389         (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
1390         rello16 and relgot16_local.
1391
1392 2015-01-09  Cary Coutant  <ccoutant@google.com>
1393
1394         * layout.cc (Layout::set_segment_offsets): Don't align start of segment
1395         unless alignment is larger than page size.
1396
1397 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1398             Cary Coutant  <ccoutant@google.com>
1399
1400         PR gold/17729
1401         * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
1402         (DEFAULT_TARGET_X32): Set for x32.
1403         * x86_64.cc (cmp_insn_32): New.
1404         (lea_r10_insn_32): Likewise.
1405         (lea_r11_insn_32): Likewise.
1406         (cmp_insn_64): Likewise.
1407         (lea_r10_insn_64): Likewise.
1408         (lea_r11_insn_64): Likewise.
1409         (Target_x86_64<size>::do_calls_non_split): Handle x32.
1410         * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
1411         (check_DATA): Add split_x32 files.
1412         (split_x32_[1234n].o): New targets.
1413         (split_x32_[124]): New targets.
1414         (split_x32_[1234r].stdout): New targets.
1415         * testsuite/split_x32.sh: New file.
1416         * testsuite/split_x32_1.s: Likewise.
1417         * testsuite/split_x32_2.s: Likewise.
1418         * testsuite/split_x32_3.s: Likewise.
1419         * testsuite/split_x32_4.s: Likewise.
1420         * testsuite/split_x32_n.s: Likewise.
1421         * configure: Regenerated.
1422         * testsuite/Makefile.in: Likewise.
1423
1424 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1425
1426         PR gold/17809
1427         * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
1428         x32.
1429
1430 2015-01-02  Alan Modra  <amodra@gmail.com>
1431
1432         * version.cc (print_version): Just print current year.
1433         * dwp.cc (print_version): Likewise.
1434
1435 2015-01-01  Alan Modra  <amodra@gmail.com>
1436
1437         Update year range in copyright notice of all files.
1438
1439 2014-12-25  Alan Modra  <amodra@gmail.com>
1440
1441         * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
1442         new enums.
1443         (Target_arm::merge_object_attributes, ): Likewise.
1444
1445 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
1446
1447         * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
1448         as hard float only when Tag_ABI_VFP_args is 1, using new enum value
1449         AEABI_VFP_args_vfp to check that.
1450         (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
1451         value and replace hardcoded values by enum values.
1452
1453 2014-12-22  Cary Coutant  <ccoutant@google.com>
1454
1455         * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
1456
1457 2014-12-20  H.J. Lu  <hongjiu.lu@intel.com>
1458
1459         PR gold/14608
1460         * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
1461         to "return i * i * 3;".
1462
1463 2014-12-16  Cary Coutant  <ccoutant@google.com>
1464
1465         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
1466         (Mapfile::print_output_data): Use current_data_size() to avoid
1467         assert for sections requiring postprocessing; if address is not valid,
1468         print 0.
1469         (Mapfile::print_output_section): Use current_data_size(); print note
1470         that addresses and sizes are before compression.
1471
1472 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
1473
1474         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1475         Cast current_group_size to unsigned long when reporting error.
1476
1477 2014-12-10  Jing Yu  <jingyu@google.com>
1478
1479         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
1480         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
1481         Update error message.
1482         (Target_aarch64::do_relax): Use absolute value of option
1483         stub_group_size. Replace local variable with class member
1484         stub_group_size_.
1485
1486 2014-12-04  Alan Modra  <amodra@gmail.com>
1487
1488         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
1489         addend of PLTREL24 reloc when not generating a plt stub.  Make
1490         max_branch_offset an "Address".
1491         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
1492         (Target_powerpc::Relocate::relocate): Likewise.
1493
1494 2014-12-04  Alan Modra  <amodra@gmail.com>
1495
1496         PR 17670
1497         * symtab.cc (Symbol::set_undefined): Remove assertion.
1498         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1499         on symbols defined in discarded sections, instead return false.
1500         Rearrange params, update all callers.
1501         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
1502         branches to syms in discarded sections.
1503         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
1504         undefined and flag as discarded.
1505         (Target_powerpc::Relocate::relocate): Localize variable.
1506
1507 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
1508
1509         PR gold/17675
1510         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
1511         * testsuite/Makefile.in: Regenerated.
1512
1513 2014-12-03  Alan Modra  <amodra@gmail.com>
1514
1515         PR 17566
1516         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
1517         when adding dynamic relocations against section symbols.
1518
1519 2014-12-01  Dimitry Ivanov <dimitry@google.com>
1520
1521         * layout.cc (Layout::finish_dynamic_section): When '-z global'
1522         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
1523         * options.h (General_options): New -z option (global).
1524
1525 2014-12-01  Cary Coutant  <ccoutant@google.com>
1526
1527         PR gold/17578
1528         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
1529         is given.
1530         (Layout::create_executable_stack_info): Warn when -z noexecstack is
1531         given but some inputs require executable stack.
1532
1533 2014-11-26  Cary Coutant  <ccoutant@google.com>
1534
1535         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
1536         .debug_str_offsets; strip .debug_gnu_pubnames and
1537         .debug_gnu_pubtypes.
1538         (lines_only_debug_sections): Strip all four new sections.
1539
1540 2014-11-26  Jing Yu  <jingyu@google.com>
1541
1542         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
1543         register to be x0 when to relax TLSDESC_LD64_LO12.
1544
1545 2014-11-26  Alan Modra  <amodra@gmail.com>
1546
1547         * powerpc.cc (struct Stub_table_owner): New.
1548         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
1549         unsigned int vector.  Update all references.
1550         (powerpc_relobj::set_stub_table): Take an unsigned int param
1551         rather than a Stub_table.  Update callers.
1552         (Powerpc_relobj::clear_stub_table): New function.
1553         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
1554         stub_group_size_ vars.
1555         (Target_powerpc::new_stub_table): Delete.
1556         (max_branch_delta): New function, extracted from..
1557         (Target_powerpc::Relocate::relocate): ..here..
1558         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
1559         status on whether stub created successfully.
1560         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
1561         default sizing to..
1562         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
1563         reduce on relax failure.
1564         (Target_powerpc::group_sections): Add "no_size_errors" param.
1565         Use stub_group_size_.  Set up group info in a temp vector,
1566         before building Stub_table vector.  Account for input sections
1567         possibly already converted to relaxed sections.
1568         (Stub_table::init): Delete.  Merge into..
1569         (Stub_table::Stub_table): ..here.
1570         (Stub_table::can_reach_stub): New function.
1571         (Stub_table::add_plt_call_entry): Add "from" parameter and
1572         return true iff stub could be reached.
1573         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
1574         param too.
1575         (Stub_table::clear_stubs): Add "all" param.
1576
1577 2014-11-26  Alan Modra  <amodra@gmail.com>
1578
1579         * powerpc.cc (Stub_control::set_output_and_owner): New function.
1580         (Target_powerpc::group_sections): Use it.
1581
1582 2014-11-25  Cary Coutant  <ccoutant@google.com>
1583
1584         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
1585         (Binary_to_elf::write_symbol): Add st_size parameter.
1586         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
1587
1588 2014-11-25  Cary Coutant  <ccoutant@google.com>
1589
1590         PR gold/17639
1591         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
1592         (Sized_relobj_file::do_layout): Handle deferred sections properly
1593         during GC pass 1. Don't add reloc sections to deferred list twice.
1594         * object.h (Sized_relobj_file::is_deferred_layout): New function.
1595         (Sized_relobj_file::is_deferred_layout_): New data member.
1596
1597 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
1598
1599         PR gold/17619
1600         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
1601         Check PC-relative offset overflow in PLT entry.
1602
1603 2014-11-21  Alan Modra  <amodra@gmail.com>
1604
1605         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
1606         for undefined weaks.
1607
1608 2014-11-20  Alan Modra  <amodra@gmail.com>
1609
1610         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
1611         from --stub-group-size parameter divided by 1024.
1612         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
1613         template parameter.  Update all uses.
1614         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
1615         has_stub_value.  Set for long branches.  Don't report overflow for
1616         branch to undefined weak symbols.  Print info message on
1617         overflowing branch to stub.
1618
1619 2014-11-20  Alan Modra  <amodra@gmail.com>
1620
1621         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
1622
1623 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
1624
1625         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
1626         entry for R_X86_64_GOTPLT64.
1627         (Target_x86_64<size>::Relocate::relocate): Update comments for
1628         R_X86_64_GOTPLT64.
1629
1630 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
1631
1632         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
1633         * plugin.h: add lock definition
1634
1635 2014-10-29  Han Shen  <shenhan@google.com>
1636             Jing Yu   <jingyu@google.com>
1637
1638         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
1639         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1640         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
1641         Symbol::TLS_REF.
1642         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
1643         method.
1644         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
1645         (Target_aarch64::tls_ld_to_le): New method.
1646         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
1647         for 64bit targets.
1648         (Output_data_plt_aarch64::irelative_rel_): New data member.
1649         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
1650         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
1651         (Output_data_plt_aarch64::add_relocation): New method.
1652         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
1653         offset. Add got_irelative size to got size.
1654         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
1655         type string with the new typename.
1656         (AArch64_relocate_functions::update_adr): Replace parameter x with
1657         immed.
1658         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
1659         (AArch64_relocate_functions::reloc_common): New method.
1660         (AArch64_relocate_funcsions::rela_general): Extract common part out
1661         into reloc_common method.
1662         (AArch64_relocate_functions::rela_general): Likewise.
1663         (AArch64_relocate_functions::pcrela_general): Likewise.
1664         (AArch64_relocate_functions::adr): New method.
1665         (AArch64_relocate_functions::adrp): Calculate immed before calling
1666         update_adr.
1667         (AArch64_relocate_functions::adrp): Likewise.
1668         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
1669         comparing x to 0. Calculate immed from ~x when x < 0.
1670         (Target_aarch64::optimize_tls_reloc): Add new cases for
1671         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1672         TLSLD_MOVW_DTPREL_G0_NC.
1673         (Target_aarch64::possible_function_pointer_reloc): Implement this
1674         method.
1675         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
1676         comment.
1677         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
1678         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1679         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1680         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
1681         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1682         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1683         (Target_aarch64::make_plt_entry): Call add_entry with two more
1684         parameters.
1685         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1686         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
1687         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1688         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1689         (Target_aarch64::Relocate::relocate_tls): Add cases for
1690         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1691         TLSLD_MOVW_DTPREL_G0_NC.
1692         * testsuite/icf_safe_so_test.cc: Correct test comment.
1693         * testsuite/icf_safe_test.sh: Add AArch64 arch.
1694
1695 2014-10-22  Alan Modra  <amodra@gmail.com>
1696
1697         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
1698         thread_starter.
1699
1700 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
1701
1702         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
1703
1704 2014-10-17  Cary Coutant  <ccoutant@google.com>
1705
1706         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1707         Add "typename" keyword.
1708
1709 2014-10-15  Han Shen  <shenhan@google.com>
1710             Jing Yu   <jingyu@google.com>
1711
1712         Patch for gold aarch64 backend to support relaxation.
1713         * aarch64-reloc.def: Change format.
1714         * aarch64.cc (class Reloc_stub): New class.
1715         (class Stub_table): New class.
1716         (class AArch64_relobj): New class.
1717         (class AArch64_input_section): New class.
1718         (class AArch64_output_section): New class.
1719         (Target_aarch64::new_stub_table): New method.
1720         (Target_aarch64::new_aarch64_input_section): New method.
1721         (Target_aarch64::find_aarch64_input_section): New method.
1722         (Target_aarch64::scan_section_for_stubs): New method.
1723         (Target_aarch64::scan_reloc_section_for_stubs): New method.
1724         (Target_aarch64::relocate_stub): New method.
1725         (Target_aarch64::current_target): New method.
1726         (Target_aarch64::do_make_elf_object): New method.
1727         (Target_aarch64::do_may_relax): New method.
1728         (Target_aarch64::do_relax): New method.
1729         (Target_aarch64::group_sections): New method.
1730         (Target_aarch64::scan_reloc_for_stub): New method.
1731         (Target_aarch64::do_make_output_section): New method.
1732         (Target_aarch64::stub_tables_): New data member.
1733         (Target_aarch64::aarch64_input_section_map_): New data member.
1734         (AArch64_relocate_functions::maybe_apply_stub): New method.
1735
1736 2014-09-30  Cary Coutant  <ccoutant@google.com>
1737
1738         PR gold/17432
1739         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
1740
1741 2014-09-30  Kito Cheng  <kito@0xlab.org>
1742
1743         PR gold/13597
1744         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
1745         hash table before sysv-style hash table.
1746
1747 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
1748
1749         * options.h (--pic-executable): Add negative to alias to -no-pie.
1750
1751 2014-09-26  Cary Coutant  <ccoutant@google.com>
1752
1753         PR gold/16773
1754         * object.cc (Sized_relobj_file): Compute value of section symbols
1755         for TLS sections the same as TLS symbols.
1756
1757 2014-09-25  Cary Coutant  <ccoutant@google.com>
1758
1759         PR gold/17432
1760         * resolve.cc (Symbol_table::resolve): Override common placeholder
1761         symbols, but adjust sizes.
1762         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
1763         symbols to common lists.
1764
1765 2014-09-24  Alan Modra  <amodra@gmail.com>
1766
1767         * po/POTFILES.in: Regenerate.
1768
1769 2014-09-23  Taiju Tsuiki  <tzik@google.com>
1770             Cary Coutant  <ccoutant@google.com>
1771
1772         PR gold/14860
1773         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
1774         on input_sections_blocker.
1775         * layout.cc (Write_sections_task::locks): Unblock
1776         input_sections_blocker_.
1777         * layout.h (Write_sections_task::Write_sections_task): Add
1778         input_sections_blocker.
1779         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
1780         to DEPENDENCIES.
1781         * testsuite/Makefile.in: Regenerate.
1782
1783 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1784
1785         * testsuite/Makefile.am (plugin_test_10): New test.
1786         * testsuite/Makefile.in: Regenerate
1787         * testsuite/plugin_common_test_2.c (c1): Align to 8.
1788         * testsuite/plugin_test_10.sh: New file.
1789
1790 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1791
1792         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
1793         * resolve.cc (Symbol_table::resolve): Don't override common symbols
1794         during the replacement phase.
1795
1796 2014-09-17  Han Shen  <shenhan@google.com>
1797             Jing Yu  <jingyu@google.com>
1798
1799         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
1800         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
1801         * aarch64.cc (Target_aarch64): Add data members
1802         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
1803         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
1804         constructor.
1805         (Target_aarch64::do_reloc_symbol_index): New method.
1806         (Target_aarch64::do_reloc_addend): New method.
1807         (Target_aarch64::add_tlsdesc_info): New method.
1808         (Target_aarch64::do_dynsym_value): New method.
1809         (Target_aarch64::do_make_data_plt): Add new parameters: got,
1810         got_irelative. Pass them to Output_data_plt_aarch64_standard.
1811         (Target_aarch64::make_data_plt): Add new parameters: got,
1812         got_irelative. Pass them to do_make_data_plt.
1813         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
1814         (Target_aarch64::Relocate:tls_gd_to_le): New method.
1815         (Target_aarch64::Relocate:tls_ie_to_le): New method.
1816         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
1817         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
1818         (Target_aarch64::got_tlsdesc_section): New method.
1819         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1820         (Target_aarch64::define_tls_base_symbol): New method.
1821         (Target_aarch64::reserve_tlsdesc_entries): New method.
1822         (Target_aarch64::got_mod_index_entry): New method.
1823         (Target_aarch64::rela_tlsdesc_section): New method.
1824         (Target_aarch64::rela_irelative_section): New method.
1825         (Target_aarch64::Tlsdesc_info): New struct.
1826         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
1827         relocations and tlsdesc relocations.
1828         (Target_aarch64::optimize_tls_reloc): Implement method.
1829         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
1830         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
1831         in constructor.
1832         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
1833         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
1834         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
1835         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
1836         (Output_data_plt_aarch64::rela_tlsdesc): New method.
1837         (Output_data_plt_aarch64::rela_irelative): New method.
1838         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
1839         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
1840         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
1841         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
1842         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
1843         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
1844         (Output_data_plt_aarch64_standard): New member variables:
1845         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
1846         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
1847         New parameter: got, got_irelative.
1848         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
1849         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
1850         (Output_data_plt_aarch64::do_write): Replace got_address with
1851         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
1852         (AArch64_relocate_functions::update_movnz): New method.
1853         (AArch64_relocate_functions): Correct format.
1854         (AArch64_relocate_functions::movnz): New method.
1855         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
1856         before the switch. Add new cases to switch.
1857         Check ie_to_le relaxation on tlsie relocations. Add code handling
1858         tlsgd tlsdesc cases.
1859         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
1860         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
1861         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
1862         Call reloc_name_in_error_message to print unsupported reloc.
1863         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
1864         make_data_plt.
1865         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
1866         relocs. Fill in some more dynamic tags.
1867         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
1868         Skip call tls_get_addr when tlsgd is relaxed.
1869         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
1870         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
1871         tlsdesc->ie relaxation.
1872
1873 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1874
1875         * mips.cc (Target_mips_nacl): New class.
1876         (Target_selector_mips_nacl): New class.
1877         (target_selector_mips32): Rename from target_selector_mips32be and use
1878         Target_selector_mips_nacl instead of Target_selector_mips.
1879         (target_selector_mips32el): Rename from target_selector_mips32 and use
1880         Target_selector_mips_nacl instead of Target_selector_mips.
1881         (target_selector_mips64): Rename from target_selector_mips64be and use
1882         Target_selector_mips_nacl instead of Target_selector_mips.
1883         (target_selector_mips64el): Rename from target_selector_mips64 and use
1884         Target_selector_mips_nacl instead of Target_selector_mips.
1885         (Target_mips::mips_info): Add const attribute.
1886
1887 2014-09-02  Cary Coutant  <ccoutant@google.com>
1888
1889         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
1890         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
1891         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
1892         (Sized_incr_dynobj::do_section_name): Likewise.
1893         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
1894         (Sized_incr_dynobj::do_section_name): Likewise.
1895         * object.h (Object::section_name): Likewise.
1896         (Object::do_section_name): Likewise.
1897         (Sized_relobj_file::do_section_name): Likewise.
1898         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
1899         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
1900
1901 2014-09-02  Cary Coutant  <ccoutant@google.com>
1902
1903         PR gold/17005
1904         * ehframe.cc (Fde::write): Add output_offset parameter.
1905         (Cie::write): Likewise.
1906         (Eh_frame::set_final_data_size): Account for offset within output
1907         section.
1908         (Eh_frame::do_sized_write): Likewise.
1909         * ehframe.h (Fde::write): Add output_offset parameter.
1910         (Cie::write): Likewise.
1911         * output.cc (Output_section::Input_section_sort_entry): Remove
1912         section_has_name_; add output_section_name parameter. Use
1913         output section name for non-input sections.
1914         (Output_section::Input_section_sort_entry::section_has_name): Remove.
1915         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
1916         (Output_section::Input_section_sort_compare): Remove logic for
1917         sections without names.
1918         (Output_section::Input_section_sort_init_fini_compare): Likewise.
1919         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
1920         Likewise.
1921         (Output_section::Input_section_sort_section_name_compare): Likewise.
1922
1923 2014-08-29 Han Shen <shenhan@google.com>
1924            Jing Yu <jingyu@google.com>
1925
1926         * aarch64-reloc-property.cc
1927         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
1928         reference reloc property in the table.
1929         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
1930         3 other entries.
1931         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
1932         2 new overloaded methods.
1933         (Output_data_got_aarch64::do_write): Add code to write out
1934         static relocs.
1935         (class Output_data_got_aarch64::Static_reloc): New class to wrap
1936         static relocs.
1937         (Output_data_got_aarch64::static_relocs): New vector to
1938         hold static relocs.
1939         (Target_aarch64::TCB_SIZE): New const static memeber.
1940         (Target_aarch64::tcb_size): New method.
1941         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
1942         (Target_aarch64::Relocate::relocate_tls): New method.
1943         (Target_aarch64::Scan::local): Add code handling new reloc types.
1944         (Target_aarch64::Scan::global): Add code handling new reloc types.
1945
1946 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
1947
1948         * options.h (-no-pie): Add option.
1949
1950 2014-08-08  Jing Yu  <jingyu@google.com>
1951             Han Shen  <shenhan@google.com>
1952
1953         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
1954         (DEFFILES): add aarch64-reloc.def.
1955         (TARGETSOURCES): Add aarch64-reloc-property.cc.
1956         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
1957         * Makefile.in: Regenerate.
1958         * aarch64-reloc-property.cc: New file.
1959         * aarch64-reloc-property.h: New file.
1960         * aarch64-reloc.def: New file.
1961         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
1962         with tab to make the format consistent.
1963         (Output_data_got_aarch64::symbol_table_): New method.
1964         (Target_aarch64::do_plt_address_for_global): New method.
1965         (Target_aarch64::do_plt_address_for_local): New method.
1966         (Target_aarch64::do_select_as_default_target): New method.
1967         (Target_aarch64::do_make_data_plt): New method.
1968         (Target_aarch64::make_data_plt): New method.
1969         (Output_data_plt_aarch64::has_irelative_section): New method.
1970         (Output_data_plt_aarch64::address_for_global): New method.
1971         (Output_data_plt_aarch64::address_for_local): New method.
1972         (Output_data_plt_aarch64::irelative_rel_): New parameter.
1973         (Output_data_plt_aarch64::add_entry): Implement contents.
1974         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
1975         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
1976         the got_pov entry to plt0.
1977         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
1978         Implement contents.
1979         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
1980         (AArch64_howto): New struct.
1981         (aarch64_howto[]): New static const array.
1982         (AArch64_relocate_functions): New class.
1983         (Target_aarch64::Scan::get_reference_flags): Remove method.
1984         (Target_aarch64::Scan::local): Implement to support a few relocations.
1985         (Target_aarch64::Scan::global): Implement to support a few relocations.
1986         (Target_aarch64::make_plt_section): Implement contents.
1987         (Target_aarch64::make_plt_entry): Implement contents.
1988         (Target_aarch64::do_finalize_sections): Implement contents.
1989         (Target_aarch64::Relocate::relocate): Implement a few relocations.
1990         (Target_aarch64::relocate_section): Implement contents.
1991
1992 2014-08-06  Alan Modra  <amodra@gmail.com>
1993
1994         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
1995
1996 2014-08-06  Alan Modra  <amodra@gmail.com>
1997
1998         PR 13227
1999         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
2000
2001 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
2002
2003         * object.cc (Relobj::is_section_name_included): Add
2004         ".rodata.nptl_version" to not garbage collect this section.
2005
2006 2014-07-08  Cary Coutant  <ccoutant@google.com>
2007
2008         * expression.cc (struct Expression::Expression_eval_info): Add
2009         new fields type_pointer, vis_pointer, and nonvis_pointer.
2010         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
2011         nonvis_pointer parameters. Adjust all calls.
2012         (Symbol_expression::value): Update type, visibility, and nonvis bits
2013         in caller.
2014         * script.cc (Symbol_assignment::sized_finalize): Update type,
2015         visibility, and remaining st_other bits for new symbol.
2016         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
2017         vis_pointer, and nonvis_pointer parameters.
2018         * symtab.h (Symbol::set_type): New method.
2019
2020         * testsuite/Makefile.am (defsym_test): New test.
2021         * testsuite/Makefile.in: Regenerate.
2022         * testsuite/defsym_test.c: New file.
2023         * testsuite/defsym_test.sh: New file.
2024
2025 2014-07-08  Cary Coutant  <ccoutant@google.com>
2026
2027         PR gold/15639
2028         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
2029         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
2030         (Sized_dynobj::base_read_symbols): ...new method.
2031         * object.h (Sized_relobj_file::base_read_symbols): New method.
2032         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
2033         (Sized_relobj_file::base_read_symbols): ...new method.
2034         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
2035         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
2036         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
2037
2038 2014-07-04  Alan Modra  <amodra@gmail.com>
2039
2040         * po/POTFILES.in: Regenerate.
2041
2042 2014-07-02  Jing Yu  <jingyu@google.com>
2043
2044         * aarch64.cc: New file
2045         * Makefile.am (TARGETSOURCES): Add aarch64.cc
2046         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
2047         * Makefile.in: Regenerate.
2048         * configure.tgt: Add entries for aarch64*.
2049         * configure.ac:  Likewise.
2050         * configure: Likewise.
2051
2052 2014-06-27  Alan Modra  <amodra@gmail.com>
2053
2054         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
2055
2056 2014-06-24  Cary Coutant  <ccoutant@google.com>
2057
2058         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
2059         sections.
2060         (Dwo_file::sized_read_unit_index): Likewise.
2061
2062 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2063
2064         * mips.cc: New file.
2065         * Makefile.am (TARGETSOURCES): Add mips.cc
2066         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
2067         * configure.tgt: Add entries for mips*.
2068         * configure.ac: Likewise.
2069         * Makefile.in: Regenerate.
2070         * configure: Likewise.
2071
2072 2014-06-09  Cary Coutant  <ccoutant@google.com>
2073
2074         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
2075         unit_length is within section bounds.
2076
2077 2014-06-09  Cary Coutant  <ccoutant@google.com>
2078
2079         PR gold/16980
2080         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
2081         map.
2082
2083 2014-06-07  Alan Modra  <amodra@gmail.com>
2084
2085         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
2086
2087 2014-06-06  Cary Coutant  <ccoutant@google.com>
2088
2089         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
2090         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
2091         (Dwarf_pubnames_table::read_header): Likewise.
2092         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
2093         .debug_gnu_pubtypes.
2094
2095 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
2096
2097         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
2098         * Makefile.in, configure: Regenerate.
2099
2100 2014-06-03  Alan Modra  <amodra@gmail.com>
2101
2102         * powerpc.cc (addis_12_2): Define.
2103         (Stub_table::do_write): Support fusion on ELFv2 stubs.
2104
2105 2014-06-03  Alan Modra  <amodra@gmail.com>
2106
2107         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
2108         st_other output.
2109
2110 2014-06-02  Alan Modra  <amodra@gmail.com>
2111
2112         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
2113         Only ignore relocs on ELFv1.
2114         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
2115
2116 2014-05-30  Cary Coutant  <ccoutant@google.com>
2117
2118         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
2119         * testsuite/Makefile.in: Regenerate.
2120         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
2121
2122 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
2123
2124         PR gold/16945
2125         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
2126         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
2127
2128 2014-05-15  Alan Modra  <amodra@gmail.com>
2129
2130         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
2131         Compare FDE contents with DW_CFA_nop rather than 0.
2132
2133 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
2134
2135         * symtab.h (may_need_copy_reloc): Remove check for position independent
2136         code.
2137         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
2138         position independence before pc absolute may_need_copy_reloc call.
2139         Add check for executable output befor pc relative may_need_copy_reloc
2140         call.
2141         * i386.cc: Ditto.
2142         * arm.cc: Ditto.
2143         * sparc.cc: Ditto.
2144         * tilegx.cc: Ditto.
2145         * powerpc.cc: Add check for no position independence before
2146         may_need_copy_reloc calls.
2147         * testsuite/pie_copyrelocs_test.cc: New file.
2148         * testsuite/pie_copyrelocs_shared_test.cc: New file.
2149         * Makefile.am (pie_copyrelocs_test): New test.
2150         * Makefile.in: Regenerate.
2151
2152 2014-05-08  Martin Liška  <mliska@suse.cz>
2153
2154         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
2155
2156 2014-05-06  Cary Coutant  <ccoutant@google.com>
2157
2158         PR gold/16900
2159         * i386.cc (Output_data_got_plt_i386): New class.
2160         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
2161         parameter. Change all callers.
2162         (Output_data_plt_i386::layout_): Remove.
2163         (Output_data_plt_i386::got_plt_): Change type.
2164         (Target_i386::got_plt_): Change type. Change all references.
2165         (Target_i386::got_section): Create instance of new class.
2166         (Output_data_got_plt_i386::do_write): New function.
2167         * x86_64.cc (Output_data_got_plt_x86_64): New class.
2168         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
2169         parameter. Change all callers.
2170         (Output_data_plt_x86_64::layout_): Remove.
2171         (Output_data_plt_x86_64::got_plt_): Change type.
2172         (Target_x86_64::got_plt_): Change type. Change all references.
2173         (Target_x86_64::got_section): Create instance of new class.
2174         (Output_data_got_plt_x86_64::do_write): New function.
2175         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
2176         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
2177         class.
2178
2179 2014-05-05  Cary Coutant  <ccoutant@google.com>
2180
2181         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
2182         if we have pubnames/pubtypes.
2183
2184 2014-05-02  Cary Coutant  <ccoutant@google.com>
2185
2186         * defstd.cc (in_segment): Define __ehdr_start here...
2187         * layout.cc (Layout::finalize): ...Instead of here.  Set the
2188         output segment when known.
2189         * resolve.cc (Symbol::override_base_with_special): Remember
2190         the original binding.
2191         * symtab.cc (Symbol::set_output_segment): New function.
2192         (Symbol::set_undefined): New function.
2193         * symtab.h (Symbol::is_weak_undefined): Check original undef
2194         binding.
2195         (Symbol::is_strong_undefined): New function.
2196         (Symbol::set_output_segment): New function.
2197         (Symbol::set_undefined): New function.
2198         * target-reloc.h (is_strong_undefined): Remove.
2199         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
2200         Check for hidden undefs.
2201         (relocate_section): Call Symbol::is_strong_undefined.
2202
2203         * testsuite/Makefile.am (ehdr_start_test_1)
2204         (ehdr_start_test_2, ehdr_start_test_3)
2205         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
2206         * testsuite/Makefile.in: Regenerate.
2207         * testsuite/ehdr_start_def.cc: New source file.
2208         * testsuite/ehdr_start_test.cc: New source file.
2209         * testsuite/ehdr_start_test.t: New linker script.
2210         * testsuite/ehdr_start_test_4.sh: New shell script.
2211
2212 2014-04-23  Cary Coutant  <ccoutant@google.com>
2213
2214         PR gold/16870
2215         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
2216
2217 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2218
2219         * layout.cc (Layout::include_section): Allow a target to decide
2220         whether to include a section.
2221         * target.h (Target::should_include_section): New function.
2222         (Target::do_should_include_section): New function.
2223
2224 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2225
2226         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
2227         inline into ...
2228         (Copy_relocs::emit): ... here.
2229         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
2230         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
2231         (Copy_reloc_entry::entries_): Change from private to protected.
2232
2233 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
2234
2235         * icf.cc (get_section_contents): Replace copies of reloc
2236         vectors with const references.
2237
2238 2014-04-02  Cary Coutant  <ccoutant@google.com>
2239
2240         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
2241         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
2242         * configure: Regenerate.
2243         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
2244         -fno-use-linker-plugin.
2245         (LINK1, CXXLINK1): Add it to the link command.
2246         * testsuite/Makefile.in: Regenerate.
2247
2248 2014-03-12  Alan Modra  <amodra@gmail.com>
2249
2250         * Makefile.in: Regenerate.
2251
2252 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2253
2254         * symtab.h (Symbol::set_nonvis): New function.
2255
2256 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2257
2258         * symtab.cc (Sized_symbol<32>::init_output_data):
2259         Instantiate the template.
2260         (Sized_symbol<64>::init_output_data): Likewise.
2261
2262 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2263
2264         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
2265         adjust dynamic symbol value.
2266         * target.h (Target::adjust_dyn_symbol): New function.
2267         (Target::do_adjust_dyn_symbol): New function.
2268
2269 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2270
2271         * output.cc (Output_data_dynamic::Dynamic_entry::write):
2272         Get the value of DYNAMIC_CUSTOM dynamic entry.
2273         * output.h (Output_data_dynamic::add_custom): New function.
2274         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
2275         dynamic entry.
2276         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
2277         * target.h (Target::dynamic_tag_custom_value): New function.
2278         (Target::do_dynamic_tag_custom_value): New function.
2279
2280 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2281
2282         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
2283         dynsym indexes.
2284         * target.h (Target::has_custom_set_dynsym_indexes): New function.
2285         (Target::do_has_custom_set_dynsym_indexes): New function.
2286         (Target::set_dynsym_indexes): New function.
2287         (Target::do_set_dynsym_indexes): New function.
2288
2289 2014-03-07  Alan Modra  <amodra@gmail.com>
2290
2291         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
2292         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
2293         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
2294         (Powerpc_relocate_functions::has_overflow_bitfield,
2295         overflowed): Use the above.
2296         (Target_powerpc::Relocate::relocate): Correct overflow checking
2297         for a number of relocations.  Modify overflow test for 16-bit
2298         fields in instructions to signed/unsigned according to whether
2299         the field takes a signed or unsigned value.
2300
2301 2014-03-05  Alan Modra  <amodra@gmail.com>
2302
2303         Update copyright years.
2304
2305 2014-03-05  Alan Modra  <amodra@gmail.com>
2306
2307         * powerpc.cc (Target_powerpc::Scan::local, global): Support
2308         R_PPC64_ADDR64_LOCAL.
2309         (Target_powerpc::Relocate::relocate): Likewise.
2310
2311 2014-03-03  Alan Modra  <amodra@gmail.com>
2312
2313         * dwp.cc (print_version): Update copyright year to current.
2314
2315 2014-02-10  Alan Modra  <amodra@gmail.com>
2316
2317         * po/gold.pot: Regenerate.
2318
2319 2014-02-06  Cary Coutant  <ccoutant@google.com>
2320
2321         Fix problem where -u is ignored when a weak undef is seen.
2322
2323         * archive.cc (Library_base::should_include_member): Reorder
2324         code to check for -u option if a weak undef has already been seen.
2325         * testsuite/Makefile.am (weak_undef_test_2): New test case.
2326         * testsuite/Makefile.in: Regenerate.
2327         * testsuite/weak_undef_file3.cc: New file.
2328         * testsuite/weak_undef_file4.cc: New file.
2329         * testsuite/weak_undef_test_2.cc: New file.
2330
2331 2014-02-05  Cary Coutant  <ccoutant@google.com>
2332
2333         Fix issues with gold undefined symbol diagnostics.
2334
2335         PR binutils/15435
2336         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
2337         check to here.
2338         * target-reloc.h (is_strong_undefined): New function.
2339         (relocate_section): Move undef vtable symbol check from here.
2340         Check for is_strong_undefined.
2341
2342 2014-02-05  Cary Coutant  <ccoutant@google.com>
2343
2344         Fix problems with the --dynamic-list option.
2345
2346         PR gold/13577
2347         * options.cc (General_options::parse_dynamic_list):
2348         Set have_dynamic_list_.
2349         (General_options::General_options): Initialize have_dynamic_list_.
2350         (General_options::finalize): Turn off -Bsymbolic and
2351         -Bsymbolic-functions if --dynamic-list provided.
2352         * options.h (General_options::have_dynamic_list): New function.
2353         (General_options::have_dynamic_list_): New data member.
2354         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
2355         correctly.
2356
2357         PR gold/16530
2358         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
2359         in --dynamic-list, mark it.
2360
2361         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
2362         (dynamic_list_2): New test case.
2363         * testsuite/Makefile.in: Regenerate.
2364         * testsuite/dynamic_list_2.cc: New file.
2365         * testsuite/dynamic_list_2.t: New file.
2366         * testsuite/dynamic_list_lib1.cc: New file.
2367         * testsuite/dynamic_list_lib2.cc: New file.
2368         * testsuite/gc_dynamic_list_test.c: New file.
2369         * testsuite/gc_dynamic_list_test.sh: New file.
2370         * testsuite/gc_dynamic_list_test.t: New file.
2371
2372 2014-01-28  Cary Coutant  <ccoutant@google.com>
2373
2374         Add .gdb_index version 7 support.
2375
2376         * gold/dwarf_reader.cc: include <utility> (for make_pair).
2377         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
2378         debug sections.
2379         (Dwarf_ranges_table::read_ranges_table): Likewise.
2380         (Dwarf_pubnames_table::read_section): Check for GNU-style
2381         sections, and for compressed debug sections.
2382         (Dwarf_pubnames_table::read_header): Compute end address of table.
2383         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
2384         for end of list by offset, not by offset == 0.
2385         (Dwarf_info_reader::do_read_string_table): Check for compressed
2386         debug sections.
2387         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2388         Initialize new data members.
2389         (Dwarf_pubnames_table::next_name): return flag_byte.
2390         (Dwarf_pubnames_table::end_of_table_): New data member.
2391         (Dwarf_pubnames_table::is_gnu_style_): New data member.
2392         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
2393         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
2394         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
2395         read skeleton type unit DIEs.
2396         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
2397         (Gdb_index::do_write): Write flag_byte.
2398         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
2399         (Gdb_index::Cu_vector): Store flags along with cu indexes.
2400         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
2401         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
2402
2403 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
2404
2405         * version.cc (print_version): Update copyright year to 2014.
2406
2407 2013-12-19  Dimitry Andric  <dimitry@andric.com>
2408
2409         * stringpool.cc (Stringpool_template::reserve): Add
2410         HAVE_UNORDERED_MAP case.
2411         * stringpool.cc (Stringpool_template::print_stats): Likewise.
2412
2413 2013-12-18  Cary Coutant  <ccoutant@google.com>
2414
2415         * configure.ac: Check for <unordered_set> and <unordered_map>.
2416         * config.in: Regenerate.
2417         * configure: Regenerate.
2418         * system.h: Use <unordered_set> and <unordered_map> if available.
2419
2420 2013-12-10  Roland McGrath  <mcgrathr@google.com>
2421
2422         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
2423         with $(INSTALL_PROGRAM_ENV).
2424         * Makefile.in: Regenerate.
2425
2426 2013-11-22  Cary Coutant  <ccoutant@google.com>
2427
2428         * configure.ac: Add check for which library is needed for
2429         dlopen.
2430         * configure: Regenerate.
2431
2432 2013-11-22  Cary Coutant  <ccoutant@google.com>
2433
2434         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
2435         assembler.
2436         * testsuite/Makefile.in: Regenerate.
2437
2438 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
2439
2440         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
2441         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
2442         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
2443         (Target_x86_64<size>::Scan::local): Likewise.
2444         (Target_x86_64<size>::Scan::global): Likewise.
2445         (Target_x86_64<size>::Relocate::relocate): Likewise.
2446         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
2447         Likewise.
2448         (Target_x86_64<size>::Scan::check_non_pic(): Handle
2449         R_X86_64_PC32_BND.
2450
2451         * testsuite/Makefile.am (check_PROGRAMS): Add
2452         exception_x86_64_bnd_test.
2453         (exception_x86_64_bnd_test_SOURCES): New macro.
2454         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
2455         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
2456         (exception_x86_64_bnd_test_LDADD): Likewise.
2457         (exception_x86_64_bnd_1.o): New rule.
2458         (exception_x86_64_bnd_2.o): Likewise.
2459         * testsuite/Makefile.in: Regenerated.
2460
2461 2013-11-15  Alan Modra  <amodra@gmail.com>
2462
2463         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
2464         accessor.
2465         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
2466         Only call ppc64_local_entry_offset for 64-bit.  Restrict
2467         symval_for_branch lookup to ELFv1.
2468         (Stub_table::add_plt_call_entry): Use unsigned int off.
2469         (Output_data_glink::Address, invalid_address): New.
2470         (Output_data_glink::add_eh_frame): Move out of line.  Add
2471         support for ELFv2.
2472         (Output_data_glink::add_global_entry, find_global_entry,
2473         global_entry_address): New functions.
2474         (Output_data_glink::global_entry_stubs_, end_branch_table_,
2475         ge_size): New variables.
2476         (Output_data_glink::set_final_data_size): Add global entry
2477         stub sizing.
2478         (Output_data_glink::do_write): Write global entry stubs.
2479         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
2480         parameter.  Return true for ELFv2.  Adjust callers.
2481         (Target_powerpc::Scan::local, global): Restrict opd lookup to
2482         ELFv1.  Similarly for ifunc and dynamic relocation processing
2483         specific to ELFv1.  Recognize that symbols are defined on
2484         their plt entries for ELFv2.
2485         (Target_powerpc::symval_for_branch): Assert if called for
2486         ELFv2 or ppc32.
2487         (Target_powerpc::Relocate::relocate): Use global entry plt
2488         stub for symbol value if such exists on ELFv2.
2489         (Target_powerpc::Relocate::relocate): Don't call
2490         symval_for_branch when ELFv2.  Do adjust for local entry
2491         offset when ELFv2.
2492         (Target_powerpc::do_dynsym_value): Set symbols to global entry
2493         plt stub for ELFv2.
2494         (Target_powerpc::do_plt_address_for_global): Similarly.
2495
2496 2013-11-14  Cary Coutant  <ccoutant@google.com>
2497
2498         Revert patch -- this did not fix the problem, and there is
2499         no race there.
2500
2501         2013-11-14  Cary Coutant  <ccoutant@google.com>
2502
2503             PR gold/14860
2504             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2505             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2506             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2507             updating fde_offsets_.
2508             (Eh_frame_hdr::lock_): New data member.
2509
2510 2013-11-14  Cary Coutant  <ccoutant@google.com>
2511
2512         * dwp.cc (Dwo_file_entry): New type.
2513         (File_list): Use Dwo_file_entry.
2514         (Dwo_file::verify): New function.
2515         (Dwo_file::verify_dwo_list): New function.
2516         (Dwo_file::sized_verify_dwo_list): New function.
2517         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
2518         list.
2519         (Dwp_options): New enum type.
2520         (dwp_options): Add --verify-only.
2521         (usage): Likewise.
2522         (main): Likewise.
2523         * dwp.h (gold_info): Add declaration.
2524
2525 2013-11-14  Cary Coutant  <ccoutant@google.com>
2526
2527         PR gold/14860
2528         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2529         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2530         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2531         updating fde_offsets_.
2532         (Eh_frame_hdr::lock_): New data member.
2533
2534 2013-11-06  Cary Coutant  <ccoutant@google.com>
2535
2536         PR gold/15758
2537         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
2538         before reloc sections.
2539
2540 2013-11-04  Alan Modra  <amodra@gmail.com>
2541
2542         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
2543         (Symbol::needs_dynamic_reloc): Test new flag.
2544         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
2545         (Target_powerpc::Scan::get_reference_flags): Add target param.
2546         Return FUNC_DESC_ABI for 64-bit ELFv1.
2547         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
2548         call.
2549         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
2550         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
2551
2552 2013-10-31  Cary Coutant  <ccoutant@google.com>
2553
2554         Restore support for dwp v2 DWARF package file format.
2555
2556         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2557         tu_length parameter.  Adjust all callers.
2558         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2559         * dwp.cc: Include dwarf.h.
2560         (Section_bounds): New struct type.
2561         (Unit_set): New struct type.
2562         (Dwo_file::Dwo_file): Initialize new data member.
2563         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2564         Combine and rename to...
2565         (Dwo_file::read_unit_index): ...this.
2566         (Dwo_file::sized_read_compunit_index)
2567         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2568         (Dwo_file::sized_read_unit_index): ...this.
2569         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2570         parameters; add section_id parameter.
2571         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2572         (Dwo_file::add_unit_set): ...this.
2573         (Dwo_file::shndx_map_): Remove.
2574         (Dwo_file::sect_offsets_): New data member.
2575         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2576         (Dwp_output_file::add_section): Rename to...
2577         (Dwp_output_file::add_contribution): ...this.
2578         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2579         (Dwp_output_file::add_tu_set): Likewise.
2580         (Dwp_output_file::Contribution): New type.
2581         (Dwp_output_file::Section::contributions): New data member.
2582         (Dwp_output_file::Cu_or_tu_set): Remove.
2583         (Dwp_output_file::Section::Section): New ctor.
2584         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2585         (Dwp_output_file::Dwp_index::Section_table): New type.
2586         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2587         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2588         parameter.
2589         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2590         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2591         (Dwp_output_file::Dwp_index::section_table): New member function.
2592         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2593         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2594         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2595         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2596         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2597         (Dwp_output_file::Dwp_index::section_table_): New data member.
2598         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2599         (Dwp_output_file::add_output_section): New member function.
2600         (Dwp_output_file::write_new_section): New member function.
2601         (Dwp_output_file::write_contributions): New member function.
2602         (Dwp_output_file::section_id_map_): New data member.
2603         (class Dwo_id_info_reader): Remove.
2604         (class Unit_reader): New class.
2605         (get_dwarf_section_name): New function.
2606         (Dwo_file::read_executable): Adjust initializations of class data.
2607         (Dwo_file::read): Add support for v2 package file format.
2608         (Dwo_file::read_unit_index): Likewise.
2609         (Dwo_file::sized_read_unit_index): Likewise.
2610         (Dwo_file::copy_section): Likewise.
2611         (Dwo_file::add_unit_set): Likewise.
2612         (Dwp_output_file::add_output_section): Likewise.
2613         (Dwp_output_file::add_contribution): Likewise.
2614         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2615         for empty slot.
2616         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2617         file format.
2618         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2619         slot.
2620         (Dwp_output_file::initialize): Remove unused function.
2621         (Dwp_output_file::finalize): Add support for v2 package file format.
2622         (Dwp_output_file::write_index): Likewise.
2623         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2624         function prototype.
2625
2626 2013-10-31  Cary Coutant  <ccoutant@google.com>
2627
2628         * configure.ac: Fix check for -fmerge-constants.
2629         * configure.ac: Regenerate.
2630
2631 2013-10-30  Roland McGrath  <mcgrathr@google.com>
2632
2633         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
2634         Correct 9-byte nop sequence to match what the assembler generates.
2635
2636 2013-10-30  Alan Modra  <amodra@gmail.com>
2637
2638         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
2639         ppc64_local_entry_offset, ppc64_local_entry_offset,
2640         do_read_symbols): New functions.
2641         (Powerpc_relobj::e_flags_, st_other_): New vars.
2642         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
2643         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
2644         (Powerpc_relobj::e_flags_): New var.
2645         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
2646         and adjust for ELFv2.
2647         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
2648         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
2649         (Powerpc_dynobj::do_find_special_sections): Likewise.
2650         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
2651         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
2652         to ELFv2 local entry.
2653         (Target_powerpc::do_relax): No thread safe barriers needed for
2654         ELFv2.
2655         (Output_data_plt_powerpc::initial_plt_entry_size_,
2656         plt_entry_size): Delete.  Replace all uses with
2657         first_plt_entry_offset() and plt_entry_size().
2658         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
2659         reserved_size parm.  Update callers.
2660         (Output_data_plt_powerpc::entry_count): Update.
2661         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
2662         and use Target_powerpc::first_plt_entry_offset().
2663         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
2664         rename to plt_entry_size.
2665         (Output_data_plt_powerpc::add_ifunc_entry,
2666         add_local_ifunc_entry): Adjust reloc for ELFv2.
2667         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
2668         (glink_eh_frame_fde_64v2): New.
2669         (Stub_table::plt_call_size): Support ELFv2 sizing.
2670         (Output_data_glink::add_eh_frame): Use the new FDE.
2671         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
2672         (Stub_table::do_write): Write ELFv2 stubs and glink.
2673         (Target_powerpc::Relocate::relocate): Replaces nop after call
2674         with ld 2,24(1) and adjust local offset destination for ELFv2.
2675
2676 2013-10-30  Alan Modra  <amodra@gmail.com>
2677
2678         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
2679         (Target_powerpc::Scan::global, local): Likewise.
2680         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
2681         on all ppc64 @h and @ha relocs.
2682
2683 2013-10-14  Alan Modra  <amodra@gmail.com>
2684
2685         * output.h (Output_data_got::add_constant): Tidy.
2686         (Output_data_got::add_constant_pair): New function.
2687         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
2688         methods used so as to first call reserve_ent().
2689
2690 2013-10-11  Roland McGrath  <mcgrathr@google.com>
2691
2692         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
2693         add_got_entry and add_got_entry_pair.
2694
2695         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
2696         (HAVE_PUBNAMES): Likewise.
2697         * configure: Regenerate.
2698
2699         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
2700         * testsuite/Makefile.in: Regenerate.
2701
2702         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
2703         Remove const from declaration.
2704         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
2705         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
2706         * output.h (Output_file_header): Remove const from member target_
2707         and corresponding constructor argument.
2708         * output.cc (Output_file_header::Output_file_header): Update prototype.
2709         (Output_file_header::do_sized_write): Use this->target_ in place
2710         of parameters()->target().
2711
2712         * testsuite/undef_symbol.cc (Foo::get_a): New method.
2713
2714         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
2715         * configure: Regenerate.
2716         * Makefile.in: Regenerate.
2717         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
2718         * testsuite/merge_string_literals_2.c: Likewise.
2719         * testsuite/Makefile.am
2720         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
2721         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
2722         literal -fmerge-constants.
2723         * testsuite/Makefile.in: Regenerate.
2724
2725         * i386.cc (Target_i386): Remove unused member dynbss_.
2726         * arm.cc (Target_arm): Likewise.
2727         * powerpc.cc (Target_powerpc): Likewise.
2728         * sparc.cc (Target_sparc): Likewise.
2729         * tilegx.cc (Target_tilegx): Likewise.
2730         * x86_64.cc (Target_x86_64): Likewise.
2731         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
2732         type_signature_, type_offset_.
2733         * plugin.h (Plugin_hook): Remove unused member layout_.
2734         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
2735         mapfile_.
2736         (Read_member): Remove unused members input_objects_, symtab_,
2737         mapfile_, layout_.
2738         (Check_library): Remove unused member symtab_.
2739         * archive.h (Lib_group): Remove unused member lib_.
2740         * archive.cc (Lib_group::Lib_group): Update initializer.
2741         * incremental.h (Incremental_binary): Remove unused member target_.
2742         (Incremental_script_entry): Removed unused member script_.
2743         * layout.h (Write_symbols_task): Remove unused member input_objects_.
2744         * icf.h (Icf): Remove unused member num_tracked_relocs.
2745
2746         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
2747         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
2748         its only use.
2749         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
2750
2751         * archive.h: Use struct rather than class for forward declaration
2752         of Read_symbols_data.
2753
2754 2013-10-07  Cary Coutant  <ccoutant@google.com>
2755
2756         PR gold/16010
2757         * testsuite/Makefile.am (icf_test): Fix dependencies.
2758         (icf_safe_test): Likewise.
2759         (icf_safe_so_test): Likewise.
2760         (large_symbol_alignment): Add empty _LDADD rule.
2761         * testsuite/Makefile.in: Regenerate.
2762
2763 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
2764
2765         PR gold/15927
2766         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
2767         relocation for R_X86_64_32 on x32.
2768
2769 2013-08-27  Roland McGrath  <mcgrathr@google.com>
2770
2771         * output.cc (Output_segment::set_section_addresses): Take new
2772         Target* argument.  If target->isolate_execinstr() and the segment
2773         is executable and starts at a target->abi_pagesize() boundary,
2774         pad its end out to a target->abi_pagesize() boundary with code fill.
2775         * output.h (Output_segment::set_section_addresses): Update decl.
2776         * layout.h (Layout::check_output_data_for_reset_values): Take new
2777         argument RELAX_OUTPUTS.
2778         (Layout): New member relax_output_list_.
2779         (Layout::add_relax_output): New method.
2780         * layout.cc (Layout::Layout): Update constructor.
2781         (Layout::reset_relax_output): New method.
2782         (Layout::clean_up_after_relaxation): Call it.
2783         (Layout::prepare_for_relaxation): Update caller.
2784         (Layout::set_segment_offsets): Update callers of set_section_addresses.
2785         Call reset_relax_output before re-processing segments for
2786         isolate_execinstr case.
2787         (Layout::write_data): Handle relax_output_list_.
2788         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
2789         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
2790
2791 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
2792
2793         PR binutils/15834
2794         * object.h: Fix typos.
2795
2796 2013-08-16  Roland McGrath  <mcgrathr@google.com>
2797
2798         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
2799         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
2800
2801 2013-08-07  Cary Coutant  <ccoutant@google.com>
2802
2803         Revert support for v2 DWP files:
2804
2805         2013-03-01  Cary Coutant  <ccoutant@google.com>
2806
2807             Add dwp support for v2 DWARF package file format.
2808             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2809             tu_length parameter.  Adjust all callers.
2810             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2811             * dwp.cc: Include dwarf.h.
2812             (Section_bounds): New struct type.
2813             (Unit_set): New struct type.
2814             (Dwo_file::Dwo_file): Initialize new data member.
2815             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2816             Combine and rename to...
2817             (Dwo_file::read_unit_index): ...this.
2818             (Dwo_file::sized_read_compunit_index)
2819             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2820             (Dwo_file::sized_read_unit_index): ...this.
2821             (Dwo_file::copy_section): Remove section_name, is_str_offsets
2822             parameters; add section_id parameter.
2823             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2824             (Dwo_file::add_unit_set): ...this.
2825             (Dwo_file::shndx_map_): Remove.
2826             (Dwo_file::sect_offsets_): New data member.
2827             (Dwp_output_file::Dwp_output_file): Initialize new data members.
2828             (Dwp_output_file::add_section): Rename to...
2829             (Dwp_output_file::add_contribution): ...this.
2830             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2831             (Dwp_output_file::add_tu_set): Likewise.
2832             (Dwp_output_file::Contribution): New type.
2833             (Dwp_output_file::Section::contributions): New data member.
2834             (Dwp_output_file::Cu_or_tu_set): Remove.
2835             (Dwp_output_file::Section::Section): New ctor.
2836             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2837             (Dwp_output_file::Dwp_index::Section_table): New type.
2838             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2839             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2840             parameter.
2841             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2842             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2843             (Dwp_output_file::Dwp_index::section_table): New member function.
2844             (Dwp_output_file::Dwp_index::section_table_end): New member function.
2845             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2846             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2847             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2848             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2849             (Dwp_output_file::Dwp_index::section_table_): New data member.
2850             (Dwp_output_file::Dwp_index::section_mask_): New data member.
2851             (Dwp_output_file::add_output_section): New member function.
2852             (Dwp_output_file::write_new_section): New member function.
2853             (Dwp_output_file::write_contributions): New member function.
2854             (Dwp_output_file::section_id_map_): New data member.
2855             (class Dwo_id_info_reader): Remove.
2856             (class Unit_reader): New class.
2857             (get_dwarf_section_name): New function.
2858             (Dwo_file::read_executable): Adjust initializations of class data.
2859             (Dwo_file::read): Add support for v2 package file format.
2860             (Dwo_file::read_unit_index): Likewise.
2861             (Dwo_file::sized_read_unit_index): Likewise.
2862             (Dwo_file::copy_section): Likewise.
2863             (Dwo_file::add_unit_set): Likewise.
2864             (Dwp_output_file::add_output_section): Likewise.
2865             (Dwp_output_file::add_contribution): Likewise.
2866             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2867             for empty slot.
2868             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2869             file format.
2870             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2871             slot.
2872             (Dwp_output_file::initialize): Remove unused function.
2873             (Dwp_output_file::finalize): Add support for v2 package file format.
2874             (Dwp_output_file::write_index): Likewise.
2875             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2876             function prototype.
2877
2878 2013-07-31  Cary Coutant  <ccoutant@google.com>
2879
2880         * object.cc (Sized_relobj::do_output_section_address): New function.
2881         (Sized_relobj): Instantiate explicitly.
2882         * object.h (Object::output_section_address): New function.
2883         (Object::do_output_section_address): New function.
2884         (Sized_relobj::do_output_section_address): New function.
2885         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
2886
2887 2013-07-30  Cary Coutant  <ccoutant@google.com>
2888             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2889
2890         * parameters.cc (Parameters::entry): Return target-specific entry
2891         symbol name.
2892         * target.h (Target::entry_symbol_name): New function.
2893         (Target_info::entry_symbol_name): New data member.
2894
2895         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
2896         * i386.cc (Target_i386::i386_info): Likewise.
2897         (Target_i386_nacl::i386_nacl_info): Likewise.
2898         * sparc.cc (Target_sparc::sparc_info): Likewise.
2899         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
2900         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
2901         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
2902         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2903
2904 2013-07-22  Sterling Augustine  <saugustine@google.com>
2905
2906         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
2907         Convert parameter shndx to local variable. Add parameters symtab
2908         and symtab_size.  Scan over section names.  Find relocation
2909         section corresponding to current section.  Create and initialize
2910         reloc_mapper_ and reloc_type_.
2911         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
2912         unit_length to off_t.  Initialize member unit_length_.  Fill in field
2913         cu_offset_.
2914         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2915         Initialize new fields unit_length_ and cu_offset_.
2916         (Dwarf_pubnames_table::read_section): Update prototype.
2917         (Dwarf_pubnames_table::cu_offset): New member function.
2918         (Dwarf_pubnames_table::subsection_size): Likewise.
2919         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
2920         New fields.
2921         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
2922         member functions public.
2923         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
2924         Update comment.  Rework logic.  Move repeated parts to...
2925         (Gdb_index_info_reader::read_pubtable): ...here. New function.
2926         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
2927         pubtypes_table_, and stmt_list_offset.
2928         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2929         Gdb_index::find_pubtype_offset,
2930         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
2931         (Gdb_index::pubnames_read): Update prototype and rework logic.
2932         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
2933         Forward declare.
2934         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2935         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
2936         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
2937         Gdb_index::map_pubtable_to_dies):
2938         Declare functions.
2939         (Gdb_index::pubnames_read): Update declaration.
2940         (Gdb_index::Pubname_offset_map): New type.
2941         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
2942         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
2943         Gdb_index::stmt_list_offset): Declare.
2944         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
2945         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
2946         Gdb_index::pubtypes_offset_): Remove.
2947
2948 2013-07-19  Roland McGrath  <mcgrathr@google.com>
2949
2950         * options.h (General_options): Add -Trodata-segment option.
2951         * parameters.cc (Parameters::check_rodata_segment): New function.
2952         (Parameters::set_target_once): Call it.
2953         * parameters.h (Parameters): Declare it (private member function).
2954         * layout.cc (load_seg_unusable_for_headers): New function, broken
2955         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
2956         then validate rodata segment rather than text segment.
2957         (relaxation_loop_body): Call that.
2958         (is_text_segment): New function.  Don't admit a non-executable
2959         segment if TARGET->isolate_execinstr().
2960         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
2961
2962 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
2963
2964         PR gold/15070
2965         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
2966         * nacl.h (Sniff_file::View::View): Request aligned view.
2967
2968 2013-07-11  Cary Coutant  <ccoutant@google.com>
2969
2970         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
2971         correct BRLT entry size.
2972
2973 2013-07-03  Alan Modra  <amodra@gmail.com>
2974
2975         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
2976         comment.
2977
2978 2013-07-01  Cary Coutant  <ccoutant@google.com>
2979
2980         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
2981         reloc_type_.
2982         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
2983         (Dwarf_ranges_table::lookup_reloc): New function.
2984         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
2985         reloc_type_.
2986         (Dwarf_ranges_table::lookup_reloc): New function.
2987         (Dwarf_ranges_table::reloc_type_): New data member.
2988
2989 2013-06-27  Jing Yu  <jingyu@google.com>
2990
2991         PR gold/15662
2992         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
2993         function.
2994         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
2995         (Target_powerpc::do_relax): Call the above.
2996
2997 2013-06-27  Cary Coutant  <ccoutant@google.com>
2998
2999         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
3000         on garbage collected .opd section.
3001
3002 2013-06-27  Alan Modra  <amodra@gmail.com>
3003
3004         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
3005         is non-zero.
3006         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
3007         (Target_powerpc::do_function_location): Likewise for loc->shndx.
3008
3009 2013-06-14  Cary Coutant  <ccoutant@google.com>
3010
3011         * resolve.cc (Symbol::override_base): Don't override st_type
3012         from plugin placeholder symbols.
3013         (Symbol_table::resolve): Likewise.
3014         (Symbol_table::should_override): Don't complain about TLS mismatch
3015         if the TO symbol is a plugin placeholder.
3016         * testsuite/Makefile.am (plugin_test_tls): New test.
3017         * testsuite/Makefile.in: Regenerate.
3018         * testsuite/plugin_test_tls.sh: New test script.
3019         * testsuite/two_file_test_2_tls.cc: New test source.
3020         * testsuite/two_file_test_tls.cc: New test source.
3021
3022 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3023
3024         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
3025         the maximum segment alignment is larger than the page size.
3026         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
3027         correctly aligns the symbols with large alignemnt.
3028         * testsuite/Makefile.in: Regenerate.
3029         * testsuite/large_symbol_alignment.cc: New file.
3030
3031 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3032             Sriraman Tallam  <tmsriram@google.com>
3033
3034         * options.h (sort_section): New option.
3035         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
3036         Rename from Input_section_sort_section_name_special_ordering_compare.
3037         (Input_section_sort_section_name_compare): New struct.
3038         * output.cc (Output_section::Input_section_sort_section_name_compare::
3039         operator()): New function.
3040         (Output_section::sort_attached_input_sections): Use new sort function
3041         for .text if --sort-section=name is specified.
3042         * layout.cc (Layout::make_output_section):
3043         Add sorting by name when --sort-section=name is specified.
3044         * testsuite/Makefile.am (text_section_grouping): Test option
3045         --sort-section=name.
3046         * testsuite/Makefile.in: Regenerate.
3047         * testsuite/section_sorting_name.cc: New file.
3048         * testsuite/section_sorting_name.sh: New file.
3049
3050 2013-05-21  Cary Coutant  <ccoutant@google.com>
3051
3052         * symtab.h (Symbol::is_cxx_vtable): New function.
3053         * target-reloc.h (relocate_section): Check for vtable symbol.
3054         * testsuite/Makefile.am (missing_key_func.sh): New test case.
3055         * testsuite/Makefile.in: Regenerate.
3056         * testsuite/missing_key_func.cc: New test source.
3057         * testsuite/missing_key_func.sh: New test script.
3058
3059 2013-05-21  Cary Coutant  <ccoutant@google.com>
3060
3061         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
3062         type of enclosing symbol.
3063         (Relocate_info::location): Check symbol type when describing symbol.
3064         * object.h (Symbol_location_info): Remove unused line_number;
3065         add enclosing_symbol_type.
3066         * testsuite/debug_msg.sh: Adjust expected output.
3067
3068 2013-05-13  Cary Coutant  <ccoutant@google.com>
3069
3070         * configure.ac: Export DEFAULT_TARGET.
3071         * configure: Regenerate.
3072         * Makefile.in: Regenerate.
3073         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
3074         * testsuite/Makefile.in: Regenerate.
3075         * testsuite/debug_msg.sh: Delete duplicate tests.
3076         Don't check undef_int error message match for powerpc where the
3077         source file and line number aren't available.
3078
3079 2013-05-10  Roland McGrath  <mcgrathr@google.com>
3080
3081         * options.h (General_options): Add --rosegment-gap option.
3082         * options.cc (finalize): --rosegment-gap implies --rosegment.
3083         * layout.cc (set_segment_offsets): Let user option override
3084         target->rosegment_gap().
3085
3086 2013-05-10  Roland McGrath  <mcgrathr@google.com>
3087
3088         * options.h (General_options): Remove leading space from help
3089         messages for -nostdlib and --rosegment.
3090
3091 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
3092
3093         PR ld/15365
3094         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
3095
3096 2013-05-03  Alan Modra  <amodra@gmail.com>
3097
3098         * merge.cc (Output_merge_string::do_add_input_section): Correct
3099         scan for number of strings.  Rename vars to avoid shadowing.
3100         Include missing terminator in input_size_.
3101
3102 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
3103
3104         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
3105         Restore empty string handling.
3106
3107 2013-05-01  Cary Coutant  <ccoutant@google.com>
3108
3109         * stringpool.cc (Stringpool_template::new_key_offset): Fix
3110         uninitialized warning.
3111
3112 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3113
3114         * output.cc (Output_section::add_merge_input_section): Allow
3115         to merge sections if the alignment is more than character size.
3116         * merge.h (Output_merge_string::Output_merge_string): Remove
3117         assert.
3118         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
3119         only not-null strings. Check the alignment of strings.
3120         * stringpool.h
3121         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
3122         alignment as the argument.
3123         (Stringpool_template<Stringpool_char>::addralign_): New class member.
3124         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
3125         Align non-zero length strings according to the addralign_.
3126         (Stringpool_template<Stringpool_char>::set_string_offsets):
3127         Updating offsets according to the given alignment.
3128         * testsuite/Makefile.am (text_section_grouping): Test if string
3129         literals are getting merged.
3130         * testsuite/Makefile.in: Regenerate.
3131         * testsuite/merge_string_literals_1.c: New file.
3132         * testsuite/merge_string_literals_2.c: Ditto.
3133         * testsuite/merge_string_literals.sh: Ditto.
3134
3135 2013-04-26  Ian Lance Taylor  <iant@google.com>
3136
3137         * target-reloc.h (relocate_section): If the reloc offset is out of
3138         range, pass VIEW as NULL to relocate.relocate.
3139         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
3140         * i386.cc (Target_i386::Relocate::relocate): Likewise.
3141         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
3142         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
3143         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
3144         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3145
3146 2013-04-26  Geoff Pike  <gpike@chromium.org>
3147
3148         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
3149         * layout.cc (Hash_task): New class.
3150         (Layout::queue_build_id_tasks): New function.
3151         (Layout::write_build_id): Handle single-thread portion of build ID
3152         computation.  (In some cases, all of it is single-threaded.)  Replace
3153         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
3154         functionality in fewer lines of code.
3155         * layout.h (Layout::queue_build_id_tasks): New function declaration.
3156         * options.h (General_options): make "--build-id" default to tree
3157         rather than sha1.  Add two new options related to --build-id=tree:
3158         --build-id-chunk-size-for-treehash and
3159         --build-id-min-file-size-for-treehash.
3160         * Makefile.am: add testing of --build-id=tree and related new options
3161         (these tests will be invoked by "make check").
3162         * Makefile.in: Regenerate.
3163
3164 2013-04-25  Alan Modra  <amodra@gmail.com>
3165
3166         * configure.tgt: Add powerpcle and powerpc64le.
3167
3168 2013-04-22  Alan Modra  <amodra@gmail.com>
3169
3170         PR gold/15355
3171         * layout.cc (Layout::segment_precedes): Allow more than one
3172         segment with the same type and flags.
3173
3174 2013-04-15  Cary Coutant  <ccoutant@google.com>
3175
3176         * layout.cc (Layout::set_relocatable_section_offsets): Don't
3177         allocate space in file for BSS sections.
3178
3179 2013-04-15  Cary Coutant  <ccoutant@google.com>
3180
3181         * script-sections.cc (Orphan_output_section): Reset address
3182         to zero after each orphaned section for relocatable links.
3183
3184 2013-04-15  Cary Coutant  <ccoutant@google.com>
3185
3186         * symtab.cc (Symbol_table::sized_write_globals): Subtract
3187         section starting address for relocatable link.
3188         * testsuite/Makefile.am (script_test_11): New test.
3189         * testsuite/Makefile.in: Regenerate.
3190         * testsuite/script_test_11.c: New source file.
3191         * testsuite/script_test_11.t: New linker script.
3192
3193 2013-04-13  Alan Modra  <amodra@gmail.com>
3194
3195         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
3196         owner when sections are not adjacent and exceed group size.
3197         (Target_powerpc::group_sections): Handle corner case.
3198         (Target_powerpc::Branch_info::make_stub): Handle case where
3199         stub table doesn't exist due to branches in non-exec sections.
3200         (Target_powerpc::Relocate::relocate): Likewise.
3201
3202 2013-04-11  Alan Modra  <amodra@gmail.com>
3203
3204         PR gold/15354
3205         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
3206         .branch_lt to match bfd ld.  Adjust comments throughout file.
3207
3208 2013-04-04  Ian Lance Taylor  <iant@google.com>
3209
3210         GCC PR c++/56840
3211         * object.cc (do_layout_deferred_sections): Handle .eh_frame
3212         sections before checking whether they are included in the link.
3213
3214 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
3215
3216         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
3217         object before calling the plugin claim_file handler.  Pass the elf
3218         object of the archive to the plugin. Delete the elf object if the
3219         plugin claims the file.
3220
3221 2013-03-21  Alan Modra  <amodra@gmail.com>
3222
3223         * layout.cc (Layout::set_segment_offsets): Accept writable .text
3224         segment when omagic.
3225
3226 2013-03-21  Alan Modra  <amodra@gmail.com>
3227
3228         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
3229         comparison warning.
3230         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
3231         uninitialized" warning.
3232
3233 2013-03-20  Alan Modra  <amodra@gmail.com>
3234
3235         * symtab.h (Symbol::clear_version): New function.
3236         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
3237         is_needed by weak references.  Clear version for symbols defined
3238         in as-needed objects that are not needed.
3239
3240 2013-03-15  Alan Modra  <amodra@gmail.com>
3241
3242         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
3243         static and public.  Add report_err param.  Return false for data refs.
3244         (Target_powerpc::rela_dyn_section): New overloaded function.
3245         (Target_powerpc::plt_, iplt_): Elucidate.
3246         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
3247         (Output_data_plt_powerpc::do_write): Don't write .iplt.
3248         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
3249         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
3250         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
3251         push_branch and make_plt_entry for ifunc syms when
3252         reloc_needs_plt_for_ifunc.
3253         (Target_powerpc::Relocate::relocate): Don't use plt entry value
3254         for ifunc unless reloc_needs_plt_for_ifunc.
3255
3256 2013-03-15  Alan Modra  <amodra@gmail.com>
3257
3258         * gc.h (gc_process_relocs): Don't look through function descriptors.
3259         * icf.cc (get_section_contents): Do so here instead.
3260
3261 2013-03-13  Alan Modra  <amodra@gmail.com>
3262
3263         * powerpc.cc (is_branch_reloc): Forward declare.
3264         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
3265         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
3266         false for 64-bit, true for 32-bit non-branch relocs.
3267         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
3268         * testsuite/Makefile.am (icf_test): Use linker map file instead of
3269         nm output.
3270         (icf_safe_test): Generate linker map file as well as nm output.
3271         (icf_safe_so_test): Likewise.
3272         * testsuite/Makefile.in: Regenerate.
3273         * testsuite/icf_test.sh: Parse linker map file to determine
3274         section folding.
3275         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
3276         * testsuite/icf_safe_so_test.sh: Likewise.
3277         (X86_32_or_ARM_specific_safe_fold): Merge into..
3278         (arch_specific_safe_fold): ..this.
3279         (X86_64_specific_safe_fold): Delete unused function.
3280
3281 2013-03-12  Alan Modra  <amodra@gmail.com>
3282
3283         * gc.h (gc_process_relocs): Look through function descriptors
3284         to determine shndx, symvalue and addend used by ICF.  Tidy
3285         variable duplication.
3286
3287 2013-03-11  Alan Modra  <amodra@gmail.com>
3288
3289         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
3290         * layout.cc (Layout_task_runner::run): ..to here.
3291         * symtab.h (struct Symbol_location): Extract from..
3292         (class Symbol_table): ..here.
3293         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
3294         * target.h (class Target): Add function_location and
3295         do_function_location functions.
3296         (class Sized_target): Add do_function_location.
3297         * object.h (class Sized_relobj_file): Move find_shdr..
3298         (class Object): ..to here.
3299         * object.cc: Likewise.  Update to suit.  Instantiate.
3300         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
3301         * powerpc.cc (class Powerpc_dynobj): New.
3302         (Target_powerpc::do_function_location): New function.
3303         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
3304         (Powerpc_dynobj::do_read_symbols): New function.
3305         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
3306
3307 2013-03-08  Ian Lance Taylor  <iant@google.com>
3308
3309         * options.cc (General_options::string_to_object_format): Accept
3310         "default".
3311
3312 2013-03-08  Alan Modra  <amodra@gmail.com>
3313
3314         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
3315         pointer to Post_fde.
3316         (struct Post_fde): Move definition to here..
3317         * ehframe.cc (struct Post_fde): ..from here.
3318         (Cie::write): Don't alloc Post_fde.
3319         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
3320
3321 2013-03-07  Alan Modra  <amodra@gmail.com>
3322
3323         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
3324         relocation referencing .LC0.
3325         * testsuite/discard_locals_test.sh: Remove FIXMEs.
3326
3327 2013-03-07  Alan Modra  <amodra@gmail.com>
3328
3329         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
3330         always_inline.  Add assembly for powerpc to avoid GOT.
3331
3332 2013-03-07  Alan Modra  <amodra@gmail.com>
3333
3334         * testsuite/script_test_10.sh: Don't test .bss section
3335         header number.
3336
3337 2013-03-06  Alan Modra  <amodra@gmail.com>
3338
3339         * powerpc.cc (class Powerpc_relobj): Move some member functions.
3340         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
3341         all callers.  Handle folded sections.
3342         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
3343         to Powerpc_relobj.
3344         (Global_symbol_visitor_opd::operator()): Likewise.
3345
3346 2013-03-04  Alan Modra  <amodra@gmail.com>
3347
3348         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
3349         * testsuite/Makefile.in: Regenerate.
3350
3351 2013-03-01  Cary Coutant  <ccoutant@google.com>
3352
3353         Add dwp support for v2 DWARF package file format.
3354         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
3355         tu_length parameter.  Adjust all callers.
3356         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
3357         * dwp.cc: Include dwarf.h.
3358         (Section_bounds): New struct type.
3359         (Unit_set): New struct type.
3360         (Dwo_file::Dwo_file): Initialize new data member.
3361         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
3362         Combine and rename to...
3363         (Dwo_file::read_unit_index): ...this.
3364         (Dwo_file::sized_read_compunit_index)
3365         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
3366         (Dwo_file::sized_read_unit_index): ...this.
3367         (Dwo_file::copy_section): Remove section_name, is_str_offsets
3368         parameters; add section_id parameter.
3369         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
3370         (Dwo_file::add_unit_set): ...this.
3371         (Dwo_file::shndx_map_): Remove.
3372         (Dwo_file::sect_offsets_): New data member.
3373         (Dwp_output_file::Dwp_output_file): Initialize new data members.
3374         (Dwp_output_file::add_section): Rename to...
3375         (Dwp_output_file::add_contribution): ...this.
3376         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
3377         (Dwp_output_file::add_tu_set): Likewise.
3378         (Dwp_output_file::Contribution): New type.
3379         (Dwp_output_file::Section::contributions): New data member.
3380         (Dwp_output_file::Cu_or_tu_set): Remove.
3381         (Dwp_output_file::Section::Section): New ctor.
3382         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
3383         (Dwp_output_file::Dwp_index::Section_table): New type.
3384         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
3385         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
3386         parameter.
3387         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
3388         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
3389         (Dwp_output_file::Dwp_index::section_table): New member function.
3390         (Dwp_output_file::Dwp_index::section_table_end): New member function.
3391         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
3392         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
3393         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
3394         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
3395         (Dwp_output_file::Dwp_index::section_table_): New data member.
3396         (Dwp_output_file::Dwp_index::section_mask_): New data member.
3397         (Dwp_output_file::add_output_section): New member function.
3398         (Dwp_output_file::write_new_section): New member function.
3399         (Dwp_output_file::write_contributions): New member function.
3400         (Dwp_output_file::section_id_map_): New data member.
3401         (class Dwo_id_info_reader): Remove.
3402         (class Unit_reader): New class.
3403         (get_dwarf_section_name): New function.
3404         (Dwo_file::read_executable): Adjust initializations of class data.
3405         (Dwo_file::read): Add support for v2 package file format.
3406         (Dwo_file::read_unit_index): Likewise.
3407         (Dwo_file::sized_read_unit_index): Likewise.
3408         (Dwo_file::copy_section): Likewise.
3409         (Dwo_file::add_unit_set): Likewise.
3410         (Dwp_output_file::add_output_section): Likewise.
3411         (Dwp_output_file::add_contribution): Likewise.
3412         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
3413         for empty slot.
3414         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
3415         file format.
3416         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
3417         slot.
3418         (Dwp_output_file::initialize): Remove unused function.
3419         (Dwp_output_file::finalize): Add support for v2 package file format.
3420         (Dwp_output_file::write_index): Likewise.
3421         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
3422         function prototype.
3423
3424 2013-03-01  Cary Coutant  <ccoutant@google.com>
3425
3426         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
3427         function into class definition in header file.
3428         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
3429         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
3430         New function.
3431         (Dwarf_info_reader::check_buffer): Move here from .cc file.
3432
3433 2013-02-28  Alan Modra  <amodra@gmail.com>
3434
3435         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
3436         * target.cc (Target::do_plt_fde_location): New function.
3437         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
3438         accessor function, and constructor param.
3439         (struct Post_fde, Post_fdes): Declare.
3440         (Cie::write): Add post_fdes param.
3441         * ehframe.cc (Fde::write): Use plt_fde_location.
3442         (struct Post_fde): Define.
3443         (Cie::write): Stash FDEs added post merge mapping.
3444         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
3445         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
3446         (Eh_frame::do_sized_write): Arrange to write post map FDES after
3447         other FDEs.
3448         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
3449         (Target_powerpc::has_glink): New function.
3450         (Target_powerpc::do_relax): Add eh_frame info for stubs.
3451         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
3452         glink_eh_frame_fde_32, default_fde): New data.
3453         (Stub_table::eh_frame_added_): New var.
3454         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
3455         Make const.
3456         (Stub_table::add_eh_frame): New function.
3457         (Output_data_glink::add_eh_frame): New function.
3458         (Target_powerpc::make_glink_section): Call add_eh_frame.
3459
3460 2013-02-15  Ian Lance Taylor  <iant@google.com>
3461
3462         * options.h (DEFINE_uint64_alias): Define.
3463         (class General_options): Add -Ttext-segment as an alias for
3464         -Ttext.
3465
3466 2013-02-15  Alan Modra  <amodra@gmail.com>
3467
3468         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
3469         (Stub_table::do_write): ..here, two places.
3470         (Stub_table::plt_call_size): Use it here too.
3471
3472 2013-02-11  Ian Lance Taylor  <iant@google.com>
3473
3474         * descriptors.cc (Descriptors::close_all): New function.
3475         * descriptors.h (class Descriptors): Declare close_all.
3476         (close_all_descriptors): New inline function.
3477         * plugin.cc: Include "descriptors.h".
3478         (Plugin_manager::cleanup): Call close_all_descriptors.
3479
3480 2013-02-06  Alan Modra  <amodra@gmail.com>
3481
3482         * README: Update coding style link.
3483
3484 2013-01-28  Cary Coutant  <ccoutant@google.com>
3485
3486         * dwp.cc (File_list): New typedef.
3487         (Dwo_name_info_reader): New class.
3488         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
3489         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
3490         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
3491         (Dwo_file::read_executable): New function.
3492         (Dwo_file::read): Move common setup code to ...
3493         (Dwo_file::make_object): ... here.
3494         (dwp_options): Add --exec/-e.
3495         (usage): Likewise.
3496         (main): Likewise.
3497
3498 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
3499
3500         * layout.cc (Layout::layout): Check for option text_reorder.
3501         (Layout::make_output_section): Ditto.
3502         * options.h (text_reorder): New option.
3503         * output.cc (Input_section_sort_compare): Remove special ordering
3504         of section names.
3505         (Output_section::
3506          Input_section_sort_section_name_special_ordering_compare::
3507          operator()): New function.
3508         (Output_section::sort_attached_input_sections): Use new sort function
3509         for .text.
3510         * output.h (Input_section_sort_section_name_special_ordering_compare):
3511         New struct.
3512         * testsuite/Makefile.am (text_section_grouping): Test option
3513         --no-text-reorder
3514         * testsuite/Makefile.in: Regenerate.
3515         * testsuite/text_section_grouping.sh: Check order of functions without
3516         default text reordering.
3517
3518 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3519
3520         * options.h (General_options): Change default to true for new_dtags.
3521
3522 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3523
3524         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
3525         when enable_new_dtags is false.  Only add DT_RUNPATH when
3526         enable_new_dtags is true.
3527
3528 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
3529
3530         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
3531         used in declaration and definition consistent.
3532         (Target_powerpc::symval_for_branch): Ditto.
3533
3534 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3535
3536         * testsuite/plugin_final_layout.cc: Fix comment.
3537
3538 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3539
3540         * layout.cc (Layout::layout): Do not do default sorting for
3541         text sections when section ordering is specified.
3542         (make_output_section): Ditto.
3543         * testsuite/plugin_final_layout.cc: Name the function sections
3544         to catch reordering issues.
3545
3546 2013-01-15  Alan Modra  <amodra@gmail.com>
3547
3548         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
3549         plt-thread-safe.
3550
3551 2013-01-15  Alan Modra  <amodra@gmail.com>
3552
3553         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
3554         * testsuite/Makefile.in: Regenerate.
3555
3556 2013-01-14  Alan Modra  <amodra@gmail.com>
3557
3558         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
3559         * testsuite/Makefile.in: Regenerate.
3560
3561 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
3562
3563         PR bfd/14430
3564         Fix mingw gold build with plugins enabled
3565         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
3566         * configure.ac: Export DLOPEN_LIBS and add headers check.
3567         * plugin.cc: Handle non-dlfcn case.
3568         * Makefile.in: Regenerate.
3569         * config.in: Regenerate.
3570         * configure: Regenerate.
3571         * testsuite/Makefile.in: Regenerate.
3572
3573 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
3574
3575         * output.h (sort_attached_input_sections): Change to be public.
3576         * script-sections.cc
3577         (Output_section_definition::set_section_addresses): Sort
3578         attached input sections according to section order before linker
3579         script assigns section addresses.
3580         (Orphan_output_section::set_section_addresses): Sort
3581         attached input sections according to section order before linker
3582         script assigns section addresses.
3583         * Makefile.am (final_layout.sh): Use a simple linker script to
3584         check if section ordering still works.
3585         * Makefile.in: Regenerate.
3586
3587 2013-01-09  Ben Cheng  <bccheng@google.com>
3588
3589         * arm.cc (Target_arm::attributes_accept_div): New function.
3590         (Target_arm::attributes_forbid_div): New function.
3591         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
3592         attribute using the same new functions as what bfd/elf32_arm.c
3593         does.
3594
3595 2013-01-07  Cary Coutant  <ccoutant@google.com>
3596
3597         PR gold/14993
3598         * output.cc (Output_section::add_input_section): For incremental
3599         updates, don't track input sections that are allocated from patch
3600         space.
3601
3602 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3603             Ian Lance Taylor  <iant@google.com>
3604
3605         PR gold/14897
3606         * configure.ac (--enable-ld): Removed.
3607         (install_as_default): Set to yes only for --enable-gold=default
3608         or --disable-ld.
3609         * configure: Regenerated.
3610
3611 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3612
3613         * options.h (General_options): Add -fuse-ld= for GCC linker
3614         option compatibility.
3615
3616 2013-01-04  Cary Coutant  <ccoutant@google.com>
3617
3618         * configure.ac: Fix typo restoring CXXFLAGS.
3619         * configure: Regenerate.
3620
3621 2013-01-04  Cary Coutant  <ccoutant@google.com>
3622
3623         * testsuite/Makefile.am (CXXLINK_S): New macro.
3624         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
3625         * testsuite/Makefile.in: Regenerate.
3626
3627 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
3628
3629         * version.cc (print_version): Update copyright year to 2013.
3630
3631 2012-12-20  Ian Lance Taylor  <iant@google.com>
3632
3633         * layout.cc (Layout::special_ordering_of_input_section): New
3634         function.
3635         (Layout::layout): If input section requires special ordering, must
3636         sort input sections.
3637         (Layout::make_output_section): May sort .text input sections.
3638         (Layout::is_section_name_prefix_grouped): Remove.
3639         * layout.h (class Layout): Declare
3640         special_ordering_of_input_section.  Don't declare
3641         is_section_name_prefix_grouped.
3642         * output.cc (Output_section::add_input_section): Revert last
3643         change.
3644         (Output_section::Input_section_sort::match_file_name): Don't crash
3645         if called on output section data.
3646         (Output_section::Input_section_sort_compare): Sort based on
3647         special ordering.
3648         (Output_section::Input_section_sort_section_order_index_compare):
3649         Revert last patch.
3650         (Output_section::sort_attached_input_sections): Likewise.
3651
3652 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
3653
3654         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
3655         * layout.h (Layout::is_section_name_prefix_grouped): New function.
3656         * output.cc (Output_section::add_input_section): Check if section
3657         name contains special prefix.  Keep input sections to sort such
3658         sections.
3659         (Output_section::Input_section_sort_section_order_index_compare
3660          ::operator()): Group sections according to prefixes.
3661         (Output_section::sort_attached_input_sections): Add condition to
3662         Input_section_entry constructor call.
3663         * testsuite/Makefile.am (text_section_grouping): New test.
3664         * testsuite/Makefile.in: Regenerate.
3665         * testsuite/text_section_grouping.cc: New file.
3666         * testsuite/text_section_grouping.sh: New file.
3667
3668 2012-12-17  Nick Clifton  <nickc@redhat.com>
3669
3670         * Makefile.am: Add copyright notice.
3671         * NEWS: Likewise.
3672         * README: Likewise.
3673         * configure.ac: Likewise.
3674         * ftruncate.c: Likewise.
3675         * Makefile.in: Regenerate.
3676
3677 2012-12-14  Cary Coutant  <ccoutant@google.com>
3678
3679         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
3680         --no-as-needed flag.
3681         (exception_separate_shared_12_test): Likewise.
3682         (incremental_copy_test): Likewise.
3683         * testsuite/Makefile.in: Regenerate.
3684
3685 2012-12-14  Cary Coutant  <ccoutant@google.com>
3686
3687         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
3688         (Dwp_output_file::Dwp_index::enter_set): Add assert.
3689
3690 2012-12-12  Alan Modra  <amodra@gmail.com>
3691
3692         * powerpc.cc (class Track_tls): New.
3693         (class Relocate, class Scan): Inherit Track_tls.
3694         (Target_powerpc::Scan::local, global): Track tls optimization
3695         and avoid creating plt entry for __tls_get_addr if all uses
3696         are optimized away.
3697         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
3698
3699 2012-12-12  Alan Modra  <amodra@gmail.com>
3700
3701         * options.h (General_options): Add --toc-sort/--no-toc-sort.
3702         Replace no_toc_optimize with toc_optimize.
3703         * output.h (Output_section::input_sections): Provide non-const variant.
3704         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
3705         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
3706         accessors.
3707         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
3708         (class Sort_toc_sections): New.
3709         (Target_powerpc::do_finalize_sections): Sort toc sections.
3710         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
3711
3712 2012-12-10  Roland McGrath  <mcgrathr@google.com>
3713
3714         * testsuite/binary_unittest.cc (read_all): New function.
3715         (Sized_binary_test): Use it instead of ::read.
3716         * fileread.cc (do_read): Don't assume pread always reads the whole
3717         amount in a single call.
3718
3719 2012-12-10  Alan Modra  <amodra@gmail.com>
3720
3721         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
3722         Set EM_PPC64 or EM_PPC here.
3723         (Target_selector_powerpc::do_recognize): Delete.
3724
3725 2012-12-10  Alan Modra  <amodra@gmail.com>
3726
3727         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
3728         stub_table_.
3729         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
3730
3731 2012-12-07  Roland McGrath  <mcgrathr@google.com>
3732
3733         * testsuite/binary_unittest.cc (Sized_binary_test):
3734         Use open_descriptor rather than ::open.
3735
3736 2012-12-07  Alan Modra  <amodra@gmail.com>
3737
3738         * powerpc.cc (Stub_table::do_write): Delete redundant Address
3739         typedef and invalid_address constant.
3740         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
3741         instantiate constants.
3742
3743 2012-12-06  Roland McGrath  <mcgrathr@google.com>
3744
3745         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
3746         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
3747         * aclocal.m4: Regenerate.
3748         * configure: Regenerate.
3749         * Makefile.in: Regenerate.
3750         * testsuite/Makefile.in: Regenerate.
3751
3752 2012-12-07  Alan Modra  <amodra@gmail.com>
3753
3754         * options.h (General_options): Add no_toc_optimize.
3755         * powerpc.cc (ok_lo_toc_insn): New function.
3756         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
3757
3758 2012-12-06  Alan Modra  <amodra@gmail.com>
3759
3760         * options.h (General_options): Add plt_align, plt_static_chain,
3761         plt_thread_safe.  Update stub_group_size help text.
3762         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
3763         for new plt_thread_safe_ var.
3764         (use_plt_offset): Correct comments.
3765         (Target_powerpc::do_relax): Look for thread creation symbols to
3766         determine default plt_thread_safe value.  Clear plt call stubs
3767         as well as branch stubs each iteration.
3768         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
3769         insn constants.
3770         (l, hi, ha, write_insn): Move earlier.
3771         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
3772         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
3773         plt stubs too.
3774         (Stub_table::update_size): Adjust.
3775         (Stub_table::prev_size, set_prev_size): Delete.
3776         (Stub_table::stub_align): Let --plt-align affect result.
3777         (Stub_table::plt_call_size): Calculate sizes for various stubs.
3778         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
3779         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
3780         (Stub_table::do_write): Support more stub variants.
3781
3782 2012-12-04  Alan Modra  <amodra@gmail.com>
3783
3784         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
3785         (Target_powerpc::do_define_standard_symbols): New function.
3786
3787 2012-12-03  Alan Modra  <amodra@gmail.com>
3788
3789         * output.h: Formatting, whitespace.
3790
3791 2012-12-03  Alan Modra  <amodra@gmail.com>
3792
3793         * layout.h (Layout::get_executable_sections): Declare.
3794         * layout.cc (Layout::get_executable_sections): New function.
3795         * arm.cc (Target_arm::group_sections): Use it.
3796         (Arm_output_section::group_sections): Delete now redundant test.
3797         * output.cc (Output_reloc::Output_reloc): Add is_relative.
3798         param to handle relative relocs.
3799         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
3800         (Output_data_reloc::add_absolute): Adjust.
3801         (Output_data_reloc::add_relative): New function.
3802         (Output_data::reset_data_size): New function.
3803         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
3804         (Output_section::set_addralign): New function.
3805         (Output_section::checkpoint_set_addralign): New function.
3806         (Output_section::clear_section_offsets_need_adjustment): New function.
3807         (Output_section::input_sections): Make public.
3808         * powerpc.cc (class Output_data_brlt_powerpc): New.
3809         (class Stub_table, class Stub_control): New.
3810         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
3811         stub_table_, set_stub_table, stub_table): New vectors and accessor
3812         functions.
3813         (Target_powerpc::do_may_relax, do_relax, push_branch,
3814         new_stub_table, stub_tables, brlt_section, group_sections,
3815         add_branch_lookup_table, find_branch_lookup_table,
3816         write_branch_lookup_table, make_brlt_section): New functions.
3817         (Target_powerpc::struct Sort_sections, class Branch_info): New.
3818         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
3819         branch_info_): New vars.
3820         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
3821         make call stubs here.
3822         (Output_data_glink): Remove all call stub handling from this class.
3823         (Target_powerpc::Scan::local, global): Save interesting branch
3824         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
3825         (Target_powerpc::do_finalize_sections): Only make reg save/restore
3826         functions on final link.
3827         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
3828         Handle long branch destinations too.
3829         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
3830         do_plt_address_for_local): Adjust lookup of plt call stubs.
3831
3832 2012-11-30  Alan Modra  <amodra@gmail.com>
3833
3834         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
3835         relocs against protected symbols when building 32-bit shared libs.
3836
3837 2012-11-30  Alan Modra  <amodra@gmail.com>
3838
3839         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
3840         param.  Call got_section() to make .got.  Update all callers
3841         and their callers and so on.
3842
3843 2012-11-30  Alan Modra  <amodra@gmail.com>
3844
3845         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
3846         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
3847         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
3848         value if it already exists.
3849
3850 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
3851
3852         PR gold/14858
3853         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
3854
3855 2012-11-14  Roland McGrath  <mcgrathr@google.com>
3856
3857         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
3858         than bfc instruction for data sandboxing.
3859
3860 2012-11-08  Alan Modra  <amodra@gmail.com>
3861
3862         * po/POTFILES.in: Regenerate.
3863
3864 2012-11-05  Alan Modra  <amodra@gmail.com>
3865
3866         * configure.ac: Apply 2012-09-10 change to config.in here.
3867         * configure: Regenerate.
3868
3869 2012-11-05  Alan Modra  <amodra@gmail.com>
3870
3871         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
3872         (struct Opd_ent): Use "Address" rather than "Offset".
3873         (Output_data_got_powerpc::got_base_offset): Return Valtype.
3874         (Target_powerpc::got_section): Make public.
3875         (Target_powerpc::scan_relocs): Move code setting symbols..
3876         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
3877         Create _SDA_BASE_ only when referenced.
3878
3879 2012-11-02  Roland McGrath  <mcgrathr@google.com>
3880
3881         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
3882         from last change.
3883
3884 2012-11-01  Roland McGrath  <mcgrathr@google.com>
3885
3886         * target.h (Sized_target::relocate_relocs): Use Elf_Off
3887         for offset_in_output_section parameter.
3888         (Sized_target::relocate_special_relocatable): Likewise.
3889         * arm.cc (Target_arm::relocate_relocs): Likewise.
3890         (Target_arm::relocate_special_relocatable): Likewise.
3891         * i386.cc (Target_i386::relocate_relocs): Likewise.
3892         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
3893         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
3894         * target-reloc.h (relocate_relocs): Likewise.
3895         * testsuite/testfile.cc (Target_test): Likewise.
3896         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
3897         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
3898
3899         * system.h: Move inclusion of <clocale> to after <libintl.h> in
3900         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
3901
3902         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
3903         parameter, which is unused in the [!F_SETFD] case.
3904
3905         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
3906         SYMNDX to off_t before comparing it to this->data_size().
3907         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
3908         * incremental.cc (Output_section_incremental_inputs::do_write):
3909         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
3910
3911         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
3912
3913 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
3914
3915         * gold.cc (Target_arm::do_adjust_elf_header): Add the
3916         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
3917         in EABI_VER5.
3918
3919 2012-10-29  Cary Coutant  <ccoutant@google.com>
3920
3921         * dwp.cc (usage): Add file and exit status parameters;
3922         add --help and --version options.
3923         (print_version): New function.
3924         (main): Add --help and --version options.
3925
3926 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3927
3928         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
3929         final_layout_sequence.txt.
3930         * testsuite/Makefile.in: Regenerated.
3931
3932 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3933
3934         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
3935         COMPILE generated by automake.
3936         (LINK1): Likewise.
3937         (CXXCOMPILE1): Likewise.
3938         (CXXLINK1): Likewise.
3939         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
3940         (LINK): Likewise.
3941         (CXXCOMPILE): Likewise.
3942         (CXXLINK): Likewise.
3943         * testsuite/Makefile.in: Regenerated.
3944
3945 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3946
3947         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
3948         on bad fwrite return.
3949
3950 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3951
3952         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
3953         on val.
3954
3955 2012-10-23  Cary Coutant  <ccoutant@google.com>
3956
3957         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
3958         * testsuite/Makefile.in: Regenerate.
3959         * testsuite/dwp_test.h: New source file.
3960         * testsuite/dwp_test_1.cc: New source file.
3961         * testsuite/dwp_test_1.s: New source file.
3962         * testsuite/dwp_test_1.sh: New source file.
3963         * testsuite/dwp_test_1b.cc: New source file.
3964         * testsuite/dwp_test_1b.s: New source file.
3965         * testsuite/dwp_test_2.cc: New source file.
3966         * testsuite/dwp_test_2.s: New source file.
3967         * testsuite/dwp_test_2.sh: New source file.
3968         * testsuite/dwp_test_main.cc: New source file.
3969         * testsuite/dwp_test_main.s: New source file.
3970
3971 2012-10-23  Cary Coutant  <ccoutant@google.com>
3972
3973         * dwp.h: New header file.
3974         * dwp.cc: New source file.
3975         * gold.h: Move shared declarations to system.h.
3976         * system.h: New header file.
3977         * Makefile.am: Add dwp.
3978         * Makefile.in: Regenerate.
3979
3980 2012-10-23  Cary Coutant  <ccoutant@google.com>
3981
3982         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
3983         Dwarf_info_reader::read_from_pointer.
3984         (Dwarf_pubnames_table::read_header): Likewise.
3985         (Dwarf_pubnames_table::next_name): Likewise.
3986         (Dwarf_die::read_attributes): Likewise.
3987         (Dwarf_die::skip_attributes): Likewise.
3988         (Dwarf_info_reader::read_from_pointer): New function template.
3989         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
3990         (Dwarf_pubnames_table): Likewise.
3991         (Dwarf_info_reader::read_from_pointer): New function template.
3992         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
3993         Dwarf_pubnames_table ctor.
3994
3995 2012-10-23  Cary Coutant  <ccoutant@google.com>
3996
3997         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
3998         abbrev_shndx.
3999         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
4000         abbrev_shndx_.
4001         (Dwarf_info_reader::set_abbrev_shndx): New method.
4002         (Dwarf_info_reader::abbrev_shndx_): New data member.
4003
4004 2012-10-23  Cary Coutant  <ccoutant@google.com>
4005
4006         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
4007         from object, not parameters.
4008         (Dwarf_info_reader::parse): Likewise.
4009         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
4010         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
4011         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
4012         methods.
4013
4014 2012-10-23  Cary Coutant  <ccoutant@google.com>
4015
4016         * fileread.cc (Input_file::Input_file): New constructor.
4017         * fileread.h (class Input_file): Add new constructor.
4018
4019 2012-10-18  Alan Modra  <amodra@gmail.com>
4020
4021         PR gold/14727
4022         * object.cc (Relobj::is_section_name_included): Also match
4023         .sdata personality section.
4024
4025 2012-10-18  Alan Modra  <amodra@gmail.com>
4026
4027         * target-reloc.h (class Default_comdat_behavior): New, package up..
4028         (get_comdat_behaviour): ..this.
4029         (relocate_section): Add Relocate_comdat_behavior template arg,
4030         adjust code to suit.
4031         * arm.cc (Target_arm::relocate_section): Adjust to suit.
4032         (Target_arm::scan_reloc_section): Likewise.
4033         * i386.cc (Target_i386::relocate_section): Likewise.
4034         * sparc.cc (Target_sparc::relocate_section): Likewise.
4035         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
4036         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
4037         * powerpc.cc (class Relocate_comdat_behavior): New.
4038         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
4039         gold::relocate_section with new template arg.
4040
4041 2012-10-18  Alan Modra  <amodra@gmail.com>
4042
4043         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
4044         dynamic relocs for GOT_TPREL got entries, without symbol if
4045         resolving locally.
4046         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
4047         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
4048         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
4049
4050 2012-10-17  Alan Modra  <amodra@gmail.com>
4051
4052         PR gold/14726
4053         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
4054
4055 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
4056
4057         * layout.cc (Layout::include_section): Keep sections marked
4058         SHF_EXCLUDE when doing relocatable links.
4059
4060 2012-10-16  Alan Modra  <amodra@gmail.com>
4061
4062         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
4063         (Target_powerpc::do_finalize_sections): Call it.
4064         (Output_data_save_res): New class and supporting functions.
4065         (Target_powerpc::symval_for_branch): Only look up .opd entry for
4066         normal symbols defined in object files.
4067
4068 2012-10-12  Alan Modra  <amodra@gmail.com>
4069
4070         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
4071         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
4072         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
4073         section if scan_opd_relocs not yet called.
4074         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
4075
4076 2012-10-12  Alan Modra  <amodra@gmail.com>
4077
4078         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
4079         add_local_ifunc_entry): Revert last change.
4080         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
4081
4082 2012-10-05  Alan Modra  <amodra@gmail.com>
4083
4084         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
4085         do_plt_address_for_global): New functions.
4086         (Output_data_got_powerpc::do_write): Don't segfault when linking
4087         statically.
4088         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
4089         add_local_ifunc_entry): Return true on adding entry..
4090         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
4091         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
4092         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
4093         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
4094         set up symbols here.
4095         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
4096         syms here.  Do so even when no .iplt.  Don't segfault when linking
4097         statically.
4098         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
4099         new variants without reloc param.
4100         (Glink_sym_ent::Glink_sym_ent): Likewise.
4101         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
4102         reloc when refs will resolve to plt call stub.
4103         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
4104         R_PPC_PLTREL24 to resolve locally.
4105         (Target_powerpc::Scan::global): Correct ifunc handling.
4106         (Target_powerpc::Relocate::relocate): Correct local sym glink
4107         lookup.  Don't destroy "value" when we have a plt call stub,
4108         and when checking plt call validity.
4109         (Target_powerpc::do_dynsym_value): Simplify.
4110
4111 2012-10-05  Alan Modra  <amodra@gmail.com>
4112
4113         * i386.cc (Output_data_plt_i386::address_for_global,
4114         address_for_local): Add plt offset to returned value.  Adjust uses.
4115         * sparc.cc (Output_data_plt_sparc::address_for_global,
4116         address_for_local): Likewise.
4117         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
4118         address_for_local): Likewise.
4119         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
4120         address_for_local): Likewise.
4121         * target.h (Target::plt_address_for_global, plt_address_for_local):
4122         Update comment.
4123         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
4124         (Output_data_got::Got_entry::write): Nor here.
4125         * output.h: Comment fix.
4126
4127 2012-10-02  Jiong Wang  <jiwang@tilera.com>
4128
4129         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
4130         global_offset_table_ value for larget got.
4131         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
4132
4133 2012-09-29  Alan Modra  <amodra@gmail.com>
4134
4135         * powerpc.cc (Target_powerpc::iplt_): New output section.
4136         (Target_powerpc::iplt_section, make_iplt_section,
4137         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
4138         (Target_powerpc::make_plt_entry): Handle ifunc syms.
4139         Target_powerpc::plt_entry_count): Count iplt entries too.
4140         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
4141         reloc section in constructor.  New params.
4142         (Target_powerpc::make_plt_section): Create reloc section here instead.
4143         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
4144         functions.
4145         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
4146         (Output_data_glink::add_entry, find_entry): New functions to
4147         deal with local syms.
4148         (Glink_sym_ent): Add support for local syms.
4149         (Output_data_glink::do_write): Handle ifunc plt entries.
4150         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4151         (Target_powerpc::Scan::local, global): Handle ifunc syms.
4152         (Target_powerpc::Relocate::relocate): Likewise.
4153         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
4154
4155 2012-09-25  Alan Modra  <amodra@gmail.com>
4156
4157         * object.h (Sized_relobj_file::adjust_local_symbol,
4158         do_adjust_local_symbol): New functions.
4159         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
4160         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
4161         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
4162         and irregular opd entry spacing.
4163         (Powerpc_relobj::do_read_relocs): Add opd size checks.
4164         (Global_symbol_visitor_opd): New functor.
4165         (Target_powerpc::do_finalize_sections): Omit global symbols defined
4166         on deleted opd entries.
4167
4168 2012-09-15  Jiong Wang  <jiwang@tilera.com>
4169
4170         * tilegx.cc: New file.
4171         * Makefile.am (TARGETSOURCES): Add tilegx.cc
4172         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
4173         * configure.tgt: Add entries for tilegx*.
4174         * configure.ac: Likewise.
4175         * Makefile.in: Rebuild.
4176         * configure: Likewise.
4177         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
4178         tilegx.
4179
4180 2012-09-13  Alan Modra  <amodra@gmail.com>
4181
4182         * target-reloc.h (scan_relocs): Call scan.local for relocs
4183         against symbols in discarded sections.  Pass is_discarded
4184         param.
4185         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
4186         Add is_discarded param.
4187         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
4188         is_discarded to flag opd entry as discarded.  Don't emit dyn
4189         relocs on such entries.
4190         (Target_powerpc::Scan::global): Similarly detect and handle
4191         such opd entries.
4192         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
4193         opd_ent_.  Update all uses.
4194         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
4195         (Target_powerpc::relocate_section): Zero out discarded opd
4196         entry relocs.
4197
4198 2012-09-12  Ian Lance Taylor  <iant@google.com>
4199
4200         PR gold/14570
4201         * output.cc: Rename Output_data_got template parameter from size
4202         to got_size for all functions.  Compile all variants of
4203         Output_data_got.
4204         (Output_data_got::Got_entry::write): Correct use of size for
4205         symbol value.  Use local_is_tls rather than casting to
4206         Sized_relobj_file.
4207         * object.h (class Object): Add local_is_tls and do_local_is_tls.
4208         (class Sized_relobj_file): Add do_local_is_tls.
4209         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
4210
4211 2012-09-11  Alan Modra  <amodra@gmail.com>
4212
4213         PR gold/14566
4214         * layout.cc (Layout::set_segment_offsets): When using
4215         common-page-size alignment, ensure we are on a new max-page-size
4216         page.
4217         * output.cc (Output_segment::set_section_addresses): Use
4218         abi_pagesize, not common_pagesize for relro boundary.
4219         (Output_segment::set_offset): Likewise.
4220
4221 2012-09-11  Alan Modra  <amodra@gmail.com>
4222
4223         * output.h (Output_data_got::add_global_tls, add_local_tls,
4224         add_local_tls_pair): New functions.
4225         (Output_data_got::add_local_pair_with_rel): Remove second
4226         reloc param.  Expand comment.
4227         (Output_data_got::Got_entry): Rename use_plt_offset_ to
4228         use_plt_or_tls_offset_, similarly for constructor param.
4229         (Output_data_got::Got_entry::write): Add got_index param.
4230         * output.cc (Output_data_got::add_global_tls, add_local_tls,
4231         add_local_tls_pair): New functions.
4232         (Output_data_got::Got_entry::write): Handle tls symbols
4233         with use_plt_or_tls_offset_ set specially.
4234         (Output_data_got::add_local_pair_with_rel): Only one reloc.
4235         (Output_data_got::do_write): Replace iterator with index, pass
4236         index to entry write function.
4237         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
4238         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
4239         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
4240         call.
4241         * i386.cc (Target_i386::Scan::local): Likewise.
4242         * sparc.cc (Target_sparc::Scan::local): Likewise.
4243         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
4244         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
4245         do_tls_offset_for_global): New functions.
4246         (Target_powerpc::Scan::local): Correct TLS relocations and got
4247         entry values.
4248         (Target_powerpc::Scan::global): Don't emit unnecessary
4249         dynamic relocations on TLS GOT entries.
4250
4251 2012-09-10  Matthias Klose  <doko@ubuntu.com>
4252
4253         * config.in: Disable sanity check for kfreebsd.
4254
4255 2012-09-10  Sterling Augustine  <saugustine@google.com>
4256
4257         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
4258         (Gdb_index::pubtypes_read): New parameter.
4259         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
4260         to calls.
4261         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
4262         pubtypes_object_.
4263
4264 2012-09-09  Alan Modra  <amodra@gmail.com>
4265
4266         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
4267         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
4268         * gc.h (gc_process_relocs): Call target gc_add_reference.
4269         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
4270         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
4271         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
4272         unnecessary cast.
4273         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
4274         to cater for when we don't need code offset.  Update use.
4275         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
4276         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
4277         set_opd_valid): New functions.
4278         (Target_powerpc::do_gc_add_reference): New function.
4279         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
4280         stashed refs.
4281         (Target_powerpc::do_gc_mark_symbol): New function.
4282
4283 2012-09-06  Cary Coutant  <ccoutant@google.com>
4284
4285         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
4286         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
4287         (Dwarf_die::skip_attributes): Likewise.
4288         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
4289         * testsuite/gdb_index_test.cc (inline_func_1): New function.
4290         (main): Call it.
4291         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
4292
4293 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
4294
4295         * testsuite/script_test_3.t: Add .got.plt output section
4296         statement.
4297         * testsuite/script_test_4.t: Likewise.
4298
4299 2012-09-05  Alan Modra  <amodra@gmail.com>
4300
4301         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
4302         update all uses and lose "enum" when using type.
4303
4304 2012-09-05  Alan Modra  <amodra@gmail.com>
4305
4306         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
4307         * configure: Regenerate.
4308         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
4309         (plugin_final_layout.stdout): Likewise.
4310         (memory_test): Set page sizes to 0x1000.
4311         * testsuite/Makefile.in: Regenerate.
4312         * testsuite/discard_locals_test.sh: Add FIXME comment.
4313         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
4314         * testsuite/pr14265.t: Add .got output section statement.
4315         * testsuite/script_test_2.t: Likewise.
4316         * testsuite/script_test_3.t: Likewise.
4317         * testsuite/script_test_4.t: Likewise.
4318         * testsuite/script_test_5.t: Likewise.
4319         * testsuite/script_test_6.t: Likewise.
4320         * testsuite/script_test_7.t: Likewise.
4321         * testsuite/script_test_9.t: Likewise.
4322
4323 2012-09-05  Alan Modra  <amodra@gmail.com>
4324
4325         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
4326         (Powerpc_relocate_functions::Status): New typedef.
4327         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4328         (Target_powerpc::Scan::local): Handle REL64.
4329         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
4330         for REL32 and REL64.
4331         (Target_powerpc::symval_for_branch): New function, extracted from..
4332         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
4333         checks.  Report overflow errors.
4334
4335 2012-09-05  Alan Modra  <amodra@gmail.com>
4336
4337         * object.h (Sized_relobj_file::emit_relocs): Delete.
4338         (Sized_relobj_file::emit_relocs_reltype): Delete.
4339         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
4340         relocate_relocs for --emit-relocs.
4341         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
4342         * output.h: Update comment.
4343         (Output_segment::first_section): New function.
4344         (Output_segment::first_section_load_address): Use first_section.
4345         * output.cc (Output_segment::first_section): New function extracted..
4346         (Output_segment::first_section_load_address): ..from here.  Delete.
4347         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
4348         * target.h (Sized_target::relocate_for_relocatable): Likewise.
4349         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
4350         adjust call to target.h function.
4351         * i386.cc (Target_i386): Likewise.
4352         * sparc.cc (Target_sparc): Likewise.
4353         * x86_64.cc (Target_x86_64): Likewise.
4354         * powerpc.cc (Target_powerpc): Likewise.
4355         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
4356         first tls section has section symbol for optimised local dynamic
4357         output relocs.
4358         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
4359         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
4360         optimised tls code.
4361         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
4362         Rename to relocate_relocs.  Update error message.
4363
4364 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
4365
4366         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
4367         --just-symbols.
4368
4369 2012-08-31  Alan Modra  <amodra@gmail.com>
4370
4371         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
4372         (Powerpc_relobj::toc_base_offset): New stub function.
4373         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
4374         got_mod_index_offset to tlsld_got_offset.  Update all refs.
4375         (Target_powerpc::Relocate::enum skip_tls): New.
4376         (Target_powerpc::call_tls_get_addr_): New var.
4377         (Target_powerpc::is_branch_reloc): Move to file scope.
4378         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
4379         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
4380         New functions.
4381         (Target_powerpc::enum Got_type): Delete old values, add new ones.
4382         (powerpc_info): Correct common_pagesize for ppc64.
4383         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
4384         (Powerpc_relocate_functions): Add overflow check enums and functions.
4385         Add non-shift version of rela, rela_ua.  Delete all rel public
4386         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
4387         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
4388         addr16_ha3, addr14 functions.
4389         (Output_data_got_powerpc::add_constant_pair): New function.
4390         (Output_data_got_powerpc::got_base_offset): Likewise.
4391         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
4392         (instruction constants): Sort, add some more.
4393         (Output_data_glink::do_write): Add and use Address typedef.  Use
4394         object->toc_base_offset() stub for 64-bit.
4395         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
4396         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4397         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
4398         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
4399         Always treat .opd relocs as against locally defined symbol.
4400         Correct condition for RELATIVE relocs.
4401         (Target_powerpc::do_finalize_sections): Test for NULL sections.
4402         (Target_powerpc::Relocate::relocate): Use plt call stub as value
4403         for 32-bit syms with a plt entry.  Correct ppc64 toc base
4404         calculations.  Handle TLS relocs, and more.  Add overflow
4405         checking and adjust for Powerpc_relocate_functions changes.
4406         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
4407         Reinstate --emit-relocs code with FIXME.
4408
4409 2012-08-30  Alan Modra  <amodra@gmail.com>
4410
4411         * layout.cc (Layout::set_segment_offsets): Set p_align to
4412         abi_pagesize, not common_pagesize.
4413         (Layout::relaxation_loop_body): Similarly use abi_pagesize
4414         to determine whether file header can go in segment.
4415
4416 2012-08-30  Alan Modra  <amodra@gmail.com>
4417
4418         * output.h (Output_reloc::Output_reloc <output section>): Add
4419         is_relative param.  Adjust calls.
4420         (Output_reloc::add_output_section_relative): New functions.
4421         * output.cc (Output_reloc::Output_reloc <output section>): Handle
4422         is_relative.
4423         (Output_reloc::symbol_value): Handle SECTION_CODE.
4424
4425 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
4426
4427         * gold.cc (queue_middle_tasks): Call layout again when unique
4428         segments for sections is desired.
4429         * layout.cc (Layout::Layout): Initialize new members.
4430         (Layout::get_output_section_flags): New function.
4431         (Layout::choose_output_section): Call get_output_section_flags.
4432         (Layout::layout): Make output section for mapping to a unique segment.
4433         (Layout::insert_section_segment_map): New function.
4434         (Layout::attach_allocated_section_to_segment): Make unique segment for
4435         output sections marked so.
4436         (Layout::segment_precedes): Check for unique segments when sorting.
4437         * layout.h (Layout::Unique_segment_info): New struct.
4438         (Layout::Section_segment_map): New typedef.
4439         (Layout::insert_section_segment_map): New function.
4440         (Layout::get_output_section_flags): New function.
4441         (Layout::is_unique_segment_for_sections_specified): New function.
4442         (Layout::set_unique_segment_for_sections_specified): New function.
4443         (Layout::unique_segment_for_sections_specified_): New member.
4444         (Layout::section_segment_map_): New member.
4445         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
4446         Rename is_gc_pass_one to is_pass_one.
4447         Rename is_gc_pass_two to is_pass_two.
4448         Rename is_gc_or_icf to is_two_pass.
4449         Check for which pass based on whether symbols data is present.
4450         Make it two pass when unique segments for sections is desired.
4451         * output.cc (Output_section::Output_section): Initialize new
4452         members.
4453         * output.h (Output_section::is_unique_segment): New function.
4454         (Output_section::set_is_unique_segment): New function.
4455         (Output_section::is_unique_segment_): New member.
4456         (Output_section::extra_segment_flags): New function.
4457         (Output_section::set_extra_segment_flags): New function.
4458         (Output_section::extra_segment_flags_): New member.
4459         (Output_section::segment_alignment): New function.
4460         (Output_section::set_segment_alignment): New function.
4461         (Output_section::segment_alignment_): New member.
4462         (Output_segment::Output_segment): Initialize is_unique_segment_.
4463         (Output_segment::is_unique_segment): New function.
4464         (Output_segment::set_is_unique_segment): New function.
4465         (Output_segment::is_unique_segment_): New member.
4466         * plugin.cc (allow_unique_segment_for_sections): New function.
4467         (unique_segment_for_sections): New function.
4468         (Plugin::load): Add new functions to transfer vector.
4469         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
4470         * Makefile.in: Regenerate.
4471         * testsuite/plugin_final_layout.sh: Check if unique segment
4472         functionality works.
4473         * testsuite/plugin_section_order.c (onload): Check if new interfaces
4474         are available.
4475         (allow_unique_segment_for_sections): New global.
4476         (unique_segment_for_sections): New global.
4477         (claim_file_hook): Call allow_unique_segment_for_sections.
4478         (all_symbols_read_hook): Call unique_segment_for_sections.
4479
4480 2012-08-22  Cary Coutant  <ccoutant@google.com>
4481
4482         * layout.cc (Layout::include_section): Don't assert on GROUP
4483         sections with --emit-relocs.
4484
4485 2012-08-21  Cary Coutant  <ccoutant@google.com>
4486
4487         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
4488         if --export-dynamic-symbol names an undef symbol.
4489
4490 2012-08-18  Alan Modra  <amodra@gmail.com>
4491
4492         * powerpc.cc: Formatting and white space.
4493         (Powerpc_relobj): Rename got2_section_ to special_.
4494         Add opd_ent_shndx_ and opd_ent_off_ vectors.
4495         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
4496         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
4497         (Target_powerpc): Add Address typedef and invalid_address.  Use
4498         throughout.
4499         (Target_powerpc::is_branch_reloc): New function.
4500         (Powerpc_relocate_functions): Add Address typedef, use throughout.
4501         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
4502         for dst_mask, value and addend.
4503         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
4504         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
4505         (Output_data_glink::do_write): Correct toc base.  Don't try to use
4506         uint16_t for 24-bit offset.  Use get_output_section_offset and
4507         check return.
4508         (Target_powerpc::Scan::local): Handle more relocs.
4509         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
4510         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
4511         Plug in toc restoring insn after plt calls.  Translate branches
4512         to function descriptor symbols to corresponding entry point.
4513         (Target_powerpc::relocate_for_relocatable): Check return from
4514         get_output_section_offset.
4515         * symtab.h: Comment typo.
4516
4517 2012-08-14  Ian Lance Taylor  <iant@google.com>
4518
4519         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
4520         unsupported_relocal_local to call unsupported_reloc_global.
4521
4522 2012-08-14  Nick Clifton  <nickc@redhat.com>
4523
4524         PR ld/14265
4525         * script-sections.cc (Sections_element::output_section_name): Add
4526         keep return parameter.
4527         (Output_section_element::match_name): Add keep return parameter.
4528         Return the value of the keep_ member.
4529         * script-sections.h (class Output_section): Update
4530         output_section_name prototype.
4531         * layout.cc (Layout::keep_input_section): New public member
4532         function.
4533         (Layout::choose_output_section): Pass keep parameter to
4534         output_section_name.
4535         * layout.h (class Layout): Add keep_input_section.
4536         * object.cc (Sized_relobj_file::do_layout): Check for kept input
4537         sections.
4538         * testsuite/Makefile.am: Add a test.
4539         * testsuite/Makefile.in: Regenerate.
4540         * testsuite/pr14265.c: Source file for the test.
4541         * testsuite/pr14265.t: Linker script for the test.
4542         * testsuite/pr14265.sh: Shell script for the test.
4543
4544 2012-08-14  Alan Modra  <amodra@gmail.com>
4545
4546         * target.h (Target::output_section_name): New function.
4547         (Target::do_output_section_name): New function.
4548         * layout.cc (Layout::choose_output_section): Call the above.
4549         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
4550
4551 2012-08-14  Alan Modra  <amodra@gmail.com>
4552
4553         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
4554         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
4555         for replace_constant call.
4556         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
4557         (Output_data_glink::do_print_to_mapfile): New function.
4558         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
4559         (Target_powerpc::Relocate::relocate): Likewise.
4560
4561 2012-08-14  Alan Modra  <amodra@gmail.com>
4562
4563         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
4564         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
4565         (Output_data_glink::add_entry,find_entry): Remove shndx param.
4566         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
4567         all references to shndx_.  Handle special case for R_PPC_PLTREL24
4568         here.
4569         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
4570         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
4571         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
4572         here.
4573         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
4574         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
4575
4576 2012-08-12  Alan Modra  <amodra@gmail.com>
4577
4578         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
4579         (glink insn constants): Use uint32_t.
4580         (Output_data_glink::add_entry): Use insert, not [] operator.
4581
4582 2012-08-11  Alan Modra  <amodra@gmail.com>
4583
4584         * object.h (Sized_relobj_file::find_shdr): New function.
4585         (Sized_relobj_file::find_special_sections): New function.
4586         * object.cc (Sized_relobj_file::find_shdr): New function.
4587         (Sized_relobj_file::find_eh_frame): Use find_shdr.
4588         (Sized_relobj_file::find_special_sections): New function, split out..
4589         (Sized_relobj_file::do_read_symbols): ..from here.
4590         * output.h (Output_data_got::replace_constant): New function.
4591         (Output_data_got::num_entries): New function.
4592         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
4593         (Output_data_got::got_offset): Protected rather than private.
4594         (Output_data_got::replace_got_entry): New function.
4595         * output.cc (Output_data_got::replace_got_entry): New function.
4596         * powerpc.cc (class Powerpc_relobj): New.
4597         (class Powerpc_relocate_functions): Delete all psymval variants or
4598         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
4599         Implement _ha functions using corresponding _hi function.
4600         (Powerpc_relobj::find_special_sections): New function.
4601         (Target_powerpc::do_make_elf_object): New function.
4602         (class Output_data_got_powerpc): New.
4603         (class Output_data_glink): New.
4604         (class Powerpc_scan_relocatable_reloc): New.
4605         Many more changes througout file.
4606
4607 2012-08-09  Nick Clifton  <nickc@redhat.com>
4608
4609         * po/vi.po: Updated Vietnamese translation.
4610
4611 2012-08-07  Ian Lance Taylor  <iant@google.com>
4612
4613         * layout.cc (Layout::add_target_dynamic_tags): If
4614         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
4615         plt_rel.
4616
4617 2012-07-30  Nick Clifton  <nickc@redhat.com>
4618
4619         * po/gold.pot: Updated template.
4620         * po/es.po: Updated Spanish translation.
4621
4622 2012-07-18  Cary Coutant  <ccoutant@google.com>
4623
4624         PR gold/14344
4625         * configure.ac: Add check for -gpubnames support.
4626         * configure: Regenerate.
4627         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
4628         support; force -gno-pubnames.
4629         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
4630         support.
4631         (gdb_index_test_4): New test.
4632         * testsuite/Makefile.in: Regenerate.
4633         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
4634         * testsuite/gdb_index_test_2.sh: Likewise.
4635         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
4636         * testsuite/gdb_index_test_4.sh: New script.
4637         * testsuite/gdb_index_test_comm.sh: New script with common code;
4638         don't look for space after colon.
4639
4640 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
4641
4642         * gold.cc (queue_middle_tasks): Update function order only after
4643         deferred objects due to plugins are processed.
4644
4645 2012-07-11  Ian Lance Taylor  <iant@google.com>
4646
4647         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
4648         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
4649         (Target_arm::scan_reloc_for_stub): Likewise.
4650         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
4651         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
4652         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
4653         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
4654         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
4655
4656 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
4657             Ian Lance Taylor  <iant@google.com>
4658
4659         PR gold/14309
4660         * configure.ac: Test whether std::tr1::hash<off_t> works.
4661         * gold.h: Add a specialization for std::tr1::hash<off_t> if
4662         needed.
4663         * output.h (class Output_fill): Add virtual destructor.
4664         * configure, config.in: Rebuild.
4665
4666 2012-06-22  Roland McGrath  <mcgrathr@google.com>
4667
4668         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
4669
4670 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
4671
4672         * plugin.cc (Plugin::load): Handle position independent executables.
4673
4674 2012-06-06  Cary Coutant  <ccoutant@google.com>
4675
4676         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
4677         add .debug_macro.
4678         (lines_only_debug_sections): Likewise.
4679         (gdb_fast_lookup_sections): New static array.
4680         (is_gdb_debug_section): Rename formal parameter.
4681         (is_lines_only_debug_section): Likewise.
4682         (is_gdb_fast_lookup_section): New function.
4683         (Layout::include_section): Check for ".zdebug_" prefix; pass
4684         section name suffix to is_gdb_debug_section, et al.; check for
4685         fast-lookup sections when building .gdb_index.
4686         * options.h (--strip-debug-gdb): Update GDB version number.
4687
4688 2012-06-06  Cary Coutant  <ccoutant@google.com>
4689
4690         * configure.ac: Add check for fallocate.
4691         * configure: Regenerate.
4692         * config.in: Regenerate.
4693
4694         * options.h (class General_options): Add --mmap-output-file and
4695         --posix-fallocate options.
4696         * output.cc: (posix_fallocate): Remove; replace with...
4697         (gold_fallocate): New function.
4698         (Output_file::map_no_anonymous): Call gold_fallocate.
4699         (Output_file::map): Check --mmap-output-file option.
4700
4701 2012-06-05  Jing Yu  <jingyu@google.com>
4702
4703         * gold.h (textdomain): Add do {} to empty while(0).
4704         (bindtextdomain): Likewise.
4705
4706 2012-06-04  Cary Coutant  <ccoutant@google.com>
4707
4708         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
4709         has_dynsym_index.
4710
4711 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
4712
4713         * symtab.cc (Symbol_table::define_special_symbol):
4714         Initialize *poldsym to prevent uninitialized variable errors.
4715
4716 2012-05-23  Cary Coutant  <ccoutant@google.com>
4717
4718         * layout.cc (Layout::section_name_mapping): Add rules to handle
4719         exact match on .data.rel.ro.local or .data.rel.ro.
4720         (Layout::output_section_name): Check for exact matches.
4721
4722 2012-05-23  Cary Coutant  <ccoutant@google.com>
4723
4724         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
4725         more carefully.
4726
4727 2012-05-22  Cary Coutant  <ccoutant@google.com>
4728
4729         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
4730         object before exporting symbol.
4731
4732 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
4733
4734         * testsuite/tls_test.cc: Include "config.h" first.
4735         * testsuite/tls_test_c.c: Likewise.
4736
4737 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
4738             Nick Clifton  <nickc@redhat.com>
4739
4740         PR 14072
4741         * configure.in: Add check that sysdep.h has been included before
4742         any system header files.
4743         * configure: Regenerate.
4744         * config.in: Regenerate.
4745
4746 2012-05-14  Cary Coutant  <ccoutant@google.com>
4747
4748         * layout.cc (Layout::make_output_section): Mark .tdata section
4749         as RELRO.
4750         * testsuite/relro_test.cc: Add a TLS variable.
4751
4752 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
4753
4754         PR gold/14091
4755         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
4756         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
4757         R_X86_64_64.
4758
4759 2012-05-08  Cary Coutant  <ccoutant@google.com>
4760
4761         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
4762         (lines_only_debug_sections): Likewise.
4763
4764 2012-05-02  Roland McGrath  <mcgrathr@google.com>
4765
4766         * nacl.cc: New file.
4767         * nacl.h: New file.
4768         * Makefile.am (CCFILES, HFILES): Add them.
4769         * Makefile.in: Regenerate.
4770         * i386.cc (Output_data_plt_i386_nacl): New class.
4771         (Output_data_plt_i386_nacl_exec): New class.
4772         (Output_data_plt_i386_nacl_dyn): New class.
4773         (Target_i386_nacl): New class.
4774         (Target_selector_i386_nacl): New class.
4775         (target_selector_i386): Use it instead of Target_selector_i386.
4776         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
4777         (Target_x86_64_nacl): New class.
4778         (Target_selector_x86_64_nacl): New class.
4779         (target_selector_x86_64, target_selector_x32): Use it instead of
4780         Target_selector_x86_64.
4781         * arm.cc (Output_data_plt_arm_nacl): New class.
4782         (Target_arm_nacl): New class.
4783         (Target_selector_arm_nacl): New class.
4784         (target_selector_arm, target_selector_armbe): Use it instead of
4785         Target_selector_arm.
4786
4787         * target-select.cc (select_target): Take new Input_file* and off_t
4788         arguments, pass them on to recognize method of selector.
4789         * object.cc (make_elf_sized_object): Update caller.
4790         * parameters.cc (parameters_force_valid_target): Likewise.
4791         * incremental.cc (make_sized_incremental_binary): Likewise.
4792         * target-select.h: Update decl.
4793         (Target_selector::recognize): Take new Input_file* argument,
4794         pass it on to do_recognize.
4795         (Target_selector::do_recognize): Take new Input_file* argument.
4796         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
4797         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
4798         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
4799         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
4800
4801         * target.h (Target::Target_info): New members isolate_execinstr
4802         and rosegment_gap.
4803         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
4804         * arm.cc (Target_arm::arm_info): Update initializer.
4805         * i386.cc (Target_i386::i386_info): Likewise.
4806         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
4807         * sparc.cc (Target_sparc::sparc_info): Likewise.
4808         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4809         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
4810         * layout.cc (Layout::attach_allocated_section_to_segment):
4811         Take new const Target* argument.  If target->isolate_execinstr(), act
4812         like --rosegment.
4813         (Layout::find_first_load_seg): Take new const Target* argument;
4814         if target->isolate_execinstr(), reject PF_X segments.
4815         (Layout::relaxation_loop_body): Update caller.
4816         (Layout::set_segment_offsets): If target->isolate_execinstr(),
4817         reset file offset to zero when we hit LOAD_SEG, and then do a second
4818         loop over the segments before LOAD_SEG to reassign offsets after
4819         addresses have been determined.  Handle target->rosegment_gap().
4820         (Layout::attach_section_to_segment): Take new const Target* argument;
4821         pass it to attach_allocated_section_to_segment.
4822         (Layout::make_output_section): Update caller.
4823         (Layout::attach_sections_to_segments): Take new const Target* argument;
4824         pass it to attach_section_to_segment.
4825         * gold.cc (queue_middle_tasks): Update caller.
4826         * layout.h (Layout): Update method decls with new arguments.
4827
4828         * arm.cc (Target_arm::Target_arm): Take optional argument for the
4829         Target_info pointer to use.
4830         (Target_arm::do_make_data_plt): New virtual method.
4831         (Target_arm::make_data_plt): New method that calls it.
4832         (Target_arm::make_plt_entry): Use it.
4833         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
4834         for the section alignment.
4835         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
4836         method.
4837         (Output_data_plt_arm::first_plt_entry_offset): Call it.
4838         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
4839         method.
4840         (Output_data_plt_arm::get_plt_entry_size): Call it.
4841         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
4842         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
4843         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
4844         method.
4845         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
4846         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
4847         method instead of sizeof(plt_entry).
4848         (Output_data_plt_arm::add_entry): Likewise.
4849         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
4850         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
4851         than static method.
4852         (Target_arm::plt_entry_size): Likewise.
4853         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
4854         Move to ...
4855         (Output_data_plt_arm_standard): ... here, new class.
4856         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
4857         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
4858         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
4859
4860         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4861         Take additional argument for the PLT entry size.
4862         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
4863         Use get_plt_entry_size method rather than plt_entry_size variable.
4864         (Output_data_plt_x86_64::reserve_slot): Likewise.
4865         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
4866         (Output_data_plt_x86_64::add_entry): Likewise.
4867         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
4868         (Output_data_plt_x86_64::address_for_global): Likewise.
4869         (Output_data_plt_x86_64::address_for_local): Likewise.
4870         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4871         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
4872         Make method non-static.
4873         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
4874         method.
4875         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
4876         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
4877         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
4878         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
4879         virtual method.
4880         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
4881         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
4882         virtual method.
4883         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
4884         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
4885         virtual method.
4886         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
4887         (Output_data_plt_x86_64::plt_entry_size)
4888         (Output_data_plt_x86_64::first_plt_entry)
4889         (Output_data_plt_x86_64::plt_entry)
4890         (Output_data_plt_x86_64::tlsdesc_plt_entry)
4891         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
4892         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
4893         (Output_data_plt_x86_64_standard): ... here, new class.
4894         (Target_x86_64::Target_x86_64): Take optional argument for the
4895         Target_info pointer to use.
4896         (Target_x86_64::do_make_data_plt): New virtual method.
4897         (Target_x86_64::make_data_plt): New method to call it.
4898         (Target_x86_64::init_got_plt_for_update): Use that.
4899         Call this->plt_->add_eh_frame method here.
4900         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
4901         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
4902         rather than static method.
4903         (Target_x86_64::plt_entry_size): Likewise.
4904         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
4905         rather than plt_entry_size variable.  Move guts of PLT filling to...
4906         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
4907         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
4908         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
4909
4910         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
4911         additional argument for the section alignment.
4912         Don't do add_eh_frame_for_plt here.
4913         (Output_data_plt_i386::first_plt_entry_offset): Make the method
4914         non-static.  Use get_plt_entry_size method rather than plt_entry_size
4915         variable.
4916         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
4917         method.
4918         (Output_data_plt_i386::get_plt_entry_size): Call it.
4919         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
4920         (Output_data_plt_i386::add_eh_frame): New method to call it.
4921         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
4922         method.
4923         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
4924         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
4925         method.
4926         (Output_data_plt_i386::fill_plt_entry): New method to call it.
4927         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
4928         method instead of plt_entry_size.
4929         (Output_data_plt_i386::plt_entry_size)
4930         (Output_data_plt_i386::plt_eh_frame_fde_size)
4931         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
4932         (Output_data_plt_i386_standard): ... here, new class.
4933         (Output_data_plt_i386_exec): New class.
4934         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
4935         (Output_data_plt_i386_exec::first_plt_entry): ... here.
4936         (Output_data_plt_i386::exec_plt_entry): Move to ...
4937         (Output_data_plt_i386_exec::plt_entry): ... here.
4938         (Output_data_plt_i386_dyn): New class.
4939         (Output_data_plt_i386::first_plt_entry): Move to ...
4940         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
4941         (Output_data_plt_i386::dyn_plt_entry): Move to ...
4942         (Output_data_plt_i386_dyn::plt_entry): ... here.
4943         (Target_i386::Target_i386): Take optional argument for the Target_info
4944         pointer to use.
4945         (Target_i386::do_make_data_plt): New virtual method.
4946         (Target_i386::make_data_plt): New method to call it.
4947         (Target_i386::make_plt_section): Use that.
4948         Call this->plt_->add_eh_frame method here.
4949         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
4950         rather than plt_entry_size variable.
4951         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
4952         (Output_data_plt_i386::address_for_local): Likewise.
4953         (Output_data_plt_i386::do_write): Likewise.
4954         Move guts of PLT filling to...
4955         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
4956         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
4957         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
4958         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
4959
4960 2012-05-01  Cary Coutant  <ccoutant@google.com>
4961
4962         * dwarf_reader.cc (Dwarf_die::read_attributes)
4963         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
4964         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
4965         * reduced_debug_output.cc
4966         (Output_reduced_debug_info_section::get_die_end): Remove
4967         DW_FORM_GNU_ref_index.  Add default case.
4968
4969 2012-04-26  Mark Wielaard  <mjw@redhat.com>
4970
4971         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
4972         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
4973         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
4974         DW_AT_high_pc as offset from DW_AT_low_pc.
4975
4976         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
4977         * testsuite/Makefile.in: Regenerate.
4978         * testsuite/gdb_index_test_3.c: New test source file.
4979         * testsuite/gdb_index_test_3.sh: New test source file.
4980
4981 2012-04-25  Ian Lance Taylor  <iant@google.com>
4982
4983         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
4984         pointer.
4985         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
4986         as a class, not a struct.
4987         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
4988         (Target_arm::apply_cortex_a8_workaround): Likewise.
4989         * gc.h: Declare Reloc_types as a struct, not a class.
4990         * object.h: Declare Symbols_data as a struct.
4991         * reloc.h: Declare Read_relocs_data as a struct.
4992         * target.h: Declare Relocate_info as a struct.
4993
4994 2012-04-24  David S. Miller  <davem@davemloft.net>
4995
4996         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
4997         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
4998         and R_SPARC_WPLT30.
4999
5000 2012-04-24  Cary Coutant  <ccoutant@google.com>
5001
5002         * incremental-dump.cc (find_input_containing_global): Replace
5003         magic number with symbolic constant.
5004         (dump_incremental_inputs): Update version number.
5005         * incremental.cc (Output_section_incremental_inputs): Update version
5006         number; import symbolic constants from Incremental_inputs_reader.
5007         (Incremental_inputs::create_data_sections): Align relocations
5008         section correctly for 64-bit targets.
5009         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
5010         constants; add padding.
5011         (Output_section_incremental_inputs::write_header): Add assert for
5012         header_size.
5013         (Output_section_incremental_inputs::write_input_files): Add assert
5014         for input_entry_size.
5015         (Output_section_incremental_inputs::write_info_blocks): Add padding;
5016         add assert for object_info_size, input_section_entry_size,
5017         global_sym_entry_size.
5018         * incremental.h (Incremental_inputs_reader): Add symbolic constants
5019         for data structure sizes; use them.
5020         (Incremental_input_entry_reader): Import symbolic constants from
5021         Incremental_inputs_reader; use them.
5022
5023 2012-04-23  David S. Miller  <davem@davemloft.net>
5024
5025         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
5026         and elf_flags_set_.
5027         (Target_sparc::Target_sparc): Initialize new fields.
5028         (Target_sparc::do_make_elf_object): New function.
5029         (Target_sparc::do_adjust_elf_header): New function.
5030
5031 2012-04-23  Cary Coutant  <ccoutant@google.com>
5032
5033         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
5034         CU range table of gdb index.
5035
5036 2012-04-20  David S. Miller  <davem@davemloft.net>
5037
5038         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
5039         instead of false.
5040
5041 2012-04-16  David S. Miller  <davem@davemloft.net>
5042
5043         * sparc.cc (Target_sparc::got_address): New function.
5044         (Sparc_relocate_functions::gdop_hix22): New function.
5045         (Sparc_relocate_functions::gdop_lox10): New function.
5046         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
5047         relocs.
5048         (Target_sparc::Scan::local): Likewise if the global symbol is not
5049         preemptible and is not IFUNC.
5050         (Target_sparc::Relocate::relocate): Perform GOTDATA code
5051         transformations for local and non-preemptible non-IFUNC global
5052         symbols.
5053
5054         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
5055         writing out 64-bit part of ranges.
5056
5057         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
5058         -fpic and -fpie respectively.
5059         * Makefile.in: Regenerate.
5060
5061         * sparc.cc (class Target_sparc): Add rela_ifunc_.
5062         (Target_sparc::Target_sparc): Initialize new field.
5063         (Target_sparc::do_plt_section_for_global): New function.
5064         (Target_sparc::do_plt_section_for_local): New function.
5065         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
5066         (Target_sparc::make_plt_section): New function, broken out of
5067         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
5068         (Target_sparc::make_plt_entry): Call make_plt_section.
5069         (Target_sparc::make_local_ifunc_plt_entry): New function.
5070         (Target_sparc::rela_ifunc_section): New function.
5071         (Target_sparc::plt_section): Remove const.
5072         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
5073         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
5074         and ifunc_count_ fields.
5075         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
5076         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
5077         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
5078         (Output_data_plt_sparc::rela_ifunc): New function.
5079         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
5080         (Output_data_plt_sparc::has_ifunc_section): New function.
5081         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
5082         (Output_data_plt_sparc::address_for_global): New function.
5083         (Output_data_plt_sparc::address_for_local): New function.
5084         (Output_data_plt_sparc::plt_index_to_offset): New function.
5085         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
5086         and entry_count.
5087         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
5088         entry_count.
5089         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
5090         R_SPARC_JMP_IREL to switch.
5091         (Target_sparc::Scan::check_non_pic): Likewise.
5092         (Target_sparc::Scan::local): Handle IFUNC symbols.
5093         (Target_sparc::Scan::local): Likewise.
5094         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
5095         and plt_address_for_local.
5096         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
5097         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
5098
5099         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
5100         (class Output_data_reloc): Adjust calls to Output_reloc_type.
5101         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
5102         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
5103         global relocs too.
5104         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
5105         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
5106         calls.
5107         * sparc.cc (Target_sparc::Scan::global): Likewise.
5108         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5109
5110 2012-04-16  Cary Coutant  <ccoutant@google.com>
5111
5112         * archive.cc (Library_base::should_include_member): Check for
5113         --export-dynamic-symbol.
5114         * options.h (class General_options): Add --export-dynamic-symbol.
5115         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
5116         --export-dynamic-symbol.
5117         (Symbol_table::gc_mark_undef_symbols): Likewise.
5118         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
5119
5120 2012-04-12  David S. Miller  <davem@davemloft.net>
5121
5122         * sparc.cc (Reloc::wdisp10): New relocation method.
5123         (Reloc::h34): Likewise.
5124         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
5125         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
5126         R_SPARC_WDISP10.
5127         (Target_sparc::Scan::local): Likewise.
5128         (Target_sparc::Scan::global): Likewise.
5129         (Target_sparc::Relocate::relocate): Likewise.
5130
5131 2012-04-09  Cary Coutant  <ccoutant@google.com>
5132
5133         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
5134         low_pc == 0.
5135
5136 2012-04-06  Ian Lance Taylor  <iant@google.com>
5137
5138         * timer.cc: #include <unistd.h>.
5139
5140 2012-04-06  Roland McGrath  <mcgrathr@google.com>
5141
5142         * configure.in (AC_CHECK_HEADERS): Add locale.h.
5143         * config.in: Regenerate.
5144         * configure: Regenerate.
5145
5146 2012-04-05  Nick Clifton  <nickc@redhat.com>
5147
5148         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
5149         (AM_LC_MESSAGES): Add.
5150         * aclocal.m4: Regenerate.
5151         * config.in: Regenerate.
5152         * configure: Regenerate.
5153
5154 2012-03-21  Cary Coutant  <ccoutant@google.com>
5155
5156         * Makefile.am: Add gdb-index.cc, gdb-index.h.
5157         * Makefile.in: Regenerate.
5158         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
5159         (Sized_elf_reloc_mapper::symbol_section): New function.
5160         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
5161         (make_elf_reloc_mapper): New function.
5162         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
5163         (Dwarf_abbrev_table::do_read_abbrevs): New function.
5164         (Dwarf_abbrev_table::do_get_abbrev): New function.
5165         (Dwarf_ranges_table::read_ranges_table): New function.
5166         (Dwarf_ranges_table::read_range_list): New function.
5167         (Dwarf_pubnames_table::read_section): New function.
5168         (Dwarf_pubnames_table::read_header): New function.
5169         (Dwarf_pubnames_table::next_name): New function.
5170         (Dwarf_die::Dwarf_die): New function.
5171         (Dwarf_die::read_attributes): New function.
5172         (Dwarf_die::skip_attributes): New function.
5173         (Dwarf_die::set_name): New function.
5174         (Dwarf_die::set_linkage_name): New function.
5175         (Dwarf_die::attribute): New function.
5176         (Dwarf_die::string_attribute): New function.
5177         (Dwarf_die::int_attribute): New function.
5178         (Dwarf_die::uint_attribute): New function.
5179         (Dwarf_die::ref_attribute): New function.
5180         (Dwarf_die::child_offset): New function.
5181         (Dwarf_die::sibling_offset): New function.
5182         (Dwarf_info_reader::check_buffer): New function.
5183         (Dwarf_info_reader::parse): New function.
5184         (Dwarf_info_reader::do_parse): New function.
5185         (Dwarf_info_reader::do_read_string_table): New function.
5186         (Dwarf_info_reader::lookup_reloc): New function.
5187         (Dwarf_info_reader::get_string): New function.
5188         (Dwarf_info_reader::visit_compilation_unit): New function.
5189         (Dwarf_info_reader::visit_type_unit): New function.
5190         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
5191         Sized_elf_reloc_mapper.
5192         (Sized_dwarf_line_info::symbol_section): Remove function.
5193         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
5194         (Sized_dwarf_line_info::read_line_mappings): Remove object
5195         parameter, adjust callers.
5196         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
5197         * dwarf_reader.h: Include <sys/types.h>.
5198         (class Track_relocs): Remove forward declaration.
5199         (class Elf_reloc_mapper): New class.
5200         (class Sized_elf_reloc_mapper): New class.
5201         (class Dwarf_abbrev_table): New class.
5202         (class Dwarf_range_list): New class.
5203         (class Dwarf_ranges_table): New class.
5204         (class Dwarf_pubnames_table): New class.
5205         (class Dwarf_die): New class.
5206         (class Dwarf_info_reader): New class.
5207         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
5208         (Sized_dwarf_line_info::symbol_section): Remove member function.
5209         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
5210         base class.
5211         * gdb-index.cc: New source file.
5212         * gdb-index.h: New source file.
5213         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
5214         and .debug_types sections, call Layout::add_to_gdb_index.
5215         (Sized_relobj_incr::do_section_name): Implement.
5216         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
5217         return type; Implement.
5218         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
5219         return type.
5220         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
5221         parameter list and return type.
5222         (Sized_incr_dynobj::do_section_contents): Likewise.
5223         * layout.cc: Include gdb-index.h.
5224         (Layout::Layout): Initialize gdb_index_data_.
5225         (Layout::init_fixed_output_section): Check for .gdb_index section.
5226         (Layout::add_to_gdb_index): New function. Instantiate.
5227         * layout.h: Add forward declaration for class Gdb_index.
5228         (Layout::add_to_gdb_index): New member function.
5229         (Layout::gdb_index_data_): New data member.
5230         * main.cc: Include gdb-index.h.
5231         (main): Print statistics for gdb index.
5232         * object.cc (Object::section_contents): Move code into
5233         do_section_contents.
5234         (need_decompressed_section): Check for sections needed when building
5235         gdb index.
5236         (build_compressed_section_map): Likewise.
5237         (Sized_relobj_file::do_read_symbols): Need local symbols when building
5238         gdb index.
5239         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
5240         sections; call Layout::add_to_gdb_index.
5241         (Sized_relobj_file::do_decompressed_section_contents): Call
5242         do_section_contents directly.
5243         * object.h (Object::do_section_contents): Adjust parameter list and
5244         return type.
5245         (Object::do_decompressed_section_contents): Call do_section_contents
5246         directly.
5247         (Sized_relobj_file::do_section_contents): Adjust parameter list and
5248         return type.
5249         * options.h (class General_options): Add --gdb-index option.
5250         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
5251         list and return type.
5252         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
5253         * reloc.h (Track_relocs::checkpoint): New function.
5254         (Track_relocs::reset): New function.
5255
5256         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
5257         New test cases.
5258         * testsuite/Makefile.in: Regenerate.
5259         * testsuite/gdb_index_test.cc: New test source file.
5260         * testsuite/gdb_index_test_1.sh: New test source file.
5261         * testsuite/gdb_index_test_2.sh: New test source file.
5262
5263 2012-03-19  Doug Kwan  <dougkwan@google.com>
5264
5265         * arm.cc (Target_arm::do_define_standard_symbols): New method.
5266         (Target_arm::do_finalize_sections): Remove code which defines
5267         __exidx_start and __exidx_end.  Make symbol table parameter
5268         anonymous as it is not used.
5269         * gold.cc (queue_middle_tasks): Call target hook to define any
5270         target-specific symbols.
5271         * target.h (Target::define_standard_symbols): New method.
5272         (Target::do_define_standard_symbols): Same.
5273         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
5274         * testsuite/Makefile.in: Regenerate.
5275         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
5276         and __exidx_end.
5277         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
5278         relocations are generated for __exidx_start and __exidx_end.
5279
5280 2012-03-16  Doug Kwan  <dougkwan@google.com>
5281
5282         * testsuite/Makefile.am: Disable test initpri3b.
5283         * testsuite/Makefile.in: Regenerate.
5284
5285 2012-03-15  Doug Kwan  <dougkwan@google.com>
5286
5287         * arm.cc (Target_arm::got_section): Make .got section read-only
5288         if -z now is given.
5289
5290 2012-03-15  Ian Lance Taylor  <iant@google.com>
5291
5292         PR gold/13850
5293         * layout.cc (Layout::make_output_section): Correctly mark
5294         SHT_INIT_ARRAY, et. al., as relro.
5295
5296 2012-03-14  Doug Kwan  <dougkwan@google.com>
5297
5298         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
5299         dynamic relocations for protected symbols in shared objects.
5300
5301 2012-03-13  Ian Lance Taylor  <iant@google.com>
5302
5303         * resolve.cc (Symbol_table::resolve): When merging common symbols,
5304         keep the larger alignment.
5305
5306 2012-03-12  Cary Coutant  <ccoutant@google.com>
5307
5308         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
5309         handling of DW_LNE_define_file.
5310
5311 2012-03-12  Cary Coutant  <ccoutant@google.com>
5312
5313         * reduced_debug_output.cc
5314         (Output_reduced_debug_info_section::get_die_end): Add new FORM
5315         codes to switch.
5316
5317 2012-02-29  Cary Coutant  <ccoutant@google.com>
5318
5319         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
5320
5321 2012-02-29  Cary Coutant  <ccoutant@google.com>
5322
5323         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5324         Call Object::decompressed_section_contents.
5325         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
5326         New dtor.
5327         (Sized_dwarf_line_info::buffer_start_): New data member.
5328         * merge.cc (Output_merge_data::do_add_input_section): Call
5329         Object::decompressed_section_contents.
5330         (Output_merge_string::do_add_input_section): Likewise.
5331         * object.cc (need_decompressed_section): New function.
5332         (build_compressed_section_map): Decompress sections needed later.
5333         (Sized_relobj_file::do_decompressed_section_contents): New function.
5334         (Sized_relobj_file::do_discard_decompressed_sections): New function.
5335         * object.h (Object::decompressed_section_contents): New function.
5336         (Object::discard_decompressed_sections): New function.
5337         (Object::do_decompressed_section_contents): New function.
5338         (Object::do_discard_decompressed_sections): New function.
5339         (Compressed_section_info): New type.
5340         (Compressed_section_map): Include decompressed section contents.
5341         (Sized_relobj_file::do_decompressed_section_contents): New function.
5342         (Sized_relobj_file::do_discard_decompressed_sections): New function.
5343
5344 2012-02-16  Cary Coutant  <ccoutant@google.com>
5345
5346         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
5347         * testsuite/Makefile.in: Regenerate.
5348
5349 2012-02-14  Cary Coutant  <ccoutant@google.com>
5350
5351         * options.cc (General_options::finalize): Disallow -pie and -static.
5352
5353 2012-02-03  Doug Kwan  <dougkwan@google.com>
5354
5355         * arm.cc (Arm_relocate_functions::abs8,
5356         Arm_relocate_functions::abs16): Use
5357         Bits::has_signed_unsigned_overflow32.
5358         (Arm_relocate_functions::thm_abs8): Correct range of
5359         overflow check.
5360         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
5361         in assertions.
5362
5363 2012-02-02  Doug Kwan  <dougkwan@google.com>
5364
5365         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
5366         position independent outputs, not just shared objects.
5367
5368 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
5369
5370         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
5371         * configure: Regenerated.
5372
5373 2012-01-27  Ian Lance Taylor  <iant@google.com>
5374
5375         * reloc.h (Bits): New class with static functions, copied from
5376         namespace utils in arm.cc.
5377         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
5378         instead.
5379
5380 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5381
5382         * incremental.cc (write_info_blocks): Correct relocation offset.
5383
5384 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5385
5386         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
5387         (Relocate::tls_gd_to_le): Likewise.
5388
5389 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5390
5391         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
5392
5393 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5394
5395         * configure.ac: Check if -mcmodel=medium works.
5396         * configure: Regenerated.
5397
5398 2012-01-24  Cary Coutant  <ccoutant@google.com>
5399
5400         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
5401         definition and ...
5402         (read_unsigned_LEB_128_x): ... this new function.
5403         (read_signed_LEB_128): Replaced with inline definition and ...
5404         (read_signed_LEB_128_x): ... this new function.
5405         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
5406         (read_unsigned_LEB_128): Add inline definition.
5407         (read_signed_LEB_128_x): New function.
5408         (read_signed_LEB_128): Add inline definition.
5409         * testsuite/Makefile.am (leb128_unittest): New unit test.
5410         * testsuite/Makefile.in: Regenerate.
5411         * testsuite/leb128_unittest.cc: New unit test.
5412
5413 2012-01-23  Ian Lance Taylor  <iant@google.com>
5414
5415         PR gold/13617
5416         * i386.cc (Target_i386::do_code_fill): When using a jmp
5417         instruction, pad with nop instructions.
5418         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5419
5420 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
5421
5422         * x86_64.cc (gc_process_relocs): Add typename on types used in
5423         template.
5424         (scan_relocs): Likewise.
5425         (relocate_section): Likewise.
5426         (apply_relocation): Likewise.
5427
5428 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
5429
5430         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
5431         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
5432         under x32.
5433
5434 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
5435
5436         * x86_64.cc: Initial support for x32.
5437
5438 2012-01-03  Cary Coutant  <ccoutant@google.com>
5439
5440         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
5441         Use abstract base class for GOT.
5442         * gold/output.h (class Output_data_got_base): New abstract base class.
5443         (class Output_data_got): Derive from new base class, adjust ctors.
5444         (Output_data_got::reserve_slot): Make virtual; rename to
5445         do_reserve_slot; Adjust callers.
5446         * gold/target.h (Sized_target::init_got_plt_for_update): Return
5447         pointer to abstract base class.
5448         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
5449
5450 2011-12-18  Ian Lance Taylor  <iant@google.com>
5451
5452         * object.h (Relobj::local_symbol_value): New function.
5453         (Relobj::local_plt_offset): New function.
5454         (Relobj::local_has_got_offset): New function.
5455         (Relobj::local_got_offset): New function.
5456         (Relobj::set_local_got_offset): New function.
5457         (Relobj::do_local_symbol_value): New pure virtual function.
5458         (Relobj::do_local_plt_offset): Likewise.
5459         (Relobj::do_local_has_got_offset): Likewise.
5460         (Relobj::do_local_got_offset): Likewise.
5461         (Relobj::do_set_local_got_offset): Likewise.
5462         (Sized_relobj::do_local_has_got_offset): Rename from
5463         local_has_got_offset.
5464         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
5465         (Sized_relobj::do_set_local_got_offset): Rename from
5466         set_local_got_offset.
5467         (Sized_relobj_file::do_local_plt_offset): Rename from
5468         local_plt_offset.
5469         (Sized_relobj_file::do_local_symbol_value): New function.
5470         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
5471         local_plt_offset.
5472         * output.cc (Output_data_got::Got_entry::write): Change object to
5473         Relobj.  Use local_symbol_value.
5474         (Output_data_got::add_global_with_rel): Change rel_dyn to
5475         Output_data_reloc_generic*.  Use add_global_generic.
5476         (Output_data_got::add_global_with_rela): Remove.  Change all
5477         callers to use add_global_with_rel.
5478         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
5479         Output_data_reloc_generic*.  Use add_global_generic.
5480         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
5481         callers to use add_global_pair_with_rel.
5482         (Output_data_got::add_local): Change object to Relobj*.
5483         (Output_data_got::add_local_plt): Likewise.
5484         (Output_data_got::add_local_with_rel): Change object to Relobj*,
5485         change rel_dyn to Output_data_reloc_generic*.  Use
5486         add_local_generic.
5487         (Output_data_got::add_local_with_rela): Remove.  Change all
5488         callers to use all_local_with_rel.
5489         (Output_data_got::add_local_pair_with_rel): Change object to
5490         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
5491         add_output_section_generic.
5492         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
5493         callers to use add_local_pair_with_rel.
5494         (Output_data_got::reserve_local): Change object to Relobj*.
5495         * output.h: (class Output_data_reloc_generic): Add pure virtual
5496         declarations for add_global_generic, add_local_generic,
5497         add_output_section_generic.
5498         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
5499         functions for Output_data_reloc_generic.  Update declarations for
5500         changes listed in output.cc.
5501         (class Output_data_got): Change template parameter to got_size.
5502         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
5503         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
5504         function.
5505         (Sized_relobj_incr::do_local_plt_offset): New function.
5506         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
5507         add_global_generic.
5508
5509 2011-12-17  Cary Coutant  <ccoutant@google.com>
5510
5511         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
5512         * resolve.cc (Symbol_table::resolve): Likewise.
5513         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
5514         arrays.
5515         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5516
5517 2011-12-16  Ian Lance Taylor  <iant@google.com>
5518
5519         * output.h (Output_data_reloc_generic::add): Only call
5520         add_dynamic_reloc if this is a dynamic reloc section.
5521
5522 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
5523
5524         PR gold/13505
5525         * target-reloc.h (apply_relocation): Replace <64, false> with
5526         <size, big_endian>.
5527
5528 2011-11-25  Nick Clifton  <nickc@redhat.com>
5529
5530         * po/it.po: New Italian translation.
5531
5532 2011-11-17  Sterling Augustine  <saugustine@google.com>
5533
5534         * script.cc (script_include_directive): Implement.
5535         (read_script_file): New local variables name and search_path. Update
5536         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
5537         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
5538         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
5539
5540 2011-11-11  Sterling Augustine  <saugustine@google.com>
5541
5542         * yyscript.y (section_cmd): Add support for INCLUDE directive.
5543         (file_or_sections_cmd): Likewise.
5544
5545 2011-11-11  Doug Kwan  <dougkwan@google.com>
5546
5547         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
5548         if --just-symbols is given.
5549
5550 2011-11-10  Doug Kwan  <dougkwan@google.com>
5551
5552         PR gold/13362
5553         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
5554         when processing data relocs.
5555         * reloc.h (Relocate_functions::rel_unaligned): New method.
5556         (Relocate_functions::pcrel_unaligned): Ditto.
5557         (Relocate_functions::rel32_unaligned): Ditto.
5558         (Relocate_functions::pcrel32_unaligned): Ditto.
5559
5560 2011-11-09  Doug Kwan  <dougkwan@google.com>
5561
5562         PR gold/13362
5563         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
5564         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
5565         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
5566         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5567         (Relocate_functions::rel_unaligned): New.
5568         (Relocate_functions::rel32_unaligned): New.
5569         * target-reloc.h (relocate_for_relocatable): Add code to handle
5570         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5571         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
5572         arm_unaligned_reloc_r): New targets.
5573         * testsuite/Makefile.in: Regenerate.
5574         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
5575         linking.
5576
5577 2011-11-02  Ian Lance Taylor  <iant@google.com>
5578
5579         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
5580         NATIVE_LINKER.
5581         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
5582         * options.cc (General_options::finalize): Use library search path
5583         from configure script if specified.  If not native and no sysroot,
5584         only search TOOLLIBDIR.
5585         * options.h (Search_directory::Search_directory): Change name to
5586         const std::string&.
5587         (General_options::add_to_library_path_with_sysroot): Change arg to
5588         const std::string&.
5589         * configure, Makefile.in, config.in: Rebuild.
5590
5591 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5592
5593         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
5594         we are working around the ARM1176 Erratum.
5595         * options.h (General_options::fix_arm1176): Add option.
5596         * testsuite/Makefile.am: Add testcases, and keep current ones
5597         working.
5598         * testsuite/Makefile.in: Regenerate.
5599         * testsuite/arm_fix_1176.s: New file.
5600         * testsuite/arm_fix_1176.sh: Likewise.
5601
5602 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5603
5604         * arm.cc (Target_arm::Target_arm): Remove initialisation of
5605         may_use_blx_.
5606         (Target_arm::may_use_blx): Remove method.
5607         (Target_arm::set_may_use_blx): Likewise.
5608         (Target_arm::may_use_v4t_interworking): New method.
5609         (Target_arm::may_use_v5t_interworking): Likewise.
5610         (Target_arm::may_use_blx_): Remove member variable.
5611         (Arm_relocate_functions::arm_branch_common): Check for v5T
5612         interworking.
5613         (Arm_relocate_functions::thumb_branch_common): Likewise.
5614         (Reloc_stub::stub_type_for_reloc): Likewise.
5615         (Target_arm::do_finalize_sections): Correct interworking checks.
5616         * testsuite/Makefile.am: Add new tests.
5617         * testsuite/Makefile.in: Regenerate.
5618         * testsuite/arm_farcall_arm_arm.s: New test.
5619         * testsuite/arm_farcall_arm_arm.sh: Likewise.
5620         * testsuite/arm_farcall_arm_thumb.s: Likewise.
5621         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
5622         * testsuite/arm_farcall_thumb_arm.s: Likewise.
5623         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
5624         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
5625         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
5626
5627 2011-10-31  Cary Coutant  <ccoutant@google.com>
5628
5629         PR gold/13023
5630         * expression.cc (Expression::eval_with_dot): Add
5631         is_section_dot_assignment parameter.
5632         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
5633         absolute and assigning to dot within a section.
5634         * script-sections.cc
5635         (Output_section_element_assignment::set_section_addresses): Pass
5636         dot_section to set_if_absolute.
5637         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
5638         as is_section_dot_assignment flag to eval_with_dot.
5639         (Output_section_element_dot_assignment::set_section_addresses):
5640         Likewise.
5641         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
5642         parameter.  Also set value if relative to dot_section; set the
5643         symbol's output_section.
5644         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
5645         parameter.  Adjust all callers.
5646         (Expression::eval_maybe_dot): Likewise.
5647         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
5648         Adjust all callers.
5649         * testsuite/script_test_2.t: Test assignment of an absolute value
5650         to dot within an output section element.
5651
5652 2011-10-31  Cary Coutant  <ccoutant@google.com>
5653
5654         * options.h (class General_options): Add --[no-]gnu-unique options.
5655         * symtab.cc (Symbol_table::sized_write_globals): Convert
5656         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
5657
5658 2011-10-31  Cary Coutant  <ccoutant@google.com>
5659
5660         PR gold/13359
5661         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
5662         unnecessary assertion.
5663         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
5664
5665 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
5666
5667         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5668         gc_mark_symbol.
5669         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5670         gc_mark_symbol.
5671         Change to just keep the section associated with symbol.
5672         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
5673         they are externally visible and --export-dynamic is turned on.
5674         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
5675
5676 2011-10-19  Ian Lance Taylor  <iant@google.com>
5677
5678         PR gold/13163
5679         * script-sections.cc
5680         (Output_section_element_dot_assignment::needs_output_section): New
5681         function.
5682
5683 2011-10-19  Ian Lance Taylor  <iant@google.com>
5684
5685         PR gold/13204
5686         * layout.cc (Layout::segment_precedes): Don't assert failure if a
5687         --section-start option was seen.
5688         * options.h (General_options::any_section_start): New function.
5689
5690 2011-10-18  David S. Miller  <davem@davemloft.net>
5691
5692         PR binutils/13301
5693         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
5694         member to track relocation locations that have moved during TLS
5695         reloc optimizations.
5696         (Target_sparc::Relocate::Relocate): Initialize to NULL.
5697         (Target_sparc::Relocate::relocate): Adjust view down by 4
5698         bytes if it matches reloc_adjust_addr_.
5699         (Target_sparc::Relocate::relocate_tls): Always move the
5700         __tls_get_addr call delay slot instruction forward 4 bytes when
5701         performing relaxation.
5702
5703 2011-10-18  Cary Coutant  <ccoutant@google.com>
5704
5705         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
5706         (Output_file::map_no_anonymous): Check for non-zero
5707         return code from posix_fallocate.
5708
5709 2011-10-17  Cary Coutant  <ccoutant@google.com>
5710
5711         PR gold/13245
5712         * plugin.cc (is_visible_from_outside): Check for symbols
5713         referenced from dynamic objects.
5714         * resolve.cc (Symbol_table::resolve): Don't count references
5715         from dynamic objects as references from real ELF files.
5716         * testsuite/plugin_test_2.sh: Adjust expected result.
5717
5718 2011-10-17  Cary Coutant  <ccoutant@google.com>
5719
5720         * gold.cc: Include timer.h.
5721         (queue_middle_tasks): Stamp time.
5722         (queue_final_tasks): Likewise.
5723         * main.cc (main): Store timer in parameters.  Print timers
5724         for each pass.
5725         * parameters.cc (Parameters::Parameters): Initialize timer_.
5726         (Parameters::set_timer): New function.
5727         (set_parameters_timer): New function.
5728         * parameters.h (Parameters::set_timer): New function.
5729         (Parameters::timer): New function.
5730         (Parameters::timer_): New data member.
5731         (set_parameters_timer): New function.
5732         * timer.cc (Timer::stamp): New function.
5733         (Timer::get_pass_time): New function.
5734         * timer.h (Timer::stamp): New function.
5735         (Timer::get_pass_time): New function.
5736         (Timer::pass_times_): New data member.
5737
5738 2011-10-17  Cary Coutant  <ccoutant@google.com>
5739
5740         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
5741         task for members of lib groups.
5742
5743 2011-10-17  Cary Coutant  <ccoutant@google.com>
5744
5745         PR gold/13288
5746         * fileread.cc (File_read::find_view): Add assert.
5747         (File_read::make_view): Move bounds check (replace with assert)...
5748         (File_read::find_or_make_view): ... to here.
5749
5750 2011-10-12  Cary Coutant  <ccoutant@google.com>
5751
5752         * output.cc (Output_file::open_base_file): Handle case where
5753         ::read returns less than requested size.
5754
5755 2011-10-10  Cary Coutant  <ccoutant@google.com>
5756
5757         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
5758         Initialize defined_count_.
5759         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
5760         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
5761         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
5762         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
5763         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
5764         * incremental.h (Sized_relobj_incr::defined_count_): New data
5765         member.
5766         (Sized_incr_dynobj::defined_count_): New data member.
5767         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
5768         Return zeroes instead of internal error.
5769
5770 2011-10-10  Cary Coutant  <ccoutant@google.com>
5771
5772         PR gold/13249
5773         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
5774         (Output_reloc::symbol_value): Return PLT offset if flag is set.
5775         * output.h (class Output_reloc): Add use_plt_offset flag.
5776         (Output_reloc::type_): Adjust size of bit field.
5777         (Output_reloc::use_plt_offset_): New bit field.
5778         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
5779         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
5780         flag.  Adjust all callers.
5781         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
5782         creating RELATIVE relocations.
5783
5784 2011-10-10  Nick Clifton  <nickc@redhat.com>
5785
5786         * po/es.po: Updated Spanish translation.
5787         * po/fi.po: Updated Finnish translation.
5788
5789 2011-10-03   Diego Novillo  <dnovillo@google.com>
5790
5791         * options.cc (parse_uint): Fix dereference of RETVAL.
5792
5793 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
5794
5795         * layout.h (section_order_map_): New member.
5796         (get_section_order_map): New member function.
5797         * output.cc (Output_section::add_input_section): Check for patterns
5798         only when --section-ordering-file is specified.
5799         * gold.cc (queue_middle_tasks): Delay updating order of sections till
5800         output_sections have been formed.
5801         * layout.cc (Layout_Layout): Initialize section_order_map_.
5802         * plugin.cc (update_section_order): Store order in order_map. Do not
5803         update the order.
5804         * testsuite/Makefile.am: Add test case for plugin_final_layout.
5805         * testsuite/Makefile.in: Regenerate.
5806         * testsuite/plugin_section_order.c: New file.
5807         * testsuite/plugin_final_layout.cc: New file.
5808         * testsuite/plugin_final_layout.sh: New file.
5809
5810 2011-09-29  Cary Coutant  <ccoutant@google.com>
5811
5812         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5813         Check for NULL.
5814         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
5815         symbols during incremental update.
5816         (Symbol_table::add_from_dynobj): Likewise.
5817
5818 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5819             Ian Lance Taylor  <iant@google.com>
5820
5821         * symtab.cc (Symbol_table::define_special_symbol): Always
5822         canonicalize version string.
5823
5824 2011-09-26  Cary Coutant  <ccoutant@google.com>
5825
5826         * gold.cc (queue_initial_tasks): Move option checks ...
5827         * options.cc (General_options::finalize): ... to here. Disable
5828         some options; make others fatal.
5829
5830 2011-09-26  Cary Coutant  <ccoutant@google.com>
5831
5832         gcc PR lto/47247
5833         * plugin.cc (get_symbols_v2): New function.
5834         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
5835         (is_referenced_from_outside): New function.
5836         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
5837         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
5838         (get_symbols): Pass version parameter.
5839         (get_symbols_v2): New function.
5840         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
5841         parameter.
5842         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
5843         (onload): Add LDPT_GET_SYMBOLS_V2.
5844         (all_symbols_read_hook): Use get_symbols_v2; check for
5845         LDPR_PREVAILING_DEF_IRONLY_EXP.
5846         * testsuite/plugin_test_3.sh: Update expected results.
5847
5848 2011-09-23  Simon Baldwin  <simonb@google.com>
5849
5850         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5851         configuration options.
5852         * configure: Regenerate.
5853         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
5854         * Makefile.in: Regenerate.
5855         * testsuite/Makefile.in: Regenerate.
5856
5857 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
5858
5859         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
5860
5861 2011-09-19  Cary Coutant  <ccoutant@google.com>
5862
5863         * incremental.cc (can_incremental_update): Fix typo in comment.
5864         * incremental.h (can_incremental_update): Likewise.
5865
5866 2011-09-18  Cary Coutant  <ccoutant@google.com>
5867
5868         * incremental.cc (can_incremental_update): New function.
5869         * incremental.h (can_incremental_update): New function.
5870         * layout.cc (Layout::init_fixed_output_section): Call it.
5871         (Layout::make_output_section): Don't allow patch space in .eh_frame.
5872         * object.cc (Sized_relobj_file::do_layout): Call
5873         can_incremental_update.
5874
5875 2011-09-13  Cary Coutant  <ccoutant@google.com>
5876
5877         * configure.ac: Check for glibc support for gnu_indirect_function
5878         support with static linking, setting automake conditional
5879         IFUNC_STATIC.
5880         * Makefile.in: Regenerate.
5881         * configure: Regenerate.
5882
5883         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
5884         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
5885         for IFUNC_STATIC.
5886         * testsuite/Makefile.in: Regenerate.
5887
5888 2011-09-13  Cary Coutant  <ccoutant@google.com>
5889
5890         * incremental.cc (Sized_relobj_incr::do_layout): Call
5891         report_comdat_group for kept comdat sections.
5892         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
5893         * testsuite/Makefile.in: Regenerate.
5894         * testsuite/incr_comdat_test_1.cc: New source file.
5895         * testsuite/incr_comdat_test_2_v1.cc: New source file.
5896         * testsuite/incr_comdat_test_2_v2.cc: New source file.
5897         * testsuite/incr_comdat_test_2_v3.cc: New source file.
5898
5899 2011-09-13  Ian Lance Taylor  <iant@google.com>
5900
5901         * object.cc (Sized_relobj_file::do_layout): Remove unused local
5902         variable external_symbols_offset.
5903
5904 2011-09-12  Ian Lance Taylor  <iant@google.com>
5905
5906         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
5907         triggered if object has no symbols.
5908
5909 2011-09-09  David S. Miller  <davem@davemloft.net>
5910
5911         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
5912         (Output_fill_debug_line::do_write): Likewise.
5913
5914 2011-08-29  Cary Coutant  <ccoutant@google.com>
5915
5916         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
5917         casts to match formatting specs.
5918         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
5919
5920 2011-08-26  Cary Coutant  <ccoutant@google.com>
5921
5922         * layout.cc (Free_list::allocate): Provide guarantee of minimum
5923         remaining hole size when allocating.
5924         (Layout::make_output_section): Set fill methods for debug sections.
5925         * layout.h (Free_list::Free_list_node): Move from private to
5926         public.
5927         (Free_list::set_min_hole_size): New function.
5928         (Free_list::begin, Free_list::end): New functions.
5929         (Free_list::min_hole_): New data member.
5930         * output.cc: Include dwarf.h.
5931         (Output_fill_debug_info::do_minimum_hole_size): New function.
5932         (Output_fill_debug_info::do_write): New function.
5933         (Output_fill_debug_line::do_minimum_hole_size): New function.
5934         (Output_fill_debug_line::do_write): New function.
5935         (Output_section::Output_section): Initialize new data member.
5936         (Output_section::set_final_data_size): Ensure patch space is larger
5937         than minimum hole size.
5938         (Output_section::do_write): Fill holes in debug sections.
5939         * output.h (Output_fill): New class.
5940         (Output_fill_debug_info): New class.
5941         (Output_fill_debug_line): New class.
5942         (Output_section::set_free_space_fill): New function.
5943         (Output_section::free_space_fill_): New data member.
5944         * testsuite/Makefile.am (incremental_test_3): Add
5945         --incremental-patch option.
5946         (incremental_test_4): Likewise.
5947         (incremental_test_5): Likewise.
5948         (incremental_test_6): Likewise.
5949         (incremental_copy_test): Likewise.
5950         (incremental_common_test_1): Likewise.
5951         * testsuite/Makefile.in: Regenerate.
5952
5953 2011-08-26  Nick Clifton  <nickc@redhat.com>
5954
5955         * po/es.po: Updated Spanish translation.
5956
5957 2011-08-01  Cary Coutant  <ccoutant@google.com>
5958
5959         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
5960         * gold/testsuite/Makefile.in: Regenerate.
5961         * gold/testsuite/justsyms_exec.c: New source file.
5962         * gold/testsuite/justsyms_lib.c: New source file.
5963
5964 2011-08-01  Cary Coutant  <ccoutant@google.com>
5965
5966         * layout.cc (Layout::set_segment_offsets): Don't realign text
5967         segment if -Ttext was specified.
5968         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
5969         file type.
5970         * object.h (Sized_relobj_file::e_type): New function.
5971         (Sized_relobj_file::e_type_): New data member.
5972         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
5973         base address for ET_EXEC files.
5974         * target.cc (Target::do_make_elf_object_implementation): Allow
5975         ET_EXEC files with --just-symbols option.
5976
5977 2011-07-28  Cary Coutant  <ccoutant@google.com>
5978
5979         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
5980         Add thread_number parameter.
5981         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
5982         * workqueue-threads.cc
5983         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
5984         current thread if its thread number is greater than desired thread
5985         count.
5986         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
5987         Add thread_number parameter.
5988         (Workqueue::should_cancel_thread): Likewise.
5989         (Workqueue::find_runnable_or_wait): Pass thread_number to
5990         should_cancel_thread.
5991         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
5992         parameter.
5993
5994 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
5995
5996         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
5997         only after checking if it cannot be forced local.
5998         * symtab.h (is_externally_visible): Check if the symbol is not forced
5999         local.
6000
6001 2011-07-15  Ian Lance Taylor  <iant@google.com>
6002
6003         * options.h (class General_options): Add --print-output-format.
6004         Move -EL next to -EB, for  better --help output.
6005         * target-select.cc: Include <cstdio>, "options.h", and
6006         "parameters.h".
6007         (Target_selector::do_target_bfd_name): New function.
6008         (print_output_format): New function.
6009         * target-select.h (class Target_selector): Update declarations.
6010         (Target_selector::target_bfd_name): New function.
6011         (print_output_format): Declare.
6012         * main.cc: Include "target-select.h".
6013         (main): Handle --print-output-format.
6014         * gold.cc: Include "target-select.h".
6015         (queue_initial_tasks): Handle --print-output-format when there are
6016         no input files.
6017         * parameters.cc (parameters_force_valid_target): Give a better
6018         error message if -EB/-EL does not match target.
6019         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
6020         function.
6021
6022 2011-07-15  Ian Lance Taylor  <iant@google.com>
6023
6024         * i386.cc (class Output_data_plt_i386): Add layout_ field.
6025         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
6026         (Output_data_plt_i386::do_write): Write address of .dynamic
6027         section to first entry in .got.plt section.
6028         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
6029         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
6030         Initialize layout_.
6031         (Output_data_plt_x86_64::do_write): Write address of .dynamic
6032         section to first entry in .got.plt section.
6033         * layout.h (Layout::dynamic_section): New function.
6034
6035 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
6036
6037         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
6038         to claim_file call.
6039         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
6040         input_section_position_, and input_section_glob_.
6041         (read_layout_from_file): Call function section_ordering_specified.
6042         * layout.h (is_section_ordering_specified): New function.
6043         (section_ordering_specified): New function.
6044         (section_ordering_specified_): New boolean member.
6045         * main.cc(main): Call load_plugins after layout object is defined.
6046         * output.cc (Output_section::add_input_section): Use
6047         function section_ordering_specified to check if section ordering is
6048         needed.
6049         * output.cc (Output_section::add_relaxed_input_section): Use
6050         function section_ordering_specified to check if section ordering is
6051         needed.
6052         (Output_section::update_section_layout): New function.
6053         (Output_section::sort_attached_input_sections): Check if input section
6054         must be reordered.
6055         * output.h (Output_section::update_section_layout): New function.
6056         * plugin.cc (get_section_count): New function.
6057         (get_section_type): New function.
6058         (get_section_name): New function.
6059         (get_section_contents): New function.
6060         (update_section_order): New function.
6061         (allow_section_ordering): New function.
6062         (Plugin::load): Add the new interfaces to the transfer vector.
6063         (Plugin_manager::load_plugins): New parameter.
6064         (Plugin_manager::all_symbols_read): New parameter.
6065         (Plugin_manager::claim_file): New parameter. Save the elf object for
6066         unclaimed objects.
6067         (Plugin_manager::get_elf_object): New function.
6068         (Plugin_manager::get_view): Change to directly use the bool to check
6069         if get_view is called from claim_file_hook.
6070         * plugin.h (input_objects): New function
6071         (Plugin__manager::load_plugins): New parameter.
6072         (Plugin_manager::claim_file): New parameter.
6073         (Plugin_manager::get_elf_object): New function.
6074         (Plugin_manager::in_claim_file_handler): New function.
6075         (Plugin_manager::in_claim_file_handler_): New member.
6076         (layout): New function.
6077         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
6078         handler with an extra parameter. Make the elf object before calling
6079         claim_file handler.
6080         * testsuite/plugin_test.c (get_section_count): New function pointer.
6081         (get_section_type): New function pointer.
6082         (get_section_name): New function pointer.
6083         (get_section_contents): New function pointer.
6084         (update_section_order): New function pointer.
6085         (allow_section_ordering): New function pointer.
6086         (onload): Check if the new interfaces exist.
6087
6088 2011-07-13  Ian Lance Taylor  <iant@google.com>
6089
6090         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
6091         relro section.
6092         * x86_64.cc (Target_x86_64::got_section): Likewise.
6093         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
6094         (relro_now_test_SOURCES): New variable.
6095         (relro_now_test_DEPENDENCIES): New variable.
6096         (relro_now_test_LDFLAGS): New variable.
6097         (relro_now_test_LDADD): New variable.
6098         (relro_now_test.so): New target.
6099         * testsuite/Makefile.in: Rebuild.
6100
6101 2011-07-12  Ian Lance Taylor  <iant@google.com>
6102
6103         PR gold/12980
6104         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
6105         GLOB_DAT relocation rather than a RELATIVE relocation for a
6106         protected symbol when creating a shared library.
6107         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6108         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
6109         * testsuite/protected_main_1.cc (main): Test that protected
6110         function has same address.
6111
6112 2011-07-11  Ian Lance Taylor  <iant@google.com>
6113
6114         PR gold/12979
6115         * options.h (class General_options): Add -Bgroup.
6116         * options.cc (General_options::finalize): If -Bgroup is set,
6117         default to --unresolved-symbols=report-all.
6118         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
6119         * target-reloc.h (issue_undefined_symbol_error): Handle
6120         --unresolved-symbols=report-all.
6121
6122 2011-07-08  Ian Lance Taylor  <iant@google.com>
6123
6124         PR gold/11985
6125         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
6126         if linker script discards key sections.
6127         (Layout::create_dynamic_symtab): Likewise.
6128         (Layout::assign_local_dynsym_offsets): Likewise.
6129         (Layout::sized_create_version_sections): Likewise.
6130         (Layout::create_interp): Likewise.
6131         (Layout::finish_dynamic_section): Likewise.
6132         (Layout::set_dynamic_symbol_size): Likewise.
6133
6134 2011-07-08  Ian Lance Taylor  <iant@google.com>
6135
6136         PR gold/12386
6137         * options.h (class General_options): Add --unresolved-symbols.
6138         * target-reloc.h (issue_undefined_symbol_error): Check
6139         --unresolved-symbols.  Add comments.
6140
6141 2011-07-08  Ian Lance Taylor  <iant@google.com>
6142
6143         * testsuite/odr_violation2.cc (Ordering::operator()): Make
6144         expression more complex.
6145
6146 2011-07-08  Ian Lance Taylor  <iant@google.com>
6147
6148         PR gold/11317
6149         * target-reloc.h (issue_undefined_symbol_error): New inline
6150         function, broken out of relocate_section.
6151         (relocate_section): Call issue_undefined_symbol_error.
6152         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
6153         there is no TLS segment if we are about to issue an undefined
6154         symbol error.
6155         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
6156
6157 2011-07-08  Ian Lance Taylor  <iant@google.com>
6158
6159         PR gold/12279
6160         * resolve.cc (Symbol_table::should_override): Add fromtype
6161         parameter.  Change all callers.  Give error when linking together
6162         TLS and non-TLS symbol.
6163         (Symbol_table::should_override_with_special): Add fromtype
6164         parameter.  Change all callers.
6165         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
6166         there is no TLS segment if we have reported some errors.
6167         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
6168
6169 2011-07-08  Ian Lance Taylor  <iant@google.com>
6170
6171         PR gold/12372
6172         * target.h (Target::plt_address_for_global): New function.
6173         (Target::plt_address_for_local): New function.
6174         (Target::plt_section_for_global): Remove.
6175         (Target::plt_section_for_local): Remove.
6176         (Target::do_plt_address_for_global): New virtual function.
6177         (Target::do_plt_address_for_local): New virtual function.
6178         (Target::do_plt_section_for_global): Remove.
6179         (Target::do_plt_section_for_local): Remove.
6180         (Target::register_global_plt_entry): Add Symbol_table and Layout
6181         parameters.
6182         * output.cc (Output_data_got::Got_entry::write): Use
6183         plt_address_for_global and plt_address_for_local.
6184         * layout.cc (Layout::add_target_dynamic_tags): Use size and
6185         address of output section.
6186         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
6187         got_irelative_, and irelative_count_ fields.  Update
6188         declarations.
6189         (Output_data_plt_i386::has_irelative_section): New function.
6190         (Output_data_plt_i386::entry_count): Add irelative_count_.
6191         (Output_data_plt_i386::set_final_data_size): Likewise.
6192         (class Target_i386): Add got_irelative_ and rel_irelative_
6193         fields.  Update declarations.
6194         (Target_i386::Target_i386): Initialize new fields.
6195         (Target_i386::do_plt_address_for_global): New function replacing
6196         do_plt_section_for_global.
6197         (Target_i386::do_plt_address_for_local): New function replacing
6198         do_plt_section_for_local.
6199         (Target_i386::got_section): Create got_irelative_.
6200         (Target_i386::rel_irelative_section): New function.
6201         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
6202         fields.  Don't define __rel_iplt_{start,end}.
6203         (Output_data_plt_i386::add_entry): Add symtab and layout
6204         parameters.  Change all callers.  Use different PLT and GOT for
6205         IFUNC symbols.
6206         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
6207         layout parameters.  Change all callers.  Use different PLT and
6208         GOT.
6209         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
6210         (Output_data_plt_i386::rel_irelative): New function.
6211         (Output_data_plt_i386::address_for_global): New function.
6212         (Output_data_plt_i386::address_for_local): New function.
6213         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
6214         IRELATIVE GOT when changing IFUNC GOT entries.
6215         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
6216         reloc.
6217         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
6218         if we didn't create an IRELATIVE GOT.
6219         (Target_i386::Relocate::relocate): Use plt_address_for_global and
6220         plt_address_for_local.
6221         (Target_i386::do_dynsym_value): Use plt_address_for_global.
6222         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
6223         got_irelative_, and irelative_count_ fields.  Update
6224         declarations.
6225         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
6226         Initialize new fields.  Remove symtab parameter.  Change all
6227         callers.
6228         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
6229         irelative_count_.
6230         (Output_data_plt_x86_64::has_irelative_section): New function.
6231         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
6232         (class Target_x86_64): Add got_irelative_ and rel_irelative_
6233         fields.  Update declarations.
6234         (Target_x86_64::Target_x86_64): Initialize new fields.
6235         (Target_x86_64::do_plt_address_for_global): New function replacing
6236         do_plt_section_for_global.
6237         (Target_x86_64::do_plt_address_for_local): New function replacing
6238         do_plt_section_for_local.
6239         (Target_x86_64::got_section): Create got_irelative_.
6240         (Target_x86_64::rela_irelative_section): New function.
6241         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
6242         all callers.  Don't create __rel_iplt_{start,end}.
6243         (Output_data_plt_x86_64::add_entry): Add symtab and layout
6244         parameters.  Change all callers.  Use different PLT and GOT for
6245         IFUNC symbols.
6246         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
6247         layout parameters.  Change all callers.  Use different PLT and
6248         GOT.
6249         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
6250         parameters.  Change all callers.  Use different PLT and GOT for
6251         IFUNC symbols.
6252         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
6253         (Output_data_plt_x86_64::rela_irelative): New function.
6254         (Output_data_plt_x86_64::address_for_global): New function.
6255         (Output_data_plt_x86_64::address_for_local): New function.
6256         (Output_data_plt_x86_64::set_final_data_size): Likewise.
6257         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
6258         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
6259         (Target_x86_64::register_global_plt_entry): Add symtab and layout
6260         parameters.
6261         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
6262         reloc.
6263         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
6264         symbols if we didn't create an IRELATIVE GOT.
6265         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
6266         plt_address_for_local.
6267         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
6268         * testsuite/ifuncvar1.c: New test file.
6269         * testsuite/ifuncvar2.c: New test file.
6270         * testsuite/ifuncvar3.c: New test file.
6271         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
6272         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
6273         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
6274         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
6275         * testsuite/Makefile.in: Rebuild.
6276
6277 2011-07-07  Cary Coutant  <ccoutant@google.com>
6278
6279         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
6280         (two_file_test_1_ndebug.o): Likewise.
6281         (two_file_test_1b_ndebug.o): Likewise.
6282         (two_file_test_2_ndebug.o): Likewise.
6283         (two_file_test_main_ndebug.o): Likewise.
6284         (incremental_test_2): Link with no-debug versions.
6285
6286 2011-07-06  Cary Coutant  <ccoutant@google.com>
6287
6288         * gold/incremental.cc
6289         (Output_section_incremental_inputs::write_info_blocks): Check for
6290         hidden and internal symbols.
6291
6292 2011-07-06  Cary Coutant  <ccoutant@google.com>
6293
6294         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
6295         Check disposition for startup file.
6296         (Incremental_inputs::report_command_line): Ignore
6297         --incremental-startup-unchanged option.
6298         * options.cc (General_options::parse_incremental_startup_unchanged):
6299         New function.
6300         (General_options::General_options): Initialize new data member.
6301         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
6302         (General_options): Add --incremental-startup-unchanged option.
6303         (General_options::incremental_startup_disposition): New function.
6304         (General_options::incremental_startup_disposition_): New data member.
6305
6306 2011-07-06  Cary Coutant  <ccoutant@google.com>
6307
6308         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
6309         input file index to Script_info ctor.
6310         (Sized_incremental_binary::do_file_has_changed): Find the
6311         command-line argument for files named in scripts.
6312         * incremental.h (Script_info::Script_info): New ctor
6313         with input file index.
6314         (Script_info::input_file_index): New function.
6315         (Script_info::input_file_index_): New data member.
6316         (Incremental_binary::get_library): Add const.
6317         (Incremental_binary::get_script_info): Add const.
6318         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
6319         * testsuite/Makefile.am (incremental_test_5): New test case.
6320         (incremental_test_6): New test case.
6321         * testsuite/Makefile.in: Regenerate.
6322
6323 2011-07-06  Cary Coutant  <ccoutant@google.com>
6324
6325         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
6326         debug output when command lines differ.
6327
6328 2011-07-06  Cary Coutant  <ccoutant@google.com>
6329
6330         * incremental.cc (Incremental_inputs::report_command_line): Ignore
6331         --incremental-patch option.
6332         * layout.cc (Free_list::allocate): Extend allocation beyond original
6333         end if enabled.
6334         (Layout::make_output_section): Mark sections that should get
6335         patch space.
6336         * options.cc (parse_percent): New function.
6337         * options.h (parse_percent): New function.
6338         (DEFINE_percent): New macro.
6339         (General_options): Add --incremental-patch option.
6340         * output.cc (Output_section::Output_section): Initialize new data
6341         members.
6342         (Output_section::add_input_section): Print section name when out
6343         of patch space.
6344         (Output_section::add_output_section_data): Likewise.
6345         (Output_section::set_final_data_size): Add patch space when
6346         doing --incremental-full.
6347         (Output_section::do_reset_address_and_file_offset): Remove patch
6348         space.
6349         (Output_segment::set_section_list_addresses): Print debug output
6350         only if --incremental-update.
6351         * output.h (Output_section::set_is_patch_space_allowed): New function.
6352         (Output_section::is_patch_space_allowed_): New data member.
6353         (Output_section::patch_space_): New data member.
6354         * parameters.cc (Parameters::incremental_full): New function.
6355         * parameters.h (Parameters::incremental_full): New function
6356         * testsuite/Makefile.am (incremental_test_2): Add test for
6357         --incremental-patch option.
6358         * testsuite/Makefile.in: Regenerate.
6359         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
6360         (t18): Remove function body.
6361
6362 2011-07-05  Doug Kwan  <dougkwan@google.com>
6363
6364         PR gold/12771
6365         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
6366         Arm_Address type for relocation result.
6367         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
6368         overflow check.
6369         (Arm_relocate_functions::abs32): Use unaligned access.
6370         (Arm_relocate_functions::rel32): Ditto.
6371         (Arm_relocate_functions::prel31): Ditto.
6372         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
6373         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
6374         static data relocations.
6375         * testsuite/Makefile.in: Regnerate.
6376         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
6377
6378 2011-07-05  Ian Lance Taylor  <iant@google.com>
6379
6380         PR gold/12392
6381         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
6382         symbols if necessary.
6383         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6384
6385 2011-07-05  Ian Lance Taylor  <iant@google.com>
6386
6387         PR gold/12952
6388         * resolve.cc (Symbol::override_base_with_special): Simply override
6389         version with special symbol version, ignoring previous version.
6390
6391 2011-07-05  Ian Lance Taylor  <iant@google.com>
6392
6393         * object.cc (Sized_relobj_file::include_section_group): Add
6394         information to comment about signature location.
6395
6396 2011-07-02  Ian Lance Taylor  <iant@google.com>
6397
6398         PR gold/12957
6399         * options.h (class General_options): Add -f and -F.
6400         * options.cc (General_options::finalize): Fatal error if -f/-F
6401         are used without -shared.
6402         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
6403
6404 2011-07-02  Ian Lance Taylor  <iant@google.com>
6405
6406         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
6407
6408 2011-07-01  Ian Lance Taylor  <iant@google.com>
6409
6410         PR gold/12525
6411         PR gold/12952
6412         * resolve.cc (Symbol::override_base_with_special): Don't override
6413         the version if the overriding symbol has a different name.
6414         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
6415         all callers.  If we give an error about an undefined version,
6416         define the base version if necessary.
6417         * dynobj.h (class Versions): Update declaration.
6418         * testsuite/weak_alias_test_5.cc: New file.
6419         * testsuite/weak_alias_test.script: New file.
6420         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
6421         and versioned_alias have the right value, and call t2.
6422         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
6423         weak_alias_test_5.so.
6424         (weak_alias_test_LDADD): Likewise.
6425         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
6426         * testsuite/Makefile.in: Rebuild.
6427
6428 2011-07-01  Ian Lance Taylor  <iant@google.com>
6429
6430         PR gold/12525
6431         * options.h (class General_options): Support -z notext.
6432         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
6433         -Wl,-z,notext.
6434         (two_file_shared_nonpic.so): Likewise.
6435         (two_file_shared_mixed.so): Likewise.
6436         (two_file_shared_mixed_1.so): Likewise.
6437         (weak_undef_lib_nonpic.so): Likewise.
6438         (alt/weak_undef_lib_nonpic.so): Likewise.
6439         (tls_test_shared_nonpic.so): Likewise.
6440         * testsuite/Makefile.in: Rebuild.
6441
6442 2011-07-01  Ian Lance Taylor  <iant@google.com>
6443
6444         PR gold/12525
6445         * configure.ac: Test whether static linking works, setting
6446         the automake conditional HAVE_STATIC.
6447         * testsuite/Makefile.am: Disable tests using -static if
6448         HAVE_STATIC is not true.
6449         * configure, testsuite/Makefile.in: Rebuild.
6450
6451 2011-07-01  Ian Lance Taylor  <iant@google.com>
6452
6453         PR gold/12525
6454         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
6455         Assert if we see DW_EH_PE_indirect.
6456         * target.h (Target::ehframe_datarel_base): New function.
6457         (Target::do_ehframe_datarel_base): New target function.
6458         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
6459         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
6460         function.
6461
6462 2011-07-01  Ian Lance Taylor  <iant@google.com>
6463
6464         PR gold/12571
6465         * options.h (class General_options): Add
6466         --ld-generated-unwind-info.
6467         * ehframe.cc (Fde::write): Add address parameter.  Change all
6468         callers.  If associated with PLT, fill in address and size.
6469         (Cie::set_output_offset): Only add merge mapping if there is an
6470         object.
6471         (Cie::write): Add address parameter.  Change all callers.
6472         (Eh_frame::add_ehframe_for_plt): New function.
6473         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
6474         input_offset_ fields into union u_, with new plt field.
6475         (Fde::Fde): Adjust for new union field.
6476         (Fde::Fde) [Output_data version]: New constructor.
6477         (Fde::add_mapping): Only add merge mapping if there is an object.
6478         (class Cie): Update declarations.
6479         (class Eh_frame): Declare add_ehframe_for_plt.
6480         * layout.cc (Layout::layout_eh_frame): Break out code into
6481         make_eh_frame_section, and call it.
6482         (Layout::make_eh_frame_section): New function.
6483         (Layout::add_eh_frame_for_plt): New function.
6484         * layout.h (class Layout): Update declarations.
6485         * merge.cc (Merge_map::add_mapping): Add assertion.
6486         * i386.cc: Include "dwarf.h".
6487         (class Output_data_plt_i386): Make first_plt_entry,
6488         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
6489         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6490         and plt_eh_frame_fde.
6491         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
6492         boundary.  Call add_eh_frame_for_plt if appropriate.
6493         * x86_64.cc: Include "dwarf.h".
6494         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
6495         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
6496         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6497         and plt_eh_frame_fde.
6498         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
6499         appropriate.
6500
6501 2011-06-29  Ian Lance Taylor  <iant@google.com>
6502
6503         PR gold/12629
6504         * object.cc (Sized_relobj_file::layout_section): Change shdr
6505         parameter to be const.
6506         (Sized_relobj_file::layout_eh_frame_section): New function, broken
6507         out of do_layout.
6508         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
6509         appropriate.  Call layout_eh_frame_section.
6510         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
6511         sections.
6512         * object.h (class Sized_relobj_file): Update declarations.
6513
6514 2011-06-29  Ian Lance Taylor  <iant@google.com>
6515
6516         PR gold/12652
6517         * script.cc (Token::integer_value): Accept trailing M/m/K/k
6518         modifier.
6519         (Lex::gather_token): Accept trailing M/m/K/k for integers.
6520
6521 2011-06-29  Ian Lance Taylor  <iant@google.com>
6522
6523         PR gold/12675
6524         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
6525         SHT_X86_64_UNWIND.
6526         * layout.cc (Layout::layout_eh_frame): Likewise.
6527
6528 2011-06-29  Ian Lance Taylor  <iant@google.com>
6529
6530         PR gold/12695
6531         * layout.cc (Layout::symtab_section_shndx): New function.
6532         * layout.h (class Layout): Declare symtab_section_shndx.
6533         * output.cc (Output_section::write_header): Call it.
6534
6535 2011-06-29  Ian Lance Taylor  <iant@google.com>
6536
6537         PR gold/12818
6538         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
6539         symbols which are not used in a relocation.
6540
6541 2011-06-28  Ian Lance Taylor  <iant@google.com>
6542
6543         PR gold/12898
6544         * layout.cc (Layout::segment_precedes): Don't crash if a linker
6545         script create indistinguishable segments.
6546         (Layout::set_segment_offsets): Use stable_sort when sorting
6547         segments.  Pass this to Compare_segments constructor.
6548         * layout.h (class Layout): Make segment_precedes non-static.
6549         (class Compare_segments): Change from struct to class.  Add
6550         layout_ field.  Add constructor.
6551         * script-sections.cc
6552         (Script_sections::attach_sections_using_phdrs_clause): Rename
6553         local orphan to is_orphan.  Don't report failure to put empty
6554         section in segment.  On attachment failure, report name of
6555         section, and attach to first PT_LOAD segment.
6556
6557 2011-06-28  Ian Lance Taylor  <iant@google.com>
6558
6559         PR gold/12934
6560         * target-select.cc (Target_selector::Target_selector): Add
6561         emulation parameter.  Change all callers.
6562         (select_target_by_bfd_name): Rename from select_target_by_name.
6563         Change all callers.
6564         (select_target_by_emulation): New function.
6565         (supported_emulation_names): New function.
6566         * target-select.h (class Target_selector): Add emulation_ field.
6567         Update declarations.
6568         (Target_selector::recognize_by_bfd_name): Rename from
6569         recognize_by_name.  Change all callers.
6570         (Target_selector::supported_bfd_names): Rename from
6571         supported_names.  Change all callers.
6572         (Target_selector::recognize_by_emulation): New function.
6573         (Target_selector::supported_emulations): New function.
6574         (Target_selector::emulation): New function.
6575         (Target_selector::do_recognize_by_bfd_name): Rename from
6576         do_recognize_by_name.  Change all callers.
6577         (Target_selector::do_supported_bfd_names): Rename from
6578         do_supported_names.  Change all callers.
6579         (Target_selector::do_recognize_by_emulation): New function.
6580         (Target_selector::do_supported_emulations): New function.
6581         (select_target_by_bfd_name): Change name in declaration.
6582         (select_target_by_emulation): Declare.
6583         (supported_emulation_names): Declare.
6584         * parameters.cc (parameters_force_valid_target): Try to find
6585         target based on emulation from -m option.
6586         * options.h (class General_options): Change doc string for -m.
6587         * options.cc (help): Print emulations.
6588         (General_options::parse_V): Likewise.
6589         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
6590         Add emulation parameter.  Change all callers.
6591
6592 2011-06-28  Ian Lance Taylor  <iant@google.com>
6593
6594         * target.h (class Target): Add osabi_ field.
6595         (Target::osabi): New function.
6596         (Target::set_osabi): New function.
6597         (Target::Target): Initialize osabi_.
6598         (Target::do_adjust_elf_header): Make pure virtual.
6599         (Sized_target::do_adjust_elf_header): Declare.
6600         * target.cc (Sized_target::do_adjust_elf_header): New function.
6601         (class Sized_target): Instantiate all versions.
6602         * freebsd.h (class Target_freebsd): Remove.
6603         (Target_selector_freebsd::do_recognize): Call set_osabi on
6604         Target.
6605         (Target_selector_freebsd::do_recognize_by_name): Likewise.
6606         (Target_selector_freebsd::set_osabi): Remove.
6607         * i386.cc (class Target_i386): Inherit from Sized_target rather
6608         than Target_freebsd.
6609         * x86_64.cc (class Target_x86_64): Likewise.
6610
6611 2011-06-28  Ian Lance Taylor  <iant@google.com>
6612
6613         * target.h (Target::can_check_for_function_pointers): Rewrite.
6614         Make non-virtual.
6615         (Target::can_icf_inline_merge_sections): Likewise.
6616         (Target::section_may_have_icf_unsafe_poineters): Likewise.
6617         (Target::Target_info): Add can_icf_inline_merge_sections field.
6618         (Target::do_can_check_for_function_pointers): New virtual
6619         function.
6620         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
6621         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
6622         from can_check_for_function_pointers, move in file.
6623         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
6624         section_may_have_icf_unsafe_poineters, move in file.
6625         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
6626         * i386.cc (Target_i386::do_can_check_for_function_pointers):
6627         Rename from can_check_for_function_pointers, move in file.
6628         (Target_i386::can_icf_inline_merge_sections): Remove.
6629         (Target_i386::i386_info): Initialize
6630         can_icf_inline_merge_sections.
6631         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6632         Initialize can_icf_inline_merge_sections.
6633         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
6634         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
6635         Rename from can_check_for_function_pointers, move in file.
6636         (Target_x86_64::can_icf_inline_merge_sections): Remove.
6637         (Target_x86_64::x86_64_info): Initialize
6638         can_icf_inline_merge_sections.
6639         * testsuite/testfile.cc (Target_test::test_target_info):
6640         Likewise.
6641         * icf.cc (get_section_contents): Correct formatting.
6642
6643 2011-06-27  Ian Lance Taylor  <iant@google.com>
6644
6645         * symtab.cc (Symbol::versioned_name): New function.
6646         (Symbol_table::add_to_final_symtab): Use versioned_name when
6647         appropriate.
6648         (Symbol_table::sized_write_symbol): Likewise.
6649         * symtab.h (class Symbol): Declare versioned_name.
6650         * stringpool.h (class Stringpool_template): Add variant of add
6651         which takes a std::basic_string.
6652         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
6653         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
6654         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
6655         (ver_test_12.o): New target.
6656         * testsuite/Makefile.in: Rebuild.
6657
6658 2011-06-27  Doug Kwan  <dougkwan@google.com>
6659
6660         * arm.cc (Arm_relocate_functions::thm_jump8,
6661         Arm_relocate_functions::thm_jump11): Use a wider signed
6662         type to compute offset.
6663         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
6664         arm_thm_jump8.
6665         * testsuite/Makefile.in: Regenerate.
6666         * testsuite/arm_branch_in_range.sh: Check test results of
6667         arm_thm_jump11 and arm_thm_jump8.
6668         * testsuite/arm_thm_jump11.s: New test source file.
6669         * testsuite/arm_thm_jump11.t: New linker script.
6670         * testsuite/arm_thm_jump8.s: New test source file.
6671         * testsuite/arm_thm_jump8.t: New linker script.
6672
6673 2011-06-24  Ian Lance Taylor  <iant@google.com>
6674
6675         * layout.cc: Include "object.h".
6676         (ctors_sections_in_init_array): New static variable.
6677         (Layout::is_ctors_in_init_array): New function.
6678         (Layout::layout): Add entry to ctors_sections_in_init_array if
6679         appropriate.
6680         * layout.h (class Layout): Declare is_ctors_in_init_array.
6681         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
6682         is_ctors_reverse_view is set.
6683         (Sized_relobj_file::write_sections): Add layout parameter.  Change
6684         all callers.  Set is_ctors_reverse_view field of View_size.
6685         (Sized_relobj_file::reverse_words): New function.
6686         * object.h (Sized_relobj_file::View_size): Add
6687         is_ctors_reverse_view field.
6688         (class Sized_relobj_file): Update declarations.
6689         * testsuite/initpri3.c: New test.
6690         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
6691         initpri3b.
6692         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
6693         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
6694         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
6695         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
6696         * testsuite/Makefile.in: Rebuild.
6697
6698 2011-06-24  Cary Coutant  <ccoutant@google.com>
6699
6700         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
6701         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
6702         (debug_msg_cdebug.err): New targets.
6703         * testsuite/Makefile.in: Regenerate.
6704         * testsuite/debug_msg.sh: Check output of link with compressed debug.
6705         Fix checks for link with shared library.
6706
6707 2011-06-24  Doug Kwan  <dougkwan@google.com>
6708
6709         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
6710         skip empty text sections.
6711         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
6712
6713 2011-06-22  Ian Lance Taylor  <iant@google.com>
6714
6715         PR gold/12910
6716         * options.h (class General_options): Add --ctors-in-init-array.
6717         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
6718         friends as SHT_PROGBITS for merging sections.
6719         (Layout::layout): Remove special handling of .init_array and
6720         friends.  Don't sort if doing relocatable link.  Sort for .ctors
6721         and .dtors if ctors_in_init_array.
6722         (Layout::make_output_section): Force correct section types for
6723         .init_array and friends.  Don't sort if doing relocatable link,
6724         Don't sort .ctors and .dtors if ctors_in_init_array.
6725         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
6726         (Layout::output_section_name): Add relobj parameter.  Change all
6727         callers.  Handle .ctors. and .dtors. in code rather than table.
6728         Handle .ctors and .dtors if ctors_in_init_array.
6729         (Layout::match_file_name): New function, moved from output.cc.
6730         * layout.h (class Layout): Update declarations.
6731         * output.cc: Include "layout.h".
6732         (Input_section_sort_entry::get_priority): New function.
6733         (Input_section_sort_entry::match_file_name): Just call
6734         Layout::match_file_name.
6735         (Output_section::Input_section_sort_init_fini_compare::operator()):
6736         Handle .ctors and .dtors.  Sort by explicit priority rather than
6737         by name.
6738         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
6739         * testsuite/initpri2.c: New test.
6740         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
6741         (check_PROGRAMS): Add initpri2.
6742         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
6743         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
6744         * configure, testsuite/Makefile.in: Rebuild.
6745
6746 2011-06-19  Ian Lance Taylor  <iant@google.com>
6747
6748         PR gold/12880
6749         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
6750         .interp section to a PT_INTERP segment even if we have seen a
6751         --dynamic-linker option.  Don't do it if we have seen a PHDRS
6752         clause in a linker script.
6753         (Layout::finalize): Don't create a .interp section if we've
6754         already create a PT_INTERP segment.
6755         (Layout::create_interp): Always call choose_output_section (revert
6756         patch of 2011-06-17).  Don't create PT_INTERP segment.
6757         * script-sections.cc
6758         (Script_sections::create_note_and_tls_segments): Add a .interp
6759         section to a PT_INTERP segment even if we have seen a
6760         --dynamic-linker option.
6761
6762 2011-06-18  Ian Lance Taylor  <iant@google.com>
6763
6764         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
6765         merely because a non-PT_LOAD segment has a dynamic reloc.
6766
6767 2011-06-18  Ian Lance Taylor  <iant@google.com>
6768
6769         * layout.cc (Layout::finish_dynamic_section): Don't create
6770         DT_FLAGS entry if not needed.
6771
6772 2011-06-18  Ian Lance Taylor  <iant@google.com>
6773
6774         PR gold/12745
6775         * layout.cc (Layout::layout_eh_frame): Correct handling of
6776         writable .eh_frame section.
6777
6778 2011-06-17  Ian Lance Taylor  <iant@google.com>
6779
6780         PR gold/12893
6781         * resolve.cc (Symbol_table::resolve): Don't give an error if a
6782         symbol is redefined with the exact same object and value.
6783
6784 2011-06-17  Ian Lance Taylor  <iant@google.com>
6785
6786         PR gold/12880
6787         * layout.h (class Layout): Add interp_segment_ field.
6788         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
6789         (Layout::attach_allocated_section_to_segment): If making shared
6790         library, put .interp section in PT_INTERP segment.
6791         (Layout::finalize): Also call create_interp if -dynamic-linker
6792         option was used.
6793         (Layout::create_interp): Assert that there is no PT_INTERP
6794         segment.  If not using a SECTIONS clause, use make_output_section.
6795         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
6796         * script-sections.cc
6797         (Script_sections::create_note_and_tls_segments): If making shared
6798         library, put .interp section in PT_INTERP segment.
6799
6800 2011-06-17  Ian Lance Taylor  <iant@google.com>
6801
6802         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
6803         when making a shared library.
6804
6805 2011-06-17  Ian Lance Taylor  <iant@google.com>
6806
6807         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
6808         parameter.  Change all callers.  Don't issue warning about PC32
6809         against locally defined symbol.
6810
6811 2011-06-16  Ian Lance Taylor  <iant@google.com>
6812
6813         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
6814         occurs in same object.
6815
6816 2011-06-14  Alan Modra  <amodra@gmail.com>
6817
6818         * po/POTFILES.in: Regenerate.
6819
6820 2011-06-09  Ian Lance Taylor  <iant@google.com>
6821
6822         * script-sections.cc
6823         (Orphan_output_section::set_section_addresses): For a relocatable
6824         link set address to 0.
6825
6826 2011-06-09  Cary Coutant  <ccoutant@google.com>
6827
6828         PR gold/12804
6829         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
6830         used with --compress-debug-sections.
6831         * gold/object.cc (Sized_relobj_file::do_layout): Report
6832         uncompressed size of compressed input sections.
6833
6834 2011-06-08  Cary Coutant  <ccoutant@google.com>
6835
6836         PR gold/12804
6837         * testsuite/two_file_test_2_v1.cc: Change initialization of
6838         v2 to keep it in .data.
6839
6840 2011-06-07  Cary Coutant  <ccoutant@google.com>
6841
6842         * common.cc (Symbol_table::do_allocate_commons_list): Call
6843         gold_fallback.
6844         * errors.cc (Errors::fatal): Adjust call to gold_exit.
6845         (Errors::fallback): New function.
6846         (gold_fallback): New function.
6847         * errors.h (Errors::fallback): New function.
6848         * gold.cc (gold_exit): Change status parameter to enum; adjust
6849         all callers.
6850         (queue_initial_tasks): Call gold_fallback.
6851         * gold.h: Include cstdlib.
6852         (Exit_status): New enum type.
6853         (gold_exit): Change status parameter to enum.
6854         (gold_fallback): New function.
6855         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
6856         (Layout::create_symtab_sections): Likewise.
6857         (Layout::create_shdrs): Likewise.
6858         * main.cc (main): Adjust call to gold_exit.
6859         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
6860         (Output_data_got::add_got_entry_pair): Likewise.
6861         (Output_section::add_input_section): Likewise.
6862         (Output_section::add_output_section_data): Likewise.
6863         (Output_segment::set_section_list_addresses): Likewise.
6864         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
6865
6866 2011-06-07  Cary Coutant  <ccoutant@google.com>
6867
6868         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
6869         for incremental links.
6870         * output.cc (Output_segment::set_section_list_addresses): Remove
6871         FIXME and test for TLS or BSS.
6872
6873 2011-06-07  Cary Coutant  <ccoutant@google.com>
6874
6875         * testsuite/Makefile.am: Add incremental_copy_test,
6876         incremental_common_test_1.
6877         * testsuite/Makefile.in: Regenerate.
6878         * testsuite/common_test_1_v1.c: New source file.
6879         * testsuite/common_test_1_v2.c: New source file.
6880         * testsuite/copy_test_v1.cc: New source file.
6881
6882 2011-06-07  Cary Coutant  <ccoutant@google.com>
6883
6884         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
6885         update, allocate common from bss section's free list.
6886         * incremental-dump.cc (dump_incremental_inputs): Print flag for
6887         linker-defined symbols.
6888         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
6889         Skip GOT and PLT entries that are no longer referenced.
6890         (Output_section_incremental_inputs::write_info_blocks): Mark
6891         linker-defined symbols.
6892         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
6893         * output.cc (Output_section::allocate): New function.
6894         * output.h (Output_section::allocate): New function.
6895         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
6896         linker-defined symbols.
6897         (Symbol::override_base_with_special): Copy is_predefined_ flag.
6898         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
6899         (Symbol::init_base_output_data): Likewise.
6900         (Symbol::init_base_output_segment): Likewise.
6901         (Symbol::init_base_constant): Likewise.
6902         (Sized_symbol::init_output_data): Likewise.
6903         (Sized_symbol::init_output_segment): Likewise.
6904         (Sized_symbol::init_constant): Likewise.
6905         (Symbol_table::do_define_in_output_data): Likewise.
6906         (Symbol_table::do_define_in_output_segment): Likewise.
6907         (Symbol_table::do_define_as_constant): Likewise.
6908         * symtab.h (Symbol::is_predefined): New function.
6909         (Symbol::init_base_output_data): Add is_predefined parameter.
6910         (Symbol::init_base_output_segment): Likewise.
6911         (Symbol::init_base_constant): Likewise.
6912         (Symbol::is_predefined_): New data member.
6913         (Sized_symbol::init_output_data): Add is_predefined parameter.
6914         (Sized_symbol::init_output_segment): Likewise.
6915         (Sized_symbol::init_constant): Likewise.
6916         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
6917
6918 2011-06-07  Cary Coutant  <ccoutant@google.com>
6919
6920         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
6921         instead of emit_copy_reloc.
6922         (Copy_relocs::emit_copy_reloc): Refactor.
6923         (Copy_relocs::make_copy_reloc): New function.
6924         (Copy_relocs::add_copy_reloc): Remove.
6925         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
6926         section.
6927         (Copy_relocs::make_copy_reloc): New function.
6928         (Copy_relocs::add_copy_reloc): Remove.
6929         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
6930         unchanged input files.
6931         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
6932         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
6933         Reserve BSS space for COPY relocations.
6934         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6935         (Output_section_incremental_inputs::write_info_blocks): Record
6936         whether a symbol is copied from a shared object.
6937         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
6938         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
6939         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
6940         (Incremental_input_entry_reader::get_output_symbol_index): Add
6941         is_copy parameter.
6942         (Incremental_binary::emit_copy_relocs): New function.
6943         (Incremental_binary::do_emit_copy_relocs): New function.
6944         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6945         new data member.
6946         (Sized_incremental_binary::add_copy_reloc): New function.
6947         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6948         (Sized_incremental_binary::Copy_reloc): New struct.
6949         (Sized_incremental_binary::Copy_relocs): New typedef.
6950         (Sized_incremental_binary::copy_relocs_): New data member.
6951         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
6952         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
6953         * target.h (Sized_target::emit_copy_reloc): New function.
6954         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
6955
6956 2011-06-02  Cary Coutant  <ccoutant@google.com>
6957
6958         PR gold/12163
6959         * gold/archive.cc (Archive::Archive): Initialize new data member.
6960         (Archive::include_all_members): Return if archive has already been
6961         included.
6962         * gold/archive.h (Archive::include_all_members_): New data member.
6963
6964 2011-06-02  Nick Clifton  <nickc@redhat.com>
6965
6966         * dynobj.h: Fix spelling mistake in comment.
6967         * output.cc: Likewise.
6968
6969 2011-05-31  Doug Kwan  <dougkwan@google.com>
6970             Asier Llano
6971
6972         PR gold/12826
6973         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
6974         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
6975         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
6976         redundant arm_exidx_test.so.
6977         * testsuite/Makefile.in: Regenerate.
6978         (check_SCRIPTS): Add pr12826.sh
6979         (check_DATA): Add pr12826.stdout
6980         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
6981         * testsuite/pr12826.sh: New file.
6982         * testsuite/pr12826_1.s: Ditto.
6983         * testsuite/pr12826_1.s: Ditto.
6984
6985 2011-05-30  Ian Lance Taylor  <iant@google.com>
6986
6987         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
6988         sections.
6989
6990 2011-05-29  Ian Lance Taylor  <iant@google.com>
6991
6992         PR gold/12804
6993         * testsuite/Makefile.am: Use different file name for two_file_test
6994         temporary file for each incremental test.
6995         * testsuite/Makefile.in: Rebuild.
6996
6997 2011-05-29  Ian Lance Taylor  <iant@google.com>
6998
6999         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
7000         binary input file is empty.
7001
7002 2011-05-27  Ian Lance Taylor  <iant@google.com>
7003
7004         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
7005         (ver_test_9.so): Likewise.
7006         * testsuite/Makefile.in: Rebuild.
7007
7008 2011-05-26 Cary Coutant  <ccoutant@google.com>
7009
7010         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
7011         * incremental.cc (Incremental_inputs::report_input_section): Fix
7012         comment, indentation.
7013         (Incremental_inputs::report_comdat_group): New function.
7014         (Output_section_incremental_inputs::set_final_data_size): Adjust size
7015         of data for incremental input file entry.
7016         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
7017         group count, COMDAT group signatures.
7018         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
7019         an unchanged input file.
7020         * incremental.h (Incremental_object_entry::Incremental_object_entry):
7021         Initialize new data member.
7022         (Incremental_object_entry::add_comdat_group): New function.
7023         (Incremental_object_entry::get_comdat_group_count): New function.
7024         (Incremental_object_entry::get_comdat_signature_key): New function.
7025         (Incremental_object_entry::groups_): New data member.
7026         (Incremental_inputs::report_comdat_group): New function.
7027         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
7028         data for incremental input file entry.
7029         (Incremental_input_entry_reader::get_comdat_group_count): New function.
7030         (Incremental_input_entry_reader::get_input_section): Adjust size of
7031         data for incremental input file entry.
7032         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
7033         (Incremental_input_entry_reader::get_comdat_group_signature): New
7034         function.
7035         * object.cc (Sized_relobj::include_section_group): Report kept
7036         COMDAT groups for incremental links.
7037
7038 2011-05-24  David Meyer  <pdox@google.com>
7039
7040         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
7041         with name parameter.  Add found_name parameter.
7042         * fileread.cc (Input_file::find_file): Adjust code accordingly.
7043         * dirsearch.h (class Dirsearch): Update declaration.
7044
7045 2011-05-24  Ian Lance Taylor  <iant@google.com>
7046
7047         * archive.cc (Library_base::should_include_member): Pull in object
7048         from archive if it defines the entry symbol.
7049         * parameters.cc (Parameters::entry): New function.
7050         * parameters.h (class Parameters): Declare entry.
7051         * output.h (class Output_file_header): Remove entry_ field.
7052         * output.cc (Output_file_header::Output_file_header): Remove entry
7053         parameter.  Change all callers.
7054         (Output_file_header::entry): Use parameters->entry.
7055         * gold.cc (queue_middle_tasks): Likewise.
7056         * plugin.cc (Plugin_hook::run): Likewise.
7057
7058 2011-05-24 Cary Coutant  <ccoutant@google.com>
7059
7060         * gold.cc (queue_initial_tasks): Pass incremental base filename
7061         to Output_file::open_base_file; don't print error message.
7062         * incremental-dump.cc (main): Adjust call to
7063         Output_file::open_for_modification.
7064         * incremental-dump.cc (main): Likewise.
7065         * incremental.cc (Incremental_inputs::report_command_line):
7066         Ignore --incremental-base option when comparing command lines.
7067         Ignore parameter when given as separate argument.
7068         * options.h (class General_options): Add --incremental-base.
7069         * output.cc (Output_file::Output_file):
7070         (Output_file::open_base_file): Add base_name and writable parameters;
7071         read base file into new file; print error message here.
7072         (Output_file::map_no_anonymous): Add writable parameter; adjust all
7073         callers.
7074         * output.h (Output_file::open_for_modification): Rename to...
7075         (Output_file::open_base_file): ...this; add base_name and
7076         writable parameters; adjust all callers.
7077         (Output_file::map_no_anonymous): Add writable parameter; adjust all
7078         callers.
7079         * testsuite/Makefile.am (incremental_test_4): Test
7080         --incremental-base.
7081         * testsuite/Makefile.in: Regenerate.
7082
7083 2011-05-24 Cary Coutant  <ccoutant@google.com>
7084
7085         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
7086         incremental_test_4.
7087         * testsuite/Makefile.in: Regenerate.
7088         * testsuite/two_file_test_1_v1.cc: New test source file.
7089         * testsuite/two_file_test_1b_v1.cc: New test source file.
7090         * testsuite/two_file_test_2_v1.cc: New test source file.
7091
7092 2011-05-24 Cary Coutant  <ccoutant@google.com>
7093
7094         * dynobj.h (Dynobj::do_dynobj): New function.
7095         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
7096         flag and soname for shared objects.
7097         * incremental.cc (Incremental_inputs::report_object): Make
7098         either Incremental_object_entry or Incremental_dynobj_entry; add
7099         soname to string table.
7100         (Incremental_inputs::report_input_section): Add assertion.
7101         (Output_section_incremental_inputs::set_final_data_size): Adjust
7102         type of input file entry for shared libraries; adjust size of
7103         shared library info entry.
7104         (Output_section_incremental_inputs::write_input_files): Write
7105         as_needed flag for shared libraries.
7106         (Output_section_incremental_inputs::write_info_blocks): Adjust type
7107         of input file entry for shared libraries; write soname.
7108         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
7109         soname from incremental info.
7110         * incremental.h (enum Incremental_input_flags): Add
7111         INCREMENTAL_INPUT_AS_NEEDED.
7112         (Incremental_input_entry::Incremental_input_entry): Initialize new
7113         data member.
7114         (Incremental_input_entry::set_as_needed): New function.
7115         (Incremental_input_entry::as_needed): New function.
7116         (Incremental_input_entry::do_dynobj_entry): New function.
7117         (Incremental_input_entry::as_needed_): New data member.
7118         (Incremental_object_entry::Incremental_object_entry): Don't check
7119         for shared library.
7120         (Incremental_object_entry::do_type): Likewise.
7121         (class Incremental_dynobj_entry): New class.
7122         (Incremental_input_entry_reader::as_needed): New function.
7123         (Incremental_input_entry_reader::get_soname): New function.
7124         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
7125         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
7126         size of shared library info entry.
7127         * layout.cc (Layout::finish_dynamic_section): Don't test for
7128         incremental link when adding DT_NEEDED entries.
7129         * object.h (Object::Object): Initialize new data member.
7130         (Object::dynobj): New function.
7131         (Object::set_as_needed): New function.
7132         (Object::as_needed): New function.
7133         (Object::do_dynobj): New function.
7134         (Object::as_needed_): New data member.
7135
7136 2011-05-24 Cary Coutant  <ccoutant@google.com>
7137
7138         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
7139         info; adjust display of GOT entries.
7140         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7141         vector of input objects; remove file_status_.
7142         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
7143         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
7144         got_plt reader; call target hooks to reserve GOT entries.
7145         (Output_section_incremental_inputs::set_final_data_size): Adjust size
7146         of input file info header and GOT info entry.
7147         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
7148         relocation info.
7149         (Got_plt_view_info::got_descriptor): Remove.
7150         (Got_plt_view_info::sym_index): New data member.
7151         (Got_plt_view_info::input_index): New data member.
7152         (Local_got_offset_visitor::visit): Write input file index.
7153         (Global_got_offset_visitor::visit): Write 0 for input file index.
7154         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
7155         with sym_index and input_index.
7156         (Output_section_incremental_inputs::write_got_plt): Adjust size of
7157         incremental info GOT entry; replace got_descriptor with input_index.
7158         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
7159         map from input file index to object.
7160         (Sized_relobj_incr::do_layout): Replace direct data member reference
7161         with accessor function.
7162         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
7163         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
7164         Adjust size of input file info header.
7165         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
7166         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
7167         (Incremental_input_entry_reader::get_input_section): Adjust size of
7168         input file info header.
7169         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
7170         of incremental info GOT entry.
7171         (Incremental_got_plt_reader::get_got_desc): Remove.
7172         (Incremental_got_plt_reader::get_got_symndx): New function.
7173         (Incremental_got_plt_reader::get_got_input_index): New function.
7174         (Sized_incremental_binary::Sized_incremental_binary): Remove
7175         file_status_; add input_objects_.
7176         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
7177         (Sized_incremental_binary::set_file_is_unchanged): Remove.
7178         (Sized_incremental_binary::file_is_unchanged): Remove.
7179         (Sized_incremental_binary::set_input_object): New function.
7180         (Sized_incremental_binary::input_object): New function.
7181         (Sized_incremental_binary::file_status_): Remove.
7182         (Sized_incremental_binary::input_objects_): New data member.
7183         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
7184         references.
7185         (Sized_relobj_incr::invalid_address): Move to base class.
7186         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
7187         class.
7188         (Sized_relobj_incr::do_output_section_offset): Likewise.
7189         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
7190         (Sized_relobj_incr::section_offsets_): Likewise.
7191         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
7192         function.
7193         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
7194         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
7195         with accessor function.
7196         (Sized_relobj_file::do_layout): Likewise.
7197         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
7198         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
7199         (Sized_relobj_file::compute_final_local_value): Replace refs to
7200         section_offsets_ with accessor function.
7201         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
7202         * object.h (Relobj::Relobj): Initialize new data members.
7203         (Relobj::add_dyn_reloc): New function.
7204         (Relobj::first_dyn_reloc): New function.
7205         (Relobj::dyn_reloc_count): New function.
7206         (Relobj::first_dyn_reloc_): New data member.
7207         (Relobj::dyn_reloc_count_): New data member.
7208         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
7209         references.
7210         (Sized_relobj::Address): New typedef.
7211         (Sized_relobj::invalid_address): Move here from child class.
7212         (Sized_relobj::Sized_relobj): Initialize new data members.
7213         (Sized_relobj::sized_relobj): New function.
7214         (Sized_relobj::is_output_section_offset_invalid): Move here from
7215         child class.
7216         (Sized_relobj::get_output_section_offset): Likewise.
7217         (Sized_relobj::local_has_got_offset): Likewise.
7218         (Sized_relobj::local_got_offset): Likewise.
7219         (Sized_relobj::set_local_got_offset): Likewise.
7220         (Sized_relobj::do_for_all_local_got_entries): Likewise.
7221         (Sized_relobj::clear_got_offsets): New function.
7222         (Sized_relobj::section_offsets): Move here from child class.
7223         (Sized_relobj::do_output_section_offset): Likewise.
7224         (Sized_relobj::do_set_section_offset): Likewise.
7225         (Sized_relobj::Local_got_offsets): Likewise.
7226         (Sized_relobj::local_got_offsets_): Likewise.
7227         (Sized_relobj::section_offsets_): Likewise.
7228         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
7229         references.
7230         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
7231         class.
7232         (Sized_relobj_file::sized_relobj): New function
7233         (Sized_relobj_file::local_has_got_offset): Move to base class.
7234         (Sized_relobj_file::local_got_offset): Likewise.
7235         (Sized_relobj_file::set_local_got_offset): Likewise.
7236         (Sized_relobj_file::get_output_section_offset): Likewise.
7237         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
7238         (Sized_relobj_file::do_output_section_offset): Likewise.
7239         (Sized_relobj_file::do_set_section_offset): Likewise.
7240         (Sized_relobj_file::Local_got_offsets): Likewise.
7241         (Sized_relobj_file::local_got_offsets_): Likewise.
7242         (Sized_relobj_file::section_offsets_): Likewise.
7243         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
7244         (all constructors).
7245         (set_needs_dynsym_index): Convert relobj to derived class pointer.
7246         (Output_reloc::get_symbol_index): Likewise.
7247         (Output_reloc::local_section_offset): Likewise.
7248         (Output_reloc::get_address): Likewise.
7249         (Output_reloc::symbol_value): Likewise.
7250         (Output_data_got::reserve_slot): Move to class definition.
7251         (Output_data_got::reserve_local): New function.
7252         (Output_data_got::reserve_slot_for_global): Remove.
7253         (Output_data_got::reserve_global): New function.
7254         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
7255         (all constructors, two instantiations).
7256         (Output_reloc::get_relobj): New function (two instantiations).
7257         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
7258         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
7259         (Output_data_reloc::add_global): Adjust type of relobj.
7260         (Output_data_reloc::add_global_relative): Likewise.
7261         (Output_data_reloc::add_symbolless_global_addend): Likewise.
7262         (Output_data_reloc::add_local): Likewise.
7263         (Output_data_reloc::add_local_relative): Likewise.
7264         (Output_data_reloc::add_symbolless_local_addend): Likewise.
7265         (Output_data_reloc::add_local_section): Likewise.
7266         (Output_data_reloc::add_output_section): Likewise.
7267         (Output_data_reloc::add_absolute): Likewise.
7268         (Output_data_reloc::add_target_specific): Likewise.
7269         (Output_data_got::reserve_slot): Move definition here.
7270         (Output_data_got::reserve_local): New function.
7271         (Output_data_got::reserve_global): New function.
7272         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
7273         section_offsets_ with accessor function.
7274         (Sized_relobj_file::write_sections): Likewise.
7275         (Sized_relobj_file::do_relocate_sections): Likewise.
7276         * target.h (Sized_target::reserve_local_got_entry): New function.
7277         (Sized_target::reserve_global_got_entry): New function.
7278         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
7279         (Target_x86_64::reserve_global_got_entry): New function.
7280         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
7281
7282 2011-05-23 Cary Coutant  <ccoutant@google.com>
7283
7284         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
7285         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
7286         bit when checking got_type.
7287         * incremental.cc (Sized_incremental_binary::setup_readers):
7288         Store symbol table and string table locations; initialize bit vector
7289         of file status flags.
7290         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
7291         unchanged files.
7292         (Sized_incremental_binary::do_process_got_plt): New function.
7293         (Sized_incremental_binary::get_symtab_view): Use stored locations.
7294         (Output_section_incremental_inputs::set_final_data_size): Record
7295         file index for each input file.
7296         (Output_section_incremental_inputs::write_got_plt): Store file index
7297         instead of input entry offset for each GOT entry.
7298         * incremental.h
7299         (Incremental_input_entry::Incremental_input_entry): Initialize new
7300         data member.
7301         (Incremental_input_entry::set_offset): Store file index.
7302         (Incremental_input_entry::get_file_index): New function.
7303         (Incremental_input_entry::file_index_): New data member.
7304         (Incremental_binary::process_got_plt): New function.
7305         (Incremental_binary::do_process_got_plt): New function.
7306         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7307         data members.
7308         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
7309         (Sized_incremental_binary::set_file_is_unchanged): New function.
7310         (Sized_incremental_binary::file_is_unchanged): New function.
7311         (Sized_incremental_binary::do_process_got_plt): New function.
7312         (Sized_incremental_binary::file_status_): New data member.
7313         (Sized_incremental_binary::main_symtab_loc_): New data member.
7314         (Sized_incremental_binary::main_strtab_loc_): New data member.
7315         * output.cc (Output_data_got::Got_entry::write): Add case
7316         RESERVED_CODE.
7317         (Output_data_got::add_global): Call add_got_entry.
7318         (Output_data_got::add_global_plt): Likewise.
7319         (Output_data_got::add_global_with_rel): Likewise.
7320         (Output_data_got::add_global_with_rela): Likewise.
7321         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
7322         (Output_data_got::add_global_pair_with_rela): Likewise.
7323         (Output_data_got::add_local): Call add_got_entry.
7324         (Output_data_got::add_local_plt): Likewise.
7325         (Output_data_got::add_local_with_rel): Likewise.
7326         (Output_data_got::add_local_with_rela): Likewise.
7327         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
7328         (Output_data_got::add_local_pair_with_rela): Likewise.
7329         (Output_data_got::reserve_slot): New function.
7330         (Output_data_got::reserve_slot_for_global): New function.
7331         (Output_data_got::add_got_entry): New function.
7332         (Output_data_got::add_got_entry_pair): New function.
7333         (Output_section::add_output_section_data): Edit FIXME.
7334         * output.h
7335         (Output_section_data_build::Output_section_data_build): New
7336         constructor with size parameter.
7337         (Output_data_space::Output_data_space): Likewise.
7338         (Output_data_got::Output_data_got): Initialize new data member; new
7339         constructor with size parameter.
7340         (Output_data_got::add_constant): Call add_got_entry.
7341         (Output_data_got::reserve_slot): New function.
7342         (Output_data_got::reserve_slot_for_global): New function.
7343         (class Output_data_got::Got_entry): Add RESERVED_CODE.
7344         (Output_data_got::add_got_entry): New function.
7345         (Output_data_got::add_got_entry_pair): New function.
7346         (Output_data_got::free_list_): New data member.
7347         * target.h (Sized_target::init_got_plt_for_update): New function.
7348         (Sized_target::register_global_plt_entry): New function.
7349         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
7350         Initialize new data member; call init; add constructor with PLT count.
7351         (Output_data_plt_x86_64::init): New function.
7352         (Output_data_plt_x86_64::add_relocation): New function.
7353         (Output_data_plt_x86_64::reserve_slot): New function.
7354         (Output_data_plt_x86_64::free_list_): New data member.
7355         (Target_x86_64::init_got_plt_for_update): New function.
7356         (Target_x86_64::register_global_plt_entry): New function.
7357         (Output_data_plt_x86_64::add_entry): Allocate from free list for
7358         incremental updates.
7359         (Output_data_plt_x86_64::add_relocation): New function.
7360         * testsuite/object_unittest.cc (Object_test): Set default options.
7361
7362 2011-05-16  Ian Lance Taylor  <iant@google.com>
7363
7364         * options.h (class General_options): Make -i a synonym for -r.
7365
7366 2011-05-16  Ian Lance Taylor  <iant@google.com>
7367
7368         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
7369
7370 2011-05-10 Cary Coutant  <ccoutant@google.com>
7371
7372         * object.cc (Sized_relobj::do_count_local_symbols): Check for
7373         strip_all (-s).
7374
7375 2011-05-06  Ian Lance Taylor  <iant@google.com>
7376
7377         * layout.cc (Layout::layout): If the output section flags change,
7378         update the ordering.
7379
7380 2011-04-25 Cary Coutant  <ccoutant@google.com>
7381
7382         * incremental-dump.cc (dump_incremental_inputs): Print local
7383         symbol info for each input file.
7384         * incremental.cc
7385         (Output_section_incremental_inputs::set_final_data_size): Add local
7386         symbol info to input file entries in incremental info.
7387         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7388         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
7389         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
7390         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
7391         implementation.
7392         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
7393         (Sized_incr_relobj::do_relocate): Write the local symbols.
7394         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
7395         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
7396         Adjust size of input file header.
7397         (Incremental_inputs_reader::get_local_symbol_offset): New function.
7398         (Incremental_inputs_reader::get_local_symbol_count): New function.
7399         (Incremental_inputs_reader::get_input_section): Adjust size of input
7400         file header.
7401         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
7402         (Sized_incr_relobj::This): New typedef.
7403         (Sized_incr_relobj::sym_size): New const data member.
7404         (Sized_incr_relobj::Local_symbol): New struct.
7405         (Sized_incr_relobj::do_output_local_symbol_count): New function.
7406         (Sized_incr_relobj::do_local_symbol_offset): New function.
7407         (Sized_incr_relobj::local_symbol_count_): New data member.
7408         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
7409         (Sized_incr_relobj::local_symbol_index_): New data member.
7410         (Sized_incr_relobj::local_symbol_offset_): New data member.
7411         (Sized_incr_relobj::local_dynsym_offset_): New data member.
7412         (Sized_incr_relobj::local_symbols_): New data member.
7413         * object.h (Relobj::output_local_symbol_count): New function.
7414         (Relobj::local_symbol_offset): New function.
7415         (Relobj::do_output_local_symbol_count): New function.
7416         (Relobj::do_local_symbol_offset): New function.
7417         (Sized_relobj::do_output_local_symbol_count): New function.
7418         (Sized_relobj::do_local_symbol_offset): New function.
7419
7420 2011-04-22  Vladimir Simonov  <sv@sw.ru>
7421
7422         * descriptors.cc (set_close_on_exec): New function.
7423         (Descriptors::open): Use set_close_on_exec.
7424         * output.cc (S_ISLNK): Define if not defined.
7425
7426 2011-04-22 Cary Coutant  <ccoutant@google.com>
7427
7428         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7429         global symbol map.
7430         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7431         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
7432         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
7433         relocations.
7434         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
7435         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
7436         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
7437         * incremental.h
7438         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
7439         function.
7440         (Incremental_binary::apply_incremental_relocs): New function.
7441         (Incremental_binary::do_apply_incremental_relocs): New function.
7442         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7443         data member.
7444         (Sized_incremental_binary::add_global_symbol): New function.
7445         (Sized_incremental_binary::global_symbol): New function.
7446         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7447         (Sized_incremental_binary::symbol_map_): New data member.
7448         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
7449         * target.h (Sized_target::apply_relocation): New function.
7450         * target-reloc.h (apply_relocation): New function.
7451         * x86_64.cc (Target_x86_64::apply_relocation): New function.
7452
7453 2011-04-22  Doug Kwan  <dougkwan@google.com>
7454
7455         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
7456         flag of a SHT_ARM_EXIDX section.
7457         * testsuite/Makefile.am (arm_exidx_test): New test rules.
7458         * testsuite/Makefile.in: Regenerate.
7459         * testsuite/arm_exidx_test.s: New file.
7460         * testsuite/arm_exidx_test.sh: Same.
7461
7462 2011-04-20 Cary Coutant  <ccoutant@google.com>
7463
7464         PR gold/12689
7465         * archive.h (Incremental_archive_entry::Archive_member):
7466         Initialize arg_serial_ (second constructor).
7467
7468 2011-04-17  Ian Lance Taylor  <iant@google.com>
7469
7470         * object.cc (Relocate_info::location): Simplify location string.
7471         * errors.cc (Errors::error_at_location): Don't print program
7472         name.
7473         (Errors::warning_at_location): Likewise.
7474         (Errors::undefined_symbol): Likewise.
7475         * testsuite/debug_msg.sh: Update accordingly.
7476
7477 2011-04-14 Cary Coutant  <ccoutant@google.com>
7478
7479         * gold/layout.cc (Layout::symtab_section_offset): New function.
7480         * gold/layout.h (Layout::symtab_section_offset): New function.
7481         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
7482
7483 2011-04-12  Ian Lance Taylor  <iant@google.com>
7484
7485         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
7486         with MREMAP_MAYMOVE.
7487         * output.h (class Output_file): Add map_is_allocated_ field.
7488         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
7489         not available, provide stubs.  If mremap is not available, #define
7490         it to gold_mremap.
7491         (MREMAP_MAYMOVE): Define if not defined.
7492         (Output_file::Output_file): Initialize map_is_allocated_.
7493         (Output_file::resize): Check map_is_allocated_.
7494         (Output_file::map_anonymous): If mmap fails, use malloc.
7495         (Output_file::unmap): Don't do anything for an anonymous map.
7496         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
7497         is not available, provide stubs.
7498         (File_read::View::~View): Use free rather than delete[].
7499         (File_read::make_view): Use malloc rather than new[].  If mmap
7500         fails, use malloc.
7501         (File_read::find_or_make_view): Use malloc rather than new[].
7502         * gold.h: Remove HAVE_REMAP code.
7503         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
7504         exists.  Rename mremap to gold_mremap.  If mmap is not available
7505         don't do anything.
7506         * configure, config.in: Rebuild.
7507
7508 2011-04-11  Ian Lance Taylor  <iant@google.com>
7509
7510         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
7511         initialize local variable v.
7512
7513 2011-04-11  Cary Coutant  <ccoutant@google.com>
7514
7515         * archive.cc (Archive::include_member): Adjust call to
7516         report_object.
7517         (Add_archive_symbols::run): Track argument serial numbers.
7518         (Lib_group::include_member): Likewise.
7519         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
7520         * archive.h (Incremental_archive_entry::Archive_member):
7521         Initialize arg_serial_.
7522         (Archive_member::arg_serial_): New data member.
7523         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
7524         (Sized_dynobj::do_add_symbols): Track symbols when doing an
7525         incremental link.
7526         (Sized_dynobj::do_for_all_local_got_entries): New function.
7527         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
7528         function.
7529         * fileread.cc (get_mtime): New function.
7530         * fileread.h (get_mtime): New function.
7531         * gold.cc (queue_initial_tasks): Check for incremental update.
7532         (process_incremental_input): New function.
7533         (queue_middle_tasks): Don't force valid target for incremental
7534         update.
7535         * incremental-dump.cc (find_input_containing_global): Adjust
7536         size of symbol info entry.
7537         (dump_incremental_inputs): Dump argument serial number and
7538         in_system_directory flag; bias shndx by 1; print symbol names
7539         when dumping per-file symbol lists; use new symbol info readers.
7540         * incremental.cc
7541         (Output_section_incremental_inputs:update_data_size): New function.
7542         (Sized_incremental_binary::setup_readers): Setup input readers
7543         for each input file; build maps for files added from libraries
7544         and scripts.
7545         (Sized_incremental_binary::check_input_args): New function.
7546         (Sized_incremental_binary::do_check_inputs): Build map of argument
7547         serial numbers to input arguments.
7548         (Sized_incremental_binary::do_file_has_changed): Rename
7549         do_file_is_unchanged to this; compare file modification times.
7550         (Sized_incremental_binary::do_init_layout): New function.
7551         (Sized_incremental_binary::do_reserve_layout): New function.
7552         (Sized_incremental_binary::do_get_input_reader): Remove.
7553         (Sized_incremental_binary::get_symtab_view): New function.
7554         (Incremental_checker::can_incrementally_link_output_file): Remove.
7555         (Incremental_inputs::report_command_line): Exclude --debug options.
7556         (Incremental_inputs::report_archive_begin): Add parameter; track
7557         argument serial numbers; don't put input file entry for archive
7558         before archive members.
7559         (Incremental_inputs::report_archive_end): Put input file entry
7560         for archive after archive members.
7561         (Incremental_inputs::report_object): Add parameter; track argument
7562         serial numbers and in_system_directory flag.
7563         (Incremental_inputs::report_script): Add parameter; track argument
7564         serial numbers.
7565         (Output_section_incremental_inputs::set_final_data_size): Adjust
7566         size of symbol info entry; check for forwarding symbols.
7567         (Output_section_incremental_inputs::write_input_files): Write
7568         in_system_directory flag and argument serial number.
7569         (Output_section_incremental_inputs::write_info_blocks): Map section
7570         indices between incremental info and original input file; store
7571         input section index for each symbol.
7572         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
7573         change operator() to visit().
7574         (class Global_got_offset_visitor): Likewise.
7575         (class Global_symbol_visitor_got_plt):
7576         (Output_section_incremental_inputs::write_got_plt): Use new visitor
7577         classes.
7578         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
7579         (Sized_incr_relobj::do_read_symbols): New function.
7580         (Sized_incr_relobj::do_layout): New function.
7581         (Sized_incr_relobj::do_layout_deferred_sections): New function.
7582         (Sized_incr_relobj::do_add_symbols): New function.
7583         (Sized_incr_relobj::do_should_include_member): New function.
7584         (Sized_incr_relobj::do_for_all_global_symbols): New function.
7585         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
7586         (Sized_incr_relobj::do_section_size): New function.
7587         (Sized_incr_relobj::do_section_name): New function.
7588         (Sized_incr_relobj::do_section_contents): New function.
7589         (Sized_incr_relobj::do_section_flags): New function.
7590         (Sized_incr_relobj::do_section_entsize): New function.
7591         (Sized_incr_relobj::do_section_address): New function.
7592         (Sized_incr_relobj::do_section_type): New function.
7593         (Sized_incr_relobj::do_section_link): New function.
7594         (Sized_incr_relobj::do_section_info): New function.
7595         (Sized_incr_relobj::do_section_addralign): New function.
7596         (Sized_incr_relobj::do_initialize_xindex): New function.
7597         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
7598         (Sized_incr_relobj::do_read_relocs): New function.
7599         (Sized_incr_relobj::do_gc_process_relocs): New function.
7600         (Sized_incr_relobj::do_scan_relocs): New function.
7601         (Sized_incr_relobj::do_count_local_symbols): New function.
7602         (Sized_incr_relobj::do_finalize_local_symbols): New function.
7603         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
7604         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
7605         (Sized_incr_relobj::do_relocate): New function.
7606         (Sized_incr_relobj::do_set_section_offset): New function.
7607         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
7608         (Sized_incr_dynobj::do_read_symbols): New function.
7609         (Sized_incr_dynobj::do_layout): New function.
7610         (Sized_incr_dynobj::do_add_symbols): New function.
7611         (Sized_incr_dynobj::do_should_include_member): New function.
7612         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
7613         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
7614         (Sized_incr_dynobj::do_section_size): New function.
7615         (Sized_incr_dynobj::do_section_name): New function.
7616         (Sized_incr_dynobj::do_section_contents): New function.
7617         (Sized_incr_dynobj::do_section_flags): New function.
7618         (Sized_incr_dynobj::do_section_entsize): New function.
7619         (Sized_incr_dynobj::do_section_address): New function.
7620         (Sized_incr_dynobj::do_section_type): New function.
7621         (Sized_incr_dynobj::do_section_link): New function.
7622         (Sized_incr_dynobj::do_section_info): New function.
7623         (Sized_incr_dynobj::do_section_addralign): New function.
7624         (Sized_incr_dynobj::do_initialize_xindex): New function.
7625         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
7626         (make_sized_incremental_object): New function.
7627         (Incremental_library::copy_unused_symbols): New function.
7628         (Incremental_library::do_for_all_unused_symbols): New function.
7629         * incremental.h (enum Incremental_input_flags): New type.
7630         (class Incremental_checker): Remove.
7631         (Incremental_input_entry::Incremental_input_entry): Add argument
7632         serial number.
7633         (Incremental_input_entry::arg_serial): New function.
7634         (Incremental_input_entry::set_is_in_system_directory): New function.
7635         (Incremental_input_entry::is_in_system_directory): New function.
7636         (Incremental_input_entry::arg_serial_): New data member.
7637         (Incremental_input_entry::is_in_system_directory_): New data member.
7638         (class Script_info): Move here from script.h.
7639         (Script_info::Script_info): Add filename parameter.
7640         (Script_info::filename): New function.
7641         (Script_info::filename_): New data member.
7642         (Incremental_script_entry::Incremental_script_entry): Add argument
7643         serial number.
7644         (Incremental_object_entry::Incremental_object_entry): Likewise.
7645         (Incremental_object_entry::add_input_section): Build list of input
7646         sections with map to original shndx.
7647         (Incremental_object_entry::get_input_section_index): New function.
7648         (Incremental_object_entry::shndx_): New data member.
7649         (Incremental_object_entry::name_key_): Rename; adjust all refs.
7650         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
7651         (Incremental_archive_entry::Incremental_archive_entry): Add argument
7652         serial number.
7653         (Incremental_inputs::report_archive_begin): Likewise.
7654         (Incremental_inputs::report_object): Likewise.
7655         (Incremental_inputs::report_script): Likewise.
7656         (class Incremental_global_symbol_reader): New class.
7657         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
7658         and store flags and input file type.
7659         (Incremental_input_entry_reader::arg_serial): New function.
7660         (Incremental_input_entry_reader::type): Extract type from flags.
7661         (Incremental_input_entry_reader::is_in_system_directory): New function.
7662         (Incremental_input_entry_reader::get_input_section_count): Call
7663         accessor function for type.
7664         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
7665         function for type; adjust size of global symbol entry.
7666         (Incremental_input_entry_reader::get_global_symbol_count): Call
7667         accessor function for type.
7668         (Incremental_input_entry_reader::get_object_count): Likewise.
7669         (Incremental_input_entry_reader::get_object_offset): Likewise.
7670         (Incremental_input_entry_reader::get_member_count): Likewise.
7671         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
7672         (Incremental_input_entry_reader::get_member_offset): Likewise.
7673         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
7674         (Incremental_input_entry_reader::Global_symbol_info): Remove.
7675         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
7676         (Incremental_input_entry_reader::get_global_symbol_reader): New
7677         function.
7678         (Incremental_input_entry_reader::get_output_symbol_index): New
7679         function.
7680         (Incremental_input_entry_reader::type_): Remove.
7681         (Incremental_input_entry_reader::flags_): New data member.
7682         (Incremental_inputs_reader::input_file_offset): New function.
7683         (Incremental_inputs_reader::input_file_index): New function.
7684         (Incremental_inputs_reader::input_file): Call input_file_offset.
7685         (Incremental_inputs_reader::input_file_at_offset): New function.
7686         (Incremental_relocs_reader::get_r_type): Reformat.
7687         (Incremental_relocs_reader::get_r_shndx): Reformat.
7688         (Incremental_relocs_reader::get_r_offset): Reformat.
7689         (Incremental_relocs_reader::data): New function.
7690         (Incremental_binary::Incremental_binary): Initialize new data members.
7691         (Incremental_binary::check_inputs): Add cmdline parameter.
7692         (Incremental_binary::file_is_unchanged): Remove.
7693         (Input_reader::arg_serial): New function.
7694         (Input_reader::get_unused_symbol_count): New function.
7695         (Input_reader::get_unused_symbol): New function.
7696         (Input_reader::do_arg_serial): New function.
7697         (Input_reader::do_get_unused_symbol_count): New function.
7698         (Input_reader::do_get_unused_symbol): New function.
7699         (Incremental_binary::input_file_count): New function.
7700         (Incremental_binary::get_input_reader): Change signature to use
7701         index instead of filename.
7702         (Incremental_binary::file_has_changed): New function.
7703         (Incremental_binary::get_input_argument): New function.
7704         (Incremental_binary::get_library): New function.
7705         (Incremental_binary::get_script_info): New function.
7706         (Incremental_binary::init_layout): New function.
7707         (Incremental_binary::reserve_layout): New function.
7708         (Incremental_binary::output_file): New function.
7709         (Incremental_binary::do_check_inputs): New function.
7710         (Incremental_binary::do_file_is_unchanged): Remove.
7711         (Incremental_binary::do_file_has_changed): New function.
7712         (Incremental_binary::do_init_layout): New function.
7713         (Incremental_binary::do_reserve_layout): New function.
7714         (Incremental_binary::do_input_file_count): New function.
7715         (Incremental_binary::do_get_input_reader): Change signature.
7716         (Incremental_binary::input_args_map_): New data member.
7717         (Incremental_binary::library_map_): New data member.
7718         (Incremental_binary::script_map_): New data member.
7719         (Sized_incremental_binary::Sized_incremental_binary): Initialize
7720         new data members.
7721         (Sized_incremental_binary::output_section): New function.
7722         (Sized_incremental_binary::inputs_reader): Add const.
7723         (Sized_incremental_binary::symtab_reader): Add const.
7724         (Sized_incremental_binary::relocs_reader): Add const.
7725         (Sized_incremental_binary::got_plt_reader): Add const.
7726         (Sized_incremental_binary::get_symtab_view): New function.
7727         (Sized_incremental_binary::Inputs_reader): New typedef.
7728         (Sized_incremental_binary::Input_entry_reader): New typedef.
7729         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
7730         (Sized_incremental_binary::do_file_is_unchanged): Remove.
7731         (Sized_incremental_binary::do_file_has_changed): New function.
7732         (Sized_incremental_binary::do_init_layout): New function.
7733         (Sized_incremental_binary::do_reserve_layout): New function.
7734         (Sized_input_reader::Inputs_reader): Remove.
7735         (Sized_input_reader::Input_entry_reader): Remove.
7736         (Sized_input_reader::do_arg_serial): New function.
7737         (Sized_input_reader::do_get_unused_symbol_count): New function.
7738         (Sized_input_reader::do_get_unused_symbol): New function.
7739         (Sized_incremental_binary::do_input_file_count): New function.
7740         (Sized_incremental_binary::do_get_input_reader): Change signature;
7741         use index instead of filename.
7742         (Sized_incremental_binary::section_map_): New data member.
7743         (Sized_incremental_binary::input_entry_readers_): New data member.
7744         (class Sized_incr_relobj): New class.
7745         (class Sized_incr_dynobj): New class.
7746         (make_sized_incremental_object): New function.
7747         (class Incremental_library): New class.
7748         * layout.cc (Free_list::num_lists): New static data member.
7749         (Free_list::num_nodes): New static data member.
7750         (Free_list::num_removes): New static data member.
7751         (Free_list::num_remove_visits): New static data member.
7752         (Free_list::num_allocates): New static data member.
7753         (Free_list::num_allocate_visits): New static data member.
7754         (Free_list::init): New function.
7755         (Free_list::remove): New function.
7756         (Free_list::allocate): New function.
7757         (Free_list::dump): New function.
7758         (Free_list::print_stats): New function.
7759         (Layout_task_runner::run): Resize output file for incremental updates.
7760         (Layout::Layout): Initialize new data members.
7761         (Layout::set_incremental_base): New function.
7762         (Layout::init_fixed_output_section): New function.
7763         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
7764         incremental updates.
7765         (Layout::create_gold_note): Do not create gold note section for
7766         incremental updates.
7767         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
7768         for incremental updates.
7769         (Layout::set_section_offsets): For incremental updates, allocate space
7770         from free list.
7771         (Layout::create_symtab_sections): Layout with offsets relative to
7772         start of section; for incremental updates, allocate space from free
7773         list.
7774         (Layout::create_shdrs): For incremental updates, allocate space from
7775         free list.
7776         (Layout::finish_dynamic_section): For incremental updates, do not
7777         check --as-needed (fixed in subsequent patch).
7778         * layout.h (class Free_list): New class.
7779         (Layout::set_incremental_base): New function.
7780         (Layout::incremental_base): New function.
7781         (Layout::init_fixed_output_section): New function.
7782         (Layout::allocate): New function.
7783         (Layout::incremental_base_): New data member.
7784         (Layout::free_list_): New data member.
7785         * main.cc (main): Print Free_list statistics.
7786         * object.cc (Relobj::finalize_incremental_relocs): Add
7787         clear_counts parameter; clear counts only when clear_counts is set.
7788         (Sized_relobj::Sized_relobj): Initialize new base class.
7789         (Sized_relobj::do_layout): Don't report special sections.
7790         (Sized_relobj::do_for_all_local_got_entries): New function.
7791         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
7792         symtab_off to all symbol table offsets.
7793         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
7794         * object.h (class Got_offset_list): Move to top of file.
7795         (Object::Object): Allow case where input_file == NULL.
7796         (Object::~Object): Likewise.
7797         (Object::input_file): Assert that input_file != NULL.
7798         (Object::lock): Allow case where input_file == NULL.
7799         (Object::unlock): Likewise.
7800         (Object::is_locked): Likewise.
7801         (Object::token): Likewise.
7802         (Object::release): Likewise.
7803         (Object::is_incremental): New function.
7804         (Object::get_mtime): New function.
7805         (Object::for_all_local_got_entries): New function.
7806         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
7807         (Object::set_is_in_system_directory): New function.
7808         (Object::is_in_system_directory): New function.
7809         (Object::do_is_incremental): New function.
7810         (Object::do_get_mtime): New function.
7811         (Object::do_for_all_local_got_entries): New function.
7812         (Object::is_in_system_directory_): New data member.
7813         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
7814         (class Sized_relobj_base): New class.
7815         (class Sized_relobj): Derive from Sized_relobj_base.
7816         (class Sized_relobj::Symbols): Redeclare from base class.
7817         (class Sized_relobj::local_got_offset_list): Remove.
7818         (class Sized_relobj::Output_sections): Redeclare from base class.
7819         (class Sized_relobj::do_for_all_local_got_entries): New function.
7820         (class Sized_relobj::write_local_symbols): Add offset parameter.
7821         (class Sized_relobj::local_symbol_offset_): Update comment.
7822         (class Sized_relobj::local_dynsym_offset_): Update comment.
7823         * options.cc (Input_arguments::add_file): Remove const.
7824         * options.h (Input_file_argument::Input_file_argument):
7825         Initialize arg_serial_ (all constructors).
7826         (Input_file_argument::set_arg_serial): New function.
7827         (Input_file_argument::arg_serial): New function.
7828         (Input_file_argument::arg_serial_): New data member.
7829         (Input_arguments::Input_arguments): Initialize file_count_.
7830         (Input_arguments::add_file): Remove const.
7831         (Input_arguments::number_of_input_files): New function.
7832         (Input_arguments::file_count_): New data member.
7833         (Command_line::number_of_input_files): Call
7834         Input_arguments::number_of_input_files.
7835         * output.cc (Output_segment_headers::Output_segment_headers):
7836         Set current size.
7837         (Output_section::Input_section::current_data_size): New function.
7838         (Output_section::Output_section): Initialize new data members.
7839         (Output_section::add_input_section): Don't do merge sections for
7840         an incremental link; allocate space from free list for an
7841         incremental update.
7842         (Output_section::add_output_section_data): Allocate space from
7843         free list for an incremental update.
7844         (Output_section::update_data_size): New function.
7845         (Output_section::set_fixed_layout): New function.
7846         (Output_section::reserve): New function.
7847         (Output_segment::set_section_addresses): Remove const.
7848         (Output_segment::set_section_list_addresses): Remove const; allocate
7849         space from free list for an incremental update.
7850         (Output_segment::set_offset): Adjust size of RELRO segment for an
7851         incremental update.
7852         * output.h (Output_data::current_data_size): Move here from
7853         child classes.
7854         (Output_data::pre_finalize_data_size): New function.
7855         (Output_data::update_data_size): New function.
7856         (Output_section_headers::update_data_size): new function.
7857         (Output_section_data_build::current_data_size): Move to Output_data.
7858         (Output_data_strtab::update_data_size): New function.
7859         (Output_section::current_data_size): Move to Output_data.
7860         (Output_section::set_fixed_layout): New function.
7861         (Output_section::has_fixed_layout): New function.
7862         (Output_section::reserve): New function.
7863         (Output_section::update_data_size): New function.
7864         (Output_section::has_fixed_layout_): New data member.
7865         (Output_section::free_list_): New data member.
7866         (Output_segment::set_section_addresses): Remove const.
7867         (Output_segment::set_section_list_addresses): Remove const.
7868         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
7869         New function.
7870         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
7871         New function.
7872         * readsyms.cc (Read_symbols::do_read_symbols): Add library
7873         parameter when calling Add_symbols constructor; store argument
7874         serial number for members of a lib group.
7875         (Add_symbols::locks): Allow case where token == NULL.
7876         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
7877         (Read_member::~Read_member): New function.
7878         (Read_member::is_runnable): New function.
7879         (Read_member::locks): New function.
7880         (Read_member::run): New function.
7881         (Check_script::~Check_script): New function.
7882         (Check_script::is_runnable): New function.
7883         (Check_script::locks): New function.
7884         (Check_script::run): New function.
7885         (Check_library::~Check_library): New function.
7886         (Check_library::is_runnable): New function.
7887         (Check_library::locks): New function.
7888         (Check_library::run): New function.
7889         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
7890         (Add_symbols::library_): New data member.
7891         (class Read_member): New class.
7892         (class Check_script): New class.
7893         (class Check_library): New class.
7894         * reloc.cc (Read_relocs::is_runnable): Allow case where
7895         token == NULL.
7896         (Read_relocs::locks): Likewise.
7897         (Scan_relocs::locks): Likewise.
7898         (Relocate_task::locks): Likewise.
7899         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
7900         to clear counters.
7901         (Sized_relobj::incremental_relocs_scan): Fix comment.
7902         (Sized_relobj::do_relocate): Pass output file offset to
7903         write_local_symbols.
7904         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
7905         from class declaration.
7906         * script.cc (read_input_script): Allocate Script_info; pass
7907         argument serial number to report_script.
7908         * script.h (class Script_info): Move to incremental.h.
7909         * symtab.cc (Symbol_table::add_from_incrobj): New function.
7910         * symtab.h (Symbol_table::add_from_incrobj): New function.
7911         (Symbol_table::set_file_offset): New function.
7912
7913 2011-04-05  Cary Coutant  <ccoutant@google.com>
7914
7915         * incremental-dump.cc (dump_incremental_inputs): Change signature
7916         to take a Sized_incremental_binary; change caller.  Use readers
7917         in Sized_incremental_binary.
7918         * incremental.cc
7919         (Sized_incremental_binary::find_incremental_inputs_sections):
7920         Rename do_find_incremental_inputs_sections to this.
7921         (Sized_incremental_binary::setup_readers): New function.
7922         (Sized_incremental_binary::do_check_inputs): Check
7923         has_incremental_info_ flag; move setup code to setup_readers;
7924         use input readers.
7925         (Sized_incremental_binary::do_file_is_unchanged): New function.
7926         (Sized_incremental_binary::do_get_input_reader): New function.
7927         * incremental.h (class Incremental_binary): Move to end of file.
7928         (Incremental_binary::file_is_unchanged): New function.
7929         (Incremental_binary::do_file_is_unchanged): New function.
7930         (Incremental_binary::Input_reader): New class.
7931         (Incremental_binary::get_input_reader): New function.
7932         (class Sized_incremental_binary): Move to end of file.
7933         (Sized_incremental_binary::Sized_incremental_binary): Setup the
7934         input section reader classes.
7935         (Sized_incremental_binary::has_incremental_info): New function.
7936         (Sized_incremental_binary::inputs_reader): New function.
7937         (Sized_incremental_binary::symtab_reader): New function.
7938         (Sized_incremental_binary::relocs_reader): New function.
7939         (Sized_incremental_binary::got_plt_reader): New function.
7940         (Sized_incremental_binary::do_file_is_unchanged): New function.
7941         (Sized_incremental_binary::Sized_input_reader): New class.
7942         (Sized_incremental_binary::get_input_reader): New function.
7943         (Sized_incremental_binary::find_incremental_inputs_sections):
7944         Rename do_find_incremental_inputs_sections to this.
7945         (Sized_incremental_binary::setup_readers): New function.
7946         (Sized_incremental_binary::has_incremental_info_): New data member.
7947         (Sized_incremental_binary::inputs_reader_): New data member.
7948         (Sized_incremental_binary::symtab_reader_): New data member.
7949         (Sized_incremental_binary::relocs_reader_): New data member.
7950         (Sized_incremental_binary::got_plt_reader_): New data member.
7951         (Sized_incremental_binary::current_input_file_): New data member.
7952
7953 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
7954
7955         PR gold/12640
7956         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
7957         violation.
7958
7959 2011-03-30  Cary Coutant  <ccoutant@google.com>
7960
7961         * archive.cc (Archive::include_member): Adjust call to report_object.
7962         (Add_archive_symbols::run): Add script_info to call to
7963         report_archive_begin.
7964         (Lib_group::include_member): Adjust call to report_object.
7965         (Add_lib_group_symbols::run): Adjust call to report_object.
7966         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
7967         blocks.  Add object count for script input files.
7968         * incremental.cc (Incremental_inputs::report_archive_begin): Add
7969         script_info parameter; change all callers.
7970         (Incremental_inputs::report_object): Add script_info parameter;
7971         change all callers.
7972         (Incremental_inputs::report_script): Store backpointer to
7973         incremental info entry.
7974         (Output_section_incremental_inputs::set_final_data_size): Record
7975         additional information for scripts.
7976         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7977         * incremental.h (Incremental_script_entry::add_object): New function.
7978         (Incremental_script_entry::get_object_count): New function.
7979         (Incremental_script_entry::get_object): New function.
7980         (Incremental_script_entry::objects_): New data member; adjust
7981         constructor.
7982         (Incremental_inputs::report_archive_begin): Add script_info parameter.
7983         (Incremental_inputs::report_object): Add script_info parameter.
7984         (Incremental_inputs_reader::get_object_count): New function.
7985         (Incremental_inputs_reader::get_object_offset): New function.
7986         * options.cc (Input_arguments::add_file): Return reference to
7987         new input argument.
7988         * options.h (Input_argument::set_script_info): New function.
7989         (Input_argument::script_info): New function.
7990         (Input_argument::script_info_): New data member; adjust all
7991         constructors.
7992         (Input_file_group::add_file): Return reference to new input argument.
7993         (Input_file_lib::add_file): Likewise.
7994         (Input_arguments::add_file): Likewise.
7995         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
7996         * script.cc (Parser_closure::Parser_closure): Add script_info
7997         parameter; adjust all callers.
7998         (Parser_closure::script_info): New function.
7999         (Parser_closure::script_info_): New data member.
8000         (read_input_script): Report scripts earlier to incremental info.
8001         (script_add_file): Set script_info in Input_argument.
8002         (script_add_library): Likewise.
8003         * script.h (Script_options::Script_info): Rewrite class.
8004
8005 2011-03-29  Cary Coutant  <ccoutant@google.com>
8006
8007         * archive.cc (Library_base::should_include_member): Move
8008         method here from class Archive.
8009         (Archive::Archive): Initialize base class.
8010         (Archive::should_include_member): Move to base class.
8011         (Archive::do_for_all_unused_symbols): New function.
8012         (Add_archive_symbols::run): Remove redundant access to
8013         incremental_inputs.
8014         (Lib_group::Lib_group): Initialize base class.
8015         (Lib_group::do_filename): New function.
8016         (Lib_group::include_member): Pass pointer to Lib_group to
8017         report_object.
8018         (Lib_group::do_for_all_unused_symbols): New function.
8019         (Add_lib_group_symbols::run): Report archive information for
8020         incremental links.
8021         * archive.h (class Library_base): New base class.
8022         (class Archive): Derive from Library_base.
8023         (Archive::filename): Move to base class.
8024         (Archive::set_incremental_info): Likewise.
8025         (Archive::incremental_info): Likewise.
8026         (Archive::Should_include): Likewise.
8027         (Archive::should_include_member): Likewise.
8028         (Archive::Armap_entry): Remove.
8029         (Archive::Unused_symbol_iterator): Remove.
8030         (Archive::unused_symbols_begin): Remove.
8031         (Archive::unused_symbols_end): Remove.
8032         (Archive::do_filename): New function.
8033         (Archive::do_get_mtime): New function.
8034         (Archive::do_for_all_unused_symbols): New function.
8035         (Archive::task_): Move to base class.
8036         (Archive::incremental_info_): Likewise.
8037         (class Lib_group): Derive from Library_base.
8038         (Lib_group::do_filename): New function.
8039         (Lib_group::do_get_mtime): New function.
8040         (Lib_group::do_for_all_unused_symbols): New function.
8041         (Lib_group::task_): Move to base class.
8042         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
8043         function.
8044         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
8045         function.
8046         * incremental.cc (Incremental_inputs::report_archive_begin):
8047         Use Library_base; call library's get_mtime; add incremental inputs
8048         entry before members.
8049         (class Unused_symbol_visitor): New class.
8050         (Incremental_inputs::report_archive_end): Use Library_base; use
8051         visitor class to record unused symbols; don't add incremental inputs
8052         entry after members.
8053         (Incremental_inputs::report_object): Use Library_base.
8054         * incremental.h
8055         (Incremental_archive_entry::Incremental_archive_entry): Remove
8056         unused Archive parameter.
8057         (Incremental_inputs::report_archive_begin): Use Library_base.
8058         (Incremental_inputs::report_archive_end): Likewise.
8059         (Incremental_inputs::report_object): Likewise.
8060         * object.cc (Sized_relobj::do_for_all_global_symbols): New
8061         function.
8062         * object.h (Object::for_all_global_symbols): New function.
8063         (Object::do_for_all_global_symbols): New function.
8064         (Sized_relobj::do_for_all_global_symbols): New function.
8065         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
8066         function.
8067         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
8068         function.
8069
8070 2011-03-27  Ian Lance Taylor  <iant@google.com>
8071
8072         * archive.cc (Archive::interpret_header): Return -1 if something
8073         goes wrong.  Change callers accordingly.
8074
8075 2011-03-25  Cary Coutant  <ccoutant@google.com>
8076
8077         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
8078         * testsuite/Makefile.in: Regenerate.
8079
8080 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
8081
8082         * plugin.cc (get_view): New.
8083         (Plugin::load): Pass get_view to the plugin.
8084         (Plugin_manager::get_view): New.
8085
8086 2011-03-21  Ian Lance Taylor  <iant@google.com>
8087
8088         * testsuite/final_layout.sh: Rewrite to not use dc.
8089         * testsuite/relro_test.sh: Fail if dc is not present.
8090
8091 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
8092
8093         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
8094         Change == to -eq.
8095         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
8096         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
8097         Change == to -eq.
8098         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
8099         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
8100
8101 2011-03-14  Ian Lance Taylor  <iant@google.com>
8102
8103         * script-sections.cc (Sort_output_sections::script_compare):
8104         Rename from is_before, change return type.
8105         (Sort_output_sections::operator()): Adjust accordingly.
8106
8107 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
8108
8109         PR gold/12572
8110         * testsuite/odr_violation2.cc: Add comment to make all error line
8111         numbers double digits.
8112         * testsuite/debug_msg.sh: Adjust expected errors.
8113
8114 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
8115
8116         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
8117         but mark earlier ones as non-canonical
8118         (offset_to_iterator): Update search target and example
8119         (do_addr2line): Return extra lines in a vector*
8120         (format_file_lineno): Extract from do_addr2line
8121         (one_addr2line): Add vector* out-param
8122         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
8123         when a lineno entry appeared last for its instruction
8124         (Dwarf_line_info): Add vector* out-param
8125         * object.cc (Relocate_info): Pass NULL for the vector* out-param
8126         * symtab.cc (Odr_violation_compare): Include the lineno in the
8127         comparison again.
8128         (linenos_from_loc): New. Combine the canonical line for an
8129         address with its other lines.
8130         (True_if_intersect): New. Helper functor to make
8131         std::set_intersection a query.
8132         (detect_odr_violations): Compare sets of lines instead of just
8133         one line for each function. This became less deterministic, but
8134         has fewer false positives.
8135         * symtab.h: Declarations.
8136         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
8137         mix an optimized and non-optimized object in the same binary
8138         (odr_violation2.so): Same.
8139         * testsuite/Makefile.in: Regenerate from Makefile.am.
8140         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
8141         * testsuite/debug_msg.sh: Update line numbers and add
8142         assertions.
8143         * testsuite/odr_violation1.cc: Use OdrDerived, in a
8144         non-optimized context.
8145         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
8146         isn't inlined, and use OdrDerived in an optimized context.
8147         * testsuite/odr_header1.h: Defines OdrDerived, where
8148         optimization will change the
8149         first-instruction-in-the-destructor's file and line number.
8150         * testsuite/odr_header2.h: Defines OdrBase.
8151
8152 2011-03-09  Ian Lance Taylor  <iant@google.com>
8153
8154         * fileread.cc (File_read::clear_views): Don't delete the whole
8155         file view.
8156
8157 2011-03-08  Ian Lance Taylor  <iant@google.com>
8158
8159         PR gold/12525
8160         * fileread.cc: #include <climits>.
8161         (GOLD_IOV_MAX): Define.
8162         (File_read::read_multiple): Limit number of entries by iov_max.
8163         * fileread.h (class File_read): Always set max_readv_entries to
8164         128.
8165
8166 2011-03-07  Ian Lance Taylor  <iant@google.com>
8167
8168         PR gold/12525
8169         * options.h (class General_options): Add -dy and -dn.
8170
8171 2011-03-02  Cary Coutant  <ccoutant@google.com>
8172
8173         * testsuite/script_test_9.t: Add TLS segment.
8174
8175 2011-03-02  Simon Baldwin  <simonb@google.com>
8176
8177         * configure.ac: Add check for gnu_indirect_function support in
8178         the toolchain building binutils.
8179         * configure: Rebuild.
8180
8181 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
8182
8183         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
8184         plugin only symbols.
8185         (Symbol_table::sized_finalize_symbol) Mark symbol only present
8186         in plugin files as not needed in the symbol table.
8187
8188 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
8189
8190         * output.cc (Output_section::add_input_section): Delay fill
8191         generation for section ordering.
8192
8193 2011-02-09  Ian Lance Taylor  <iant@google.com>
8194
8195         PR gold/12316
8196         * object.h (class Sized_relobj): Remove clear_local_symbols.
8197         * reloc.cc (Sized_relobj::do_relocate): Don't call
8198         clear_local_symbols.
8199
8200 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
8201
8202         * plugin.cc (is_visible_from_outside): Return true for symbols
8203         in the -u option.
8204
8205 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
8206
8207         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
8208         filename.
8209
8210 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
8211
8212         * icf.h (is_section_foldable_candidate): Change type of parameter
8213         to std::string.
8214         * icf.cc (Icf::find_identical_sections): Change type of local variable
8215         section_name to be std::string.
8216         (is_function_ctor_or_dtor): Change type of parameter to std::string.
8217
8218 2011-01-25  Ian Lance Taylor  <iant@google.com>
8219
8220         * script.cc (script_add_extern): Rewrite to use
8221         add_symbol_reference.
8222
8223 2011-01-25  Doug Kwan  <dougkwan@google.com>
8224
8225         * icf.cc (get_section_contents): Always lock section's object.
8226
8227 2011-01-24  Ian Lance Taylor  <iant@google.com>
8228
8229         * options.h (class General_options): Accept
8230         --no-detect-odr-violations.
8231
8232 2011-01-24  Ian Lance Taylor  <iant@google.com>
8233
8234         * version.cc (version_string): Bump to 1.11.
8235
8236 2011-01-24  Ian Lance Taylor  <iant@google.com>
8237
8238         * plugin.cc (class Plugin_rescan): Define new class.
8239         (Plugin_manager::claim_file): Set any_claimed_.
8240         (Plugin_manager::save_archive): New function.
8241         (Plugin_manager::save_input_group): New function.
8242         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
8243         necessary.
8244         (Plugin_manager::new_undefined_symbol): New function.
8245         (Plugin_manager::rescan): New function.
8246         (Plugin_manager::rescannable_defines): New function.
8247         (Plugin_manager::add_input_file): Set any_added_.
8248         * plugin.h (class Plugin_manager): define new fields rescannable_,
8249         undefined_symbols_, any_claimed_, and any_added_.  Declare
8250         Plugin_rescan as friend.  Declare new functions.
8251         (Plugin_manager::Rescannable): Define type.
8252         (Plugin_manager::Rescannable_list): Define type.
8253         (Plugin_manager::Undefined_symbol_list): Define type.
8254         (Plugin_manager::Plugin_manager): Initialize new fields.
8255         * archive.cc (Archive::defines_symbol): New function.
8256         (Add_archive_symbols::run): Pass archive to plugins if any.
8257         * archive.h (class Archive): Declare defines_symbol.
8258         * readsyms.cc (Input_group::~Input_group): New function.
8259         (Finish_group::run): Pass input_group to plugins if any.
8260         * readsyms.h (class Input_group): Declare destructor.
8261         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
8262         any.
8263
8264 2011-01-10  Ian Lance Taylor  <iant@google.com>
8265
8266         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
8267         section as relro.
8268         (Layout::set_segment_offsets): Reset increase_relro before calling
8269         set_section_addresses a second time.
8270
8271 2011-01-04  Cary Coutant  <ccoutant@google.com>
8272
8273         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
8274         sections before NOBITS sections.
8275
8276 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
8277
8278         * version.cc (print_version): Update copyright to 2011.
8279
8280 2010-12-23  Cary Coutant  <ccoutant@google.com>
8281
8282         * output.h (Output_data_reloc::add_output_section): Pass OD instead
8283         of OS to this->add.  Add OD parameter to second form of the function.
8284
8285 2010-12-20  Ian Lance Taylor  <iant@google.com>
8286
8287         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
8288         second of two consecutive entries with same offset.
8289
8290 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8291
8292         * testsuite/Makefile.am (ifuncmain2static_LDADD)
8293         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
8294         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
8295         to avoid unneeded links against $(LDADD).
8296         * testsuite/Makefile.in: Regenerate.
8297
8298 2010-12-15  Ian Lance Taylor  <iant@google.com>
8299
8300         PR gold/12324
8301         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
8302         for R_X86_64_32 and R_X86_64_PC32.
8303         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
8304         ver_matching_def_pic.o.
8305         (ver_matching_def_pic.o): New target.
8306
8307 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8308
8309         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
8310         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
8311         Move definition before File_read::View member definitions.
8312         (File_read::View::~View): Initialize and hold lock before
8313         updating current_mapped_bytes.
8314
8315 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8316
8317         * dwarf_reader.cc: Remove outdated comment.
8318         * gold-threads.cc: Fix typo in error message.
8319         * archive.cc: Fix typos in comments.
8320         * archive.h: Likewise.
8321         * arm-reloc-property.cc: Likewise.
8322         * arm-reloc-property.h: Likewise.
8323         * arm-reloc.def: Likewise.
8324         * arm.cc: Likewise.
8325         * attributes.h: Likewise.
8326         * cref.cc: Likewise.
8327         * ehframe.cc: Likewise.
8328         * fileread.h: Likewise.
8329         * gold.h: Likewise.
8330         * i386.cc: Likewise.
8331         * icf.cc: Likewise.
8332         * incremental.h: Likewise.
8333         * int_encoding.cc: Likewise.
8334         * layout.h: Likewise.
8335         * main.cc: Likewise.
8336         * merge.h: Likewise.
8337         * object.cc: Likewise.
8338         * object.h: Likewise.
8339         * options.cc: Likewise.
8340         * readsyms.cc: Likewise.
8341         * reduced_debug_output.cc: Likewise.
8342         * reloc.cc: Likewise.
8343         * script-sections.cc: Likewise.
8344         * sparc.cc: Likewise.
8345         * symtab.h: Likewise.
8346         * target-reloc.h: Likewise.
8347         * target.cc: Likewise.
8348         * target.h: Likewise.
8349         * timer.cc: Likewise.
8350         * timer.h: Likewise.
8351         * x86_64.cc: Likewise.
8352
8353 2010-12-09  Cary Coutant  <ccoutant@google.com>
8354
8355         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
8356         stack.
8357         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
8358         parameter; change all callers.
8359         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
8360         * options.h (warn_execstack): New option.
8361
8362 2010-12-07  Doug Kwan  <dougkwan@google.com>
8363
8364         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
8365         like function call relocations.
8366
8367 2010-12-07  Ian Lance Taylor  <iant@google.com>
8368
8369         * archive.cc (Archive::get_elf_object_for_member): Permit
8370         punconfigured to be NULL.
8371         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
8372         (Archive::include_member): Pass NULL to get_elf_object_for_member
8373         if we searched for the archive and this is the first included
8374         object.
8375
8376 2010-12-01  Ian Lance Taylor  <iant@google.com>
8377
8378         * dwarf_reader.h (class Sized_dwarf_line_info): Add
8379         track_relocs_type_ field.
8380         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8381         Set track_relocs_type_.
8382         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
8383         contents when using RELA relocs.
8384         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
8385         reloc_map_.
8386         * reloc.cc (Track_relocs::next_addend): New function.
8387         * reloc.h (class Track_relocs): Declare next_addend.
8388
8389 2010-12-01  Ian Lance Taylor  <iant@google.com>
8390
8391         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
8392         virtual destructor.
8393
8394 2010-12-01  Ian Lance Taylor  <iant@google.com>
8395
8396         * README: Update compilers known to work and fail.
8397
8398 2010-11-23  Matthias Klose  <doko@ubuntu.com>
8399
8400         * configure.in: For --enable-gold, handle value `default' instead of
8401         `both*'.  Always install ld as ld.bfd, install as ld if gold is
8402         not the default.
8403         * configure: Regenerate.
8404
8405 2010-11-18  Doug Kwan  <dougkwan@google.com>
8406
8407         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
8408         and right_alignment to be zero.  Store result alignment only if it is
8409         greater than existing alignment.
8410
8411 2010-11-16  Cary Coutant  <ccoutant@google.com>
8412
8413         PR gold/12220
8414         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8415         Check for ".zdebug_line".
8416
8417 2010-11-16  Doug Kwan  <dougkwan@google.com>
8418             Cary Coutant  <ccoutant@google.com>
8419
8420         * output.h (Output_segment::set_section_addresses): Pass increase_relro
8421         by reference; adjust all callers.
8422         * output.cc (Output_segment::set_section_addresses): Adjust references
8423         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
8424         list is empty.
8425         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
8426         end at page boundary.
8427
8428 2010-11-16  Cary Coutant  <ccoutant@google.com>
8429
8430         PR gold/12220
8431         * layout.cc (Layout::choose_output_section): Transform names of
8432         compressed sections even when using a script with a SECTIONS clause.
8433         (Layout::output_section_name): Remove code to transform
8434         compressed debug section names.
8435         * output.cc (Output_section::add_input_section): Use uncompressed
8436         section size when tracking input sections.
8437
8438 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
8439
8440         * symtab.h (Symbol::NON_PIC_REF): Remove.
8441         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
8442         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
8443         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
8444         (Symbol::use_plt_offset): Take a flags argument and pass it
8445         directly to needs_dynamic_reloc.  Restrict check for undefined
8446         weak symbols to function calls.
8447         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
8448         (Target_arm::Scan::global): Use it.
8449         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
8450         (Target_arm::Relocate::relocate): Likewise.
8451         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
8452         parameter with an r_type parameter.  Use get_reference_flags
8453         to get the flags.
8454         (Target_arm::Relocate::relocate): Update accordingly.
8455         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
8456         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
8457         (Target_i386::Scan::global): Likewise.
8458         (Target_i386::Relocate::relocate): Likewise.
8459         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
8460         parameter with an r_type parameter.  Use get_reference_flags
8461         to get the flags.
8462         (Target_i386::Relocate::relocate): Update accordingly.
8463         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
8464         (Target_powerpc::Scan::global): Use it.
8465         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
8466         (Target_powerpc::Relocate::relocate): Likewise.
8467         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
8468         (Target_sparc::Scan::global): Use it.
8469         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
8470         (Target_sparc::Relocate::relocate): Likewise.
8471         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
8472         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
8473         (Target_x86_64::Scan::global): Likewise.
8474         (Target_x86_64::Relocate::relocate): Likewise.
8475
8476 2010-11-08  Doug Kwan  <dougkwan@google.com>
8477             Cary Coutant  <ccoutant@google.com>
8478
8479         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
8480         (Arm_exidx_merge_section::section_contents_): New data member.
8481         (Arm_input_section::Arm_input_section): Initialize original_contents_.
8482         (Arm_input_section::~Arm_input_section): De-allocate memory.
8483         (Arm_input_section::original_contents_): New data member.
8484         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
8485         in parameters instead of calling Object::section_contents without
8486         locking.
8487         (Arm_output_section::group_section): New parameter TASK.  Pass it
8488         to callees that need locking objects.
8489         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
8490         to lock EXIDX input sections.  Fix a formatting issue.  Call
8491         Arm_exidx_merged_section::build_contents to create merged section
8492         contents.
8493         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
8494         to lock object of stub table owner.
8495         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
8496         TEXT_SIZE to initialize data member TEXT_SIZE_.
8497         (Arm_exidx_input_section::addralign): Fix typo in comment.
8498         (Arm_exidx_input_section::text_size): New method.
8499         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
8500         that require locking objects.  Lock objects before scanning for stubs
8501         and updating local symbols.
8502         (Arm_input_section<big_endian>::init): Copy contents of original
8503         input section.
8504         (Arm_input_section<big_endian>::do_write): Use saved contents of
8505         original input section instead of calling Object::section_contents
8506         without locking.
8507         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
8508         size without calling Object::section_size().
8509         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
8510         for size.  Allocate a buffer for merged EXIDX entries.
8511         (Arm_exidx_merged_section::build_contents): New method.
8512         (Arm_exidx_merged_section::do_write): Move merge section contents
8513         building code to Arm_exidx_merged_section::build_contetns.  Write
8514         out contetns in buffer instead of building it on the fly.
8515         (Arm_relobj::make_exidx_input_section): Also pass text section size
8516         to Arm_exidx_input_section constructor.
8517         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
8518         (Arm_dynobj::do_read_symbols): Fix memory leak.
8519         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
8520         * target.h: (class Task): Add forward declaration.
8521         (Target::relax): Add new parameter TASK and pass it to
8522         Target::do_relax().
8523         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
8524
8525 2010-11-05  Cary Coutant  <ccoutant@google.com>
8526
8527         PR gold/10708
8528         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
8529         object when reading from the file.
8530         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
8531         second layout pass.
8532         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
8533         when reading section contents.
8534         (get_section_contents): Likewise.
8535         (icf::find_identical_sections): Likewise.
8536         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
8537         object when reading from the file.
8538         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
8539         the object when doing deferred section layout.
8540
8541 2010-11-03  Nick Clifton  <nickc@redhat.com>
8542
8543         PR gold/12001
8544         * script.h (class Symbol_assignment: name): New member.  Returns
8545         the name of the symbol.
8546         * scrfipt.cc (Script_options::is_pending_assignment): New member.
8547         Returns true if the given symbol name is on the list of
8548         assignments wating to be processed.
8549         * archive.cc (should_incldue_member): If the symbol is undefined,
8550         check to see if it is on the list of symbols pending assignment.
8551
8552 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
8553
8554         * script-sections.cc (Script_sections::find_memory_region): Check
8555         for a NULL output section pointer.
8556
8557 2010-10-29  Doug Kwan  <dougkwan@google.com>
8558
8559         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
8560         Output_section::add_relaxed_input_section.
8561         * output.cc (Output_section::add_relaxed_input_section): Add new
8562         arguments LAYOUT and NAME.  Set section order index.
8563         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8564         Copy section order index.
8565         * output.h (Output_section::add_relaxed_input_section): Add new
8566         arguments LAYOUT and NAME.
8567
8568 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8569
8570         * testsuite/Makefile.am: Move gcctestdir/ld rule to
8571         NATIVE_OR_CROSS_LINKER.
8572         * testsuite/Makefile.in: Regenerate.
8573
8574 2010-10-20  Doug Kwan  <dougkwan@google.com>
8575
8576         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
8577         without SHF_LINK_ORDER flags.
8578         * layout.cc (Layout::choose_output_section): Do not filter
8579         SHF_LINK_ORDER flag in a relocatable link.
8580
8581 2010-10-17  Cary Coutant  <ccoutant@google.com>
8582
8583         * output.h (Output_segment::set_section_addresses): Change function
8584         signature.  Update all callers.
8585         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
8586         sections.
8587         (Output_segment::set_section_addresses): Align after last TLS
8588         section.  Add padding before last relro section instead of after.
8589
8590 2010-10-17  Doug Kwan  <dougkwan@google.com>
8591
8592         * gold/arm.cc (Target_arm::got_section): Use correct order and set
8593         GOT output section to be writable.
8594
8595 2010-10-14  Cary Coutant  <ccoutant@google.com>
8596
8597         * debug.h (DEBUG_INCREMENTAL): New flag.
8598         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
8599         * gold.cc (queue_initial_tasks): Check parameters for incremental link
8600         mode.
8601         * incremental.cc (report_command_line): Ignore all forms of
8602         --incremental.
8603         * layout.cc (Layout::Layout): Check parameters for incremental link
8604         mode.
8605         * options.cc (General_options::parse_incremental): New function.
8606         (General_options::parse_no_incremental): New function.
8607         (General_options::parse_incremental_full): New function.
8608         (General_options::parse_incremental_update): New function.
8609         (General_options::incremental_mode_): New data member.
8610         (General_options::finalize): Check incremental_mode_.
8611         * options.h (General_options): Update help text for --incremental.
8612         Add --no-incremental, --incremental-full, --incremental-update.
8613         (General_options::Incremental_mode): New enum type.
8614         (General_options::incremental_mode): New function.
8615         (General_options::incremental_mode_): New data member.
8616         * parameters.cc (Parameters::incremental_mode_): New data member.
8617         (Parameters::set_options): Set incremental_mode_.
8618         (Parameters::set_incremental_full): New function.
8619         (Parameters::incremental): New function.
8620         (Parameters::incremental_update): New function.
8621         (set_parameters_incremental_full): New function.
8622         * parameters.h (Parameters::set_incremental_full): New function.
8623         (Parameters::incremental): New function.
8624         (Parameters::incremental_update): New function.
8625         (Parameters::incremental_mode_): New data member.
8626         (set_parameters_incremental_full): New function.
8627         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
8628         incremental link mode.
8629         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
8630         (Sized_relobj::do_relocate_sections): Likewise.
8631         * testsuite/Makefile.am (incremental_test): Use --incremental-full
8632         option.
8633         * testsuite/Makefile.in: Regenerate.
8634         * testsuite/incremental_test.sh: Filter all forms of --incremental.
8635
8636 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8637
8638         * script-sections.h (class Script_sections): Make
8639         Sections_elements typedef public.
8640         * script-sections.cc (class Sort_output_sections): Add elements_
8641         field.  Add constructor which sets it; change all callers.
8642         (Sort_output_sections::is_before): New function.
8643         (Sort_output_sections::operator()): Call is_before.
8644         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
8645         conditional.
8646         * testsuite/script_test_10.sh: New test. Test script section
8647         order.
8648         * testsuite/script_test_10.t: Likewise.
8649         * testsuite/script_test_10.s: Likewise.
8650         * testsuite/Makefile.am: Wrap the cross linker tests and the
8651         common tests into NATIVE_OR_CROSS_LINKER.
8652         (check_SCRIPTS): Add script_test_10.sh.
8653         (check_DATA): Add script_test_10.stdout.
8654         (script_test_10.o, script_test_10): New targets.
8655         (script_test_10.stdout): New target.
8656         * configure, testsuite/Makefile.in: Regenerate.
8657
8658 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8659
8660         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
8661         error for the deprecated relocations.
8662         (Target_arm::Scan::global): Likewise.
8663         (Target_arm::Relocate::relocate): Likewise.
8664
8665 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
8666
8667         * fileread.cc (Input_file::find_file): Initialize *found_name
8668         and *namep when using the fallback search for case 4.
8669
8670 2010-10-11  Cary Coutant  <ccoutant@google.com>
8671
8672         * options.h (class General_options): Redefine -z lazy as an alias for
8673         the negation of -z now.
8674
8675 2010-10-11  Ian Lance Taylor  <iant@google.com>
8676
8677         * resolve.cc (symbol_to_bits): Report the value of the unsupported
8678         binding.
8679
8680 2010-10-06  Nick Clifton  <nickc@redhat.com>
8681
8682         * script-sections.cc(class Memory_region): Remove
8683         current_lma_offset_ field.  Rename current_vma_offset_ to
8684         current_offset_.  Add last_section_ field.
8685         (Memory_region::get_current_vma_address): Rename to
8686         get_current_address.
8687         (Memory_region::get_current_lma_address): Delete.
8688         (Memory_region::increment_vma_offset): Rename to
8689         increment_offset.
8690         (Memory_region::increment_lma_offset): Delete.
8691         (Memory_region::attributes_compatible): New method.  Returns
8692         true if the provided section is compatible with the region.
8693         (Memory_region::get_last_section): New method.  Returns the last
8694         section to use the region.
8695         (Memory_region::set_last_section): New method.  Stores the last
8696         section to use the region.
8697         (Script_sections::block_in_region): New method.  Returns true if
8698         a block of memory is contained within a region.
8699         (Script_sections::find_memory_region): New method.  Locates a
8700         memory region to be used to set a VMA or LMA address.
8701         (Output_section_definition::set_section_addresses): Add code to
8702         check for addresses set by memory regions.
8703         (Output_segment::set_section_addresses): Remove memory region
8704         walking code.
8705         (Script_sections::create_segment): Add a warning if a header
8706         segment is created outside of any region.
8707         * script-sections.h (class Script_sections): Add prototypes for
8708         find_memory_region and block_in_region methods.
8709         * testsuite/memory_test.s: Use .long instead of .word.
8710         * testsuite/memory_test.t: Add some more output sections.
8711         * testsuite/memory_test.sh: Update expected output.
8712
8713 2010-10-02  Doug Kwan  <dougkwan@google.com>
8714
8715         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
8716         defintion to symtab.h
8717         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
8718         declaration to defintion.
8719
8720 2010-10-01  Nick Clifton  <nickc@redhat.com>
8721
8722         * expression.cc (eval): Replace dummy argument with NULL.
8723         (eval_maybe_dot): Check for a NULL result section pointer.
8724         (Symbol_expression::value): Likewise.
8725         (Dot_expression::value): Likewise.
8726         (BINARY_EXPRESSION): Likewise.
8727         (Max_expression::value): Likewise.
8728         (Min_expression::value): Likewise.
8729         (Absolute_expression::value): Likewise.
8730         (Addr_expression::value_from_output_section): Likewise.
8731         (Loaddddr_expression::value_from_output_section): Likewise.
8732         (Segment_start_expression::value): Likewise.
8733         * script-sections.cc
8734         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
8735         argument with NULL.
8736         (Sections_elememt_dot_assignment::set_section_addresses):
8737         Likewise.
8738         (Output_data_expression::do_write_to_buffer): Likewise.
8739         (Output_section_definition::finalize_symbols): Likewise.
8740         (Output_section_definition::set_section_addresses): Likewise.
8741
8742 2010-09-30  Doug Kwan  <dougkwan@google.com>
8743
8744         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
8745
8746 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
8747
8748         * target.h (Target::can_icf_inline_merge_sections): New virtual
8749         function.
8750         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
8751         virtual function.
8752         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
8753         virtual function.
8754         * icf.cc (get_section_contents): Inline merge sections only when
8755         target allows it.
8756
8757 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8758
8759         * configure: Regenerate.
8760
8761 2010-09-17  Ian Lance Taylor  <iant@google.com>
8762
8763         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
8764         * testsuite/Makefile.am (memory_test.o): New target.
8765         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
8766         memory_test.t.
8767         * testsuite/Makefile.in: Rebuild.
8768
8769 2010-09-17  Doug Kwan  <dougkwan@google.com>
8770
8771         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
8772         defintion if relocation uses GOT entries of the symbol.
8773         * testsuite/icf_safe_test.sh: Fix test.
8774         * testsuite/icf_safe_so_test.sh: Fix test.
8775
8776 2010-09-16  Cary Coutant  <ccoutant@google.com>
8777
8778         * script_sections.cc (class Memory_region): Remove "NULL" from
8779         vector initializations.
8780
8781 2010-09-15  Cary Coutant  <ccoutant@google.com>
8782
8783         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
8784         Resolve forwarding symbols.
8785
8786 2010-09-15  Doug Kwan  <dougkwan@google.com>
8787
8788         * gold/testsuite/script_test_3.t: Add ARM special sections.
8789         * gold/testsuite/script_test_4.t: Same.
8790         * gold/testsuite/script_test_5.t: Same.
8791         * gold/testsuite/script_test_6.t: Same.
8792         * gold/testsuite/script_test_7.t: Same.
8793         * gold/testsuite/script_test_7.t: Same.
8794         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
8795
8796 2010-09-14  Cary Coutant  <ccoutant@google.com>
8797
8798         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
8799         (Target_x86_64::Relocate::relocate_tls): Replace check for
8800         saw_tls_block_reloc_ with test for executable section.
8801
8802 2010-09-12  Cary Coutant  <ccoutant@google.com>
8803
8804         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
8805         position-independent executables to shared libraries need dynamic
8806         relocations.
8807         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
8808         position-independent executables.
8809         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
8810         * testsuite/Makefile.in: Regenerate.
8811
8812 2010-09-10  Nick Clifton  <nickc@redhat.com>
8813
8814         PR gold/11997
8815         * testsuite/memory_test.t: Discard any sections that are not
8816         needed.
8817
8818 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
8819
8820         PR gold/11996
8821         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8822         "This::" to work around a bug in gcc 4.2.
8823
8824         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
8825
8826 2010-09-09  Rafael Espindola  <espindola@google.com>
8827
8828         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
8829         sections with different PF_X flags in the same segment.
8830         (Layout::find_first_load_seg): Search all segments to find the first
8831         one.
8832         * options.h (rosegment): New.
8833
8834 2010-09-08  Rafael Espindola  <espindola@google.com>
8835
8836         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
8837
8838 2010-09-08  Doug Kwan  <dougkwan@google.com>
8839
8840         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
8841         (Arm_relobj::do_relocate_sections): Add new parameter for output
8842         file to match the parent.
8843         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
8844         of local symbols instead of input values.  Update code to track
8845         changes in gold::relocate_section.
8846         * object.cc (Sized_relobj::compute_final_local_value): New methods.
8847         (Sized_relobj::compute_final_local_value_internal): New methods.
8848         (Sized_relobj::do_finalize_local_symbols): Move code from loop
8849         body into private version of Sized_relobj::compute_final_local_value.
8850         Call the inline method.
8851         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
8852         merged symbol value if there is one.
8853         (Symbol_value::has_output_value): New method defintiion.
8854         (Sized_relobj::Compute_final_local_value_status): New enum type.
8855         (Sized_relobj::compute_final_local_value): New methods.
8856         (Sized_relobj::compute_final_local_value_internal): New methods.
8857         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
8858         and arm_cortex_a8.sh.
8859         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
8860         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
8861         New tests.
8862         * Makefile.in: Regenerate.
8863         * testsuite/arm_bl_out_of_range.s: Update test.
8864         * testsuite/thumb_bl_out_of_range.s: Ditto.
8865         * testsuite/thumb_blx_out_of_range.s: Ditto.
8866         * testsuite/arm_branch_out_of_range.sh: New file.
8867         * testsuite/arm_cortex_a8.sh: Ditto.
8868         * testsuite/arm_cortex_a8_b.s: Ditto.
8869         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
8870         * testsuite/arm_cortex_a8_b_local.s: Ditto.
8871         * testsuite/arm_cortex_a8_bl.s: Ditto.
8872         * testsuite/arm_cortex_a8_blx.s: Ditto.
8873         * testsuite/arm_cortex_a8_local.s: Ditto.
8874         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
8875         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
8876
8877 2010-09-08  Rafael Espindola  <espindola@google.com>
8878
8879         * Makefile.am (memory_test.stdout): Run readelf with -W.
8880         * Makefile.in: Regenerate.
8881         * testsuite/memory_test.sh: Make the regexps accept both 32 and
8882         64 bit output.
8883
8884 2010-09-08  Rafael Espindola  <espindola@google.com>
8885
8886         * script-sections.cc (Script_sections::add_memory_region): Convert
8887         field precision to int.
8888         * script.cc (script_set_section_region, script_set_section_region):
8889         Convert field precision to int.
8890
8891 2010-09-08  Rafael Espindola  <espindola@google.com>
8892
8893         * arm.cc (do_finalize_sections): Create the __exidx_start and
8894         __exdix_end symbols even when the section is missing.
8895
8896 2010-09-08  Nick Clifton  <nickc@redhat.com>
8897
8898         * README: Remove claim that MEMORY is not supported.
8899         * expression.cc (script_exp_function_origin)
8900         (script_exp_function_length): Move from here to ...
8901         * script.cc: ... here.
8902         (script_set_section_region, script_add_memory)
8903         (script_parse_memory_attr, script_include_directive): New
8904         functions.
8905         * script-sections.cc
8906         (class Memory_region): New class.
8907         (class Output_section_definition): Add set_memory_region,
8908         set_section_vma, set_section_lma and get_section_name methods.
8909         (class Script_Sections): Add add_memory_region,
8910         find_memory_region, find_memory_region_origin,
8911         find_memory_region_length and set_memory_region methods.
8912         Have set_section_addresses method walk the list of set memory
8913         regions.
8914         Extend the print methos to display memory regions.
8915         * script-sections.h: Add prototypes for new methods.
8916         Add enum for MEMORY region attributes.
8917         * yyscript.y: Add support for parsing MEMORY regions.
8918         * script-c.h: Add prototypes for new functions.
8919         * testsuite/Makefile.am: Add test of MEMORY region functionality.
8920         * testsuite/Makefile.in: Regenerate.
8921         * testsuite/memory_test.sh: New script.
8922         * testsuite/memory_test.s: New assembler source file.
8923         * testsuite/memory_test.t: New linker script.
8924
8925 2010-08-27  Doug Kwan  <dougkwan@google.com>
8926
8927         * gold/resolve.cc (Symbol_table::should_override): Let a weak
8928         reference override an existing dynamic weak reference.
8929         * testsuite/Makefile.am: Add new test dyn_weak_ref.
8930         * testsuite/Makefile.in: Regenerate.
8931         * testsuite/dyn_weak_ref.sh: New file.
8932         * testsuite/dyn_weak_ref_1.c: Ditto.
8933         * testsuite/dyn_weak_ref_2.c: Ditto.
8934
8935 2010-08-27  Ian Lance Taylor  <iant@google.com>
8936
8937         * incremental.h (class Incremental_input_entry): Add virtual
8938         destructor.
8939
8940 2010-08-27  Ian Lance Taylor  <iant@google.com>
8941
8942         * testsuite/start_lib_test_3.c: Mark t3 as used.
8943
8944 2010-08-27  Nick Clifton  <nickc@redhat.com>
8945
8946         * options.cc (version_script): Fix small typo in previous
8947         whitespace tidyup.
8948
8949 2010-08-25  Nick Clifton  <nickc@redhat.com>
8950
8951         * archive.cc: Formatting fixes: Remove whitespace between
8952         typename and following asterisk.  Remove whitespace between
8953         function name and opening parenthesis.
8954         * archive.h: Likewise.
8955         * arm.cc: Likewise.
8956         * attributes.cc: Likewise.
8957         * attributes.h: Likewise.
8958         * common.cc: Likewise.
8959         * copy-relocs.cc: Likewise.
8960         * dirsearch.h: Likewise.
8961         * dynobj.cc: Likewise.
8962         * ehframe.cc: Likewise.
8963         * ehframe.h: Likewise.
8964         * expression.cc: Likewise.
8965         * fileread.cc: Likewise.
8966         * fileread.h: Likewise.
8967         * gc.h: Likewise.
8968         * gold-threads.cc: Likewise.
8969         * gold.cc: Likewise.
8970         * i386.cc: Likewise.
8971         * icf.h: Likewise.
8972         * incremental-dump.cc: Likewise.
8973         * incremental.cc: Likewise.
8974         * layout.cc: Likewise.
8975         * layout.h: Likewise.
8976         * main.cc: Likewise.
8977         * merge.cc: Likewise.
8978         * merge.h: Likewise.
8979         * object.cc: Likewise.
8980         * object.h: Likewise.
8981         * options.cc: Likewise.
8982         * options.h: Likewise.
8983         * output.cc: Likewise.
8984         * output.h: Likewise.
8985         * plugin.cc: Likewise.
8986         * plugin.h: Likewise.
8987         * powerpc.cc: Likewise.
8988         * reloc.cc: Likewise.
8989         * script-c.h: Likewise.
8990         * script-sections.cc: Likewise.
8991         * script.cc: Likewise.
8992         * stringpool.cc: Likewise.
8993         * symtab.cc: Likewise.
8994         * symtab.h: Likewise.
8995         * target.cc: Likewise.
8996         * timer.cc: Likewise.
8997         * timer.h: Likewise.
8998         * version.cc: Likewise.
8999         * x86_64.cc: Likewise.
9000
9001 2010-08-24  Nick Clifton  <nickc@redhat.com>
9002
9003         PR 11899
9004         * layout.cc (segment_precedes): Sort segments by their physical
9005         addresses, if they have been set.
9006
9007 2010-08-23  Cary Coutant  <ccoutant@google.com>
9008
9009         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
9010         symbols data.
9011         (Lib_group::include_member): Unlock object after deleting its
9012         symbols data.
9013         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
9014         the bug fixed here.
9015
9016 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
9017             Cary Coutant  <ccoutant@google.com>
9018
9019         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
9020         constructor, and set_blocker.
9021         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
9022         readsyms_blocker_.
9023         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
9024         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
9025         * testsuite/Makefile.am (start_lib_test): New test case.
9026         * testsuite/Makefile.in: Regenerate.
9027         * testsuite/start_lib_test_main.c: New file.
9028         * testsuite/start_lib_test_1.c: New file.
9029         * testsuite/start_lib_test_2.c: New file.
9030         * testsuite/start_lib_test_3.c: New file.
9031
9032 2010-08-19  Ian Lance Taylor  <iant@google.com>
9033
9034         * Makefile.in: Rebuild with automake 1.11.1.
9035         * aclocal.m4: Likewise.
9036         * testsuite/Makefile.in: Likewise.
9037
9038 2010-08-19  Ian Lance Taylor  <iant@google.com>
9039
9040         PR 10893
9041         * i386.cc (class Output_data_plt_i386): Update declarations.
9042         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
9043         local_ifuncs_ fields.
9044         (Target_i386::do_plt_section_for_global): New function.
9045         (Target_i386::do_plt_section_for_local): New function.
9046         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
9047         parameter; change all callers.  Initialize global_ifuncs_ and
9048         local_ifuncs_.  If doing a static link define __rel_iplt_start and
9049         __rel_iplt_end.
9050         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
9051         (Output_data_plt_i386::add_local_ifunc_entry): New function.
9052         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
9053         symbols.
9054         (Target_i386::make_plt_section): New function, broken out of
9055         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
9056         (Target_i386::make_plt_entry): Call make_plt_section.
9057         (Target_i386::make_local_ifunc_plt_entry): New function.
9058         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
9059         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
9060         R_386_IRELATIVE to switch.
9061         (Target_i386::Scan::global): Likewise.
9062         (Target_i386::Relocate::relocate): Likewise.
9063         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
9064         switch.
9065         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
9066         (Target_x86_64::do_plt_section_for_global): New function.
9067         (Target_x86_64::do_plt_section_for_local): New function.
9068         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
9069         parameter; change all callers.  If doing a static link define
9070         __rela_iplt_start and __rela_iplt_end.
9071         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
9072         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
9073         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
9074         to point to .plt.
9075         (Target_x86_64::make_local_ifunc_plt_entry): New function.
9076         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
9077         switch.
9078         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
9079         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
9080         R_X86_64_IRELATIVE to switch.
9081         (Target_x86_64::Scan::global): Likewise.
9082         (Target_x86_64::Relocate::relocate): Likewise.
9083         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
9084         switch.
9085         * target.h (class Target): Add plt_section_for_global and
9086         plt_section_for_local functions.  Add do_plt_section_for_global
9087         and do_plt_section_for_local virtual functions.
9088         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
9089         clarifying comments.
9090         (Symbol::use_plt_offset): Handle IFUNC symbol.
9091         * object.cc (Sized_relobj::Sized_relobj): Initialize
9092         local_plt_offsets_.
9093         (Sized_relobj::local_has_plt_offset): New function.
9094         (Sized_relobj::local_plt_offset): New function.
9095         (Sized_relobj::set_local_plt_offset): New function.
9096         (Sized_relobj::do_count): Handle IFUNC symbol.
9097         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
9098         a bit away from input_shndx_ field.  Add set_is_func_symbol and
9099         is_ifunc_symbol functions.
9100         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
9101         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
9102         local_plt_offsets_ field.
9103         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
9104         * output.h (class Output_section_data): Add non-const
9105         output_section function.
9106         (class Output_data_got): Update declarations.
9107         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
9108         Add use_plt_offset parameter to global and local constructors.
9109         Change all callers.  Change local_sym_index_ field to 31 bits.
9110         Change GSYM_CODE and CONSTANT_CODE accordingly.
9111         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
9112         doing a static link don't set sh_link field.
9113         (Output_data_got::Got_entry::write): Use PLT offset if
9114         appropriate.
9115         (Output_data_got::add_global_plt): New function.
9116         (Output_data_got::add_local_plt): New function.
9117         * target-reloc.h (relocate_section): Handle IFUNC symbol.
9118         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
9119         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
9120         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
9121         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
9122         IFUNC conditional.
9123         * testsuite/ifunc-sel.h: New file.
9124         * testsuite/ifuncmain1.c: New file.
9125         * testsuite/ifuncmain1vis.c: New file.
9126         * testsuite/ifuncmod1.c: New file.
9127         * testsuite/ifuncdep2.c: New file.
9128         * testsuite/ifuncmain2.c: New file.
9129         * testsuite/ifuncmain3.c: New file.
9130         * testsuite/ifuncmod3.c: New file.
9131         * testsuite/ifuncmain4.c: New file.
9132         * testsuite/ifuncmain5.c: New file.
9133         * testsuite/ifuncmod5.c: New file.
9134         * testsuite/ifuncmain6pie.c: New file.
9135         * testsuite/ifuncmod6.c: New file.
9136         * testsuite/ifuncmain7.c: New file.
9137         * configure, testsuite/Makefile.in: Rebuild.
9138
9139 2010-08-18  Ian Lance Taylor  <iant@google.com>
9140
9141         * incremental.cc
9142         (Output_section_incremental_inputs::write_input_files): Add cast
9143         to avoid signed/unsigned comparison warning.
9144         (Output_section_incremental_inputs::write_info_blocks): Likewise.
9145
9146 2010-08-12  Cary Coutant  <ccoutant@google.com>
9147
9148         * common.cc (Sort_commons::operator()): Remove unnecessary code.
9149
9150 2010-08-13  Ian Lance Taylor  <iant@google.com>
9151
9152         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
9153
9154 2010-08-12  Cary Coutant  <ccoutant@google.com>
9155             Doug Kwan  <dougkwan@google.com>
9156
9157         * resolve.cc (Symbol_table::should_override): When a weak dynamic
9158         defintion overrides non-weak undef, remember that the original undef
9159         is not weak.
9160         * symtab.cc (Symbol_table::sized_write_global): For undef without
9161         an original weak binding, set binding to global in output.
9162         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
9163         * testsuite/Makefile.in: Regenerate.
9164         * testsuite/strong_ref_weak_def.sh: New file.
9165         * testsuite/strong_ref_weak_def_1.c: Ditto.
9166         * testsuite/strong_ref_weak_def_2.c: Ditto.
9167
9168 2010-08-12  Cary Coutant  <ccoutant@google.com>
9169
9170         * testsuite/incremental_test.sh: Rewrite.
9171         * testsuite/incremental_test_1.c: Rewrite.
9172         * testsuite/incremental_test_2.c: Rewrite.
9173
9174 2010-08-12  Cary Coutant  <ccoutant@google.com>
9175
9176         * arm.cc (Target_arm::got_size): Add const.
9177         (Target_arm::got_entry_count): New function.
9178         (Target_arm::plt_entry_count): New function.
9179         (Target_arm::first_plt_entry_offset): New function.
9180         (Target_arm::plt_entry_size): New function.
9181         (Output_data_plt_arm::entry_count): New function.
9182         (Output_data_plt_arm::first_plt_entry_offset): New function.
9183         (Output_data_plt_arm::get_plt_entry_size): New function.
9184         * i386.cc (Target_i386::got_size): Add const.
9185         (Target_i386::got_entry_count): New function.
9186         (Target_i386::plt_entry_count): New function.
9187         (Target_i386::first_plt_entry_offset): New function.
9188         (Target_i386::plt_entry_size): New function.
9189         (Output_data_plt_i386::entry_count): New function.
9190         (Output_data_plt_i386::first_plt_entry_offset): New function.
9191         (Output_data_plt_i386::get_plt_entry_size): New function.
9192         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
9193         find_incremental_inputs_sections.  Dump incremental_got_plt section.
9194         * incremental.cc: Include target.h.
9195         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
9196         parameter.  Adjust all callers.  Find incremental_got_plt section.
9197         (Incremental_inputs::create_data_sections): Create incremental_got_plt
9198         section.
9199         (Output_section_incremental_inputs::set_final_data_size): Calculate
9200         size of incremental_got_plt section.
9201         (Output_section_incremental_inputs::do_write): Write the
9202         incremental_got_plt section.
9203         (Got_plt_view_info): New struct.
9204         (Local_got_offset_visitor): New class.
9205         (Global_got_offset_visitor): New class.
9206         (Global_symbol_visitor_got_plt): New class.
9207         (Output_section_incremental_inputs::write_got_plt): New function.
9208         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
9209         Add parameter.  Adjust all callers.
9210         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9211         (Incremental_inputs::got_plt_section): New function.
9212         (Incremental_inputs::got_plt_section_): New data member.
9213         (Incremental_got_plt_reader): New class.
9214         * layout.cc (Layout::create_incremental_info_sections): Add the
9215         incremental_got_plt section.
9216         * object.h (Got_offset_list::get_list): New function.
9217         (Got offset_list::for_all_got_offsets): New function.
9218         (Sized_relobj::local_got_offset_list): New function.
9219         * powerpc.cc (Target_powerpc::got_size): Add const.
9220         (Target_powerpc::got_entry_count): New function.
9221         (Target_powerpc::plt_entry_count): New function.
9222         (Target_powerpc::first_plt_entry_offset): New function.
9223         (Target_powerpc::plt_entry_size): New function.
9224         (Output_data_plt_powerpc::entry_count): New function.
9225         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
9226         (Output_data_plt_powerpc::get_plt_entry_size): New function.
9227         * sparc.cc (Target_sparc::got_size): Add const.
9228         (Target_sparc::got_entry_count): New function.
9229         (Target_sparc::plt_entry_count): New function.
9230         (Target_sparc::first_plt_entry_offset): New function.
9231         (Target_sparc::plt_entry_size): New function.
9232         (Output_data_plt_sparc::entry_count): New function.
9233         (Output_data_plt_sparc::first_plt_entry_offset): New function.
9234         (Output_data_plt_sparc::get_plt_entry_size): New function.
9235         * symtab.h (Symbol::got_offset_list): New function.
9236         (Symbol_table::for_all_symbols): New function.
9237         * target.h (Sized_target::got_entry_count): New function.
9238         (Sized_target::plt_entry_count): New function.
9239         (Sized_target::plt_entry_size): New function.
9240         * x86_64.cc (Target_x86_64::got_size): Add const.
9241         (Target_x86_64::got_entry_count): New function.
9242         (Target_x86_64::plt_entry_count): New function.
9243         (Target_x86_64::first_plt_entry_offset): New function.
9244         (Target_x86_64::plt_entry_size): New function.
9245         (Output_data_plt_x86_64::entry_count): New function.
9246         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
9247         (Output_data_plt_x86_64::get_plt_entry_size): New function.
9248
9249 2010-08-12  Cary Coutant  <ccoutant@google.com>
9250
9251         * archive.cc: Include incremental.h.
9252         (Archive::Archive): Initialize incremental_info_.
9253         (Archive::include_member): Record archive members in incremental info.
9254         (Add_archive_symbols::run): Record begin and end of an archive in
9255         incremental info.
9256         (Lib_group::include_member): Record objects in incremental info.
9257         * archive.h (Incremental_archive_entry): Forward declaration.
9258         (Archive::set_incremental_info): New member function.
9259         (Archive::incremental_info): New member function.
9260         (Archive::Unused_symbol_iterator): New class.
9261         (Archive::unused_symbols_begin): New member function.
9262         (Archive::unused_symbols_end): New member function.
9263         (Archive::incremental_info_): New data member.
9264         * incremental-dump.cc (find_input_containing_global): New function.
9265         (dump_incremental_inputs): Dump new incremental info sections.
9266         * incremental.cc: Include symtab.h.
9267         (Output_section_incremental_inputs): New class.
9268         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
9269         new incremental info sections.
9270         (Sized_incremental_binary::do_check_inputs): Likewise.
9271         (Incremental_inputs::report_archive): Remove.
9272         (Incremental_inputs::report_archive_begin): New function.
9273         (Incremental_inputs::report_archive_end): New function.
9274         (Incremental_inputs::report_object): New function.
9275         (Incremental_inputs::finalize_inputs): Remove.
9276         (Incremental_inputs::report_input_section): New function.
9277         (Incremental_inputs::report_script): Rewrite.
9278         (Incremental_inputs::finalize): Do nothing but finalize string table.
9279         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9280         (Incremental_inputs::sized_create_inputs_section_data): Remove.
9281         (Incremental_inputs::create_data_sections): New function.
9282         (Incremental_inputs::relocs_entsize): New function.
9283         (Output_section_incremental_inputs::set_final_data_size): New function.
9284         (Output_section_incremental_inputs::do_write): New function.
9285         (Output_section_incremental_inputs::write_header): New function.
9286         (Output_section_incremental_inputs::write_input_files): New function.
9287         (Output_section_incremental_inputs::write_info_blocks): New function.
9288         (Output_section_incremental_inputs::write_symtab): New function.
9289         * incremental.h (Incremental_script_entry): Forward declaration.
9290         (Incremental_object_entry): Forward declaration.
9291         (Incremental_archive_entry): Forward declaration.
9292         (Incremental_inputs): Forward declaration.
9293         (Incremental_inputs_header_data): Remove.
9294         (Incremental_inputs_header): Remove.
9295         (Incremental_inputs_header_write): Remove.
9296         (Incremental_inputs_entry_data): Remove.
9297         (Incremental_inputs_entry): Remove.
9298         (Incremental_inputs_entry_write): Remove.
9299         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
9300         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
9301         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9302         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
9303         Likewise.
9304         (Incremental_input_entry): New class.
9305         (Incremental_script_entry): New class.
9306         (Incremental_object_entry): New class.
9307         (Incremental_archive_entry): New class.
9308         (Incremental_inputs::Incremental_inputs): Initialize new data members.
9309         (Incremental_inputs::report_inputs): Remove.
9310         (Incremental_inputs::report_archive): Remove.
9311         (Incremental_inputs::report_archive_begin): New function.
9312         (Incremental_inputs::report_archive_end): New function.
9313         (Incremental_inputs::report_object): Change prototype.
9314         (Incremental_inputs::report_input_section): New function.
9315         (Incremental_inputs::report_script): Change prototype.
9316         (Incremental_inputs::get_reloc_count): New function.
9317         (Incremental_inputs::set_reloc_count): New function.
9318         (Incremental_inputs::create_data_sections): New function.
9319         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9320         (Incremental_inputs::inputs_section): New function.
9321         (Incremental_inputs::symtab_section): New function.
9322         (Incremental_inputs::relocs_section): New function.
9323         (Incremental_inputs::get_stringpool): Add const.
9324         (Incremental_inputs::command_line): Add const.
9325         (Incremental_inputs::inputs): Remove.
9326         (Incremental_inputs::command_line_key): New function.
9327         (Incremental_inputs::input_file_count): New function.
9328         (Incremental_inputs::input_files): New function.
9329         (Incremental_inputs::relocs_entsize): New function.
9330         (Incremental_inputs::sized_create_inputs_section_data): Remove.
9331         (Incremental_inputs::finalize_inputs): Remove.
9332         (Incremental_inputs::Input_info): Remove.
9333         (Incremental_inputs::lock_): Remove.
9334         (Incremental_inputs::inputs_): Change type.
9335         (Incremental_inputs::inputs_map_): Remove.
9336         (Incremental_inputs::current_object_entry_): New data member.
9337         (Incremental_inputs::inputs_section_): New data member.
9338         (Incremental_inputs::symtab_section_): New data member.
9339         (Incremental_inputs::relocs_section_): New data member.
9340         (Incremental_inputs::reloc_count_): New data member.
9341         (Incremental_inputs_reader): New class.
9342         (Incremental_symtab_reader): New class.
9343         (Incremental_relocs_reader): New class.
9344         * layout.cc (Layout::finalize): Move finalization of incremental info
9345         and creation of incremental info sections to follow finalization of
9346         symbol table.  Set offsets for postprocessing sections.
9347         (Layout::create_incremental_info_sections): Call
9348         Incremental_inputs::create_data_sections.  Add incremental symtab
9349         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
9350         sections to layout after input sections.
9351         * layout.h (struct Timespec): Forward declaration.
9352         (Layout::incremental_inputs): Add const.
9353         (Layout::create_incremental_info_sections): Add parameter.
9354         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
9355         * object.cc: Include incremental.h.
9356         (Relobj::finalize_incremental_relocs): New function.
9357         (Sized_relobj::do_layout): Record input sections in incremental info.
9358         * object.h (Object::output_section): New function.
9359         (Object::output_section_offset): Moved from Relobj.
9360         (Object::get_incremental_reloc_base): New function.
9361         (Object::get_incremental_reloc_count): New function.
9362         (Object::do_output_section): New function.
9363         (Object::do_output_section_offset): Moved from Relobj.
9364         (Object::do_get_incremental_reloc_base): New function.
9365         (Object::do_get_incremental_reloc_count): New function.
9366         (Object::Object): Initialize new data members.
9367         (Relobj::output_section): Renamed do_output_section and moved to
9368         protected.
9369         (Relobj::output_section_offset): Moved to Object.
9370         (Relobj::do_get_incremental_reloc_base): New function.
9371         (Relobj::do_get_incremental_reloc_count): New function.
9372         (Relobj::allocate_incremental_reloc_counts): New function.
9373         (Relobj::count_incremental_reloc): New function.
9374         (Relobj::finalize_incremental_relocs): New function.
9375         (Relobj::next_incremental_reloc_index): New function.
9376         (Relobj::reloc_counts_): New data member.
9377         (Relobj::reloc_bases_): New data member.
9378         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
9379         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
9380         (Sized_relobj::incremental_relocs_scan): New function.
9381         (Sized_relobj::incremental_relocs_scan_reltype): New function.
9382         (Sized_relobj::incremental_relocs_write): New function.
9383         (Sized_relobj::incremental_relocs_write_reltype): New function.
9384         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
9385         incremental link.
9386         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
9387         archives and object files elsewhere.
9388         (Add_symbols::run): Report object files here.
9389         (Finish_group::run): Report end of archive at end of group.
9390         * reloc.cc: Include layout.h, incremental.h.
9391         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
9392         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
9393         (Sized_relobj::incremental_relocs_scan): New function.
9394         (Sized_relobj::incremental_relocs_scan_reltype): New function.
9395         (Sized_relobj::do_relocate_sections): Write incremental relocations.
9396         (Sized_relobj::incremental_relocs_write): New function.
9397         (Sized_relobj::incremental_relocs_write_reltype): New function.
9398         * script.cc (read_input_script): Rewrite test for incremental link.
9399         Change call to Incremental_inputs::report_script.
9400         * symtab.h (Symbol_table::first_global_index): New function.
9401         (Symbol_table::output_count): New function.
9402
9403 2010-08-12  Doug Kwan  <dougkwan@google.com>
9404
9405         * arm.cc (Target_arm::merge_object_attributes): Check command line
9406         options --no-wchar-size-warning and --no-enum-size-warning.
9407         * options.h (General_options): Add ld-compatible options
9408         --no-enum-size-warning and --no-wchar-size-warning.
9409
9410 2010-08-04  Ian Lance Taylor  <iant@google.com>
9411
9412         * x86_64.cc (Target_x86_64::Scan::local): Use
9413         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
9414         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
9415         (Target_x86_64::Scan::global): Likewise.
9416         (Target_x86_64::Relocate::relocate): Likewise.
9417         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
9418         Likewise.
9419
9420 2010-08-03  Cary Coutant  <ccoutant@google.com>
9421
9422         * merge.cc (Output_merge_string::do_add_input_section): Count strings
9423         to reserve space in merged_strings vector. Keep total input size
9424         for stats.
9425         (Output_merge_string::do_print_merge_stats): Print total input size.
9426         * merge.h (Output_merge_string): Add input_size_ field.
9427         * stringpool.cc (Stringpool_template::string_length): Move
9428         implementations out of Stringpool_template class and place in
9429         stringpool.h.
9430         * stringpool.h (string_length): Move out of Stringpool_template.
9431
9432 2010-08-03  Ian Lance Taylor  <iant@google.com>
9433
9434         PR 11712
9435         * layout.cc (relaxation_loop_body): If address of load segment is
9436         set, adjust address to include headers if possible.
9437
9438 2010-08-03  Ian Lance Taylor  <iant@google.com>
9439
9440         * version.cc (version_string): Bump to 1.10.
9441
9442 2010-08-03  Ian Lance Taylor  <iant@google.com>
9443
9444         PR 11805
9445         * layout.h (enum Output_section_order): Define.
9446         (class Layout): Update declarations.
9447         * layout.cc (Layout::get_output_section): Add order parameter.
9448         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
9449         is_first_non_relro parameters.  Change all callers.
9450         (Layout::choose_output_section): Likewise.
9451         (Layout::add_output_section_data): Likewise.
9452         (Layout::make_output_section): Likewise.  Set order.
9453         (Layout::default_section_order): New function.
9454         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
9455         * output.cc (Output_section::Output_section): Initialize order_.
9456         Don't initialize deleted fields.
9457         (Output_segment::Output_segment): Don't initialize deleted
9458         fields.
9459         (Output_segment::add_output_section_to_load): New function
9460         replacing add_output_section.  Change all callers to call this or
9461         add_output_section_to_nonload.
9462         (Output_segment::add_output_section_to_nonload): New function.
9463         (Output_segment::remove_output_section): Rewrite.
9464         (Output_segment::add_initial_output_data): Likewise.
9465         (Output_segment::has_any_data_sections): Likewise.
9466         (Output_segment::is_first_section_relro): Likewise.
9467         (Output_segment::maximum_alignment): Likewise.
9468         (Output_segment::has_dynamic_reloc): New function replacing
9469         dynamic_reloc_count.  Change all callers.
9470         (Output_segment::has_dynamic_reloc_list): New function replacing
9471         dynamic_reloc_count_list.  Change all callers.
9472         (Output_segment::set_section_addresses): Rewrite.
9473         (Output_segment::set_offset): Rewrite.
9474         (Output_segment::find_first_and_last_list): Remove.
9475         (Output_segment::set_tls_offsets): Rewrite.
9476         (Output_segment::first_section_load_address): Likewise.
9477         (Output_segment::output_section_count): Likewise.
9478         (Output_segment::section_with_lowest_load_address): Likewise.
9479         (Output_segment::write_section_headers): Likewise.
9480         (Output_segment::print_sections_to_map): Likewise.
9481         * output.h (class Output_data): Remove dynamic_reloc_count_
9482         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
9483         (Output_data::add_dynamic_reloc): Rewrite.
9484         (Output_data::has_dynamic_reloc): New function.
9485         (Output_data::dynamic_reloc_count): Remove.
9486         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
9487         is_last_relro_, is_first_non_relro_, is_interp_,
9488         is_dynamic_linker_section_ fields.  Add order and set_order
9489         functions.  Remove is_relro_local, set_is_relro_local,
9490         is_last_relro, set_is_last_relro, is_first_non_relro,
9491         set_is_first_non_relro functions, is_interp, set_is_interp,
9492         is_dynamic_linker_section, and set_is_dynamic_linker_section
9493         functions.
9494         (class Output_segment): Change Output_data_list from std::list to
9495         std:;vector.  Add output_lists_ field.  Remove output_data_ and
9496         output_bss_ fields.  Update declarations.
9497
9498 2010-08-02  Ian Lance Taylor  <iant@google.com>
9499
9500         * arm.cc (Target_arm::gc_process_relocs): Use typename.
9501         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
9502         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
9503
9504 2010-08-02  Ian Lance Taylor  <iant@google.com>
9505
9506         PR 11855
9507         * script.cc (Script_options::Script_options): Initialize
9508         symbol_definitions_ and symbol_references_.
9509         (Script_options::add_symbol_assignment): Update
9510         symbol_definitions_ and symbol_references_.
9511         (Script_options::add_symbol_reference): New function.
9512         (script_symbol): New function.
9513         * script.h (class Script_options): Add symbol_definitions_ and
9514         symbol_references_ fields.
9515         (Script_options::referenced_const_iterator): New type.
9516         (Script_options::referenced_begin): New function.
9517         (Script_options::referenced_end): New function.
9518         (Script_options::is_referenced): New function.
9519         (Script_options::any_unreferenced): New function.
9520         * script-c.h (script_symbol): Declare.
9521         * yyscript.y (exp): Call script_symbol.
9522         * symtab.cc: Include "script.h".
9523         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
9524         Change all callers.  Check symbols referenced by scripts.
9525         (Symbol_table::add_undefined_symbols_from_command_line): Add
9526         layout parameter.  Change all callers.
9527         (Symbol_table::do_add_undefined_symbols_from_command_line):
9528         Likewise.  Break out loop body.  Check symbols referenced by
9529         scripts.
9530         (Symbol_table::add_undefined_symbol_from_command_line): New
9531         function broken out of
9532         do_add_undefined_symbols_from_command_line.
9533         * symtab.h (class Symbol_table): Update declarations.
9534         * archive.cc: Include "layout.h".
9535         (Archive::should_include_member): Add layout parameter.  Change
9536         all callers.  Check for symbol mentioned in expression.
9537         * archive.h (class Archive): Update declaration.
9538         * object.cc (Sized_relobj::do_should_include_member): Add layout
9539         parameter.
9540         * object.h (Object::should_include_member): Add layout parameter.
9541         Change all callers.
9542         (Object::do_should_include_member): Add layout parameter.
9543         (class Sized_relobj): Update declaration.
9544         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
9545         parameter.
9546         * dynobj.h (class Sized_dynobj): Update declaration.
9547         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
9548         layout parameter.
9549         * plugin.h (class Sized_pluginobj): Update declaration.
9550
9551 2010-08-02  Ian Lance Taylor  <iant@google.com>
9552
9553         PR 11866
9554         * output.cc (Output_segment::set_offset): Search for the first and
9555         last sections rather than assuming that the list is in order.
9556         (Output_segment::find_first_and_last_list): New function.
9557         * output.h (class Output_segment): Update declarations.
9558         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
9559         (relro_strip_test_SOURCES): New variable.
9560         (relro_strip_test_DEPENDENCIES): New variable.
9561         (relro_strip_test_LDFLAGS): New variable.
9562         (relro_strip_test_LDADD): New variable.
9563         (relro_strip_test.so): New target.
9564
9565 2010-08-02  Ian Lance Taylor  <iant@google.com>
9566
9567         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
9568         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
9569         (Target_i386::got_tlsdesc_section): New function.
9570         (Target_i386::got_section): Create space for GOT entries for
9571         TLSDESC relocations.
9572         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
9573         R_386_TLS_GOTDESC.
9574         (Target_i386::Scan::global): Likewise.
9575         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
9576         using TLSDESC GOT.
9577         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
9578         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
9579         (Target_x86_64::got_tlsdesc_section): New function.
9580         (Target_x86_64::got_section): Create space for GOT entries for
9581         TLSDESC relocations.
9582         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
9583         R_386_TLS_GOTDESC.
9584         (Target_x86_64::Scan::global): Likewise.
9585         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
9586         using TLSDESC GOT.
9587
9588 2010-08-02  Ian Lance Taylor  <iant@google.com>
9589
9590         * testsuite/final_layout.sh: Use dc to convert from hex to
9591         decimal.
9592
9593 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
9594
9595         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
9596         paramter to the call to gold::gc_process_relocs.
9597         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
9598         paramter to the call to gold::gc_process_relocs.
9599         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
9600         parameter to the call to gold::gc_process_relocs.
9601         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
9602         template parameter to the call to gold::gc_process_relocs.
9603         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
9604         paramter to the call to gold::gc_process_relocs.
9605         * gc.h (get_embedded_addend_size): New function.
9606         (gc_process_relocs): Save the size of the reloc for use by ICF.
9607         * icf.cc (get_section_contents): Get the addend from the text section
9608         for SHT_REL relocation sections.
9609         * icf.h (Icf::Reloc_addend_size_info): New typedef.
9610         (Icf::Reloc_info): Add new member reloc_addend_size_info.
9611         * int_encoding.h (read_from_pointer): New overloaded function.
9612         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
9613         * testsuite/icf_sht_rel_addend_test.sh: New file.
9614         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
9615         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
9616
9617 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9618
9619         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
9620         * Makefile.in: Regenerate.
9621         * testsuite/Makefile.in: Regenerate.
9622
9623 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
9624
9625         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
9626         * gold/testsuite/debug_msg.cc: Likewise.
9627         * gold/testsuite/odr_violation1.cc
9628         * gold/testsuite/odr_violation2.cc
9629
9630 2010-07-21  Cary Coutant  <ccoutant@google.com>
9631
9632         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
9633         string, and length fields.
9634         (Output_merge_string::Merged_strings_list): New type.
9635         (Output_merge_string::Merged_strings_lists): New typedef.
9636         (Output_merge_string): Replace merged_strings_ with
9637         merged_strings_lists_.
9638         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
9639         Merged_strings_list per input object and section.  Don't store pointer
9640         to the string.  Don't store length with each merged string entry.
9641         (Output_merge_string::finalize_merged_data): Loop over list of merged
9642         strings lists.  Recompute length of each merged string.
9643
9644 2010-07-15  Cary Coutant  <ccoutant@google.com>
9645
9646         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
9647         here.
9648
9649 2010-07-14  Ian Lance Taylor  <iant@google.com>
9650
9651         * descriptors.cc (Descriptors::open): Report correct name in error
9652         message.
9653
9654 2010-07-13  Doug Kwan  <dougkwan@google.com>
9655
9656         * arm.cc (Arm_input_section::Arm_input_section): For a
9657         SHT_ARM_EXIDX section, always keeps the input sections.
9658         (Arm_input_section::set_exidx_section_link): New method.
9659         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
9660         has_errors_ to false.
9661         (Arm_exidx_input_section::has_errors,
9662         Arm_exidx_input_section::set_has_errors): New methods.
9663         (Arm_exidx_input_section::has_errors_): New data member.
9664         (Arm_relobj::get_exidx_shndx_list): New method.
9665         (Arm_output_section::append_text_sections_to_list): Do not skip
9666         section without SHF_EXECINSTR.
9667         (Arm_output_section::fix_exidx_coverage): Skip input sections with
9668         errors.
9669         (Arm_relobj::make_exidx_input_section): Add new parameter for text
9670         section header.  Make error messages more verbose.  Check for
9671         a non-executable section linked to an EXIDX section.
9672         (Arm_relobj::do_read_symbols): Remove error checking, which has been
9673         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
9674         check that there is no deferred EXIDX section if we exit early.
9675         Instead of not making an EXIDX section in case of an error, make one
9676         and set the has_errors flag of it.
9677         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
9678         in a relocatable link.
9679         (Target_arm::do_relax): Look for the EXIDX output section instead of
9680         assuming that it is called .ARM.exidx.
9681         (Target_arm::fix_exidx_coverage): Add a new parameter for input
9682         section list.  Do not check for SHF_EXECINSTR section flags but
9683         skip any input section with errors.
9684         * output.cc (Output_section::Output_section): Initialize
9685         always_keeps_input_sections_ to false.
9686         (Output_section::add_input_section): Check for
9687         always_keeps_input_sections_.
9688         *  output.h (Output_section::always_keeps_input_sections,
9689         Output_section::set_always_keeps_input_sections): New methods.
9690         (Output_section::always_keeps_input_sections): New data member.
9691
9692 2010-07-13  Rafael Espindola  <espindola@google.com>
9693
9694         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
9695         * fileread.h (Input_file): Add try_extra_search_path and find_file.
9696
9697 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
9698             Ian Lance Taylor  <iant@google.com>
9699
9700         * output.h (Output_section_lookup_maps::add_merge_section):
9701         Correct check of whether value was inserted.
9702         (Output_section_lookup_maps::add_merge_input_section): Likewise.
9703         (Output_section_lookup_maps::add_relaxed_input_section):
9704         Likewise.
9705         * arm.cc (Target_arm::got_section): Remove used local os.
9706         * i386.cc (Target_i386::got_section): Likewise.
9707         * x86_64.cc (Target_x86_64::got_section): Likewise.
9708         * sparc.cc (Target_sparc::got_section): Likewise.
9709         (Target_sparc::relocate): Remove unused local have_got_offset.
9710         * powerpc.cc (Target_powerpc::relocate): Likewise.
9711
9712 2010-07-13  Ian Lance Taylor  <iant@google.com>
9713
9714         * compressed_output.cc (zlib_decompress): Fix signature in
9715         !HAVE_ZLIB_H case.
9716
9717         * archive.cc (Archive::include_member): Unlock an external member
9718         of a thin archive.  Don't bother to delete an object we know is
9719         NULL.
9720
9721 2010-07-12  Cary Coutant  <ccoutant@google.com>
9722
9723         * compressed_output.cc (zlib_decompress): New function.
9724         (get_uncompressed_size): New function.
9725         (decompress_input_section): New function.
9726         * compressed_output.h (get_uncompressed_size): New function.
9727         (decompress_input_section): New function.
9728         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
9729         Handle compressed debug sections.
9730         * layout.cc (is_compressed_debug_section): New function.
9731         (Layout::output_section_name): Map compressed section names to
9732         canonical names.
9733         * layout.h (is_compressed_debug_section): New function.
9734         (is_debug_info_section): Recognize compressed debug sections.
9735         * merge.cc: Include compressed_output.h.
9736         (Output_merge_data::do_add_input_section): Handle compressed
9737         debug sections.
9738         (Output_merge_string::do_add_input_section): Handle compressed
9739         debug sections.
9740         * object.cc: Include compressed_output.h.
9741         (Sized_relobj::Sized_relobj): Initialize new data members.
9742         (build_compressed_section_map): New function.
9743         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
9744         * object.h (Object::section_is_compressed): New method.
9745         (Object::do_section_is_compressed): New method.
9746         (Sized_relobj::Compressed_section_map): New type.
9747         (Sized_relobj::do_section_is_compressed): New method.
9748         (Sized_relobj::compressed_sections_): New data member.
9749         * output.cc (Output_section::add_input_section): Handle compressed
9750         debug sections.
9751         * reloc.cc: Include compressed_output.h.
9752         (Sized_relobj::write_sections): Handle compressed debug sections.
9753
9754 2010-07-08  Cary Coutant  <ccoutant@google.com>
9755
9756         * resolve.cc (Symbol_table::resolve): Remember whether undef was
9757         weak when resolving to a dynamic def.
9758         (Symbol_table::should_override): Add adjust_dyndef flag; set it
9759         for weak undef/dynamic def cases. Adjust callers.
9760         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
9761         undef_binding_weak_.
9762         (Symbol_table::sized_write_globals): Adjust symbol binding.
9763         (Symbol_table::sized_write_symbol): Add binding parameter.
9764         * symtab.h (Symbol::set_undef_binding): New method.
9765         (Symbol::is_undef_binding_weak): New method.
9766         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
9767         (Symbol_table::should_override): Add new parameter.
9768         (Symbol_table::sized_write_symbol): Add new parameter.
9769
9770         * testsuite/weak_undef_file1.cc: Add new test case.
9771         * testsuite/weak_undef_file2.cc: Fix header comment.
9772         * testsuite/weak_undef_test.cc: Add new test case.
9773
9774 2010-06-29  Doug Kwan  <dougkwan@google.com>
9775
9776         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
9777         Initialize USE_SYMBOL_.
9778         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
9779         definition.
9780         (Arm_reloc_property::uses_symbol_): New data member declaration.
9781         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
9782         uses symbol value and symbol is undefined but not weakly undefined.
9783
9784 2010-06-28  Rafael Espindola  <espindola@google.com>
9785
9786         * plugin.cc (Plugin::load): Use dlerror.
9787
9788 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
9789
9790         * symtab.cc (detect_odr_violations): When reporting an ODR
9791         violation, report an object where the symbol is defined.
9792
9793 2010-06-25  Doug Kwan  <dougkwan@google.com>
9794
9795         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
9796         (Target_arm::section_may_have_icf_unsafe_pointers): New method
9797         definition.
9798         (Target_arm::Scan::local_reloc_may_be_function_pointer,
9799         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
9800         target hook to detect function points.
9801         (Target_arm::Scan::possible_function_pointer_reloc): New method.
9802         * icf.h (Icf::check_section_for_function_pointers): Change type of
9803         parameter SECTION_NAME to const reference to std::string.  Use
9804         target hook to determine if section may have unsafe pointers.
9805         * target.h (Target::section_may_have_icf_unsafe_pointers): New
9806         method definition.
9807
9808 2010-06-21  Rafael Espindola  <espindola@google.com>
9809
9810         * fileread.cc (Input_file::find_fie): New
9811         (Input_file::open): Use Input_file::find_fie.
9812         * fileread.h (Input_file::find_fie): New
9813         * plugin.cc (set_extra_library_path): New.
9814         (Plugin::load): Add set_extra_library_path to the transfer vector.
9815         (Plugin_manager::set_extra_library_path): New.
9816         (Plugin_manager::add_input_file): Use the extra search path if set.
9817         (set_extra_library_path(): New.
9818         * plugin.h (Plugin_manager): Add set_extra_library_path and
9819         extra_search_path_.
9820
9821 2010-06-19  Cary Coutant  <ccoutant@google.com>
9822
9823         * layout.cc (gdb_sections): Add .debug_types.
9824         (lines_only_debug_sections): Likewise.
9825
9826 2010-06-18  Rafael Espindola  <espindola@google.com>
9827
9828         * plugin.cc (add_input_file,add_input_library)
9829         (Plugin_manager::add_input_file): Make filename arguments const.
9830         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
9831         const.
9832
9833 2010-06-16  Doug Kwan  <dougkwan@google.com>
9834
9835         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
9836         .ARM.attributes section if we have not merged any input
9837         attributes sections.
9838
9839 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9840
9841         * arm.cc: Allow combining objects with no EABI version
9842         information.
9843
9844 2010-06-15  Rafael Espindola  <espindola@google.com>
9845
9846         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
9847
9848 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9849
9850         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
9851         (struct iovec): Correct !HAVE_READV definition.
9852
9853 2010-06-10  Cary Coutant  <ccoutant@google.com>
9854
9855         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
9856         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
9857         reloc sections.
9858         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
9859
9860         PR 11683
9861         * symtab.h (Symbol::is_placeholder): New member function.
9862         * target-reloc.h (relocate_section): Check for placeholder symbols.
9863
9864         * testsuite/Makefile.am (plugin_test_8): New test.
9865         (plugin_test_9): New test.
9866         * testsuite/Makefile.in: Regenerate.
9867
9868 2010-06-09  Nick Clifton  <nickc@redhat.com>
9869
9870         * yyscript.y (input_list_element): Allow strings prefixed with
9871         the '-' character.  Treat these as libraries.
9872         * script.cc (script_add_library): New function.  Adds a library
9873         specified by "-l<name>" found in an input script.
9874         * script-c.h: Add prototype for script_add_library.
9875
9876 2010-06-07  Doug Kwan  <dougkwan@google.com>
9877
9878         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
9879         Restrict stub-group size to be within long conditional branch
9880         range when working around cortex-A8 erratum.
9881
9882 2010-06-07  Damien Diederen  <dd@crosstwine.com>
9883
9884         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
9885         #ifdef typo.
9886
9887 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
9888
9889         PR gold/11658
9890         * output.cc
9891         (Output_section::Input_section_sort_entry::compare_section_ordering):
9892         Change to return non-zero correctly.
9893         (Output_section::Input_section_sort_section_order_index_compare
9894         ::operator()): Change to fix ambiguity in comparisons.
9895
9896 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
9897
9898         * gold.h (is_wildcard_string): New function.
9899         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
9900         (Layout::layout_eh_frame): Ditto.
9901         (Layout::find_section_order_index): New method.
9902         (Layout::read_layout_from_file): New method.
9903         * layout.h (Layout::find_section_order_index): New method.
9904         (Layout::read_layout_from_file): New method.
9905         (Layout::input_section_position_): New private member.
9906         (Layout::input_section_glob_): New private member.
9907         * main.cc (main): Call read_layout_from_file here.
9908         * options.h (--section-ordering-file): New option.
9909         * output.cc (Output_section::input_section_order_specified_): New
9910         member.
9911         (Output_section::Output_section): Initialize new member.
9912         (Output_section::add_input_section): Add new parameter.
9913         Keep input sections when --section-ordering-file is used.
9914         (Output_section::set_final_data_size): Sort input sections when
9915         section ordering file is specified.
9916         (Output_section::Input_section_sort_entry): Add new parameter.
9917         Check sorting type.
9918         (Output_section::Input_section_sort_entry::compare_section_ordering):
9919         New method.
9920         (Output_section::Input_section_sort_compare::operator()): Change to
9921         consider section_order_index.
9922         (Output_section::Input_section_sort_init_fini_compare::operator()):
9923         Change to consider section_order_index.
9924         (Output_section::Input_section_sort_section_order_index_compare
9925         ::operator()): New method.
9926         (Output_section::sort_attached_input_sections): Change to sort
9927         according to section order when specified.
9928         (Output_section::add_input_section<32, true>): Add new parameter.
9929         (Output_section::add_input_section<64, true>): Add new parameter.
9930         (Output_section::add_input_section<32, false>): Add new parameter.
9931         (Output_section::add_input_section<64, false>): Add new parameter.
9932         * output.h (Output_section::add_input_section): Add new parameter.
9933         (Output_section::input_section_order_specified): New
9934         method.
9935         (Output_section::set_input_section_order_specified): New method.
9936         (Input_section::Input_section): Initialize section_order_index_.
9937         (Input_section::section_order_index): New method.
9938         (Input_section::set_section_order_index): New method.
9939         (Input_section::section_order_index_): New member.
9940         (Input_section::Input_section_sort_section_order_index_compare): New
9941         struct.
9942         (Output_section::input_section_order_specified_): New member.
9943         * script-sections.cc (is_wildcard_string): Delete and move modified
9944         method to gold.h.
9945         (Output_section_element_input::Output_section_element_input): Modify
9946         call to is_wildcard_string.
9947         (Output_section_element_input::Input_section_pattern
9948         ::Input_section_pattern): Ditto.
9949         (Output_section_element_input::Output_section_element_input): Ditto.
9950         * testsuite/Makefile.am (final_layout): New test case.
9951         * testsuite/Makefile.in: Regenerate.
9952         * testsuite/final_layout.cc: New file.
9953         * testsuite/final_layout.sh: New file.
9954
9955 2010-06-01  Rafael Espindola  <espindola@google.com>
9956
9957         * plugin.cc (Plugin::load): Pass the output name to the plugin.
9958
9959 2010-06-01  Rafael Espindola  <espindola@google.com>
9960
9961         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
9962         visibility of symbols.
9963
9964 2010-05-27  Doug Kwan  <dougkwan@google.com>
9965
9966         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
9967         from start of output section instead of address for a local symbol
9968         in a merged or relaxed section when doing a relocatable link.
9969
9970 2010-05-26  Rafael Espindola  <espindola@google.com>
9971
9972         PR 11604
9973         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
9974         adding sections the garbage collector removed.
9975         * gold/testsuite/Makefile.am: Add test.
9976         * gold/testsuite/Makefile.in: Regenerate.
9977         * gold/testsuite/plugin_test_7.sh: New.
9978         * gold/testsuite/plugin_test_7_1.c: New.
9979         * gold/testsuite/plugin_test_7_2.c: New.
9980
9981 2010-05-26  Rafael Espindola  <espindola@google.com>
9982
9983         * script-sections.cc (Output_section_definition::set_section_addresses):
9984         Check for --section-start.
9985
9986 2010-05-26  Doug Kwan  <dougkwan@google.com>
9987
9988         * arm.cc (Arm_scan_relocatable_relocs): New class.
9989         (Target_arm::relocate_special_relocatable): New method.
9990         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
9991         (Arm_relocate_functions::thumb_branch_common): Same.
9992         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
9993         instead of Default_scan_relocatable_relocs.
9994         * target-reloc.h (relocate_for_relocatable): Let target handle
9995         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
9996         * target.h (Sized_target::relocate_special_relocatable): New method.
9997
9998 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9999
10000         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
10001
10002 2010-05-23  Doug Kwan  <dougkwan@google.com>
10003
10004         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
10005         instead of a cast.
10006         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
10007         with a direct branch, not a conditional branch, to a stub.
10008         * merge.cc (Output_merge_base::record_input_section): New method
10009         defintion.
10010         (Output_merge_data::do_add_input_section): Record input section if
10011         keeps-input-sections flag is set.
10012         (Output_merge_string::do_add_input_section): Ditto.
10013         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
10014         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
10015         INPUT_SECTIONS_.
10016         (Output_merge_base::keeps_input_sections,
10017         Output_merge_base::set_keeps_input_sections,
10018         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
10019         method definitions.
10020         (Output_merge_base::Input_sections): New type declaration.
10021         (Output_merge_base::input_sections_begin,
10022         Output_merge_base::input_sections_end,
10023         Output_merge_base::do_set_keeps_input_sections): New method definitions.
10024         (Output_merge_base::bool keeps_input_sections_,
10025         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
10026         Output_merge_base::input_sections_): New data members.
10027         (Output_merge_data::do_set_keeps_input_sections): New method
10028         defintion.
10029         (Output_merge_string::do_set_keeps_input_sections): Ditto.
10030         * output.cc (Output_section::Input_section::relobj): Move method
10031         defintion from class declaration to here and handle merge sections.
10032         (Output_section::Input_section::shndx): Ditto.
10033         (Output_section::Output_section): Remove initializations of removed
10034         data members and initialize new data member LOOKUP_MAPS_.
10035         (Output_section::add_input_section): Set keeps-input-sections flag
10036         for a newly created merge output section as appropriate.  Adjust code
10037         to use Output_section_lookup_maps class.
10038         (Output_section::add_relaxed_input_section): Adjst code for lookup
10039         maps code refactoring.
10040         (Output_section::add_merge_input_section): Add a new parameter
10041         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
10042         class.  If adding input section to a newly created merge output
10043         section fails, remove the new merge section.
10044         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
10045         Adjust code for use of the Output_section_lookup_maps class.
10046         (Output_section::find_merge_section): Ditto.
10047         (Output_section::build_lookup_maps): New method defintion.
10048         (Output_section::find_relaxed_input_section): Adjust code to use
10049         Output_section_lookup_maps class.
10050         (Output_section::get_input_sections): Export merge sections.  Adjust
10051         code to use Output_section_lookup_maps class.
10052         (Output_section:::add_script_input_section): Adjust code to use
10053         Output_section_lookup_maps class.  Update lookup maps for merge
10054         sections also.
10055         (Output_section::discard_states): Use Output_section_lookup_maps.
10056         (Output_section::restore_states): Same.
10057         * output.h (Merge_section_properties): Move class defintion out of
10058         Output_section.
10059         (Output_section_lookup_maps): New class.
10060         (Output_section::Input_section::is_merge_section): New method
10061         defintion.
10062         (Output_section::Input_section::relobj): Move defintion out of class
10063         defintion.  Declare method only.
10064         (Output_section::Input_section::shndx): Ditto.
10065         (Output_section::Input_section::output_merge_base): New method defintion.
10066         (Output_section::Input_section::u2_.pomb): New union field.
10067         (Output_section::Merge_section_by_properties_map,
10068         Output_section::Output_section_data_by_input_section_map,
10069         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
10070         Remove types.
10071         (Output_section::add_merge_input_section): Add new parameter
10072         KEEPS_INPUT_SECTIONS.
10073         (Output_section::build_lookup_maps): New method declaration.
10074         (Output_section::merge_section_map_,
10075         Output_section::merge_section_by_properties_map_,
10076         Output_section::relaxed_input_section_map_,
10077         Output_section::is_relaxed_input_section_map_valid_): Remove data
10078         members.
10079         (Output_section::lookup_maps_): New data member.
10080
10081 2010-05-21  Doug Kwan  <dougkwan@google.com>
10082
10083         PR gold/11619
10084         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
10085         avoid a compilation error.
10086
10087 2010-05-19  Rafael Espindola  <espindola@google.com>
10088
10089         * script-sections.cc (Output_section_definition::allocate_to_segment):
10090         Update the phdrs_list even when the output section is NULL.
10091         * testsuite/Makefile.am: Add test.
10092         * testsuite/Makefile.in: Regenerate.
10093         * testsuite/script_test_9.cc: New.
10094         * testsuite/script_test_9.sh: New.
10095         * testsuite/script_test_9.t: New.
10096
10097 2010-05-19  Doug Kwan  <dougkwan@google.com>
10098
10099         * arm.cc (Arm_input_section::original_size): New method.
10100         (Arm_input_section::do_addralign): Add a cast.
10101         (Arm_input_section::do_output_offset): Remove static cast.
10102         (Arm_input_section::original_addralign,
10103          Arm_input_section::original_size_): Change type to uint32_t.
10104         (Arm_input_section::init): Add safe casts for section alignment
10105         and size.
10106         (Arm_input_section::set_final_data_size): Do not set address and
10107         offset of stub table.
10108         (Arm_output_section::fix_exidx_coverage): Change use of of
10109         Output_section::Simple_input_section to that of
10110         Output_section::Input_section.
10111         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
10112         except for the first pass.
10113         * output.cc (Output_section::get_input_sections): Change type of
10114         input_sections to std::list<Input_section>.
10115         (Output_section::add_script_input_section): Rename from
10116         Output_section::add_simple_input_section.  Change type of SIS
10117         parameter from Simple_input_section to Input_section.
10118         * output.h (Output_section::Simple_input_section): Remove class.
10119         (Output_section::Input_section): Change class visibility to public.
10120         (Output_section::Input_section::addralign): Use stored alignments
10121         for special input sections if set.
10122         (Output_section::Input_section::set_addralign): New method.
10123         (Output_section::get_input_sections): Change parameter type from
10124         list of Simple_input_section to list of Input_section.
10125         (Output_section::add_script_input_section): Rename from
10126         Output_section::add_simple_input_section. Change first parameter's
10127         type from Simple_input_section to Input_section and remove the
10128         second and third parameters.
10129         * script-sections.cc (Input_section::Input_section_list): Change
10130         type to list of Output_section::Input_section/
10131         (Input_section_info::Input_section_info): Change parameter type of
10132         INPUT_SECTION to Output_section::Input_section.
10133         (Input_section_info::input_section): Change return type.
10134         (Input_section_info::input_section_): Change type to
10135         Output_section::Input_section.
10136         (Output_section_element_input::set_section_addresses): Adjust code
10137         to use Output_section::Input_section instead of
10138         Output_section::Simple_input_section.  Adjust code for renaming
10139         of Output_section::add_simple_input_section.
10140         (Orphan_output_section::set_section_addresses): Ditto.
10141
10142 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10143
10144         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
10145         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
10146
10147 2010-05-18  Rafael Espindola  <espindola@google.com>
10148
10149         * options.cc (General_options::finalize): Handle -nostdlib.
10150         * options.h (nostdlib): New option.
10151         * script.cc (script_add_search_dir): Handle -nostdlib.
10152
10153 2010-05-12  Doug Kwan  <dougkwan@google.com>
10154
10155         * arm.cc (Target_arm::do_finalize_sections): Create an empty
10156         attributes section only if there no attributes section after merging.
10157         (Target_arm::merge_object_attributes): Move value of
10158         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
10159         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
10160         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
10161         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
10162         and arm_attr_merge_7.stdout.
10163         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
10164         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
10165         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
10166         arm_attr_merge_7b.o): New rules.
10167         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
10168         arm_attr_merge_7
10169         * testsuite/Makefile.in: Regenerate.
10170         * testsuite/arm_attr_merge.sh: New file.
10171         * testsuite/arm_attr_merge_[67][ab].s: Same.
10172
10173 2010-05-05  Nick Clifton  <nickc@redhat.com>
10174
10175         * po/es.po: Updated Spanish translation.
10176
10177 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
10178
10179         * Makefile.am (install-exec-local): Properly install gold as
10180         default cross linker.
10181         * Makefile.in: Regenerated.
10182
10183 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
10184             Nick Clifton  <nickc@redhat.com>
10185
10186         * configure.ac (install_as_default): Define and set to false
10187         unless --enable-gold or --enable-gold=both/gold has been
10188         specified.
10189         * configure: Regenerate.
10190
10191         * Makefile.am (install-exec-local): Install the executable as
10192         'ld.gold'.  If install_as_default is true then also install it as
10193         'ld'.
10194         * Makefile.in: Regenerated.
10195
10196 2010-04-24  Ian Lance Taylor  <iant@google.com>
10197
10198         * layout.cc (Layout::layout_reloc): In relocatable link don't
10199         combine reloc sections for grouped sections.
10200
10201 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
10202
10203         * gc.h (gc_process_relocs): Pass information on relocs pointing to
10204         sections that are not ordinary to icf.
10205         * icf.cc (get_section_contents): Handle relocation pointing to section
10206         with no object or shndx information.
10207         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
10208         * testsuite/Makefile.in: Regenerate.
10209         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
10210         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
10211
10212 2010-04-22  Ian Lance Taylor  <iant@google.com>
10213
10214         * expression.cc (Expression::Expression_eval_info): Add
10215         result_alignment_pointer field.
10216         (Expression::eval_with_dot): Add result_alignment_pointer
10217         parameter.  Change all callers.
10218         (Expression::eval_maybe_dot): Likewise.
10219         (class Binary_expression): Add alignment_pointer parameter to
10220         left_value and right_value.  Change all callers.
10221         (BINARY_EXPRESSION): Set result alignment.
10222         (class Trinary_expression): Add alignment_pointer parameter to
10223         arg2_value and arg3_value.  Change all callers.
10224         (Trinary_cond::value): Set result alignment.
10225         (Max_expression::value, Min_expression::value): Likewise.
10226         (Align_expression::value): Likewise.
10227         * script-sections.cc (class Sections_element): Add dot_alignment
10228         parameter to set_section_addresses virtual function.  Update
10229         instantiations.
10230         (class Output_section_element): Likewise.
10231         (Script_sections::create_segments): Add dot_alignment parameter.
10232         Change all callers.
10233         (Script_sections::create_segments_from_phdrs_clause): Likewise.
10234         (Script_sections::set_phdrs_clause_addresses): Likewise.
10235         * script-sections.h: Update declarations.
10236         * script.h: Update declarations.
10237         * output.h (Output_segment::set_minimum_p_align): Don't decrease
10238         min_p_align.
10239         * testsuite/script_test_3.t: Set large alignment.
10240         * testsuite/script_test_3.sh: Make sure that at least one LOAD
10241         segment has expected alignment.
10242
10243 2010-04-22  Nick Clifton  <nickc@redhat.com>
10244
10245         * po/gold.pot: Updated by the Translation project.
10246         * po/vi.po: Updated Vietnamese translation.
10247
10248 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
10249
10250         * testsuite/Makefile.am (check_PROGRAMS): Add
10251         icf_virtual_function_folding_test.
10252         * testsuite/Makefile.in: Regenerated.
10253
10254 2010-04-15  Andrew Haley  <aph@redhat.com>
10255
10256         * options.h (merge_exidx_entries): New option.
10257         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
10258         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
10259         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
10260         (Target_arm::merge_exidx_entries): New function.
10261         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
10262         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
10263         to Arm_exidx_fixup constructor.
10264         Add new arg, merge_exidx_entries.
10265         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
10266         Arm_output_section::fix_exidx_coverage.
10267
10268 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
10269
10270         * icf.cc (get_section_contents): Check for preemptible functions.
10271         Ignore addend when appropriate.
10272         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
10273         section folded.
10274         (add_from_relobj): Check for section folded.
10275         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
10276         * symtab.h (should_add_dynsym_entry): Add new parameter.
10277         * target-reloc.h (scan_relocs): Check for section folded.
10278         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
10279         Check reloc types for function pointers in shared objects.
10280         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
10281         case.
10282         (icf_preemptible_functions_test): New test case.
10283         (icf_string_merge_test): New test case.
10284         * testsuite.Makefile.in: Regenerate.
10285         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
10286         bar_glob.  Refactor code.
10287         * testsuite/icf_preemptible_functions_test.cc: New file.
10288         * testsuite/icf_preemptible_functions_test.sh: New file.
10289         * testsuite/icf_string_merge_test.cc: New file.
10290         * testsuite/icf_string_merge_test.sh: New file.
10291         * testsuite/icf_virtual_function_folding_test.cc: New file.
10292         * testsuite/icf_virtual_function_folding_test.sh: New file.
10293
10294 2010-04-14  Doug Kwan  <dougkwan@google.com>
10295
10296         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
10297         for local symbol recounting if we remove a section due to ICF.
10298         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
10299         there are no regular objects in input.
10300
10301 2010-04-13  Doug Kwan  <dougkwan@google.com>
10302
10303         * arm.cc (Arm_input_section::set_final_data_size): Compute
10304         accurate final data size instead of using current data size.
10305
10306 2010-04-09  Doug Kwan  <dougkwan@google.com>
10307
10308         * layout.cc (Layout::choose_output_section): Handle script section
10309         types.
10310         (Layout::make_output_section_for_script): Add section type parameter.
10311         Handle script section types.
10312         * layout.h (Layout::make_output_section_for_script): Add section
10313         type parameter.
10314         * output.cc (Output_section::Output_section): Initialize data member
10315         is_noload_.
10316         (Output_section::do_reset_address_and_file_offset): Do not set address
10317         to 0 if section is a NOLOAD section.
10318         * output.h (Output_section::is_noload): New method.
10319         (Output_section::set_is_noload): Ditto.
10320         (Output_section::is_noload_): New data member.
10321         * script-c.h (Script_section_type): New enum type.
10322         (struct Parser_output_section_header): Add new file section_type.
10323         * script-sections.cc (Sections_element::output_section_name): Add
10324         parameter for returning script section type.
10325         (Output_section_definition::output_section_name): Ditto.
10326         (Output_section_definition::section_type)P; New method.
10327         (Output_section_definiton::script_section_type_name): Ditto.
10328         (Output_section_definition::script_section_type_): New data member.
10329         (Output_section_definition::Output_section_definition): Initialize
10330         data member Output_section_definition::script_section_type_.
10331         (Output_section_definition::create_sections): Pass script section type
10332         to Layout::make_output_section_for_script.
10333         (Output_section_definition::output_section_name): Return script
10334         section type to caller.
10335         (Output_section_definition::set_section_address): Do not advance
10336         dot value and load address if section type is NOLOAD.  Set address
10337         of NOLOAD sections regardless of section flags.
10338         (Output_section_definition::print): Print section type if it is
10339         not SCRIPT_SECTION_TYPE_NONE.
10340         (Output_section_definition::section_type): New method.
10341         (Output_section_definition::script_section_type_name): Ditto.
10342         (Script_sections::output_section_name): Add new parameter
10343         PSECTION_TYPE for returning script section type.  Pass it to
10344         section elements.  Handle discard sections.
10345         (Sort_output_sections::operator()): Handle NOLOAD sections.
10346         * script-sections.h (Script_sections::Section_type): New enum type.
10347         (Script_sections::output_section_name): Add a new parameter for
10348         returning script section type.
10349         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
10350         INFO and NOLOAD.
10351         * yyscript.y (union): Add new field SECTION_TYPE.
10352         (COPY, DSECT, INFO, NOLOAD): New tokens.
10353         (opt_address_and_section_type): Change type to output_section_header.
10354         (section_type): New non-terminal
10355         (section_header): Handle section type.
10356         (opt_address_and_section_type): Return section type value.
10357
10358 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
10359
10360         * testsuite/plugin_common_test_1.c (foo): Add prototype.
10361         * testsuite/plugin_common_test_2.c (foo): Likewise.
10362
10363 2010-04-08  Doug Kwan  <dougkwan@google.com>
10364
10365         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
10366         Output_merge_data.
10367         * output.cc (Output_section::add_merge_input_section): Simplify
10368         code and return status of Output_merge_base::add_input_section.
10369         Update merge section map only if Output_merge_base::add_input_section
10370         returns true.
10371
10372 2010-04-07  Doug Kwan  <dougkwan@google.com>
10373
10374         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
10375         if section is marked as containing instructions but has no mapping
10376         symbols.
10377         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
10378         correct section index.
10379         (Arm_relobj::find_linked_text_section): Ditto.
10380
10381 2010-04-07  Cary Coutant  <ccoutant@google.com>
10382
10383         * archive.cc (include_member): Destroy Read_symbols_data object before
10384         releasing file.
10385         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
10386         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
10387         (Read_symbols_data::~Read_symbols_data) New destructor.
10388         (Section_relocs::Section_relocs) New constructor.
10389         (Section_relocs::~Section_relocs) New destructor.
10390         (Read_relocs_data::Read_relocs_data) New constructor.
10391         (Read_relocs_data::~Read_relocs_data) New destructor.
10392         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
10393         pointers to NULL after deleting.
10394
10395 2010-04-07  Doug Kwan  <dougkwan@google.com>
10396
10397         * arm.cc: Replace "endianity" with "endianness" in comments.
10398         (Arm_exidx_cantunwind): Ditto.
10399         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
10400         (Arm_relobj::merge_flags_and_attributes): New method.
10401         (Arm_relobj::merge_flags_and_attributes_): New data member.
10402         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
10403         (Arm_relobj::scan_sections_for_stubs): Ditto.
10404         (Arm_relobj::do_read_symbols): Check to see if we really want to
10405         merge processor-specific flags and attributes.  Exit early if
10406         an object is empty except for section names and the undefined symbol.
10407         (Target_arm::do_finalize_sections): Move check for ELF format to
10408         Arm_relobj::do_read_symbols.  Merge processor specific flags and
10409         attributes from a regular object only when we have determined that
10410         it is aapropriate.  Do not create an .ARM.attributes section in
10411         output if there is no regular input object.
10412         (Target_arm::merge_processor_specific_flags): Check
10413         --warn-mismatch before printing any error.
10414         (Target_arm::merge_object_attributes): Ditto.
10415         * gold.cc (queue_middle_tasks): Handle the case in which there is
10416         no regular object in input.
10417         * options.cc (General_options::parse_EB): New method.
10418         (General_options::parse_EL): Same.
10419         (General_options::General_options): Initialize endianness_.
10420         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
10421         New options.
10422         (General_options::Endianness): New enum.
10423         (General_options::endianness): New method.
10424         (General_options::endianness_): New data member.
10425         * parameters.cc (Parameters::set_options): Check target endianness.
10426         (Parameters::set_target_once): Ditto.
10427         (Parameters::check_target_endianness): New method.
10428         (parameters_force_valid_target): If either -EL or -EB is specified,
10429         use it to define endianness of default target.
10430         * parameters.h (Parameters::check_target_endianness): New method
10431         declaration.
10432         * target.h (class Target): Change "endianity" to "endianness"
10433         in comments.
10434
10435 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10436
10437         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
10438         * configure: Regenerate.
10439         * Makefile.in: Regenerate.
10440         * testsuite/Makefile.in: Regenerate.
10441
10442 2010-04-06  Cary Coutant  <ccoutant@google.com>
10443
10444         gcc PR lto/42757
10445         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
10446         prevailing definitions of common symbols.
10447         * testsuite/plugin_test_6.sh: New test case.
10448         * testsuite/plugin_common_test_1.c: New test case.
10449         * testsuite/plugin_common_test_2.c: New test case.
10450         * testsuite/Makefile.am (plugin_test_6): New test case.
10451         * testsuite/Makefile.in: Regenerate.
10452
10453 2010-04-06  Nick Clifton  <nickc@redhat.com>
10454
10455         * po/vi.po: New Vietnamese translation.
10456
10457 2010-03-30  Doug Kwan  <dougkwan@google.com>
10458
10459         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
10460
10461 2010-03-25  Doug Kwan  <dougkwan@google.com>
10462
10463         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
10464         to avoid a conversion warning on a 32-bit host.
10465
10466 2010-03-24  Ian Lance Taylor  <iant@google.com>
10467
10468         * testsuite/script_test_3.t: Add a TLS segment.
10469         * testsuite/Makefile.am (check_PROGRAMS): Add
10470         tls_phdrs_script_test.
10471         (tls_phdrs_script_test_SOURCES): Define.
10472         (tls_phdrs_script_test_DEPENDENCIES): Define.
10473         (tls_phdrs_script_test_LDFLAGS): Define.
10474         (tls_phdrs_script_test_LDADD): Define.
10475         * testsuite/Makefile.in: Rebuild.
10476
10477 2010-03-23  Cary Coutant  <ccoutant@google.com>
10478
10479         * fileread.cc (find_or_make_view): Fix comment.
10480
10481 2010-03-23  Ian Lance Taylor  <iant@google.com>
10482
10483         * script-sections.cc (class Orphan_section_placement): Define
10484         PLACE_TLS and PLACE_TLS_BSS.
10485         (Orphan_section_placement::Orphan_section_placement): Initialize
10486         new places.
10487         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
10488         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
10489         (tls_script_test_SOURCES): Define.
10490         (tls_script_test_DEPENDENCIES): Define.
10491         (tls_script_test_LDFLAGS): Define.
10492         (tls_script_test_LDADD): Define.
10493         * testsuite/Makefile.in: Rebuild.
10494
10495 2010-03-22  Doug Kwan  <dougkwan@google.com>
10496
10497         * arm.cc (Arm_relocate_functions::abs8,
10498         Arm_relocate_functions::abs16): Use correct check for overflow
10499         specified in the ARM ELF specs.
10500         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
10501         target of a BLX instruction specially.
10502         (Reloc_stub::stub_type_for_reloc): Ditto.
10503         (Relocate::relocate): Use symbolic names instead of numeric relocation
10504         codes to report error.
10505         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
10506         workaround.
10507         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
10508         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
10509         thumb2_blx_out_of_range.stdout
10510         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
10511         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
10512         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
10513         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
10514         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
10515         thumb2_blx_in_range, thumb2_blx_in_range.o,
10516         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
10517         thumb2_blx_out_of_range.o): New rules.
10518         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
10519         thumb2_blx_in_range and thumb2_blx_out_of_range.
10520         * testsuite/Makefile.in: Regenerate.
10521         * arm_branch_in_range.sh: Add tests for THUMB BLX.
10522         * testsuite/thumb_blx_in_range.s: New file.
10523         * testsuite/thumb_blx_out_of_range.s: New file.
10524
10525 2010-03-22  Rafael Espindola  <espindola@google.com>
10526
10527         * archive.cc (Should_include): Move to archive.h.
10528         (should_include_member): Make it a member of Archive.
10529         (Lib_group): New.
10530         (Add_lib_group_symbols): New.
10531         * archive.h: Include options.h.
10532         (Archive_member): Moved from Archive.
10533         (Should_include): Moved from archive.cc.
10534         (Lib_group): New.
10535         (Add_lib_group_symbols): New.
10536         * dynobj.cc (do_should_include_member): New.
10537         * dynobj.h (do_should_include_member): New.
10538         * gold.cc (queue_initial_tasks): Update call to queue.
10539         * main.cc (main): Print lib group stats.
10540         * object.cc (do_should_include_member): New.
10541         * object.h: Include archive.h.
10542         (Object::should_include_member): New.
10543         (Object::do_should_include_member): New.
10544         (Sized_relobj::do_should_include_member): New.
10545         * options.cc (General_options::parse_start_lib): New.
10546         (General_options::parse_end_lib): New.
10547         (Input_arguments::add_file): Handle lib groups.
10548         (Input_arguments::start_group): Check we are not in a lib.
10549         (Input_arguments::start_lib): New.
10550         (Input_arguments::end_lib): New.
10551         * options.h (General_options): Add start_lib and end_lib.
10552         (Input_argument::lib_): New.
10553         (Input_argument::lib): New.
10554         (Input_argument::is_lib): New.
10555         (Input_file_lib): New.
10556         (Input_arguments::in_lib_): New.
10557         (Input_arguments::in_lib): New.
10558         (Input_arguments::start_lib): New.
10559         (Input_arguments::end_lib_): New.
10560         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
10561         in unused members as preempted.
10562         (Sized_pluginobj::do_should_include_member): New.
10563         * plugin.h (Sized_pluginobj::do_should_include_member): New.
10564         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
10565         return the blocker.
10566         (Read_symbols::do_whole_lib_group): New.
10567         (Read_symbols::do_lib_group): New.
10568         (Read_symbols::do_read_symbols): Handle lib groups.
10569         (Read_symbols::get_name): Handle lib groups.
10570         * readsyms.h (Read_symbols): Add an archive member pointer.
10571         (Read_symbols::do_whole_lib_group): New.
10572         (Read_symbols::do_lib_group): New.
10573         (Read_symbols::member_): New.
10574         * script.cc (read_input_script): Update call to queue_soon.
10575
10576 2010-03-19  Doug Kwan  <dougkwan@google.com>
10577
10578         * arm.cc (Stub_table::Stub_table): Initialize new data members
10579         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10580         (Stub_table::add_reloc_stub): Assign stub offset and update
10581         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10582         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
10583         New data members.
10584         (Stub_table::update_data_size_and_addralign): Use
10585         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
10586         instead of going over all reloc stubs.
10587         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
10588         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10589         Stringpool_template::offset_ to size of Stringpool_char.
10590         (Stringpool_template::new_key_offset): Remove code to initialize
10591         Stringpool_template::offset_.
10592         * stringpool.h (Stringpool_template::set_no_zero_null): Set
10593         Stringpool_template::offset_ to zero.
10594
10595 2010-03-15  Doug Kwan  <dougkwan@google.com>
10596
10597         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10598         offset_.
10599         (Stringpool_template::new_key_offset): New method.
10600         (Stringpool_template::add_string): Assign offsets when adding new
10601         strings.
10602         (Stringpool_template::set_string_offsets): Do not set string offsets
10603         when not optimizing.
10604         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
10605         member size_.
10606         (Chunked_vector::clear): Clear size_.
10607         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
10608         (Chunked_vector::size): Return size_.
10609         (Chunked_vector::push_back): Use size_ to find insert position.
10610         (Chunked_vector::size_): New data member.
10611         (Stringpool_template::set_no_zero_null): Assert string set is empty.
10612         (Stringpool_template::new_key_offset): New method declaration.
10613         (Stringpool_template::offset_): New data member.
10614
10615 2010-03-15   Rafael Espindola  <espindola@google.com>
10616
10617         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
10618         Add_symbols' constructor.
10619         * readsyms.h (Add_symbols): Remove the input_group member.
10620
10621 2010-03-10  Ian Lance Taylor  <iant@google.com>
10622
10623         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
10624         target to ask whether a reference to a symbol requires a stack
10625         split.
10626         * target.h (Target::is_call_to_non_split): New function.
10627         (Target::do_is_call_to_non_split): Declare virtual function.
10628         * target.cc: Include "symtab.h".
10629         (Target::do_is_call_to_non_split): New function.
10630         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
10631
10632 2010-03-10  Cary Coutant  <ccoutant@google.com>
10633
10634         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
10635         (File_read::open[1]): Remove initial mapping of whole_file_view_.
10636         (File_read::open[2]): Add whole_file_view_ to list of views.
10637         (File_read::make_view): Remove test of whole_file_view_.
10638         (File_read::find_or_make_view): Create whole_file_view_ if
10639         necessary.
10640         (File_read::clear_views): Replace bool parameter with enum;
10641         adjust all callers.  Don't delete views with permanent data;
10642         do delete cached views and views from archives if
10643         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
10644         if clearing the corresponding view.
10645         * fileread.h (File_read::Clear_views_mode): New enum.
10646         (File_read::View::is_permanent_view): New method.
10647         (File_read::clear_views): Replace bool parameter
10648         with enum; adjust all callers.
10649         * options.h (General_options): Change keep_files_mapped option;
10650         add map_whole_files.
10651         * readsyms.cc (Add_symbols::run): Delete sd_ object before
10652         releasing the file.
10653         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
10654         the file.
10655
10656 2010-03-10  David S. Miller  <davem@davemloft.net>
10657
10658         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
10659
10660 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
10661
10662         * icf.cc (get_section_contents): Add '@' marker after processing the
10663         merge reloc.
10664
10665 2010-03-08  Doug Kwan  <dougkwan@google.com>
10666
10667         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
10668         due to a conversion warning.
10669         (Arm_relobj::update_output_local_symbol_count): Check for local
10670         symbol with unset output index.
10671
10672 2010-03-05  Ian Lance Taylor  <iant@google.com>
10673
10674         * options.h (class General_options): Add --spare-dynamic-tags.
10675         * output.cc (Output_data_dynamic::set_final_data_size): Implement
10676         --spare-dynamic-tags.
10677
10678 2010-03-05  Ian Lance Taylor  <iant@google.com>
10679
10680         * incremental.cc: Include "libiberty.h".
10681
10682 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
10683
10684         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
10685         function, is_info_ member.
10686         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
10687         (Versions::Versions): Update caller.
10688         (Versions::define_base_version): Likewise.
10689         (Versions::add_def): Likewise.
10690
10691 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
10692
10693         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
10694         (Scan::possible_function_pointer_reloc): New function.
10695         (Scan::local_reloc_may_be_function_pointer): Change to call
10696         possible_function_pointer_reloc.
10697         (Scan::global_reloc_may_be_function_pointer): Ditto.
10698         * icf.h (Icf::check_section_for_function_pointers): Change to reject
10699         relocations in ".data.rel.ro._ZTV" section.
10700         * testsuite/icf_safe_so_test.sh: Change to pass i386.
10701         * testsuite/icf_safe_so_test.cc: Ditto.
10702         * testsuite/icf_safe_test.cc: Ditto.
10703         * testsuite/icf_safe_test.sh: Ditto.
10704
10705 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10706             Ian Lance Taylor  <iant@google.com>
10707
10708         * target-reloc.h (relocate_section): Check the symbol table index
10709         for -1U before setting the local symbol index.
10710         (scan_relocatable_relocs): If copying the relocation, record that
10711         the local symbol is required.
10712         * object.h (Symbol_value::is_output_symtab_index_set): New
10713         function.
10714         (Symbol_value::may_be_discarded_from_output_symtab): New
10715         function.
10716         (Symbol_value::has_output_symtab_entry): New function.
10717         (Symbol_value::needs_output_symtab_entry): Remove.
10718         (Symbol_value::output_symtab_index): Make sure the symbol index is
10719         set.
10720         (Symbol_value::set_output_symtab_index): Make sure the symbol
10721         index is not set.  Make sure the new index is valid.
10722         (Symbol_value::set_must_have_output_symtab_entry): New function.
10723         (Symbol_value::has_output_dynsym_entry): New function.
10724         (Symbol_value::set_output_dynsym_index): Make sure the new index
10725         is valid.
10726         (Sized_relobj::set_must_have_output_symtab_entry): New function.
10727         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
10728         local symbol if permitted.
10729         (Sized_relobj::do_finalize_local_symbols): Call
10730         is_output_symtab_index_set rather than needs_output_symtab_entry.
10731         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
10732         rather than needs_output_symtab_entry.  Call
10733         has_output_dynsym_entry rather than needs_output_dynsym_entry.
10734         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
10735         is_output_symtab_index_set rather than needs_output_symtab_entry.
10736         * testsuite/discard_locals_relocatable_test.c: New file.
10737         * testsuite/discard_locals_test.sh: Test -r.
10738         * testsuite/Makefile.am (check_DATA): Add
10739         discard_locals_relocatable_test1.syms,
10740         discard_local_relocatable_test2.syms.
10741         (MOSTLYCLEANFILES): Likewise.  Also add
10742         discard_locals_relocatable_test1.lout and
10743         discard_locals_relocatable_test2.out.
10744         (discard_locals_relocatable_test1.syms): New target.
10745         (discard_locals_relocatable_test.o): New target.
10746         (discard_locals_relocatable_test1.out): New target.
10747         (discard_locals_relocatable_test2.syms): New target.
10748         (discard_locals_relocatable_test2.out): New target.
10749         (various): Add missing ../ld-new dependencies.
10750         * testsuite/Makefile.in: Rebuild.
10751
10752 2010-03-03  Nick Clifton  <nickc@redhat.com>
10753
10754         * po/fi.po: New Finnish translation.
10755
10756 2010-03-01  Doug Kwan  <dougkwan@google.com>
10757
10758         * layout.cc (Layout::Layout): Force section types of .init_array*,
10759         .preinit_array* and .fini_array* sections.
10760         * output.cc (Output_section::Input_section_sort_entry::has_priority):
10761         Fix check of return value of std::string::find.().
10762         (Output_section::Input_section_sort_compare::operator()): Remove
10763         comment about .init_array.
10764         (Output_section::Input_section_sort_init_fini_compare::operator()):
10765         New method.
10766         (Output_section::sort_attached_input_sections): Handle .init_array
10767         and .fini_array specially.
10768         * output.h (Output_section::Inut_section_sort_compare): Update
10769         comment.
10770         (Output_section::Input_section_sort_init_fini_compare): New struct.
10771
10772 2010-02-26  Doug Kwan  <dougkwan@google.com>
10773
10774         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
10775         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
10776         * testsuite/debug_msg.sh: Avoid matching source line number for
10777         use of global variable undef_int.
10778
10779 2010-02-26  Doug Kwan  <dougkwan@google.com>
10780
10781         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
10782         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
10783         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
10784         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
10785         * options.cc (General_options::General_options): Initialize member
10786         fix_v4bx_.
10787         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
10788         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
10789         and rm_no_fix_v4bx.stdout
10790         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
10791         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
10792         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
10793         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
10794         and arm_no_fix_v4bx.
10795         * Makefile.in: Regenerate.
10796         * testsuite/arm_fix_v4bx.s: New file.
10797         * testsuite/arm_fix_v4bx.sh: Ditto.
10798
10799 2010-02-24  Doug Kwan  <dougkwan@google.com>
10800
10801         * arm.cc (Target_arm::got_section): Make the .got section the first
10802         non RELRO section in the data segment.
10803         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
10804         suffixes of section names.
10805
10806 2010-02-24  Doug Kwan  <dougkwan@google.com>
10807
10808         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
10809         flags and attributes merging if an input file is a binary file.
10810         * fileread.cc (Input_file::open): Record format of original file.
10811         * fileread.h (Input_file::Format): New enum type.
10812         (Input_file::Input_file): Initialize data member format_.
10813         (Input_file::format): New method definition.
10814         (Input_file::format_):: New data member.
10815
10816 2010-02-24  Doug Kwan  <dougkwan@google.com>
10817
10818         * arm.cc (Arm_output_data_got): New class.
10819         (ARM_TCB_SIZE): New constant
10820         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
10821         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10822         If user uses a script with a SECTIONS clause, issue only a warning
10823         for a misplaced EXIDX input section.  Otherwise, issue an error.
10824         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
10825         garbage collection.
10826         (Target_arm::got_mode_index_entry): Handle static linking.
10827         (Target_arm::Scan::local): Ditto.
10828         (Target_arm::Scan::global): Ditto.
10829         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
10830         all incorrectly implemented relocations.
10831         (Target_arm::fix_exidx_coverage): Pass layout to
10832         Arm_output_section::fix_exidx_coverage.
10833         * layout.cc (Layout::section_name_mapping): Remove trailing dots
10834         from ".ARM.exidx." and ".ARM.extab.".
10835
10836 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10837
10838         * arm.cc (Target_arm::do_finalize_sections): Create attribute
10839         section if it does not already exist.
10840         * attributes.cc (Attributes_section_data::Attributes_section_data):
10841         Don't crash if size is zero.
10842
10843 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10844             Ian Lance Taylor  <iant@google.com>
10845
10846         * gold.cc (queue_middle_tasks): If no input files were opened,
10847         exit.
10848         * workqueue.h (Task_function::Task_function): Assert that there is
10849         a blocker.
10850
10851 2010-02-22  Doug Kwan  <dougkwan@google.com>
10852
10853         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
10854         * icf.cc (get_section_contents): Cast snprintf arguments to long long
10855         types to avoid warnings due to different uint64_t implementations
10856         on different hosts.
10857
10858 2010-02-21  Doug Kwan  <dougkwan@google.com>
10859
10860         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
10861         handling of the maximum backward branch offset.
10862         (Arm_relocate_functions::thumb_branch_common): Ditto.
10863         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
10864         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
10865         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
10866         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
10867         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
10868         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
10869         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
10870         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
10871         thumb_bl_out_of_range thumb_bl_out_of_range.o,
10872         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
10873         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
10874         thumb2_bl_out_of_range.o): New rules.
10875         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
10876         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
10877         thumb2_bl_out_of_range
10878         * testsuite/Makefile.in: Regenerate.
10879         * testsuite/arm_bl_in_range.s: New file.
10880         * testsuite/arm_bl_out_of_range.s: Ditto.
10881         * testsuite/arm_branch_in_range.sh: Ditto.
10882         * testsuite/arm_branch_range.t: Ditto.
10883         * testsuite/thumb2_branch_range.t: Ditto.
10884         * testsuite/thumb_bl_in_range.s: Ditto.
10885         * testsuite/thumb_bl_out_of_range.s: Ditto.
10886         * testsuite/thumb_branch_range.t: Ditto.
10887
10888 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
10889
10890         * gc.h (gc_process_relocs): Change vectors to point to the new list.
10891         Add reloc offset information.
10892         * icf.cc (get_section_contents): Change iterators to point to the new
10893         vectors. Add reloc offset information to the contents.
10894         * icf.h (Icf::Sections_reachable_info): New typedef.
10895         (Icf::Sections_reachable_list): New typedef.
10896         (Icf::Offset_info): New typedef.
10897         (Icf::Reloc_info): New struct typedef.
10898         (Icf::Reloc_info_list): New typedef.
10899         (Icf::symbol_reloc_list): Delete method.
10900         (Icf::addend_reloc_list): Delete method.
10901         (Icf::section_reloc_list): Delete method.
10902         (Icf::reloc_info_list): New method.
10903         (Icf::reloc_info_list_): New member.
10904
10905 2010-02-19  Doug Kwan  <dougkwan@google.com>
10906
10907         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
10908         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
10909         * arm.cc (Arm_relocation_functions): New forward declaration.
10910         (Target_arm::Target_arm): Initialize new data members
10911         got_mod_index_offset_ and tls_base_symbol_defined_.
10912         (Target_arm::Relocate::relocate_tls): New method.
10913         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
10914          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
10915         New methods.
10916         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
10917         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
10918         (Target_arm::got_mod_index_offset_,
10919         Target_arm::tls_base_symbol_defined_): New data members.
10920         (Target_arm::Scan::local, Target::Scan::global,
10921         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
10922         relocations.
10923
10924 2010-02-18  Doug Kwan  <dougkwan@google.com>
10925
10926         * arm.cc (Arm_relobj::find_linked_text_section): New method.
10927         (Arm_relobj::make_exidx_input_section): Pass section index of linked
10928         text section as a parameter becuase some broken tools may not set
10929         the link in section header.
10930         (Target_arm::has_got_section): New method.
10931         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
10932         without any mapping symbol as data only.  Remove warning.
10933         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
10934         link in its section header, try to discover the link by inspecting the
10935         REL31 relocation at the beginning of the section.
10936         (Target_arm::Scan::check_non_pic): Report name of offending relocation
10937         in error message.
10938         (Target_arm::Scan::global): Treat any reference to the symbol
10939         _GLOBAL_OFFSET_TABLE_ as a GOT access.
10940
10941 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
10942
10943         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
10944         (Scan::global_reloc_may_be_function_pointer): New function.
10945         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10946         (Scan::global_reloc_may_be_function_pointer): New function.
10947         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10948         (Scan::global_reloc_may_be_function_pointer): New function.
10949         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
10950         (Scan::global_reloc_may_be_function_pointer): New function.
10951         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
10952         (Scan::global_reloc_may_be_function_pointer): New function.
10953         (Scan::possible_function_pointer_reloc): New function.
10954         (Target_x86_64::can_check_for_function_pointers): New function.
10955         * gc.h (gc_process_relocs): Scan relocation types to determine if
10956         function pointers were taken for targets that support it.
10957         * icf.cc (Icf::find_identical_sections): Include functions for
10958         folding in safe ICF whose pointer is not taken.
10959         * icf.h (Secn_fptr_taken_set): New typedef.
10960         (fptr_section_id_): New member.
10961         (section_has_function_pointers): New function.
10962         (set_section_has_function_pointers): New function.
10963         (check_section_for_function_pointers): New function.
10964         * options.h: Fix comment for safe ICF option.
10965         * target.h (can_check_for_function_pointers): New function.
10966         * testsuite/Makefile.am: Add icf_safe_so_test test case.
10967         Modify icf_safe_test for X86-64.
10968         * testsuite/Makefile.in: Regenerate.
10969         * testsuite/icf_safe_so_test.cc: New file.
10970         * testsuite/icf_safe_so_test.sh: New file.
10971         * testsuite/icf_safe_test.cc (kept_func_3): New function.
10972         (main): Change to take pointer to function kept_func_3.
10973         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
10974         folding is done correctly for X86-64.
10975
10976 2010-02-12  David S. Miller  <davem@davemloft.net>
10977
10978         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
10979         is_symbolless parameter.
10980         (Output_reloc<SHT_REL>::is_symbolless): New.
10981         (Output_reloc<SHT_REL>::is_symbolless_): New.
10982         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
10983         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
10984         (Output_reloc<SHT_RELA>::is_symbolless): New.
10985         (Output_data_reloc::add_global): Handle is_symbolless.
10986         (Output_data_reloc::add_global_relative): Likewise.
10987         (Output_data_reloc::add_local): Likewise.
10988         (Output_data_reloc::add_local_relative): Likewise.
10989         (Output_data_reloc::add_symbolless_global_addend): New.
10990         (Output_data_reloc::add_symbolless_local_addend): New.
10991         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
10992         is_symbolless.
10993         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
10994         instead of ->is_relative_
10995         (Output_reloc::write): Likewise.
10996         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
10997         (Output_reloc::write_rel): Simplify.
10998
10999         * sparc.cc (Target_sparc::Scan::local): Use
11000         ->add_symbolless_local_addend as needed.
11001         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
11002         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
11003         based upon relocation offset.
11004
11005 2010-02-11  Doug Kwan  <dougkwan@google.com>
11006
11007         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
11008         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
11009         beginning of function.
11010         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
11011         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
11012         parameter is_32bit in calls to should_apply_static_reloc.
11013         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
11014         (check_DATA): Add arm_abs_global.stdout.
11015         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
11016         arm_abs_global.stdout): New rules.
11017         (MOSTLLYCLEANFILES): Add arm_abs_global
11018         * Makefile.in: Regenerate.
11019         * testsuite/arm_abs_global.s: New file.
11020         * testsuite/arm_abs_global.sh: Ditto.
11021         * testsuite/arm_abs_lib.s: Ditto.
11022
11023 2010-02-11  Ian Lance Taylor  <iant@google.com>
11024
11025         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
11026         Read_relocs task.
11027         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
11028         Allocate_commons_task first.
11029         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
11030         task, rather than symtab_lock_.
11031         (Gc_process_relocs::~Gc_process_relocs): New function.
11032         (Gc_process_relocs::is_runnable): Check this_blocker_.
11033         (Gc_process_relocs::locks): Use next_blocker_ rather than
11034         blocker_.
11035         (Scan_relocs::~Scan_relocs): New function.
11036         (Scan_relocs::is_runnable): Check this_blocker_ rather than
11037         symtab_lock_.
11038         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
11039         next_blocker_.
11040         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
11041         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
11042         constructor accordingly.
11043         (class Gc_process_relocs): Likewise.
11044         (class Scan_relocs): Likewise.
11045         * common.h (class Allocate_commons_task): Remove symtab_lock_
11046         field, and corresponding constructor parameter.
11047         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
11048         symtab_lock_.
11049         (Allocate_commons_task::locks): Likewise.
11050
11051 2010-02-11  Ian Lance Taylor  <iant@google.com>
11052
11053         * gold-threads.h (class Once): Define.
11054         (class Initialize_lock): Rewrite as child of Once.
11055         * gold-threads.cc (class Once_initialize): Define.
11056         (once_pointer_control): New static variable.
11057         (once_pointer, once_arg): New static variables.
11058         (c_run_once): New static function.
11059         (Once::Once, Once::run_once, Once::internal_run): New functions.
11060         (class Initialize_lock_once): Remove.
11061         (initialize_lock_control): Remove.
11062         (initialize_lock_pointer): Remove.
11063         (initialize_lock_once): Remove.
11064         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
11065         (Initialize_lock::initialize): Rewrite.
11066         (Initialize_lock::do_run_once): New function.
11067         * archive.cc (Archive::interpret_header): Only clear name if it is
11068         not already empty.
11069         * fileread.cc: Include "gold-threads.h"
11070         (file_counts_lock): New static variable.
11071         (file_counts_initialize_lock): Likewise.
11072         (File_read::release): Only increment counts when using --stats.
11073         Use a lock around the increment.
11074         * parameters.cc (class Set_parameters_target_once): Define.
11075         (set_parameters_target_once): New static variable.
11076         (Parameters::Parameters): Move here from parameters.h.
11077         (Parameters::set_target): Rewrite.
11078         (Parameters::set_target_once): New function.
11079         (Parameters::clear_target): Move here and rewrite.
11080         * parameters.h (class Parameters): Update declarations.  Add
11081         set_parameters_target_once_ field.
11082         (Parameters::Parameters): Move to parameters.cc.
11083         (Parameters::clear_target): Likewise.
11084         * readsyms.cc (Read_symbols::do_group): Create a Start_group
11085         task.
11086         (Start_group::~Start_group): New function.
11087         (Start_group::is_runnable): New function.
11088         (Start_group::locks, Start_group::run): New functions.
11089         (Finish_group::run): Change saw_undefined to size_t.
11090         * readsyms.h (class Start_group): Define.
11091         (class Finish_group): Change saw_undefined_ field to size_t.
11092         (Finish_group::Finish_group): Remove saw_undefined and
11093         this_blocker parameters.  Change all callers.
11094         (Finish_group::set_saw_undefined): New function.
11095         (Finish_group::set_blocker): New function.
11096         * symtab.h (class Symbol_table): Change saw_undefined to return
11097         size_t.  Change saw_undefined_ field to size_t.
11098         * target-select.cc (Set_target_once::do_run_once): New function.
11099         (Target_selector::Target_selector): Initialize set_target_once_
11100         field.  Don't initialize lock_ and initialize_lock_ fields.
11101         (Target_selector::instantiate_target): Rewrite.
11102         (Target_selector::set_target): New function.
11103         * target-select.h (class Set_target_once): Define.
11104         (class Target_selector): Update declarations.  Make
11105         Set_target_once a friend.  Remove lock_ and initialize_lock_
11106         fields.  Add set_target_once_ field.
11107
11108 2010-02-10  Ian Lance Taylor  <iant@google.com>
11109
11110         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
11111         queueing any tasks.
11112         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
11113         (queue_middle_tasks): Add all blockers before queueing any tasks.
11114         (queue_final_tasks): Likewise.
11115         * token.h (Task_token::add_blockers): New function.
11116         * object.h (Input_objects::number_of_relobjs): New function.
11117
11118 2010-02-10  Ian Lance Taylor  <iant@google.com>
11119
11120         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
11121         shared, not if not position independent.
11122         * x86_64.cc (Relocate::relocate_tls): Likewise.
11123         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
11124         (tls_pie_pic_test): New target.
11125         * testsuite/Makefile.in: Rebuild.
11126
11127         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
11128         (tls_test_main_pie.o, tls_test_pie.o): New targets.
11129         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
11130         * testsuite/Makefile.in: Rebuild.
11131
11132 2010-02-09  David S. Miller  <davem@davemloft.net>
11133
11134         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
11135         R_SPARC_RELATIVE using ->add_local_relative().
11136         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
11137
11138         * output.h (Output_data_dynamic::add_section_size): New method
11139         that takes two Output_data objects.
11140         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
11141         entry param.  Handle it in initializers.
11142         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
11143         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
11144         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
11145         arg.
11146         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
11147         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
11148         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
11149         for dynrel_includes_plt.
11150         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11151         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11152         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
11153         before .rela.plt
11154         (Target_sparc::do_finalize_sections): Update to pass true for
11155         dynrel_includes_plt.
11156         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
11157         output before .rela.plt
11158         (Target_powerpc::do_finalize_sections): Update to pass true for
11159         dynrel_includes_plt when 32-bit.
11160
11161 2010-02-08  Doug Kwan  <dougkwan@google.com>
11162
11163         * arm.cc (Arm_relobj::simple_input_section_output_address): New
11164         method.
11165         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
11166         Arm_relobj::scan_section_for_cortex_a8_stubs,
11167         Arm_relobj::do_relocation_section): Instead of calling
11168         Output_section::output_address, use faster
11169         Arm_relobj::simple_input_section_output_address.
11170
11171 2010-02-08  David S. Miller  <davem@davemloft.net>
11172
11173         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
11174         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
11175         relocation helper function.
11176
11177         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
11178         just like R_SPARC_GOT{10,13,22}.
11179         (Target_sparc::Scan::local): Likewise.
11180         (Target_sparc::Relocate:relocate): Likewise.
11181
11182 2010-02-06  Ian Lance Taylor  <iant@google.com>
11183
11184         * configure.ac: Rewrite targetobjs duplicate removal code to use
11185         only shell constructs.
11186         * configure: Rebuild.
11187
11188 2010-02-05  Doug Kwan  <dougkwan@google.com>
11189
11190         PR 11247
11191         * arm.cc (Arm_relobj::section_is_scannable): New method.
11192         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
11193         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
11194
11195 2010-02-04  Doug Kwan  <dougkwan@google.com>
11196
11197         PR 11247
11198         * arm-reloc-property.cc (cstdio): Include.
11199         * configure.ac (targetobjs): Remove duplicates.
11200         * configure: Regenerate.
11201         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
11202         big and little endian version for a given address size.
11203
11204 2010-02-03  Doug Kwan  <dougkwan@google.com>
11205
11206         * arm-reloc-property.cc
11207         (Arm_reloc_property_table::reloc_name_in_error_message): New method
11208         definition.
11209         * arm-reloc-property.h
11210         (Arm_reloc_property_table::get_implemented_static_reloc_property):
11211         New method definition.
11212         (Arm_reloc_property_table::reloc_name_in_error_message): New method
11213         declaration.
11214         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
11215         overflow to N.
11216         (GOT_PREL): Change implemented to Y.
11217         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
11218         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
11219         (Arm_relocate_functions::movw_abs_nc): Remove method.
11220         (Arm_relocate_functions::movt_abs): Ditto.
11221         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
11222         (Arm_relocate_functions::thm_movt_abs): Ditto.
11223         (Arm_relocate_functions::movw_rel_nc): Ditto.
11224         (Arm_relocate_functions::movw_rel): Ditto.
11225         (Arm_relocate_functions::movt_rel): Ditto.
11226         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
11227         (Arm_relocate_functions:thm_movw_rel): Ditto.
11228         (Arm_relocate_functions:thm_movt_rel): Ditto.
11229         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
11230         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
11231         New method definitions.
11232         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
11233         (Arm_relocation_functions::arm_grp_ldr): Ditto.
11234         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
11235         (Arm_relocation_functions::arm_grp_ldc): Ditto.
11236         (Target_arm::Relocate::relocate): Check for non-static or
11237         unimplemented relocation code and exit early.  Change calls to
11238         Target_arm::reloc_uses_thumb_bit and
11239         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
11240         instead.  Refactor code to handle similar relocations to increase
11241         code sharing.  Remove check for unsupported relocation code in switch
11242         statement.
11243         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
11244         relocation property table to find out size.  Change error message to
11245         print out the name of a relocation code instead of the numeric value.
11246         (Target_arm::scan_reloc_for_stub): Use relocation property table
11247         instead of calling Target_arm::reloc_uses_thumb_bit().
11248
11249 2010-02-02  Doug Kwan  <dougkwan@google.com>
11250
11251         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
11252         types of relaxed input section.
11253
11254 2010-02-02  Doug Kwan  <dougkwan@google.com>
11255
11256         * Makefile.am (HFILES): Add arm-reloc-property.h.
11257         (DEFFILES): New.
11258         (TARGETSOURCES): Add arm-reloc-property.cc
11259         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
11260         (libgold_a_SOURCES): $(DEFFILES)
11261         * Makefile.in: Regenerate.
11262         * arm-reloc-property.cc: New file.
11263         * arm-reloc-property.h: New file.
11264         * arm-reloc.def: New file.
11265         * arm.cc: Update comments.
11266         (arm-reloc-property.h): New included header.
11267         (arm_reloc_property_table): New global variable.
11268         (Target_arm::do_select_as_default_target): New method definition.
11269         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
11270         arm-reloc-property to targ_extra_obj.
11271         * parameters.cc (set_parameters_target): Call
11272         Target::select_as_default_target().
11273         * target.h (Target::select_as_default_target): New method definition.
11274         (Target::do_select_as_default_target): Same.
11275
11276 2010-02-01  Doug Kwan  <dougkwan@google.com>
11277
11278         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
11279         first_output_text_section_.
11280         (Arm_exidx_fixup::first_output_text_section): New method definition.
11281         (Arm_exidx_fixup::first_output_text_section_): New data member.
11282         (Arm_exidx_fixup::process_exidx_section): Record the first text
11283         output section seen.
11284         (Arm_output_section::fix_exidx_coverage): Set correct linked section
11285         and entsize in output section header.
11286
11287 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11288
11289         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
11290         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
11291         (Arm_relocate_functions::thm_alu11): New Method.
11292         (Arm_relocate_functions::thm_pc8): New Method.
11293         (Arm_relocate_functions::thm_pc12): New Method.
11294         (Target_arm::Scan::local): Handle the relocations.
11295         (Target_arm::Scan::global): Likewise.
11296         (Target_arm::Relocate::relocate): Likewise.
11297         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11298
11299 2010-01-29  Doug Kwan  <dougkwan@google.com>
11300
11301         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
11302         of relocation types as ld.
11303
11304 2010-01-29  Doug Kwan  <dougkwan@google.com>
11305
11306         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
11307         to public.
11308         (Arm_relocate_functions::thumb_branch_common): Ditto.
11309         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
11310         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
11311         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
11312         Arm_relocate_functions::jump24): Remove.
11313         (Target_arm::Relocate::relocate): Adjust code to call
11314         Arm_relocation_functions::arm_branch_common and
11315         Arm_relocation_functions::thumb_branch_common instead of their removed
11316         wrappers.  Merge switch-cases together to reduce source code size.
11317
11318 2010-01-29  Doug Kwan  <dougkwan@google.com>
11319
11320         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
11321         output_local_symbol_count_needs_update_.
11322         (Arm_relobj::output_local_symbol_count_needs_update,
11323          Arm_relobj::set_output_local_symbol_count_needs_update,
11324          Arm_relobj::update_output_local_symbol_count): New methods.
11325         (Arm_relobj::output_local_symbol_count_needs_update_): New data
11326         member.
11327         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
11328         of pointed function as in a R_ARM_PREL31 relocation.
11329         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
11330         for output local symbol count updating.
11331         (Target_arm::do_relax): Update output local symbol counts in objects
11332         if necessary.
11333         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
11334
11335 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11336
11337         * arm.cc: Added support for the ARM relocations:
11338         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
11339         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
11340         (Arm_relocate_functions::movw_rel_nc): Renamed (was
11341         movw_prel_nc).
11342         (Arm_relocate_functions::movw_rel): New method.
11343         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
11344         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
11345         thm_movw_prel_nc).
11346         (Arm_relocate_functions::thm_movw_rel): New method.
11347         (Arm_relocate_functions::thm_movt_rel): Renamed (was
11348         thm_movt_prel).
11349         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
11350         relocations.
11351         (Target_arm::Scan::global): Likewise.
11352         (Target_arm::Relocate::relocate): Likewise.
11353         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11354         Likewise.
11355
11356 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11357
11358         * arm.cc: Added support for ARM group relocations.
11359         (Target_arm::reloc_needs_sym_origin): New method.
11360         (Arm_relocate_functions::calc_grp_kn): New method.
11361         (Arm_relocate_functions::calc_grp_residual): New method.
11362         (Arm_relocate_functions::calc_grp_gn): New method.
11363         (Arm_relocate_functions::arm_grp_alu): New Method.
11364         (Arm_relocate_functions::arm_grp_ldr): New Method.
11365         (Arm_relocate_functions::arm_grp_ldrs): New Method.
11366         (Arm_relocate_functions::arm_grp_ldc): New Method.
11367         (Target_arm::Scan::local): Handle the ARM group relocations.
11368         (Target_arm::Scan::global): Likewise.
11369         (Target_arm::Relocate::relocate): Likewise.
11370         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11371         Likewise.
11372
11373 2010-01-26  Doug Kwan  <dougkwan@google.com>
11374
11375         * arm.cc (set): Include.
11376         (class Arm_exidx_fixup): Change type of last_input_section_ to const
11377         pointer type.
11378         (Arm_output_section::Text_section_list): New type.
11379         (Arm_output_section::append_text_sections_to_list): New method.
11380         (Arm_output_section::fix_exidx_coverage): Ditto.
11381         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
11382         (Arm_relobj::convert_input_section_to_relaxed_section): Use
11383         Relobj::set_section_offset() instead of
11384         Sized_relobj::invalidate_section_offset().
11385         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
11386         parameter for section headers. Ignore relocation sections for
11387         unallocated sections and EXIDX sections.
11388         (Target_arm::fix_exidx_coverage): New method.
11389         (Target_arm::output_section_address_less_than): New type.
11390         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
11391         linked text section instead of the EXIDX section.
11392         (Arm_output_section::create_stub_group): Add an assertion to check
11393         that this is not an EXIDX output section.
11394         (Arm_output_section::append_text_sections_to_list): New method.
11395         (Arm_output_section::fix_exidx_coverage): Ditto.
11396         (Arm_relobj::scan_sections_for_stubs): Adjust call to
11397         Arm_relobj::section_needs_reloc_stub_scanning.
11398         (Target_arm::do_relax): Fix EXIDX output section coverage in the
11399         first pass.
11400         (Target_arm::fix_exidx_coverage): New method.
11401         * object.h (Relobj::set_output_section): New method.
11402         (Sized_relobj::invalidate_section_offset): Remove method.
11403         (Sized_relobj::do_invalidate_section_offset): Remove method.
11404         (Sized_relobj::do_set_section_offset): Handle offset value -1.
11405
11406 2010-01-25  Doug Kwan  <dougkwan@google.com>
11407
11408         * arm.cc (Arm_exidx_merged_section::do_output_offset):
11409         Fix warning due to signed and unsigned comparison on a 32-bit host.
11410
11411 2010-01-22  Doug Kwan  <dougkwan@google.com>
11412
11413         * arm.cc (Target_arm::do_relax): Record an output section for section
11414         offset adjustment it contains any stub table that has changed.
11415         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
11416         offsets in an output section if necessary.
11417         * output.cc (Output_section::Output_section): Initialize
11418         section_offsets_need_adjustments_.
11419         (Output_section::add_input_section_for_script): Renamed to
11420         Output_section::add_simple_input_section.
11421         (Output_section::save_states): Add a comment.
11422         (Output_section::discard_states): New method defintion.
11423         (Output_section::adjust_section_offsets): Same.
11424         * output.h (Output_section::add_input_section_for_script): Renamed to
11425         Output_section::add_simple_input_section.
11426         (Output_section::discard_states): New method declaration.
11427         (Output_section::adjust_section_offsets): Same.
11428         (Output_section::section_offsets_need_adjustment,
11429         Output_section::set_section_offsets_need_adjustment): New method
11430         definitions.
11431         (Output_section::section_offsets_need_adjustment_): New data member.
11432         * script-sections.cc
11433         (Output_section_element_input::set_section_address): Adjust code for
11434         renaming of Output_section::add_input_section_for_script.
11435         (Orphan_output_section::set_section_address): Same.
11436
11437 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11438
11439         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
11440         Fix_v4bx enum values .
11441         * gold/options.h (General_options): New option definitions.
11442         (General_options::fix_v4bx): New method.
11443         (General_options::Fix_v4bx): New enum.
11444         * gold/options.cc (General_options::parse_fix_v4bx): New method.
11445         (General_options::parse_fix_v4bx_interworking): New method.
11446
11447 2010-01-22  Doug Kwan  <dougkwan@google.com>
11448
11449         * arm.cc (Arm_exidx_fixup): New class.
11450
11451 2010-01-21  Doug Kwan  <dougkwan@google.com>
11452
11453         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
11454         classes.
11455         (Arm_exidx_section_offset_map): New type.
11456
11457 2010-01-21  Doug Kwan  <dougkwan@google.com>
11458
11459         * arm.cc (Arm_exidx_input_section): New class.
11460         (Arm_relobj::exidx_input_section_by_link,
11461         Arm_relobj::exidx_input_section_by_shndx,
11462         Arm_relobj::make_exidx_input_section): New methods.
11463         (read_arm_attributes_section): Remove.
11464         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
11465         information about them.
11466         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
11467         to here.
11468
11469 2010-01-20  Doug Kwan  <dougkwan@google.com>
11470
11471         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
11472         Input_section_specifier to Section_id.
11473         (Target_arm::new_arm_input_section: Adjust code for change of key
11474         type.
11475         (Target_arm::find_arm_input_section): Ditto.
11476         * gc.h (object.h): Include for Section_id nand Section_id_hash.
11477         (Section_id): Remove.
11478         (Garbage_collection::Section_id_hash): Remove.
11479         * icf.h (object.h): Include for Section_id nand Section_id_hash.
11480         (Section_id): Remove.
11481         (Icf::Section_id_hash): Remove.
11482         * object.h (Section_id, Const_section_id, Section_id_hash,
11483         Const_section_id_hash): New type definitions.
11484         * output.cc (Output_section::add_relaxed_input_section): Change to
11485         use Const_section_id instead of Input_section_specifier as key type.
11486         (Output_section::add_merge_input_section): Ditto.
11487         (Output_section::build_relaxation_map): Change to use Section_id
11488         instead of Input_section_specifier as key type.
11489         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11490         Ditto.
11491         (Output_section::convert_input_sections_to_relaxed_sections): Change
11492         to use Const_section_id instead of Input_section_specifier as key type.
11493         (Output_section::find_merge_section): Ditto.
11494         (Output_section::find_relaxed_input_section): Ditto.
11495         * output.h (Input_section_specifier): Remove class.
11496         (Output_section::Output_section_data_by_input_section_map): Change
11497         key type to Const_section_id.
11498         (Output_section::Output_relaxed_input_section_by_input_section_map):
11499         Ditto.
11500         (Output_section::Relaxation_map): Change key type to Section_id.
11501
11502 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11503
11504         * gold/arm.cc: Added support for R_ARM_V4BX relocation
11505         (class Arm_v4bx_stub): New class.
11506         (DEF_STUBS): Updated definition to support v4_veneer_bx.
11507         (Stub_factory::make_arm_v4bx_stub): New method.
11508         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
11509         (Stub_table::empty): Handle v4bx stubs.
11510         (Stub_table::add_arm_v4bx_stub): New method.
11511         (Stub_table::find_arm_v4bx_stub): New method.
11512         (Arm_relocate_functions::v4bx): New method.
11513         (Target_arm::fix_v4bx): New method.
11514         (Target_arm::Target_arm): Handle R_ARM_V4BX.
11515         (Stub_table::relocate_stubs): Likewise.
11516         (Stub_table::do_write): Likewise.
11517         (Stub_table::update_data_size_and_addralign): Likewise.
11518         (Stub_table::finalize_stubs):  Likewise.
11519         (Target_arm::Scan::local): Likewise.
11520         (Target_arm::Scan::global): Likewise.
11521         (Target_arm::do_finalize_sections): Likewise.
11522         (Target_arm::Relocate::relocate): Likewise.
11523         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11524         Likewise.
11525         (Target_arm::scan_reloc_for_stub): Likewise.
11526         (Target_arm::scan_reloc_section_for_stubs): Likewise.
11527
11528 2010-01-19  Ian Lance Taylor  <iant@google.com>
11529
11530         * output.cc (Output_section_headers::do_sized_write): Write large
11531         segment count to sh_info field.
11532         (Output_file_header::do_sized_write): For large segment count,
11533         write PN_XNUM to e_phnum field.
11534
11535 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11536
11537         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
11538         (Arm_relocate_functions::thm_jump8): New function.
11539         (Arm_relocate_functions::thm_jump11): New function.
11540         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
11541         R_ARM_THM_JUMP11.
11542         (Target_arm::Scan::global): Likewise.
11543         (Target_arm::Relocate::relocate): Likewise.
11544         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11545         Likewise.
11546
11547 2010-01-14  Doug Kwan  <dougkwan@google.com>
11548
11549         * arm.cc (map, utility): Include headers.
11550         (Target_arm::apply_cortex_a8_workaround): New method.
11551         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
11552         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
11553         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
11554         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
11555         the --[no-]fix-cortex-a8 command line options.
11556         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
11557         (Target_arm::relocate_stub): Use addend in instruction template.
11558         * options.h (DEFINE_bool): Set the user-set flag.
11559         (General_options): Add --[no-]-fix-cortex options.
11560         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
11561         : Update fast look-up map after conversion.
11562
11563 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
11564
11565         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
11566         in the first pass of do_layout.
11567
11568 2010-01-13  Doug Kwan  <dougkwan@google.com>
11569
11570         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11571         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
11572         apparent compiler problem of not folding static constant integral
11573         data members of elfcpp::Elf_sizes<32>.
11574
11575 2010-01-13  Doug Kwan  <dougkwan@google.com>
11576
11577         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11578         Arm_relobj::section_needs_cortex_a8_stub_scanning,
11579         Arm_relobj::scan_section_for_cortex_a8_erratum,
11580         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
11581         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
11582         sections to scan for relocation stubs into a new method
11583         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
11584         relocation and Cortex-A8 stub scanning.
11585         (Target_arm::do_relax): Force stubs to be after stubbed sections
11586         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
11587         the beginning of a new relaxation pass.  Update a comment.
11588         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
11589
11590 2010-01-12  Ian Lance Taylor  <iant@google.com>
11591
11592         * target-reloc.h (visibility_error): New inline function.
11593         (relocate_section): Call visibility_error.
11594         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
11595         (MOSTLYCLEANFILES): Likewise.
11596         (protected_4_pic.o, protected_3.err): New targets.
11597         * testsuite/protected_4.cc: New file.
11598
11599 2010-01-12  Doug Kwan  <dougkwan@google.com>
11600
11601         * arm.cc (Cortex_a8_reloc): New class.
11602         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
11603         and cortex_a8_relocs_info_.
11604         (Target_arm::fix_cortex_a8): New method definition.
11605         (Target_arm::Cortex_a8_relocs_info): New type.
11606         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
11607         New data member declarations.
11608         (Target_arm::scan_reloc_for_stub): Record information about
11609         relocations for THUMB branches that might be exempted from the
11610         Cortex-A8 workaround.
11611         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
11612         at the beginning of a relaxation pass.
11613
11614 2010-01-12  Doug Kwan  <dougkwan@google.com>
11615
11616         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
11617         (Arm_relobj::Mapping_symbol_position,
11618          Arm_reloj::Mapping_symbol_position_less,
11619          Arm_relobj::Mapping_symbols_info): New types.
11620         (Target_arm::is_mapping_symbol_name): New method definition.
11621         (Arm_relobj::do_count_local_symbols): Save information about mapping
11622         symbols.
11623
11624 2010-01-11  Doug Kwan  <dougkwan@google.com>
11625
11626         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
11627         Arm_relocate_functions::thumb32_branch_upper,
11628         Arm_relocate_functions::thumb32_branch_lower,
11629         Arm_relocate_functions::thumb32_cond_branch_offset,
11630         Arm_relocate_functions::thumb32_cond_branch_upper,
11631         Arm_relocate_functions::thumb32_cond_branch_lower,
11632         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
11633         branch offset encoding.
11634         (Arm_relocate_functions::thumb_branch_common): Use new branch
11635         offset encoding methods to avoid code duplication.
11636         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
11637         (Stub_addend_reader::operator()): Use new branch encoding method
11638         to avoid code duplication.
11639
11640 2010-01-11  Doug Kwan  <dougkwan@google.com>
11641
11642         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
11643         (Target_arm::do_finalize_sections): Define special EXIDX section
11644         symbols only if referenced.
11645         * gc.h (Garbage_collection::add_reference): New method.
11646         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
11647         code duplication.
11648
11649 2010-01-11  Ian Lance Taylor  <iant@google.com>
11650
11651         * script.cc (Version_script_info::build_expression_list_lookup):
11652         Change complaing about duplicate wildcard match from error to
11653         warning.
11654
11655         * script.cc (class Lazy_demangler): Recreate--revert part of patch
11656         of 2009-12-30.
11657         (Version_script_info::Version_script_info): Initialize globs_,
11658         default_version_, default_is_global_, and exact_.  Don't
11659         initialize globals_ or locals_.
11660         (Version_script_info::build_lookup_tables): Build local symbols
11661         first.
11662         (Version_script_info::unquote): New function.
11663         (Version_script_info::add_exact_match): New function.
11664         (Version_script_info::build_expression_list_lookup): Remove lookup
11665         parameter.  Add is_global parameter.  Change all callers.  Handle
11666         wildcard pattern specially.  Unquote pattern.  Call
11667         add_exact_match.
11668         (Version_script_info::get_name_to_match): New function.
11669         (Version_script_info::get_symbol_version): New function.
11670         (Version_script_info::get_symbol_version_helper): Remove.
11671         (Version_script_info::check_unmatched_names): Call unquote.
11672         * script.h (class Version_script_info): Change get_symbol_version
11673         to be non-inline and add is_global parameter; change all callers.
11674         Rewrite symbol_is_local.  Update declarations.  Define struct
11675         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
11676         Remove globals_ and locals_ members.  Add exact_, globs_,
11677         default_version_, is_global_.
11678         (Version_script_info::Glob): Remove pattern, add expression and
11679         is_global.  Update constructor.  Change all callers.
11680         * dynobj.cc (Versions::finalize): Mark the version symbol as the
11681         default version.
11682         (Versions::symbol_section_contents): If a symbol is undefined, or
11683         defined in a dynamic object, set the version index to
11684         VER_NDX_LOCAL.
11685         * symtab.cc (Symbol_table::add_from_relobj): Don't call
11686         symbol_is_local.
11687         (Symbol_table::add_from_pluginobj): Likewise.
11688         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
11689
11690 2010-01-11  Doug Kwan  <dougkwan@google.com>
11691
11692         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
11693         (incremental_dump_LDADD): Add linking option for libintl.
11694         * Makefile.in: Regenerate.
11695
11696 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
11697
11698         PR gold/11144
11699         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
11700         instead of -Ds.
11701         * testsuite/Makefile.in: Regenerated.
11702
11703 2010-01-10  Doug Kwan  <dougkwan@google.com>
11704
11705         * options.h (DEFINE_var): Use parentheses around argument varname__
11706         in macro body to avoid any unintended subsequent substitutions.
11707
11708 2010-01-10  Ian Lance Taylor  <iant@google.com>
11709
11710         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
11711         candidates before doing symbol resolution.
11712
11713         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
11714         ODR candidates if only one is weak.
11715
11716 2010-01-08  Ian Lance Taylor  <iant@google.com>
11717
11718         * script.cc (Version_script_info::build_expression_list_lookup):
11719         Don't warn about ambiguous version, just record the ambiguity.
11720         (Version_script_info::get_symbol_version_helper): Give error if
11721         version is ambiguous.
11722
11723 2010-01-08  Doug Kwan  <dougkwan@google.com>
11724
11725         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
11726         prev_data_size_ and prev_addralign_.  Remove initializer for
11727         deleted data member has_been_changed_.
11728         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
11729         to determine if the table is empty.
11730         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
11731         Remove.
11732         (Stub_table::add_reloc_stub): Define method in class definition
11733         instead of just declaring it there.
11734         (Stub_table::add_cortex_a8_stub): New method definition.
11735         (Stub_table::update_data_size_and_addralign): Ditto.
11736         (Stub_table::finalize_stubs): Ditto.
11737         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
11738         (Stub_table::do_addralign_): Return address alignment in the
11739         (Stub_table::do_reset_address_and_file_offset): Define method in
11740         class definition instead of declaring it there.  Set current data
11741         size to be the data size of the previous pass.
11742         (Stub_table::set_final_data_size): Use current data size as the
11743         final data size.
11744         (Stub_table::relocate_stub): Change parameter type of stub from
11745         Reloc_stub pointer to Stub pointer.
11746         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
11747         (Stub_table::Cortex_a8_stub_list): New typedef.
11748         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
11749          Stub_table::prev_addralign_): New data member.
11750         (Arm_relobj::Arm_relobj): Initialize data member
11751         section_has_cortex_a8_workaround_.
11752         (Arm_relobj::section_has_cortex_a8_workaround,
11753          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
11754          definitions.
11755         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
11756         declarations.
11757         (Target_arm::relocate_stub): Change parameter type of stub from
11758         Reloc_stub pointer to Stub pointer.
11759         (Insn_template::size, Insn_template::alignment): Handle
11760         THUMB16_SPECIAL_TYPE.
11761         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
11762          Stub_table::update_data_size_and_addralign,
11763          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
11764         definitions.
11765         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
11766         (Stub_table::do_write): Ditto.
11767         (Target_arm::do_relax): Adjust code for changes in Stub_table.
11768
11769 2010-01-08  Ian Lance Taylor  <iant@google.com>
11770
11771         PR 11108
11772         * symtab.h (class Symbol): Remove fields is_target_special_ and
11773         has_plt_offset_.  Add field is_defined_in_discarded_section_.
11774         (Symbol::is_defined_in_discarded_section): New function.
11775         (Symbol::set_is_defined_in_discarded_section): New function.
11776         (Symbol::has_plt_offset): Rewrite.
11777         (Symbol::set_plt_offset): Verify that new offset is not -1U.
11778         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
11779         Don't initialize is_target_special_ or has_plt_offset_.
11780         Initialize is_defined_in_discarded_section_.
11781         (Symbol_table::add_from_relobj): If appropriate, set
11782         is_defined_in_discarded_section.
11783         * resolve.cc (Symbol::override_base_with_special): Don't test
11784         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
11785         * target-reloc.h (relocate_section): Do special handling for
11786         symbols defined in discarded sections for global symbols as well
11787         as local symbols.
11788
11789 2010-01-08  Ian Lance Taylor  <iant@google.com>
11790
11791         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
11792         the SHT_SYMTAB case.
11793
11794 2010-01-08  Ian Lance Taylor  <iant@google.com>
11795
11796         * object.cc (Sized_relobj::do_layout): Don't get confused if
11797         layout_eh_frame returns NULL.
11798
11799 2010-01-08  Ian Lance Taylor  <iant@google.com>
11800
11801         PR 11084
11802         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
11803         dynamic symbol table, use the normal symbol table.
11804         (Sized_dynobj::do_read_symbols): Remove assertion about type of
11805         symbol table.
11806
11807 2010-01-08  Ian Lance Taylor  <iant@google.com>
11808
11809         PR 11072
11810         * layout.cc (Layout::include_section): Remove .gnu_debuglink
11811         sections.
11812
11813 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
11814
11815         * version.cc (print_version): Change to "Copyright 2010".
11816
11817 2010-01-08  Ian Lance Taylor  <iant@google.com>
11818
11819         PR 10287
11820         PR 11063
11821         * i386.cc (class Target_i386): Change return type of plt_section
11822         to be non-const.
11823         (class Output_data_plt_i386): Add tls_desc_rel_ field.
11824         (Output_data_plt_i386::Output_data_plt_i386): Initialize
11825         tls_desc_rel_ field.
11826         (Output_data_plt_i386::rel_tls_desc): New function.
11827         (Target_i386::rel_tls_desc_section): New function.
11828         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
11829         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
11830         R_386_TLS_DESC reloc in rel_tls_desc_section.
11831         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
11832         Define struct Tlsdesc_info.
11833         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
11834         (Target_x86_64::do_reloc_symbol_index): New function.
11835         (Target_x86_64::add_tlsdesc_info): New function.
11836         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
11837         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
11838         tlsdesc_rel_ field.
11839         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
11840         all callers.
11841         (Output_data_plt_x86_64::rela_tlsdesc): New function.
11842         (Target_x86_64::rela_tlsdesc_section): New function.
11843         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
11844         handling.
11845         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
11846         (Target_x86_64::do_reloc_addend): New function.
11847         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
11848         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
11849         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
11850         (Output_reloc::type): New function.
11851         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
11852         (Output_reloc::is_target_specific): New function.
11853         (Output_reloc::target_arg): New function.
11854         (class Output_reloc) [SHT_RELA]: Add four new constructors for
11855         absolute relocs and target specific relocs.
11856         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
11857         add_target_specific.
11858         (class Output_data_reloc) [SHT_RELA]: Likewise.
11859         * output.cc (Output_reloc::Output_reloc): Add four new versions
11860         for absolute relocs and target specific relocs.
11861         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
11862         (Output_reloc::get_symbol_index): Likewise.
11863         (Output_reloc::local_section_offset): Check that local_sym_index_
11864         is not TARGET_CODE or 0.
11865         (Output_reloc::symbol_value): Likewise.
11866         (Output_reloc::write) [SHT_RELA]: Call target for target specific
11867         reloc.
11868         * target.h (class Target): Add reloc_symbol_index and reloc_addend
11869         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
11870         functions.
11871         * layout.cc (add_target_dynamic_tags): Use output section for
11872         DT_PLTRELSZ and DT_JMPREL.
11873
11874 2010-01-07  Ian Lance Taylor  <iant@google.com>
11875
11876         PR 11061
11877         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
11878         function.
11879         (class Output_data_reloc_generic): Define.
11880         (class Output_data_reloc_base): Change base class to
11881         Output_data_reloc_generic.  Change add() method to call
11882         bump_relative_reloc_count for a relative reloc.  Remove
11883         sort_relocs_ field.
11884         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
11885         to sort_relocs().
11886         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
11887         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
11888         appropriate.
11889         * layout.h (class Layout): Update declaration.
11890
11891 2010-01-07  Ian Lance Taylor  <iant@google.com>
11892
11893         * output.h (class Output_data): Add const version of
11894         output_section and do_output_section.
11895         (class Output_section_data): Add const version of
11896         do_output_section.
11897         (class Output_section): Likewise.
11898         * layout.cc (Layout::add_target_dynamic_tags): New function.
11899         * layout.h (class Layout): Update declarations.
11900         * arm.cc (Target_arm::do_finalize_sections): Use
11901         add_target_dynamic_tags.
11902         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11903         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11904         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11905         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11906
11907 2010-01-07  Ian Lance Taylor  <iant@google.com>
11908
11909         PR 11042
11910         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
11911         object as needed.
11912
11913 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
11914             Ian Lance Taylor  <iant@google.com>
11915
11916         PR 11019
11917         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
11918         Xindex::read_symtab_xindex.
11919
11920 2010-01-07  Doug Kwan  <dougkwan@google.com>
11921
11922         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
11923         (Insn_template::thumb16_bcond_insn): New method declaration.
11924         (Insn_template): Fix spelling.
11925         (Stub::thumb16_special): New method declaration.
11926         (Stub::do_write): Define virtual method which was previously pure
11927         virtual.
11928         (Stub::do_thumb16_special): New method declaration.
11929         (Stub::do_fixed_endian_write): New template member.
11930         (Reloc_stub::do_write): Remove.
11931         (Reloc_stub::do_fixed_endian_write): Remove.
11932         (Cortex_a8_stub): New class definition.
11933         (Stub_factory::make_cortex_a8_stub): New method definition.
11934         (Stub_factory::Stub_factory): Add missing static storage class
11935         qualifier for elf32_arm_stub_a8_veneer_blx.
11936
11937 2010-01-07  Ian Lance Taylor  <iant@google.com>
11938
11939         PR 10980
11940         * options.h (class General_options): Add --warn-unresolved-symbols
11941         and --error-unresolved-symbols.
11942         * errors.cc (Errors::undefined_symbol): Implement
11943         --warn-unresolved-symbols.
11944
11945         * options.h (class General_options): Add -z text and -z textoff.
11946         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
11947
11948 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
11949
11950         * gc.h (Garbage_collection::Cident_section_map): New typedef.
11951         (Garbage_collection::cident_sections): New function.
11952         (Garbage_collection::add_cident_section): New function.
11953         (Garbage_collection::cident_sections_): New member.
11954         (gc_process_relocs): Add references to sections whose names are C
11955         identifiers.
11956         * gold.h (cident_section_start_prefix): New constant.
11957         (cident_section_stop_prefix): New constant.
11958         (is_cident): New function.
11959         * layout.cc (Layout::define_section_symbols): Replace string constants
11960         with the newly defined constants.
11961         * object.cc (Sized_relobj::do_layout): Track sections whose names are
11962         C identifiers.
11963         * testsuite/Makefile.am: Add gc_orphan_section_test.
11964         * testsuite/Makefile.in: Regenerate.
11965         * testsuite/gc_orphan_section_test.cc: New file.
11966         * testsuite/gc_orphan_section_test.sh: New file.
11967
11968 2010-01-06  Ian Lance Taylor  <iant@google.com>
11969
11970         PR 10980
11971         * options.h (class General_options): Add --warn-shared-textrel.
11972         * layout.cc (Layout::finish_dynamic_section): Implement
11973         --warn-shared-textrel.
11974
11975         PR 10980
11976         * options.h (class General_options): Add --warn-multiple-gp.
11977
11978 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11979
11980         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
11981         $(THREADSLIB) and $(LIBDL).
11982         * Makefile.in: Rebuild.
11983
11984 2010-01-06  Ian Lance Taylor  <iant@google.com>
11985
11986         PR 10980
11987         * options.cc (General_options::parse_section_start): New function.
11988         (General_options::section_start): New function.
11989         (General_options::General_options): Initialize all members.
11990         * options.h: Include <map>
11991         (class General_options): Add --section-start.  Add section_starts_
11992         member.
11993         * layout.cc (Layout::attach_allocated_section_to_segment): If
11994         --section-start was used, set the address of the segment.  Remove
11995         local sort_sections.
11996         (Layout::relaxation_loop_body): If the address of the load segment
11997         has been set by --section-start, don't use it.
11998         * output.h (Output_segment::update_flags_for_output_section): New
11999         function.
12000         * output.cc (Output_segment::add_output_section): Call
12001         update_flags_for_output_section.
12002
12003 2010-01-05  Ian Lance Taylor  <iant@google.com>
12004
12005         PR 10980
12006         * options.h (class General_options): Add --undefined-version.
12007         * script.cc (struct Version_expression): Add was_matched_by_symbol
12008         field.
12009         (Version_script_info::matched_symbol): New function.
12010         (Version_script_info::get_symbol_version_helper): Call
12011         matched_symbol.
12012         (Version_script_info::check_unmatched_names): New function.
12013         * script.h (class Version_script_info): Update declarations.
12014         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
12015
12016         * options.h (class General_options): Use DEFINE_bool_alias for
12017         allow_multiple_definition.
12018         * resolve.cc (Symbol_table::should_override): Don't test
12019         allow_multiple_definition.
12020
12021         PR 10980
12022         * options.h (class General_options): Add --cref.
12023         * main.cc (main): Print cref table if --cref.  Don't close mapfile
12024         until after printing cref table.
12025         * cref.cc: Include "symtab.h".
12026         (class Cref_inputs): Define Cref_table_compare and Cref_table.
12027         (Cref_table_compare::operator()): New function.
12028         (Cref_inputs::gather_cref): New function.
12029         (filecol): New static const.
12030         (Cref_inputs::print_cref): New function.
12031         (Cref::print_cref): New function.
12032         * cref.h: Include <cstdio>.
12033         (class Cref): Update declarations.
12034         * mapfile.h (Mapfile::file): New function.
12035         * object.h (class Object): Define Symbols.  Declare virtual
12036         do_get_global_symbols.
12037         (Object::get_global_symbols): New function.
12038         * object.cc (Input_objects::add_object): Pass object to cref_ if
12039         --cref.
12040         (Input_objects::archive_start): Likewise.
12041         (Input_objects::archive_stop): Likewise.
12042         (Input_objects::print_cref): New function.
12043         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
12044         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
12045         --cref.
12046         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
12047         function.
12048         * plugin.h (class Sized_pluginobj): Update declarations.
12049
12050 2010-01-05  Ian Lance Taylor  <iant@google.com>
12051
12052         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
12053         to is_default_version.  Rename insdef to insdefault.
12054         (Symbol_table::add_from_relobj): Rename def to is_default_version
12055         and local to is_forced_local.
12056         (Symbol_table::add_from_pluginobj): Likewise.
12057         (Symbol_table::add_from_dynobj): Likewise.
12058         (Symbol_table::define_special_symbol): Rename insdef to
12059         insdefault.
12060
12061 2010-01-04  Ian Lance Taylor  <iant@google.com>
12062
12063         PR 10980
12064         * options.h (class General_options): Add
12065         --allow-multiple-definition and -z muldefs.
12066         * resolve.cc (Symbol_table::should_override): Don't warn about a
12067         multiple symbol definition if --allow-multiple-definition or -z
12068         muldefs.
12069
12070         PR 10980
12071         * options.h (class General_options): Add --add-needed and
12072         --copy-dt-needed-entries.  Tweak --as-needed help entry.
12073         * object.cc (Input_objects::check_dynamic_dependencies): Give an
12074         error if --copy-dt-needed-entries aka --add-needed is used and
12075         would cause a change in behaviour.
12076
12077         PR 10980
12078         * options.h (class General_options): Add -G as a short version of
12079         --shared.  Add no-op options -assert, -g, and -i.
12080
12081 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
12082
12083         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
12084         check for .text or .gnu.linkonce.t sections.
12085         * icf.cc (Icf::find_identical_sections): Ditto.
12086         Change the detection for mangled function name within the section
12087         name.
12088         * icf.h (is_section_foldable_candidate): New function.
12089
12090 2009-12-30  Ian Lance Taylor  <iant@google.com>
12091
12092         PR 10980
12093         * options.h (class General_options): Permit two dashes with
12094         --retain-symbols-file.
12095
12096 2009-12-30  Ian Lance Taylor  <iant@google.com>
12097
12098         PR 10979
12099         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
12100         don't put the file header and segment headers in the text
12101         segment.
12102
12103         PR 10979
12104         * common.cc (Sort_commons::operator()): Stabilize sort when both
12105         entries are NULL.
12106         (Symbol_table::do_allocate_commons_list): When allocating common
12107         symbols, skip a symbol which is no longer common.
12108         * symtab.h (Symbol::is_common): Test whether the symbol comes from
12109         an object before checking its type.
12110         * testsuite/common_test_2.c: New file.
12111         * testsuite/common_test_3.c: New file.
12112         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
12113         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
12114         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
12115         (common_test_2_pic.o, common_test_2.so): New targets.
12116         (common_test_3_pic.o, common_test_3.so): New targets.
12117         * testsuite/Makefile.in: Rebuild.
12118
12119         PR 10979
12120         * script.cc (read_input_script): If we see a new SECTIONS clause,
12121         and we have added an input section, give an error.
12122         * layout.h (class Layout): Add have_added_input_section function.
12123         Add have_added_input_section_ field.
12124         * layout.cc (Layout::Layout): Initialize
12125         have_added_input_section_.
12126         (Layout::layout): Set have_added_input_section_.
12127         (Layout::layout_eh_frame): Likewise.
12128
12129 2009-12-30  Ian Lance Taylor  <iant@google.com>
12130
12131         PR 10931
12132         * options.h (class General_options): Add --sort-common option.
12133         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
12134         * common.cc (Sort_common): Add sort_order parameter to
12135         constructor.  Add sort_order_ field.
12136         (Sort_commons::operator): Check sort_order_.
12137         (Symbol_table::allocate_commons): Determine the sort order.
12138         (Symbol_table::do_allocate_commons): Add sort_order parameter.
12139         Change all callers.
12140         (Symbol_table::do_allocate_commons_list): Likewise.
12141
12142 2009-12-30  Ian Lance Taylor  <iant@google.com>
12143
12144         PR 10916
12145         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
12146         symbols from this object, don't change the visibility of an
12147         undefined symbol.
12148         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
12149
12150 2009-12-30  Ian Lance Taylor  <iant@google.com>
12151
12152         PR 10861
12153         * script.h (class Version_script_info): Define Language enum.
12154         Update declarations.  Define Glob, Exact, and Lookup types.  Add
12155         new fields globals_, locals_, and is_finalized_.
12156         * script.cc: Various formatting fixes.
12157         (class Parser_closure): Change language_stack_ from a vector of
12158         std::string to one of Version_script_info::Language.  Adjust all
12159         uses accordingly.
12160         (class Lazy_demangler): Remove.
12161         (struct Version_expression): Change language from std::string to
12162         Version_script_info::Language.
12163         (Version_script_info::Version_script_info): New function.
12164         (Version_script_info::~Version_script_info): Don't call clear.
12165         (Version_script_info::finalize): New function.
12166         (Version_script_info::build_lookup_tables): New function.
12167         (Version_script_info::build_expression_list_lookup): New
12168         function.
12169         (Version_script_info::get_symbol_version_helper): Rewrite to use
12170         lookup tables.
12171         (Version_script_info::print_expression_list): Adjust to use
12172         Version_script_info::Language.
12173         (script_push_lex_into_version_mode): Check that the version script
12174         has not been finalized.
12175         (version_script_push_lang): Change language string to
12176         Version_script_info::Language.
12177         * options.cc (Command_line::version_script): New function.
12178         * options.h (class General_options): Add finalize_dynamic_list
12179         function.  Change version_script from declaration to definition.
12180         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
12181         * testsuite/version_script.map: Remove duplicate def of foo.
12182         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
12183         version_script.map.
12184         * testsuite/Makefile.in: Rebuild.
12185
12186 2009-12-30  Ian Lance Taylor  <iant@google.com>
12187
12188         PR 10843
12189         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
12190         if the input symbol index is 0, make the output symbol index 0.
12191
12192 2009-12-30  Ian Lance Taylor  <iant@google.com>
12193
12194         PR 10670
12195         * options.h (class General_options): Add -x/--discard-all.
12196         * object.cc (Sized_relobj::do_count_local_symbols): Handle
12197         --discard-all.  If the local symbol needs a dynamic entry, check
12198         that before handling --discard-locals.
12199
12200 2009-12-30  Ian Lance Taylor  <iant@google.com>
12201
12202         PR 10450
12203         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
12204         flags to PF_R.
12205         (Output_segment::add_output_section): Don't change the flags if
12206         the type is PT_TLS.
12207
12208         PR 10450
12209         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
12210         GNU hash table if they need a dynamic value.  Otherwise, don't add
12211         them if they are defined in a dynamic object or are forced local.
12212
12213 2009-12-29  Ian Lance Taylor  <iant@google.com>
12214
12215         PR 10450
12216         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
12217         .gnu.hash table for a 32-bit target.
12218
12219         PR 10450
12220         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
12221         regular and a dynamic object only needs a dynamic symbol table
12222         entry if it is externally visible.
12223
12224         PR 10450
12225         * i386.cc (class Target_i386): Initialize global_offset_table_ in
12226         constructor.  Add global_offset_table_ field.
12227         (Target_i386::got_section): Set global_offset_table_.
12228         (Target_i386::do_finalize_sections): Set global_offset_table_
12229         size.
12230         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
12231         in constructor.  Add global_offset_table_ field.
12232         (Target_x86_64::got_section): Set global_offset_table_.
12233         (Target_x86_64::do_finalize_sections): Set global_offset_table_
12234         size.
12235
12236         * layout.cc (Layout::Layout): Initialize increase_relro_.
12237         (Layout::get_output_section): Add is_relro, is_last_relro, and
12238         is_first_non_relro parameters.  Change all callers.
12239         (Layout::choose_output_section): Likewise.
12240         (Layout::add_output_section_data): Likewise.
12241         (Layout::make_output_section): Likewise.
12242         (Layout::set_segment_offsets): Clear increase_relro when using a
12243         linker script.
12244         * layout.h (class Layout): Add increase_relro method.  Add
12245         increase_relro_ field.  Update declarations.
12246         * output.cc (Output_section::Output_section): Initialize
12247         is_last_relro_ and is_first_non_relro_.
12248         (Output_segment::add_output_section): Group relro sections is
12249         do_sort is true.  Handle is_last_relro and is_first_non_relro.
12250         (Output_segment::maximum_alignment): Remove relro handling.
12251         (Output_segment::set_section_addresses): Add increase_relro
12252         parameter.  Change all callers.  Add initial alignment to align
12253         relro sections on separate page.  Remove old relro handling.
12254         (Output_segment::set_section_list_addresses): Remove in_relro
12255         parameter.  Change all callers.
12256         (Output_segment::set_offset): Add increase parameter.  Change all
12257         callers.  Remove old relro handling.
12258         * output.h (class Output_section): Add new methods: is_last_relro,
12259         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
12260         Add is_last_relro_ and is_first_non_relro_ fields.
12261         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
12262         Create separate .got.plt section.  Call increase_relro.
12263         * x86_64.cc (Target_x86_64::got_section): Likewise.
12264         * testsuite/relro_script_test.t: Add .got.plt.
12265
12266         PR 10450
12267         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
12268         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
12269         (Layout::finalize): Call set_dynamic_symbol_size.
12270         (Layout::set_dynamic_symbol_size): New function.
12271         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
12272         set_dynamic_symbol_size.
12273
12274         PR 10450
12275         * output.h (class Output_section): Add is_entsize_zero_ field.
12276         * output.cc (Output_section::Output_section): Initialize
12277         is_entsize_zero_.
12278         (Output_section::set_entsize): If two different entsizes are
12279         requested, force it to zero.
12280         (Output_section::add_input_section): Set flags for .debug_str
12281         before updating section flags.  Set entsize.
12282         (Output_section::update_flags_for_input_section): Set SHF_MERGE
12283         and SHF_STRING if all input sections have those flags.
12284
12285 2009-12-29   Rafael Espindola  <espindola@google.com>
12286
12287         * main.cc (main): Fix the sys time reporting.
12288         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
12289         reporting.
12290
12291 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
12292
12293         * options.cc (General_options::parse_version): Allow -v to exit
12294         without an error if there is nothing to link.
12295
12296 2009-12-29  Ian Lance Taylor  <iant@google.com>
12297
12298         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
12299         using a version of gcc before 4.1.
12300         * configure: Rebuild.
12301
12302 2009-12-28  Chris Demetriou  <cgd@google.com>
12303
12304         * attributes.cc (Output_attributes_section_data::do_write): Use
12305         std::vector::front rather than std::vector::data.
12306
12307 2009-12-28  Ian Lance Taylor  <iant@google.com>
12308
12309         * symtab.h (class Symbol_table): Add enum Defined.
12310         * resolve.cc (Symbol_table::should_override): Add defined
12311         parameter.  Change all callers.  Test whether object is NULL
12312         before calling a method on it.
12313         (Symbol_table::report_resolve_problem): Add defined parameter.
12314         Change all callers.
12315         (Symbol_table::should_override_with_special): Likewise.
12316         * symtab.cc (Symbol_table::define_in_output_data): Add defined
12317         parameter.  Change all callers.
12318         (Symbol_table::do_define_in_output_data): Likewise.
12319         (Symbol_table::define_in_output_segment): Likewise.
12320         (Symbol_table::do_define_in_output_segment): Likewise.
12321         (Symbol_table::define_as_constant): Likewise.
12322         (Symbol_table::do_define_as_constant): Likewise.
12323         * script.h (class Symbol_assignment): Add is_defsym parameter to
12324         constructor; change all callers.
12325         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
12326         parameter.  Change all callers.  Add is_defsym_ field.
12327         (class Parser_closure): Add parsing_defsym parameter to
12328         constructor; change all callers.  Add parsing_defsym accessor
12329         function.  Add parsing_defsym_ field.
12330
12331 2009-12-28  Ian Lance Taylor  <iant@google.com>
12332
12333         * gold.cc (queue_middle_tasks): Fix formatting.
12334         * object.cc (Relobj::is_section_name_included): Likewise.
12335
12336 2009-12-23  Ian Lance Taylor  <iant@google.com>
12337
12338         * i386.cc (Target_i386::do_calls_non_split): Recognize
12339         -fsplit-stack prologue for a function with a static chain.
12340         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
12341         -fsplit-stack prologue when using %r11.
12342
12343 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
12344
12345         * options.cc (General_options::parse_version): Make -v continue and do
12346         the link like GNU ld does.
12347
12348 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
12349
12350         * Makefile.am (CCFILES): Add timer.cc.
12351         (HFILES): Add timer.h.
12352         * configure.ac: Check for sysconf and times.
12353         * main.cc: include timer.h.
12354         (main): Use Timer instead of get_run_time.
12355         * timer.cc: New.
12356         * timer.h: New.
12357         * workqueue.cc: include timer.h.
12358         (Workqueue::find_and_run_task):
12359         Report user, sys and wall time.
12360         * Makefile.in: Regenerate.
12361         * config.in: Regenerate.
12362         * configure: Regenerate.
12363
12364 2009-12-16  Doug Kwan  <dougkwan@google.com>
12365
12366         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
12367         sections.
12368         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
12369         relaxed input sections.
12370         * output.cc (Output_section::find_relaxed_input_section): Change
12371         return type to Output_relaxed_input_section pointer.  Adjust code
12372         for new type of relaxed_input_section_map_.
12373         * output.h (Output_section::find_relaxed_input_section): Change
12374         return type to Output_relaxed_input_section pointer.
12375         (Output_section::Output_relaxed_input_section_by_input_section_map):
12376         New type.
12377         (Output_section::relaxed_input_section_map_): Change type to
12378         Output_section::Output_relaxed_input_section_by_input_section_map.
12379         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
12380         input section.
12381
12382 2009-12-15  Ian Lance Taylor  <iant@google.com>
12383
12384         * layout.cc (Layout::create_shstrtab): Only write out after input
12385         sections if we are compressing debug sections.
12386
12387 2009-12-15  Ian Lance Taylor  <iant@google.com>
12388
12389         * archive.cc (Archive::add_symbols): Only look up a symbol without
12390         a version if there is, in fact, a version.
12391
12392 2009-12-14  Ian Lance Taylor  <iant@google.com>
12393
12394         Revert -Wshadow changes, all changes from:
12395         2009-12-11  Doug Kwan  <dougkwan@google.com>
12396         2009-12-11  Nick Clifton  <nickc@redhat.com>
12397         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
12398
12399 2009-12-11  Doug Kwan  <dougkwan@google.com>
12400
12401         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
12402         due to -Wshadow.
12403         * attributes.cc (Object_attribute::size): Ditto.
12404         (Attributes_section_data::size): Ditto.
12405         (Attributes_section_data::Attributes_section_data): Ditto.
12406         (Output_attributes_section_data::do_write): Ditto.
12407         * attributes.h (Object_attribute::set_type): Ditto.
12408         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
12409
12410 2009-12-11  Nick Clifton  <nickc@redhat.com>
12411
12412         * archive.cc: Fix shadowed variable warnings.
12413         * arm.cc: Likewise.
12414         * compressed_output.cc: Likewise.
12415         * compressed_output.h: Likewise.
12416         * configure: Likewise.
12417         * dwarf_reader.cc: Likewise.
12418         * dynobj.cc: Likewise.
12419         * dynobj.h: Likewise.
12420         * ehframe.cc: Likewise.
12421         * ehframe.h: Likewise.
12422         * errors.cc: Likewise.
12423         * expression.cc: Likewise.
12424         * fileread.cc: Likewise.
12425         * fileread.h: Likewise.
12426         * freebsd.h: Likewise.
12427         * i386.cc: Likewise.
12428         * icf.cc: Likewise.
12429         * incremental.h: Likewise.
12430         * layout.cc: Likewise.
12431         * layout.h: Likewise.
12432         * mapfile.cc: Likewise.
12433         * merge.cc: Likewise.
12434         * merge.h: Likewise.
12435         * object.cc: Likewise.
12436         * object.h: Likewise.
12437         * options.h: Likewise.
12438         * output.cc: Likewise.
12439         * output.h: Likewise.
12440         * parameters.cc: Likewise.
12441         * plugin.cc: Likewise.
12442         * powerpc.cc: Likewise.
12443         * reduced_debug_output.cc: Likewise.
12444         * reduced_debug_output.h: Likewise.
12445         * reloc.cc: Likewise.
12446         * reloc.h: Likewise.
12447         * resolve.cc: Likewise.
12448         * script-sections.cc: Likewise.
12449         * script.cc: Likewise.
12450         * script.h: Likewise.
12451         * sparc.cc: Likewise.
12452         * symtab.cc: Likewise.
12453         * symtab.h: Likewise.
12454         * target-select.cc: Likewise.
12455         * target-select.h: Likewise.
12456         * token.h: Likewise.
12457         * workqueue.cc: Likewise.
12458         * workqueue.h: Likewise.
12459         * x86_64.cc: Likewise.
12460
12461 2009-12-10  Doug Kwan  <dougkwan@google.com>
12462
12463         * arm.cc (attributes.h): New include.
12464         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
12465         (Arm_relobj::~Arm_relobj): Delete object pointed by
12466         attributes_section_data_.
12467         (Arm_relobj::attributes_section_data): New method definition.
12468         (Arm_relobj::attributes_section_data_): New data member declaration.
12469         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
12470         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
12471         attributes_section_data_.
12472         (Arm_dynobj::attributes_section_data): New method definition.
12473         (Arm_dynobj::attributes_section_data_): New data member declaration.
12474         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
12475         initialization value of may_use_blx_ to false.
12476         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
12477         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
12478         object attributes to compute results instead of hard-coding.
12479         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
12480         Target_arm::get_secondary_compatible_arch,
12481         Target_arm::set_secondary_compatible_arch
12482         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12483         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
12484         New method declarations.
12485         (Target_arm::get_aeabi_object_attribute): New method definition.
12486         (Target_arm::attributes_section_data_): New data member declaration.
12487         (read_arm_attributes_section): New template definition.
12488         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
12489         (Arm_dynobj::do_read_symbols): Ditto.
12490         (Target_arm::do_finalize_sections): Merge attributes sections from
12491         input.  Check for BLX use after attributes section merging.
12492         Fix __exidx_start and __exidx_end visibility.  Create an
12493         .ARM.attributes section if necessary.
12494         (Target_arm::get_secondary_compatible_arch,
12495         Target_arm::set_secondary_compatible_arch,
12496         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12497         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
12498         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
12499         New method definitions.
12500
12501 2009-12-09  Ian Lance Taylor  <iant@google.com>
12502
12503         * plugin.cc (Plugin::load): Don't cast from void* to a function
12504         pointer.
12505
12506 2009-12-09  Ian Lance Taylor  <iant@google.com>
12507
12508         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
12509         information fields.
12510
12511 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
12512
12513         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
12514         Replace two_file_shared_1.so with two_file_shared_2.so.
12515         * testsuite/Makefile.in: Regenerated.
12516
12517 2009-12-08  Doug Kwan  <dougkwan@google.com>
12518
12519         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
12520         (HFILES): Add attributes.h and int_encoding.h.
12521         * Makefile.in: Regenerate.
12522         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
12523         function definitions to int_encoding.cc
12524         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
12525         prototypes to int_encoding.h
12526         * reduced_debug_output.cc (int_encoding.h): New include.
12527         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
12528         function definitions to int_encoding.cc
12529         (insert_into_vector, read_from_pointer): Move template definitions to
12530         int_encoding.h
12531         * attributes.cc: New file.
12532         * attributes.h: New file.
12533         * int_encoding.cc: New file.
12534         * int_encoding.h: New file.
12535
12536 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
12537
12538         PR gold/11055
12539         * incremental-dump.cc (dump_incremental_inputs): New.
12540         (main): Use dump_incremental_inputs.
12541
12542 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
12543
12544         PR gold/10893
12545         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
12546         checking elfcpp::STT_FUNC.
12547         (Target_i386::Relocate::relocate): Likewise.
12548         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
12549
12550         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
12551         symbols from shared libraries into normal FUNC symbols.
12552
12553         * symtab.h (Symbol): Add is_func and use it.
12554
12555 2009-12-05  Doug Kwan  <dougkwan@google.com>
12556
12557         * arm.cc (Target_arm::arm_info): Initialize new fields
12558         attributes_section and attributes_vendor.
12559         * i386.cc (Target_i386::i386_info): Same.
12560         * object.cc (Sized_relobj::do_layout): Skip attribute section.
12561         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
12562         fields attributes_section and attributes_vendor.
12563         * sparc.cc (Target_sparc::sparc_info): Same.
12564         * target.h (Target::attributes_section, Target::attributes_vendor,
12565         Target::is_attributes_section, Target::attribute_arg_type,
12566         Target::attributes_order): New method definitions.
12567         (Target::Target_info::attributes_section,
12568         Target::Target_info::attributes_vendor): New fields.
12569         (Target::do_attribute_arg_type, Target::do_attributes_order): New
12570         virtual method definitions.
12571         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
12572         attributes_section and attributes_vendor.
12573         * testsuite/testfile.cc (Target_test::test_target_info): Same.
12574
12575 2009-12-05  Doug Kwan  <dougkwan@google.com>
12576
12577         * arm.cc: Update comments about interworking and stub generation.
12578         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
12579         considered as non-PIC.
12580         (Arm_relocate_functions::base_abs): Fix formatting.
12581         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
12582         of function to use GOT entry address instead of offset.
12583         (Target_arm::Scan::global): Issue an error if a symbol would need a
12584         PLT does not get one because it is untyped.  Remove code to create
12585         dynamic symbols for relative branches.
12586         (Target_arm::Relocate::relocate: Use 0 instead of false since function
12587         takes unsigned integer instead of boolean.
12588
12589 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
12590
12591         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
12592         (two_file_test_LDADD): Likewise.
12593         (common_test_1_LDADD): Likewise.
12594         (exception_test_LDADD) Likewise.
12595         (weak_test_LDADD): Likewise.
12596         (many_sections_test_LDADD): Likewise.
12597         (initpri1_LDADD): Likewise.
12598         (script_test_1_LDADD): Likewise.
12599         (script_test_2_LDADD): Likewise.
12600         (justsyms_LDADD): Likewise.
12601         (binary_test_LDADD): Likewise.
12602         (large_LDADD): Likewise.
12603         * testsuite/Makefile.in: Regenerated.
12604
12605 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
12606
12607         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
12608         (Symbol_table::override_with_special): Likewise.
12609         (Symbol_table::add_from_object): Likewise.
12610
12611 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12612
12613         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12614         Don't set the data_offset twice.
12615
12616 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12617
12618         * testsuite/Makefile.in: Regenerate.
12619
12620 2009-12-03  Doug Kwan  <dougkwan@google.com>
12621
12622         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
12623         (Target_arm::do_finalize_sections): Add parameter for symbol table
12624         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
12625         * i386.cc (Target_i386::do_finalize_sections): Add an additional
12626         parameter for symbol table pointer.
12627         * layout.cc (Layout::finalize): Call Target::finalize_sections with
12628         an additional parameter for a pointer to symbol table.
12629         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
12630         parameter for a symbol table pointer.
12631         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
12632         * target.h (Target::finalize_sections, Target::do_finalize_sections):
12633         Ditto.
12634         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
12635         parameter for a symbol table pointer.
12636
12637 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
12638
12639         * incremental.cc (Incremental_inputs_header)
12640         (Incremental_inputs_header_write, Incremental_inputs_entry)
12641         (Incremental_inputs_entry_write): Move ...
12642         * incremental.h (Incremental_inputs_header)
12643         (Incremental_inputs_header_write, Incremental_inputs_entry)
12644         (Incremental_inputs_entry_write): here.
12645
12646 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12647
12648         * incremental.cc (make_sized_incremental_binary): Set the target.
12649         Error if it is incompatible.
12650         * output.h (Output_file): Add filename method.
12651
12652 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12653
12654         * incremental.cc (Incremental_inputs_entry): Remove unused argument
12655         from the get_* methods.
12656
12657 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12658
12659         * incremental-dump.cc (main): Check that the offeset of a script is 0.
12660         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12661         Write 0 for the data_offset of scripts.
12662
12663 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12664
12665         * testsuite/Makefile.am: Add the incremental_test.sh test.
12666         * testsuite/incremental_test.sh: New.
12667         * testsuite/incremental_test_1.c: New.
12668         * testsuite/incremental_test_2.c: New.
12669
12670 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
12671
12672         * incremental-dump.cc (main): Fix typos.
12673
12674 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
12675
12676         PR gold/11025
12677         * incremental-dump.cc (main): Use llu to print 64 bit values.
12678
12679 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
12680             H.J. Lu  <hongjiu.lu@intel.com>
12681
12682         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
12683         $(LIBDL).
12684         (incremental_dump_LDADD): Likewise.
12685         * Makefile.in: Regenerated.
12686
12687 2009-11-25  Doug Kwan  <dougkwan@google.com>
12688
12689         Revert:
12690
12691         2009-11-25  Doug Kwan  <dougkwan@google.com>
12692
12693                 * arm.cc (Target_arm::Target_arm): Move method definition
12694                 outside of class definition.  Add code to handle
12695                 --target1-rel, --target1-abs and --target2= options.
12696                 (Target_arm::get_reloc_reloc_type): Change method to be
12697                 non-static and const.
12698                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
12699                 New data member declaration.
12700                 (Target_arm::Scan::local, Target_arm::Scan::global,
12701                 Target_arm::Relocate::relocate,
12702                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12703                 Adjust call to Target_arm::get_real_reloc_type.
12704                 (Target_arm::get_real_reloc_type): Use command line options
12705                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12706                 * options.h (--target1-rel, --target1-abs, --target2): New
12707                 ARM-only options.
12708
12709 2009-11-25  Doug Kwan  <dougkwan@google.com>
12710
12711         * arm.cc (Target_arm::Target_arm): Move method definition outside of
12712         class definition.  Add code to handle --target1-rel, --target1-abs
12713         and --target2= options.
12714         (Target_arm::get_reloc_reloc_type): Change method to be non-static
12715         and const.
12716         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
12717         member declaration.
12718         (Target_arm::Scan::local, Target_arm::Scan::global,
12719         Target_arm::Relocate::relocate,
12720         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
12721         call to Target_arm::get_real_reloc_type.
12722         (Target_arm::get_real_reloc_type): Use command line options to
12723         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12724         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
12725         options.
12726
12727 2009-11-25  Doug Kwan  <dougkwan@google.com>
12728
12729         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
12730         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
12731         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
12732         formatting.
12733         (Arm_relocate_functions::thm_call): Replace body with a call to
12734         Arm_relocate_functions::thumb_branch_common.
12735         (Arm_relocate_functions::thm_jump24,
12736         Arm_relocate_functions::thm_xpc22): New method definitions.
12737         (Arm_relocate_functions::thumb_branch_common): New method definition.
12738         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
12739         operator.
12740         (Target_arm::Relocate::relocate): Adjust call to thm_call.
12741         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
12742
12743 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12744
12745         * Makefile.am: Build incremental-dump
12746         * Makefile.in: Regenerate.
12747         * incremental-dump.cc: New.
12748         * incremental.cc (Incremental_inputs_header_data,
12749         Incremental_inputs_entry_data): Move to incremental.h
12750         * incremental.h: (Incremental_inputs_header_data,
12751         Incremental_inputs_entry_data): Move from incremental.cc
12752
12753 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12754
12755         * incremental.cc (Incremental_inputs_header,
12756         Incremental_inputs_header_write, Incremental_inputs_entry,
12757         Incremental_inputs_entry_write): Add a typedef with the data type.
12758
12759 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12760
12761         * incremental.cc (Incremental_inputs_header,
12762         Incremental_inputs_header_write, Incremental_inputs_entry,
12763         Incremental_inputs_entry_write): Update comment about which
12764         type has the filed descriptions.
12765
12766 2009-11-15  Doug Kwan  <dougkwan@google.com>
12767
12768         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
12769         (Arm_relocate_functions::arm_branch_common): Change method defintion
12770         in class definition to a method declaration and update list of formal
12771         parameters.
12772         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
12773         Arm_relocation_functions::jump24): Adjust call to
12774         Arm_relocate_functions::arm_branch_common.  Update list of formal
12775         parameters.
12776         (Arm_relocate_functions::xpc25): New method definition.
12777         (Arm_relocate_functions::arm_branch_common): Move method defintion
12778         out from class definition.  Use stubs for mode-switching and extending
12779         branch ranges.
12780         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
12781         specially.  Change code to enable use of stubs in ARM branches.
12782
12783 2009-11-10  Doug Kwan  <dougkwan@google.com>
12784
12785         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
12786         in method declaration.
12787         (Target_arm::relocate_stub): New method declaration.
12788         (Target_arm::default_target): Change to return a pointer instead of
12789         a const reference.
12790         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
12791         Target_arm::default_target.
12792         (Arm_Relobj::do_relocate_sections): Remove options paramater in
12793         method definition.
12794         (Target_arm::relocate_section): Adjust view.
12795         (Target_arm::relocate_stub): New method definition.
12796
12797 2009-11-10  Doug Kwan  <dougkwan@google.com>
12798
12799         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
12800         a format warning.
12801         * incremental.cc (open_incremental_binary): Initialized local
12802         variables to avoid warnings.
12803         * object.cc (make_elf_object): Ditto.
12804         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
12805         a format warning.
12806
12807 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
12808
12809         PR gold/10930
12810         * testsuite/plugin_test.c: Include "config.h".
12811
12812 2009-11-09  Doug Kwan  <dougkwan@google.com>
12813
12814         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
12815         (arm_symbol_value): Remove.
12816         (Arm_relocate_functions::arm_branch_common,
12817         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
12818         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
12819         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
12820         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
12821         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12822         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12823         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12824         Arm_relocate_functions::thm_mobw_abs_nc,
12825         Arm_relocate_functions::thm_mov_abs,
12826         Arm_relocate_functions::movw_prel_nc,
12827         Arm_relocate_functions::thm_movt_abs,
12828         Arm_relocate_functions::movt_prel,
12829         Arm_relocate_functions::thm_movw_prel_nc,
12830         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
12831         (Target_arm::Relocate::relocate): Only decompose address into two
12832         parts if relocation type uses the thumb-bit and pass the actual
12833         bit instead of a flag indicating that the thumb-bit is used.  Adjust
12834         calls to methods in Arm_relocate_functions for this change.
12835
12836 2009-11-08  Ian Lance Taylor  <iant@google.com>
12837
12838         PR 10925
12839         * reloc.cc: Instantiate
12840         Sized_relobj::initialize_input_to_output_maps and
12841         Sized_relobj:free_input_to_output_maps.
12842
12843 2009-11-06  Ian Lance Taylor  <iant@google.com>
12844
12845         PR 10876
12846         * defstd.cc (in_segment): Set only_if_ref true for "end".
12847
12848 2009-11-06  Doug Kwan  <dougkwan@google.com>
12849
12850         * arm.cc (class Reloc_stub): Correct a comment.
12851         (Target_arm::Target_arm): Initialize arm_input_section_map_.
12852         (Target_arm::scan_section_for_stubs): New method declaration.
12853         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
12854         Change methods from private to protected.
12855         (Target_arm::do_may_relax): New method definition.
12856         (Target_arm::do_relax, Target_arm::group_sections,
12857         Target_arm::scan_reloc_for_stub,
12858         Target_arm::scan_reloc_section_for_stubs): New method declarations.
12859         (Target_arm::arm_input_section_map_): New data member declaration.
12860         (Target_arm::scan_reloc_for_stub,
12861         Target_arm::scan_reloc_section_for_stubs,
12862         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
12863         Target_arm::do_relax): New method definitions.
12864
12865 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
12866
12867         * configure.ac: Check for (struct stat)::st_mtim
12868         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
12869         * config.in: Regenerate.
12870         * configure: Regenerate.
12871
12872 2009-11-05  Ian Lance Taylor  <iant@google.com>
12873
12874         PR 10910
12875         * output.cc (Output_segment::add_output_section): Add missing
12876         return statement.
12877
12878 2009-11-04  Ian Lance Taylor  <iant@google.com>
12879
12880         PR 10880
12881         * object.h (class Object): Add is_needed and set_is_needed
12882         methods.  Add is_needed_ field.  Make bool fields into bitfields.
12883         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
12884         defined in a dynamic object and referenced by a regular object,
12885         set is_needed for the dynamic object.
12886         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
12887         if the file is marked with as_needed and it is not needed.
12888
12889 2009-11-04  Ian Lance Taylor  <iant@google.com>
12890
12891         PR 10887
12892         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
12893         tags if data is discarded by linker script.
12894         * i386.cc (Target_i386::do_finalize_sections): Likewise.
12895         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12896         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12897         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12898
12899 2009-11-04  Ian Lance Taylor  <iant@google.com>
12900
12901         * layout.cc (Layout::get_output_section): Add is_interp and
12902         is_dynamic_linker_section parameters.  Change all callers.
12903         (Layout::choose_output_section): Likewise.
12904         (Layout::make_output_section): Likewise.
12905         (Layout::add_output_section_data): Add is_dynamic_linker_section
12906         parameter.  Change all callers.
12907         * layout.h (class Layout): Update declarations.
12908         * output.h (class Output_section): Add is_interp, set_is_interp,
12909         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
12910         Add is_interp_, is_dynamic_linker_section_ fields.  Change
12911         generate_code_fills_at_write_ to a bitfield.
12912         * output.cc (Output_section::Output_sections): Initialize new
12913         fields.
12914         (Output_segment::add_output_section): Add do_sort parameter.
12915         Change all callers.
12916
12917 2009-11-03  Ian Lance Taylor  <iant@google.com>
12918
12919         PR 10860
12920         * options.h (class General_options): Add --warn-common.
12921         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
12922         merging two common symbols.
12923         (Symbol_table::should_override): Handle --warn-common when merging
12924         a common symbol with a defined symbol.  Use report_resolve_problem
12925         for multiple definitions.
12926         (Symbol_table::report_resolve_problem): New function.
12927         * symtab.h (class Symbol_table): Declare report_resolve_problem.
12928
12929 2009-11-03  Doug Kwan  <dougkwan@google.com>
12930
12931         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
12932         stub_factory_.
12933         (Target_arm::stub_factory): New method definition.
12934         (Target_arm::new_arm_input_section,
12935         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
12936         Target_arm::reloc_uses_thumb_bit): New method declarations.
12937         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
12938         New type definitions.
12939         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
12940         member declarations.
12941         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
12942         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
12943         New method definitions.
12944
12945 2009-11-03  Ian Lance Taylor  <iant@google.com>
12946
12947         * options.h (class General_options): Add --warn_constructors.
12948
12949 2009-11-03  Ian Lance Taylor  <iant@google.com>
12950
12951         PR 10893
12952         * defstd.cc (in_section): Add entries for __rel_iplt_start,
12953         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
12954
12955 2009-11-03  Ian Lance Taylor  <iant@google.com>
12956
12957         PR 10895
12958         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
12959         --msgid-bugs-address.
12960         (install-pdf): New target.
12961         (install-data_yes): Look up one directory to find mkinstalldirs.
12962
12963 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
12964
12965         * po/Make-in (.po.gmo): Don't generate .gmo files in source
12966         tree.
12967
12968 2009-10-30  Doug Kwan  <dougkwan@google.com>
12969
12970         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
12971
12972 2009-10-30  Doug Kwan  <dougkwan@google.com>
12973
12974         * arm.cc (Stub_addend_reader): New struct template definition
12975         and partial specializations.
12976         (Stub_addend_reader::operator()): New method definition for a
12977         partially specialized template.
12978
12979 2009-10-30  Doug Kwan  <dougkwan@google.com>
12980
12981         * arm.cc (Arm_relobj::processor_specific_flags): New method
12982         definition.
12983         (Arm_relobj::do_read_symbols): New method declaration.
12984         (Arm_relobj::processor_specific_flags_): New data member declaration.
12985         (Arm_dynobj): New class definition.
12986         (Target_arm::do_finalize_sections): Add input_objects parameter.
12987         (Target_arm::do_adjust_elf_header): New method declaration.
12988         (Target_arm::are_eabi_versions_compatible,
12989         (Target_arm::merge_processor_specific_flags): New method declaration.
12990         (Target_arm::do_make_elf_object): New overloaded method definitions
12991         and declaration.
12992         (Arm_relobj::do_read_symbols): New method definition.
12993         (Arm_dynobj::do_read_symbols): Ditto.
12994         (Target_arm::do_finalize_sections): Add input_objects parameters.
12995         Merge processor-specific flags from all input objects.
12996         (Target_arm::are_eabi_versions_compatible,
12997         Target_arm::merge_processor_specific_flags,
12998         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
12999         New method definitions.
13000         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
13001         Input_objects pointer type parameter.
13002         * layout.cc (Layout::finalize): Pass input objects to target's.
13003         finalize_sections function.
13004         * output.cc (Output_file_header::do_sized_write): Set ELF file
13005         header's processor-specific flags.
13006         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
13007         Input_objects pointer type parameter.
13008         * sparc.cc (Target_sparc::do_finalize_sections): Same.
13009         * target.h (Input_objects): New forward class declaration.
13010         (Target::processor_specific_flags,
13011         Target::are_processor_specific_flags_sect): New method definitions.
13012         (Target::finalize_sections): Add input_objects parameter.
13013         (Target::Target): Initialize processor_specific_flags_ and
13014         are_processor_specific_flags_set_.
13015         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
13016         parameter.
13017         (Target::set_processor_specific_flags): New method definition.
13018         (Target::processor_specific_flags_,
13019         Target::are_processor_specific_flags_set_): New data member
13020         declarations.
13021         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
13022         Input_objects pointer type parameter.
13023
13024 2009-10-30  Doug Kwan  <dougkwan@google.com>
13025
13026         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
13027
13028 2009-10-28  Ian Lance Taylor  <iant@google.com>
13029
13030         * object.h (class Relobj): Drop options parameter from
13031         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
13032         do_scan_relocs, do_relocate.  Change all callers.
13033         (class Sized_relobj): Drop options parameters from
13034         do_gc_process_relocs, do_scan_relocs, do_relocate,
13035         do_relocate_sections, relocate_sections, emit_relocs_scan,
13036         emit_relocs_scan_reltype.  Change all callers.
13037         (struct Relocate_info): Remove options field and all references to
13038         it.
13039         * reloc.h (class Read_relocs): Remove options constructor
13040         parameter and options_ field.  Change all callers.
13041         (class Gc_process_relocs, class Scan_relocs): Likewise.
13042         (class Relocate_task): Likewise.
13043         * target-reloc.h (scan_relocs): Remove options parameter.  Change
13044         all callers.
13045         (scan_relocatable_relocs): Likewise.
13046         * target.h (class Sized_target): Remove options parameter from
13047         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
13048         all callers.
13049         * gc.h (gc_process_relocs): Remove options parameter.  Change all
13050         callers.
13051         * arm.cc: Update functions to remove options parameters.
13052         * i386.cc: Likewise.
13053         * powerpc.cc: Likewise.
13054         * sparc.cc: Likewise.
13055         * x86_64.cc: Likewise.
13056         * testsuite/testfile.cc: Likewise.
13057
13058 2009-10-28  Doug Kwan  <dougkwan@google.com>
13059
13060         * arm.cc (Arm_relobj): New class definition.
13061         (Arm_relobj::scan_sections_for_stubs,
13062         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
13063         New method definitions.
13064
13065 2009-10-28  Cary Coutant  <ccoutant@google.com>
13066
13067         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
13068         (Plugin::cleanup_done_): New member.
13069         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
13070         (Plugin_manager::cleanup_done_): Remove.
13071         (Plugin_manager::add_input_file): Edit error message.
13072         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
13073         (Plugin_manager::cleanup): Remove use of cleanup_done_.
13074
13075 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
13076
13077         * fileread.cc: (File_read::View::~View): Use the new
13078         data_ownership_ filed.
13079         (File_read::~File_read): Dispose the new whole_file_view_.
13080         (File_read::open): Mmap the whole file if needed.
13081         (File_read::open): Use whole_file_view_ instead of contents_.
13082         (File_read::find_view): Use whole_file_view_ if applicable.
13083         (File_read::do_read): Use whole_file_view_ instead of contents_.
13084         (File_read::make_view): Use whole_file_view_ instead of contents_,
13085         update File_read::View::View call.
13086         (File_read::find_or_make_view): Update File_read::View::View
13087         call.
13088         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
13089         remove contents_
13090         (File_read::View::Data_ownership): New enum.
13091         (File_read::View::View): Replace bool mapped_ with Data_ownership
13092         argument.
13093         (File_read::View::mapped_): Remove (replaced by data_ownership_).
13094         (File_read::View::data_ownership_): New field.
13095         (File_read::contents_): Remove (replaced by whole_file_view_).
13096         (File_read::whole_file_view_): New field.
13097         * options.h (class General_options): Add --keep-files-mapped.
13098
13099 2009-10-27  Cary Coutant  <ccoutant@google.com>
13100
13101         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
13102         * testsuite/Makefile.am (plugin_test_5): New test case.
13103         * testsuite/Makefile.in: Regenerate.
13104
13105 2009-10-25  Doug Kwan  <dougkwan@google.com>
13106
13107         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
13108         from private to protected to allow access by child class.
13109         (Sized_relobj::do_relocate_sections): New method declaration.
13110         (Sized_relobj::relocate_sections): Virtualize.
13111         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
13112         Sized_relobj::relocate_sections.  Instantiate template explicitly
13113         for different target sizes and endianity.
13114
13115 2009-10-24  Doug Kwan  <dougkwan@google.com>
13116
13117         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
13118         (Arm_input_section::as_arm_input_section): New method.
13119         (Arm_output_section): New class definition.
13120         (Arm_output_section::create_stub_group,
13121         Arm_output_section::group_sections): New method definitions.
13122
13123 2009-10-22  Doug Kwan  <dougkwan@google.com>
13124
13125         * arm.cc (Arm_input_section): New class definition.
13126         (Arm_input_section::init, Arm_input_section:do_write,
13127         Arm_input_section::set_final_data_size,
13128         Arm_input_section::do_reset_address_and_file_offset): New method
13129         definitions.
13130
13131 2009-10-21  Doug Kwan  <dougkwan@google.com>
13132
13133         * arm.cc (Stub_table, Arm_input_section): New forward class
13134         declarations.
13135         (Stub_table): New class defintion.
13136         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
13137         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
13138         New method definition.
13139
13140 2009-10-21  Doug Kwan  <dougkwan@google.com>
13141
13142         * arm.cc: Update copyright comments.
13143         (Target_arm): New forward class template declaration.
13144         (Arm_address): New type.
13145         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
13146         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
13147         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
13148         constants.
13149         (Insn_template): Same.
13150         (DEF_STUBS): New macro.
13151         (Stub_type): New enum type.
13152         (Stub_template): New class definition.
13153         (Stub): Same.
13154         (Reloc_stub): Same.
13155         (Stub_factory): Same.
13156         (Target_arm::Target_arm): Initialize may_use_blx_ and
13157         should_force_pic_veneer_.
13158         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
13159         Target_arm::should_force_pic_veneer,
13160         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
13161         Target_arm::using_thumb_only, Target_arm:;default_target): New
13162         method defintions.
13163         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
13164         New data member declarations.
13165         (Insn_template::size, Insn_template::alignment): New method defintions.
13166         (Stub_template::Stub_template): New method definition.
13167         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
13168         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
13169         (Stub_factory::Stub_factory): New method definition.
13170         * gold.h (string_hash): New template.
13171         * output.h (Input_section_specifier::hash_value): Use
13172         gold::string_hash.
13173         (Input_section_specifier::string_hash): Remove.
13174         * stringpool.cc (Stringpool_template::string_hash): Use
13175         gold::string_hash.
13176
13177 2009-10-20  Doug Kwan  <dougkwan@google.com>
13178
13179         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
13180         symbols of relaxed input sections.
13181         * output.h (Output_section::find_relaxed_input_section): Make
13182         method public.
13183
13184 2009-10-16  Doug Kwan  <dougkwan@google.com>
13185
13186         * dynobj.cc (Versions::Versions): Initialize version_script_.
13187         Only insert base version symbol definition for a shared object
13188         if version script defines any version versions.
13189         (Versions::define_base_version): New method definition.
13190         (Versions::add_def): Check that base version is not needed.
13191         (Versions::add_need): Define base version lazily.
13192         * dynobj.h (Versions::define_base_version): New method declaration.
13193         (Versions::needs_base_version_): New data member declaration.
13194         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
13195         (check_DATA): Add no_version_test.stdout.
13196         (libno_version_test.so, no_version_test.o no_version_test.stdout):
13197         New make rules.
13198         * testsuite/Makefile.in: Regenerate.
13199         * testsuite/no_version_test.c: New file.
13200         * testsuite/no_version_test.sh: Ditto.
13201
13202 2009-10-16  Doug Kwan  <dougkwan@google.com>
13203
13204         * expression.cc (class Segment_start_expression): New class definition.
13205         (Segment_start_expression::value): New method definition.
13206         (script_exp_function_segment_start): Return a new
13207         Segment_start_expression.
13208         * gold/script-c.h (script_saw_segment_start_expression): New function
13209         prototype.
13210         * script-sections.cc (Script_sections::Script_sections): Initialize
13211         SAW_SEGMENT_START_EXPRESSION_ to false.
13212         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
13213         and -Tbbs options to specify section addresses if given in
13214         command line and no SEGMENT_START expression is seen in a script.
13215         * script-sections.h (Script_sections::saw_segment_start_expression,
13216         Script_sections::set_saw_segment_start_expression): New method
13217         definition.
13218         (Script_sections::saw_segment_start_expression_): New data member
13219         declaration.
13220         * script.cc (script_saw_segment_start_expression): New function.
13221         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
13222         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
13223         script_test_7.sh and script_test_8.sh.
13224         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
13225         script_test_8.stdout.
13226         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
13227         (script_test_6, script_test_6.stdout, script_test_7,
13228         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
13229         * Makefile.in: Regenerate.
13230         * testsuite/script_test_6.sh: New file.
13231         * testsuite/script_test_6.t: Same.
13232         * testsuite/script_test_7.sh: Same.
13233         * testsuite/script_test_7.t: Same.
13234         * testsuite/script_test_8.sh: Same.
13235
13236 2009-10-16  Doug Kwan  <dougkwan@google.com>
13237
13238         * output.cc (Output_segment::set_section_list_address): Cast
13239         expressions to unsigned long long type to avoid format warnings.
13240
13241 2009-10-15  Ian Lance Taylor  <iant@google.com>
13242
13243         * script.cc (Script_options::add_symbol_assignment): Always add a
13244         dot assignment to script_sections_.
13245         * script-sections.cc (Script_sections::add_dot_assignment):
13246         Initialize if necessary.
13247
13248         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
13249         program headers with no load segment if there is a linker script.
13250
13251         * layout.cc (Layout::set_segment_offsets): Align the file offset
13252         to the segment aligment for -N or -n with no load segment.
13253         * output.cc (Output_segment::add_output_section): Don't crash if
13254         the first section is a TLS section.
13255         (Output_segment::set_section_list_addresses): Print an error
13256         message if the address moves backward in a linker script.
13257         * script-sections.cc
13258         (Output_section_element_input::set_section_addresses): Don't
13259         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
13260         (Orphan_output_section::set_section_addresses): Likewise.
13261
13262 2009-10-15  Doug Kwan  <dougkwan@google.com>
13263
13264         * layout.cc (Layout::finish_dynamic_section): Generate tags
13265         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
13266         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
13267         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
13268
13269 2009-10-14  Ian Lance Taylor  <iant@google.com>
13270
13271         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
13272         fields.
13273         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
13274         data_shdr fields of relinfo.
13275         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
13276         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
13277         R_386_TLS_LDO_32, adjust based on section flags.
13278         (Target_i386::Relocate::fix_up_ldo): Remove.
13279
13280 2009-10-13  Ian Lance Taylor  <iant@google.com>
13281
13282         Add support for -pie.
13283         * options.h (class General_options): Add -pie and
13284         --pic-executable.
13285         (General_options::output_is_position_independent): Test -pie.
13286         (General_options::output_is_executable): Return true if not shared
13287         and not relocatable.
13288         (General_options::output_is_pie): Remove.
13289         * options.cc (General_options::finalize): Reject incompatible uses
13290         of -pie.
13291         * gold.cc (queue_middle_tasks): A -pie link is not static.
13292         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
13293         * symtab.cc (Symbol::final_value_is_known): Return false if
13294         output_is_position_independent.
13295         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
13296         output_is_position_independent.
13297         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
13298         output_is_position_independent.
13299         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
13300         output_is_position_independent.
13301         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
13302         two_file_pie_test.
13303         (basic_pie_test.o, basic_pie_test): New targets.
13304         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
13305         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
13306         (two_file_pie_test): New target.
13307         * testsuite/Makefile.in: Rebuild.
13308         * README: Remove note saying that -pie is not supported.
13309
13310 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
13311
13312         * options.h (class General_options): Add -init and -fini.
13313         * layout.cc (Layout::finish_dynamic_section): Emit
13314         given init and fini functions.
13315
13316 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
13317
13318         * gc.h (gc_process_relocs): Check if icf is enabled using new
13319         function.
13320         * gold.cc (queue_initial_tasks): Likewise.
13321         (queue_middle_tasks): Likewise.
13322         * object.cc (do_layout): Likewise.
13323         * symtab.cc (is_section_folded): Likewise.
13324         * main.cc (main): Likewise.
13325         * reloc.cc (Read_relocs::run): Likewise.
13326         (Sized_relobj::do_scan_relocs): Likewise.
13327         * icf.cc (is_function_ctor_or_dtor): New function.
13328         (Icf::find_identical_sections): Check if function is ctor or dtor when
13329         safe icf is chosen.
13330         * options.h (General_options::icf): Change option to be an enum.
13331         (Icf_status): New enum.
13332         (icf_enabled): New method.
13333         (icf_safe_folding): New method.
13334         (set_icf_status): New method.
13335         (icf_status_): New variable.
13336         * (options.cc) (General_options::finalize): Set icf_status_.
13337         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
13338         icf_test and icf_keep_unique_test to use the --icf enum flag.
13339         * testsuite/icf_safe_test.sh: New file.
13340         * testsuite/icf_safe_test.cc: New file.
13341
13342 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
13343
13344         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
13345         includes to gc.h and icf.h.
13346         * arm.cc: Include gc.h.
13347         * gold.cc: Likewise.
13348         * i386.cc: Likewise.
13349         * powerpc.cc: Likewise.
13350         * sparc.cc: Likewise.
13351         * x86_64.cc: Likewise.
13352         * gc.h: Include icf.h.
13353
13354 2009-10-11  Ian Lance Taylor  <iant@google.com>
13355
13356         * plugin.cc: Include "gold.h" before other header files.
13357
13358 2009-10-10  Chris Demetriou  <cgd@google.com>
13359
13360         * options.h (Input_file_argument::Input_file_type): New enum.
13361         (Input_file_argument::is_lib_): Replace with...
13362         (Input_file_argument::type_): New member.
13363         (Input_file_argument::Input_file_argument): Take Input_file_type
13364         'type' rather than boolean 'is_lib' as second argument.
13365         (Input_file_argument::is_lib): Use type_.
13366         (Input_file_argument::is_searched_file): New function.
13367         (Input_file_argument::may_need_search): Handle is_searched_file.
13368         * options.cc (General_options::parse_library): Support -l:filename.
13369         (General_options::parse_just_symbols): Update for Input_file_argument
13370         changes.
13371         (Command_line::process): Likewise.
13372         * archive.cc (Archive::get_file_and_offset): Likewise.
13373         * plugin.cc (Plugin_manager::release_input_file): Likewise.
13374         * script.cc (read_script_file, script_add_file): Likewise.
13375         * fileread.cc (Input_file::Input_file): Likewise.
13376         (Input_file::will_search_for): Handle is_searched_file.
13377         (Input_file::open): Likewise.
13378         * readsyms.cc (Read_symbols::get_name): Likewise.
13379         * testsuite/Makefile.am (searched_file_test): New test.
13380         * testsuite/Makefile.in: Regenerate.
13381         * testsuite/searched_file_test.cc: New file.
13382         * testsuite/searched_file_test_lib.cc: New file.
13383
13384 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13385             Ian Lance Taylor  <iant@google.com>
13386
13387         * descriptor.cc: Include <cstdio> and "binary-io.h".
13388         (Descriptors::open): Open the files in binary mode always.
13389         * script.cc (Lex::get_token): Treat \r as whitespace.
13390
13391 2009-10-09  Ian Lance Taylor  <iant@google.com>
13392
13393         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
13394
13395 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13396             Ian Lance Taylor  <iant@google.com>
13397
13398         * configure.ac: Check for readv function also.
13399         * fileread.cc (readv): Define if not HAVE_READV.
13400         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
13401         does not exist.
13402         * config.in: Regenerate.
13403         * configure: Regenerate.
13404
13405 2009-10-09  Doug Kwan  <dougkwan@google.com>
13406
13407         * layout.cc (Layout::make_output_section): Call target hook to make
13408         ordinary output section.
13409         (Layout::finalize): Adjust parameter list of call the
13410         Target::may_relax().
13411         * layout.h (class Layout::section_list): New method.
13412         * merge.h (Output_merge_base::entsize): Change visibility to public.
13413         (Output_merge_base::is_string, Output_merge_base::do_is_string):
13414         New methods.
13415         (Output_merge_string::do_is_string): New method.
13416         * object.cc (Sized_relobj::do_setup): renamed from
13417         Sized_relobj::set_up.
13418         * object.h (Sized_relobj::adjust_shndx,
13419         Sized_relobj::initializ_input_to_output_maps,
13420         Sized_relobj::free_input_to_output_maps): Change visibilities to
13421         protected.
13422         (Sized_relobj::setup): Virtualize.
13423         (Sized_relobj::do_setup): New method declaration.
13424         (Sized_relobj::invalidate_section_offset,
13425         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
13426         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
13427         * options.cc (parse_int): New function.
13428         * options.h (parse_int): New declaration.
13429         (DEFINE_int): New macro.
13430         (stub_group_size): New option.
13431         * output.cc (Output_section::Output_section): Initialize memebers
13432         merge_section_map_, merge_section_by_properties_map_,
13433         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
13434         (Output_section::add_input_section): Handled deferred code-fill
13435         generation and remove an old comment.
13436         (Output_section::add_relaxed_input_section): New method definition.
13437         (Output_section::add_merge_input_section): Use merge section by
13438         properties map to speed to search.  Update merge section maps
13439         as appropriate.
13440         (Output_section::build_relaxation_map): New method definition.
13441         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
13442         Same.
13443         (Output_section::relax_input_section): Renamed to
13444         Output_section::convert_input_sections_to_relaxed_sections and change
13445         interface to take a vector of pointers to relaxed sections.
13446         (Output_section::find_merge_section,
13447         Output_section::find_relaxed_input_section): New method definitions.
13448         (Output_section::is_input_address_mapped,
13449         Output_section::output_offset, Output_section::output_address):
13450         Use output section data maps to speed up searching.
13451         (Output_section::find_starting_output_address): Add comments.
13452         (Output_section::do_write,
13453         Output_section::write_to_postprocessing_buffer): Do code-fill
13454         generation as appropriate.
13455         (Output_section::get_input_sections): Invalidate relaxed input section
13456         map.
13457         (Output_section::restore_states): Adjust type of checkpoint .
13458         Invalidate relaxed input section map.
13459         * output.h (Output_merge_base): New class declaration.
13460         (Input_section_specifier): New class defintion.
13461         (class Output_relaxed_input_section) Change base class to
13462         Output_section_data_build.
13463         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
13464         base class initializer.
13465         (Output_section::add_relaxed_input_section): New method declaration.
13466         (Output_section::Input_section): Change visibility to protected.
13467         (Output_section::Input_section::relobj,
13468         Output_section::Input_section::shndx): Handle relaxed input sections.
13469         Output_section::input_sections) Change visibility to protected.  Also
13470         define overload to return a non-const pointer.
13471         (Output_section::Merge_section_properties): New class defintion.
13472         (Output_section::Merge_section_by_properties_map,
13473         Output_section::Output_section_data_by_input_section_map,
13474         Output_section::Relaxation_map): New types.
13475         (Output_section::relax_input_section): Rename method to
13476         Output_section::convert_input_sections_to_relaxed_sections and change
13477         interface to take a vector of relaxed section pointers.
13478         (Output_section::find_merge_section,
13479         Output_section::find_relaxed_input_section,
13480         Output_section::build_relaxation_map,
13481         Output_section::convert_input_sections_in_list_to_relaxed_sections):
13482         New method declarations.
13483         (Output_section::merge_section_map_
13484         Output_section::merge_section_by_properties_map_,
13485         Output_section::relaxed_input_section_map_,
13486         Output_section::is_relaxed_input_section_map_valid_,
13487         Output_section::generate_code_fills_at_write_): New data members.
13488         * script-sections.cc
13489         (Output_section_element_input::set_section_addresses): Call
13490         current_data_size and addralign methods of relaxed input sections.
13491         (Orphan_output_section::set_section_addresses): Call current_data_size
13492         and addralign methods of relaxed input sections.
13493         * symtab.cc (Symbol_table::compute_final_value): Extract template
13494         from the body of Symbol_table::sized_finalize_symbol.
13495         (Symbol_table::sized_finalized_symbol): Call
13496         Symbol_table::compute_final_value.
13497         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
13498         (Symbol_table::compute_final_value): New templated method declaration.
13499         * target.cc (Target::do_make_output_section): New method defintion.
13500         * target.h (Target::make_output_section): New method declaration.
13501         (Target::relax): Add more parameters for input objects, symbol table
13502         and layout.  Adjust call to do_relax.
13503         (Target::do_make_output_section): New method declaration.
13504         (Target::do_relax): Add parameters for input objects, symbol table
13505         and layout.
13506
13507 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13508
13509         * pread.c: Include stdio.h.
13510
13511 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13512
13513         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
13514         defined.
13515
13516 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13517
13518         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
13519         Change read_shndx type to unsigned int.
13520         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13521         int.
13522         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13523         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
13524         Change read_shndx type to unsigned int.
13525         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13526         int.
13527         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13528         * layout.cc (Layout::create_symtab_sections): Cast the result of
13529         local_symcount * symsize to off_t in the gold_assert.
13530
13531 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13532
13533         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
13534         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
13535         R_ARM_BASE_ABS.
13536         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
13537         (Arm_relocate_functions::thm_abs5): New function.
13538         (Arm_relocate_functions::abs12): New function.
13539         (Arm_relocate_functions::abs16): New function.
13540         (Arm_relocate_functions::base_abs): New function.
13541         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
13542         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
13543         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
13544         R_ARM_BASE_ABS.
13545         (Scan::global): Likewise.
13546         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
13547         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
13548         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
13549         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
13550         R_ARM_BASE_ABS.
13551
13552 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13553
13554         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
13555         (Arm_relocate_functions::movt_prel): New function.
13556         (Arm_relocate_functions::thm_movw_prel_nc): New function.
13557         (Arm_relocate_functions::thm_movt_prel): New function.
13558         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
13559         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
13560         (Scan::global, Relocate::relocate): Likewise.
13561         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13562
13563 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13564
13565         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
13566         Incremental_checker.
13567         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
13568         unsigned int.
13569         (class Incremental_inputs_header): New class.
13570         (Incremental_inputs_header_writer): Edit comment.
13571         (Incremental_inputs_entry): New class.
13572         (Incremental_inputs_entry_writer): Edit comment.
13573         (Sized_incremental_binary::do_find_incremental_inputs_section):
13574         Add *strtab_shndx parameter, fill it.
13575         (Sized_incremental_binary::do_check_inputs): New method.
13576         (Incremental_checker::can_incrementally_link_output_file): Use
13577         Sized_incremental_binary::check_inputs.
13578         (Incremental_inputs::report_command_line): Save command line in
13579         command_line_.
13580         * incremental.h:
13581         (Incremental_binary::find_incremental_inputs_section): New
13582         method.
13583         (Incremental_binary::do_find_incremental_inputs_section): Add
13584         strtab_shndx parameter.
13585         (Incremental_binary::do_check_inputs): New pure virtual method.
13586         (Sized_incremental_binary::do_check_inputs): Declare.
13587         (Incremental_checker::Incremental_checker): Add incremental_inputs
13588         parameter, use it to initialize incremental_inputs_.
13589         (Incremental_checker::incremental_inputs_): New field.
13590         (Incremental_checker::command_line): New method.
13591         (Incremental_checker::inputs): New method.
13592         (Incremental_checker::command_line_): New field.
13593
13594 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13595
13596         * incremental.cc: Include <cstdarg> and "target-select.h".
13597         (vexplain_no_incremental): New function.
13598         (explain_no_incremental): New function.
13599         (Incremental_binary::error): New method.
13600         (Sized_incremental_binary::do_find_incremental_inputs_section): New
13601         method.
13602         (make_sized_incremental_binary): New function.
13603         (open_incremental_binary): New function.
13604         (can_incrementally_link_file): Add checks if output is ELF and has
13605         inputs section.
13606         * incremental.h: Include "elfcpp_file.h" and "output.h".
13607         (Incremental_binary): New class.
13608         (Sized_incremental_binary): New class.
13609         (open_incremental_binary): Declare.
13610         * object.cc (is_elf_object): Use
13611         elfcpp::Elf_recognizer::is_elf_file.
13612         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
13613         * output.h (Output_file::filesize): New method.
13614
13615 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13616
13617         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
13618         New function.
13619         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
13620         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
13621         function.
13622         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
13623         function.
13624         (Arm_relocate_functions::movw_abs_nc): New function.
13625         (Arm_relocate_functions::movt_abs): New function.
13626         (Arm_relocate_functions::thm_movw_abs_nc): New function.
13627         (Arm_relocate_functions::thm_movt_abs): New function.
13628         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
13629         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
13630         (Scan::global): Likewise.
13631         (Relocate::relocate): Likewise.
13632         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13633
13634 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13635
13636         * arm.cc (Arm_relocate_functions::got_prel) New function.
13637         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
13638         (Relocate::relocate): Likewise.
13639         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13640
13641 2009-10-06  Ian Lance Taylor  <iant@google.com>
13642
13643         * options.h (class General_options): Define
13644         split_stack_adjust_size parameter.
13645         * object.h (class Object): Add uses_split_stack_ and
13646         has_no_split_stack_ fields.  Add uses_split_stack and
13647         has_no_split_stack accessor functions.  Declare
13648         handle_split_stack_section.
13649         (class Reloc_symbol_changes): Define.
13650         (class Sized_relobj): Define Function_offsets.  Declare
13651         split_stack_adjust, split_stack_adjust_reltype, and
13652         find_functions.
13653         * object.cc (Object::handle_split_stack_section): New function.
13654         (Sized_relobj::do_layout): Call handle_split_stack_section.
13655         * dynobj.cc (Sized_dynobj::do_layout): Call
13656         handle_split_stack_section.
13657         * reloc.cc (Sized_relobj::relocate_sections): Call
13658         split_stack_adjust for executable sections in split_stack
13659         objects.  Pass reloc_map to relocate_section.
13660         (Sized_relobj::split_stack_adjust): New function.
13661         (Sized_relobj::split_stack_adjust_reltype): New function.
13662         (Sized_relobj::find_functions): New function.
13663         * target-reloc.h: Include "object.h".
13664         (relocate_section): Add reloc_symbol_changes parameter.  Change
13665         all callers.
13666         * target.h (class Target): Add calls_non_split method.  Declare
13667         do_calls_non_split virtual method.  Declare match_view and
13668         set_view_to_nop.
13669         * target.cc: Include "elfcpp.h".
13670         (Target::do_calls_non_split): New function.
13671         (Target::match_view): New function.
13672         (Target::set_view_to_nop): New function.
13673         * gold.cc (queue_middle_tasks): Give an error if mixing
13674         split-stack and non-split-stack objects with -r.
13675         * i386.cc (Target_i386::relocate_section): Add
13676         reloc_symbol_changes parameter.
13677         (Target_i386::do_calls_non_split): New function.
13678         * x86_64.cc (Target_x86_64::relocate_section): Add
13679         reloc_symbol_changes parameter.
13680         (Target_x86_64::do_calls_non_split): New function.
13681         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
13682         parameter.
13683         * powerpc.cc (Target_powerpc::relocate_section): Add
13684         reloc_symbol_changes parameter.
13685         * sparc.cc (Target_sparc::relocate_section): Add
13686         reloc_symbol_changes parameter.
13687         * configure.ac: Call AM_CONDITIONAL for the default target.
13688         * configure: Rebuild.
13689         * testsuite/Makefile.am (TEST_AS): New variable.
13690         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
13691         (check_DATA): Add split_i386 and split_x86_64 files.
13692         (SPLIT_DEFSYMS): Define.
13693         (split_i386_[1234n].o): New targets.
13694         (split_i386_[124]): New targets.
13695         (split_i386_[1234r].stdout): New targets.
13696         (split_x86_64_[1234n].o): New targets.
13697         (split_x86_64_[124]): New targets.
13698         (split_x86_64_[1234r].stdout): New targets.
13699         (MOSTLYCLEANFILES): Add new executables.
13700         * testsuite/split_i386.sh: New file.
13701         * testsuite/split_x86_64.sh: New file.
13702         * testsuite/split_i386_1.s: New file.
13703         * testsuite/split_i386_2.s: New file.
13704         * testsuite/split_i386_3.s: New file.
13705         * testsuite/split_i386_4.s: New file.
13706         * testsuite/split_i386_n.s: New file.
13707         * testsuite/split_x86_64_1.s: New file.
13708         * testsuite/split_x86_64_2.s: New file.
13709         * testsuite/split_x86_64_3.s: New file.
13710         * testsuite/split_x86_64_4.s: New file.
13711         * testsuite/split_x86_64_n.s: New file.
13712         * testsuite/testfile.cc (Target_test): Update relocation_section
13713         function.
13714         * testsuite/Makefile.in: Rebuild.
13715
13716 2009-10-06  Ian Lance Taylor  <iant@google.com>
13717
13718         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
13719         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
13720         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
13721         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
13722         the address on ldo_addrs_.
13723         (Target_i386::Relocate::fix_up_ldo): New function.
13724
13725 2009-10-06   Rafael Espindola  <espindola@google.com>
13726
13727         * plugin.cc (add_input_library): New.
13728         (Plugin::load): Add add_input_library to tv.
13729         (Plugin_manager::add_input_file): Add the is_lib argument.
13730         (add_input_file): Update call to Plugin_manager::add_input_file.
13731         (add_input_library): New.
13732         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
13733
13734 2009-09-30  Doug Kwan  <dougkwan@google.com>
13735
13736         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
13737         symbol and call Symbol::may_need_copy_reloc to determine if
13738         a copy reloc is needed.
13739         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
13740         nocopyreloc is given in command line.
13741         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
13742         given in command line.
13743         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
13744         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
13745         of the removed Target_i386::may_need_copy_reloc.
13746         * options.h (copyreloc): New option with default value false.
13747         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13748         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
13749         instead of the removed Target_powerpc::may_need_copy_reloc.
13750         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13751         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
13752         instead of the removed Target_sparc::may_need_copy_reloc.
13753         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
13754         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
13755         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
13756         instead of the removed Target_x86_64::may_need_copy_reloc.
13757
13758 2009-09-30  Ian Lance Taylor  <iant@google.com>
13759
13760         * object.h (class Object): Remove target_ field, and target,
13761         sized_target, and set_target methods.
13762         (Object::sized_target): Remove.
13763         (class Sized_relobj): Update declarations.  Remove sized_target.
13764         * object.cc (Sized_relobj::setup): Remove target parameter.
13765         Change all callers.
13766         (Input_objects::add_object): Don't do anything with the target.
13767         (make_elf_sized_object): Add punconfigured parameter.  Change all
13768         callers.  Set or test parameter target.
13769         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
13770         Change all callers.
13771         * parameters.cc (Parameters::set_target): Change parameter type to
13772         be non-const.
13773         (Parameters::default_target): Remove.
13774         (set_parameters_target): Change parameter type to be non-const.
13775         (parameters_force_valid_target): New function.
13776         (parameters_clear_target): New function.
13777         * parameters.h (class Parameters): Update declarations.  Remove
13778         default_target method.  Add sized_target and clear_target
13779         methods.  Change target_ to be non-const.
13780         (set_parameters_target): Update declaration.
13781         (parameters_force_valid_target): Declare.
13782         (parameters_clear_target): Declare.
13783         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
13784         as NULL if we aren't searching.
13785         (Add_symbols::run): Don't check for compatible target.
13786         * fileread.cc (Input_file::open_binary): Call
13787         parameters_force_valid_target.
13788         * gold.cc (queue_middle_tasks): Likewise.
13789         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
13790         set_target on object.
13791         * dynobj.h (class Sized_dynobj): Update declarations.
13792         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
13793         make_elf_object returns NULL.
13794         (Archive::include_member): Don't check whether object target is
13795         compatible.
13796         * output.cc (Output_section::add_input_section): Get target from
13797         parameters.
13798         (Output_section::relax_input_section): Likewise.
13799         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
13800         parameters.
13801         (Sized_relobj::do_scan_relocs): Likewise.
13802         (Sized_relobj::relocate_sections): Likewise.
13803         * resolve.cc (Symbol_table::resolve): Likewise.
13804         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
13805         parameter.  Change all callers.
13806         (Symbol_table::add_from_object): Get target from parameters.
13807         (Symbol_table::add_from_relobj): Don't check object target.
13808         (Symbol_table::add_from_dynobj): Likewise.
13809         (Symbol_table::define_special_symbol): Get target from
13810         parameters.
13811         * symtab.h (class Symbol_table): Update declaration.
13812         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
13813         parameter.  Change all callers.  Clear parameter target.
13814         (Binary_test): Test target here.
13815         * testsuite/object_unittest.cc (gold_testsuite): Remove
13816         target_test_pointer parameter.  Change all callers.
13817         (Object_test): Test target here.
13818
13819 2009-09-26  Ian Lance Taylor  <iant@google.com>
13820
13821         * testsuite/initpri1.c: Don't try to use constructor priorities if
13822         compiling with gcc before 4.3.
13823
13824 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
13825
13826         * testsuite/retain_symbols_file_test.sh (check_present): Change
13827         output file name to retain_symbols_file_test.stdout.
13828         (check_absent): Likewise.
13829
13830 2009-09-18  Craig Silverstein  <csilvers@google.com>
13831
13832         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
13833         * options.cc: Include <cerrno> and <fstream>.
13834         (General_options::finalize): Parse -retain-symbols-file tag.
13835         * options.h: New flag.
13836         (General_options): New method should_retain_symbol, new
13837         variable symbols_to_retain.
13838         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
13839         should_retain_symbol map.
13840         * testsuite/Makefile.am (retain_symbols_file_test): New test.
13841         * testsuite/Makefile.in: Regenerate.
13842         * testsuite/retain_symbols_file_test.sh: New file.
13843
13844 2009-09-18  Nick Clifton  <nickc@redhat.com>
13845
13846         * po/es.po: Updated Spanish translation.
13847
13848 2009-09-17  Doug Kwan  <dougkwan@google.com>
13849
13850         * debug.h (DEBUG_RELAXATION): New constant.
13851         (DEBUG_ALL): Add DEBUG_RELAXATION.
13852         (debug_string_to_enum): Add relaxation debug option.
13853         * layout.cc
13854         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
13855         Layout::Relaxation_debug_check::read_sections,
13856         Layout::Relaxation_debug_check::read_sections): New method definitions.
13857         (Layout::Layout): Initialize data members
13858         record_output_section_data_from_scrips_,
13859         script_output_section_data_list_ and relaxation_debug_check_.
13860         (Layout::save_segments, Layout::restore_segments,
13861         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13862         Layout::relaxation_loop_body): New method definitions.
13863         (Layout::finalize): Support relaxation.  Move section layout code to
13864         Layout::relaxation_loop_body.
13865         (Layout::set_asection_address_from_script): Move code for orphan
13866         section placement out.
13867         (Layout::place_orphan_sections_in_script): New method definition.
13868         * layout.h (Output_segment_headers, Output_file_header):
13869         New forward class declarations.
13870         (Layout::~Layout): Define.
13871         (Layout::new_output_section_data_from_script): New method definition.
13872         (Layout::place_orphan_sections_in_script): New method declaration.
13873         (Layout::Segment_states): New type declaration.
13874         (Layout::save_segments, Layout::restore_segments,
13875         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13876         Layout::relaxation_loop_body): New method declarations.
13877         (Layout::Output_section_data_list): New type declaration.
13878         (Layout::Relaxation_debug_check): New class definition.
13879         (Layout::record_output_section_data_from_script_,
13880         Layout::script_output_section_data_list_, Layout::segment_states_,
13881         Layout::relaxation_debug_check_): New data members.
13882         * output.cc: (Output_section_headers::do_size): New method definition.
13883         (Output_section_headers::Output_section_headers): Move size
13884         computation to Output_section_headers::do_size.
13885         (Output_segment_headers::do_size): New method definition.
13886         (Output_file_header::Output_file_header): Move size computation to
13887         Output_file_header::do_size and call it.
13888         (Output_file_header::do_size): New method definition.
13889         (Output_data_group::Output_data_group): Adjust call to
13890         Output_section_data.
13891         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
13892         (Output_symtab_xindex::do_write): Add array bound check.
13893         (Output_section::Input_section::print_to_mapfile): Handle
13894         RELAXED_INPUT_SECTION_CODE.
13895         (Output_section::Output_section): Initialize data member checkpoint_.
13896         (Output_section::~Output_section): Delete checkpoint object pointed
13897         by checkpoint_.
13898         (Output_section::add_input_section): Always add an Input_section if
13899         relaxing.
13900         (Output_section::add_merge_input_section): Add assert.
13901         (Output_section::relax_input_section): New method definition.
13902         (Output_section::set_final_data_size): Set load address to zero for
13903         an unallocated section.
13904         (Output_section::do_address_and_file_offset_have_reset_values):
13905         New method definition.
13906         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
13907         Handle relaxed input section.
13908         (Output_section::sort_attached_input_sections): Checkpoint input
13909         section list lazily.
13910         (Output_section::get_input_sections): Change type of input_sections to
13911         list of Simple_input_section pointers.  Checkpoint input section list
13912         lazily.  Also handle relaxed input sections.
13913         (Output_section::add_input_section_for_script): Take a reference to
13914         a Simple_input_section object instead of Relobj pointer and section
13915         index as parameter.  Handle relaxed input sections.
13916         (Output_section::save_states, Output_section::restore_states): New
13917         method definitions.
13918         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
13919         (Output_data::is_data_size_fixed): New method definition.
13920         (Output_data::reset_addresss_and_file_offset): Do not reset data size
13921         if it is fixed.
13922         (Output_data::address_and_file_offset_have_reset_values): New method
13923         definition.
13924         (Output_data::do_address_and_file_offset_have_reset_values): New method
13925         definition.
13926         (Output_data::set_data_size): Check that data size is not fixed.
13927         (Output_data::fix_data_size): New method definition.
13928         (Output_data::is_data_size_fixed_): New data member.
13929         (Output_section_headers::set_final_data_size): New method definition.
13930         (Output_section_headers::do_size): New method declaration.
13931         (Output_segment_headers::set_final_data_size): New method definition.
13932         (Output_segment_headers::do_size): New method declaration.
13933         (Output_file_header::set_final_data_size)::New method definition.
13934         (Output_file_header::do_size)::New method declaration.
13935         (Output_section_data::Output_section_data): Add new parameter
13936         is_data_size_fixed and use it to fix data size.
13937         (Output_data_const::Output_data_const): Adjust call to base class
13938         constructor and fix data size.
13939         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
13940         base class constructor and fix data size.
13941         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
13942         base class constructor and fix data size.
13943         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
13944         class constructor and fix data size.
13945         (Output_data_group::set_final_data_size): New method definition.
13946         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
13947         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
13948         class constructor and fix data size.
13949         (Output_relaxed_input_section): New class definition.
13950         (Output_section::Simple_input_section): New class definition.
13951         (Output_section::get_input_sections): Adjust parameter list.
13952         (Output_section::add_input_section_for_script): Same.
13953         (Output_section::save_states, Output_section::restore_states,
13954         Output_section::do_address_and_file_offset_have_reset_values,
13955         (Output_section::Input_section::Input_section): Handle
13956         RELAXED_INPUT_SECTION_CODE.  Add new overload for
13957         Output_relaxed_input_section.
13958         (Output_section::Input_section::is_input_section,
13959         Output_section::Input_section::set_output_section): Handle relaxed
13960         input section.
13961         (Output_section::Input_section::is_relaxed_input_section,
13962         Output_section::Input_section::output_section_data,
13963         Output_section::Input_section::relaxed_input_section): New method
13964         definitions.
13965         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
13966         value.
13967         (Output_section::Input_section::u1_): Update comments.
13968         (Output_section::Input_section::u2_): Add new union member poris.
13969         (Output_section::Checkpoint_output_section): New classs definition.
13970         (Output_section::relax_input_section): New method declaration.
13971         (Output_section::checkpoint_): New data member.
13972         (Output_segment): Update comments.
13973         (Output_segment::Output_segment): Un-privatize copy constructor.
13974         (Output_segment::operator=): Un-privatize.
13975         * script-sections.cc (Output_section_element::Input_section_list):
13976         Change element type to Output_section::Simple_input_section.
13977         (Output_section_element_dot_assignment::set_section_addresses):
13978         Register output section data for relaxation clean up.
13979         (Output_data_exression::Output_data_expression): Adjust call to base
13980         constructor to fix data size.
13981         (Output_section_element_data::set_section_addresses): Register
13982         Output_data_expression object for relaxation clean up.
13983         (struct Input_section_info): Replace Relobj pointer and section index
13984         pair with Output_section::Simple_input_section and Convert struct to a
13985         class.
13986         (Input_section_sorter::operator()): Adjust access to
13987         Input_section_info data member to use accessors.
13988         (Output_section_element_input::set_section_addresses): Use layout
13989         parameter.  Adjust code to use Output_section::Simple_input_section
13990         and Input_secction_info classes.  Register filler for relaxation
13991         clean up.
13992         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
13993         and section index pair with Output_section::Simple_input_section
13994         class.  Adjust code accordingly.
13995         (Phdrs_element::release_segment): New method definition.
13996         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
13997         segment list.
13998         (Script_sections::release_segments): New method definition.
13999         * gold/script-sections.h (Script_sections::release_segments): New
14000         method declaration.
14001         * gold/target.h (Target::may_relax, Target::relax,
14002         Target::do_may_relax, Target::do_relax): New method definitions.
14003
14004 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
14005
14006         * arm.cc (has_signed_unsigned_overflow): New function.
14007         (Arm_relocate_functions::abs8): New function.
14008         (Target_arm::Scan::local): Handle R_ARM_ABS8.
14009         (Target_arm::Scan::global): Likewise.
14010         (Target_arm::relocate::relocate): Likewise.
14011         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
14012         Likewise.
14013
14014 2009-09-16  Cary Coutant  <ccoutant@google.com>
14015
14016         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
14017         * testsuite/Makefile.in: Regenerate.
14018
14019 2009-09-11  Nick Clifton  <nickc@redhat.com>
14020
14021         * po/gold.pot: Updated by the Translation project.
14022
14023 2009-09-08  Cary Coutant  <ccoutant@google.com>
14024
14025         * output.cc (Output_file::open): Add execute permission to empty file.
14026         * testsuite/Makefile.am (permission_test): New test.
14027         * testsuite/Makefile.in: Regenerate.
14028
14029 2009-09-02  Ian Lance Taylor  <iant@google.com>
14030
14031         * output.cc (Output_file::resize): Call map_no_anonymous rather
14032         than map.
14033
14034 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
14035
14036         * gold.cc: Include "incremental.h".
14037         (queue_initial_tasks): Call Incremental_checker methods.
14038         * incremental.cc: Include "output.h".
14039         (Incremental_checker::can_incrementally_link_output_file): New
14040         method.
14041         * incremental.h (Incremental_checker): New class.
14042
14043         * output.cc (Output_file::open_for_modification): New method.
14044         (Output_file::map_anonymous): Changed return type to bool.  Record
14045         map in base_ field.
14046         (Output_file::map_no_anonymous): New method, broken out of map.
14047         (Output_file::map): Use map_no_anonymous and map_anonymous.
14048         * output.h (class Output_file): Update declarations.
14049
14050 2009-08-24  Cary Coutant  <ccoutant@google.com>
14051
14052         * options.h (Command_line::Pre_options): New class.
14053         (Command_line::pre_options): New member.
14054         * options.cc (gold::options::ready_to_register): New variable.
14055         (One_option::register_option): Do nothing if not registering options.
14056         Assert if same short option registered twice.
14057         (General_options::General_options): Turn off option registration when
14058         done constructing.
14059         (Command_line::Pre_options::Pre_options): New constructor.
14060
14061 2009-08-24  Cary Coutant  <ccoutant@google.com>
14062
14063         * options.h (General_options::no_keep_memory): Remove incorrect
14064         short option.
14065
14066 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
14067
14068         * Makefile.am (am__skiplex, am__skipyacc): New.
14069         * Makefile.in: Regenerate.
14070
14071 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
14072
14073         * Makefile.am (AM_CPPFLAGS): Renamed from ...
14074         (INCLUDES): ... this.
14075         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
14076         (AM_CPPFLAGS): Renamed from ...
14077         (INCLUDE): ... this.
14078         * Makefile.in, testsuite/Makefile.in: Regenerate.
14079
14080         * Makefile.in: Regenerate.
14081         * aclocal.m4: Likewise.
14082         * config.in: Likewise.
14083         * configure: Likewise.
14084         * testsuite/Makefile.in: Likewise.
14085
14086         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
14087         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
14088         * Makefile.in: Regenerate.
14089         * testsuite/Makefile.in: Regenerate.
14090
14091 2009-08-19  Cary Coutant  <ccoutant@google.com>
14092
14093         * resolve.cc (Symbol_table::resolve): Don't complain about defined
14094         symbols in shared libraries overridden by hidden or internal symbols
14095         in the main program.
14096
14097 2009-08-19  Chris Demetriou  <cgd@google.com>
14098
14099         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
14100         checking source file names in error messages.
14101
14102 2009-08-18  Doug Kwan  <dougkwan@google.com>
14103
14104         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
14105         an elcpp::Ehdr as parameter.  Adjust call to set_target.
14106         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
14107         an elfcpp::Ehdr as parameter.
14108         * object.cc (Object::set_target): Remove the version that looks up
14109         a target and sets it.
14110         (Sized_relobj::setup): Take a Target object instead of
14111         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
14112         (make_elf_sized_object): Find target and ask target to
14113         make an ELF object.
14114         * object.h: (Object::set_target): Remove the version that looks up
14115         a target and sets it.
14116         (Sized_relobj::setup): Take a Target object instead of
14117         an elfcpp:Ehdr as parameter.
14118         * target.cc: Include dynobj.h.
14119         (Target::do_make_elf_object_implementation): New.
14120         (Target::do_make_elf_object): New.
14121         * target.h (Target::make_elf_object): New template declaration.
14122         (Target::do_make_elf_object): New method declarations.
14123         (Target::do_make_elf_object_implementation): New template declaration.
14124
14125 2009-08-14  Ian Lance Taylor  <iant@google.com>
14126
14127         * gold.h (FUNCTION_NAME): Define.
14128         (gold_unreachable): Use FUNCTION_NAME.
14129
14130 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
14131
14132         * icf.cc (Icf::find_identical_sections): Issue a warning when a
14133         symbol in the --keep-unique list is not found.
14134
14135 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
14136
14137         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
14138         been maked as --keep-unique.
14139         (Icf::unfold_section): New function.
14140         * icf.h (Icf::unfold_section): New function.
14141         * options.h (General_options::keep_unique): New option.
14142         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
14143         * testsuite/Makefile.in: Regenerate.
14144         * testsuite/icf_keep_unique_test.sh: New file.
14145         * testsuite/icf_keep_unique_test.cc: New file.
14146
14147 2009-08-12  Cary Coutant  <ccoutant@google.com>
14148
14149         PR 10471
14150         * resolve.cc (Symbol_table::resolve): Check for references from
14151         dynamic objects to hidden and internal symbols.
14152         * testsuite/Makefile.am (hidden_test.sh): New test.
14153         * testsuite/Makefile.in: Regenerate.
14154         * testsuite/hidden_test.sh: New script.
14155         * testsuite/hidden_test_1.c: New test source.
14156         * testsuite/hidden_test_main.c: New test source.
14157
14158 2009-08-11  Doug Kwan  <dougkwan@google.com>
14159
14160         * arm.cc: Update comments.
14161         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
14162         segment to locate the .ARM.exidx section if present.
14163
14164 2009-08-09  Doug Kwan  <dougkwan@google.com>
14165
14166         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
14167         patch.
14168
14169 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
14170         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
14171         compiler warnings.
14172
14173 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
14174
14175         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
14176         valid tls_segment only for non-debug-section relocations.
14177         * testsuite/Makefile.am: Add gc_tls_test.
14178         * testsuite/Makefile.in: Regenerate.
14179         * testsuite/gc_tls_test.cc: New file.
14180         * testsuite/gc_tls_test.sh: New file.
14181
14182 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
14183
14184         * icf.cc: New file.
14185         * icf.h: New file.
14186         * Makefile.am (CCFILES): Add icf.cc.
14187         (HFILES): Add icf.h
14188         * Makefile.in: Regenerate.
14189         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
14190         * gc.h (gc_process_relocs): Populate lists used by icf to contain
14191         section, symbol and addend information for the relocs.
14192         * gold.cc (queue_middle_tasks): Call identical code folding.
14193         * gold.h: Add defines for multimap.
14194         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
14195         to the call of finalize_local_symbols.
14196         * main.cc (main): Create object of class Icf.
14197         * object.cc (Sized_relobj::do_layout): Allow this function to be
14198         called twice during icf.
14199         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
14200         to sections marked as identical by icf.
14201         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
14202         when available.
14203         (Sized_relobj::do_section_entsize): New function.
14204         * object.h (Object::section_entsize): New function.
14205         (Object::do_section_entsize): New pure virtual function.
14206         (Relobj::finalize_local_symbols): Add new parameter.
14207         (Relobj::do_section_entsize): New function.
14208         * options.h (General_options::icf): New option.
14209         (General_options::icf_iterations): New option.
14210         (General_options::print_icf_sections): New option.
14211         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
14212         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
14213         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
14214         icf.
14215         * symtab.cc (Symbol_table::is_section_folded): New function.
14216         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
14217         to sections marked as identical by icf.
14218         * symtab.h (Symbol_table::set_icf): New function.
14219         (Symbol_table::icf): New function.
14220         (Symbol_table::is_section_folded): New function.
14221         (Symbol_table::icf_): New data member.
14222         * target-reloc.h (relocate_section): Ignore sections folded by icf.
14223         * testsuite/Makefile.am: Add commands to build icf_test.
14224         * testsuite/Makefile.in: Regenerate.
14225         * testsuite/icf_test.sh: New file.
14226         * testsuite/icf_test.cc: New file.
14227
14228 2009-07-24  Chris Demetriou  <cgd@google.com>
14229
14230         * layout.cc (is_compressible_debug_section): Fix incorrect
14231         comment about compressed section names.
14232
14233 2009-07-20  Ian Lance Taylor  <ian@airs.com>
14234
14235         PR 10419
14236         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
14237
14238 2009-07-16  Ian Lance Taylor  <iant@google.com>
14239
14240         PR 10400
14241         * layout.h: #include <map>.
14242         (class Kept_section): Change from struct to class.  Add accessors
14243         and setters.  Add section size to Comdat_group mapping.  Change
14244         Comdat_group to std::map.  Add is_comdat_ field.  Add
14245         linkonce_size field in union.
14246         (class Layout): Update declaration of find_or_add_kept_section.
14247         Don't declare find_kept_object.
14248         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
14249         parameter.  Add object, shndx, is_comdat, and is_group_name
14250         parameters.  Change all callers.  Adjust for new Kept_section.
14251         (Layout::find_kept_object): Remove.
14252         * object.cc (Sized_relobj::include_section_group): Update use of
14253         Kept_section.  Rename secnum to shndx.  Only record
14254         Kept_comdat_section if sections are the same size.
14255         (Sized_relobj::include_linkonce_section): Update use of
14256         Kept_section.  Only record Kept_comdat_section if sections are the
14257         same size.  Set size of linkonce section.
14258         (Sized_relobj::map_to_kept_section): Update call to
14259         get_kept_comdat_section.
14260         * object.h (class Sized_relobj): Rename fields in
14261         Kept_comdat_section to drop trailing underscores; change object
14262         field to Relobj*.  Change Kept_comdat_section_table to store
14263         struct rather than pointer.
14264         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
14265         Add kept_object and kept_shndx parameters.  Change all callers.
14266         (Sized_relobj::get_kept_comdat_section): Change return type to
14267         bool.  Add kept_object and kept_shndx parameters.  Change all
14268         callers.
14269         * plugin.cc (Pluginobj::include_comdat_group): Update call to
14270         Layout::find_or_add_kept_section.
14271
14272 2009-07-09  Ian Lance Taylor  <iant@google.com>
14273
14274         * merge.cc (Object_merge_map::initialize_input_to_output_map):
14275         Reserve space in the hash table.
14276
14277 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
14278
14279         * fileread.cc (File_read::get_mtime): New method.
14280         * fileread.h (Timespec): New structure.
14281         (File_read::get_mtime): New method.
14282         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
14283         Renamed from timestamp_nsec.
14284         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
14285         Elf_Xword.
14286         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
14287         timestamp_nsec.
14288         (Incremental_inputs::report_archive): Save mtime; style fix.
14289         (Incremental_inputs::report_obejct): Save mtime; style fix.
14290         (Incremental_inputs::report_script): Save mtime; style fix.
14291         (Incremental_inputs::finalize_inputs): Style fix.
14292         (Incremental_inputs::finalize): Style fix.
14293         (Incremental_inputs::create_input_section_data): Store inputs
14294         mtime.
14295         * incremental.h (Incremental_inputs::report_script): Add mtime
14296         argument.
14297         (Incremental_inputs::Input_info::Input_info): Intialize only one
14298         union member.
14299         (Incremental_inputs::Input_info::archive): Move to nameless
14300         union.
14301         (Incremental_inputs::Input_info::obejct): Move to nameless union.
14302         (Incremental_inputs::Input_info::script): Move to nameless union.
14303         (Incremental_inputs::mtime): New field.
14304         * script.cc (read_input_script): Pass file mtime to
14305         Incremental_input.
14306         * script.h (Script_info::inputs): Style fix.
14307
14308 2009-07-01  Ian Lance Taylor  <ian@airs.com>
14309
14310         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
14311         instead of 32.
14312
14313 2009-06-24  Ian Lance Taylor  <iant@google.com>
14314
14315         PR 10156
14316         * layout.cc (Layout::choose_output_section): If we find an
14317         existing section, update the flags.
14318         (Layout::create_notes): New function, broken out of
14319         Layout::finalize.
14320         (Layout::finalize): Don't create note sections.
14321         (Layout::create_note): Don't crash if linker script discards
14322         section.
14323         (Layout::create_gold_note): Likewise.
14324         (Layout::create_build_id): Likewise.  Don't set
14325         after_input_sections on the section.
14326         (Layout::create_executable_stack_info): Remove target parameter.
14327         Change caller.
14328         * layout.h (class Layout): Declare create_notes.  Update
14329         declaration of create_executable_stack_info.
14330         * gold.cc (queue_middle_tasks): Call create_notes.
14331         * output.cc (Output_section::update_flags_for_input_section): Move
14332         here from output.h.  If SHF_ALLOC flag is newly set, mark address
14333         invalid.
14334         * output.h (Output_data::mark_address_invalid): New function.
14335         (class Output_section): Only declare, not define,
14336         update_flags_for_input_section.  Remove set_flags.
14337
14338 2009-06-24  Ian Lance Taylor  <iant@google.com>
14339
14340         * script-sections.cc (Output_section_definition::
14341         set_section_addresses): Rename shadowing local load_address to
14342         laddr.
14343
14344 2009-06-24  Ian Lance Taylor  <iant@google.com>
14345
14346         PR 10244
14347         * reloc.cc (relocate_sections): Skip empty relocation sections.
14348
14349 2009-06-23  Ian Lance Taylor  <iant@google.com>
14350
14351         PR 10156
14352         * layout.cc (Layout::create_note): Use choose_output_section
14353         rather than make_output_section.
14354
14355 2009-06-23  Ian Lance Taylor  <iant@google.com>
14356
14357         PR 10237
14358         * options.cc (General_options::parse_V): Set printed_version_.
14359         (General_options::General_options): Initialize printed_version_.
14360         * options.h (class General_options): Add printed_version_ field.
14361         * gold.cc (queue_initial_tasks): If there are no input files,
14362         don't give a fatal error if we printed the version information.
14363         (queue_middle_tasks): If using -r with a shared object, give a
14364         fatal error rather than an ordinary error.
14365
14366 2009-06-23  Ian Lance Taylor  <iant@google.com>
14367
14368         PR 10219
14369         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
14370         (Layout::make_output_section): Set have_stabstr_section_ if we see
14371         a .stab*str section.
14372         (Layout::finalize): Call link_stabs_sections.
14373         (Layout::link_stabs_sections): New file.
14374         * layout.h (class Layout): Add have_stabstr_section_ field.
14375         Declare link_stabs_sections.
14376
14377 2009-06-23  Doug Kwan  <dougkwan@google.com>
14378
14379         * Makefile.am (libgold_a_LIBADD): New.
14380         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
14381         * Makefile.in: Regenerate.
14382         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
14383         * configure: Regenerate.
14384         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
14385         * fileread.cc: Include sys/state.h
14386         * gold.h: Declare memmem and strndup if found missing.
14387         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
14388
14389 2009-06-23  Ian Lance Taylor  <iant@google.com>
14390
14391         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
14392         * configure: Rebuild.
14393
14394 2009-06-23  Ian Lance Taylor  <iant@google.com>
14395
14396         PR 10147
14397         * object.cc (Object::section_contents): Don't try to get a view if
14398         the section has length zero.
14399         (Object::handle_gnu_warning_section): If the section is empty, use
14400         the name of the section as the warning.
14401
14402 2009-06-23  Ian Lance Taylor  <iant@google.com>
14403
14404         PR 10133
14405         * stringpool.h (class Stringpool_template): Add optimize_ field.
14406         (Stringpool_template::set_optimize): New function.
14407         * stringpool.cc (Stringpool_template::Stringpool_template):
14408         Initialize optimize_ field.
14409         (Stringpool_template::set_string_offsets): Test local optimize
14410         fild rather than parameter.
14411         * layout.cc (Layout::Layout): Call set_optimize on the section
14412         name stringpool.
14413
14414 2009-06-22  Ian Lance Taylor  <iant@google.com>
14415
14416         PR 10030
14417         * yyscript.y: Parse TARGET.
14418         * script.cc (script_set_target): New function.
14419         * script-c.h (script_set_target): Declare.
14420         * options.cc (General_options::string_to_object_format): Rename
14421         from string_to_object_format in anonymous namespace.  Change
14422         callers.
14423         * options.h (class General_options): Declare
14424         string_to_object_format.
14425
14426 2009-06-22  Ian Lance Taylor  <iant@google.com>
14427
14428         * script-sections.cc (Script_sections::create_segments): Don't put
14429         program headers in a PT_LOAD segment if -n or -N.
14430
14431 2009-06-22  Ian Lance Taylor  <iant@google.com>
14432
14433         PR 10141
14434         * options.h (class General_options): Add -z lazy and -z now.  Sort
14435         -z options into alphabetical order.
14436         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
14437
14438 2009-06-21  Ian Lance Taylor  <iant@google.com>
14439
14440         * layout.cc (Layout::make_output_section): Call
14441         Target::new_output_section.
14442         (Layout::attach_allocated_section_to_segment): Put large section
14443         sections in a separate load segment with the large segment flag
14444         set.
14445         (Layout::segment_precedes): Sort large data segments after other
14446         load segments.
14447         (align_file_offset): New static function.
14448         (Layout::set_segment_offsets): Use align_file_offset.
14449         * output.h (class Output_section): Add is_small_section_ and
14450         is_large_section_ fields.
14451         (Output_section::is_small_section): New function.
14452         (Output_section::set_is_small_section):  New function.
14453         (Output_section::is_large_section): New function.
14454         (Output_section::set_is_large_section): New function.
14455         (Output_section::is_large_data_section): New function.
14456         (class Output_segment): Add is_large_data_segment_ field.
14457         (Output_segment::is_large_data_segment): New function.
14458         (Output_segment::set_is_large_data_segment): New function.
14459         * output.cc (Output_section::Output_section): Initialize new
14460         fields.
14461         (Output_segment::Output_segment): Likewise.
14462         (Output_segment::add_output_section): Add assertion that large
14463         data sections always go in large data segments.  Force small data
14464         sections to the end of the list of data sections.  Force small BSS
14465         sections to the start of the list of BSS sections.  For large BSS
14466         sections to the end of the list of BSS sections.
14467         * symtab.h (class Symbol): Declare is_common_shndx.
14468         (Symbol::is_defined): Check Symbol::is_common_shndx.
14469         (Symbol::is_common): Likewise.
14470         (class Symbol_table): Define enum Commons_section_type.  Update
14471         declarations.  Add small_commons_ and large_commons_ fields.
14472         * symtab.cc (Symbol::is_common_shndx): New function.
14473         (Symbol_table::Symbol_table): Initialize new fields.
14474         (Symbol_table::add_from_object): Put small and large common
14475         symbols in the right list.
14476         (Symbol_table::sized_finalized_symbol): Check
14477         Symbol::is_common_shndx.
14478         (Symbol_table::sized_write_globals): Likewise.
14479         * common.cc (Symbol_table::do_allocate_commons): Allocate new
14480         common symbol lists.  Don't call do_allocate_commons_list if the
14481         list is empty.
14482         (Symbol_table::do_allocate_commons_list): Remove is_tls
14483         parameter.  Add comons_section_type parameter.  Change all
14484         callers.  Handle small and large common symbols.
14485         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
14486         Symbol::is_common_shndx.
14487         * resolve.cc (symbol_to_bits): Likewise.
14488         * target.h (Target::small_common_shndx): New function.
14489         (Target::small_common_section_flags): New function.
14490         (Target::large_common_shndx): New function.
14491         (Target::large_common_section_flags): New function.
14492         (Target::new_output_section): New function.
14493         (Target::Target_info): Add small_common_shndx, large_common_shndx,
14494         small_common_section_flags, and large_common_section_flags
14495         fields.
14496         (Target::do_new_output_section): New virtual function.
14497         * arm.cc (Target_arm::arm_info): Initialize new fields.
14498         * i386.cc (Target_i386::i386_info): Likewise.
14499         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
14500         Likewise.
14501         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
14502         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14503         (Target_x86_64::do_new_output_section): New function.
14504         * configure.ac: Define conditional MCMODEL_MEDIUM.
14505         * testsuite/Makefile.am (check_PROGRAMS): Add large.
14506         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
14507         (large_LDFLAGS): Define.
14508         * testsuite/large.c: New file.
14509         * testsuite/testfile.cc (Target_test::test_target_info):
14510         Initialize new fields.
14511         * configure, testsuite/Makefile.in: Rebuild.
14512
14513 2009-06-05  Doug Kwan  <dougkwan@google.com>
14514
14515         * Makefile.am (CCFILES): Add target.cc.
14516         * Makefile.in: Regenerate.
14517         * i386.cc (class Target_i386): Define new virtual method to
14518         override do_is_local_label_name in parent.
14519         * object.cc (Sized_relobj::do_count_local_symbols): Discard
14520         local symbols if --discard-locals or -X is given.
14521         * options.h (class General_options): Declare new options
14522         '--discard-locals' and '-X' for discarding locals.
14523         * target.h (class Target): Define new methods is_local_label_name.
14524         Declare new virtual method do_is_local_label_name.
14525         * target.cc: New file.
14526         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
14527         (check_SCRIPTS): Add discard_locals_test.sh.
14528         (check_DATA): Add discard_local_tests.syms.
14529         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
14530         (discard_local_tests.syms, discard_locals_test.o): New make rules.
14531         * testsuite/Makefile.in: Regenerate.
14532         * testsuite/discard_locals_test.c: New file.
14533         * testsuite/discard_locals_test.sh: Same.
14534
14535 2009-06-05  Doug Kwan  <dougkwan@google.com>
14536
14537         * object.cc (Sized_relobj::Sized_relobj): Initialize
14538         discarded_eh_frame_shndx_ to -1U.
14539         (Sized_relobj::do_layout): Record index of a discard .eh_frame
14540         section.
14541         (Sized_relobj::do_count_local_symbols): Skip local symbols in
14542         a discarded .eh_frame section.
14543         (Sized_relobj::do_finalize_local_symbols): Ditto.
14544         * object.h (class Sized_relobj): Declare new member
14545         discarded_eh_frame_shndx_.
14546         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
14547         (local_labels_test.o, local_labels_test): New rules.
14548         * testsuite/Makefile.in: Regenerate.
14549
14550 2009-06-04  Doug Kwan  <dougkwan@google.com>
14551
14552         * layout.cc (Layout::section_name_mapping): Add mapping for
14553         special ARM sections.
14554
14555 2009-06-03  Doug Kwan  <dougkwan@google.com>
14556
14557         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
14558         (utils::has_overflow): Same.
14559
14560 2009-06-03  Ian Lance Taylor  <iant@google.com>
14561
14562         * layout.cc (Layout::section_name_mapping): New array, replacing
14563         Layout::linkonce_mapping.
14564         (Layout::section_name_mapping_count): New variable, replacing
14565         Layout::linkonce_mapping_count.
14566         (Layout::linkonce_output_name): Remove.
14567         (Layout::output_section_name): Rewrite.
14568         * layout.h (class Layout): Rename Linkonce_mapping to
14569         Section_name_mapping, linkonce_mapping to section_name_mapping,
14570         linkonce_mapping_count to section_name_mapping_count.  Don't
14571         declare linkonce_output_name.
14572
14573 2009-06-03  Doug Kwan  <dougkwan@google.com>
14574
14575         * gold/arm.cc (namespace utils): New.
14576         (Target_arm::reloc_is_non_pic): Define new method.
14577         (class Arm_relocate_functions): New.
14578         (Target_arm::Relocate::relocate): Handle relocation types used by
14579         Android.
14580
14581 2009-06-03  Ian Lance Taylor  <iant@google.com>
14582
14583         * arm.cc (Target_arm::scan::global): Use || instead of |.
14584
14585 2009-06-02  Doug Kwan  <dougkwan@google.com>
14586
14587         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
14588         issued_non_pic_error_.
14589         (class Target_arm::Scan): Declare new method check_non_pic.
14590         Define new method symbol_needs_plt_entry.
14591         Declare new data member issued_non_pic_error_.
14592         (class Target_arm::Relocate): Declare new method
14593         should_apply_static_reloc.
14594         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
14595         (Target_arm::Scan::check_non_pic): Define new method.
14596         (Target_arm::Scan::local): Handle a small subset of reloc types used
14597         by Android.
14598         (Target_arm::Scan::local): Same.
14599         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
14600
14601 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
14602
14603         * incremental.cc (Incremental_inputs::report_command_line): Filter
14604         out --incremental-* options.
14605
14606 2009-05-29  Doug Kwan  <dougkwan@google.com>
14607
14608         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
14609         template class.
14610         (class Target_arm): Update comment.
14611         (Target_arm::Target_arm): Initialize new data members GOT_,
14612         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
14613         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
14614         and Target_arm::rel_dyn_section.
14615         Declare new_enum Target_arm::Got_type.
14616         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
14617         and DYNBSS_.
14618         Update commments for member do_dynsym_value.
14619         (Target_arm::got_size, Target_arm::plt_section,
14620         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
14621         new methods inside class defintion.
14622         (Target_arm::got_section): Define new method.
14623         (Target_arm::rel_dyn_section): Same.
14624         (Output_data_plt_arm): New template class.
14625         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
14626         (Output_data_plt_arm:do_adjust_output_section): Define new method.
14627         (Output_data_plt_arm::add_entry): Same.
14628         (Output_data_plt_arm::first_plt_entry): Define new
14629         static data member for PLT instruction template.
14630         (Output_data_plt_arm::plt_entry): Same.
14631         (Output_data_plt_arm::do_write): Define new method.
14632         (Target_arm::make_plt_entry): Same.
14633         (Target_arm::do_finalize_sections): Same.
14634         (Target_arm::do_dynsym_value): Same.
14635
14636 2009-05-28  Doug Kwan  <dougkwan@google.com>
14637
14638         * Makefile.am (TARGETSOURCES): Add arm.cc.
14639         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
14640         * Makefile.in: Regenerate.
14641         * arm.cc: New file.
14642         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
14643
14644 2009-05-26  Doug Kwan  <dougkwan@google.com>
14645
14646         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
14647         (General_options::check_excluded_libs): Strip off directories in
14648         archive name before matching like GNU ld does.
14649         * testsuite/Makefile.am (MOSTLYCLEANFILES,
14650         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
14651         (exclude_libs_test_LDFLAGS): Add linker option
14652         -Wl,--exclude-libs,libexclude_libs_test_3
14653         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
14654         an explicit archive without using -l.
14655         (alt/libexclude_libs_test_3.a): New make rule.
14656         * testsuite/Makefile.in: Regenerate.
14657         * testsuite/exclude_libs_test.c : Declare lib3_default().
14658         (main): Call it.
14659         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
14660         * exclude_libs_test_3.c: New file.
14661
14662 2009-05-26  Nick Clifton  <nickc@redhat.com>
14663
14664         * po/id.po: New Indonesian translation.
14665         * po/gold.pot: Updated template file.
14666
14667 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
14668
14669         * testsuite/Makefile.am: Add -ffunction-sections to compile
14670         gc_comdat_test files.  Add -Wl,--gc-sections to build
14671         gc_comdat_test.
14672         * testsuite/Makefile.in: Regenerate.
14673         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
14674
14675 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
14676
14677         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
14678         kept comdat section was garbage collected.
14679         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
14680         * testsuite/Makefile.in: Regenerate.
14681         * testsuite/gc_comdat_test.sh: New file.
14682         * testsuite/gc_comdat_test_1.cc: New file.
14683         * testsuite/gc_comdat_test_2.cc: New file.
14684
14685 2009-05-19  Doug Kwan  <dougkwan@google.com>
14686
14687         * archive.cc (Archive::Archive): Move constructor from archive.h
14688         to here.  Initialize no_export_.
14689         (Archive::get_elf_object_for_member): Set no_export flag of object.
14690         * archive.h (Archive::Archive): Move constructor body to
14691         archive.cc.
14692         (Archive::no_export): New method.
14693         (Archive::no_export_): New field.
14694         * object.h (Object::Object): Initialize no_export_ to false.
14695         (Object::no_export, Object::set_no_export): New methods.
14696         (Object::no_export_): New field.
14697         * options.cc (General_options::parse_exclude_libs): New method.
14698         (General_options::check_excluded_libs) Same.
14699         * options.h (exclude_libs): New option.
14700         (General_options::check_excluded_libs): New method declaration.
14701         (General_options::excluded_libs_): New field.
14702         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
14703         default or protected visibility if an object has no-export flag set.
14704         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
14705         (check_SCRIPTS): Add exclude_libs_test.sh.
14706         (check_DATA): Add exclude_libs_test.syms.
14707         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
14708         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
14709         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
14710         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
14711         (exclude_libs_test.syms, libexclude_libs_test_1.a,
14712         libexclude_libs_test_2.a): New rules.
14713         * testsuite/Makefile.in: Regenerate.
14714         * testsuite/exclude_libs_test.c: New file.
14715         * testsuite/exclude_libs_test.sh: Ditto.
14716         * testsuite/exclude_libs_test_1.c: Ditto.
14717         * testsuite/exclude_libs_test_2.c: Ditto.
14718
14719 2009-05-15  Ian Lance Taylor  <iant@google.com>
14720
14721         * configure.ac: Check for declarations for cases where libiberty.h
14722         checks HAVE_DECL_xxx.
14723         * configure, config.in: Rebuild.
14724
14725 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
14726
14727         * gold.h (Incremental_argument_list): Remove (invalid) forward
14728         declaration.
14729         * incremental.cc (Incremental_inputs::report_achive): New method.
14730         (Incremental_inputs::report_object): New method.
14731         (Incremental_inputs::report_script): New method.
14732         (Incremental_inputs::finalize_inputs): New method.
14733         (Incremental_inputs::finalize): Call finalize_inputs().
14734         (Incremental_inputs::sized_create_incremental_inputs_section_data):
14735         Create inputs entries.
14736         * incremental.h (Incremental_input_type): New enum.
14737         (Incremental_inputs::Incremental_input): Initialize new fields.
14738         (Incremental_inputs::report_inputs): New method.
14739         (Incremental_inputs::report_achive): New method.
14740         (Incremental_inputs::report_object): New method.
14741         (Incremental_inputs::report_script): New method.
14742         (Incremental_inputs::finalize_inputs): New method.
14743         (Incremental_inputs::Input_info): New struct.
14744         (Incremental_inputs::Input_info_map): New typedef.
14745         (Incremental_inputs::lock_): New field.
14746         (Incremental_inputs::Inputs_): New field.
14747         (Incremental_inputs::Inputs_map): New field.
14748         * main.cc (main): Call Incremental_input::report_inputs.
14749         * options.h (Input_argument_list): Typedef moved from
14750         Input_arguments.
14751         (Input_file_group::Files): Remove, use ::Input_argument_list.
14752         (Input_file_group::Input_argument_list): Remove, use
14753         ::Input_argument_list.
14754         * plugin.cc (Plugin_manager::add_input_file): Add error in
14755         incremental build.
14756         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
14757         functions.
14758         * script.cc (read_input_script): Call
14759         Incremental_input::report_script.
14760         * script.h (Script_info): New class.
14761
14762 2009-04-27  Ian Lance Taylor  <iant@google.com>
14763
14764         * x86_64.cc (do_adjust_output_section): Set entsize to
14765         plt_entry_size.
14766
14767 2009-04-23  Elliott Hughes  <enh@google.com>
14768
14769         * output.cc (Output_file::close): After short writes, continue
14770         writing from the correct offset in the buffer being written.
14771
14772 2009-04-23  Chris Demetriou  <cgd@google.com>
14773
14774         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
14775         * configure: Regenerate.
14776         * config.in: Regenerate.
14777         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
14778         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
14779
14780 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
14781
14782         * incremental.cc (Incremental_inputs_header_data): Renamed from
14783         Incremental_input_header_data.
14784         (Incremental_inputs_header_data::data_size): New field.
14785         (Incremental_inputs_header_data::put_input_file_count): Renamed
14786         from input_file_count.
14787         (Incremental_inputs_header_data::put_command_line_offset): Renamed
14788         from command_line_offset.
14789         (Incremental_inputs_header_data::put_reserved): Renamed from
14790         put_reserved.
14791         (Incremental_inputs_entry_data): Renamed from
14792         Incremental_input_entry_data.
14793         (Incremental_inputs_entry_data::data_size): New field.
14794         (Incremental_inputs::report_command_line): New method.
14795         (Incremental_inputs::finalize): New method.
14796         (Incremental_inputs::create_incremental_inputs_data): New method.
14797         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
14798         * incremental.h: New file.
14799         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
14800         (Layout::finalize): Create incremental inputs section in
14801         incremental builds.
14802         (Layout::create_incremental_info_sections): New method.
14803         * layout.h (Layout::incremental_inputs): New method.
14804         (Layout::create_incremental_info_sections): New method.
14805         (Layout::incremental_inputs_): New field.
14806         * main.cc (main): Notify Incremental_input of the command line.
14807
14808 2009-04-01  Ian Lance Taylor  <iant@google.com>
14809             Mikolaj Zalewski  <mikolajz@google.com>
14810
14811         * gold.h (reserve_unordered_map): Define, three versions, one for
14812         each version of Unordered_map.
14813         * layout.cc (Layout::Layout): Remove options parameter.  Add
14814         number_of_input_files parameter.  Don't initialize options_.
14815         Initialize number_of_input_files_ and resized_signatures_.  Move
14816         sections_are_attached_.
14817         (Layout::layout_group): Reserve space for group_signatures_.
14818         (Layout::find_or_add_kept_section): Change name parameter to be a
14819         reference.  Resize signatures_ map when it gets large enough.
14820         (Layout::layout_eh_frame): Use parameters->options() instead of
14821         this->options_.
14822         (Layout::make_output_section): Likewise.
14823         (Layout::attach_allocated_section_to_segment): Likewise.
14824         (Layout::finalize, Layout::create_executable_stack): Likewise.
14825         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
14826         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
14827         * layout.h (class Layout): Update declarations.  Remove options_
14828         field.  Add number_of_input_files_ and resized_signatures_
14829         fields.  Move sections_are_attached_ field.
14830         * main.cc (main): Pass number of input files to Layout
14831         constructor.  Don't pass options.
14832
14833 2009-03-30  Ian Lance Taylor  <iant@google.com>
14834
14835         * ffsll.c (ffsll): Correct implementation.
14836
14837 2009-03-27  Ian Lance Taylor  <iant@google.com>
14838
14839         * ffsll.c: New file.
14840         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
14841         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
14842         * ftruncate.c (ftruncate): Declare before definition.
14843         * mremap.c (mremap): Likewise.
14844         * pread.c (pread): Likewise.
14845         * configure, Makefile.in, config.in: Rebuild.
14846
14847         * mremap.c: New file.
14848         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
14849         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
14850         (mremap): Declare if HAVE_MREMAP is not defined.
14851         * configure, Makefile.in, config.in: Rebuild.
14852
14853 2009-03-27  Cary Coutant  <ccoutant@google.com>
14854
14855         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
14856         position independent.
14857         * sparc.cc (Target_sparc::check_non_pic): Likewise.
14858         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
14859
14860 2009-03-24  Cary Coutant  <ccoutant@google.com>
14861
14862         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
14863         an executable.
14864         (needs_dynamic_reloc): Likewise.
14865
14866 2009-03-24  Ian Lance Taylor  <iant@google.com>
14867
14868         * yyscript.y (file_cmd): Recognize EXTERN.
14869         (extern_name_list, extern_name_list_body): New nonterminals.
14870         * script.cc (script_add_extern): Define.
14871         * script-c.h (script_add_extern): Declare.
14872
14873 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
14874
14875         * object.cc (is_elf_object): Define.
14876         * object.h (is_elf_object): Declare.
14877         * archive.cc (Archive::get_elf_object_for_member): Call
14878         is_elf_object.
14879         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
14880
14881 2009-03-24  Elliott Hughes  <enh@google.com>
14882
14883         * output.cc (Output_file::map_anonymous): Define.
14884         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
14885         try an anonymous one.  Report the size if the mmap fails.
14886         * output.h (class Output_file): Declare map_anonymous.
14887
14888 2009-03-24  Ian Lance Taylor  <iant@google.com>
14889
14890         * target-select.cc (instantiate_target): Don't acquire the lock if
14891         the instantiated_target_ field has already been set.
14892
14893 2009-03-23  Ian Lance Taylor  <iant@google.com>
14894
14895         * gold-threads.h (class Initialize_lock): Define.
14896         * gold-threads.cc (class Initialize_lock_once): Define.
14897         (initialize_lock_control): New static variable.
14898         (initialize_lock_pointer): New static variable.
14899         (initialize_lock_once): New static function.
14900         (Initialize_lock::Initialize_lock): Define.
14901         (Initialize_lock::initialize): Define.
14902         * target-select.h: Include "gold-threads.h".
14903         (class Target_selector): Add lock_ and initialize_lock_ fields.
14904         Don't define instantiate_target, just declare it.
14905         * target-select.cc (Target_selector::Target_selector): Initialize
14906         new fields.
14907         (Target_selector::instantiate_target): Define.
14908         * descriptors.h: Include "gold-threads.h".
14909         (class Descriptors): Add initialize_lock_ field.
14910         * descriptors.cc (Descriptors::Descriptors): Initialize new
14911         field.
14912         (Descriptors::open): Use initialize_lock_ field
14913         * errors.h (class Errors): Add initialize_lock_ field.
14914         * errors.cc (Errors::Errors): Initialize new field.
14915         (Errors::initialize_lock): Use initialize_lock_ field.
14916         * powerpc.cc (class Target_selector_powerpc): Remove
14917         instantiated_target_ field.  In do_recognize call
14918         instantiate_target rather than do_instantiate_target.  In
14919         do_instantiate_target just allocate a new target.
14920         * sparc.cc (class Target_selector_sparc): Likewise.
14921
14922         * freebsd.h: New file.
14923         * i386.cc: Include "freebsd.h".
14924         (Target_i386): Derive from Target_freebsd rather than
14925         Sized_target.
14926         (Target_selector_i386): Derive from Target_selector_freebsd rather
14927         than Target_selector.
14928         * x86_64.cc: Include "freebsd.h".
14929         (Target_x86_64): Derive from Target_freebsd rather than
14930         Sized_target.
14931         (Target_selector_x86_64): Derive from Target_selector_freebsd
14932         rather than Target_selector.
14933         * target.h (class Target): Add adjust_elf_header and
14934         do_adjust_elf_header.
14935         * output.cc (Output_file_header:: do_sized_write): Call target
14936         adjust_elf_header routine.
14937         * configure.tgt: Set targ_osabi.
14938         * configure.ac: Define GOLD_DEFAULT_OSABI.
14939         * parameters.cc (Parameters::default_target): Pass
14940         GOLD_DEFAULT_OSABI to select_target.
14941         * target-select.h (class Target_selector): Make instantiate_target
14942         protected rather than private.
14943         * Makefile.am (HFILES): Add freebsd.h.
14944         * configure, Makefile.in, config.in: Rebuild.
14945
14946         * merge.cc (do_add_input_section): Correct pend value.  Change
14947         message about last entry not being null terminated from error to
14948         warning.
14949
14950 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
14951
14952         * incremental.cc: New file.
14953         * Makefile.am (CCFILES): Add incremental.cc.
14954         * Makefile.in: Rebuild.
14955
14956 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
14957
14958         * layout.cc (Layout::output_section_name): Preserve names
14959         of '.note.' sections.
14960
14961 2009-03-19  Ian Lance Taylor  <iant@google.com>
14962
14963         * descriptors.cc (Descriptors::open): Check that the options are
14964         valid before using them.
14965
14966 2009-03-18  Ian Lance Taylor  <iant@google.com>
14967
14968         * script-sections.h: Include <list>.
14969         (class Script_sections): Change Sections_elements from std::vector
14970         to std::list.  Typedef public Elements_iterator.  Add
14971         orphan_section_placement_, data_segment_align_start_, and
14972         saw_data_segment_align_ fields.  Remove data_segment_align_index_
14973         field.
14974         * script-sections.cc (class Orphan_section_placement): New class.
14975         (class Sections_element): Add virtual functions is_relro and
14976         orphan_section_init.  Remove virtual function place_orphan_here.
14977         (class Output_section_definition): Add is_relro and
14978         orphan_section_init.  Remove place_orphan_here.
14979         (class Orphan_output_section): Likewise.
14980         (Script_sections::Script_sections): Update for field changes.
14981         (Script_sections::data_segment_align): Set saw_data_segment_align_
14982         and data_segment_align_start_, not data_segment_align_index.
14983         (Script_sections::data_segment_relro_end): Check
14984         saw_data_segment_align_.  Use data_segment_align_start_ rather
14985         than data_segment_align_index_.
14986         (Script_sections::place_orphan): Rewrite to use
14987         Orphan_section_placement.
14988
14989 2009-03-17  Ian Lance Taylor  <iant@google.com>
14990
14991         * archive.cc (Archive::add_symbols): Check for a version attached
14992         to the symbol name in the archive map.
14993         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
14994         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
14995         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
14996         (ver_test_11.a): New target.
14997         * testsuite/Makefile.in: Rebuild.
14998
14999         * configure.ac: Check for chsize and posix_fallocate.  Replace
15000         ftruncate.
15001         * ftruncate.c: New file, from gnulib.
15002         * output.cc (posix_fallocate): Define dummy version if not
15003         HAVE_POSIX_FALLOCATE.
15004         (Output_file::map): Call posix_fallocate rather than lseek and
15005         write.
15006         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
15007         * configure, Makefile.in, config.in: Rebuild.
15008
15009 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
15010
15011         * layout.h (Layout::create_note): Add section_name parameter.
15012         * layout.cc (Layout::create_note): Likewise.
15013         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
15014
15015 2009-03-17  Ian Lance Taylor  <iant@google.com>
15016
15017         * descriptors.cc: Include "options.h".
15018         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
15019         (Descriptors::open): Always use O_CLOEXEC when opening a new
15020         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
15021         then set FD_CLOEXEC.
15022
15023         * sparc.cc (class Target_sparc): Add has_got_section.
15024         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
15025         make sure we have a GOT section.
15026
15027         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
15028         (Target_sparc::Scan::local): Likewise.
15029         (Target_sparc::Scan::global): Likewise.
15030         (Target_sparc::Relocate::relocate): Likewise.
15031         (Target_sparc::Relocate::relocate_tls): Likewise.
15032
15033         * symtab.cc (Symbol_table::define_default_version): New function,
15034         broken out of add_from_object.
15035         (Symbol_table::add_from_object): Call define_default_version.
15036         (Symbol_table::define_special_symbol): Add resolve_oldsym
15037         parameter.  Change all callers.  If the version for a symbol comes
15038         from a version script, resolve it with the symbol with the same
15039         name with no version.  Also add the symbol without a version if
15040         appropriate.
15041         (do_define_in_output_data): If resolving with oldsym, don't delete
15042         sym.
15043         (do_define_in_output_segment): Likewise.
15044         (do_define_as_constant): Likewise.
15045         * symtab.h (class Symbol_table): Update declarations.
15046
15047 2009-03-13  Ian Lance Taylor  <iant@google.com>
15048
15049         * readsyms.cc (Read_symbols::incompatible_warning): New function.
15050         (Read_symbols::requeue): New function.
15051         (Read_symbols::do_read_symbols): If make_elf_object fails because
15052         the target type is not configured, and the file was searched for,
15053         issue a warning and retry with the next directory.
15054         (Add_symbols::run): If the file has an incompatible format, and
15055         it was searched for, requeue the Read_symbols task.  On error,
15056         release the object.
15057         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
15058         dirindex parameter to constructor.  Change all callers.  Declare
15059         incompatible_warning and requeue.
15060         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
15061         input_argument_ and input_group_ fields.  Add them to
15062         constructor.  Change all callers.
15063         (class Read_script): Add dirindex_ field.  Add it to constructor.
15064         Change all callers.
15065         * archive.cc (Archive::setup): Remove input_objects parameter.
15066         Change all callers.
15067         (Archive::get_file_and_offset): Likewise.
15068         (Archive::read_all_symbols): Likewise.
15069         (Archive::read_symbols): Likewise.
15070         (Archive::get_elf_object_for_member): Remove input_objects
15071         parameter.  Add punconfigured parameter.  Change all callers.
15072         (Archive::add_symbols): Change return type to bool.  Check return
15073         value of include_member.
15074         (Archive::include_all_members): Likewise.
15075         (Archive::include_member): Change return type to bool.  Return
15076         false if first included object has incompatible target.  Set
15077         included_member_ field.
15078         (Add_archive_symbols::run): If add_symbols returns false, requeue
15079         Read_symbols task.
15080         * archive.h (class Archive): Add included_member_ field.
15081         Initialize it in constructor.  Add input_file and searched_for
15082         methods.  Update declarations.
15083         (class Add_archive_symbols): Add dirpath_, dirindex_, and
15084         input_argument_ fields.  Add them to constructor.  Change all
15085         callers.
15086         * script.cc: Include "target-select.h".
15087         (class Parser_closure): Add skip_on_incompatible_target_ and
15088         found_incompatible_target_ fields.  Add
15089         skip_on_incompatible_target parameter to constructor.  Change all
15090         callers.  Add methods skip_on_incompatible_target,
15091         clear_skip_on_incompatible_target, found_incompatible_target, and
15092         set_found_incompatible_target.
15093         (read_input_script): Add dirindex parameter.  Change all callers.
15094         If parser finds an incompatible target, requeue Read_symbols
15095         task.
15096         (script_set_symbol): Clear skip_on_incompatible_target in
15097         closure.
15098         (script_add_assertion, script_parse_option): Likewise.
15099         (script_start_sections, script_add_phdr): Likewise.
15100         (script_check_output_format): New function.
15101         * script.h (read_input_script): Update declaration.
15102         * script-c.h (script_check_output_format): Declare.
15103         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
15104         (ignore_cmd): Remove OUTPUT_FORMAT.
15105         * fileread.cc (Input_file::Input_file): Add explicit this.
15106         (Input_file::will_search_for): New function.
15107         (Input_file::open): Add pindex parameter.  Change all callers.
15108         * fileread.h (class Input_file): Add input_file_argument method.
15109         Declare will_search_for.  Update declarations.
15110         * object.cc (make_elf_object): Add punconfigured parameter.
15111         Change all callers.
15112         * object.h (class Object): Make input_file public.  Add
15113         searched_for method.
15114         (make_elf_object): Update declaration.
15115         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
15116         restart search.
15117         * dirsearch.h (class Dirsearch): Update declaration.
15118         * options.h (class General_options): Add --warn-search-mismatch.
15119         * parameters.cc (Parameters::is_compatible_target): New function.
15120         * parameters.h (class Parameters): Declare is_compatible_target.
15121         * workqueue.cc (Workqueue::add_blocker): New function.
15122         * workqueue.h (class Workqueue): Declare add_blocker.
15123
15124         * fileread.cc (Input_file::open): Remove options parameter.
15125         Change all callers.
15126         (Input_file::open_binary): Likewise.
15127         * script.cc (read_input_script): Likewise.
15128         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
15129         options parameter from constructor.  Change all callers.
15130         (class Read_script): Likewise.
15131         * fileread.h (class Input_file): Update declarations.
15132         * script.h (read_input_script): Update declaration.
15133
15134 2009-03-10  Nick Clifton  <nickc@redhat.com>
15135
15136         * po/es.po: New Spanish translation.
15137
15138 2009-03-06  Cary Coutant  <ccoutant@google.com>
15139
15140         * options.cc (parse_short_option): Keep dash_z from registering itself.
15141
15142 2009-03-03  Ian Lance Taylor  <iant@google.com>
15143
15144         PR 9918
15145         * target-reloc.h (relocate_section): Pass output_section to
15146         relocate.
15147         * i386.cc (Target_i386::should_apply_static_reloc): Add
15148         output_section parameter.  Change all callers.
15149         (Target_i386::Relocate::relocate): Add output_section parameter.
15150         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15151         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
15152         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
15153         * testsuite/two_file_shared.sh: New script.
15154         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
15155         (check_DATA): Add two_file_shared.dbg.
15156         (two_file_shared.dbg): New target.
15157         * testsuite/Makefile.in: Rebuild.
15158
15159 2009-03-01  Ian Lance Taylor  <iant@google.com>
15160
15161         * configure.ac: Check for byteswap.h.
15162         * configure: Rebuild.
15163         * config.in: Rebuild.
15164
15165 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
15166
15167         * layout.cc (Layout::find_or_add_kept_section): New function.
15168         (Layout::add_comdat): Removed.
15169         * layout.h (struct Kept_section): Move out of class Layout.
15170         Remove trailing underscores from field names.  Add group_sections
15171         field.  Rename group_ field to is_group.  Change all uses.
15172         (class Layout): Declare find_or_add_kept_section, not add_comdat.
15173         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
15174         comdat_groups_ field.
15175         (Sized_relobj::include_section_group): Use
15176         find_or_add_kept_section and Kept_section::group_sections.
15177         (Sized_relobj::include_linkonce_section): Likewise.
15178         * object.cc (class Sized_relobj): Don't define Comdat_group or
15179         Comdat_group_table.  Remove find_comdat_group and
15180         add_comdat_group.  Remove comdat_groups_ field.
15181         * plugin.cc (include_comdat_group): Use
15182         Layout::find_or_add_kept_section.
15183
15184 2009-02-28  Ian Lance Taylor  <iant@google.com>
15185
15186         * README: --gc-sections and map files are now supported.  Document
15187         some build requirements.
15188
15189         PR 6992
15190         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
15191         relocatable link set the value of the section symbol to zero.
15192         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
15193         relocatable link don't include the section address in the local
15194         symbol value.
15195
15196 2009-02-27  Ian Lance Taylor  <iant@google.com>
15197
15198         PR 6811
15199         * options.h (class Search_directory): Add is_system_directory.
15200         (class General_options): Declare is_in_system_directory.
15201         * options.cc (get_relative_sysroot): Make static.
15202         (get_default_sysroot): Make static.
15203         (General_optoins::is_in_system_directory): New function.
15204         * fileread.cc (Input_file::is_in_system_directory): New function.
15205         * fileread.h (class Input_file): Declare is_in_system_directory.
15206         * object.h (class Object): Add is_in_system_directory.
15207         (class Input_objects): Remove system_library_directory_ field.
15208         * object.cc (Input_objects::add_object): Don't set
15209         system_library_directory_.
15210         (input_objects::found_in_system_library_directory): Remove.
15211         * symtab.cc (Symbol_table::write_globals): Remove input_objects
15212         parameter.  Change all callers.
15213         (Symbol_table::sized_write_globals): Likewise.
15214         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
15215         Call Object::is_in_system_directory.
15216         * symtab.h (class Symbol_table): Update declarations.
15217
15218         PR 5990
15219         * descriptors.h (Open_descriptor): Add is_on_stack field.
15220         * descriptors.cc (Descriptors::open): If the descriptor is on the
15221         top of the stack, remove it.  Initialize is_on_stack field.
15222         (Descriptors::release): Only add pod to stack if it is not on the
15223         stack already.
15224         (Descriptors::close_some_descriptor): Clear stack_next and
15225         is_on_stack fields.
15226
15227         PR 7091
15228         * output.cc (Output_section::find_starting_output_address): Rename
15229         from starting_output_address; add PADDR parameter; change return
15230         type.
15231         * output.h (class Output_section): Declare
15232         find_starting_output_address instead of starting_output_address.
15233         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
15234         section symbol for which we can't find a merge section.
15235
15236         PR 9836
15237         * symtab.cc (Symbol_table::add_from_object): If the visibility is
15238         hidden or internal, force the symbol to be local.
15239         * resolve.cc (Symbol::override_visibility): Define.
15240         (Symbol::override_base): Use override_visibility.
15241         (Symbol_table::resolve): Likewise.
15242         (Symbol::override_base_with_special): Likewise.
15243         (Symbol_table::override_with_special): If the visibility is hidden
15244         or internal, force the symbol to be local.
15245         * symtab.h (class Symbol): Add set_visibility and
15246         override_visibility.
15247         * testsuite/ver_test_1.sh: New file.
15248         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
15249         (check_DATA): Add ver_test_1.syms.
15250         (ver_test_1.syms): New target.
15251         * testsuite/Makefile.in: Rebuild.
15252
15253 2009-02-25  Cary Coutant  <ccoutant@google.com>
15254
15255         * layout.cc (Layout::choose_output_section): Don't rename sections
15256         when using a linker script that has a SECTIONS clause.
15257         * Makefile.in: Regenerate.
15258
15259         * testsuite/Makefile.am (script_test_5.sh): New test case.
15260         * testsuite/Makefile.in: Regenerate.
15261         * testsuite/script_test_5.cc: New file.
15262         * testsuite/script_test_5.sh: New file.
15263         * testsuite/script_test_5.t: New file.
15264
15265 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
15266
15267         * archive.cc (Archive::include_member): Update calls to add_symbols.
15268         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
15269         the Layout argument.
15270         * dynobj.h (do_add_symbols): Add the Layout argument.
15271         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
15272         Layout argument.
15273         * object.h (Object::add_symbols): Add the Layout argument.
15274         (Object::do_add_symbols): Add the Layout argument.
15275         (Sized_relobj::do_add_symbols): Add the Layout argument.
15276         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
15277         Unify the two versions.
15278         (Add_plugin_symbols): Remove.
15279         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
15280         (Sized_pluginobj::do_add_symbols): Unify the two versions.
15281         (Add_plugin_symbols): Remove.
15282         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
15283         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
15284         (Add_symbols::run): Make it work with Pulginobj.
15285
15286 2009-02-06  Ian Lance Taylor  <iant@google.com>
15287
15288         * object.cc (Sized_relobj::do_layout): Make info message start
15289         with lower case letter.
15290
15291 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
15292
15293         * binary.cc: Fix file comment.
15294
15295         * options.h (enum Incremental_disposition): Define.
15296         (class General_options): Add new options: --incremental,
15297         --incremental_changed, --incremental_unchanged,
15298         --incremental_unknown.  Add incremental_disposition_ and
15299         implicit_incremental_ fields.
15300         (General_options::incremental_disposition): New function.
15301         (class Position_dependent_options): Add incremental_disposition
15302         option.
15303         (Position_dependent_options::copy_from_options): Set incremental
15304         dispositions.
15305         * options.cc (General_options::parse_incremental_changed): New
15306         function.
15307         (General_options::parse_incremental_unchanged): New function.
15308         (General_options::parse_incremental_unknown): New function.
15309         (General_options::General_options): Initialize new fields
15310         incremental_disposition_ and implicit_incremental_.
15311         (General_options::finalize): Check for uasge of --incremental-*
15312         without --incremental.
15313
15314 2009-02-06  Chris Demetriou  <cgd@google.com>
15315
15316         * gold.h (gold_undefined_symbol): Change to take only a Symbol
15317         pointer and to report location as the file name associated with
15318         the symbol.
15319         (gold_undefined_symbol_at_location): New function to replace the
15320         old gold_undefined_symbol functionality.
15321         * target-reloc.h (relocate_section): Update to use
15322         gold_undefined_symbol_at_location.
15323         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15324         Call gold_undefined_symbol function rather than gold_error.
15325         * errors.h (Errors::undefined_symbol): Take location as a
15326         string, rather than calculating it from a relocation.
15327         * errors.cc (Errors::fatal): Print "fatal error:" before the
15328         formatted message.
15329         (Errors::error, Errors::error_at_location): Print "error: "
15330         before the formatted message.
15331         (Errors::undefined_symbol): Take location as a string, rather
15332         than calculating it from a relocation.
15333         (gold_undefined_symbol_at_location): New function akin to
15334         old gold_undefined_symbol, calculates location from relocation.
15335         (gold_undefined_symbol): Change to take only a Symbol pointer
15336         and to report location as the file name associated with the symbol.
15337         * testsuite/debug_msg.sh: Update for changed error messages.
15338         * testsuite/undef_symbol.sh: Likewise.
15339
15340 2009-02-04  Duncan Sands  <baldrick@free.fr>
15341
15342         PR 9812
15343         * reduced_debug_output.h
15344         (Output_reduced_debug_abbrev_section::failed): Use format for
15345         gold_warning.
15346         (Output_reduced_debug_info_section::faild): Likewise.
15347
15348 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
15349
15350         * script.cc (Lazy_demangler): New class.
15351         (Version_script_info::get_symbol_version_helper): Demangle a
15352         symbol only once.
15353
15354 2009-01-29  Cary Coutant  <ccoutant@google.com>
15355
15356         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
15357         to __tls_get_addr.
15358         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15359
15360 2009-01-28  Ian Lance Taylor  <iant@google.com>
15361
15362         * version.cc (version_string): Bump to 1.9.
15363
15364         * gold.h: Include <cstring> and <stdint.h>.
15365         * version.cc: Include <cstdio>.
15366         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
15367         warning.
15368         * reduced_debug_output.cc (insert_into_vector): Rename from
15369         Insert_into_vector; change all callers.  Use Swap_unaligned to
15370         avoid aliasing issue; remove union since it is unnecessary.
15371
15372 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
15373
15374         * Makefile.am (CCFILES): Add gc.cc.
15375         (HFILES): Add gc.h.
15376         * Makefile.in: Regenerate.
15377         * gold.cc (Gc_runner): New class.
15378         (queue_initial_tasks): Call garbage collection related tasks
15379         when corresponding options are invoked.
15380         (queue_middle_gc_tasks): New function.
15381         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
15382         processed early before laying out sections during garbage collection.
15383         * gold.h (queue_middle_gc_tasks): New function.
15384         (is_prefix_of): Move from "layout.cc".
15385         * i386.cc (Target_i386::gc_process_relocs): New function.
15386         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
15387         * main.cc (main): Create object of class "Garbage_collection".
15388         * object.cc (Relobj::copy_symbols_data): New function.
15389         (Relobj::is_section_name_included): New function.
15390         (Sized_relobj::do_layout): Allow this function to be called twice
15391         during garbage collection and defer layout of section during the
15392         first call.
15393         * object.h (Relobj::get_symbols_data): New function.
15394         (Relobj::is_section_name_included): New function.
15395         (Relobj::copy_symbols_data): New function.
15396         (Relobj::set_symbols_data): New function.
15397         (Relobj::get_relocs_data): New function.
15398         (Relobj::set_relocs_data): New function.
15399         (Relobj::is_output_section_offset_invalid): New pure virtual function.
15400         (Relobj::gc_process_relocs): New function.
15401         (Relobj::do_gc_process_relocs): New pure virtual function.
15402         (Relobj::sd_): New data member.
15403         (Sized_relobj::is_output_section_offset_invalid): New function.
15404         (Sized_relobj::do_gc_process_relocs): New function.
15405         * options.h (General_options::gc_sections): Modify to not be a no-op.
15406         (General_options::print_gc_sections): New option.
15407         * plugin.cc (Plugin_finish::run): Remove function call to
15408         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
15409         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
15410         * reloc.cc (Read_relocs::run): Add task to process relocs and
15411         determine unreferenced sections when doing garbage collection.
15412         (Gc_process_relocs): New class.
15413         (Sized_relobj::do_gc_process_relocs): New function.
15414         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
15415         sections that are garbage collected.
15416         * reloc.h (Gc_process_relocs): New class.
15417         * sparc.cc (Target_sparc::gc_process_relocs): New function.
15418         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
15419         symbols whose corresponding sections are garbage collected.
15420         (Symbol_table::Symbol_table): Add new parameter for the garbage
15421         collection object.
15422         (Symbol_table::gc_mark_undef_symbols): New function.
15423         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15424         (Symbol_table::gc_mark_dyn_syms): New function.
15425         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
15426         as garbage.
15427         (Symbol_table::add_from_object): Likewise.
15428         (Symbol_table::add_from_relobj): When building shared objects, do not
15429         treat externally visible symbols as garbage.
15430         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
15431         table information for static and relocatable links.
15432         * symtab.h (Symbol_table::set_gc): New function.
15433         (Symbol_table::gc): New function.
15434         (Symbol_table::gc_mark_undef_symbols): New function.
15435         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15436         (Symbol_table::gc_mark_dyn_syms): New function.
15437         (Symbol_table::gc_): New data member.
15438         * target.h (Sized_target::gc_process_relocs): New pure virtual
15439         function.
15440         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
15441         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
15442
15443 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
15444
15445         * options.h (General_options::gc_sections): Define as a no-op for now.
15446         (General_options::no_keep_memory): Ditto.
15447         (General_options::Bshareable): Define.
15448         * options.cc (General_options::finalize): Honor -Bshareable.
15449
15450 2009-01-20  Andreas Schwab  <schwab@suse.de>
15451
15452         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
15453         read the value in the contents, since we don't use it.  Use the
15454         template endianness when writing.
15455         (Relocate::relocate): Use it for R_PPC_REL16_HA.
15456
15457 2009-01-19  Andreas Schwab  <schwab@suse.de>
15458
15459         * configure.tgt (powerpc64-*): Fix targ_obj.
15460
15461 2009-01-15  Ian Lance Taylor  <iant@google.com>
15462
15463         * object.cc (Sized_relobj::write_local_symbols): Don't write out
15464         local symbols when stripping all symbols.
15465
15466 2009-01-14  Cary Coutant  <ccoutant@google.com>
15467
15468         * output.cc (Output_reloc): Add explicit instantiations.
15469
15470 2009-01-14  Cary Coutant  <ccoutant@google.com>
15471
15472         * archive.cc (Archive::get_elf_object_for_member): Remove call
15473         to File_read::claim_for_plugin.
15474         * descriptors.cc (Descriptors::open): Remove reference to
15475         is_claimed.
15476         (Descriptors::claim_for_plugin): Remove.
15477         * descriptors.h (Descriptors::claim_for_plugin): Remove.
15478         (Descriptors::is_claimed): Remove.
15479         (claim_descriptor_for_plugin): Remove.
15480         * fileread.cc (File_read::claim_for_plugin): Remove.
15481         * fileread.h (File_read::claim_for_plugin): Remove.
15482         (File_read::descriptor): Reopen descriptor if necessary.
15483         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
15484         (Plugin_manager::all_symbols_read): Add task parameter. Change
15485         all callers.
15486         (Plugin_manager::get_input_file): New function.
15487         (Plugin_manager::release_input_file): New function.
15488         (Pluginobj::Pluginobj): Add filesize parameter and initialize
15489         corresponding data member.
15490         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
15491         and pass to base constructor. Change all callers.
15492         (get_input_file, release_input_file): New functions.
15493         (make_sized_plugin_object): Add filesize parameter. Change all callers.
15494         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
15495         (Plugin_manager::all_symbols_read): Add task parameter.
15496         (Plugin_manager::get_input_file): New function.
15497         (Plugin_manager::release_input_file): New function.
15498         (Plugin_manager::task_): New data member.
15499         (Pluginobj::Pluginobj): Add filesize parameter.
15500         (Pluginobj::filename): New function.
15501         (Pluginobj::descriptor): New function.
15502         (Pluginobj::filesize): New function.
15503         (Pluginobj::filesize_): New data member.
15504         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
15505         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
15506         File_read::claim_for_plugin; use Object::unlock to unlock the file.
15507
15508         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
15509         with archive libraries.
15510         * testsuite/Makefile.in: Regenerate.
15511         * testsuite/plugin_test.c (struct sym_info): New type.
15512         (get_input_file, release_input_file): New static variables.
15513         (onload): Capture new transfer vector entries.
15514         (claim_file_hook): Stop reading at end of file according to filesize.
15515         Factor out parsing of readelf output into separate function.
15516         (all_symbols_read_hook): Exercise get_input_file and release_input_file
15517         APIs and get the source file name from the symbol table.  Convert
15518         source file name to corresponding object file name.  Print info
15519         message when adding new input files.
15520         (parse_readelf_line): New function.
15521         * testsuite/plugin_test_1.sh: Add checks for new info messages.
15522         * testsuite/plugin_test_2.sh: Likewise.
15523         * testsuite/plugin_test_3.sh: Likewise.
15524         * testsuite/plugin_test_4.sh: New test case.
15525
15526 2009-01-07  Ian Lance Taylor  <iant@google.com>
15527
15528         * version.cc (version_string): Bump to 1.8.
15529
15530 2008-12-23  Cary Coutant  <ccoutant@google.com>
15531
15532         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
15533         * plugin.cc (Plugin_manager::finish): Rename as
15534         layout_deferred_objects.  Move cleanup to separate function.
15535         (Plugin_manager::cleanup): New function.
15536         (Plugin_finish::run): Call layout_deferred_objects and cleanup
15537         separately.
15538         * plugin.h (Plugin_manager::finish): Rename as
15539         layout_deferred_objects.
15540         (Plugin_manager::cleanup): New function.
15541         (Plugin_manager::cleanup_done): New field.
15542
15543 2008-12-23  Cary Coutant  <ccoutant@google.com>
15544
15545         * plugin.cc (is_visible_from_outside): New function.
15546         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
15547         so we don't return "IR only" status for exported symbols or -r links.
15548
15549         * testsuite/Makefile.am (plugin_test_3): New test case.
15550         * testsuite/Makefile.in: Regenerate.
15551         * testsuite/plugin_test_3.sh: New file.
15552
15553 2008-12-22  Cary Coutant  <ccoutant@google.com>
15554
15555         * object.cc (Sized_relobj::layout_section): New function.
15556         (Sized_relobj::do_layout): Defer layout of input sections until after
15557         plugin has provided replacement files.
15558         (Sized_relobj::do_layout_deferred_sections): New function.
15559         * object.h (Relobj::set_section_offset): Remove virtual keyword.
15560         (Relobj::layout_deferred_sections): New function.
15561         (Relobj::do_layout_deferred_sections): New function.
15562         (Sized_relobj::do_layout_deferred_sections): New function.
15563         (Sized_relobj::layout_section): New function.
15564         (Sized_relobj::Deferred_layout): New structure.
15565         (Sized_relobj::deferred_layout_): New field.
15566         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
15567         Change all callers.  Layout deferred sections.
15568         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
15569         references.
15570         (Plugin_hook::run): Move code from do_plugin_hook inline.
15571         (Plugin_hook::do_plugin_hook): Remove.
15572         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
15573         (Plugin_manager::finish): Renamed, was cleanup.
15574         (Plugin_manager::should_defer_layout): New function.
15575         (Plugin_manager::add_deferred_layout_object): New function.
15576         (Plugin_manager::Deferred_layout_list): New type.
15577         (Plugin_manager::deferred_layout_objects_): New field.
15578         (Plugin_hook::do_plugin_hook): Remove.
15579
15580 2008-12-17  Ian Lance Taylor  <iant@google.com>
15581
15582         * options.h (class General_options): Add --no case for
15583         --export-dynamic.
15584
15585 2008-12-16  Cary Coutant  <ccoutant@google.com>
15586
15587         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
15588         vector.
15589         (Plugin_manager::claim_file): Create plugin object even if
15590         plugin did not call the add_symbols callback.
15591         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
15592         asking for more symbols than were added.
15593         * testsuite/Makefile.am (plugin_test_1): Add test case with
15594         no global symbols.
15595         (empty.syms): New target.
15596         * testsuite/Makefile.in: Regenerate.
15597         * testsuite/plugin_test.c (claim_file_hook): Add new debug
15598         message. Don't call add_symbols if no globals.
15599         (all_symbols_read_hook): Don't provide replacement for empty
15600         claimed file.
15601
15602 2008-12-12  Ian Lance Taylor  <iant@google.com>
15603
15604         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
15605         r_type == 0 for a local symbol with r_sym == 0.
15606         (scan_relocatable_relocs): Pass r_sym to
15607         local_non_section_strategy.
15608         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
15609         r_sym parameter.
15610
15611         * configure.ac: Update test for TLS descriptors: they are
15612         supported as of glibc 2.9.
15613         * configure: Rebuild.
15614
15615 2008-12-11  Ian Lance Taylor  <iant@google.com>
15616
15617         PR 7091
15618         * target-reloc.h (Default_scan_relocatable_relocs): For each
15619         function, map r_type == 0 to RELOC_DISCARD.
15620
15621 2008-12-10  Cary Coutant  <ccoutant@google.com>
15622
15623         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
15624         object to override a kept COMDAT group from a plugin object.
15625
15626 2008-12-09  Ian Lance Taylor  <iant@google.com>
15627
15628         PR 7088
15629         * yyscript.y (file_cmd): Handle INPUT.
15630
15631         * testsuite/initpri1.c: Change all declarations to be full
15632         prototypes by adding void, to avoid compiler warnings.
15633
15634 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
15635
15636         * options.cc (General_options::parse_plugin_opt): New.
15637         (General_options::add_plugin): The argument now is just the filename.
15638         (General_options::add_plugin_option): New.
15639         * options.h (plugin_opt): New.
15640         (add_plugin): Change argument name.
15641         (add_plugin_option): New.
15642         * plugin.cc (Plugin::load): Don't parse the plugin option.
15643         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
15644         (Plugin::add_option): New.
15645         (Plugin::args_): Change type.
15646         (Plugin::filename_): New.
15647         (Plugin_manager::add_plugin_option): New.
15648         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
15649         * testsuite/Makefile.in: Regenerate.
15650
15651 2008-12-05  Cary Coutant  <ccoutant@google.com>
15652
15653         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
15654         Handle --strip-lto-sections option.
15655         * options.h (strip_lto_sections): New option.
15656
15657 2008-12-01  Cary Coutant  <ccoutant@google.com>
15658
15659         * plugin.cc (ld_plugin_message): Change format parameter to const.
15660         Fix mismatch between new[] and delete.
15661
15662 2008-11-14  Cary Coutant  <ccoutant@google.com>
15663
15664         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
15665         instead of -1U.
15666
15667 2008-11-05  Craig Silverstein  <csilvers@google.com>
15668
15669         * options.cc (General_options::parse_dynamic_list): New function.
15670         * options.h (General_options): New flags dynamic_list,
15671         dynamic_list_data, dynamic_list_cpp_new, and
15672         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
15673         (General_options::in_dynamic_list): New function.
15674         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
15675         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
15676         (Lex::can_continue_name): Likewise.
15677         (yylex): Likewise.
15678         (read_script_file): New parameter script_options.
15679         (read_dynamic_list): New function.
15680         (Script_options::define_dynamic_list): New function.
15681         (dynamic_list_keyword_parsecodes): New variable.
15682         (dynamic_list_keywords): New variable.
15683         * script.h (Script_options::define_dynamic_list): New function
15684         prototype.
15685         (read_dynamic_list): New function prototype.
15686         * symtab.cc (strprefix): New macro.
15687         (Symbol::should_add_dynsym_entry): Support dynamic_list,
15688         dynamic_list_data, dynamic_list_cpp_new, and
15689         dynamic_list_cpp_typeinfo.
15690         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
15691         (dynamic_list_expr): New rule.
15692         (dynamic_list_nodes): Likewise.
15693         (dynamic_list_node): Likewise.
15694         * testsuite/Makefile.am (dynamic_list): New test.
15695         * testsuite/Makefile.in: Regenerated.
15696         * testsuite/dynamic_list.t: New file.
15697         * testsuite/dynamic_list.sh: New file.
15698
15699 2008-11-05  Craig Silverstein  <csilvers@google.com>
15700
15701         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
15702         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
15703         (t11_last): Likewise.
15704         * testsuite/ver_test_6.c (main): Likewise.
15705
15706 2008-10-07  Cary Coutant  <ccoutant@google.com>
15707
15708         * options.c (General_options::finalize): Add check for -static and
15709         -shared.
15710         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
15711         is not empty.
15712
15713 2008-10-02  Cary Coutant  <ccoutant@google.com>
15714
15715         * plugin.cc (make_sized_plugin_object): Fix conditional
15716         compilation to work when not all targets are enabled.
15717
15718 2008-09-29  Cary Coutant  <ccoutant@google.com>
15719
15720         * archive.cc (Archive::get_file_and_offset): Use filename instead
15721         of name to get library path.
15722         (Archive::include_member): Unlock external member of a thin archive.
15723
15724         * testsuite/Makefile.am (TEST_AR): New variable.
15725         (thin_archive_test_1): New test.
15726         (thin_archive_test_2): New test.
15727         * testsuite/Makefile.in: Regenerate.
15728         * testsuite/thin_archive_main.cc: New file.
15729         * testsuite/thin_archive_test_1.cc: New file.
15730         * testsuite/thin_archive_test_2.cc: New file.
15731         * testsuite/thin_archive_test_3.cc: New file.
15732         * testsuite/thin_archive_test_4.cc: New file.
15733
15734 2008-09-29  Cary Coutant  <ccoutant@google.com>
15735
15736         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
15737         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
15738         instead of -1U.
15739         (Sized_relobj::do_finalize_local_symbols): Likewise.
15740         (Sized_relobj::map_to_kept_section): Likewise.
15741         * object.h (Sized_relobj::invalid_address): New constant.
15742         (Sized_relobj::do_output_section_offset): Check for invalid_address
15743         and return -1ULL.
15744         * output.cc (Output_reloc::local_section_offset): Use constant
15745         invalid_address instead of -1U.
15746         (Output_reloc::get_address): Likewise.
15747         (Output_section::output_address): Change -1U to -1ULL.
15748         * output.h (Output_reloc::invalid_address): New constant.
15749         * reloc.cc (Sized_relobj::write_sections): Use constant
15750         invalid_address instead of -1U.
15751         (Sized_relobj::relocate_sections): Likewise.
15752         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
15753         values for merge sections.
15754         * target-reloc.h (relocate_for_relocatable): Use constant
15755         invalid_address instead of -1U.
15756
15757 2008-09-19  Cary Coutant  <ccoutant@google.com>
15758
15759         Add plugin functionality for link-time optimization (LTO).
15760         * configure.ac (plugins): Add --enable-plugins option.
15761         * configure: Regenerate.
15762         * config.in: Regenerate.
15763         * Makefile.am (LIBDL): New variable.
15764         (CCFILES): Add plugin.cc.
15765         (HFILES): Add plugin.h.
15766         (ldadd_var): Add LIBDL.
15767         * Makefile.in: Regenerate.
15768
15769         * archive.cc: Include "plugin.h".
15770         (Archive::setup): Don't preread archive symbols when using a plugin.
15771         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
15772         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
15773         files.
15774         (Archive::include_member): Add symbols from plugin objects.
15775         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
15776         * descriptors.cc (Descriptors::open): Check for file descriptors
15777         abandoned by plugins.
15778         (Descriptors::claim_for_plugin): New function.
15779         * descriptors.h (Descriptors::claim_for_plugin): New function.
15780         (Open_descriptor::is_claimed): New field.
15781         (claim_descriptor_for_plugin): New function.
15782         * fileread.cc (File_read::claim_for_plugin): New function.
15783         * fileread.h (File_read::claim_for_plugin): New function.
15784         (File_read::descriptor): New function.
15785         * gold.cc: Include "plugin.h".
15786         (queue_initial_tasks): Add task to call plugin hooks for generating
15787         new object files.
15788         * main.cc: Include "plugin.h".
15789         (main): Load plugin libraries.
15790         * object.h (Pluginobj): Declare.
15791         (Object::pluginobj): New function.
15792         (Object::do_pluginobj): New function.
15793         (Object::set_target): New function.
15794         * options.cc: Include "plugin.h".
15795         (General_options::parse_plugin): New function.
15796         (General_options::General_options): Initialize plugins_ field.
15797         (General_options::add_plugin): New function.
15798         * options.h (Plugin_manager): Declare.
15799         (General_options): Add --plugin option.
15800         (General_options::has_plugins): New function.
15801         (General_options::plugins): New function.
15802         (General_options::add_plugin): New function.
15803         (General_options::plugins_): New field.
15804         * plugin.cc: New file.
15805         * plugin.h: New file.
15806         * readsyms.cc: Include "plugin.h".
15807         (Read_symbols::do_read_symbols): Check for archive before checking
15808         for ELF file.  Call plugin hooks to claim files.
15809         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
15810         from a real object file; force override when processing replacement
15811         files.
15812         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
15813         (Symbol::init_base_object): Likewise.
15814         (Symbol::init_base_output_data): Likewise.
15815         (Symbol::init_base_output_segment): Likewise.
15816         (Symbol::init_base_constant): Likewise.
15817         (Symbol::init_base_undefined): Likewise.
15818         (Symbol::output_section): Assert that object is not a plugin.
15819         (Symbol_table::add_from_pluginobj): New function.
15820         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15821         undefined.
15822         (Symbol_table::sized_write_globals): Likewise.
15823         (Symbol_table::add_from_pluginobj): Instantiate template.
15824         * symtab.h (Sized_pluginobj): Declare.
15825         (Symbol::in_real_elf): New function.
15826         (Symbol::set_in_real_elf): New function.
15827         (Symbol::in_real_elf_): New field.
15828         (Symbol_table::add_from_pluginobj): New function.
15829
15830         * testsuite/Makefile.am (AM_CFLAGS): New variable.
15831         (LIBDL): New variable.
15832         (LDADD): Add LIBDL.
15833         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
15834         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
15835         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
15836         (MOSTLYCLEANFILES): Likewise.
15837         * testsuite/Makefile.in: Regenerate.
15838         * testsuite/plugin_test.c: New file.
15839         * testsuite/plugin_test_1.sh: New file.
15840         * testsuite/plugin_test_2.sh: New file.
15841
15842 2008-09-16  Ian Lance Taylor  <iant@google.com>
15843
15844         * target-reloc.h (relocate_section): Check whether a symbol is
15845         defined by the ABI before reporting an undefined symbol error.
15846         * target.h (Target::is_defined_by_abi): Make parameter const.
15847         (Target::do_is_defined_by_abi): Likewise.
15848         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
15849         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
15850         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
15851         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
15852         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
15853         * testsuite/Makefile.in: Rebuild.
15854
15855         * fileread.cc (make_view): Add casts to avoid warning.
15856
15857 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15858
15859         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
15860         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15861
15862 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15863
15864         * options.h (General_options::output_is_executable): New.
15865         (General_options::output_is_pie): New.
15866         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
15867         for shared libraries.
15868         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15869
15870 2008-09-11  Chris Demetriou  <cgd@google.com>
15871
15872         * options.h (origin): New -z option.
15873         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
15874         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
15875         in DT_FLAGS_1.
15876
15877 2008-09-05  Cary Coutant  <ccoutant@google.com>
15878
15879         * fileread.cc (File_read::make_view): Add check for attempt to map
15880         beyond end of file.
15881
15882 2008-09-05  Cary Coutant  <ccoutant@google.com>
15883
15884         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
15885         explicit instantiations.
15886
15887 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
15888
15889         PR gold/6858
15890         * options.cc (General_options::finalize): Allow undefined symbols
15891         in shlibs if linking -shared.
15892
15893         PR gold/6859
15894         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
15895         symbols as not needing a dynsym entry.
15896
15897 2008-08-20  Craig Silverstein  <csilvers@google.com>
15898
15899         * fileread.cc (File_read::open): Do not lock the file unless it
15900         was successfully opened.
15901
15902 2008-08-14  Cary Coutant  <ccoutant@google.com>
15903
15904         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
15905         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
15906         * testsuite/tls_test.cc (struct int128): 128-bit struct
15907         for testing TLS relocs with non-zero addend.
15908         (v12): New TLS variable.
15909         (t12): New test.
15910         (t_last): Add check for v12.
15911         * testsuite/tls_test.h (t12): New function.
15912         * testsuite/tls_test_main.cc (thread_routine): Call new test.
15913
15914 2008-08-13  Ian Lance Taylor  <iant@google.com>
15915
15916         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
15917         set tls_segment_ or relro_segment_.
15918         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
15919         when appropriate.
15920         * output.h (Output_section::clear_is_relro): New function.
15921         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
15922         sections specially even when output_data_ is empty.
15923         (Output_segment::maximum_alignment): When first section is relro,
15924         only force alignment for PT_LOAD segments.
15925         * script.cc (script_data_segment_align): New function.
15926         (script_data_segment_relro_end): New function.
15927         * script-c.h (script_data_segment_align): Declare.
15928         (script_data_segment_relro_end): Declare.
15929         * script-sections.h (class Script_sections): Declare
15930         data_segment_align and data_segment_relro_end.  Add fields
15931         segment_align_index_ and saw_relro_end_.
15932         * script-sections.cc (class Sections_element): Add set_is_relro
15933         virtual function.  Add new bool* parameter to place_orphan_here.
15934         Add get_output_section virtual function.
15935         (class Output_section_definition): Add set_is_relro.  Add new
15936         bool* parameter to place_orphan_here.  Add get_output_section.
15937         Add is_relro_ field.
15938         (Output_section_definition::Output_section_definition): Initialize
15939         evaluated_address_, evaluated_load_address, evaluated_addralign_,
15940         and is_relro_ fields.
15941         (Output_section_definition::place_orphan_here): Add is_relro
15942         parameter.
15943         (Output_section_definition::set_section_addresses): Set relro for
15944         output section.
15945         (Output_section_definition::alternate_constraint): Likewise.
15946         (class Orphan_output_section): Add new bool* parameter to
15947         place_orphan_here.  Add get_output_section.
15948         (Orphan_output_section::place_orphan_here): Add is_relro
15949         parameter.
15950         (Script_sections::Script_sections): Initialize
15951         data_segment_align_index_ and saw_relro_end_.
15952         (Script_sections::data_segment_align): New function.
15953         (Script_sections::data_segment_relro_end): New function.
15954         (Script_sections::place_orphan): Set or clear is_relro.
15955         (Script_sections::set_section_addresses): Force alignment of first
15956         TLS section.
15957         * yyscript.y (exp): Call script_data_segment_align and
15958         script_data_segment_relro_end.
15959         * testsuite/relro_script_test.t: New file.
15960         * testsuite/relro_test.cc (using_script): Declare.
15961         (t1, t2): Test using_script.
15962         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
15963         (relro_script_test_SOURCES): Define.
15964         (relro_script_test_DEPENDENCIES): Define.
15965         (relro_script_test_LDFLAGS): Define.
15966         (relro_script_test_LDADD): Define.
15967         (relro_script_test.so): New target.
15968         * testsuite/Makefile.in: Rebuild.
15969
15970 2008-08-06  Cary Coutant <ccoutant@google.com>
15971
15972         * archive.cc (Archive::total_archives, Archive::total_members)
15973         (Archive::total_members_loaded): New variables.
15974         (Archive::setup): Add parameter.  Add option to preread
15975         archive symbols.
15976         (Archive::read_armap): Add counter.
15977         (Archive::get_file_and_offset): New function.
15978         (Archive::get_elf_object_for_member): New function.
15979         (Archive::read_all_symbols): New function.
15980         (Archive::read_symbols): New function.
15981         (Archive::add_symbols): Add counters.
15982         (Archive::include_all_members): Use armap to find members if it's
15983         already built.
15984         (Archive::include_member): Skip reading symbols if already read.
15985         Factored code into Archive::get_file_and_offset and
15986         Archive::get_elf_object_for_member.  Changed call to
15987         Mapfile::report_include_archive_member.
15988         (Archive::print_stats): New function.
15989         * archive.h: Declare Object and Read_symbols_data classes.
15990         (Archive::Archive): Add initializers for new members.
15991         (Archive::setup): Add parameter.
15992         (Archive::print_stats): New function.
15993         (Archive::total_archives, Archive::total_members)
15994         (Archive::total_members_loaded): New variables.
15995         (Archive::get_file_and_offset): New function.
15996         (Archive::get_elf_object_for_member): New function.
15997         (Archive::read_all_symbols): New function.
15998         (Archive::read_symbols): New function.
15999         (Archive::Archive_member): New class.
16000         (Archive::members_): New member.
16001         (Archive::num_members_): New member.
16002         * main.cc: Include archive.h.
16003         (main): Call Archive::print_stats.
16004         * mapfile.cc (Mapfile::report_include_archive_member): Delete
16005         archive parameter; member_name is now the fully-decorated name.
16006         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
16007         * options.h: (General_options): Add --preread-archive-symbols option.
16008         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
16009         Archive::setup.
16010
16011 2008-08-04  Ian Lance Taylor  <iant@google.com>
16012
16013         * symtab.h (Symbol::use_plt_offset): New function.
16014         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
16015         * powerpc.cc (Relocate::relocate): Likewise.
16016         * sparc.cc (Relocate::relocate): Likewise.
16017         * x86_64.cc (Relocate::relocate): Likewise.
16018         * testsuite/weak_plt.sh: New test.
16019         * testsuite/weak_plt_main.cc: New test.
16020         * testsuite/weak_plt_shared.cc: New test.
16021         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
16022         (check_PROGRAMS): Add weak_plt.
16023         (check_DATA): Add weak_plt_shared.so.
16024         (weak_plt_main_pic.o, weak_plt): New targets.
16025         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
16026         * testsuite/Makefile.in: Rebuild.
16027
16028         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
16029         gcctestdir/ld.
16030         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
16031         * testsuite/Makefile.in: Rebuild.
16032
16033 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
16034
16035         * Makefile.am (POTFILES.in): Set LC_ALL=C.
16036         * Makefile.in: Regenerate.
16037         * po/POTFILES.in: Regenerate.
16038
16039 2008-07-29  Ian Lance Taylor  <iant@google.com>
16040
16041         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
16042         symbols before other symbols.
16043         * testsuite/script_test_2.cc (test_addr): Declare.
16044         (test_addr_alias): Declare.
16045         (main): Check that test_addr and test_addr_alias have the right
16046         values.
16047         * testsuite/script_test_2.t: Define test_addr_alias and
16048         test_addr.
16049
16050 2008-07-24  Ian Lance Taylor  <iant@google.com>
16051
16052         PR 5990
16053         * descriptors.cc: New file.
16054         * descriptors.h: New file.
16055         * gold-threads.h (class Hold_optional_lock): New class.
16056         * fileread.cc: Include "descriptors.h".
16057         (File_read::~File_read): Release descriptor rather than closing
16058         it.
16059         (File_read::open) [file]: Call open_descriptor rather than open.
16060         Set is_descriptor_opened_.
16061         (File_read::open) [memory]: Assert that descriptor is not open.
16062         (File_read::reopen_descriptor): New function.
16063         (File_read::release): Release descriptor.
16064         (File_read::do_read): Make non-const.  Reopen descriptor.
16065         (File_read::read): Make non-const.
16066         (File_read::make_view): Reopen descriptor.
16067         (File_read::do_readv): Likewise.
16068         * fileread.h (class File_read): Add is_descriptor_opened_ field.
16069         Update declarations.
16070         * layout.cc: Include "descriptors.h".
16071         (Layout::create_build_id): Use open_descriptor rather than open.
16072         * output.cc: Include "descriptors.h".
16073         (Output_file::open): Use open_descriptor rather than open.
16074         * archive.cc (Archive::const_iterator): Change Archive to be
16075         non-const.
16076         (Archive::begin, Archive::end): Make non-const.
16077         (Archive::count_members): Likewise.
16078         * archive.h (class Archive): Update declarations.
16079         * object.h (Object::read): Make non-const.
16080         * Makefile.am (CCFILES): Add descriptors.cc.
16081         (HFILES): Add descriptors.h.
16082         * Makefile.in: Rebuild.
16083
16084         PR 6716
16085         * gold.h: Always include <clocale>.  Add Solaris workarounds
16086         following code in binutils/sysdep.h.
16087
16088         PR 6048
16089         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
16090         this->eh_frame_hdr_ is NULL before using it.
16091
16092         * dynobj.cc (Versions::Versions): Update comment.
16093
16094         * dynobj.cc (Versions::Versions): If there is an soname, use it as
16095         the base version name.
16096
16097         * stringpool.cc (Stringpool_template::add_with_length): Set key to
16098         array size plus one.
16099         (Stringpool_template::set_string_offsets): Subtract one from key
16100         before using it as an array index.
16101         (Stringpool_template::get_offset_with_length): Likewise.
16102         (Stringpool_template::write_to_buffer): Likewise.
16103         * stringpool.h (Stringpool_template::get_offset_from_key):
16104         Likewise.
16105
16106 2008-07-23  Ian Lance Taylor  <iant@google.com>
16107
16108         PR 6658
16109         * object.h (Merged_symbol_value::value): Do our best to handle a
16110         negative addend.
16111
16112         PR 6647
16113         * script.cc (Version_script_info::get_versions): Don't add empty
16114         version tag to return value.
16115         (Version_script_info::get_symbol_version_helper): Change return
16116         type to bool.  Add pversion parameter.  Change all callers.
16117         (script_register_vers_node): Don't require a non-NULL tag.
16118         * script.h (class Version_script_info): Update declarations.
16119         (Version_script_info::get_symbol_version): Change return type to
16120         bool.  Add version parameter.  Change all callers.
16121         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
16122         handling.  Handle an empty version from a version script.
16123         (Symbol_table::define_special_symbol): Likewise.
16124         * testsuite/ver_test_10.script: New file.
16125         * testsuite/ver_test_10.sh: New file.
16126         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
16127         (check_DATA): Add ver_test_10.syms.
16128         (ver_test_10.syms, ver_test_10.so): New target.
16129         * testsuite/Makefile.in: Rebuild.
16130
16131 2008-07-23  Simon Baldwin  <simonb@google.com>
16132
16133         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
16134         to zero for undefined symbols from dynamic libraries.
16135
16136 2008-07-23  Ian Lance Taylor  <iant@google.com>
16137
16138         * symtab.cc (Symbol_table::resolve): Remove version parameter.
16139         Change all callers.
16140         * symtab.h (class Symbol_table): Update declaration.
16141         * testsuite/ver_test_9.cc: New file.
16142         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
16143         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
16144         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
16145         (ver_test_9.so, ver_test_9.o): New targets.
16146         * testsuite/Makefile.in: Rebuild.
16147
16148 2008-07-22  Ian Lance Taylor  <iant@google.com>
16149
16150         * options.h (class General_options): Define --check-sections.
16151         * layout.cc (Layout::set_segment_offsets): Handle
16152         --check-sections.
16153
16154         * options.h (class General_options): Define -n/--nmagic and
16155         -N/--omagic.
16156         * options.cc (General_options::finalize): For -n/--nmagic or
16157         -N/--omagic, set -static.
16158         * layout.cc (Layout::attach_allocated_section_to_segment): If
16159         -N/--omagic, don't put read-only and read-write sections in
16160         different segments.
16161         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
16162         finding a read-only segment.
16163         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
16164         don't set the minimum segment alignment to the common page size,
16165         and don't set the file offset to the address modulo the page size.
16166         * script-sections.cc (Script_sections::create_segments): If
16167         -n/--omagic, don't put read-only and read-write sections in
16168         different segments.
16169
16170         * cref.cc: New file.
16171         * cref.h: New file.
16172         * options.h (class General_options): Add --print-symbol-counts.
16173         * main.cc (main): Issue defined symbol report if requested.
16174         * archive.cc (Archive::interpret_header): Make into a const member
16175         function.
16176         (Archive::add_symbols): Call Input_objects::archive_start and
16177         archive_stop.
16178         (Archive::const_iterator): Define new class.
16179         (Archive::begin, Archive::end): New functions.
16180         (Archive::include_all_members): Rewrite to use iterator.
16181         (Archive::count_members): New function.
16182         * archive.h (class Archive): Update declarations.
16183         (Archive::filename): New function.
16184         * object.cc: Include "cref.h".
16185         (Sized_relobj::Sized_relobj): Initialize defined_count_.
16186         (Sized_relobj::do_get_global_symbol_counts): New function.
16187         (Input_objects::add_object): Add object to cross-referencer.
16188         (Input_objects::archive_start): New function.
16189         (Input_objects::archive_stop): New function.
16190         (Input_objects::print_symbol_counts): New function.
16191         * object.h: Declare Cref and Archive.
16192         (Object::get_global_symbol_counts): New function.
16193         (Object::do_get_global_symbol_counts): New pure virtual function.
16194         (class Sized_relobj): Add defined_count_ field.  Update
16195         declarations.
16196         (class Input_objects): Add cref_ field.  Update constructor.
16197         Update declarations.
16198         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
16199         defined_count_.
16200         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
16201         symbol counts.
16202         (Sized_dynobj::do_get_global_symbol_counts): New function.
16203         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
16204         defined_count_.  Update declarations.  Define Symbols typedef.
16205         * symtab.cc (Symbol_table::add_from_relobj): Add defined
16206         parameter.  Change all callers.
16207         (Symbol_table::add_from_dynobj): Add sympointers and defined
16208         parameters.  Change all callers.
16209         * symtab.h (class Symbol_table): Update declarations.
16210         * Makefile.am (CCFILES): Add cref.cc.
16211         (HFILES): Add cref.h.
16212         * Makefile.in: Rebuild.
16213
16214 2008-07-22  Simon Baldwin  <simonb@google.com>
16215
16216         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
16217         to zero when writing undefined symbols.
16218
16219 2008-07-22  Ian Lance Taylor  <iant@google.com>
16220
16221         * output.cc (Output_section::add_input_section): Don't try to
16222         merge empty merge sections.
16223
16224 2008-07-21  Craig Silverstein  <csilvers@google.com>
16225
16226         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
16227         Include symbol version in error message.
16228
16229 2008-07-20  Chris Demetriou  <cgd@google.com>
16230
16231         * configure.ac (gold_cv_c_random_seed): New configured variable.
16232         (RANDOM_SEED_CFLAGS): New substituted variable.
16233         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
16234         * configure: Rebuild.
16235         * Makefile.in: Likewise.
16236         * testsuite/Makefile.in: Likewise.
16237
16238 2008-07-18  Ian Lance Taylor  <iant@google.com>
16239
16240         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
16241         where we see NAME/NULL and NAME/VERSION  as separate symbols.
16242         * testsuite/ver_test_main.cc (main): Call t4.
16243         (t4, t4_2a): Define.
16244         * testsuite/ver_test_2.cc (t4_2): Define.
16245         * testsuite/ver_test_2.script: Put t4_2a in VER2.
16246         * testsuite/ver_test_4.cc (t4_2a): Define.
16247         * testsuite/ver_test_4.script: Put t4_2a in VER2.
16248         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
16249
16250 2008-07-17  Ian Lance Taylor  <iant@google.com>
16251
16252         * dynobj.cc (Versions::add_def): If we give an error about a
16253         missing version, go ahead and create the version anyhow.
16254
16255 2008-07-10  Ian Lance Taylor  <iant@google.com>
16256
16257         Handle output sections with more than 0x7fffffff bytes.
16258         * object.h (class Relobj): Change map_to_output_ to
16259         output_sections_, and just keep a section pointer.  Change all
16260         uses.  Move comdat group support to Sized_relobj.
16261         (Relobj::is_section_specially_mapped): Remove.
16262         (Relobj::output_section): Remove poff parameter.  Change all
16263         callers.
16264         (Relobj::output_section_offset): New function.
16265         (Relobj::set_section_offset): Rewrite.
16266         (Relobj::map_to_output): Remove.
16267         (Relobj::output_sections): New function.
16268         (Relobj::do_output_section_offset): New pure virtual function.
16269         (Relobj::do_set_section_offset): Likewise.
16270         (class Sized_relobj): Add section_offsets_ field.  Add comdat
16271         group support from Relobj.  Update declarations.
16272         (Sized_relobj::get_output_section_offset): New function.
16273         (Sized_relobj::do_output_section_offset): New function.
16274         (Sized_relobj::do_set_section_offset): New function.
16275         * object.cc (Relobj::output_section_address): Remove.
16276         (Sized_relobj::Sized_relobj): Initialize new fields.
16277         (Sized_relobj::include_section_group): Cast find_kept_object to
16278         Sized_relobj.
16279         (Sized_relobj::include_linkonce_section): Likewise.
16280         (Sized_relobj::do_layout): Use separate arrays for output section
16281         and output offset.
16282         (Sized_relobj::do_count_local_symbols): Change map_to_output to
16283         output_sections.
16284         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
16285         output_sections and section_offsets.
16286         (Sized_relobj::write_local_symbols): Likewise.
16287         (map_to_kept_section): Compute output address directly.
16288         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
16289         output_sections and section_offsets.
16290         (Sized_relobj::write_sections): Likewise.
16291         (Sized_relobj::relocate_sections): Likewise.
16292         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
16293         * output.h (class Output_reloc): Update declarations.  Change
16294         u2_.relobj to Sized_relobj*.
16295         (class Output_data_reloc): Change add functions to use
16296         Sized_relobj*.
16297         * output.cc (Output_reloc::Output_reloc): Change relobj to
16298         Sized_relobj*.
16299         (Output_reloc::local_section_offset): Change return type to
16300         Elf_Addr.  Use get_output_section_offset.
16301         (Output_reloc::get_address): Likewise.
16302         (Output_section::is_input_address_mapped): Don't call
16303         is_section_specially_mapped.
16304         (Output_section::output_offset): Likewise.
16305         (Output_section::output_address): Likewise.
16306         (Output_section::starting_output_address): Likewise.
16307         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
16308         parameter to Sized_relobj*.
16309         (Copy_relocs::need_copy_reloc): Likewise.
16310         (Copy_relocs::save): Likewise.
16311         * copy-relocs.h (class Copy_relocs): Update declarations.
16312         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
16313         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
16314         * target-reloc.h (relocate_for_relocatable): Change
16315         offset_in_output_section type to Elf_Addr.  Change code that uses
16316         it as well.
16317         * layout.cc (Layout::layout): Always set *off.
16318         * mapfile.cc (Mapfile::print_input_section): Use
16319         output_section_offset.
16320         * i386.cc (Target_i386::copy_reloc): Change object parameter to
16321         Sized_relobj*.
16322         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
16323         * sparc.cc (Target_sparc::copy_reloc): Likewise.
16324         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
16325
16326 2008-07-03  Ian Lance Taylor  <iant@google.com>
16327
16328         * layout.cc (Layout::include_section): Do not discard unrecognized
16329         SHT_STRTAB sections.
16330
16331 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
16332
16333         * script.cc (Lex::can_continue_name): Make '?' allowable in
16334         version-script names.
16335         * testsuite/version_script.map: Change glob pattern to use '?'
16336
16337 2008-06-30  Manish Singh  <yosh@gimp.org>
16338
16339         PR 6585
16340         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
16341         Correct typo.
16342
16343 2008-06-30  Ian Lance Taylor  <iant@google.com>
16344
16345         PR 6660
16346         PR 6682
16347         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
16348         versions]: Don't try to read the value in the contents, since we
16349         don't use it.  Use the template endianness when writing.
16350
16351 2008-06-25  Cary Coutant  <ccoutant@google.com>
16352
16353         * fileread.cc (File_read::make_view): Assert on zero-length view.
16354         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
16355         symbol table when there are no symbols to read.
16356
16357 2008-06-23  Craig Silverstein  <csilvers@google.com>
16358
16359         * version.cc (version_string): Bump to 1.7
16360
16361 2008-06-18  Craig Silverstein  <csilvers@google.com>
16362
16363         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
16364         constant 0xFFFF to type Valtype.
16365         (Powerpc_relocate_functions::rel16_ha): Likewise.
16366
16367 2008-06-17  Ian Lance Taylor  <iant@google.com>
16368
16369         * output.h (Output_section::Input_section): Initialize p2align_ to
16370         zero for Output_section_data constructors.
16371         (Output_section::Input_section::addralign): If not an input
16372         section, return the alignment of the Output_section_data.
16373         * testsuite/copy_test.cc: New file.
16374         * testsuite/copy_test_1.cc: New file.
16375         * testsuite/copy_test_2.cc: New file.
16376         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
16377         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
16378         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
16379         (copy_test_1_pic.o, copy_test_1.so): New targets.
16380         (copy_test_2_pic.o, copy_test_2.so): New targets.
16381         * testsuite/Makefile.in: Rebuild.
16382
16383         * script-sections.cc (Script_sections::place_orphan): Initialize
16384         local variable exact.
16385
16386 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
16387
16388         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
16389
16390 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
16391             David S. Miller  <davem@davemloft.net>
16392
16393         * powerpc.cc: New file.
16394         * Makefile.am (TARGETSOURCES): Add powerpc.cc
16395         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
16396         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
16397         * Makefile.in: Rebuild.
16398
16399 2008-06-09  Ian Lance Taylor  <iant@google.com>
16400
16401         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
16402         <exception>.
16403         (throwing, orig_terminate): New static variables.
16404         (terminate_handler): New static function.
16405         (t2): Set terminate handler.
16406
16407 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
16408
16409         PR 6584
16410         * binary.cc (Binary_to_elf::sized_convert): Fix .data
16411         alignment.
16412
16413 2008-05-30  Cary Coutant  <ccoutant@google.com>
16414
16415         * archive.cc (Archive::include_all_members) Correct to step
16416         over symbol table and extended name table in thin archives.
16417
16418 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
16419
16420         PR 6407
16421         * target-reloc.h (relocate_for_relocatable): Fix new_offset
16422         calculation.
16423
16424 2008-05-28  Caleb Howe  <cshowe@google.com>
16425
16426         * reduced_debug_output.cc: New file.
16427         * reduced_debug_output.h: New file.
16428         * options.h (class General_options): Add --strip-debug-non-line.
16429         * options.cc (General_options::finalize): Add strip_debug_non_line
16430         to the strip heirarchy.
16431         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
16432         fields.
16433         * layout.cc: Include "reduced_debug_output.h".
16434         (Layout::Layout): Initialize new fields.
16435         (line_only_debug_sections): New static array.
16436         (is_lines_only_debug_sections): New static inline function.
16437         (Layout::include_section): Handle --strip-debug-non-line.
16438         (Layout::make_output_section): If --strip-debug-non-line, build
16439         new output sections for .debug_abbrev and .debug_info.
16440         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
16441         gold.  Warn about possible overflow.
16442         (read_signed_LEB_128): Likewise.
16443         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
16444         (read_signed_LEB_128): Declare.
16445         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
16446         (HFILES): Add reduced_debug_output.h.
16447         * Makefile.in: Rebuild.
16448
16449 2008-05-21  Ian Lance Taylor  <iant@google.com>
16450
16451         * mapfile.cc: New file.
16452         * mapfile.h: New file.
16453         * options.h (class General_options): Add -M/--print-map and -Map.
16454         * options.cc (General_options::finalize): Make -M equivalent to
16455         -Map -.
16456         * main.cc: Include <cstdio> and "mapfile.h".
16457         (main): Open mapfile if requested.
16458         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
16459         constructor.  Change caller.
16460         (queue_initial_tasks): Add mapfile parameter.  Change caller.
16461         (queue_middle_tasks): Likewise.
16462         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
16463         declarations.
16464         * archive.cc: Include "mapfile.h".
16465         (Archive::add_symbols): Add mapfile parameter.  Change all
16466         callers.  Pass mapfile, symbol, and reason to include_member.
16467         (Archive::include_all_members): Add mapfile parameter.  Change all
16468         callers.
16469         (Archive::include_member): Add mapfile, sym, and why parameters.
16470         Change all callers.  Report inclusion to map file.
16471         * archive.h: Include "fileread.h".
16472         (class Archive): Update declarations.
16473         (Archive::file): New const method.
16474         (class Add_archive_symbols): Add mapfile_ field.  Update
16475         constructor.  Change all callers.
16476         * readsyms.h (class Read_symbols): Likewise.
16477         (class Finish_group): Likewise.
16478         (class Read_script): Likewise.
16479         * common.cc: Include "mapfile.h".
16480         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
16481         all callers.
16482         (Symbol_table::do_allocate_commons): Likewise.
16483         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
16484         symbol allocation to mapfile.
16485         * common.h (class Allocate_commons_task): Add mapfile_ field.
16486         Update constructor.  Change all callers.
16487         * symtab.h (class Symbol_table): Update declarations.
16488         * layout.cc: Include "mapfile.h".
16489         (Layout_task_runner::run): Print information to mapfile.
16490         (Layout::create_gold_note): Change Output_data_fixed_space to
16491         Output_data_zero_fill.
16492         (Layout::create_build_id): Likewise.
16493         (Layout::print_to_mapfile): New function.
16494         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
16495         constructor.  Change caller.
16496         (class Layout): Declare print_to_mapfile.
16497         * output.cc (Output_section::Input_section::print_to_mapfile): New
16498         function.
16499         (Output_section::add_input_section): If producing a map, always
16500         add to input_sections_ list.
16501         (Output_section::do_print_to_mapfile): New function.
16502         (Output_segment::print_sections_to_mapfile): New function.
16503         (Output_segment::print_section_list_to_mapfile): New function.
16504         * output.h: Include "mapfile.h".
16505         (Output_data::print_to_mapfile): New function.
16506         (Output_data::do_print_to_mapfile): New virtual function.
16507         (Output_segment_headers::do_print_to_mapfile): New function.
16508         (Output_file_header::do_print_to_mapfile): New function.
16509         (Output_data_const::do_print_to_mapfile): New function.
16510         (class Output_data_const_buffer): Add map_name_ field.  Update
16511         constructor.  Change all callers.  Add do_print_to_mapfile
16512         function.
16513         (class Output_data_fixed_space): Likewise.
16514         (class Output_data_space): Likewise.
16515         (class Output_data_zero_fill): New class.
16516         (Output_data_strtab::do_print_to_mapfile): New function.
16517         (Output_data_reloc_base::do_print_to_mapfile): New function.
16518         (Output_relocatable_relocs::do_print_to_mapfile): New function.
16519         (Output_data_group::do_print_to_mapfile): New function.
16520         (Output_data_got::do_print_to_mapfile): New function.
16521         (Output_data_dynamic::do_print_to_mapfile): New function.
16522         (Output_symtab_xindex::do_print_to_mapfile): New function.
16523         (class Output_section): Declare do_print_to_mapflie.  Declare
16524         print_to_mapfile in Input_section.
16525         (class Output_segment): Declare new functions.
16526         * object.h (Sized_relobj::symbol_count): New function.
16527         * script-sections.cc
16528         (Output_section_element_dot_assignment::set_section_addresses):
16529         Change Output_data_fixed_space to Output_data_zero_fill.
16530         (Output_data_expression::do_print_to_mapfile): New function.
16531         * script.cc (read_input_script): Add mapfile parameter.  Change
16532         all callers.
16533         * script.h (read_input_script): Update declaration.
16534         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
16535         (Eh_frame::do_print_to_mapfile): New function.
16536         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
16537         (Output_merge_string::do_print_to_mapfile): New function.
16538         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
16539         function.
16540         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
16541         function.
16542         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
16543         function.
16544         * Makefile.am (CCFILES): Add mapfile.cc.
16545         (HFILES): Add mapfile.h.
16546         * Makefile.in: Rebuild.
16547
16548 2008-05-19  Ian Lance Taylor  <iant@google.com>
16549
16550         * options.h (class General_options): Add -z relro.
16551         * layout.cc (Layout::Layout): Initialize relro_segment_.
16552         (Layout::add_output_section_data): Return the output section.
16553         (Layout::make_output_section): Rcognize relro sections and mark
16554         them appropriately.
16555         (Layout::attach_allocated_section_to_segment): Put relro sections
16556         in a PT_GNU_RELRO segment.
16557         (Layout::create_initial_dynamic_sections): Mark the .dynamic
16558         section as relro.
16559         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
16560         PT_TLS segments.
16561         (Layout::linkonce_mapping): Map d.rel.ro.local to
16562         .data.rel.ro.local.
16563         (Layout::output_section_name): Us .data.rel.ro.local for any
16564         section which begins with that.
16565         * layout.h (class Layout): Update add_output_section_data
16566         declaration.  Add relro_segment_ field.
16567         * output.cc (Output_section::Output_section): Initialize is_relro_
16568         and is_relro_local_ fields.
16569         (Output_segment::add_output_section): Group relro sections.
16570         (Output_segment::is_first_section_relro): New function.
16571         (Output_segment::maximum_alignment): If there is a relro section,
16572         align the segment to the common page size.
16573         (Output_segment::set_section_addresses): Track whether we are
16574         looking at relro sections.  If the last section is a relro
16575         section, align to the common page size.
16576         (Output_segment::set_section_list_addresses): Add in_relro
16577         parameter.  Change all callers.  Align to the page size when
16578         moving from relro to non-relro section.
16579         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
16580         segment.
16581         * output.h (class Output_section): Add is_relro_ and
16582         is_relro_local_ fields.
16583         (Output_section::is_relro): New function.
16584         (Output_section::set_is_relro): New function.
16585         (Output_section::is_relro_local): New function.
16586         (Output_section::set_is_relro_local): New function.
16587         (class Output_segment): Update declarations.
16588         * i386.cc (Target_i386::got_section): Mark .got section as relro.
16589         * sparc.cc (Target_sparc::got_section): Likewise.
16590         * x86_64.cc (Target_x86_64::got_section): Likewise.
16591         * testsuite/relro_test_main.cc: New file.
16592         * testsuite/relro_test.cc: New file.
16593         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
16594         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
16595         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
16596         (relro_test.so, relro_test_pic.o): New targets.
16597         * testsuite/Makefile.in: Rebuild.
16598
16599 2008-05-16  Ian Lance Taylor  <iant@google.com>
16600
16601         * output.cc (Output_segment::add_output_section): Remove front
16602         parameter.
16603         * output.h (class Output_segment): Remove
16604         add_initial_output_section and overloaded add_output_section.
16605         Update declaration of remaining add_output_section.
16606         * layout.cc (Layout::create_interp): Call add_output_section
16607         rather than add_initial_output_section.
16608         (Layout::finish_dynamic_section): Likewise.
16609
16610         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
16611         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
16612         know the dynamic type.
16613         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
16614         field.  Initialize it in constructor.
16615         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
16616         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
16617         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
16618         reloc.
16619
16620         * output.cc (Output_reloc::get_address): Change return type to
16621         Elf_Addr.
16622         * output.h (class Output_reloc): Update get_address declaration.
16623         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
16624         for section addresses.
16625
16626 2008-05-09  Ian Lance Taylor  <iant@google.com>
16627
16628         PR 6493
16629         * gold.cc (gold_nomem): Use return value of write.
16630
16631 2008-05-08  Ian Lance Taylor  <iant@google.com>
16632
16633         * symtab.c (Symbol::init_base_output_data): Add version
16634         parameter.  Change all callers.
16635         (Symbol::init_base_output_segment): Likewise.
16636         (Symbol::init_base_constant): Likewise.
16637         (Symbol::init_base_undefined): Likewise.
16638         (Sized_symbol::init_output_data): Likewise.
16639         (Sized_symbol::init_output_segment): Likewise.
16640         (Sized_symbol::init_constant): Likewise.
16641         (Sized_symbol::init_undefined): Likewise.
16642         (Symbol_table::do_define_in_output_data): If the new symbol has a
16643         version, mark it as the default.
16644         (Symbol_table::do_define_in_output_segment): Likewise.
16645         (Symbol_table::do_define_as_constant): Likewise.
16646         * symtab.h (class Symbol): Update declarations.
16647         (class Sized_symbol): Likewise.
16648         * resolve.cc (Symbol::override_version): New function.
16649         (Symbol::override_base): Call override_version.
16650         (Symbol::override_base_with_special): Likewise.
16651         * testsuite/ver_script_8.script: New file.
16652         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
16653         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
16654         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
16655         (ver_test_8_1.so, ver_test_8_2.so): New targets.
16656
16657 2008-05-06  Ian Lance Taylor  <iant@google.com>
16658
16659         PR 6049
16660         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
16661         functions.
16662         (class General_options): Remove existing --undefined, and add
16663         --no-undefined instead.  Add new --undefined as synonym for -u.
16664         * archive.cc (Archive::add_symbols): Check whether symbol was
16665         named with -u.
16666         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
16667         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
16668         all uses.  Add IS_UNDEFINED.  Update declarations to split
16669         different versions of init_base.  Declare init_base_undefined.
16670         (Symbol::is_defined): Handle IS_UNDEFINED.
16671         (Symbol::is_undefined): Likewise.
16672         (Symbol::is_weak_undefined): Call is_undefined.
16673         (Symbol::is_absolute): Handle IS_CONSTANT.
16674         (class Sized_symbol): Update declarations to split different
16675         versions of init.  Declare init_undefined.
16676         (class Symbol_table): Declare new functions.
16677         * symtab.cc (Symbol::init_base_object): Rename from init_base.
16678         Change all callers.
16679         (Symbol::init_base_output_data): Likewise.
16680         (Symbol::init_base_output_segment): Likewise.
16681         (Symbol::init_base_constant): Likewise.
16682         (Symbol::init_base_undefined): New function.
16683         (Sized_symbol::init_object): Rename from init.  Change all
16684         callers.
16685         (Sized_symbol::init_output_data): Likewise.
16686         (Sized_symbol::init_output_segment): Likewise.
16687         (Sized_symbol::init_constant): Likewise.
16688         (Sized_symbol::init_undefined): New function.
16689         (Symbol_table::add_undefined_symbols_from_command_line): New
16690         function.
16691         (Symbol_table::do_add_undefined_symbols_from_command_line): New
16692         function.
16693         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
16694         (Symbol::output_section): Likewise.
16695         (Symbol::set_output_section): Likewise.
16696         (Symbol_table::sized_finalize_symbol): Likewise.
16697         (Symbol_table::sized_write_globals): Likewise.
16698         * resolve.cc (Symbol_table::should_override): Likewise.
16699         (Symbol::override_base_with_special): Likewise.
16700
16701         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
16702         symbol, change it to have default visibility.
16703         * testsuite/protected_1.cc: New file.
16704         * testsuite/protected_2.cc: New file.
16705         * testsuite/protected_3.cc: New file.
16706         * testsuite/protected_main_1.cc: New file.
16707         * testsuite/protected_main_2.cc: New file.
16708         * testsuite/protected_main_3.cc: New file.
16709         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
16710         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
16711         (protected_1_LDFLAGS, protected_1_LDADD): Define.
16712         (protected_1.so): New target.
16713         (protected_1_pic.o, protected_2_pic.o): New targets.
16714         (protected_3_pic.o): New target.
16715         (check_PROGRAMS): Add protected_2.
16716         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
16717         (protected_2_LDFLAGS, protected_2_LDADD): Define.
16718         * testsuite/Makefile.in: Rebuild.
16719
16720         * options.h (DEFINE_var): Add set_user_set_##varname__.
16721         (DEFINE_bool_alias): New macro.
16722         (class General_options): Define -Bstatic using DEFINE_bool_alias
16723         rather than DEFINE_special.  Add --undefined as an alias for -z
16724         defs.
16725         * options.cc (General_options::parse_Bstatic): Remove.
16726
16727         * options.h (class General_options): Add --fatal-warnings.
16728         * main.cc (main): Implement --fatal-warnings.
16729         * errors.h (Errors::warning_count): New function.
16730
16731         * options.h (class General_options): Add -Bsymbolic-functions.
16732         * symtab.h (Symbol::is_preemptible): Check for
16733         -Bsymbolic-functions.
16734
16735 2008-05-05  Ian Lance Taylor  <iant@google.com>
16736
16737         * options.h (DEFINE_bool): For DASH_Z, create the negative option
16738         as noVARNAME rather than no-VARNAME.
16739         (class General_options): Add option -z combreloc.
16740         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
16741         get_address.
16742         (Output_reloc::sort_before) [SHT_REL]: New function.
16743         (Output_reloc::sort_before) [SHT_RELA]: New function.
16744         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
16745         Sort_relocs_comparison.
16746         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
16747         parameter.  Change all callers.
16748         (Output_data_reloc::Output_data_reloc) [both versions]: Add
16749         sort_relocs parameter.  Change all callers.
16750         * output.cc (Output_reloc::get_address): New function, broken out
16751         of write_rel.
16752         (Output_reloc::write_rel): Call it.
16753         (Output_reloc::compare): New function.
16754         (Output_data_reloc_base::do_write): Optionally sort relocs.
16755
16756         * configure.ac: If targ_extra_obj is set, link it in.
16757         * configure.tgt: Initialize all variables.
16758         (x86_64*): Set targ_extra_obj and targ_extra_size.
16759         * configure: Rebuild.
16760
16761         * object.cc (Sized_relobj::include_section_group): Adjust section
16762         indexes read from group data.  Build vector to pass to
16763         layout_group.
16764         * layout.cc (Layout::layout_group): Add flags and shndxes
16765         parameters.  Remove contents parameter.  Change caller.  Update
16766         explicit instantiations.
16767         * layout.h (class Layout): Update layout_group declaration.
16768         * output.cc (Output_data_group::Output_data_group): Add flags and
16769         input_shndxes parameters.  Remove contents parameter.  Change
16770         caller.
16771         (Output_data_group::do_write): Change input_sections_ to
16772         input_shndxes_.
16773         * output.h (class Output_data_group): Update constructor
16774         declaration.  Rename input_sections_ to input_shndxes_.
16775         * testsuite/many_sections_test.cc: Add template.
16776
16777 2008-04-30  Cary Coutant  <ccoutant@google.com>
16778
16779         * target-reloc.h (relocate_section): Fix dead-pointer bug.
16780
16781         * layout.cc (Layout::include_section): Refactored check for debug
16782         info section.
16783         (Layout::add_comdat): Add new parameters.  Change type
16784         of signature parameter.  Add object and shndx to signatures table.
16785         (Layout::find_kept_object): New function.
16786         * layout.h: Include <cstring>.
16787         (Layout::is_debug_info_section): New function.
16788         (Layout::add_comdat): Add new parameters.
16789         (Layout::find_kept_object): New function.
16790         (Layout::Kept_section): New struct.
16791         (Layout::Signatures): Change type of map range.
16792         * object.cc (Relobj::output_section_address): New function.
16793         (Sized_relobj::include_section_group): Add new parameters.  Change
16794         calls to Layout::add_comdat.  Change to build table of kept comdat
16795         groups and table mapping discarded sections to kept sections.
16796         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
16797         (Sized_relobj::do_layout): Change calls to include_section_group and
16798         include_linkonce_section.
16799         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
16800         value to zero when section is discarded.
16801         (Sized_relobj::map_to_kept_section): New function.
16802         * object.h (Relobj::output_section_address): New function.
16803         (Relobj::Comdat_group): New type.
16804         (Relobj::find_comdat_group): New function.
16805         (Relobj::Comdat_group_table): New type.
16806         (Relobj::Kept_comdat_section): New type.
16807         (Relobj::Kept_comdat_section_table): New type.
16808         (Relobj::add_comdat_group): New function.
16809         (Relobj::set_kept_comdat_section): New function.
16810         (Relobj::get_kept_comdat_section): New function.
16811         (Relobj::comdat_groups_): New field.
16812         (Relobj::kept_comdat_sections_): New field.
16813         (Symbol_value::input_value): Update comment.
16814         (Sized_relobj::map_to_kept_section) New function.
16815         (Sized_relobj::include_linkonce_section): Add new parameter.
16816         * target-reloc.h (Comdat_behavior): New type.
16817         (get_comdat_behavior): New function.
16818         (relocate_section): Add code to map a discarded section to the
16819         corresponding kept section when applying a relocation.
16820
16821 2008-04-30  Craig Silverstein  <csilvers@google.com>
16822
16823         * dwarf_reader.cc (next_generation_count): New static var.
16824         (Addr2line_cache_entry): New struct.
16825         (addr2line_cache): New static var.
16826         (Dwarf_line_info::one_addr2line): Added caching.
16827         (Dwarf_line_info::clear_addr2line_cache): New function.
16828         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
16829         cache-size parameter.
16830         (Dwarf_line_info::one_addr2line_cache): New function.
16831         * symtab.cc (Symbol_table::detect_odr_violations): Pass
16832         new cache-size argument to one_addr2line(), and clear cache.
16833
16834 2008-04-28  Cary Coutant  <ccoutant@google.com>
16835
16836         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
16837         R_386_PC8 relocations.
16838
16839 2008-04-23  Ian Lance Taylor  <iant@google.com>
16840
16841         * object.cc (Sized_relobj::include_section_group): Check for
16842         invalid section group.
16843
16844         * object.cc (make_elf_object): Correct test for 64-bit ELF file
16845         header size.
16846
16847         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
16848         than read for file header.
16849         * archive.cc (Archive::include_member): Likewise.
16850
16851 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
16852
16853         * aclocal.m4: Regenerate.
16854         * configure: Regenerate.
16855
16856 2008-04-19  Ian Lance Taylor  <iant@google.com>
16857
16858         * version.cc (version_string): Bump to 1.6.
16859
16860         * testsuite/Makefile.am (many_sections_r_test): New target.
16861         (many_sections_r_test_SOURCES): Remove.
16862         (many_sections_r_test_DEPENDENCIES): Remove.
16863         (many_sections_r_test_LDFLAGS): Remove.
16864         (many_sections_r_test_LDADD): Remove.
16865
16866         * object.cc (Sized_relobj::do_add_symbols): Always pass
16867         local_symbol_count_ to add_from_relobj.
16868
16869         * testsuite/Makefile.am (many_sections_check.h): Only check one in
16870         every thousand variables.
16871         * testsuite/Makefile.in: Rebuild.
16872
16873         * object.cc (Xindex::initialize_symtab_xindex): New function.
16874         (Xindex::read_symtab_xindex): New function.
16875         (Xindex::sym_xindex_to_shndx): New function.
16876         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
16877         available.
16878         (Sized_relobj::do_initialize_xindex): New function.
16879         (Sized_relobj::do_read_symbols): Adjust section links.
16880         (Sized_relobj::symbol_section_and_value): Add is_ordinary
16881         parameter.  Change all callers.
16882         (Sized_relobj::include_section_group): Adjust section links and
16883         symbol section indexes.
16884         (Sized_relobj::do_layout): Adjust section links.
16885         (Sized_relobj::do_count_local_symbols): Adjust section links and
16886         symbol section indexes.
16887         (Sized_relobj::do_finalize_local_symbols): Distinguish between
16888         ordinary and special symbols.
16889         (Sized_relobj::write_local_symbols): Add symtab_xindex and
16890         dynsym_xindex parameters.  Change all callers.  Adjust section
16891         links.  Use SHN_XINDEX when needed.
16892         (Sized_relobj::get_symbol_location_info): Adjust section links.
16893         Don't get fooled by special symbols.
16894         * object.h (class Xindex): Define.
16895         (class Object): Add xindex_ parameter.  Declare virtual functoin
16896         do_initialize_xindex.
16897         (Object::adjust_sym_shndx): New function.
16898         (Object::set_xindex): New protected function.
16899         (class Symbol_value): Add is_ordinary_shndx_ field.
16900         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
16901         (Symbol_value::value): Assert ordinary section.
16902         (Symbol_value::initialize_input_to_output_map): Likewise.
16903         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
16904         Change all callers.
16905         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
16906         all callers.
16907         (class Sized_relobj): Update declarations.
16908         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
16909         parameter.  Change all callers.
16910         (Sized_relobj::adjust_shndx): New function.
16911         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
16912         field.
16913         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
16914         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
16915         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
16916         (Sized_dynobj::read_dynsym_section): Adjust section links.
16917         (Sized_dynobj::read_dynamic): Likewise.
16918         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
16919         section links.
16920         (Sized_dynobj::do_initialize_xindex): New function.
16921         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
16922         do_initialize_xindex.
16923         (Sized_dynobj::adjust_shndx): New function.
16924         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
16925         dynsym_xindex_ fields.
16926         (Layout::finalize): Add a call to set_section_indexes before
16927         creating the symtab sections.
16928         (Layout::set_section_indexes): Don't do anything if the section
16929         already has a section index.
16930         (Layout::create_symtab_sections): Add shnum parameter.  Change
16931         caller.  Create .symtab_shndx section if needed.
16932         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
16933         caller.
16934         (Layout::allocated_output_section_count): New function.
16935         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
16936         needed.
16937         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
16938         fields.  Update declarations.
16939         (Layout::symtab_xindex): New function.
16940         (Layout::dynsym_xindex): New function.
16941         (class Write_symbols_task): Add layout_ field.
16942         (Write_symbols_task::Write_symbols_task): Add layout parameter.
16943         Change caller.
16944         * output.cc (Output_section_headers::Output_section_headers): Add
16945         shstrtab_section parameter.  Change all callers.
16946         (Output_section_headers::do_sized_write): Store overflow values
16947         for section count and section string table section index in
16948         section header zero.
16949         (Output_file_header::do_sized_write): Check for overflow of
16950         section count and section string table section index.
16951         (Output_symtab_xindex::do_write): New function.
16952         (Output_symtab_xindex::endian_do_write): New function.
16953         * output.h (class Output_section_headers): Add shstrtab_section_.
16954         Update declarations.
16955         (class Output_symtab_xindex): Define.
16956         (Output_section::has_out_shndx): New function.
16957         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
16958         field.
16959         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
16960         Change all callers.
16961         (Sized_symbol::init): Likewise.
16962         (Symbol::output_section): Check for ordinary symbol.
16963         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
16964         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
16965         callers.
16966         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
16967         Change all callers.  Simplify handling of symbols from sections
16968         not included in the link.
16969         (Symbol_table::add_from_dynobj): Handle ordinary symbol
16970         distinction.
16971         (Weak_alias_sorter::operator()): Assert that symbols are
16972         ordinary.
16973         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
16974         distinction.
16975         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
16976         parameters.  Change all callers.
16977         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
16978         symbol distinction.  Use SHN_XINDEX when needed.
16979         (Symbol_table::write_section_symbol): Add symtab_xindex
16980         parameter.  Change all callers.
16981         (Symbol_table::sized_write_section_symbol): Likewise.  Use
16982         SHN_XINDEX when needed.
16983         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
16984         declarations.
16985         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
16986         (Symbol::is_defined): Check is_ordinary.
16987         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
16988         (Symbol::is_absolute, Symbol::is_common): Likewise.
16989         (class Sized_symbol): Update declarations.
16990         (class Symbol_table): Update declarations.
16991         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
16992         parameters.  Change all callers.
16993         (Sized_symbol::override): Likewise.
16994         (Symbol_table::override): Likewise.
16995         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
16996         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
16997         is_ordinary, and orig_st_shndx parameters.  Change all callers.
16998         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
16999         to be in an ordinary section.
17000         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
17001         object and is_ordinary parameters.  Change all callers.
17002         (Sized_dwarf_line_info::read_relocs): Add object parameter.
17003         Change all callers.  Don't add undefined or non-ordinary symbols
17004         to reloc_map_.
17005         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
17006         Change all callers.
17007         * dwarf_reader.h (class Sized_dwarf_line_info): Update
17008         declarations.
17009         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
17010         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
17011         (Sized_relobj::relocate_sections): Likewise.
17012         * target-reloc.h (scan_relocs): Adjust section symbol index.
17013         (scan_relocatable_relocs): Likewise.
17014         * i386.cc (Scan::local): Check for ordinary symbols.
17015         * sparc.cc (Scan::local): Likewise.
17016         * x86_64.cc (Scan::local): Likewise.
17017         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
17018         to symbol_section_and_value.
17019         * testsuite/many_sections_test.cc: New file.
17020         * testsuite/Makefile.am (BUILT_SOURCES): Define.
17021         (check_PROGRAMS): Add many_sections_test.
17022         (many_sections_test_SOURCES): Define.
17023         (many_sections_test_DEPENDENCIES): Define.
17024         (many_sections_test_LDFLAGS): Define.
17025         (BUILT_SOURCES): Add many_sections_define.h.
17026         (many_sections_define.h): New target.
17027         (BUILT_SOURCES): Add many_sections_check.h.
17028         (many_sections_check.h): New target.
17029         (check_PROGRAMS): Add many_sections_r_test.
17030         (many_sections_r_test_SOURCES): Define.
17031         (many_sections_r_test_DEPENDENCIES): Define.
17032         (many_sections_r_test_LDFLAGS): Define.
17033         (many_sections_r_test_LDADD): Define.
17034         (many_sections_r_test.o): New target.
17035         * testsuite/Makefile.in: Rebuild.
17036
17037 2008-04-17  Cary Coutant  <ccoutant@google.com>
17038
17039         * errors.cc (Errors::info): New function.
17040         (gold_info): New function.
17041         * errors.h (Errors::info): New function.
17042         * gold.h (gold_info): New function.
17043         * object.cc (Input_objects::add_object): Print trace output.
17044         * options.cc (options::parse_set): New function.
17045         (General_options::parse_wrap): Deleted.
17046         (General_options::General_options): Deleted initializer.
17047         * options.h (options::String_set): New typedef.
17048         (options::parse_set): New function.
17049         (DEFINE_set): New macro.
17050         (General_options::wrap): Changed to use DEFINE_set. Changed
17051         callers of any_wrap_symbols and is_wrap_symbol.
17052         (General_options::trace, General_options::trace_symbol):
17053         New options.
17054         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
17055         (General_options::wrap_symbols_): Deleted.
17056         * symtab.cc (Symbol_table::add_from_object): Print trace output.
17057
17058 2008-04-17  David S. Miller  <davem@davemloft.net>
17059
17060         * options.cc (General_options::parse_V): New function.
17061         * options.h: Add entries for -V and -Qy.
17062
17063 2008-04-17  Ian Lance Taylor  <iant@google.com>
17064
17065         * common.cc (Symbol_table::allocate_commons): Remove options
17066         parameter.  Change caller.
17067         (Symbol_table::do_allocate_commons): Remove options parameter.
17068         Change caller.  Just call do_allocate_commons_list twice.
17069         (Symbol_table::do_allocate_commons_list): New function, broken out
17070         of do_allocate_commons.
17071         * common.h (class Allocate_commons_task): Remove options_ field.
17072         Update constructor.
17073         * symtab.cc (Symbol_table::Symbol_table): Initialize
17074         tls_commons_.
17075         (Symbol_table::add_from_object): Put TLS common symbols on
17076         tls_commons_ list.
17077         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
17078         which are IN_OUTPUT_DATA.
17079         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
17080         allocate_commons and do_allocate_commons declarations.  Declare
17081         do_allocate_commons_list.
17082         * gold.cc (queue_middle_tasks): Update creation of
17083         Allocate_commons_task to not pass options.
17084         * testsuite/Makefile.am (INCLUDES): Add -I.. .
17085         (TLS_TEST_C_FLAGS): New variable.
17086         (tls_test_c_pic.o): New target.
17087         (tls_test_shared.so): Link in tls_test_c_pic.o.
17088         (tls_test_c_pic_ie.o): New target.
17089         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
17090         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
17091         (tls_test_c.o): New target.
17092         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
17093         (tls_pic_test_LDADD): Likewise.
17094         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
17095         (tls_shared_gd_to_ie_test_LDADD): Likewise.
17096         (tls_test_c_gnu2.o): New target.
17097         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
17098         tls_test_c_gnu2.o.
17099         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
17100         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
17101         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
17102         * testsuite/tls_test.cc: Include "config.h".
17103         (t_last): Call t11_last.
17104         * testsuite/tls_test.h (t11, t11_last): Declare.
17105         * testsuite/tls_test_c.c: New file.
17106         * testsuite/tls_test_main.cc (thread_routine): Call t11.
17107         * configure.ac: Check for OpenMP support.
17108         * configure, config.in, Makefile.in: Rebuild.
17109         * testsuite/Makefile.in: Rebuild.
17110
17111 2008-04-16  Cary Coutant  <ccoutant@google.com>
17112
17113         * i386.cc (Target_i386::define_tls_base_symbol): New function.
17114         (Target_i386::tls_base_symbol_defined_): New field.
17115         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
17116         (Target_i386::Scan::global): Likewise.
17117         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
17118         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
17119         (Target_x86_64::tls_base_symbol_defined_): New field.
17120         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
17121         (Target_x86_64::Scan::global): Likewise.
17122
17123 2008-04-16  Cary Coutant  <ccoutant@google.com>
17124
17125         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
17126         (Symbol::needs_plt_entry): Allow weak undefined symbols.
17127         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
17128         building shared libraries.
17129         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
17130         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
17131         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
17132         * testsuite/Makefile.in: Rebuild.
17133         * testsuite/weak_undef.h: New file.
17134         * testsuite/weak_undef_file1.cc: Add extra test cases.
17135         * testsuite/weak_undef_file2.cc: Likewise.
17136         * testsuite/weak_undef_test.cc: Likewise.
17137
17138 2008-04-16  David S. Miller  <davem@davemloft.net>
17139
17140         * sparc.cc (Target_sparc::Scan): Change from struct to class.
17141         Add issued_non_pic_error_ field.  Declare check_non_pic.
17142         (Target_sparc::Scan::check_non_pic): New function.
17143         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
17144         (Target_sparc::Scan::global): Likewise.
17145
17146         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
17147         * configure: Rebuild.
17148
17149         * options.h (DEFINE_enable): New macro.
17150         (new_dtags): New enable option.
17151         (initfirst, interpose, loadfltr, nodefaultlib,
17152         nodelete, nodlopen, nodump): New -z options.
17153         * layout.cc (Layout:finish_dynamic_section): If new
17154         dtags enabled, emit DT_RUNPATH.  Also, emit a
17155         DT_FLAGS_1 containing any specified -z flags.
17156
17157 2008-04-16  Ian Lance Taylor  <iant@google.com>
17158
17159         * copy-relocs.cc: New file.
17160         * copy-relocs.h: New file.
17161         * reloc.cc: Remove Copy_relocs code.
17162         * reloc.h: Likewise.
17163         * reloc-types.h (struct Reloc_types) [both versions]: Add
17164         get_reloc_addend_noerror.
17165         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
17166         variants of add_global which take an addend which must be zero.
17167         * i386.cc: Include "copy-relocs.h".
17168         (class Target_i386): Change type of copy_relocs_ to variable,
17169         update initializer.
17170         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
17171         Change all callers.
17172         (Target_i386::do_finalize_sections): Change handling of
17173         copy_relocs_.
17174         * sparc.cc: Include "copy-relocs.h".
17175         (class Target_sparc): Change type of copy_relocs_ to variable,
17176         update initializer.
17177         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
17178         Change all callers.
17179         (Target_sparc::do_finalize_sections): Change handling of
17180         copy_relocs_.
17181         * x86_64.cc: Include "copy-relocs.h".
17182         (class Target_x86_64): Change type of copy_relocs_ to variable,
17183         update initializer.
17184         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
17185         class.  Change all callers.
17186         (Target_x86_64::do_finalize_sections): Change handling of
17187         copy_relocs_.
17188         * Makefile.am (CCFILES): Add copy-relocs.cc.
17189         (HFILES): Add copy-relocs.h.
17190
17191         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
17192
17193         * testsuite/script_test_4.sh: Permit leading zeroes.
17194
17195 2008-04-15  Ian Lance Taylor  <iant@google.com>
17196
17197         * script-sections.cc (Script_sections::create_segments): Use
17198         header_size_adjustment even when there is enough room for the
17199         headers.
17200         * testsuite/script_test_4.sh: New file.
17201         * testsuite/script_test_4.t: New file.
17202         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
17203         (check_DATA): Add script_test_4.stdout.
17204         (MOSTLYCLEANFILES): Likewise.
17205         (script_test_4): New target.
17206         (script_test_4.stdout): New target.
17207         * testsuite/Makefile.in: Rebuild.
17208
17209         * sparc.cc: Add definitions for Output_data_plt_sparc class
17210         constants.
17211
17212 2008-04-14  David S. Miller  <davem@davemloft.net>
17213
17214         * sparc.cc: New file.
17215         * Makefile.am (TARGETSOURCES): Add sparc.cc
17216         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
17217         * configure.tgt: Document targ_extra_size and
17218         targ_extra_big_endian.  Add entries for sparc-* and
17219         sparc64-*.
17220         * configure.ac: Handle targ_extra_size and
17221         targ_extra_big_endian.
17222         * Makefile.in: Rebuild.
17223         * configure: Likewise.
17224         * po/POTFILES.in: Likewise.
17225         * po/gold.pot: Likewise.
17226
17227 2008-04-14  Ian Lance Taylor  <iant@google.com>
17228
17229         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
17230         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
17231         in the name/type/flags to section mapping.  Don't call
17232         allocate_output_section.
17233         (Layout::choose_output_section): Change parameter from adjust_name
17234         to is_input_section.  Don't permit input sections after sections
17235         are attached to segments.  Don't call allocate_output_section.
17236         (Layout::layout_eh_frame): Call update_flags_for_input_section,
17237         not write_enable_output_section.
17238         (Layout::make_output_section): Don't push to
17239         unattached_section_list_ nor call attach_to_segment.  Call
17240         attach_section_to_segment if sections are attached.
17241         (Layout::attach_sections_to_segments): New function.
17242         (Layout::attach_section_to_segment): New function.
17243         (Layout::attach_allocated_section_to_segment): Rename from
17244         attach_to_segment.  Remove flags parameter.
17245         (Layout::allocate_output_section): Remove function.
17246         (Layout::write_enable_output_section): Remove function.
17247         * layout.h (class Layout): Update for above changes.  Add new
17248         field sections_are_attached_.
17249         * output.h (Output_section::update_flags_for_input_section): New
17250         function.
17251         * output.cc (Output_section::add_input_section): Call
17252         update_flags_for_input_section.
17253         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
17254
17255 2008-04-11  Cary Coutant  <ccoutant@google.com>
17256
17257         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
17258         thought unnecessary.
17259         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
17260
17261 2008-04-11  Ian Lance Taylor  <iant@google.com>
17262
17263         * output.h (class Output_section_data): Remove inline definition
17264         of set_addralign.
17265         * output.cc (Output_section_data::set_addralign): New function.
17266
17267 2008-04-11  Cary Coutant  <ccoutant@google.com>
17268
17269         Add support for TLS descriptors for i386 and x86_64.
17270         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
17271         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
17272         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
17273         GOT_TYPE_TLS_DESC.
17274         (Target_i386::got_mod_index_entry): Remove unnecessary code.
17275         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
17276         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
17277         relocations.
17278         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
17279         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
17280         Fix problem with initial-exec relocations.
17281         (Target_i386::Relocate::relocate_tls): Likewise.
17282         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
17283         relaxation.
17284         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
17285         support for section-plus-offset dynamic table entries.
17286         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
17287         (Output_data_dynamic::Dynamic_entry): Add support for
17288         section-plus-offset dynamic table entries.
17289         (Output_data_dynamic::Classification): Likewise.
17290         (Output_data_dynamic::classification_): Renamed offset_.
17291         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
17292         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
17293         (Target_x86_64::make_plt_section): New function.
17294         (Target_x86_64::reserve_tlsdesc_entries): New function.
17295         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
17296         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
17297         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
17298         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
17299         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
17300         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
17301         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
17302         add extra PLT entry for TLS descriptors.
17303         (Output_data_plt_x86_64::got_): New field.
17304         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
17305         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
17306         fields.
17307         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
17308         descriptors.
17309         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
17310         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
17311         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
17312         R_386_TLS_DESC_CALL relocations.
17313         (Target_x86_64::Scan::global): Likewise.
17314         (Target_x86_64::do_finalize_sections): Add dynamic table entries
17315         for TLS descriptors.
17316         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
17317         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
17318         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
17319         GD-to-IE relaxation.
17320         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
17321         and TLS_DESCRIPTORS.
17322         * Makefile.in: Rebuild.
17323         * configure: Rebuild.
17324         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
17325         (tls_test_shared2.so): New target.
17326         (tls_shared_gd_to_ie_test_SOURCES): New variable.
17327         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
17328         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
17329         (tls_shared_gd_to_ie_test_LDADD): New variable.
17330         (tls_shared_gnu2_gd_to_ie_test): New target.
17331         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
17332         New targets.
17333         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
17334         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
17335         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
17336         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
17337         (tls_shared_gnu2_test): New target.
17338         (tls_test_gnu2_shared.so): New target.
17339         (tls_shared_gnu2_test_SOURCES): New variable.
17340         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
17341         (tls_shared_gnu2_test_LDFLAGS): New variable.
17342         (tls_shared_gnu2_test_LDADD): New variable.
17343         * testsuite/Makefile.in: Rebuild.
17344         * testsuite/Makefile.
17345
17346 2008-04-11  Ian Lance Taylor  <iant@google.com>
17347
17348         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
17349         justsyms.t.
17350         * testsuite/Makefile.in: Rebuild.
17351
17352         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
17353         long.
17354         * testsuite/script_test_2.cc (main): Adjust test.
17355
17356 2008-04-11  David S. Miller  <davem@davemloft.net>
17357             Ian Lance Taylor  <iant@google.com>
17358
17359         * options.h (General_options): Add entries for '-Y' and
17360         '-relax'.
17361         * options.cc (General_options:finalize): If -Y was used, add those
17362         entries to the library path instead of the default "/lib" and
17363         "/usr/lib".
17364
17365 2008-04-11  David S. Miller  <davem@davemloft.net>
17366
17367         * testsuite/justsyms.t: Start at 0x100.
17368         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
17369         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
17370         long.
17371         * testsuite/script_test_2.cc: Adjust string and section length
17372         checks.
17373
17374 2008-04-09  Ian Lance Taylor  <iant@google.com>
17375
17376         PR gold/5996
17377         * script-sections.cc (Sections_element::allocate_to_segment): Add
17378         orphan parameter.
17379         (Output_section_definition::allocate_to_segment): Likewise.
17380         (Orphan_output_section::allocate_to_segment): Likewise.
17381         (Script_sections::attach_sections_using_phdrs_clause): Don't
17382         propagate non-PT_LOAD segments to orphan sections.
17383         * testsuite/Makefile.am (script_test_3.stdout): Generate using
17384         readelf rather than objdump.
17385         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
17386         .interp section and PT_INTERP segment are the same size.
17387         * testsuite/Makefile.in: Rebuild.
17388
17389         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
17390         aliases for symbols defined in the same object.
17391         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
17392         (weak_alias_test_SOURCES): New variable.
17393         (weak_alias_test_DEPENDENCIES): New variable.
17394         (weak_alias_test_LDFLAGS): New variable.
17395         (weak_alias_test_LDADD): New variable.
17396         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
17397         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
17398         (weak_alias_test_3.o): New target.
17399         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
17400         * testsuite/weak_alias_test_main.cc: New file.
17401         * testsuite/weak_alias_test_1.cc: New file.
17402         * testsuite/weak_alias_test_2.cc: New file.
17403         * testsuite/weak_alias_test_3.cc: New file.
17404
17405 2008-04-08  Ian Lance Taylor  <iant@google.com>
17406
17407         * options.h (class General_options): Add --noinhibit-exec option.
17408         * main.cc (main): Check --noinhibit-exec.
17409
17410         * options.h (class General_options): Define --wrap as a special
17411         option.  Add wrap_symbols_ field.
17412         (General_options::any_wrap_symbols): New function.
17413         (General_options::is_wrap_symbol): New function.
17414         * options.cc (General_options::parse_wrap): New function.
17415         (General_options::General_options): Initialize wrap_symbols_.
17416         * symtab.cc (Symbol_table::wrap_symbol): New function.
17417         (Symbol_table::add_from_object): Handle --wrap.
17418         * symtab.h (class Symbol_table): Declare wrap_symbol.
17419         * target.h (Target::wrap_char): New function.
17420         (Target::Target_info): Add wrap_char field.
17421         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
17422         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
17423         * testsuite/testfile.cc (Target_test::test_target_info):
17424         Likewise.
17425
17426         * errors.cc (Errors::undefined_symbol): Mention symbol version if
17427         there is one.
17428
17429         * layout.h (class Layout): Add added_eh_frame_data_ field.
17430         * layout.cc (Layout::Layout): Initialize new field.
17431         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
17432         output section until we find a section we merged successfully.
17433         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
17434         that the size be non-zero.
17435
17436         * merge.cc (Object_merge_map::get_output_offset): Remove inline
17437         qualifier.
17438
17439 2008-04-08  Craig Silverstein  <csilvers@google.com>
17440
17441         * configure.ac: Export new conditional variable HAVE_ZLIB.
17442         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
17443         on HAVE_ZLIB.
17444         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
17445         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17446
17447 2008-04-07  Ian Lance Taylor  <iant@google.com>
17448
17449         * version.cc (version_string): Set to "1.5".
17450
17451         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
17452         Add issued_non_pic_error_ field.  Declare check_non_pic.
17453         (Target_x86_64::Scan::check_non_pic): New function.
17454         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
17455         (Target_x86_64::Scan::global): Likewise.
17456
17457         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
17458         addend parameter.  Change caller.  Handle merge sections.
17459         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
17460         Address to Addend.  Don't add in the result of
17461         local_section_offset, pass down the addend and use the returned
17462         value.
17463         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
17464         Update declarations of local_section_offset and symbol_value.
17465         * testsuite/two_file_test_1.cc (t18): New function.
17466         * testsuite/two_file_test_2.cc (f18): New function.
17467         * testsuite/two_file_test_main.cc (main): Call t18.
17468         * testsuite/two_file_test.h (t18, f18): Declare.
17469
17470         * configure.ac: Don't test for objdump, c++filt, or readelf.
17471         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
17472         conditionals.
17473         (TEST_READELF): New variable.
17474         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
17475         (check_PROGRAMS): Add two_file_strip_test.
17476         (two_file_strip_test): New target.
17477         (check_PROGRAMS): Add two_file_same_shared_strip_test.
17478         (two_file_same_shared_strip_test_SOURCES): New variable.
17479         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
17480         (two_file_same_shared_strip_test_LDFLAGS): New variable.
17481         (two_file_same_shared_strip_test_LDADD): New variable.
17482         (two_file_shared_strip.so): New target.
17483         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
17484         (ver_test_5.syms, ver_test_7.syms): Likewise.
17485         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
17486         (strip_test_3.stdout): Use TEST_OBJDUMP.
17487         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17488
17489 2008-04-04  Cary Coutant  <ccoutant@google.com>
17490
17491         * symtab.h (Symbol::is_weak_undefined): New function.
17492         (Symbol::is_strong_undefined): New function.
17493         (Symbol::is_absolute): New function.
17494         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
17495         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
17496         absolute symbols.
17497         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
17498         (weak_undef_test): New target.
17499         * testsuite/Makefile.in: Rebuild.
17500         * testsuite/weak_undef_file1.cc: New file.
17501         * testsuite/weak_undef_file2.cc: New file.
17502         * testsuite/weak_undef_test.cc: New file.
17503
17504 2008-04-03  Craig Silverstein  <csilvers@google.com>
17505
17506         * compressed_output.h (class Output_compressed_section): Use
17507         unsigned buffer.
17508         * compressed_output.cc (zlib_compress): Use unsigned buffers,
17509         add zlib header.
17510         (zlib_compressed_suffix): Removed.
17511         (Output_compressed_section::set_final_data_size): Use unsigned
17512         buffers.
17513         * testsuite/Makefile.am (flagstest_compress_debug_sections):
17514         Fix linker invocation.
17515         (flagstest_o_specialfile_and_compress_debug_sections):
17516         Likewise.
17517         * testsuite/Makefile.in: Regenerated.
17518
17519 2008-04-02  David S. Miller  <davem@davemloft.net>
17520
17521         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
17522         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
17523
17524 2008-04-02  Craig Silverstein  <csilvers@google.com>
17525
17526         * TODO: New file.
17527
17528 2008-04-02  Ian Lance Taylor  <iant@google.com>
17529
17530         * fileread.cc (File_read::find_view): Add byteshift and vshifted
17531         parameters.  Update for new key type to views_.  Change all
17532         callers.
17533         (File_read::read): Adjust for byteshift in returned view.
17534         (File_read::add_view): New function, broken out of
17535         find_and_make_view.
17536         (File_read::make_view): New function, broken out of
17537         find_and_make_view.
17538         (File_read::find_or_make_view): Add offset and aligned
17539         parameters.  Rewrite accordingly.  Change all callers.
17540         (File_read::get_view): Add offset and aligned parameters.  Adjust
17541         for byteshift in return value.
17542         (File_read::get_lasting_view): Likewise.
17543         * fileread.h (class File_read): Update declarations.
17544         (class File_read::View): Add byteshift_ field.  Add byteshift to
17545         constructor.  Add byteshift method.
17546         * archive.h (Archive::clear_uncached_views): New function.
17547         (Archive::get_view): Add aligned parameter.  Change all callers.
17548         * object.h (Object::get_view): Add aligned parameter.  Change all
17549         callers.
17550         (Object::get_lasting_view): Likewise.
17551
17552         * fileread.cc (File_read::release): Don't call clear_views if
17553         there are multiple objects.
17554         * fileread.h (File_read::clear_uncached_views): New function.
17555         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
17556         on the archive.
17557
17558 2008-03-31  Cary Coutant  <ccoutant@google.com>
17559
17560         Add thin archive support.
17561         * archive.cc (Archive::armagt): New const.
17562         (Archive::setup): Remove task parameter and calls to unlock.
17563         (Archive::unlock_nested_archives): New function.
17564         (Archive::read_header): Add nested_off parameter. Change
17565         all callers.
17566         (Archive::interpret_header): Likewise.
17567         (Archive::include_all_members): Change to handle thin
17568         archives.
17569         (Archive::include_member): Likewise.
17570         * archive.h (Archive::Archive): Add new parameters and
17571         initializers.
17572         (Archive::armagt): New const.
17573         (Archive::setup): Remove task parameter.
17574         (Archive::unlock_nested_archives): New function.
17575         (Archive::read_header): Add nested_off parameter.
17576         (Archive::interpret_header): Likewise.
17577         (Archive::Nested_archive_table): New typedef.
17578         (Archive::is_thin_archive_): New field.
17579         (Archive::nested_archives_): New field.
17580         (Archive::options_): New field.
17581         (Archive::dirpath_): New field.
17582         (Archive::task_): New field.
17583         * readsyms.cc (Read_symbols::do_read_symbols): Add check
17584         for thin archives.  Pass additional parameters to
17585         Archive::Archive.  Unlock the archive file after calling
17586         Archive::setup.
17587
17588 2008-03-29  Ian Lance Taylor  <iant@google.com>
17589
17590         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
17591         version symbol to be local.
17592         * testsuite/ver_test_4.sh: New file.
17593         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
17594         (check_DATA): Add ver_test_4.syms.
17595         (ver_test_4.syms): New target.
17596         * testsuite/Makefile.in: Rebuild.
17597
17598         * output.cc
17599         (Output_section::Input_section_sort_entry::has_priority): New
17600         function.
17601         (Output_section::Input_section_sort_entry::match_file_name): New
17602         function.
17603         (Output_section::Input_section_sort_entry::match_section_name):
17604         Remove.
17605         (Output_section::Input_section_sort_entry::match_section_name_prefix):
17606         Remove.
17607         (Output_section::Input_section_sort_entry::match_section_file):
17608         Remove.
17609         (Output_section::Input_section_sort_compare::operator()): Rewrite
17610         using new Input_section_sort_entry functions.  Sort crtbegin and
17611         crtend first.  Sort sections with no priority before sections with
17612         a priority.
17613         * testsuite/initpri1.c (d3): Check j != 4.
17614         (cd5): New constructor/destructor function.
17615         (main): Check j != 2.
17616
17617         * symtab.cc (Symbol_table::add_from_object): If we don't use the
17618         new symbol when resolving, don't call set_is_default.
17619         * testsuite/ver_test_7.cc: New file.
17620         * testsuite/ver_test_7.sh: New file.
17621         * testsuite/Makefile.am (ver_test_7.so): New target.
17622         (ver_test_7.o): New target.
17623         (check_SCRIPTS): Add ver_test_7.sh.
17624         (check_DATA): Add ver_test_7.syms.
17625         (ver_test_7.syms): New target.
17626
17627 2008-03-28  Ian Lance Taylor  <iant@google.com>
17628
17629         * layout.cc (Layout::layout): If we see an input section with a
17630         name that needs sorting, set the must_sort flag for the output
17631         section.
17632         (Layout::make_output_section): If the name of the output section
17633         indicates that it might require sorting, set the may_sort flag.
17634         * output.h (Output_section::may_sort_attached_input_sections): New
17635         function.
17636         (Output_section::set_may_sort_attached_input_sections): New
17637         function.
17638         (Output_section::must_sort_attached_input_sections): New
17639         function.
17640         (Output_section::set_must_sort_attached_input_sections): New
17641         function.
17642         (class Output_section): Declare Input_section_sort_entry.  Define
17643         Input_section_sort_compare.  Declare
17644         sort_attached_input_sections.  Add new fields:
17645         may_sort_attached_input_sections_,
17646         must_sort_attached_input_sections_,
17647         attached_input_sections_are_sorted_.
17648         * output.cc (Output_section::Output_section): Initialize new
17649         fields.
17650         (Output_section::add_input_section): Add an entry to
17651         input_sections_ if may_sort or must_sort are true.
17652         (Output_section::set_final_data_size): Call
17653         sort_attached_input_sections if necessary.
17654         (Output_section::Input_section_sort_entry): Define new class.
17655         (Output_section::Input_section_sort_compare::operator()): New
17656         function.
17657         (Output_section::sort_attached_input_sections): New function.
17658         * configure.ac: Check whether the compiler supports constructor
17659         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
17660         * testsuite/initpri1.c: New file.
17661         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
17662         CONSTRUCTOR_PRIORITY.
17663         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
17664         (initpri1_LDFLAGS): New variable.
17665         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17666
17667 2008-03-27  Ian Lance Taylor  <iant@google.com>
17668
17669         * common.cc (Sort_commons::operator): Correct sorting algorithm.
17670         * testsuite/common_test_1.c: New file.
17671         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
17672         (common_test_1_SOURCES): New variable.
17673         (common_test_1_DEPENDENCIES): New variable.
17674         (common_test_1_LDFLAGS): New variable.
17675
17676         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
17677         and commons_ correctly when NAME/VERSION does not override
17678         NAME/NULL.
17679         * testsuite/ver_test_6.c: New file.
17680         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
17681         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
17682         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
17683
17684 2008-03-26  Ian Lance Taylor  <iant@google.com>
17685
17686         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
17687         of an undefined symbol from a version script.
17688         * testsuite/Makefile.am (ver_test_5.so): New target.
17689         (ver_test_5.o): New target.
17690         (check_SCRIPTS): Add ver_test_5.sh.
17691         (check_DATA): Add ver_test_5.syms.
17692         (ver_test_5.syms): New target.
17693         * testsuite/ver_test_5.cc: New file.
17694         * testsuite/ver_test_5.script: New file.
17695         * testsuite/ver_test_5.sh: New file.
17696         * Makefile.in, testsuite/Makefile.in: Rebuild.
17697
17698         PR gold/5986
17699         Fix problems building gold with gcc 4.3.0.
17700         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
17701         (gold_error_at_location, gold_warning_at_location): Use it.
17702         * configure.ac: Check whether we can compile and use a template
17703         function with a printf attribute.
17704         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
17705         when jumping over bytes.
17706         * object.cc: Instantiate Object::read_section_data.
17707         * debug.h: Include <cstring>
17708         * dwarf_reader.cc: Include <algorithm>
17709         * main.cc: Include <cstring>.
17710         * options.cc: Include <cstring>.
17711         * output.cc: Include <cstring>.
17712         * script.cc: Include <cstring>.
17713         * script.h: Include <string>.
17714         * symtab.cc: Include <cstring> and <algorithm>.
17715         * target-select.cc: Include <cstring>.
17716         * version.cc: Include <string>.
17717         * testsuite/testmain.cc: Include <cstdlib>.
17718         * configure, config.in: Rebuild.
17719
17720 2008-03-25  Ian Lance Taylor  <iant@google.com>
17721
17722         * options.cc: Include "../bfd/bfdver.h".
17723         (options::help): Print bug reporting address.
17724
17725         * version.cc (print_version): Adjust output for current value of
17726         BFD_VERSION_STRING.
17727
17728         * NEWS: New file.
17729
17730         * options.cc (options::help): Print list of supported targets.
17731         * target-select.h: Include <vector>.
17732         (class Target_selector): Make machine_, size_, and is_big_endian_
17733         fields const.  Add bfd_name_ and instantiated_target_ fields.
17734         (Target_selector::Target_selector): Add bfd_name parameter.
17735         (Target_selector::recognize): Make non-virtual, call
17736         do_recognize.
17737         (Target_selector::recognize_by_name): Make non-virtual, call
17738         do_recognize_by_name.
17739         (Target_selector::supported_names): New function.
17740         (Target_selector::bfd_name): New function.
17741         (Target_selector::do_instantiate_target): New pure virtual
17742         function.
17743         (Target_selector::do_recognize): New virtual function.
17744         (Target_selector::do_recognize_by_name): New virtual function.
17745         (Target_selector::instantiate_target): New private function.
17746         (supported_target_names): Declare.
17747         * target-select.cc (Target_selector::Target_selector): Update for
17748         new parameter and fields.
17749         (select_target_by_name): Check that the name matches before
17750         calling recognize_by_name.
17751         (supported_target_names): New function.
17752         * i386.cc (class Target_selector_i386): Update Target_selector
17753         constructor call.  Remove recognize and recognize_by_name.  Add
17754         do_instantiate_target.
17755         * x86_64.cc (class Target_selector_x86_64): Likewise.
17756         * testsuite/testfile.cc (class Target_selector_test): Update for
17757         changes to Target_selector.
17758
17759         * README: Rewrite, with some notes on unsupported features.
17760
17761 2008-03-24  Cary Coutant  <ccoutant@google.com>
17762
17763         * i386.cc (Target_i386::Got_type): New enum declaration.
17764         (Target_i386::Scan::local): Updated callers of Output_data_got
17765         member functions.
17766         (Target_i386::Scan::global): Likewise.
17767         (Target_i386::Relocate::relocate): Likewise.
17768         (Target_i386::Relocate::relocate_tls): Likewise.
17769         * object.h (Got_offset_list): New class.
17770         (Sized_relobj::local_has_got_offset): Added got_type parameter.
17771         (Sized_relobj::local_got_offset): Likewise.
17772         (Sized_relobj::set_local_got_offset): Likewise.
17773         (Sized_relobj::local_has_tls_got_offset): Removed.
17774         (Sized_relobj::local_tls_got_offset): Removed.
17775         (Sized_relobj::set_local_tls_got_offset): Removed.
17776         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
17777         * output.cc (Output_data_got::add_global): Added got_type parameter.
17778         (Output_data_got::add_global_with_rel): Likewise.
17779         (Output_data_got::add_global_with_rela): Likewise.
17780         (Output_data_got::add_global_pair_with_rel): New function.
17781         (Output_data_got::add_global_pair_with_rela): New function.
17782         (Output_data_got::add_local): Added got_type parameter.
17783         (Output_data_got::add_local_with_rel): Likewise.
17784         (Output_data_got::add_local_with_rela): Likewise.
17785         (Output_data_got::add_local_pair_with_rel): New function.
17786         (Output_data_got::add_local_pair_with_rela): New function.
17787         (Output_data_got::add_global_tls): Removed.
17788         (Output_data_got::add_global_tls_with_rel): Removed.
17789         (Output_data_got::add_global_tls_with_rela): Removed.
17790         (Output_data_got::add_local_tls): Removed.
17791         (Output_data_got::add_local_tls_with_rel): Removed.
17792         (Output_data_got::add_local_tls_with_rela): Removed.
17793         * output.h (Output_data_got::add_global): Added got_type parameter.
17794         (Output_data_got::add_global_with_rel): Likewise.
17795         (Output_data_got::add_global_with_rela): Likewise.
17796         (Output_data_got::add_global_pair_with_rel): New function.
17797         (Output_data_got::add_global_pair_with_rela): New function.
17798         (Output_data_got::add_local): Added got_type parameter.
17799         (Output_data_got::add_local_with_rel): Likewise.
17800         (Output_data_got::add_local_with_rela): Likewise.
17801         (Output_data_got::add_local_pair_with_rel): New function.
17802         (Output_data_got::add_local_pair_with_rela): New function.
17803         (Output_data_got::add_global_tls): Removed.
17804         (Output_data_got::add_global_tls_with_rel): Removed.
17805         (Output_data_got::add_global_tls_with_rela): Removed.
17806         (Output_data_got::add_local_tls): Removed.
17807         (Output_data_got::add_local_tls_with_rel): Removed.
17808         (Output_data_got::add_local_tls_with_rela): Removed.
17809         * resolve.cc (Symbol::override_base_with_special): Removed
17810         reference to has_got_offset_ field.
17811         * symtab.cc (Symbol::init_fields): Replaced initialization
17812         of got_offset_ with got_offsets_.  Removed initialization
17813         of has_got_offset_
17814         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
17815         (Symbol::got_offset): Likewise.
17816         (Symbol::set_got_offset): Likewise.
17817         (Symbol::has_tls_got_offset): Removed.
17818         (Symbol::tls_got_offset): Removed.
17819         (Symbol::set_tls_got_offset): Removed.
17820         (Symbol::got_offset_): Removed.
17821         (Symbol::tls_mod_got_offset_): Removed.
17822         (Symbol::tls_pair_got_offset_): Removed.
17823         (Symbol::got_offsets_): New field.
17824         (Symbol::has_got_offset): Removed.
17825         (Symbol::has_tls_mod_got_offset): Removed.
17826         (Symbol::has_tls_pair_got_offset): Removed.
17827         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
17828         (Target_x86_64::Scan::local): Updated callers of Output_data_got
17829         member functions.
17830         (Target_x86_64::Scan::global): Likewise.
17831         (Target_x86_64::Relocate::relocate): Likewise.
17832         (Target_x86_64::Relocate::relocate_tls): Likewise.
17833
17834 2008-03-25  Ben Elliston  <bje@au.ibm.com>
17835
17836         * yyscript.y: Fix spelling error in comment.
17837
17838 2008-03-24  Ian Lance Taylor  <iant@google.com>
17839
17840         * options.h (class General_options): Define build_id option.
17841         * layout.h (class Layout): Declare write_build_id, create_note,
17842         create_build_id.  Add build_id_note_ member.
17843         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
17844         "libiberty.h", "md5.h", "sha1.h".
17845         (Layout::Layout): Initialize eh_frame_data_,
17846         eh_frame_hdr_section_, and build_id_note_.
17847         (Layout::finalize): Call create_build_id.
17848         (Layout::create_note): New function, broken out of
17849         Layout::create_gold_note.
17850         (Layout::create_gold_note): Call create_note.
17851         (Layout::create_build_id): New function.
17852         (Layout::write_build_id): New function.
17853         (Close_task_runner::run): Call write_build_id.
17854
17855         * x86_64.cc: Correct license to GPLv3.
17856
17857 2008-03-23  Ian Lance Taylor  <iant@google.com>
17858
17859         * options.cc: Include "demangle.h".
17860         (parse_optional_string): New function.
17861         (parse_long_option): Handle takes_optional_argument.
17862         (parse_short_option): Update dash_z initializer.  Handle
17863         takes_optional_argument.
17864         (General_options::General_options): Initialize do_demangle_.
17865         (General_options::finalize): Set do_demangle_.  Handle demangling
17866         style.
17867         * options.h (parse_optional_string): Declare.
17868         (struct One_option): Add optional_arg field.  Update constructor.
17869         Update call constructor calls.  Add takes_optional_argument
17870         function.
17871         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
17872         (DEFINE_optional_string): Define.
17873         (General_options::demangle): Change from DEFINE_bool to
17874         DEFINE_optional_string.
17875         (General_options::no_demangle): New function.
17876         (General_options::do_demangle): New function.
17877         (General_options::set_do_demangle): New function.
17878         (General_options::execstack_status_): Move definition to end of
17879         class definition.
17880         (General_options::static_): Likewise.
17881         (General_options::do_demangle_): New field.
17882         * object.cc (big_endian>::get_symbol_location_info): Call
17883         Options::do_demangle, not Options::demangle.
17884         * symtab.cc (demangle): Likewise.
17885
17886 2008-03-22  Ian Lance Taylor  <iant@google.com>
17887
17888         * gold.h: Include <cstddef> and <sys/types.h>
17889         * options.h: Include <cstring>.
17890
17891 2008-03-21  Ian Lance Taylor  <iant@google.com>
17892
17893         * Added source code to GNU binutils.
17894 \f
17895 Copyright (C) 2008-2015 Free Software Foundation, Inc.
17896
17897 Copying and distribution of this file, with or without modification,
17898 are permitted in any medium without royalty provided the copyright
17899 notice and this notice are preserved.
17900
17901 Local Variables:
17902 mode: change-log
17903 left-margin: 8
17904 fill-column: 74
17905 version-control: never
17906 End: