0957c53a94815cad37c0ef4bfc59a0f62b95f931
[external/binutils.git] / gold / ChangeLog
1 2015-10-28  Marcin Koƛcielnicki  <koriakin@0x04.net>
2
3         * archive.cc (Archive::sym64name): New const.
4         (Archive::setup): Add support for SYM64 armap.
5         (Archive::read_armap): Likewise.
6         (Archive::interpret_header): Likewise.
7         (Archive::const_iterator::read_next_header): Likewise.
8         * archive.h (Archive::sym64name): New const.
9         (Archive::read_armap): Add mapsize template parameter.
10
11 2015-10-28  Marcin Koƛcielnicki  <koriakin@0x04.net>
12
13         * dynobj.cc (Dynobj::create_elf_hash_table): Create hash table with
14         target-specific entry size.
15         (Dynobj::sized_create_elf_hash_table): Add size template parameter.
16         * dynobj.h (Dynobj::sized_create_elf_hash_table): Likewise.
17         * layout.cc (Layout::create_dynamic_symtab): Set entsize to
18         hash_entry_size.
19         * target.h (Target::hash_entry_size): New method.
20         (Target::Target_info::hash_entry_size): New data member.
21
22         * aarch64.cc (Target_aarch64::aarch64_info): Add hash_entry_size.
23         * arm.cc (Target_arm::arm_info): Likewise.
24         (Target_arm_nacl::arm_nacl_info): Likewise.
25         * i386.cc (Target_i386::i386_info): Likewise.
26         (Target_i386_nacl::i386_nacl_info): Likewise.
27         (Target_iamcu::iamcu_info): Likewise.
28         * mips.cc (Target_mips::mips_info): Likewise.
29         (Target_mips_nacl::mips_nacl_info): Likewise.
30         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
31         * sparc.cc (Target_sparc::sparc_info): Likewise.
32         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
33         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
34         (Target_x86_64_nacl::x86_64_nacl_info): Likewise.
35         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
36
37 2015-10-28  H.J. Lu  <hongjiu.lu@intel.com>
38
39         PR gold/19177
40         * i386.cc (Target_i386::Relocate::relocate): Check R_386_GOT32
41         and R_386_GOT32X relocations without base register.
42
43 2015-10.27  Han Shen  <shenhan@google.com>
44
45         PR gold/19042 - unsupported reloc 311/312.
46
47         * aarch64.cc (Target_aarch64::Scan::local): Add support for
48         reloc 311/312.
49
50 2015-10-22  H.J. Lu  <hongjiu.lu@intel.com>
51
52         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
53         Treat R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX the same
54         as R_X86_64_GOTPCREL.
55         (Target_x86_64<size>::Scan::local): Likewise.
56         (Target_x86_64<size>::Scan::possible_function_pointer_reloc):
57         Likewise.
58         (Target_x86_64<size>::Scan::global): Likewise.
59         (Target_x86_64<size>::Relocate::relocate): Likewise.
60         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
61         Likewise.
62
63 2015-10-22  H.J. Lu  <hongjiu.lu@intel.com>
64
65         * i386.cc (Target_i386::Scan::get_reference_flags(): Treat
66         R_386_GOT32X the same as R_386_GOT32.
67         (Target_i386::Scan::local): Likewise.
68         (Target_i386::Scan::possible_function_pointer_reloc): Likewise.
69         (Target_i386::Scan::global): Likewise.
70         (Target_i386::Relocate::relocate): Likewise.
71         (Target_i386::Relocatable_size_for_reloc::get_size_for_reloc):
72         Likewise.
73
74 2015-10-20  H.J. Lu  <hongjiu.lu@intel.com>
75
76         * testsuite/Makefile.am (x86_64_mov_to_lea11): Replace
77         x86_64_mov_to_lea1.o with x86_64_mov_to_lea2.o.
78         (x86_64_mov_to_lea12): Replace x86_64_mov_to_lea2.o with
79         x86_64_mov_to_lea1.o.
80         * testsuite/Makefile.in: Regenerated.
81
82 2015-10-16  H.J. Lu  <hongjiu.lu@intel.com>
83
84         PR gold/19119
85         * options.h (General_options): Remove "obsolete" from -m.
86         * parameters.cc (set_parameters_target): Check if input target
87         is compatible with output emulation set by "-m emulation".
88
89 2015-10-13  H.J. Lu  <hongjiu.lu@intel.com>
90
91         PR gold/19118
92         * i386.cc (Target_iamcu): New class.
93         (Target_selector_iamcu): Likewise.
94         (Target_iamcu::iamcu_info): New variable.
95         (target_selector_iamcu): Likewise.
96
97 2015-10-07  Andreas Schwab  <schwab@suse.de>
98
99         * aarch64.cc (aarch64_info): Set abi_pagesize to 64K.
100
101 2015-10-06  Cary Coutant  <ccoutant@gmail.com>
102
103         PR gold/18855
104         * sparc.cc (Sparc_relocate_functions::gdop_hix22): Remove addend
105         parameter.
106         (Sparc_relocate_functions::gdop_lox10): Likewise.
107         (Target_sparc::Relocate::relocate): Use addend when computing
108         symbol value for R_SPARC_GOTDATA_OP*.
109
110 2015-09-07  Cary Coutant  <ccoutant@gmail.com>
111
112         PR gold/18930
113         PR gold/18886
114         * resolve.cc (Symbol::override_base): Don't convert IFUNC symbols here.
115         * symtab.cc (Symbol_table::add_from_dynobj): Convert them here instead.
116
117 2015-09-02  H.J. Lu  <hongjiu.lu@intel.com>
118
119         PR gold/18886
120         * resolve.cc (Symbol::override_base): Turn IFUNC symbols from
121         shared libraries into normal FUNC symbols.
122         * symtab.cc (Symbol_table::sized_write_symbol): Assert IFUNC
123         symbols aren't from shared libraries.
124
125 2015-09-02  Alan Modra  <amodra@gmail.com>
126
127         PR 18878
128         * powerpc.cc (Target_powerpc): Add savres_section_ and accessor.
129         (Target_powerpc::Branch_info::make_stub): Determine whether long
130         branch stub is for save/restore function.
131         (Branch_stub_ent): Add save_res_, and extra parm to constructor.
132         (Stub_table): Add need_save_res_.
133         (Stub_table:clear_stubs): Clear need_save_res_.
134         (Stub_table:set_address_and_size): Add save/restore section size.
135         (Stub_table::add_long_branch_entry): Add save_res param.  Set
136         need_save_res_, but don't add space for save/restore stubs.
137         (Stub_table::find_long_branch_entry): Return offset to local copy
138         of save/restore func.
139         (Stub_table::do_write): Don't output save/restore stubs.  Instead
140         copy the save/restore functions.
141         (Output_data_save_res:contents): New accessor.
142         (Target_powerpc::define_save_restore_funcs): Set savres_section_.
143
144 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
145
146         PR gold/18847
147         * script-sections.cc (Memory_region::set_address): New method.
148         (Script_sections::find_memory_region): Add explicit_only parameter.
149         (Output_section_definition::set_section_addresses): Handle case where
150         script specifies both address and vma region.
151         * script-sections.h (Script_sections::find_memory_region): Add
152         explicit_only parameter.
153
154 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
155
156         PR gold/18859
157         * object.cc (Input_objects::add_object): Store objects in a map,
158         indexed by soname; update as-needed flag when necessary.
159         * object.h (Object::clear_as_needed): New method.
160         (Input_objects::so_names_): Change from set to map.
161
162 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
163
164         PR gold/14746
165         * expression.cc (Expression::Expression_eval_info): Add
166         is_valid_pointer field.
167         (Expression::eval_maybe_dot): Add is_valid_pointer parameter.
168         Adjust all callers.
169         (Addr_expression::value_from_output_section): Check whether address
170         is valid.
171         * script.cc (Symbol_assignment::set_if_absolute): Defer assignment
172         if evaluation failed due to address that is not yet valid.
173         * script.h: (Expression::eval_maybe_dot): Add is_valid_pointer
174         parameter.
175
176 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
177
178         PR gold/18866
179         PR gold/18703
180         * symtab.cc (Symbol_table): Reorder conditions to avoid internal error.
181
182 2015-08-20  Alan Modra  <amodra@gmail.com>
183
184         PR gold/18846
185         * target-reloc.h (relocate_relocs <RELOC_ADJUST_FOR_SECTION_RELA>):
186         Subtract os->address() from addend.
187         * powerpc.cc (relocate_relocs): Likewise.
188
189 2015-08-12  Simon Dardis  <simon.dardis@imgtec.com>
190
191         * mips.cc (plt0_entry_o32, plt0_entry_n32, plt0_entry_n64,
192         lazy_stub_normal_1, lazy_stub_normal_1_n64,
193         lazy_stub_normal_2, lazy_stub_normal_2_n64, lazy_stub_big,
194         lazy_stub_big_n64, lazy_stub_micromips32_normal_1_n64,
195         lazy_stub_micromips32_normal_2_n64, lazy_stub_micromips32_big,
196         lazy_stub_micromips32_big_n64): Update to use 'or' for move instead
197         of 'addu/daddu'.
198
199 2015-07-27  H.J. Lu  <hongjiu.lu@intel.com>
200
201         * configure: Regenerated.
202
203 2015-07-26  Doug Kwan  <dougkwan@google.com>
204
205         * testsuite/arm_unaligned_reloc.{s,sh}: Make test less sensitive to
206           disassembler output format.
207
208 2015-07-23  Ian Coolidge  <icoolidge@google.com>
209         Plumb --pic-veneer option for gold.
210
211         * arm.cc (Reloc_stub::stub_type_for_reloc): Plumb to stub
212         generation.
213         * options.h (General_options): Add --pic-veneer option.
214
215 2015-07-22  H.J. Lu  <hongjiu.lu@intel.com>
216
217         PR gold/18663
218         * testsuite/Makefile.am (script_test_1_SOURCES): Set to
219         script_test_1a.cc script_test_1b.cc.
220         (script_test_11_r.o): Replace script_test_11.o with
221         script_test_11a.o script_test_11b.o.
222         (script_test_11.o): Removed.
223         (script_test_11a.o): New.
224         (script_test_11b.o): Likewise.
225         * testsuite/Makefile.in: Regenerated.
226         * testsuite/script_test_1.h: New file.
227         * testsuite/script_test_1b.cc: Likewise.
228         * testsuite/script_test_11.h: Likewise.
229         * testsuite/script_test_11b.c: Likewise.
230         * testsuite/script_test_1.cc: Renamed to ...
231         * testsuite/script_test_1a.cc: This.
232         Include "script_test_1.h".
233         (main): Call check_int and check_ptr.
234         * testsuite/script_test_11.c: Renamed to ...
235         * testsuite/script_test_11a.c: This.
236         Include "script_test_11.h".
237         (main): Call ptr_equal.
238
239 2015-07-22  H.J. Lu  <hongjiu.lu@intel.com>
240
241         PR gold/18628
242         * testsuite/ifuncdep2.c (global): Change protected to hidden.
243         * testsuite/ifuncmod1.c (global): Likewise.
244         * testsuite/ifuncmod5.c (global): Likewise.
245
246 2015-07-22  Alan Modra  <amodra@gmail.com>
247
248         * aarch64.cc (try_fix_erratum_843419_optimized): Warning fix.
249
250 2015-07-21  Cary Coutant  <ccoutant@gmail.com>
251
252         PR gold/18548
253         * symtab.cc (Symbol_table::do_define_in_output_data): Check for
254         forced local symbol even when oldsym != NULL.
255         (Symbol_table::do_define_in_output_segment): Likewise.
256         (Symbol_table::do_define_as_constant): Likewise.
257
258 2015-07-21  Cary Coutant  <ccoutant@gmail.com>
259
260         PR gold/18698
261         * archive.cc (Library_base::should_include_member): Don't use entry
262         point for relocatable links, or if target is not yet valid.
263         * parameters.cc (Parameters::entry): Check target_valid().
264
265 2015-07-20  Han Shen  <shenhan@google.com>
266
267         Optimize erratum 843419 fix.
268
269         * aarch64.cc (AArch64_insn_utilities::is_adr): New method.
270         (AArch64_insn_utilities::aarch64_adr_encode_imm): New method.
271         (AArch64_insn_utilities::aarch64_adrp_decode_imm): New method.
272         (E843419_stub): New sub-class of Erratum_stub.
273         (AArch64_relobj::try_fix_erratum_843419_optimized): New method.
274         (AArch64_relobj::section_needs_reloc_stub_scanning): Try optimized fix.
275         (AArch64_relobj::create_erratum_stub): Add 1 argument.
276         (Target_aarch64::scan_erratum_843419_span): Pass in adrp insn offset.
277
278 2015-07-20  Han Shen  <shenhan@google.com>
279
280         Fix arm elf header flags wrt hardfp bit.
281
282         * arm.cc (Target_arm::do_adjust_elf_header): Set flags into view.
283
284 2015-07-20  H.J. Lu  <hongjiu.lu@intel.com>
285
286         PR gold/18689
287         * layout.cc (Layout::layout): Clear the SHF_COMPRESSED flag bit
288         from input group section for relocatable link.
289         * testsuite/Makefile.am (check_SCRIPTS): Add pr18689.sh.
290         (check_DATA): Add pr18689.stdout.
291         (MOSTLYCLEANFILES): Add pr18689a.o pr18689b.o.
292         (pr18689.stdout): New rule.
293         (pr18689a.o): Likewise.
294         (pr18689b.o): Likewise.
295         (pr18689.o): Likewise.
296         * testsuite/pr18689.c: New file.
297         * testsuite/pr18689.sh: Likewise.
298         * testsuite/Makefile.in: Regenerated.
299
300 2015-07-20  Yiran Wang  <yiran@google.com>
301         Cary Coutant  <ccoutant@gmail.com>
302
303         PR gold/15574
304         * resolve.cc (Symbol_table): Remove warning about references
305         from shared objects to hidden symbols.
306         * testsuite/Makefile.am (hidden_test): Add hidden_test.syms.
307         * testsuite/Makefile.in: Regenerate.
308         * testsuite/hidden_test.sh: Check dynamic symbol table; update
309         expected error messages.
310
311 2015-07-14  H.J. Lu  <hongjiu.lu@intel.com>
312
313         * compressed_output.cc (Output_compressed_section::set_final_data_size):
314         Make --compress-debug-sections=zlib the same as
315         --compress-debug-sections=zlib-gabi.
316         * testsuite/Makefile.am (flagstest_compress_debug_sections.check):
317         Expect ".debug_.*" with the SHF_COMPRESSED bit, instead of
318         ".zdebug_".
319         * testsuite/Makefile.in: Regenerated.
320
321 2015-07-12  H.J. Lu  <hongjiu.lu@intel.com>
322
323         PR gold/18322
324         * compressed_output.cc (zlib_compress): Add argument for
325         compression header size.  Set header size to compression header
326         size if it isn't 0.  Don't write out the zlib header here.
327         (Output_compressed_section::set_final_data_size): Support
328         zlib-gnu and zlib-gabi compressions.  Pass compression header
329         size to zlib_compress and write out compression header.  Set
330         the SHF_COMPRESSED bit for zlib-gabi compression.  Otherwise
331         clear the SHF_COMPRESSED bit
332         * options.h (compress_debug_sections): Add zlib-gnu and
333         zlib-gabi.
334         * output.h (Output_section::set_flags): New.
335         * testsuite/Makefile.am (check_PROGRAMS): Add
336         flagstest_compress_debug_sections_none,
337         flagstest_compress_debug_sections_gnu and
338         flagstest_compress_debug_sections_gabi.
339         (check_DATA): Add flagstest_compress_debug_sections_none.stdout.
340         flagstest_compress_debug_sections.stdout,
341         flagstest_compress_debug_sections.cmp,
342         flagstest_compress_debug_sections.check,
343         flagstest_compress_debug_sections_gnu.stdout,
344         flagstest_compress_debug_sections_gnu.cmp,
345         flagstest_compress_debug_sections_gnu.check,
346         flagstest_compress_debug_sections_gabi.stdout,
347         flagstest_compress_debug_sections_gabi.cmp and
348         flagstest_compress_debug_sections_gabi.check.
349         (flagstest_compress_debug_sections_none): New.
350         (flagstest_compress_debug_sections_none.stdout): Likewise.
351         (flagstest_compress_debug_sections.stdout): Likewise.
352         (flagstest_compress_debug_sections.check): Likewise.
353         (flagstest_compress_debug_sections.cmp): Likewise.
354         (flagstest_compress_debug_sections_gnu): Likewise.
355         (flagstest_compress_debug_sections_gnu.stdout): Likewise.
356         (flagstest_compress_debug_sections_gnu.check): Likewise.
357         (flagstest_compress_debug_sections_gnu.cmp): Likewise.
358         (flagstest_compress_debug_sections_gabi): Likewise.
359         (flagstest_compress_debug_sections_gabi.stdout): Likewise.
360         (flagstest_compress_debug_sections_gnu.check): Likewise.
361         (flagstest_compress_debug_sections_gnu.cmp): Likewise.
362         * testsuite/Makefile.in: Regenerated.
363
364 2015-07-12  H.J. Lu  <hongjiu.lu@intel.com>
365
366         PR gold/18321
367         * compressed_output.h (decompress_input_section): Add arguments
368         for ELF class, big endian and sh_flags.
369         * compressed_output.cc (decompress_input_section): Likewise.
370         Support the SHF_COMPRESSED section.
371         * dynobj.h (Dynobj): Add elfsize and is_big_endian member
372         functions.
373         * plugin.h (Pluginobj): Likewise.
374         * layout.cc (Layout::get_output_section_flags): Also clear the
375         SHF_COMPRESSED bit.
376         * object.h (Compressed_section_info): Add flag to store sh_flags.
377         (Object): Add pure virtual elfsize and is_big_endian member
378         functions.
379         * object.cc (need_decompressed_section): Don't skip the ".zdebug"
380         prefix here.
381         (build_compressed_section_map): Check SHF_COMPRESSED for
382         uncompressed size.  Store sh_flags in Compressed_section_info.
383         Pass size, big_endian and sh_flags to decompress_input_section.
384         Skip the ".debug"/".zdebug" prefix when passing section name to
385         need_decompressed_section.
386         (Sized_relobj_file<size, big_endian>::do_find_special_section):
387         Don't check ".zdebug_*" sections.
388         (Object::decompressed_section_contents): Pass ELF class, big
389         endian and sh_flags to decompress_input_section.
390         * reloc.cc (Sized_relobj_file<size, big_endian>::write_sections):
391         Likewise.
392         * testsuite/Makefile.am (check_DATA): Add
393         debug_msg_cdebug_gabi.err and gdb_index_test_2_gabi.stdout.
394         (MOSTLYCLEANFILES): Add debug_msg_cdebug_gabi.err and
395         gdb_index_test_2_gabi.stdout.
396         (debug_msg_cdebug_gabi.o): New.
397         (odr_violation1_cdebug_gabi.o): Likewise.
398         (odr_violation2_cdebug_gabi.o): Likewise.
399         (debug_msg_cdebug_gabi.err): Likewise.
400         (check_SCRIPTS): Add gdb_index_test_2_gabi.sh.
401         (gdb_index_test_cdebug_gabi.o): Likewise.
402         (gdb_index_test_2_gabi): Likewise.
403         (gdb_index_test_2_gabi.stdout): Likewise.
404         * testsuite/gdb_index_test_2_gabi.sh: New file.
405         * testsuite/Makefile.in: Regenerated.
406
407 2015-07-09  Han Shen  <shenhan@google.com>
408
409         Use "gold_info" instead of "gold_warning" for erratum fix.
410
411         * aarch64.cc (Target_aarch64::scan_erratum_843419_span): Use
412         'gold_info'.
413         (Target_aarch64::scan_erratum_835769_span): USe 'gold_info'.
414
415 2015-07-09  Han Shen  <shenhan@google.com>
416
417         Drop missing symbol warning for arm/aarch64.
418
419         * aarch64.cc (AArch64_relobj::scan_errata): Drop missing symbol warning.
420         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Drop missing
421         symbol warning.
422
423 2015-07-07  Han Shen  <shenhan@google.com>
424
425         Make gold aarch64 accept long form of mapping symbols.
426
427         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Make legal
428         of mapping symbols.
429
430 2015-06-29  Doug Kwan  <dougkwan@google.com>
431
432         * testsuite/arm_bl_out_of_range.s: Align stub table so that it appears
433           at address expected by test.
434         * testsuite/arm_cortex_a8_b.s: Ditto.
435         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
436         * testsuite/arm_cortex_a8_bl.s: Ditto.
437         * testsuite/arm_cortex_a8_blx.s: Ditto.
438         * testsuite/arm_cortex_a8_local.s: Ditto.
439         * testsuite/arm_fix_v4bx.s: Ditto.
440         * testsuite/arm_unaligned_reloc.s: Ditto.
441         * testsuite/thumb_bl_out_of_range.s: Ditto.
442         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
443         * testsuite/thumb_blx_out_of_range.s: Ditto.
444
445 2015-06-29  Han Shen  <shenhan@google.com>
446
447         Patch for erratum 843419 internal error.
448
449         * aarch64.cc (Erratum_stub::Insn_utilities): New typedef.
450         (Erratum_stub::update_erratum_insn): New method.
451         (Stub_table::relocate_stubs): Modified to place relocated insn.
452         (AArch64_relobj::fix_errata): Modified gold_assert.
453
454 2015-06-12  Han Shen  <shenhan@google.com>
455
456         Fix erratum 835769.
457
458         * aarch64.cc (AArch64_insn_utilities::BYTES_PER_INSN): Move
459         defintion outside class definition.
460         (AArch64_insn_utilities::AARCH64_ZR): New static constant.
461         (AArch64_insn_utilities::aarch64_op31): New member.
462         (AArch64_insn_utilities::aarch64_ra): New member.
463         (AArch64_insn_utilities::aarch64_mac): New member.
464         (AArch64_insn_utilities::aarch64_mlxl): New member.
465         (ST_E_835769): New global enum member.
466         (Stub_table::relocate_stubs): Add 835769 handler.
467         (Stub_template_repertoire::Stub_template_repertoire): Install new
468         stub type.
469         (AArch64_relobj::scan_errata): This func is renamed from
470         scan_erratum_843419.
471         (AArch64_relobj::do_count_local_symbols): Add 835769 handler.
472         (AArch64_relobj::do_relocate_sections): Add 835769 handler.
473         (AArch64_relobj::scan_sections_for_stubs): Add 835769 handler.
474         (Target_aarch64::scan_erratum_835769_span): New method.
475         (Target_aarch64::create_erratum_stub): New method.
476         (Target_aarch64::is_erratum_835769_sequence): New method.
477         (Target_aarch64::scan_erratum_843419_sequence): Move part of the
478         code into create_erratum_stub.
479         * options.h (fix_cortex_a53_835769): New option.
480
481 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
482
483         * aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
484         outside class body.
485         (Reloc_stub::STUB_ADDR_ALIGN): Likewise.
486
487 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
488
489         PR gold/17731
490         * layout.cc (corresponding_uncompressed_section_name): New function.
491         (Layout::choose_output_section): Call it.
492         * layout.h (corresponding_uncompressed_section_name): New function.
493         * script-sections.cc (Input_section_info::set_section_name): Check
494         for compressed debug section (.zdebug style).
495
496 2015-06-11  Jing Yu  <jingyu@google.com>
497
498         * testsuite/Makefile.am: Add -O0 for script_test_12 test.
499         * testsuite/Makefile.in: Regenerate.
500
501 2015-06-11  Davide Italiano  <dccitaliano@gmail.com>
502
503         * gold.h (is_cident): Correct typo.
504
505 2015-06-10  Han Shen  <shenhan@google.com>
506         Patch for erratum-843419 (2 of 2 - fix erratum occurrences).
507
508         Now fixing for 843419 is fully functional.
509
510         The first part of the erratum fix CL is here -
511         https://sourceware.org/ml/binutils/2015-04/msg00229.html
512
513         * aarch64.cc(global enum): New constants representing stub types.
514         (Stub_template): New POD struct.
515         (Stub_template_repertoire): New class.
516         (Stub_base): New class.
517         (Erratum_stub): New class.
518         (Reloc_stub): Refactored to be a subclass of Stub_base.
519         (Reloc_stub::Stub_type): Removed.
520         (Reloc_stub::offset): Moved to Stub_base.
521         (Reloc_stub::set_offset): Moved to Stub_base.
522         (Reloc_stub::destination_address): Moved to Stub_base.
523         (Reloc_stub::set_destination_address): Moved to Stub_base.
524         (Reloc_stub::reset_destination_address): Moved to Stub_base.
525         (Reloc_stub::stub_type): Renamed and moved to Stub_base.
526         (Reloc_stub::stub_size): Renamed and moved to Stub_base.
527         (Reloc_stub::stub_insns): Renamed and moved to Stub_base.
528         (Reloc_stub::write): Moved to Stub_base.
529         (Reloc_stub::invalid_offset): Moved to Stub_base.
530         (Reloc_stub::invalid_address): Moved to Stub_base.
531         (Reloc_stub::stub_type_): Renamed and moved to Stub_base.
532         (Reloc_stub::stub_insns_): Moved to Stub_base.
533         (Reloc_stub::offset_): Moved to Stub_base.
534         (Reloc_stub::destination_address_): Moved to Stub_base.
535         (Stub_table::The_aarch64_relobj): New typedef.
536         (Stub_table::The_erratum_stub): New typedef.
537         (Stub_table::The_erratum_stub_less): New typedef.
538         (Stub_table::The_erratum_stub_set): New typedef.
539         (Stub_table::The_erratum_stub_set_iter): New typedef.
540         (Stub_table::empty): Added emptiness testing for erratum stubs.
541         (Stub_table::add_erratum_stub): New method to add an erratum stub.
542         (Stub_table::find_erratum_stub): New method.
543         (Stub_table::find_erratum_stubs_for_input_section): New method.
544         (Stub_table::erratum_stub_address): New method.
545         (Stub_table::update_date_size_changed_p): Modified to handle erratum stubs.
546         (Stub_table::do_addralign): Modified to handle erratum stubs.
547         (Stub_table::erratum_stubs_): New member.
548         (Stub_table::erratum_stub_size_): New member.
549         (Stub_table::relocate_stubs): Modified to handle erratum stubs.
550         (Stub_table::do_write): Modified to handle erratum stubs.
551         (AArch64_relobj::The_erratum_stub): New typedef.
552         (AArch64_relobj::Erratum_stub_set_iter): New typedef.
553         (AArch64_relobj::fix_errata): New method.
554         (Target_aarch64::The_reloc_stub_type): Removed.
555         (Target_aarch64::The_erratum_stub): New typede.
556         (AArch64_relocate_functions::construct_b): New method.
557
558 2015-06-08  Nick Clifton  <nickc@redhat.com>
559
560         * po/fr.po: New French Translation.
561
562 2015-06-07  Cary Coutant  <ccoutant@gmail.com>
563
564         PR gold/18288
565         * resolve.cc (symbol_to_bits): Remove type parameter; adjust all
566         callers. Don't use STT_COMMON to check for common symbols.
567         (Symbol_table::resolve): Warn if relocatable object has STT_COMMON
568         symbol that's not in a common section.
569         * symtab.h (Symbol::is_common): Don't use STT_COMMON to check for
570         common symbols.
571
572 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
573
574         PR gold/18200
575         * Makefile.am (diststuff): Add target.
576         * Makefile.in: Regenerate.
577
578 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
579
580         PR gold/17498
581         * object.cc (Sized_relobj_file::do_count_local_symbols): Discard
582         temporary locals in merge sections.
583         * options.cc (General_options::parse_discard_all): New method.
584         (General_options::parse_discard_locals): New method.
585         (General_options::parse_discard_none): New method.
586         (General_options::General_options): Initialize discard_locals_.
587         * options.h (--discard-all): Convert to special option.
588         (--discard-locals): Likewise.
589         (--discard-none): New option.
590         (General_options::discard_all): New method.
591         (General_options::discard_locals): New method.
592         (General_options::discard_sec_merge): New method.
593         (General_options::Discard_locals): New enum.
594         (General_options::discard_locals_): New data member.
595
596 2015-06-03  Cary Coutant  <cary@google.com>
597
598         * script-sections.cc (Script_sections::Script_sections): Initialize
599         segments_created_.
600         (Script_sections::create_note_and_tls_segments): Set flag when
601         segments are created.
602         (Script_sections::expected_segment_count): Count PT_INTERP.
603         (Script_sections::attach_sections_using_phdrs_clause): Set flag when
604         segments are created.
605         * script-sections.h (Script_sections::segments_created_): New data
606         member.
607
608 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
609
610         PR gold/15370
611         * script-sections.cc
612         (Output_section_element_input::set_section_addresses): When there
613         are several patterns with no sort spec, put all sections in the same
614         bin.
615         * testsuite/Makefile.am (script_test_12): New testcase.
616         (script_test_12i): New testcase.
617         * testsuite/Makefile.in: Regenerate.
618         * testsuite/script_test_12.t: New test linker script.
619         * testsuite/script_test_12i.t: New test linker script.
620         * testsuite/script_test_12a.c: New test source file.
621         * testsuite/script_test_12b.c: New test source file.
622
623 2015-06-02  Cary Coutant  <ccoutant@gmail.com>
624
625         * nacl.h (Sniff_file): Switch parameters to get_view to get an
626         aligned view.
627
628 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
629
630         PR gold/17819
631         * gold.cc (queue_final_tasks): When --build-id=tree, queue a
632         separate task to schedule the build id computation.
633         * layout.cc (Hash_task::Hash_task): Remove build_id_blocker,
634         add Output_file and offset.
635         (Hash_task::run): Get and release the input views.
636         (Hash_task::is_runnable): Always return NULL (always runnable).
637         (Layout::queue_build_id_tasks): Remove.
638         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
639         parameters; use them instead of class members.
640         (Build_id_task_runner::run): New function.
641         (Close_task_runner::run): Pass array_of_hashes and size_of_hashes
642         to write_build_id.
643         * layout.h (Layout::queue_build_id_tasks): Remove.
644         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
645         parameters.
646         (Layout::array_of_hashes_): Remove.
647         (Layout::size_of_array_of_hashes_): Remove.
648         (Layout::input_view_): Remove.
649         (Build_id_task_runner): New class.
650         (Close_task_runner::Close_task_runner): Add array_of_hashes and
651         size_of_hashes parameters.
652         (Close_task_runner::array_of_hashes_): New data member.
653         (Close_task_runner::size_of_hashes_): New data member.
654         * testsuite/Makefile.am
655         (flagstest_compress_debug_sections_and_build_id_tree): New test.
656         * testsuite/Makefile.in: Regenerate.
657
658 2015-06-01  Rafael Ăvila de EspĂ­ndola <rafael.espindola@gmail.com>
659
660         * merge.cc (get_input_merge_map): Update for data structure change.
661         (get_or_make_input_merge_map): Update for data structure change.
662         * merge.h (Object_merge_map): Use a std::vector<std::pair>> instead of
663         a std::map. Remove first_shnum_, first_map_, second_shnum_, second_map_.
664
665 2015-05-16  Alan Modra  <amodra@gmail.com>
666
667         * reloc.cc (Sized_relobj_file::find_functions): Use function_location.
668         * powerpc.cc (Target_powerpc::do_calls_non_split): New function.
669         (addi_12_1, addis_2_12, addis_12_1, cmpld_7_12_0): New constants.
670         (lis_0): Rename from lis_0_0.
671
672 2015-04-29  Cary Coutant  <cary@google.com>
673             Rafael Ăvila de EspĂ­ndola <rafael.espindola@gmail.com>
674
675         * gc.h (Garbage_collection::is_section_garbage): Change Object*
676         to Relobj*.
677         (Garbage_collection::add_reference): Likewise.
678         (Garbage_collection::gc_process_relocs): Likewise. Don't push
679         object/shndx pair onto *secvec for dynamic objects. Don't follow
680         relocations pointing to dynamic objects for GC.
681         * icf.cc (Icf::find_identical_sections): Change Object* to Relobj*.
682         (Icf::unfold_section): Likewise.
683         (Icf::is_section_folded): Likewise.
684         (Icf::get_folded_section): Likewise.
685         * icf.h: (Icf::get_folded_section): Likewise.
686         (Icf::unfold_section): Likewise.
687         (Icf::is_section_folded): Likewise.
688         (Icf::section_has_function_pointers): Likewise.
689         (Icf::set_section_has_function_pointers): Likewise.
690         * object.h (Section_id): Likewise.
691         (Const_section_id): Likewise.
692         * output.cc (Output_section::update_section_layout): Likewise.
693         * output.h: (Output_section_lookup_maps::find_relaxed_input_section):
694         Likewise.
695         * plugin.cc (update_section_order): Likewise.
696         (unique_segment_for_sections): Likewise.
697         * powerpc.cc (Powerpc_relobj::add_reference): Likewise.
698         (Target_powerpc::do_gc_add_reference): Likewise.
699         (Target_powerpc::gc_process_relocs): Likewise.
700         (Target_powerpc::do_gc_add_reference): Likewise.
701         * symtab.cc (Symbol_table::is_section_folded): Likewise.
702         (Symbol_table::gc_mark_symbol): Likewise.
703         * symtab.h: (Symbol_table::is_section_folded): Likewise.
704         * target.h: (Sized_target::gc_add_reference): Likewise.
705         (Sized_target::do_gc_add_reference): Likewise.
706
707 2015-04-29  Nick Clifton  <nickc@redhat.com>
708
709         * po/fi.po: Updated Finnish translation.
710
711 2015-04-28  Alan Modra  <amodra@gmail.com>
712
713         * powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather
714         than unsigned int for find_global_entry result temp.  Compare
715         against invalid_address.
716         (Target_powerpc::do_plt_address_for_global): Likewise.
717         (Target_powerpc::Relocate::relocate): Likewise.  Don't assert
718         on plt call stub existence for debug info.  Do assert for plt
719         and global entry stub existence if an alloc section.
720
721 2015-04-28  Alan Modra  <amodra@gmail.com>
722
723         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert
724         on missing global entry stub due to bogus debug info.
725
726 2015-04-27  Han Shen  <shenhan@google.com>
727
728         * options.h (--fix-cortex-a53-843419): Rename option.
729         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Use renamed
730         option.
731         (AArch64_relobj::scan_sections_for_stubs): Use renamed option.
732
733 2015-04-27  Rafael Ăvila de EspĂ­ndola <rafael.espindola@gmail.com>
734
735         PR gold/18327
736         * output.cc (Output_section::is_input_address_mapped): Assume a missing
737         entry is mapped.
738         * testsuite/Makefile.am: Add the eh_test test.
739         * testsuite/Makefile.in: Regenerate.
740         * testsuite/eh_test_a.cc: New test.
741         * testsuite/eh_test_b.cc: New test.
742
743 2015-04-23  Sriraman Tallam  <tmsriram@google.com>
744
745         * options.h (--weak-unresolved-symbols): New option.
746         * symtab.cc (Symbol_table::sized_write_globals): Change symbol
747         binding to weak with new option.
748         * symtab.h (is_weak_undefined): Check for new option.
749         (is_strong_undefined): Check for new option.
750         * testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
751         * testsuite/Makefile.in: Regenerate.
752         * testsuite/weak_unresolved_symbols_test.cc: New file.
753
754 2015-04-20  Ian Coolidge  <icoolidge@google.com>
755
756         * symtab.cc (Symbol::should_add_dynsym_entry): Return true for
757         GNU_UNIQUE.
758
759 2015-04-17  Rafael Ăvila de EspĂ­ndola <rafael.espindola@gmail.com>
760
761         * gc.cc (Garbage_collection::do_transitive_closure): Use back and
762         push_back.
763         * gc.h (Garbage_collection): Use a std::vector instead of a std::queue.
764         * object.cc (Sized_relobj_file::do_layout): Use push_back.
765         * powerpc.cc (process_gc_mark): Use push_back.
766         (Target_powerpc::do_gc_mark_symbol): Use push_back.
767         * symtab.cc (Symbol_table::gc_mark_symbol): Use push_back.
768
769 2015-04-16  Han Shen  <shenhan@google.com>
770
771         * aarch64.cc (AArch64_insn_utilities): New utility class.
772         (AArch64_relobj::Mapping_symbol_position): New struct.
773         (AArch64_relobj::Mapping_symbol_info): New typedef.
774         (AArch64_relobj::do_count_local_symbols): New function overriding
775         parent's implementation.
776         (AArch64_relobj::mapping_symbol_info_): New member
777         (AArch64_relobj::scan_erratum_843419): New method.
778         (Target_aarch64::scan_erratum_843419_span): New method.
779         (Target_aarch64::is_erratum_843419_sequence): New method.
780         * options.h (fix_cortex_a53): New option.
781
782 2015-04-09  Cary Coutant  <ccoutant@google.com>
783
784         * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
785         in a PIE link.
786         * testsuite/Makefile.am (tls_pie_test.sh): New test.
787         * testsuite/Makefile.in: Regenerate.
788         * testsuite/tls_pie_test.sh: New.
789
790 2015-04-09  Cary Coutant  <ccoutant@google.com>
791
792         * debug.h (DEBUG_LOCATION): New.
793         (DEBUG_ALL): Include DEBUG_LOCATION.
794         (debug_string_to_enum): Add DEBUG_LOCATION.
795         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
796         output to print correct context.
797         (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
798         up to 4 more locations at the beginning of the function.
799         * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
800         result before sorting list of line numbers.
801         * testsuite/debug_msg.sh: Allow range of line numbers for
802         canonical results on optimized code.
803
804 2015-04-07  HC Yen <hc.yen@mediatek.com>
805
806         Add AArch32 support for gold linker.
807         gold/
808         * arm.cc: Add V8 arch combine table.
809
810 2015-04-06  Rafael Ăvila de EspĂ­ndola <rafael.espindola@gmail.com>
811
812         * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
813
814 2015-04-06  Rafael Ăvila de EspĂ­ndola <rafael.espindola@gmail.com>
815
816         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
817         to find by using the return value of insert.
818
819 2015-04-06  Rafael Ăvila de EspĂ­ndola <rafael.espindola@gmail.com>
820
821         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
822         constructor call.
823
824 2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>
825
826         PR gold/17641
827         * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
828         (Target_x86_64::Scan::local): Don't create GOT entry, when we
829         can convert mov to lea.
830         (Target_x86_64::Scan::global): Ditto.
831         (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
832         %reg to lea foo(%rip), %reg if possible.
833         * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
834         * testsuite/x86_64_mov_to_lea1.s: New.
835         * testsuite/x86_64_mov_to_lea2.s: Ditto.
836         * testsuite/x86_64_mov_to_lea3.s: Ditto.
837         * testsuite/x86_64_mov_to_lea4.s: Ditto.
838         * testsuite/x86_64_mov_to_lea.sh: Ditto.
839
840 2015-04-02  H.J. Lu  <hongjiu.lu@intel.com>
841
842         * configure: Regenerated.
843
844 2015-04-01  Ilya Tocar  <ilya.tocar@intel.com>
845
846         PR gold/17640
847         * i386.cc (Target_i386::can_convert_mov_to_lea): New.
848         (Target_i386::Scan::local): Don't create GOT entry, when we
849         can convert GOT to GOTOFF.
850         (Target_i386::Scan::global): Ditto.
851         (Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
852         lea foo@GOTOFF(%reg), %reg if possible.
853         * testsuite/Makefile.am (i386_mov_to_lea): New test.
854         * testsuite/i386_mov_to_lea1.s: New.
855         * testsuite/i386_mov_to_lea2.s: Ditto.
856         * testsuite/i386_mov_to_lea3.s: Ditto.
857         * testsuite/i386_mov_to_lea4.s: Ditto.
858         * testsuite/i386_mov_to_lea5.s: Ditto.
859         * testsuite/i386_mov_to_lea.sh: Ditto.
860
861 2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>
862
863         * Makefile.am (ZLIB): New.
864         (ZLIBINC): Likewise.
865         (AM_CFLAGS): Add $(ZLIBINC).
866         (AM_CXXFLAGS): Likewise.
867         (ldadd_varldadd_var): Add $(ZLIB).
868         (incremental_dump_LDADD): Likewise.
869         (dwp_LDADD): Likewise.
870         * compressed_output.cc: Don't check HAVE_ZLIB_H to include
871         <zlib.h>.
872         (zlib_compress): Don't check HAVE_ZLIB_H.
873         (zlib_decompress): Likewise.
874         * options.h (compress_debug_sections): Likewise.
875         * configure.ac (AM_CONDITIONAL): Removed.
876         * testsuite/Makefile.am (ZLIB): New.
877         (LDADD): Add $(ZLIB).
878         Don't check HAVE_ZLIB.
879         * Makefile.in: Regenerated.
880         * config.in: Likewise.
881         * configure: Likewise.
882         * testsuite/Makefile.in: Likewise.
883
884 2015-03-30  Jing Yu  <jingyu@google.com>
885
886         * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
887         TLSLD_ADD_DTPREL_LO12_NC.
888         * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
889         _TLS_MODULE_BASE_ point to the start of tls segment.
890         (Target_aarch64::optimize_tls_reloc): Add cases for
891         R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
892         R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
893         (Target_aarch64::Scan::local): Likewise.
894         (Target_aarch64::Scan::global): Likewise.
895         (Target_aarch64::Relocate::relocate): Likewise.
896         (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
897         subtracting tls segment size from symbol value for TLSLD_*_DTPREL
898         relocations.
899
900 2015-03-27  Rafael Ăvila de EspĂ­ndola <rafael.espindola@gmail.com>
901
902         * merge.cc (Object_merge_map::add_mapping): call
903         Object_merge_map::Input_merge_map::add_mapping.
904         (Object_merge_map::Input_merge_map::add_mapping): New.
905         (Output_merge_data::do_add_input_section): Call
906         get_or_make_input_merge_map before a loop.
907         (Output_merge_string<Char_type>::finalize_merged_data): Call
908         get_or_make_input_merge_map before a loop.
909         * merge.h (Object_merge_map): Make Input_merge_map public.
910         * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
911         (Relobj::get_or_create_merge_map): New.
912         * object.h (Relobj::get_or_create_merge_map): New.
913
914 2015-03-24  Alan Modra  <amodra@gmail.com>
915
916         PR 18147
917         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
918         relocation errors for branches to strong undefined symbols.
919
920 2015-03-23  Rafael Ăvila de EspĂ­ndola <rafael.espindola@gmail.com>
921
922         * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
923         (Object_merge_map::is_merge_section_for): Remove.
924         (Object_merge_map::find_merge_section): New.
925         * merge.h (Object_merge_map::is_merge_section_for): Remove.
926         (Object_merge_map::find_merge_section): New.
927         (Object_merge_map::get_input_merge_map): Add a const version.
928         * object.cc (Relobj::is_merge_section_for): Remove.
929         (Relobj::find_merge_section): New.
930         * object.h (Relobj::is_merge_section_for): Remove.
931         (Relobj::find_merge_section): New.
932         * output.cc
933         (Output_section::Input_section::is_merge_section_for): Remove.
934         (Output_section::add_merge_input_section): Don't call
935         add_merge_input_section.
936         (Output_section::find_merge_section): Return const. Use
937         object->find_merge_section.
938         (Output_section::build_lookup_maps): Don't build a map for
939         merge sections.
940         (Output_section::is_input_address_mapped): Return false if
941         section is not found.
942         (Output_section::find_starting_output_address): Use
943         find_merge_section instead of is_merge_section_for.
944         (Output_section::add_script_input_section):  Don't build a map for
945         merge sections.
946         * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
947         (Output_section_lookup_maps::find_merge_section): Remove.
948         (Output_section_lookup_maps::add_merge_input_section) Remove.
949         (Output_section::find_merge_section): Return const.
950
951 2015-03-22  Cary Coutant  <cary@google.com>
952
953         PR gold/18106
954         * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
955         non-SIB form of lea, with nop after the call.
956
957 2015-03-21  Cary Coutant  <cary@google.com>
958
959         PR gold/14217
960         * output.cc (Output_segment::is_first_section_relro): Don't ignore
961         .tdata section.
962         (Output_segment::set_section_addresses): Don't align size of relro
963         segment for .tbss.
964
965 2015-03-21  Cary Coutant  <cary@google.com>
966
967         PR gold/18010
968         * stringpool.cc (Stringpool_template): Don't optimize if section
969         alignment is greater than sizeof(char).
970
971 2015-03-21  Cary Coutant  <cary@google.com>
972
973         PR gold/18048
974         * script-c.h (script_include_directive): Add first_token parameter.
975         * script.cc (script_include_directive): Add first_token parameter, and
976         pass it to read_script_file.
977         * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
978         (PARSING_MEMORY_DEF): New tokens.
979         (top): Add new productions for INCLUDE files.
980         (file_cmd): Replace file_or_sections_cmd with copy of its productions.
981         Pass PARSING_LINKER_SCRIPT to script_include_directive.
982         (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
983         (section_cmd): Pass PARSING_SECTION_CMDS.
984         (file_or_sections_cmd): Remove.
985         (memory_def): Pass PARSING_MEMORY_DEF.
986         * testsuite/Makefile.am (memory_test_2): New test.
987         * testsuite/Makefile.in: Regenerate.
988         * testsuite/memory_test_inc.t: New script file.
989         * testsuite/memory_test_inc_1.t.src: New script file.
990         * testsuite/memory_test_inc_2.t.src: New script file.
991         * testsuite/memory_test_inc_3.t.src: New script file.
992
993 2015-03-21  Cary Coutant  <cary@google.com>
994
995         * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
996         (Sized_relobj_dwo::setup): Build compressed section map.
997         (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
998         * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
999         section map.
1000         * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
1001         compressed_sections_ field.
1002         (build_compressed_section_map): Take Object instead of
1003         Sized_relobj_file parameter; add decompress_if_needed parameter.
1004         (Sized_relobj_file::do_find_special_sections): Store compressed
1005         section map in parent Object.
1006         (Sized_relobj_file::do_decompressed_section_contents): Move
1007         implementation to Object::decompressed_section_contents.
1008         (Sized_relobj_file::do_discard_decompressed_sections): Move
1009         implementation to Object::discard_decompressed_sections.
1010         * object.h (build_compressed_section_map): Declare.
1011         (Object::Object): Add compressed_sections_ field.
1012         (Object::section_is_compressed): Move implementation here.
1013         (Object::decompressed_section_contents): De-virtualize.
1014         (Object::discard_decompressed_sections): De-virtualize.
1015         (Object::do_section_is_compressed): Delete.
1016         (Object::do_decompressed_section_contents): Delete.
1017         (Object::set_compressed_sections): New method.
1018         (Object::compressed_sections): New method.
1019         (Object::compressed_sections_): New data member.
1020         (Compressed_section_info, Compressed_section_map): Move to top of file.
1021         (Sized_relobj_file::do_section_is_compressed): Delete.
1022         (Sized_relobj_file::do_decompressed_section_contents): Delete.
1023         (Sized_relobj_file::do_discard_decompressed_sections): Delete.
1024         (Sized_relobj_file::compressed_sections_): Move to Object class.
1025
1026 2015-03-21  Cary Coutant  <ccoutant@google.com>
1027
1028         PR gold/18152
1029         * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
1030         deferred objects.
1031
1032 2015-03-11  Cary Coutant  <ccoutant@google.com>
1033
1034         * options.cc (General_options::finalize): Don't allow -z relro
1035         with incremental linking.
1036         * testsuite/Makefile.am (incremental_test): Add -z norelro.
1037         (incremental_test_2): Likewise.
1038         (incremental_test_3): Likewise.
1039         (incremental_test_4): Likewise.
1040         (incremental_test_5): Likewise.
1041         (incremental_test_6): Likewise.
1042         (incremental_copy_test): Likewise.
1043         (incremental_common_test_1): Likewise.
1044         (incremental_comdat_test_1): Likewise.
1045         * testsuite/Makefile.in: Regenerate.
1046
1047 2015-03-09  Cary Coutant  <ccoutant@google.com>
1048
1049         PR gold/14675
1050         * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
1051         return enum indicating whether .eh_frame section is empty, optimizable,
1052         unrecognized, or an end marker. Adjust explicit instantiations.
1053         * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
1054         (Eh_frame::add_ehframe_input_section): Change return type.
1055         * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
1056         * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
1057         to the .eh_frame output section until we see the end marker.
1058         (Layout::finalize_eh_frame_section): New.
1059         * layout.h: (Layout::finalize_eh_frame_section): New.
1060
1061 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
1062
1063         * output.cc (Relobj::initialize_input_to_output_map<size>):
1064         Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
1065
1066 2015-03-04  Cary Coutant  <ccoutant@google.com>
1067
1068         * parameters.cc (Parameters::set_target_once): Call
1069         Target::select_as_default_target just once from here...
1070         (set_parameters_target): ...instead of from here.
1071
1072 2015-03-04  Rafael Ăvila de EspĂ­ndola <rafael.espindola@gmail.com>
1073
1074         * ehframe.cc (Cie::set_output_offset): Pass in and use a
1075         Output_section_data instead of a Merge_map.
1076         (Eh_frame::Eh_frame): Don't initialize merge_map_.
1077         (Eh_frame::read_cie): Use add_merge_mapping instead of
1078         Merge_map::add_mapping.
1079         (Eh_frame::read_fde): Ditto.
1080         (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
1081         (Eh_frame::do_output_offset): Use merge_output_offset istead of
1082         merge_map_->get_output_offset.
1083         (Eh_frame::do_is_merge_section_for): Delete.
1084         * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
1085         instead of a Merge_map.
1086         (Cie::set_output_offset): Pass in a Output_section_data instead of a
1087         Merge_map.
1088         (Eh_frame::do_is_merge_section_for): Delete.
1089         (Eh_frame::merge_map_): Delete.
1090         * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
1091         and use a Output_section_data instead of a Merge_map.
1092         (Object_merge_map::add_mapping): Ditto.
1093         (Object_merge_map::get_output_offset): Remove the merge_map argument.
1094         (Object_merge_map::is_merge_section_for): Pass in and use a
1095         Output_section_data instead of a Merge_map.
1096         (Merge_map): Delete.
1097         (Output_merge_base::do_output_offset): Use merge_output_offset instead
1098         of merge_map_.get_output_offset.
1099         (Output_merge_base::do_is_merge_section_for): Delete.
1100         (Output_merge_data::do_add_input_section): Use
1101         object->add_merge_mapping instead of add_mapping.
1102         (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
1103         * merge.h (Merge_map): Delete forward declaration.
1104         (Object_merge_map::add_mapping): Pass in and use a Output_section_data
1105         instead of a Merge_map.
1106         (Object_merge_map::get_output_offset): Remove the merge_map argument.
1107         (Object_merge_map::is_merge_section_for): Pass in and use a
1108         Output_section_data instead of a Merge_map.
1109         (Input_merge_map::Object_merge_map::merge_map): Replace with
1110         output_data.
1111         (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
1112         Output_section_data instead of a Merge_map.
1113         (Merge_map): Delete.
1114         (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
1115         (Output_merge_base::do_is_merge_section_for): Delete.
1116         (Output_merge_base::add_mapping): Delete.
1117         (Output_merge_base::merge_map_): Delete.
1118         * object.cc (Relobj::initialize_input_to_output_map): New.
1119         (Relobj::initialize_input_to_output_map): New.
1120         (Relobj::merge_output_offset): New.
1121         (Relobj::is_merge_section_for): New.
1122         (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
1123         bits.
1124         * object.h (Relobj::merge_map): Delete.
1125         (initialize_input_to_output_map): New.
1126         (set_merge_map): Delete.
1127         (add_merge_mapping): New.
1128         (merge_output_offset): New.
1129         (is_merge_section_for): New.
1130         * output.cc (Output_section::Input_section::is_merge_section_for):
1131         Use object->is_merge_section_for.
1132         * output.h (Output_section_data::is_merge_section_for): Delete.
1133         (Output_section_data::do_is_merge_section_for): Delete.
1134         * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
1135         Use object->initialize_input_to_output_map.
1136         (Merged_symbol_value<size>::value_from_output_section): Use
1137         object->merge_output_offset.
1138
1139 2015-03-02  Peter Collingbourne  <pcc@google.com>
1140             Cary Coutant  <ccoutant@google.com>
1141
1142         * output.cc (Output_section::add_merge_input_section): Do not
1143         attempt to merge sections with an entsize of 0.
1144
1145 2015-03-02  Khem Raj  <raj.khem@gmail.com>
1146
1147         * attributes.h (class Output_attributes_section_data ): Add
1148         do_print_to_mapfile function.
1149
1150 2015-02-24  Alan Modra  <amodra@gmail.com>
1151
1152         PR 18010
1153         * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
1154         complain if value is not a multiple of four.
1155         (Target_powerpc::Relocate::relocate): Correct handling of
1156         R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
1157
1158 2015-02-21  H.J. Lu  <hongjiu.lu@intel.com>
1159
1160         * configure.ac (default_size): Set to 32 for x32.
1161         * configure: Regenerated.
1162
1163 2015-02-18  Alan Modra  <amodra@gmail.com>
1164
1165         PR 17954
1166         * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
1167         visibility.
1168
1169 2015-02-17  Rafael Ăvila de EspĂ­ndola <rafael.espindola@gmail.com>
1170
1171         * gc.h (Garbage_collection::add_reference): Don't use find.
1172
1173 2015-02-17  Rafael Ăvila de EspĂ­ndola <rafael.espindola@gmail.com>
1174
1175         * object.cc (write_local_symbols): avoid std::vector copy.
1176
1177 2015-02-17  Rafael Ăvila de EspĂ­ndola <rafael.espindola@gmail.com>
1178
1179         * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
1180
1181 2015-02-09  Mark Wielaard  <mjw@redhat.com>
1182
1183         * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
1184         DW_LANG_Fortran03 and DW_LANG_Fortran08.
1185
1186 2015-02-16  Cary Coutant  <ccoutant@google.com>
1187
1188         PR gold/13577
1189         PR gold/16992
1190         * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
1191         DF_SYMBOLIC if --dynamic-list option is used.
1192         * options.cc (General_options::finalize): --dynamic-list is not
1193         mutually exclusive with -Bsymbolic.
1194         * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
1195         listed in --dynamic-list.
1196         * testsuite/Makefile.am (dynamic_list_lib2.so): Add
1197         -Bsymbolic-functions.
1198         * testsuite/Makefile.in: Regenerate.
1199
1200 2015-02-16  Cary Coutant  <ccoutant@google.com>
1201
1202         PR gold/17971
1203         * incremental.cc: Remove redundant include of "output.h".
1204
1205 2015-02-12  Jing Yu  <jingyu@google.com>
1206
1207         * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
1208         TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
1209         New relocation.
1210         * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
1211         TLSLE_MOVW_* relocations.
1212         (Target_aarch64::Scan::global): Likewise.
1213         (Target_aarch64::Relocate::relocate): Likewise.
1214         (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
1215         for new TLSLE_MOVW_* relocations.
1216
1217 2015-02-11  Will Newton  <will.newton@linaro.org>
1218
1219         PR gold/13321
1220         * arm.cc (Target_arm::make_plt_section): Create an ARM
1221         state mapping symbol at the start of the PLT.
1222
1223 2015-02-09  H.J. Lu  <hongjiu.lu@intel.com>
1224
1225         * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
1226         Replace two_file_shared_2.so with two_file_shared_1.so.
1227         * testsuite/Makefile.in: Regenerated.
1228
1229 2015-02-09  Alan Modra  <amodra@gmail.com>
1230
1231         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
1232         plugin_test_thin.a and defsym_test.
1233         * testsuite/Makefile.in: Regenerate.
1234
1235 2015-02-04  Rafael Ăvila de EspĂ­ndola <rafael.espindola@gmail.com>
1236
1237         * merge.cc (do_add_input_section): Combine loop epilogue into main loop
1238         body.
1239
1240 2015-02-04  Peter Collingbourne  <pcc@google.com>
1241
1242         * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
1243         forwarding symbols when computing symbol resolution info for plugins.
1244         * plugin.h (Plugin_manager::symtab): New method.
1245         (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
1246
1247 2015-02-03  Cary Coutant  <ccoutant@google.com>
1248             Peter Collingbourne  <pcc@google.com>
1249
1250         PR gold/15660
1251         * archive.cc (Thin_archive_object_unlocker): New class.
1252         (Archive::include_member): Unlock external members of thin archives.
1253         * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
1254         (plugin_test_2): Likewise.
1255         (plugin_test_3): Likewise.
1256         (plugin_test_4): Likewise.
1257         (plugin_test_5): Likewise.
1258         (plugin_test_6): Likewise.
1259         (plugin_test_7): Likewise.
1260         (plugin_test_8): Likewise.
1261         (plugin_test_9): Likewise.
1262         (plugin_test_10): Likewise.
1263         (plugin_test_11): New test case.
1264         * testsuite/Makefile.in: Regenerate.
1265         * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
1266         file to decide whether to claim file.
1267         (all_symbols_read_hook): Likewise.
1268         * testsuite/plugin_test_1.sh: Adjust expected output.
1269         * testsuite/plugin_test_2.sh: Likewise.
1270         * testsuite/plugin_test_3.sh: Likewise.
1271         * testsuite/plugin_test_6.sh: Likewise.
1272         * testsuite/plugin_test_tls.sh: Likewise.
1273         * testsuite/plugin_test_11.sh: New testcase.
1274
1275 2015-02-03  Cary Coutant  <ccoutant@google.com>
1276
1277         * descriptors.cc (Descriptors::open): Set artificially-low limit for
1278         file descriptors when debugging enabled. Add debug output.
1279         (Descriptors::release): Add debug output.
1280         (Descriptors::close_some_descriptor): Likewise.
1281         (Descriptors::close_all): Likewise.
1282         * fileread.cc (File_read::lock): Likewise.
1283         (File_read::unlock): Likewise.
1284
1285 2015-02-02  Cary Coutant  <ccoutant@google.com>
1286
1287         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
1288         executable output file.
1289
1290 2015-01-22  Han Shen  <shenhan@google.com>
1291
1292         * arm.cc (Target_arm::Target_arm): Add initialization for new members.
1293         (Target_arm::do_plt_address_for_global): New method.
1294         (Target_arm::do_plt_address_for_local): New method.
1295         (Target_arm::rel_irelative_section): New method.
1296         (Target_arm::make_data_plt): Add more parameters for plt ctor.
1297         (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
1298         (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
1299         (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
1300         (Target_arm::Scan::check_non_pic): Add ifunc support.
1301         (Target_arm::Scan::local): Add ifunc support.
1302         (Target_arm::Scan::global): Add ifunc support.
1303         (Target_arm::make_plt_section): New method.
1304         (Target_arm::make_plt_entry): Change to call to make_plt_section.
1305         (Target_arm::make_local_ifunc_plt_entry): New method.
1306         (Target_arm::got_irelative_): New member.
1307         (Target_arm::rel_irelative_): New member.
1308         (Target_arm::got_section): Add creation for got_irelative_.
1309         (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
1310         (Target_arm::Relocate::relocate): Properly set local ifunc address.
1311         (Target_arm::do_dynsym_value): Properly set global ifunc address.
1312         (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
1313         (Output_data_plt_arm::IRelative_data): New type.
1314         (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
1315         (Output_data_plt_arm::add_entry): Add more parameters.
1316         (Output_data_plt_arm::add_relocation): New method.
1317         (Output_data_plt_arm::add_local_ifunc_entry): New method.
1318         (Output_data_plt_arm::rel_irelative): New method.
1319         (Output_data_plt_arm::entry_count): Modified.
1320         (Output_data_plt_arm::address_for_global): New method.
1321         (Output_data_plt_arm::address_for_local): New method.
1322 gold/
1323         (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
1324         (Output_data_plt_arm::insert_irelative_data): New method.
1325         (Output_data_plt_arm::irelative_rel_): New member.
1326         (Output_data_plt_arm::got_): New member.
1327         (Output_data_plt_arm::got_irelative_): New member.
1328         (Output_data_plt_arm::irelative_count_): New member.
1329         (Output_data_plt_arm::IRelative_data_vec): New typedef.
1330         (Output_data_plt_arm::irelative_data_vec_): New member.
1331         (Output_data_plt_arm::do_write): Write out irelative entries.
1332         (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
1333         more parameters to ctor.
1334         (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
1335         more parameters to ctor.
1336         * output.h (Output_data_reloc::add_local_relative): New method.
1337         * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
1338
1339 2015-01-29  Alan Modra  <amodra@gmail.com>
1340
1341         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
1342         and GOT_TLSGD to LE optimization.
1343
1344 2015-01-28  Cary Coutant  <ccoutant@google.com>
1345
1346         * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
1347         for undef TLS symbols.
1348         (Target_x86_64::Relocate::relocate_tls): Likewise.
1349         (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
1350
1351 2015-01-25  Cary Coutant  <ccoutant@google.com>
1352
1353         * output.cc (Output_segment::set_section_addresses): Fix calculation
1354         of size of relro segment.
1355
1356 2015-01-22  Alan Modra  <amodra@gmail.com>
1357
1358         * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
1359         condition for need of ifunc plt entry.
1360         (Target_powerpc::Scan::global <got relocs>): Likewise.
1361
1362 2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1363
1364         * mips.cc (reloc_high): Add r_sym.
1365         (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
1366         reloc_high constructor.
1367         (Mips_relocate_functions::relgot16_local): Likewise.
1368         (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
1369         r_type to decide whether LO16 matches HI16.
1370         (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
1371         rello16 and relgot16_local.
1372
1373 2015-01-09  Cary Coutant  <ccoutant@google.com>
1374
1375         * layout.cc (Layout::set_segment_offsets): Don't align start of segment
1376         unless alignment is larger than page size.
1377
1378 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1379             Cary Coutant  <ccoutant@google.com>
1380
1381         PR gold/17729
1382         * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
1383         (DEFAULT_TARGET_X32): Set for x32.
1384         * x86_64.cc (cmp_insn_32): New.
1385         (lea_r10_insn_32): Likewise.
1386         (lea_r11_insn_32): Likewise.
1387         (cmp_insn_64): Likewise.
1388         (lea_r10_insn_64): Likewise.
1389         (lea_r11_insn_64): Likewise.
1390         (Target_x86_64<size>::do_calls_non_split): Handle x32.
1391         * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
1392         (check_DATA): Add split_x32 files.
1393         (split_x32_[1234n].o): New targets.
1394         (split_x32_[124]): New targets.
1395         (split_x32_[1234r].stdout): New targets.
1396         * testsuite/split_x32.sh: New file.
1397         * testsuite/split_x32_1.s: Likewise.
1398         * testsuite/split_x32_2.s: Likewise.
1399         * testsuite/split_x32_3.s: Likewise.
1400         * testsuite/split_x32_4.s: Likewise.
1401         * testsuite/split_x32_n.s: Likewise.
1402         * configure: Regenerated.
1403         * testsuite/Makefile.in: Likewise.
1404
1405 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1406
1407         PR gold/17809
1408         * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
1409         x32.
1410
1411 2015-01-02  Alan Modra  <amodra@gmail.com>
1412
1413         * version.cc (print_version): Just print current year.
1414         * dwp.cc (print_version): Likewise.
1415
1416 2015-01-01  Alan Modra  <amodra@gmail.com>
1417
1418         Update year range in copyright notice of all files.
1419
1420 2014-12-25  Alan Modra  <amodra@gmail.com>
1421
1422         * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
1423         new enums.
1424         (Target_arm::merge_object_attributes, ): Likewise.
1425
1426 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
1427
1428         * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
1429         as hard float only when Tag_ABI_VFP_args is 1, using new enum value
1430         AEABI_VFP_args_vfp to check that.
1431         (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
1432         value and replace hardcoded values by enum values.
1433
1434 2014-12-22  Cary Coutant  <ccoutant@google.com>
1435
1436         * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
1437
1438 2014-12-20  H.J. Lu  <hongjiu.lu@intel.com>
1439
1440         PR gold/14608
1441         * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
1442         to "return i * i * 3;".
1443
1444 2014-12-16  Cary Coutant  <ccoutant@google.com>
1445
1446         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
1447         (Mapfile::print_output_data): Use current_data_size() to avoid
1448         assert for sections requiring postprocessing; if address is not valid,
1449         print 0.
1450         (Mapfile::print_output_section): Use current_data_size(); print note
1451         that addresses and sizes are before compression.
1452
1453 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
1454
1455         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1456         Cast current_group_size to unsigned long when reporting error.
1457
1458 2014-12-10  Jing Yu  <jingyu@google.com>
1459
1460         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
1461         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
1462         Update error message.
1463         (Target_aarch64::do_relax): Use absolute value of option
1464         stub_group_size. Replace local variable with class member
1465         stub_group_size_.
1466
1467 2014-12-04  Alan Modra  <amodra@gmail.com>
1468
1469         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
1470         addend of PLTREL24 reloc when not generating a plt stub.  Make
1471         max_branch_offset an "Address".
1472         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
1473         (Target_powerpc::Relocate::relocate): Likewise.
1474
1475 2014-12-04  Alan Modra  <amodra@gmail.com>
1476
1477         PR 17670
1478         * symtab.cc (Symbol::set_undefined): Remove assertion.
1479         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1480         on symbols defined in discarded sections, instead return false.
1481         Rearrange params, update all callers.
1482         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
1483         branches to syms in discarded sections.
1484         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
1485         undefined and flag as discarded.
1486         (Target_powerpc::Relocate::relocate): Localize variable.
1487
1488 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
1489
1490         PR gold/17675
1491         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
1492         * testsuite/Makefile.in: Regenerated.
1493
1494 2014-12-03  Alan Modra  <amodra@gmail.com>
1495
1496         PR 17566
1497         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
1498         when adding dynamic relocations against section symbols.
1499
1500 2014-12-01  Dimitry Ivanov <dimitry@google.com>
1501
1502         * layout.cc (Layout::finish_dynamic_section): When '-z global'
1503         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
1504         * options.h (General_options): New -z option (global).
1505
1506 2014-12-01  Cary Coutant  <ccoutant@google.com>
1507
1508         PR gold/17578
1509         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
1510         is given.
1511         (Layout::create_executable_stack_info): Warn when -z noexecstack is
1512         given but some inputs require executable stack.
1513
1514 2014-11-26  Cary Coutant  <ccoutant@google.com>
1515
1516         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
1517         .debug_str_offsets; strip .debug_gnu_pubnames and
1518         .debug_gnu_pubtypes.
1519         (lines_only_debug_sections): Strip all four new sections.
1520
1521 2014-11-26  Jing Yu  <jingyu@google.com>
1522
1523         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
1524         register to be x0 when to relax TLSDESC_LD64_LO12.
1525
1526 2014-11-26  Alan Modra  <amodra@gmail.com>
1527
1528         * powerpc.cc (struct Stub_table_owner): New.
1529         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
1530         unsigned int vector.  Update all references.
1531         (powerpc_relobj::set_stub_table): Take an unsigned int param
1532         rather than a Stub_table.  Update callers.
1533         (Powerpc_relobj::clear_stub_table): New function.
1534         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
1535         stub_group_size_ vars.
1536         (Target_powerpc::new_stub_table): Delete.
1537         (max_branch_delta): New function, extracted from..
1538         (Target_powerpc::Relocate::relocate): ..here..
1539         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
1540         status on whether stub created successfully.
1541         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
1542         default sizing to..
1543         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
1544         reduce on relax failure.
1545         (Target_powerpc::group_sections): Add "no_size_errors" param.
1546         Use stub_group_size_.  Set up group info in a temp vector,
1547         before building Stub_table vector.  Account for input sections
1548         possibly already converted to relaxed sections.
1549         (Stub_table::init): Delete.  Merge into..
1550         (Stub_table::Stub_table): ..here.
1551         (Stub_table::can_reach_stub): New function.
1552         (Stub_table::add_plt_call_entry): Add "from" parameter and
1553         return true iff stub could be reached.
1554         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
1555         param too.
1556         (Stub_table::clear_stubs): Add "all" param.
1557
1558 2014-11-26  Alan Modra  <amodra@gmail.com>
1559
1560         * powerpc.cc (Stub_control::set_output_and_owner): New function.
1561         (Target_powerpc::group_sections): Use it.
1562
1563 2014-11-25  Cary Coutant  <ccoutant@google.com>
1564
1565         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
1566         (Binary_to_elf::write_symbol): Add st_size parameter.
1567         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
1568
1569 2014-11-25  Cary Coutant  <ccoutant@google.com>
1570
1571         PR gold/17639
1572         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
1573         (Sized_relobj_file::do_layout): Handle deferred sections properly
1574         during GC pass 1. Don't add reloc sections to deferred list twice.
1575         * object.h (Sized_relobj_file::is_deferred_layout): New function.
1576         (Sized_relobj_file::is_deferred_layout_): New data member.
1577
1578 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
1579
1580         PR gold/17619
1581         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
1582         Check PC-relative offset overflow in PLT entry.
1583
1584 2014-11-21  Alan Modra  <amodra@gmail.com>
1585
1586         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
1587         for undefined weaks.
1588
1589 2014-11-20  Alan Modra  <amodra@gmail.com>
1590
1591         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
1592         from --stub-group-size parameter divided by 1024.
1593         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
1594         template parameter.  Update all uses.
1595         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
1596         has_stub_value.  Set for long branches.  Don't report overflow for
1597         branch to undefined weak symbols.  Print info message on
1598         overflowing branch to stub.
1599
1600 2014-11-20  Alan Modra  <amodra@gmail.com>
1601
1602         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
1603
1604 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
1605
1606         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
1607         entry for R_X86_64_GOTPLT64.
1608         (Target_x86_64<size>::Relocate::relocate): Update comments for
1609         R_X86_64_GOTPLT64.
1610
1611 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
1612
1613         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
1614         * plugin.h: add lock definition
1615
1616 2014-10-29  Han Shen  <shenhan@google.com>
1617             Jing Yu   <jingyu@google.com>
1618
1619         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
1620         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1621         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
1622         Symbol::TLS_REF.
1623         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
1624         method.
1625         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
1626         (Target_aarch64::tls_ld_to_le): New method.
1627         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
1628         for 64bit targets.
1629         (Output_data_plt_aarch64::irelative_rel_): New data member.
1630         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
1631         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
1632         (Output_data_plt_aarch64::add_relocation): New method.
1633         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
1634         offset. Add got_irelative size to got size.
1635         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
1636         type string with the new typename.
1637         (AArch64_relocate_functions::update_adr): Replace parameter x with
1638         immed.
1639         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
1640         (AArch64_relocate_functions::reloc_common): New method.
1641         (AArch64_relocate_funcsions::rela_general): Extract common part out
1642         into reloc_common method.
1643         (AArch64_relocate_functions::rela_general): Likewise.
1644         (AArch64_relocate_functions::pcrela_general): Likewise.
1645         (AArch64_relocate_functions::adr): New method.
1646         (AArch64_relocate_functions::adrp): Calculate immed before calling
1647         update_adr.
1648         (AArch64_relocate_functions::adrp): Likewise.
1649         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
1650         comparing x to 0. Calculate immed from ~x when x < 0.
1651         (Target_aarch64::optimize_tls_reloc): Add new cases for
1652         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1653         TLSLD_MOVW_DTPREL_G0_NC.
1654         (Target_aarch64::possible_function_pointer_reloc): Implement this
1655         method.
1656         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
1657         comment.
1658         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
1659         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1660         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1661         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
1662         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1663         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1664         (Target_aarch64::make_plt_entry): Call add_entry with two more
1665         parameters.
1666         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1667         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
1668         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1669         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1670         (Target_aarch64::Relocate::relocate_tls): Add cases for
1671         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1672         TLSLD_MOVW_DTPREL_G0_NC.
1673         * testsuite/icf_safe_so_test.cc: Correct test comment.
1674         * testsuite/icf_safe_test.sh: Add AArch64 arch.
1675
1676 2014-10-22  Alan Modra  <amodra@gmail.com>
1677
1678         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
1679         thread_starter.
1680
1681 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
1682
1683         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
1684
1685 2014-10-17  Cary Coutant  <ccoutant@google.com>
1686
1687         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1688         Add "typename" keyword.
1689
1690 2014-10-15  Han Shen  <shenhan@google.com>
1691             Jing Yu   <jingyu@google.com>
1692
1693         Patch for gold aarch64 backend to support relaxation.
1694         * aarch64-reloc.def: Change format.
1695         * aarch64.cc (class Reloc_stub): New class.
1696         (class Stub_table): New class.
1697         (class AArch64_relobj): New class.
1698         (class AArch64_input_section): New class.
1699         (class AArch64_output_section): New class.
1700         (Target_aarch64::new_stub_table): New method.
1701         (Target_aarch64::new_aarch64_input_section): New method.
1702         (Target_aarch64::find_aarch64_input_section): New method.
1703         (Target_aarch64::scan_section_for_stubs): New method.
1704         (Target_aarch64::scan_reloc_section_for_stubs): New method.
1705         (Target_aarch64::relocate_stub): New method.
1706         (Target_aarch64::current_target): New method.
1707         (Target_aarch64::do_make_elf_object): New method.
1708         (Target_aarch64::do_may_relax): New method.
1709         (Target_aarch64::do_relax): New method.
1710         (Target_aarch64::group_sections): New method.
1711         (Target_aarch64::scan_reloc_for_stub): New method.
1712         (Target_aarch64::do_make_output_section): New method.
1713         (Target_aarch64::stub_tables_): New data member.
1714         (Target_aarch64::aarch64_input_section_map_): New data member.
1715         (AArch64_relocate_functions::maybe_apply_stub): New method.
1716
1717 2014-09-30  Cary Coutant  <ccoutant@google.com>
1718
1719         PR gold/17432
1720         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
1721
1722 2014-09-30  Kito Cheng  <kito@0xlab.org>
1723
1724         PR gold/13597
1725         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
1726         hash table before sysv-style hash table.
1727
1728 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
1729
1730         * options.h (--pic-executable): Add negative to alias to -no-pie.
1731
1732 2014-09-26  Cary Coutant  <ccoutant@google.com>
1733
1734         PR gold/16773
1735         * object.cc (Sized_relobj_file): Compute value of section symbols
1736         for TLS sections the same as TLS symbols.
1737
1738 2014-09-25  Cary Coutant  <ccoutant@google.com>
1739
1740         PR gold/17432
1741         * resolve.cc (Symbol_table::resolve): Override common placeholder
1742         symbols, but adjust sizes.
1743         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
1744         symbols to common lists.
1745
1746 2014-09-24  Alan Modra  <amodra@gmail.com>
1747
1748         * po/POTFILES.in: Regenerate.
1749
1750 2014-09-23  Taiju Tsuiki  <tzik@google.com>
1751             Cary Coutant  <ccoutant@google.com>
1752
1753         PR gold/14860
1754         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
1755         on input_sections_blocker.
1756         * layout.cc (Write_sections_task::locks): Unblock
1757         input_sections_blocker_.
1758         * layout.h (Write_sections_task::Write_sections_task): Add
1759         input_sections_blocker.
1760         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
1761         to DEPENDENCIES.
1762         * testsuite/Makefile.in: Regenerate.
1763
1764 2014-09-18  Rafael Ăvila de EspĂ­ndola <rafael.espindola@gmail.com>
1765
1766         * testsuite/Makefile.am (plugin_test_10): New test.
1767         * testsuite/Makefile.in: Regenerate
1768         * testsuite/plugin_common_test_2.c (c1): Align to 8.
1769         * testsuite/plugin_test_10.sh: New file.
1770
1771 2014-09-17  Rafael Ăvila de EspĂ­ndola <rafael.espindola@gmail.com>
1772
1773         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
1774         * resolve.cc (Symbol_table::resolve): Don't override common symbols
1775         during the replacement phase.
1776
1777 2014-09-17  Han Shen  <shenhan@google.com>
1778             Jing Yu  <jingyu@google.com>
1779
1780         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
1781         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
1782         * aarch64.cc (Target_aarch64): Add data members
1783         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
1784         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
1785         constructor.
1786         (Target_aarch64::do_reloc_symbol_index): New method.
1787         (Target_aarch64::do_reloc_addend): New method.
1788         (Target_aarch64::add_tlsdesc_info): New method.
1789         (Target_aarch64::do_dynsym_value): New method.
1790         (Target_aarch64::do_make_data_plt): Add new parameters: got,
1791         got_irelative. Pass them to Output_data_plt_aarch64_standard.
1792         (Target_aarch64::make_data_plt): Add new parameters: got,
1793         got_irelative. Pass them to do_make_data_plt.
1794         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
1795         (Target_aarch64::Relocate:tls_gd_to_le): New method.
1796         (Target_aarch64::Relocate:tls_ie_to_le): New method.
1797         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
1798         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
1799         (Target_aarch64::got_tlsdesc_section): New method.
1800         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1801         (Target_aarch64::define_tls_base_symbol): New method.
1802         (Target_aarch64::reserve_tlsdesc_entries): New method.
1803         (Target_aarch64::got_mod_index_entry): New method.
1804         (Target_aarch64::rela_tlsdesc_section): New method.
1805         (Target_aarch64::rela_irelative_section): New method.
1806         (Target_aarch64::Tlsdesc_info): New struct.
1807         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
1808         relocations and tlsdesc relocations.
1809         (Target_aarch64::optimize_tls_reloc): Implement method.
1810         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
1811         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
1812         in constructor.
1813         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
1814         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
1815         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
1816         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
1817         (Output_data_plt_aarch64::rela_tlsdesc): New method.
1818         (Output_data_plt_aarch64::rela_irelative): New method.
1819         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
1820         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
1821         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
1822         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
1823         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
1824         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
1825         (Output_data_plt_aarch64_standard): New member variables:
1826         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
1827         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
1828         New parameter: got, got_irelative.
1829         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
1830         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
1831         (Output_data_plt_aarch64::do_write): Replace got_address with
1832         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
1833         (AArch64_relocate_functions::update_movnz): New method.
1834         (AArch64_relocate_functions): Correct format.
1835         (AArch64_relocate_functions::movnz): New method.
1836         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
1837         before the switch. Add new cases to switch.
1838         Check ie_to_le relaxation on tlsie relocations. Add code handling
1839         tlsgd tlsdesc cases.
1840         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
1841         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
1842         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
1843         Call reloc_name_in_error_message to print unsupported reloc.
1844         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
1845         make_data_plt.
1846         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
1847         relocs. Fill in some more dynamic tags.
1848         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
1849         Skip call tls_get_addr when tlsgd is relaxed.
1850         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
1851         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
1852         tlsdesc->ie relaxation.
1853
1854 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1855
1856         * mips.cc (Target_mips_nacl): New class.
1857         (Target_selector_mips_nacl): New class.
1858         (target_selector_mips32): Rename from target_selector_mips32be and use
1859         Target_selector_mips_nacl instead of Target_selector_mips.
1860         (target_selector_mips32el): Rename from target_selector_mips32 and use
1861         Target_selector_mips_nacl instead of Target_selector_mips.
1862         (target_selector_mips64): Rename from target_selector_mips64be and use
1863         Target_selector_mips_nacl instead of Target_selector_mips.
1864         (target_selector_mips64el): Rename from target_selector_mips64 and use
1865         Target_selector_mips_nacl instead of Target_selector_mips.
1866         (Target_mips::mips_info): Add const attribute.
1867
1868 2014-09-02  Cary Coutant  <ccoutant@google.com>
1869
1870         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
1871         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
1872         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
1873         (Sized_incr_dynobj::do_section_name): Likewise.
1874         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
1875         (Sized_incr_dynobj::do_section_name): Likewise.
1876         * object.h (Object::section_name): Likewise.
1877         (Object::do_section_name): Likewise.
1878         (Sized_relobj_file::do_section_name): Likewise.
1879         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
1880         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
1881
1882 2014-09-02  Cary Coutant  <ccoutant@google.com>
1883
1884         PR gold/17005
1885         * ehframe.cc (Fde::write): Add output_offset parameter.
1886         (Cie::write): Likewise.
1887         (Eh_frame::set_final_data_size): Account for offset within output
1888         section.
1889         (Eh_frame::do_sized_write): Likewise.
1890         * ehframe.h (Fde::write): Add output_offset parameter.
1891         (Cie::write): Likewise.
1892         * output.cc (Output_section::Input_section_sort_entry): Remove
1893         section_has_name_; add output_section_name parameter. Use
1894         output section name for non-input sections.
1895         (Output_section::Input_section_sort_entry::section_has_name): Remove.
1896         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
1897         (Output_section::Input_section_sort_compare): Remove logic for
1898         sections without names.
1899         (Output_section::Input_section_sort_init_fini_compare): Likewise.
1900         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
1901         Likewise.
1902         (Output_section::Input_section_sort_section_name_compare): Likewise.
1903
1904 2014-08-29 Han Shen <shenhan@google.com>
1905            Jing Yu <jingyu@google.com>
1906
1907         * aarch64-reloc-property.cc
1908         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
1909         reference reloc property in the table.
1910         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
1911         3 other entries.
1912         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
1913         2 new overloaded methods.
1914         (Output_data_got_aarch64::do_write): Add code to write out
1915         static relocs.
1916         (class Output_data_got_aarch64::Static_reloc): New class to wrap
1917         static relocs.
1918         (Output_data_got_aarch64::static_relocs): New vector to
1919         hold static relocs.
1920         (Target_aarch64::TCB_SIZE): New const static memeber.
1921         (Target_aarch64::tcb_size): New method.
1922         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
1923         (Target_aarch64::Relocate::relocate_tls): New method.
1924         (Target_aarch64::Scan::local): Add code handling new reloc types.
1925         (Target_aarch64::Scan::global): Add code handling new reloc types.
1926
1927 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
1928
1929         * options.h (-no-pie): Add option.
1930
1931 2014-08-08  Jing Yu  <jingyu@google.com>
1932             Han Shen  <shenhan@google.com>
1933
1934         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
1935         (DEFFILES): add aarch64-reloc.def.
1936         (TARGETSOURCES): Add aarch64-reloc-property.cc.
1937         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
1938         * Makefile.in: Regenerate.
1939         * aarch64-reloc-property.cc: New file.
1940         * aarch64-reloc-property.h: New file.
1941         * aarch64-reloc.def: New file.
1942         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
1943         with tab to make the format consistent.
1944         (Output_data_got_aarch64::symbol_table_): New method.
1945         (Target_aarch64::do_plt_address_for_global): New method.
1946         (Target_aarch64::do_plt_address_for_local): New method.
1947         (Target_aarch64::do_select_as_default_target): New method.
1948         (Target_aarch64::do_make_data_plt): New method.
1949         (Target_aarch64::make_data_plt): New method.
1950         (Output_data_plt_aarch64::has_irelative_section): New method.
1951         (Output_data_plt_aarch64::address_for_global): New method.
1952         (Output_data_plt_aarch64::address_for_local): New method.
1953         (Output_data_plt_aarch64::irelative_rel_): New parameter.
1954         (Output_data_plt_aarch64::add_entry): Implement contents.
1955         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
1956         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
1957         the got_pov entry to plt0.
1958         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
1959         Implement contents.
1960         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
1961         (AArch64_howto): New struct.
1962         (aarch64_howto[]): New static const array.
1963         (AArch64_relocate_functions): New class.
1964         (Target_aarch64::Scan::get_reference_flags): Remove method.
1965         (Target_aarch64::Scan::local): Implement to support a few relocations.
1966         (Target_aarch64::Scan::global): Implement to support a few relocations.
1967         (Target_aarch64::make_plt_section): Implement contents.
1968         (Target_aarch64::make_plt_entry): Implement contents.
1969         (Target_aarch64::do_finalize_sections): Implement contents.
1970         (Target_aarch64::Relocate::relocate): Implement a few relocations.
1971         (Target_aarch64::relocate_section): Implement contents.
1972
1973 2014-08-06  Alan Modra  <amodra@gmail.com>
1974
1975         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
1976
1977 2014-08-06  Alan Modra  <amodra@gmail.com>
1978
1979         PR 13227
1980         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
1981
1982 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
1983
1984         * object.cc (Relobj::is_section_name_included): Add
1985         ".rodata.nptl_version" to not garbage collect this section.
1986
1987 2014-07-08  Cary Coutant  <ccoutant@google.com>
1988
1989         * expression.cc (struct Expression::Expression_eval_info): Add
1990         new fields type_pointer, vis_pointer, and nonvis_pointer.
1991         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
1992         nonvis_pointer parameters. Adjust all calls.
1993         (Symbol_expression::value): Update type, visibility, and nonvis bits
1994         in caller.
1995         * script.cc (Symbol_assignment::sized_finalize): Update type,
1996         visibility, and remaining st_other bits for new symbol.
1997         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
1998         vis_pointer, and nonvis_pointer parameters.
1999         * symtab.h (Symbol::set_type): New method.
2000
2001         * testsuite/Makefile.am (defsym_test): New test.
2002         * testsuite/Makefile.in: Regenerate.
2003         * testsuite/defsym_test.c: New file.
2004         * testsuite/defsym_test.sh: New file.
2005
2006 2014-07-08  Cary Coutant  <ccoutant@google.com>
2007
2008         PR gold/15639
2009         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
2010         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
2011         (Sized_dynobj::base_read_symbols): ...new method.
2012         * object.h (Sized_relobj_file::base_read_symbols): New method.
2013         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
2014         (Sized_relobj_file::base_read_symbols): ...new method.
2015         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
2016         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
2017         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
2018
2019 2014-07-04  Alan Modra  <amodra@gmail.com>
2020
2021         * po/POTFILES.in: Regenerate.
2022
2023 2014-07-02  Jing Yu  <jingyu@google.com>
2024
2025         * aarch64.cc: New file
2026         * Makefile.am (TARGETSOURCES): Add aarch64.cc
2027         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
2028         * Makefile.in: Regenerate.
2029         * configure.tgt: Add entries for aarch64*.
2030         * configure.ac:  Likewise.
2031         * configure: Likewise.
2032
2033 2014-06-27  Alan Modra  <amodra@gmail.com>
2034
2035         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
2036
2037 2014-06-24  Cary Coutant  <ccoutant@google.com>
2038
2039         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
2040         sections.
2041         (Dwo_file::sized_read_unit_index): Likewise.
2042
2043 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2044
2045         * mips.cc: New file.
2046         * Makefile.am (TARGETSOURCES): Add mips.cc
2047         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
2048         * configure.tgt: Add entries for mips*.
2049         * configure.ac: Likewise.
2050         * Makefile.in: Regenerate.
2051         * configure: Likewise.
2052
2053 2014-06-09  Cary Coutant  <ccoutant@google.com>
2054
2055         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
2056         unit_length is within section bounds.
2057
2058 2014-06-09  Cary Coutant  <ccoutant@google.com>
2059
2060         PR gold/16980
2061         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
2062         map.
2063
2064 2014-06-07  Alan Modra  <amodra@gmail.com>
2065
2066         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
2067
2068 2014-06-06  Cary Coutant  <ccoutant@google.com>
2069
2070         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
2071         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
2072         (Dwarf_pubnames_table::read_header): Likewise.
2073         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
2074         .debug_gnu_pubtypes.
2075
2076 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
2077
2078         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
2079         * Makefile.in, configure: Regenerate.
2080
2081 2014-06-03  Alan Modra  <amodra@gmail.com>
2082
2083         * powerpc.cc (addis_12_2): Define.
2084         (Stub_table::do_write): Support fusion on ELFv2 stubs.
2085
2086 2014-06-03  Alan Modra  <amodra@gmail.com>
2087
2088         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
2089         st_other output.
2090
2091 2014-06-02  Alan Modra  <amodra@gmail.com>
2092
2093         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
2094         Only ignore relocs on ELFv1.
2095         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
2096
2097 2014-05-30  Cary Coutant  <ccoutant@google.com>
2098
2099         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
2100         * testsuite/Makefile.in: Regenerate.
2101         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
2102
2103 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
2104
2105         PR gold/16945
2106         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
2107         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
2108
2109 2014-05-15  Alan Modra  <amodra@gmail.com>
2110
2111         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
2112         Compare FDE contents with DW_CFA_nop rather than 0.
2113
2114 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
2115
2116         * symtab.h (may_need_copy_reloc): Remove check for position independent
2117         code.
2118         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
2119         position independence before pc absolute may_need_copy_reloc call.
2120         Add check for executable output befor pc relative may_need_copy_reloc
2121         call.
2122         * i386.cc: Ditto.
2123         * arm.cc: Ditto.
2124         * sparc.cc: Ditto.
2125         * tilegx.cc: Ditto.
2126         * powerpc.cc: Add check for no position independence before
2127         may_need_copy_reloc calls.
2128         * testsuite/pie_copyrelocs_test.cc: New file.
2129         * testsuite/pie_copyrelocs_shared_test.cc: New file.
2130         * Makefile.am (pie_copyrelocs_test): New test.
2131         * Makefile.in: Regenerate.
2132
2133 2014-05-08  Martin LiĆĄka  <mliska@suse.cz>
2134
2135         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
2136
2137 2014-05-06  Cary Coutant  <ccoutant@google.com>
2138
2139         PR gold/16900
2140         * i386.cc (Output_data_got_plt_i386): New class.
2141         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
2142         parameter. Change all callers.
2143         (Output_data_plt_i386::layout_): Remove.
2144         (Output_data_plt_i386::got_plt_): Change type.
2145         (Target_i386::got_plt_): Change type. Change all references.
2146         (Target_i386::got_section): Create instance of new class.
2147         (Output_data_got_plt_i386::do_write): New function.
2148         * x86_64.cc (Output_data_got_plt_x86_64): New class.
2149         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
2150         parameter. Change all callers.
2151         (Output_data_plt_x86_64::layout_): Remove.
2152         (Output_data_plt_x86_64::got_plt_): Change type.
2153         (Target_x86_64::got_plt_): Change type. Change all references.
2154         (Target_x86_64::got_section): Create instance of new class.
2155         (Output_data_got_plt_x86_64::do_write): New function.
2156         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
2157         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
2158         class.
2159
2160 2014-05-05  Cary Coutant  <ccoutant@google.com>
2161
2162         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
2163         if we have pubnames/pubtypes.
2164
2165 2014-05-02  Cary Coutant  <ccoutant@google.com>
2166
2167         * defstd.cc (in_segment): Define __ehdr_start here...
2168         * layout.cc (Layout::finalize): ...Instead of here.  Set the
2169         output segment when known.
2170         * resolve.cc (Symbol::override_base_with_special): Remember
2171         the original binding.
2172         * symtab.cc (Symbol::set_output_segment): New function.
2173         (Symbol::set_undefined): New function.
2174         * symtab.h (Symbol::is_weak_undefined): Check original undef
2175         binding.
2176         (Symbol::is_strong_undefined): New function.
2177         (Symbol::set_output_segment): New function.
2178         (Symbol::set_undefined): New function.
2179         * target-reloc.h (is_strong_undefined): Remove.
2180         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
2181         Check for hidden undefs.
2182         (relocate_section): Call Symbol::is_strong_undefined.
2183
2184         * testsuite/Makefile.am (ehdr_start_test_1)
2185         (ehdr_start_test_2, ehdr_start_test_3)
2186         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
2187         * testsuite/Makefile.in: Regenerate.
2188         * testsuite/ehdr_start_def.cc: New source file.
2189         * testsuite/ehdr_start_test.cc: New source file.
2190         * testsuite/ehdr_start_test.t: New linker script.
2191         * testsuite/ehdr_start_test_4.sh: New shell script.
2192
2193 2014-04-23  Cary Coutant  <ccoutant@google.com>
2194
2195         PR gold/16870
2196         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
2197
2198 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2199
2200         * layout.cc (Layout::include_section): Allow a target to decide
2201         whether to include a section.
2202         * target.h (Target::should_include_section): New function.
2203         (Target::do_should_include_section): New function.
2204
2205 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2206
2207         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
2208         inline into ...
2209         (Copy_relocs::emit): ... here.
2210         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
2211         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
2212         (Copy_reloc_entry::entries_): Change from private to protected.
2213
2214 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
2215
2216         * icf.cc (get_section_contents): Replace copies of reloc
2217         vectors with const references.
2218
2219 2014-04-02  Cary Coutant  <ccoutant@google.com>
2220
2221         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
2222         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
2223         * configure: Regenerate.
2224         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
2225         -fno-use-linker-plugin.
2226         (LINK1, CXXLINK1): Add it to the link command.
2227         * testsuite/Makefile.in: Regenerate.
2228
2229 2014-03-12  Alan Modra  <amodra@gmail.com>
2230
2231         * Makefile.in: Regenerate.
2232
2233 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2234
2235         * symtab.h (Symbol::set_nonvis): New function.
2236
2237 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2238
2239         * symtab.cc (Sized_symbol<32>::init_output_data):
2240         Instantiate the template.
2241         (Sized_symbol<64>::init_output_data): Likewise.
2242
2243 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2244
2245         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
2246         adjust dynamic symbol value.
2247         * target.h (Target::adjust_dyn_symbol): New function.
2248         (Target::do_adjust_dyn_symbol): New function.
2249
2250 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2251
2252         * output.cc (Output_data_dynamic::Dynamic_entry::write):
2253         Get the value of DYNAMIC_CUSTOM dynamic entry.
2254         * output.h (Output_data_dynamic::add_custom): New function.
2255         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
2256         dynamic entry.
2257         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
2258         * target.h (Target::dynamic_tag_custom_value): New function.
2259         (Target::do_dynamic_tag_custom_value): New function.
2260
2261 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2262
2263         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
2264         dynsym indexes.
2265         * target.h (Target::has_custom_set_dynsym_indexes): New function.
2266         (Target::do_has_custom_set_dynsym_indexes): New function.
2267         (Target::set_dynsym_indexes): New function.
2268         (Target::do_set_dynsym_indexes): New function.
2269
2270 2014-03-07  Alan Modra  <amodra@gmail.com>
2271
2272         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
2273         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
2274         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
2275         (Powerpc_relocate_functions::has_overflow_bitfield,
2276         overflowed): Use the above.
2277         (Target_powerpc::Relocate::relocate): Correct overflow checking
2278         for a number of relocations.  Modify overflow test for 16-bit
2279         fields in instructions to signed/unsigned according to whether
2280         the field takes a signed or unsigned value.
2281
2282 2014-03-05  Alan Modra  <amodra@gmail.com>
2283
2284         Update copyright years.
2285
2286 2014-03-05  Alan Modra  <amodra@gmail.com>
2287
2288         * powerpc.cc (Target_powerpc::Scan::local, global): Support
2289         R_PPC64_ADDR64_LOCAL.
2290         (Target_powerpc::Relocate::relocate): Likewise.
2291
2292 2014-03-03  Alan Modra  <amodra@gmail.com>
2293
2294         * dwp.cc (print_version): Update copyright year to current.
2295
2296 2014-02-10  Alan Modra  <amodra@gmail.com>
2297
2298         * po/gold.pot: Regenerate.
2299
2300 2014-02-06  Cary Coutant  <ccoutant@google.com>
2301
2302         Fix problem where -u is ignored when a weak undef is seen.
2303
2304         * archive.cc (Library_base::should_include_member): Reorder
2305         code to check for -u option if a weak undef has already been seen.
2306         * testsuite/Makefile.am (weak_undef_test_2): New test case.
2307         * testsuite/Makefile.in: Regenerate.
2308         * testsuite/weak_undef_file3.cc: New file.
2309         * testsuite/weak_undef_file4.cc: New file.
2310         * testsuite/weak_undef_test_2.cc: New file.
2311
2312 2014-02-05  Cary Coutant  <ccoutant@google.com>
2313
2314         Fix issues with gold undefined symbol diagnostics.
2315
2316         PR binutils/15435
2317         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
2318         check to here.
2319         * target-reloc.h (is_strong_undefined): New function.
2320         (relocate_section): Move undef vtable symbol check from here.
2321         Check for is_strong_undefined.
2322
2323 2014-02-05  Cary Coutant  <ccoutant@google.com>
2324
2325         Fix problems with the --dynamic-list option.
2326
2327         PR gold/13577
2328         * options.cc (General_options::parse_dynamic_list):
2329         Set have_dynamic_list_.
2330         (General_options::General_options): Initialize have_dynamic_list_.
2331         (General_options::finalize): Turn off -Bsymbolic and
2332         -Bsymbolic-functions if --dynamic-list provided.
2333         * options.h (General_options::have_dynamic_list): New function.
2334         (General_options::have_dynamic_list_): New data member.
2335         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
2336         correctly.
2337
2338         PR gold/16530
2339         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
2340         in --dynamic-list, mark it.
2341
2342         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
2343         (dynamic_list_2): New test case.
2344         * testsuite/Makefile.in: Regenerate.
2345         * testsuite/dynamic_list_2.cc: New file.
2346         * testsuite/dynamic_list_2.t: New file.
2347         * testsuite/dynamic_list_lib1.cc: New file.
2348         * testsuite/dynamic_list_lib2.cc: New file.
2349         * testsuite/gc_dynamic_list_test.c: New file.
2350         * testsuite/gc_dynamic_list_test.sh: New file.
2351         * testsuite/gc_dynamic_list_test.t: New file.
2352
2353 2014-01-28  Cary Coutant  <ccoutant@google.com>
2354
2355         Add .gdb_index version 7 support.
2356
2357         * gold/dwarf_reader.cc: include <utility> (for make_pair).
2358         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
2359         debug sections.
2360         (Dwarf_ranges_table::read_ranges_table): Likewise.
2361         (Dwarf_pubnames_table::read_section): Check for GNU-style
2362         sections, and for compressed debug sections.
2363         (Dwarf_pubnames_table::read_header): Compute end address of table.
2364         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
2365         for end of list by offset, not by offset == 0.
2366         (Dwarf_info_reader::do_read_string_table): Check for compressed
2367         debug sections.
2368         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2369         Initialize new data members.
2370         (Dwarf_pubnames_table::next_name): return flag_byte.
2371         (Dwarf_pubnames_table::end_of_table_): New data member.
2372         (Dwarf_pubnames_table::is_gnu_style_): New data member.
2373         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
2374         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
2375         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
2376         read skeleton type unit DIEs.
2377         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
2378         (Gdb_index::do_write): Write flag_byte.
2379         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
2380         (Gdb_index::Cu_vector): Store flags along with cu indexes.
2381         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
2382         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
2383
2384 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
2385
2386         * version.cc (print_version): Update copyright year to 2014.
2387
2388 2013-12-19  Dimitry Andric  <dimitry@andric.com>
2389
2390         * stringpool.cc (Stringpool_template::reserve): Add
2391         HAVE_UNORDERED_MAP case.
2392         * stringpool.cc (Stringpool_template::print_stats): Likewise.
2393
2394 2013-12-18  Cary Coutant  <ccoutant@google.com>
2395
2396         * configure.ac: Check for <unordered_set> and <unordered_map>.
2397         * config.in: Regenerate.
2398         * configure: Regenerate.
2399         * system.h: Use <unordered_set> and <unordered_map> if available.
2400
2401 2013-12-10  Roland McGrath  <mcgrathr@google.com>
2402
2403         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
2404         with $(INSTALL_PROGRAM_ENV).
2405         * Makefile.in: Regenerate.
2406
2407 2013-11-22  Cary Coutant  <ccoutant@google.com>
2408
2409         * configure.ac: Add check for which library is needed for
2410         dlopen.
2411         * configure: Regenerate.
2412
2413 2013-11-22  Cary Coutant  <ccoutant@google.com>
2414
2415         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
2416         assembler.
2417         * testsuite/Makefile.in: Regenerate.
2418
2419 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
2420
2421         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
2422         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
2423         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
2424         (Target_x86_64<size>::Scan::local): Likewise.
2425         (Target_x86_64<size>::Scan::global): Likewise.
2426         (Target_x86_64<size>::Relocate::relocate): Likewise.
2427         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
2428         Likewise.
2429         (Target_x86_64<size>::Scan::check_non_pic(): Handle
2430         R_X86_64_PC32_BND.
2431
2432         * testsuite/Makefile.am (check_PROGRAMS): Add
2433         exception_x86_64_bnd_test.
2434         (exception_x86_64_bnd_test_SOURCES): New macro.
2435         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
2436         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
2437         (exception_x86_64_bnd_test_LDADD): Likewise.
2438         (exception_x86_64_bnd_1.o): New rule.
2439         (exception_x86_64_bnd_2.o): Likewise.
2440         * testsuite/Makefile.in: Regenerated.
2441
2442 2013-11-15  Alan Modra  <amodra@gmail.com>
2443
2444         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
2445         accessor.
2446         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
2447         Only call ppc64_local_entry_offset for 64-bit.  Restrict
2448         symval_for_branch lookup to ELFv1.
2449         (Stub_table::add_plt_call_entry): Use unsigned int off.
2450         (Output_data_glink::Address, invalid_address): New.
2451         (Output_data_glink::add_eh_frame): Move out of line.  Add
2452         support for ELFv2.
2453         (Output_data_glink::add_global_entry, find_global_entry,
2454         global_entry_address): New functions.
2455         (Output_data_glink::global_entry_stubs_, end_branch_table_,
2456         ge_size): New variables.
2457         (Output_data_glink::set_final_data_size): Add global entry
2458         stub sizing.
2459         (Output_data_glink::do_write): Write global entry stubs.
2460         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
2461         parameter.  Return true for ELFv2.  Adjust callers.
2462         (Target_powerpc::Scan::local, global): Restrict opd lookup to
2463         ELFv1.  Similarly for ifunc and dynamic relocation processing
2464         specific to ELFv1.  Recognize that symbols are defined on
2465         their plt entries for ELFv2.
2466         (Target_powerpc::symval_for_branch): Assert if called for
2467         ELFv2 or ppc32.
2468         (Target_powerpc::Relocate::relocate): Use global entry plt
2469         stub for symbol value if such exists on ELFv2.
2470         (Target_powerpc::Relocate::relocate): Don't call
2471         symval_for_branch when ELFv2.  Do adjust for local entry
2472         offset when ELFv2.
2473         (Target_powerpc::do_dynsym_value): Set symbols to global entry
2474         plt stub for ELFv2.
2475         (Target_powerpc::do_plt_address_for_global): Similarly.
2476
2477 2013-11-14  Cary Coutant  <ccoutant@google.com>
2478
2479         Revert patch -- this did not fix the problem, and there is
2480         no race there.
2481
2482         2013-11-14  Cary Coutant  <ccoutant@google.com>
2483
2484             PR gold/14860
2485             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2486             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2487             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2488             updating fde_offsets_.
2489             (Eh_frame_hdr::lock_): New data member.
2490
2491 2013-11-14  Cary Coutant  <ccoutant@google.com>
2492
2493         * dwp.cc (Dwo_file_entry): New type.
2494         (File_list): Use Dwo_file_entry.
2495         (Dwo_file::verify): New function.
2496         (Dwo_file::verify_dwo_list): New function.
2497         (Dwo_file::sized_verify_dwo_list): New function.
2498         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
2499         list.
2500         (Dwp_options): New enum type.
2501         (dwp_options): Add --verify-only.
2502         (usage): Likewise.
2503         (main): Likewise.
2504         * dwp.h (gold_info): Add declaration.
2505
2506 2013-11-14  Cary Coutant  <ccoutant@google.com>
2507
2508         PR gold/14860
2509         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2510         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2511         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2512         updating fde_offsets_.
2513         (Eh_frame_hdr::lock_): New data member.
2514
2515 2013-11-06  Cary Coutant  <ccoutant@google.com>
2516
2517         PR gold/15758
2518         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
2519         before reloc sections.
2520
2521 2013-11-04  Alan Modra  <amodra@gmail.com>
2522
2523         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
2524         (Symbol::needs_dynamic_reloc): Test new flag.
2525         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
2526         (Target_powerpc::Scan::get_reference_flags): Add target param.
2527         Return FUNC_DESC_ABI for 64-bit ELFv1.
2528         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
2529         call.
2530         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
2531         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
2532
2533 2013-10-31  Cary Coutant  <ccoutant@google.com>
2534
2535         Restore support for dwp v2 DWARF package file format.
2536
2537         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2538         tu_length parameter.  Adjust all callers.
2539         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2540         * dwp.cc: Include dwarf.h.
2541         (Section_bounds): New struct type.
2542         (Unit_set): New struct type.
2543         (Dwo_file::Dwo_file): Initialize new data member.
2544         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2545         Combine and rename to...
2546         (Dwo_file::read_unit_index): ...this.
2547         (Dwo_file::sized_read_compunit_index)
2548         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2549         (Dwo_file::sized_read_unit_index): ...this.
2550         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2551         parameters; add section_id parameter.
2552         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2553         (Dwo_file::add_unit_set): ...this.
2554         (Dwo_file::shndx_map_): Remove.
2555         (Dwo_file::sect_offsets_): New data member.
2556         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2557         (Dwp_output_file::add_section): Rename to...
2558         (Dwp_output_file::add_contribution): ...this.
2559         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2560         (Dwp_output_file::add_tu_set): Likewise.
2561         (Dwp_output_file::Contribution): New type.
2562         (Dwp_output_file::Section::contributions): New data member.
2563         (Dwp_output_file::Cu_or_tu_set): Remove.
2564         (Dwp_output_file::Section::Section): New ctor.
2565         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2566         (Dwp_output_file::Dwp_index::Section_table): New type.
2567         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2568         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2569         parameter.
2570         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2571         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2572         (Dwp_output_file::Dwp_index::section_table): New member function.
2573         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2574         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2575         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2576         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2577         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2578         (Dwp_output_file::Dwp_index::section_table_): New data member.
2579         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2580         (Dwp_output_file::add_output_section): New member function.
2581         (Dwp_output_file::write_new_section): New member function.
2582         (Dwp_output_file::write_contributions): New member function.
2583         (Dwp_output_file::section_id_map_): New data member.
2584         (class Dwo_id_info_reader): Remove.
2585         (class Unit_reader): New class.
2586         (get_dwarf_section_name): New function.
2587         (Dwo_file::read_executable): Adjust initializations of class data.
2588         (Dwo_file::read): Add support for v2 package file format.
2589         (Dwo_file::read_unit_index): Likewise.
2590         (Dwo_file::sized_read_unit_index): Likewise.
2591         (Dwo_file::copy_section): Likewise.
2592         (Dwo_file::add_unit_set): Likewise.
2593         (Dwp_output_file::add_output_section): Likewise.
2594         (Dwp_output_file::add_contribution): Likewise.
2595         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2596         for empty slot.
2597         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2598         file format.
2599         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2600         slot.
2601         (Dwp_output_file::initialize): Remove unused function.
2602         (Dwp_output_file::finalize): Add support for v2 package file format.
2603         (Dwp_output_file::write_index): Likewise.
2604         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2605         function prototype.
2606
2607 2013-10-31  Cary Coutant  <ccoutant@google.com>
2608
2609         * configure.ac: Fix check for -fmerge-constants.
2610         * configure.ac: Regenerate.
2611
2612 2013-10-30  Roland McGrath  <mcgrathr@google.com>
2613
2614         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
2615         Correct 9-byte nop sequence to match what the assembler generates.
2616
2617 2013-10-30  Alan Modra  <amodra@gmail.com>
2618
2619         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
2620         ppc64_local_entry_offset, ppc64_local_entry_offset,
2621         do_read_symbols): New functions.
2622         (Powerpc_relobj::e_flags_, st_other_): New vars.
2623         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
2624         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
2625         (Powerpc_relobj::e_flags_): New var.
2626         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
2627         and adjust for ELFv2.
2628         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
2629         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
2630         (Powerpc_dynobj::do_find_special_sections): Likewise.
2631         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
2632         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
2633         to ELFv2 local entry.
2634         (Target_powerpc::do_relax): No thread safe barriers needed for
2635         ELFv2.
2636         (Output_data_plt_powerpc::initial_plt_entry_size_,
2637         plt_entry_size): Delete.  Replace all uses with
2638         first_plt_entry_offset() and plt_entry_size().
2639         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
2640         reserved_size parm.  Update callers.
2641         (Output_data_plt_powerpc::entry_count): Update.
2642         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
2643         and use Target_powerpc::first_plt_entry_offset().
2644         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
2645         rename to plt_entry_size.
2646         (Output_data_plt_powerpc::add_ifunc_entry,
2647         add_local_ifunc_entry): Adjust reloc for ELFv2.
2648         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
2649         (glink_eh_frame_fde_64v2): New.
2650         (Stub_table::plt_call_size): Support ELFv2 sizing.
2651         (Output_data_glink::add_eh_frame): Use the new FDE.
2652         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
2653         (Stub_table::do_write): Write ELFv2 stubs and glink.
2654         (Target_powerpc::Relocate::relocate): Replaces nop after call
2655         with ld 2,24(1) and adjust local offset destination for ELFv2.
2656
2657 2013-10-30  Alan Modra  <amodra@gmail.com>
2658
2659         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
2660         (Target_powerpc::Scan::global, local): Likewise.
2661         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
2662         on all ppc64 @h and @ha relocs.
2663
2664 2013-10-14  Alan Modra  <amodra@gmail.com>
2665
2666         * output.h (Output_data_got::add_constant): Tidy.
2667         (Output_data_got::add_constant_pair): New function.
2668         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
2669         methods used so as to first call reserve_ent().
2670
2671 2013-10-11  Roland McGrath  <mcgrathr@google.com>
2672
2673         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
2674         add_got_entry and add_got_entry_pair.
2675
2676         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
2677         (HAVE_PUBNAMES): Likewise.
2678         * configure: Regenerate.
2679
2680         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
2681         * testsuite/Makefile.in: Regenerate.
2682
2683         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
2684         Remove const from declaration.
2685         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
2686         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
2687         * output.h (Output_file_header): Remove const from member target_
2688         and corresponding constructor argument.
2689         * output.cc (Output_file_header::Output_file_header): Update prototype.
2690         (Output_file_header::do_sized_write): Use this->target_ in place
2691         of parameters()->target().
2692
2693         * testsuite/undef_symbol.cc (Foo::get_a): New method.
2694
2695         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
2696         * configure: Regenerate.
2697         * Makefile.in: Regenerate.
2698         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
2699         * testsuite/merge_string_literals_2.c: Likewise.
2700         * testsuite/Makefile.am
2701         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
2702         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
2703         literal -fmerge-constants.
2704         * testsuite/Makefile.in: Regenerate.
2705
2706         * i386.cc (Target_i386): Remove unused member dynbss_.
2707         * arm.cc (Target_arm): Likewise.
2708         * powerpc.cc (Target_powerpc): Likewise.
2709         * sparc.cc (Target_sparc): Likewise.
2710         * tilegx.cc (Target_tilegx): Likewise.
2711         * x86_64.cc (Target_x86_64): Likewise.
2712         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
2713         type_signature_, type_offset_.
2714         * plugin.h (Plugin_hook): Remove unused member layout_.
2715         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
2716         mapfile_.
2717         (Read_member): Remove unused members input_objects_, symtab_,
2718         mapfile_, layout_.
2719         (Check_library): Remove unused member symtab_.
2720         * archive.h (Lib_group): Remove unused member lib_.
2721         * archive.cc (Lib_group::Lib_group): Update initializer.
2722         * incremental.h (Incremental_binary): Remove unused member target_.
2723         (Incremental_script_entry): Removed unused member script_.
2724         * layout.h (Write_symbols_task): Remove unused member input_objects_.
2725         * icf.h (Icf): Remove unused member num_tracked_relocs.
2726
2727         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
2728         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
2729         its only use.
2730         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
2731
2732         * archive.h: Use struct rather than class for forward declaration
2733         of Read_symbols_data.
2734
2735 2013-10-07  Cary Coutant  <ccoutant@google.com>
2736
2737         PR gold/16010
2738         * testsuite/Makefile.am (icf_test): Fix dependencies.
2739         (icf_safe_test): Likewise.
2740         (icf_safe_so_test): Likewise.
2741         (large_symbol_alignment): Add empty _LDADD rule.
2742         * testsuite/Makefile.in: Regenerate.
2743
2744 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
2745
2746         PR gold/15927
2747         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
2748         relocation for R_X86_64_32 on x32.
2749
2750 2013-08-27  Roland McGrath  <mcgrathr@google.com>
2751
2752         * output.cc (Output_segment::set_section_addresses): Take new
2753         Target* argument.  If target->isolate_execinstr() and the segment
2754         is executable and starts at a target->abi_pagesize() boundary,
2755         pad its end out to a target->abi_pagesize() boundary with code fill.
2756         * output.h (Output_segment::set_section_addresses): Update decl.
2757         * layout.h (Layout::check_output_data_for_reset_values): Take new
2758         argument RELAX_OUTPUTS.
2759         (Layout): New member relax_output_list_.
2760         (Layout::add_relax_output): New method.
2761         * layout.cc (Layout::Layout): Update constructor.
2762         (Layout::reset_relax_output): New method.
2763         (Layout::clean_up_after_relaxation): Call it.
2764         (Layout::prepare_for_relaxation): Update caller.
2765         (Layout::set_segment_offsets): Update callers of set_section_addresses.
2766         Call reset_relax_output before re-processing segments for
2767         isolate_execinstr case.
2768         (Layout::write_data): Handle relax_output_list_.
2769         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
2770         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
2771
2772 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
2773
2774         PR binutils/15834
2775         * object.h: Fix typos.
2776
2777 2013-08-16  Roland McGrath  <mcgrathr@google.com>
2778
2779         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
2780         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
2781
2782 2013-08-07  Cary Coutant  <ccoutant@google.com>
2783
2784         Revert support for v2 DWP files:
2785
2786         2013-03-01  Cary Coutant  <ccoutant@google.com>
2787
2788             Add dwp support for v2 DWARF package file format.
2789             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2790             tu_length parameter.  Adjust all callers.
2791             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2792             * dwp.cc: Include dwarf.h.
2793             (Section_bounds): New struct type.
2794             (Unit_set): New struct type.
2795             (Dwo_file::Dwo_file): Initialize new data member.
2796             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2797             Combine and rename to...
2798             (Dwo_file::read_unit_index): ...this.
2799             (Dwo_file::sized_read_compunit_index)
2800             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2801             (Dwo_file::sized_read_unit_index): ...this.
2802             (Dwo_file::copy_section): Remove section_name, is_str_offsets
2803             parameters; add section_id parameter.
2804             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2805             (Dwo_file::add_unit_set): ...this.
2806             (Dwo_file::shndx_map_): Remove.
2807             (Dwo_file::sect_offsets_): New data member.
2808             (Dwp_output_file::Dwp_output_file): Initialize new data members.
2809             (Dwp_output_file::add_section): Rename to...
2810             (Dwp_output_file::add_contribution): ...this.
2811             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2812             (Dwp_output_file::add_tu_set): Likewise.
2813             (Dwp_output_file::Contribution): New type.
2814             (Dwp_output_file::Section::contributions): New data member.
2815             (Dwp_output_file::Cu_or_tu_set): Remove.
2816             (Dwp_output_file::Section::Section): New ctor.
2817             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2818             (Dwp_output_file::Dwp_index::Section_table): New type.
2819             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2820             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2821             parameter.
2822             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2823             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2824             (Dwp_output_file::Dwp_index::section_table): New member function.
2825             (Dwp_output_file::Dwp_index::section_table_end): New member function.
2826             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2827             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2828             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2829             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2830             (Dwp_output_file::Dwp_index::section_table_): New data member.
2831             (Dwp_output_file::Dwp_index::section_mask_): New data member.
2832             (Dwp_output_file::add_output_section): New member function.
2833             (Dwp_output_file::write_new_section): New member function.
2834             (Dwp_output_file::write_contributions): New member function.
2835             (Dwp_output_file::section_id_map_): New data member.
2836             (class Dwo_id_info_reader): Remove.
2837             (class Unit_reader): New class.
2838             (get_dwarf_section_name): New function.
2839             (Dwo_file::read_executable): Adjust initializations of class data.
2840             (Dwo_file::read): Add support for v2 package file format.
2841             (Dwo_file::read_unit_index): Likewise.
2842             (Dwo_file::sized_read_unit_index): Likewise.
2843             (Dwo_file::copy_section): Likewise.
2844             (Dwo_file::add_unit_set): Likewise.
2845             (Dwp_output_file::add_output_section): Likewise.
2846             (Dwp_output_file::add_contribution): Likewise.
2847             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2848             for empty slot.
2849             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2850             file format.
2851             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2852             slot.
2853             (Dwp_output_file::initialize): Remove unused function.
2854             (Dwp_output_file::finalize): Add support for v2 package file format.
2855             (Dwp_output_file::write_index): Likewise.
2856             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2857             function prototype.
2858
2859 2013-07-31  Cary Coutant  <ccoutant@google.com>
2860
2861         * object.cc (Sized_relobj::do_output_section_address): New function.
2862         (Sized_relobj): Instantiate explicitly.
2863         * object.h (Object::output_section_address): New function.
2864         (Object::do_output_section_address): New function.
2865         (Sized_relobj::do_output_section_address): New function.
2866         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
2867
2868 2013-07-30  Cary Coutant  <ccoutant@google.com>
2869             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2870
2871         * parameters.cc (Parameters::entry): Return target-specific entry
2872         symbol name.
2873         * target.h (Target::entry_symbol_name): New function.
2874         (Target_info::entry_symbol_name): New data member.
2875
2876         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
2877         * i386.cc (Target_i386::i386_info): Likewise.
2878         (Target_i386_nacl::i386_nacl_info): Likewise.
2879         * sparc.cc (Target_sparc::sparc_info): Likewise.
2880         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
2881         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
2882         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
2883         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2884
2885 2013-07-22  Sterling Augustine  <saugustine@google.com>
2886
2887         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
2888         Convert parameter shndx to local variable. Add parameters symtab
2889         and symtab_size.  Scan over section names.  Find relocation
2890         section corresponding to current section.  Create and initialize
2891         reloc_mapper_ and reloc_type_.
2892         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
2893         unit_length to off_t.  Initialize member unit_length_.  Fill in field
2894         cu_offset_.
2895         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2896         Initialize new fields unit_length_ and cu_offset_.
2897         (Dwarf_pubnames_table::read_section): Update prototype.
2898         (Dwarf_pubnames_table::cu_offset): New member function.
2899         (Dwarf_pubnames_table::subsection_size): Likewise.
2900         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
2901         New fields.
2902         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
2903         member functions public.
2904         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
2905         Update comment.  Rework logic.  Move repeated parts to...
2906         (Gdb_index_info_reader::read_pubtable): ...here. New function.
2907         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
2908         pubtypes_table_, and stmt_list_offset.
2909         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2910         Gdb_index::find_pubtype_offset,
2911         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
2912         (Gdb_index::pubnames_read): Update prototype and rework logic.
2913         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
2914         Forward declare.
2915         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2916         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
2917         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
2918         Gdb_index::map_pubtable_to_dies):
2919         Declare functions.
2920         (Gdb_index::pubnames_read): Update declaration.
2921         (Gdb_index::Pubname_offset_map): New type.
2922         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
2923         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
2924         Gdb_index::stmt_list_offset): Declare.
2925         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
2926         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
2927         Gdb_index::pubtypes_offset_): Remove.
2928
2929 2013-07-19  Roland McGrath  <mcgrathr@google.com>
2930
2931         * options.h (General_options): Add -Trodata-segment option.
2932         * parameters.cc (Parameters::check_rodata_segment): New function.
2933         (Parameters::set_target_once): Call it.
2934         * parameters.h (Parameters): Declare it (private member function).
2935         * layout.cc (load_seg_unusable_for_headers): New function, broken
2936         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
2937         then validate rodata segment rather than text segment.
2938         (relaxation_loop_body): Call that.
2939         (is_text_segment): New function.  Don't admit a non-executable
2940         segment if TARGET->isolate_execinstr().
2941         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
2942
2943 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
2944
2945         PR gold/15070
2946         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
2947         * nacl.h (Sniff_file::View::View): Request aligned view.
2948
2949 2013-07-11  Cary Coutant  <ccoutant@google.com>
2950
2951         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
2952         correct BRLT entry size.
2953
2954 2013-07-03  Alan Modra  <amodra@gmail.com>
2955
2956         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
2957         comment.
2958
2959 2013-07-01  Cary Coutant  <ccoutant@google.com>
2960
2961         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
2962         reloc_type_.
2963         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
2964         (Dwarf_ranges_table::lookup_reloc): New function.
2965         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
2966         reloc_type_.
2967         (Dwarf_ranges_table::lookup_reloc): New function.
2968         (Dwarf_ranges_table::reloc_type_): New data member.
2969
2970 2013-06-27  Jing Yu  <jingyu@google.com>
2971
2972         PR gold/15662
2973         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
2974         function.
2975         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
2976         (Target_powerpc::do_relax): Call the above.
2977
2978 2013-06-27  Cary Coutant  <ccoutant@google.com>
2979
2980         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
2981         on garbage collected .opd section.
2982
2983 2013-06-27  Alan Modra  <amodra@gmail.com>
2984
2985         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
2986         is non-zero.
2987         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
2988         (Target_powerpc::do_function_location): Likewise for loc->shndx.
2989
2990 2013-06-14  Cary Coutant  <ccoutant@google.com>
2991
2992         * resolve.cc (Symbol::override_base): Don't override st_type
2993         from plugin placeholder symbols.
2994         (Symbol_table::resolve): Likewise.
2995         (Symbol_table::should_override): Don't complain about TLS mismatch
2996         if the TO symbol is a plugin placeholder.
2997         * testsuite/Makefile.am (plugin_test_tls): New test.
2998         * testsuite/Makefile.in: Regenerate.
2999         * testsuite/plugin_test_tls.sh: New test script.
3000         * testsuite/two_file_test_2_tls.cc: New test source.
3001         * testsuite/two_file_test_tls.cc: New test source.
3002
3003 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3004
3005         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
3006         the maximum segment alignment is larger than the page size.
3007         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
3008         correctly aligns the symbols with large alignemnt.
3009         * testsuite/Makefile.in: Regenerate.
3010         * testsuite/large_symbol_alignment.cc: New file.
3011
3012 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3013             Sriraman Tallam  <tmsriram@google.com>
3014
3015         * options.h (sort_section): New option.
3016         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
3017         Rename from Input_section_sort_section_name_special_ordering_compare.
3018         (Input_section_sort_section_name_compare): New struct.
3019         * output.cc (Output_section::Input_section_sort_section_name_compare::
3020         operator()): New function.
3021         (Output_section::sort_attached_input_sections): Use new sort function
3022         for .text if --sort-section=name is specified.
3023         * layout.cc (Layout::make_output_section):
3024         Add sorting by name when --sort-section=name is specified.
3025         * testsuite/Makefile.am (text_section_grouping): Test option
3026         --sort-section=name.
3027         * testsuite/Makefile.in: Regenerate.
3028         * testsuite/section_sorting_name.cc: New file.
3029         * testsuite/section_sorting_name.sh: New file.
3030
3031 2013-05-21  Cary Coutant  <ccoutant@google.com>
3032
3033         * symtab.h (Symbol::is_cxx_vtable): New function.
3034         * target-reloc.h (relocate_section): Check for vtable symbol.
3035         * testsuite/Makefile.am (missing_key_func.sh): New test case.
3036         * testsuite/Makefile.in: Regenerate.
3037         * testsuite/missing_key_func.cc: New test source.
3038         * testsuite/missing_key_func.sh: New test script.
3039
3040 2013-05-21  Cary Coutant  <ccoutant@google.com>
3041
3042         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
3043         type of enclosing symbol.
3044         (Relocate_info::location): Check symbol type when describing symbol.
3045         * object.h (Symbol_location_info): Remove unused line_number;
3046         add enclosing_symbol_type.
3047         * testsuite/debug_msg.sh: Adjust expected output.
3048
3049 2013-05-13  Cary Coutant  <ccoutant@google.com>
3050
3051         * configure.ac: Export DEFAULT_TARGET.
3052         * configure: Regenerate.
3053         * Makefile.in: Regenerate.
3054         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
3055         * testsuite/Makefile.in: Regenerate.
3056         * testsuite/debug_msg.sh: Delete duplicate tests.
3057         Don't check undef_int error message match for powerpc where the
3058         source file and line number aren't available.
3059
3060 2013-05-10  Roland McGrath  <mcgrathr@google.com>
3061
3062         * options.h (General_options): Add --rosegment-gap option.
3063         * options.cc (finalize): --rosegment-gap implies --rosegment.
3064         * layout.cc (set_segment_offsets): Let user option override
3065         target->rosegment_gap().
3066
3067 2013-05-10  Roland McGrath  <mcgrathr@google.com>
3068
3069         * options.h (General_options): Remove leading space from help
3070         messages for -nostdlib and --rosegment.
3071
3072 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
3073
3074         PR ld/15365
3075         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
3076
3077 2013-05-03  Alan Modra  <amodra@gmail.com>
3078
3079         * merge.cc (Output_merge_string::do_add_input_section): Correct
3080         scan for number of strings.  Rename vars to avoid shadowing.
3081         Include missing terminator in input_size_.
3082
3083 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
3084
3085         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
3086         Restore empty string handling.
3087
3088 2013-05-01  Cary Coutant  <ccoutant@google.com>
3089
3090         * stringpool.cc (Stringpool_template::new_key_offset): Fix
3091         uninitialized warning.
3092
3093 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3094
3095         * output.cc (Output_section::add_merge_input_section): Allow
3096         to merge sections if the alignment is more than character size.
3097         * merge.h (Output_merge_string::Output_merge_string): Remove
3098         assert.
3099         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
3100         only not-null strings. Check the alignment of strings.
3101         * stringpool.h
3102         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
3103         alignment as the argument.
3104         (Stringpool_template<Stringpool_char>::addralign_): New class member.
3105         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
3106         Align non-zero length strings according to the addralign_.
3107         (Stringpool_template<Stringpool_char>::set_string_offsets):
3108         Updating offsets according to the given alignment.
3109         * testsuite/Makefile.am (text_section_grouping): Test if string
3110         literals are getting merged.
3111         * testsuite/Makefile.in: Regenerate.
3112         * testsuite/merge_string_literals_1.c: New file.
3113         * testsuite/merge_string_literals_2.c: Ditto.
3114         * testsuite/merge_string_literals.sh: Ditto.
3115
3116 2013-04-26  Ian Lance Taylor  <iant@google.com>
3117
3118         * target-reloc.h (relocate_section): If the reloc offset is out of
3119         range, pass VIEW as NULL to relocate.relocate.
3120         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
3121         * i386.cc (Target_i386::Relocate::relocate): Likewise.
3122         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
3123         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
3124         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
3125         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3126
3127 2013-04-26  Geoff Pike  <gpike@chromium.org>
3128
3129         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
3130         * layout.cc (Hash_task): New class.
3131         (Layout::queue_build_id_tasks): New function.
3132         (Layout::write_build_id): Handle single-thread portion of build ID
3133         computation.  (In some cases, all of it is single-threaded.)  Replace
3134         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
3135         functionality in fewer lines of code.
3136         * layout.h (Layout::queue_build_id_tasks): New function declaration.
3137         * options.h (General_options): make "--build-id" default to tree
3138         rather than sha1.  Add two new options related to --build-id=tree:
3139         --build-id-chunk-size-for-treehash and
3140         --build-id-min-file-size-for-treehash.
3141         * Makefile.am: add testing of --build-id=tree and related new options
3142         (these tests will be invoked by "make check").
3143         * Makefile.in: Regenerate.
3144
3145 2013-04-25  Alan Modra  <amodra@gmail.com>
3146
3147         * configure.tgt: Add powerpcle and powerpc64le.
3148
3149 2013-04-22  Alan Modra  <amodra@gmail.com>
3150
3151         PR gold/15355
3152         * layout.cc (Layout::segment_precedes): Allow more than one
3153         segment with the same type and flags.
3154
3155 2013-04-15  Cary Coutant  <ccoutant@google.com>
3156
3157         * layout.cc (Layout::set_relocatable_section_offsets): Don't
3158         allocate space in file for BSS sections.
3159
3160 2013-04-15  Cary Coutant  <ccoutant@google.com>
3161
3162         * script-sections.cc (Orphan_output_section): Reset address
3163         to zero after each orphaned section for relocatable links.
3164
3165 2013-04-15  Cary Coutant  <ccoutant@google.com>
3166
3167         * symtab.cc (Symbol_table::sized_write_globals): Subtract
3168         section starting address for relocatable link.
3169         * testsuite/Makefile.am (script_test_11): New test.
3170         * testsuite/Makefile.in: Regenerate.
3171         * testsuite/script_test_11.c: New source file.
3172         * testsuite/script_test_11.t: New linker script.
3173
3174 2013-04-13  Alan Modra  <amodra@gmail.com>
3175
3176         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
3177         owner when sections are not adjacent and exceed group size.
3178         (Target_powerpc::group_sections): Handle corner case.
3179         (Target_powerpc::Branch_info::make_stub): Handle case where
3180         stub table doesn't exist due to branches in non-exec sections.
3181         (Target_powerpc::Relocate::relocate): Likewise.
3182
3183 2013-04-11  Alan Modra  <amodra@gmail.com>
3184
3185         PR gold/15354
3186         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
3187         .branch_lt to match bfd ld.  Adjust comments throughout file.
3188
3189 2013-04-04  Ian Lance Taylor  <iant@google.com>
3190
3191         GCC PR c++/56840
3192         * object.cc (do_layout_deferred_sections): Handle .eh_frame
3193         sections before checking whether they are included in the link.
3194
3195 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
3196
3197         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
3198         object before calling the plugin claim_file handler.  Pass the elf
3199         object of the archive to the plugin. Delete the elf object if the
3200         plugin claims the file.
3201
3202 2013-03-21  Alan Modra  <amodra@gmail.com>
3203
3204         * layout.cc (Layout::set_segment_offsets): Accept writable .text
3205         segment when omagic.
3206
3207 2013-03-21  Alan Modra  <amodra@gmail.com>
3208
3209         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
3210         comparison warning.
3211         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
3212         uninitialized" warning.
3213
3214 2013-03-20  Alan Modra  <amodra@gmail.com>
3215
3216         * symtab.h (Symbol::clear_version): New function.
3217         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
3218         is_needed by weak references.  Clear version for symbols defined
3219         in as-needed objects that are not needed.
3220
3221 2013-03-15  Alan Modra  <amodra@gmail.com>
3222
3223         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
3224         static and public.  Add report_err param.  Return false for data refs.
3225         (Target_powerpc::rela_dyn_section): New overloaded function.
3226         (Target_powerpc::plt_, iplt_): Elucidate.
3227         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
3228         (Output_data_plt_powerpc::do_write): Don't write .iplt.
3229         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
3230         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
3231         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
3232         push_branch and make_plt_entry for ifunc syms when
3233         reloc_needs_plt_for_ifunc.
3234         (Target_powerpc::Relocate::relocate): Don't use plt entry value
3235         for ifunc unless reloc_needs_plt_for_ifunc.
3236
3237 2013-03-15  Alan Modra  <amodra@gmail.com>
3238
3239         * gc.h (gc_process_relocs): Don't look through function descriptors.
3240         * icf.cc (get_section_contents): Do so here instead.
3241
3242 2013-03-13  Alan Modra  <amodra@gmail.com>
3243
3244         * powerpc.cc (is_branch_reloc): Forward declare.
3245         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
3246         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
3247         false for 64-bit, true for 32-bit non-branch relocs.
3248         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
3249         * testsuite/Makefile.am (icf_test): Use linker map file instead of
3250         nm output.
3251         (icf_safe_test): Generate linker map file as well as nm output.
3252         (icf_safe_so_test): Likewise.
3253         * testsuite/Makefile.in: Regenerate.
3254         * testsuite/icf_test.sh: Parse linker map file to determine
3255         section folding.
3256         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
3257         * testsuite/icf_safe_so_test.sh: Likewise.
3258         (X86_32_or_ARM_specific_safe_fold): Merge into..
3259         (arch_specific_safe_fold): ..this.
3260         (X86_64_specific_safe_fold): Delete unused function.
3261
3262 2013-03-12  Alan Modra  <amodra@gmail.com>
3263
3264         * gc.h (gc_process_relocs): Look through function descriptors
3265         to determine shndx, symvalue and addend used by ICF.  Tidy
3266         variable duplication.
3267
3268 2013-03-11  Alan Modra  <amodra@gmail.com>
3269
3270         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
3271         * layout.cc (Layout_task_runner::run): ..to here.
3272         * symtab.h (struct Symbol_location): Extract from..
3273         (class Symbol_table): ..here.
3274         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
3275         * target.h (class Target): Add function_location and
3276         do_function_location functions.
3277         (class Sized_target): Add do_function_location.
3278         * object.h (class Sized_relobj_file): Move find_shdr..
3279         (class Object): ..to here.
3280         * object.cc: Likewise.  Update to suit.  Instantiate.
3281         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
3282         * powerpc.cc (class Powerpc_dynobj): New.
3283         (Target_powerpc::do_function_location): New function.
3284         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
3285         (Powerpc_dynobj::do_read_symbols): New function.
3286         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
3287
3288 2013-03-08  Ian Lance Taylor  <iant@google.com>
3289
3290         * options.cc (General_options::string_to_object_format): Accept
3291         "default".
3292
3293 2013-03-08  Alan Modra  <amodra@gmail.com>
3294
3295         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
3296         pointer to Post_fde.
3297         (struct Post_fde): Move definition to here..
3298         * ehframe.cc (struct Post_fde): ..from here.
3299         (Cie::write): Don't alloc Post_fde.
3300         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
3301
3302 2013-03-07  Alan Modra  <amodra@gmail.com>
3303
3304         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
3305         relocation referencing .LC0.
3306         * testsuite/discard_locals_test.sh: Remove FIXMEs.
3307
3308 2013-03-07  Alan Modra  <amodra@gmail.com>
3309
3310         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
3311         always_inline.  Add assembly for powerpc to avoid GOT.
3312
3313 2013-03-07  Alan Modra  <amodra@gmail.com>
3314
3315         * testsuite/script_test_10.sh: Don't test .bss section
3316         header number.
3317
3318 2013-03-06  Alan Modra  <amodra@gmail.com>
3319
3320         * powerpc.cc (class Powerpc_relobj): Move some member functions.
3321         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
3322         all callers.  Handle folded sections.
3323         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
3324         to Powerpc_relobj.
3325         (Global_symbol_visitor_opd::operator()): Likewise.
3326
3327 2013-03-04  Alan Modra  <amodra@gmail.com>
3328
3329         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
3330         * testsuite/Makefile.in: Regenerate.
3331
3332 2013-03-01  Cary Coutant  <ccoutant@google.com>
3333
3334         Add dwp support for v2 DWARF package file format.
3335         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
3336         tu_length parameter.  Adjust all callers.
3337         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
3338         * dwp.cc: Include dwarf.h.
3339         (Section_bounds): New struct type.
3340         (Unit_set): New struct type.
3341         (Dwo_file::Dwo_file): Initialize new data member.
3342         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
3343         Combine and rename to...
3344         (Dwo_file::read_unit_index): ...this.
3345         (Dwo_file::sized_read_compunit_index)
3346         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
3347         (Dwo_file::sized_read_unit_index): ...this.
3348         (Dwo_file::copy_section): Remove section_name, is_str_offsets
3349         parameters; add section_id parameter.
3350         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
3351         (Dwo_file::add_unit_set): ...this.
3352         (Dwo_file::shndx_map_): Remove.
3353         (Dwo_file::sect_offsets_): New data member.
3354         (Dwp_output_file::Dwp_output_file): Initialize new data members.
3355         (Dwp_output_file::add_section): Rename to...
3356         (Dwp_output_file::add_contribution): ...this.
3357         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
3358         (Dwp_output_file::add_tu_set): Likewise.
3359         (Dwp_output_file::Contribution): New type.
3360         (Dwp_output_file::Section::contributions): New data member.
3361         (Dwp_output_file::Cu_or_tu_set): Remove.
3362         (Dwp_output_file::Section::Section): New ctor.
3363         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
3364         (Dwp_output_file::Dwp_index::Section_table): New type.
3365         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
3366         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
3367         parameter.
3368         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
3369         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
3370         (Dwp_output_file::Dwp_index::section_table): New member function.
3371         (Dwp_output_file::Dwp_index::section_table_end): New member function.
3372         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
3373         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
3374         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
3375         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
3376         (Dwp_output_file::Dwp_index::section_table_): New data member.
3377         (Dwp_output_file::Dwp_index::section_mask_): New data member.
3378         (Dwp_output_file::add_output_section): New member function.
3379         (Dwp_output_file::write_new_section): New member function.
3380         (Dwp_output_file::write_contributions): New member function.
3381         (Dwp_output_file::section_id_map_): New data member.
3382         (class Dwo_id_info_reader): Remove.
3383         (class Unit_reader): New class.
3384         (get_dwarf_section_name): New function.
3385         (Dwo_file::read_executable): Adjust initializations of class data.
3386         (Dwo_file::read): Add support for v2 package file format.
3387         (Dwo_file::read_unit_index): Likewise.
3388         (Dwo_file::sized_read_unit_index): Likewise.
3389         (Dwo_file::copy_section): Likewise.
3390         (Dwo_file::add_unit_set): Likewise.
3391         (Dwp_output_file::add_output_section): Likewise.
3392         (Dwp_output_file::add_contribution): Likewise.
3393         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
3394         for empty slot.
3395         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
3396         file format.
3397         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
3398         slot.
3399         (Dwp_output_file::initialize): Remove unused function.
3400         (Dwp_output_file::finalize): Add support for v2 package file format.
3401         (Dwp_output_file::write_index): Likewise.
3402         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
3403         function prototype.
3404
3405 2013-03-01  Cary Coutant  <ccoutant@google.com>
3406
3407         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
3408         function into class definition in header file.
3409         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
3410         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
3411         New function.
3412         (Dwarf_info_reader::check_buffer): Move here from .cc file.
3413
3414 2013-02-28  Alan Modra  <amodra@gmail.com>
3415
3416         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
3417         * target.cc (Target::do_plt_fde_location): New function.
3418         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
3419         accessor function, and constructor param.
3420         (struct Post_fde, Post_fdes): Declare.
3421         (Cie::write): Add post_fdes param.
3422         * ehframe.cc (Fde::write): Use plt_fde_location.
3423         (struct Post_fde): Define.
3424         (Cie::write): Stash FDEs added post merge mapping.
3425         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
3426         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
3427         (Eh_frame::do_sized_write): Arrange to write post map FDES after
3428         other FDEs.
3429         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
3430         (Target_powerpc::has_glink): New function.
3431         (Target_powerpc::do_relax): Add eh_frame info for stubs.
3432         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
3433         glink_eh_frame_fde_32, default_fde): New data.
3434         (Stub_table::eh_frame_added_): New var.
3435         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
3436         Make const.
3437         (Stub_table::add_eh_frame): New function.
3438         (Output_data_glink::add_eh_frame): New function.
3439         (Target_powerpc::make_glink_section): Call add_eh_frame.
3440
3441 2013-02-15  Ian Lance Taylor  <iant@google.com>
3442
3443         * options.h (DEFINE_uint64_alias): Define.
3444         (class General_options): Add -Ttext-segment as an alias for
3445         -Ttext.
3446
3447 2013-02-15  Alan Modra  <amodra@gmail.com>
3448
3449         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
3450         (Stub_table::do_write): ..here, two places.
3451         (Stub_table::plt_call_size): Use it here too.
3452
3453 2013-02-11  Ian Lance Taylor  <iant@google.com>
3454
3455         * descriptors.cc (Descriptors::close_all): New function.
3456         * descriptors.h (class Descriptors): Declare close_all.
3457         (close_all_descriptors): New inline function.
3458         * plugin.cc: Include "descriptors.h".
3459         (Plugin_manager::cleanup): Call close_all_descriptors.
3460
3461 2013-02-06  Alan Modra  <amodra@gmail.com>
3462
3463         * README: Update coding style link.
3464
3465 2013-01-28  Cary Coutant  <ccoutant@google.com>
3466
3467         * dwp.cc (File_list): New typedef.
3468         (Dwo_name_info_reader): New class.
3469         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
3470         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
3471         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
3472         (Dwo_file::read_executable): New function.
3473         (Dwo_file::read): Move common setup code to ...
3474         (Dwo_file::make_object): ... here.
3475         (dwp_options): Add --exec/-e.
3476         (usage): Likewise.
3477         (main): Likewise.
3478
3479 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
3480
3481         * layout.cc (Layout::layout): Check for option text_reorder.
3482         (Layout::make_output_section): Ditto.
3483         * options.h (text_reorder): New option.
3484         * output.cc (Input_section_sort_compare): Remove special ordering
3485         of section names.
3486         (Output_section::
3487          Input_section_sort_section_name_special_ordering_compare::
3488          operator()): New function.
3489         (Output_section::sort_attached_input_sections): Use new sort function
3490         for .text.
3491         * output.h (Input_section_sort_section_name_special_ordering_compare):
3492         New struct.
3493         * testsuite/Makefile.am (text_section_grouping): Test option
3494         --no-text-reorder
3495         * testsuite/Makefile.in: Regenerate.
3496         * testsuite/text_section_grouping.sh: Check order of functions without
3497         default text reordering.
3498
3499 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3500
3501         * options.h (General_options): Change default to true for new_dtags.
3502
3503 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3504
3505         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
3506         when enable_new_dtags is false.  Only add DT_RUNPATH when
3507         enable_new_dtags is true.
3508
3509 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
3510
3511         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
3512         used in declaration and definition consistent.
3513         (Target_powerpc::symval_for_branch): Ditto.
3514
3515 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3516
3517         * testsuite/plugin_final_layout.cc: Fix comment.
3518
3519 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3520
3521         * layout.cc (Layout::layout): Do not do default sorting for
3522         text sections when section ordering is specified.
3523         (make_output_section): Ditto.
3524         * testsuite/plugin_final_layout.cc: Name the function sections
3525         to catch reordering issues.
3526
3527 2013-01-15  Alan Modra  <amodra@gmail.com>
3528
3529         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
3530         plt-thread-safe.
3531
3532 2013-01-15  Alan Modra  <amodra@gmail.com>
3533
3534         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
3535         * testsuite/Makefile.in: Regenerate.
3536
3537 2013-01-14  Alan Modra  <amodra@gmail.com>
3538
3539         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
3540         * testsuite/Makefile.in: Regenerate.
3541
3542 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
3543
3544         PR bfd/14430
3545         Fix mingw gold build with plugins enabled
3546         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
3547         * configure.ac: Export DLOPEN_LIBS and add headers check.
3548         * plugin.cc: Handle non-dlfcn case.
3549         * Makefile.in: Regenerate.
3550         * config.in: Regenerate.
3551         * configure: Regenerate.
3552         * testsuite/Makefile.in: Regenerate.
3553
3554 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
3555
3556         * output.h (sort_attached_input_sections): Change to be public.
3557         * script-sections.cc
3558         (Output_section_definition::set_section_addresses): Sort
3559         attached input sections according to section order before linker
3560         script assigns section addresses.
3561         (Orphan_output_section::set_section_addresses): Sort
3562         attached input sections according to section order before linker
3563         script assigns section addresses.
3564         * Makefile.am (final_layout.sh): Use a simple linker script to
3565         check if section ordering still works.
3566         * Makefile.in: Regenerate.
3567
3568 2013-01-09  Ben Cheng  <bccheng@google.com>
3569
3570         * arm.cc (Target_arm::attributes_accept_div): New function.
3571         (Target_arm::attributes_forbid_div): New function.
3572         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
3573         attribute using the same new functions as what bfd/elf32_arm.c
3574         does.
3575
3576 2013-01-07  Cary Coutant  <ccoutant@google.com>
3577
3578         PR gold/14993
3579         * output.cc (Output_section::add_input_section): For incremental
3580         updates, don't track input sections that are allocated from patch
3581         space.
3582
3583 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3584             Ian Lance Taylor  <iant@google.com>
3585
3586         PR gold/14897
3587         * configure.ac (--enable-ld): Removed.
3588         (install_as_default): Set to yes only for --enable-gold=default
3589         or --disable-ld.
3590         * configure: Regenerated.
3591
3592 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3593
3594         * options.h (General_options): Add -fuse-ld= for GCC linker
3595         option compatibility.
3596
3597 2013-01-04  Cary Coutant  <ccoutant@google.com>
3598
3599         * configure.ac: Fix typo restoring CXXFLAGS.
3600         * configure: Regenerate.
3601
3602 2013-01-04  Cary Coutant  <ccoutant@google.com>
3603
3604         * testsuite/Makefile.am (CXXLINK_S): New macro.
3605         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
3606         * testsuite/Makefile.in: Regenerate.
3607
3608 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
3609
3610         * version.cc (print_version): Update copyright year to 2013.
3611
3612 2012-12-20  Ian Lance Taylor  <iant@google.com>
3613
3614         * layout.cc (Layout::special_ordering_of_input_section): New
3615         function.
3616         (Layout::layout): If input section requires special ordering, must
3617         sort input sections.
3618         (Layout::make_output_section): May sort .text input sections.
3619         (Layout::is_section_name_prefix_grouped): Remove.
3620         * layout.h (class Layout): Declare
3621         special_ordering_of_input_section.  Don't declare
3622         is_section_name_prefix_grouped.
3623         * output.cc (Output_section::add_input_section): Revert last
3624         change.
3625         (Output_section::Input_section_sort::match_file_name): Don't crash
3626         if called on output section data.
3627         (Output_section::Input_section_sort_compare): Sort based on
3628         special ordering.
3629         (Output_section::Input_section_sort_section_order_index_compare):
3630         Revert last patch.
3631         (Output_section::sort_attached_input_sections): Likewise.
3632
3633 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
3634
3635         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
3636         * layout.h (Layout::is_section_name_prefix_grouped): New function.
3637         * output.cc (Output_section::add_input_section): Check if section
3638         name contains special prefix.  Keep input sections to sort such
3639         sections.
3640         (Output_section::Input_section_sort_section_order_index_compare
3641          ::operator()): Group sections according to prefixes.
3642         (Output_section::sort_attached_input_sections): Add condition to
3643         Input_section_entry constructor call.
3644         * testsuite/Makefile.am (text_section_grouping): New test.
3645         * testsuite/Makefile.in: Regenerate.
3646         * testsuite/text_section_grouping.cc: New file.
3647         * testsuite/text_section_grouping.sh: New file.
3648
3649 2012-12-17  Nick Clifton  <nickc@redhat.com>
3650
3651         * Makefile.am: Add copyright notice.
3652         * NEWS: Likewise.
3653         * README: Likewise.
3654         * configure.ac: Likewise.
3655         * ftruncate.c: Likewise.
3656         * Makefile.in: Regenerate.
3657
3658 2012-12-14  Cary Coutant  <ccoutant@google.com>
3659
3660         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
3661         --no-as-needed flag.
3662         (exception_separate_shared_12_test): Likewise.
3663         (incremental_copy_test): Likewise.
3664         * testsuite/Makefile.in: Regenerate.
3665
3666 2012-12-14  Cary Coutant  <ccoutant@google.com>
3667
3668         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
3669         (Dwp_output_file::Dwp_index::enter_set): Add assert.
3670
3671 2012-12-12  Alan Modra  <amodra@gmail.com>
3672
3673         * powerpc.cc (class Track_tls): New.
3674         (class Relocate, class Scan): Inherit Track_tls.
3675         (Target_powerpc::Scan::local, global): Track tls optimization
3676         and avoid creating plt entry for __tls_get_addr if all uses
3677         are optimized away.
3678         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
3679
3680 2012-12-12  Alan Modra  <amodra@gmail.com>
3681
3682         * options.h (General_options): Add --toc-sort/--no-toc-sort.
3683         Replace no_toc_optimize with toc_optimize.
3684         * output.h (Output_section::input_sections): Provide non-const variant.
3685         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
3686         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
3687         accessors.
3688         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
3689         (class Sort_toc_sections): New.
3690         (Target_powerpc::do_finalize_sections): Sort toc sections.
3691         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
3692
3693 2012-12-10  Roland McGrath  <mcgrathr@google.com>
3694
3695         * testsuite/binary_unittest.cc (read_all): New function.
3696         (Sized_binary_test): Use it instead of ::read.
3697         * fileread.cc (do_read): Don't assume pread always reads the whole
3698         amount in a single call.
3699
3700 2012-12-10  Alan Modra  <amodra@gmail.com>
3701
3702         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
3703         Set EM_PPC64 or EM_PPC here.
3704         (Target_selector_powerpc::do_recognize): Delete.
3705
3706 2012-12-10  Alan Modra  <amodra@gmail.com>
3707
3708         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
3709         stub_table_.
3710         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
3711
3712 2012-12-07  Roland McGrath  <mcgrathr@google.com>
3713
3714         * testsuite/binary_unittest.cc (Sized_binary_test):
3715         Use open_descriptor rather than ::open.
3716
3717 2012-12-07  Alan Modra  <amodra@gmail.com>
3718
3719         * powerpc.cc (Stub_table::do_write): Delete redundant Address
3720         typedef and invalid_address constant.
3721         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
3722         instantiate constants.
3723
3724 2012-12-06  Roland McGrath  <mcgrathr@google.com>
3725
3726         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
3727         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
3728         * aclocal.m4: Regenerate.
3729         * configure: Regenerate.
3730         * Makefile.in: Regenerate.
3731         * testsuite/Makefile.in: Regenerate.
3732
3733 2012-12-07  Alan Modra  <amodra@gmail.com>
3734
3735         * options.h (General_options): Add no_toc_optimize.
3736         * powerpc.cc (ok_lo_toc_insn): New function.
3737         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
3738
3739 2012-12-06  Alan Modra  <amodra@gmail.com>
3740
3741         * options.h (General_options): Add plt_align, plt_static_chain,
3742         plt_thread_safe.  Update stub_group_size help text.
3743         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
3744         for new plt_thread_safe_ var.
3745         (use_plt_offset): Correct comments.
3746         (Target_powerpc::do_relax): Look for thread creation symbols to
3747         determine default plt_thread_safe value.  Clear plt call stubs
3748         as well as branch stubs each iteration.
3749         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
3750         insn constants.
3751         (l, hi, ha, write_insn): Move earlier.
3752         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
3753         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
3754         plt stubs too.
3755         (Stub_table::update_size): Adjust.
3756         (Stub_table::prev_size, set_prev_size): Delete.
3757         (Stub_table::stub_align): Let --plt-align affect result.
3758         (Stub_table::plt_call_size): Calculate sizes for various stubs.
3759         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
3760         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
3761         (Stub_table::do_write): Support more stub variants.
3762
3763 2012-12-04  Alan Modra  <amodra@gmail.com>
3764
3765         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
3766         (Target_powerpc::do_define_standard_symbols): New function.
3767
3768 2012-12-03  Alan Modra  <amodra@gmail.com>
3769
3770         * output.h: Formatting, whitespace.
3771
3772 2012-12-03  Alan Modra  <amodra@gmail.com>
3773
3774         * layout.h (Layout::get_executable_sections): Declare.
3775         * layout.cc (Layout::get_executable_sections): New function.
3776         * arm.cc (Target_arm::group_sections): Use it.
3777         (Arm_output_section::group_sections): Delete now redundant test.
3778         * output.cc (Output_reloc::Output_reloc): Add is_relative.
3779         param to handle relative relocs.
3780         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
3781         (Output_data_reloc::add_absolute): Adjust.
3782         (Output_data_reloc::add_relative): New function.
3783         (Output_data::reset_data_size): New function.
3784         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
3785         (Output_section::set_addralign): New function.
3786         (Output_section::checkpoint_set_addralign): New function.
3787         (Output_section::clear_section_offsets_need_adjustment): New function.
3788         (Output_section::input_sections): Make public.
3789         * powerpc.cc (class Output_data_brlt_powerpc): New.
3790         (class Stub_table, class Stub_control): New.
3791         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
3792         stub_table_, set_stub_table, stub_table): New vectors and accessor
3793         functions.
3794         (Target_powerpc::do_may_relax, do_relax, push_branch,
3795         new_stub_table, stub_tables, brlt_section, group_sections,
3796         add_branch_lookup_table, find_branch_lookup_table,
3797         write_branch_lookup_table, make_brlt_section): New functions.
3798         (Target_powerpc::struct Sort_sections, class Branch_info): New.
3799         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
3800         branch_info_): New vars.
3801         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
3802         make call stubs here.
3803         (Output_data_glink): Remove all call stub handling from this class.
3804         (Target_powerpc::Scan::local, global): Save interesting branch
3805         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
3806         (Target_powerpc::do_finalize_sections): Only make reg save/restore
3807         functions on final link.
3808         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
3809         Handle long branch destinations too.
3810         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
3811         do_plt_address_for_local): Adjust lookup of plt call stubs.
3812
3813 2012-11-30  Alan Modra  <amodra@gmail.com>
3814
3815         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
3816         relocs against protected symbols when building 32-bit shared libs.
3817
3818 2012-11-30  Alan Modra  <amodra@gmail.com>
3819
3820         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
3821         param.  Call got_section() to make .got.  Update all callers
3822         and their callers and so on.
3823
3824 2012-11-30  Alan Modra  <amodra@gmail.com>
3825
3826         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
3827         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
3828         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
3829         value if it already exists.
3830
3831 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
3832
3833         PR gold/14858
3834         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
3835
3836 2012-11-14  Roland McGrath  <mcgrathr@google.com>
3837
3838         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
3839         than bfc instruction for data sandboxing.
3840
3841 2012-11-08  Alan Modra  <amodra@gmail.com>
3842
3843         * po/POTFILES.in: Regenerate.
3844
3845 2012-11-05  Alan Modra  <amodra@gmail.com>
3846
3847         * configure.ac: Apply 2012-09-10 change to config.in here.
3848         * configure: Regenerate.
3849
3850 2012-11-05  Alan Modra  <amodra@gmail.com>
3851
3852         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
3853         (struct Opd_ent): Use "Address" rather than "Offset".
3854         (Output_data_got_powerpc::got_base_offset): Return Valtype.
3855         (Target_powerpc::got_section): Make public.
3856         (Target_powerpc::scan_relocs): Move code setting symbols..
3857         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
3858         Create _SDA_BASE_ only when referenced.
3859
3860 2012-11-02  Roland McGrath  <mcgrathr@google.com>
3861
3862         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
3863         from last change.
3864
3865 2012-11-01  Roland McGrath  <mcgrathr@google.com>
3866
3867         * target.h (Sized_target::relocate_relocs): Use Elf_Off
3868         for offset_in_output_section parameter.
3869         (Sized_target::relocate_special_relocatable): Likewise.
3870         * arm.cc (Target_arm::relocate_relocs): Likewise.
3871         (Target_arm::relocate_special_relocatable): Likewise.
3872         * i386.cc (Target_i386::relocate_relocs): Likewise.
3873         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
3874         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
3875         * target-reloc.h (relocate_relocs): Likewise.
3876         * testsuite/testfile.cc (Target_test): Likewise.
3877         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
3878         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
3879
3880         * system.h: Move inclusion of <clocale> to after <libintl.h> in
3881         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
3882
3883         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
3884         parameter, which is unused in the [!F_SETFD] case.
3885
3886         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
3887         SYMNDX to off_t before comparing it to this->data_size().
3888         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
3889         * incremental.cc (Output_section_incremental_inputs::do_write):
3890         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
3891
3892         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
3893
3894 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
3895
3896         * gold.cc (Target_arm::do_adjust_elf_header): Add the
3897         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
3898         in EABI_VER5.
3899
3900 2012-10-29  Cary Coutant  <ccoutant@google.com>
3901
3902         * dwp.cc (usage): Add file and exit status parameters;
3903         add --help and --version options.
3904         (print_version): New function.
3905         (main): Add --help and --version options.
3906
3907 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3908
3909         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
3910         final_layout_sequence.txt.
3911         * testsuite/Makefile.in: Regenerated.
3912
3913 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3914
3915         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
3916         COMPILE generated by automake.
3917         (LINK1): Likewise.
3918         (CXXCOMPILE1): Likewise.
3919         (CXXLINK1): Likewise.
3920         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
3921         (LINK): Likewise.
3922         (CXXCOMPILE): Likewise.
3923         (CXXLINK): Likewise.
3924         * testsuite/Makefile.in: Regenerated.
3925
3926 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3927
3928         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
3929         on bad fwrite return.
3930
3931 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3932
3933         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
3934         on val.
3935
3936 2012-10-23  Cary Coutant  <ccoutant@google.com>
3937
3938         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
3939         * testsuite/Makefile.in: Regenerate.
3940         * testsuite/dwp_test.h: New source file.
3941         * testsuite/dwp_test_1.cc: New source file.
3942         * testsuite/dwp_test_1.s: New source file.
3943         * testsuite/dwp_test_1.sh: New source file.
3944         * testsuite/dwp_test_1b.cc: New source file.
3945         * testsuite/dwp_test_1b.s: New source file.
3946         * testsuite/dwp_test_2.cc: New source file.
3947         * testsuite/dwp_test_2.s: New source file.
3948         * testsuite/dwp_test_2.sh: New source file.
3949         * testsuite/dwp_test_main.cc: New source file.
3950         * testsuite/dwp_test_main.s: New source file.
3951
3952 2012-10-23  Cary Coutant  <ccoutant@google.com>
3953
3954         * dwp.h: New header file.
3955         * dwp.cc: New source file.
3956         * gold.h: Move shared declarations to system.h.
3957         * system.h: New header file.
3958         * Makefile.am: Add dwp.
3959         * Makefile.in: Regenerate.
3960
3961 2012-10-23  Cary Coutant  <ccoutant@google.com>
3962
3963         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
3964         Dwarf_info_reader::read_from_pointer.
3965         (Dwarf_pubnames_table::read_header): Likewise.
3966         (Dwarf_pubnames_table::next_name): Likewise.
3967         (Dwarf_die::read_attributes): Likewise.
3968         (Dwarf_die::skip_attributes): Likewise.
3969         (Dwarf_info_reader::read_from_pointer): New function template.
3970         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
3971         (Dwarf_pubnames_table): Likewise.
3972         (Dwarf_info_reader::read_from_pointer): New function template.
3973         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
3974         Dwarf_pubnames_table ctor.
3975
3976 2012-10-23  Cary Coutant  <ccoutant@google.com>
3977
3978         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
3979         abbrev_shndx.
3980         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
3981         abbrev_shndx_.
3982         (Dwarf_info_reader::set_abbrev_shndx): New method.
3983         (Dwarf_info_reader::abbrev_shndx_): New data member.
3984
3985 2012-10-23  Cary Coutant  <ccoutant@google.com>
3986
3987         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
3988         from object, not parameters.
3989         (Dwarf_info_reader::parse): Likewise.
3990         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
3991         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
3992         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
3993         methods.
3994
3995 2012-10-23  Cary Coutant  <ccoutant@google.com>
3996
3997         * fileread.cc (Input_file::Input_file): New constructor.
3998         * fileread.h (class Input_file): Add new constructor.
3999
4000 2012-10-18  Alan Modra  <amodra@gmail.com>
4001
4002         PR gold/14727
4003         * object.cc (Relobj::is_section_name_included): Also match
4004         .sdata personality section.
4005
4006 2012-10-18  Alan Modra  <amodra@gmail.com>
4007
4008         * target-reloc.h (class Default_comdat_behavior): New, package up..
4009         (get_comdat_behaviour): ..this.
4010         (relocate_section): Add Relocate_comdat_behavior template arg,
4011         adjust code to suit.
4012         * arm.cc (Target_arm::relocate_section): Adjust to suit.
4013         (Target_arm::scan_reloc_section): Likewise.
4014         * i386.cc (Target_i386::relocate_section): Likewise.
4015         * sparc.cc (Target_sparc::relocate_section): Likewise.
4016         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
4017         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
4018         * powerpc.cc (class Relocate_comdat_behavior): New.
4019         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
4020         gold::relocate_section with new template arg.
4021
4022 2012-10-18  Alan Modra  <amodra@gmail.com>
4023
4024         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
4025         dynamic relocs for GOT_TPREL got entries, without symbol if
4026         resolving locally.
4027         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
4028         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
4029         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
4030
4031 2012-10-17  Alan Modra  <amodra@gmail.com>
4032
4033         PR gold/14726
4034         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
4035
4036 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
4037
4038         * layout.cc (Layout::include_section): Keep sections marked
4039         SHF_EXCLUDE when doing relocatable links.
4040
4041 2012-10-16  Alan Modra  <amodra@gmail.com>
4042
4043         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
4044         (Target_powerpc::do_finalize_sections): Call it.
4045         (Output_data_save_res): New class and supporting functions.
4046         (Target_powerpc::symval_for_branch): Only look up .opd entry for
4047         normal symbols defined in object files.
4048
4049 2012-10-12  Alan Modra  <amodra@gmail.com>
4050
4051         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
4052         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
4053         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
4054         section if scan_opd_relocs not yet called.
4055         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
4056
4057 2012-10-12  Alan Modra  <amodra@gmail.com>
4058
4059         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
4060         add_local_ifunc_entry): Revert last change.
4061         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
4062
4063 2012-10-05  Alan Modra  <amodra@gmail.com>
4064
4065         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
4066         do_plt_address_for_global): New functions.
4067         (Output_data_got_powerpc::do_write): Don't segfault when linking
4068         statically.
4069         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
4070         add_local_ifunc_entry): Return true on adding entry..
4071         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
4072         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
4073         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
4074         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
4075         set up symbols here.
4076         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
4077         syms here.  Do so even when no .iplt.  Don't segfault when linking
4078         statically.
4079         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
4080         new variants without reloc param.
4081         (Glink_sym_ent::Glink_sym_ent): Likewise.
4082         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
4083         reloc when refs will resolve to plt call stub.
4084         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
4085         R_PPC_PLTREL24 to resolve locally.
4086         (Target_powerpc::Scan::global): Correct ifunc handling.
4087         (Target_powerpc::Relocate::relocate): Correct local sym glink
4088         lookup.  Don't destroy "value" when we have a plt call stub,
4089         and when checking plt call validity.
4090         (Target_powerpc::do_dynsym_value): Simplify.
4091
4092 2012-10-05  Alan Modra  <amodra@gmail.com>
4093
4094         * i386.cc (Output_data_plt_i386::address_for_global,
4095         address_for_local): Add plt offset to returned value.  Adjust uses.
4096         * sparc.cc (Output_data_plt_sparc::address_for_global,
4097         address_for_local): Likewise.
4098         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
4099         address_for_local): Likewise.
4100         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
4101         address_for_local): Likewise.
4102         * target.h (Target::plt_address_for_global, plt_address_for_local):
4103         Update comment.
4104         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
4105         (Output_data_got::Got_entry::write): Nor here.
4106         * output.h: Comment fix.
4107
4108 2012-10-02  Jiong Wang  <jiwang@tilera.com>
4109
4110         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
4111         global_offset_table_ value for larget got.
4112         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
4113
4114 2012-09-29  Alan Modra  <amodra@gmail.com>
4115
4116         * powerpc.cc (Target_powerpc::iplt_): New output section.
4117         (Target_powerpc::iplt_section, make_iplt_section,
4118         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
4119         (Target_powerpc::make_plt_entry): Handle ifunc syms.
4120         Target_powerpc::plt_entry_count): Count iplt entries too.
4121         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
4122         reloc section in constructor.  New params.
4123         (Target_powerpc::make_plt_section): Create reloc section here instead.
4124         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
4125         functions.
4126         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
4127         (Output_data_glink::add_entry, find_entry): New functions to
4128         deal with local syms.
4129         (Glink_sym_ent): Add support for local syms.
4130         (Output_data_glink::do_write): Handle ifunc plt entries.
4131         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4132         (Target_powerpc::Scan::local, global): Handle ifunc syms.
4133         (Target_powerpc::Relocate::relocate): Likewise.
4134         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
4135
4136 2012-09-25  Alan Modra  <amodra@gmail.com>
4137
4138         * object.h (Sized_relobj_file::adjust_local_symbol,
4139         do_adjust_local_symbol): New functions.
4140         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
4141         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
4142         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
4143         and irregular opd entry spacing.
4144         (Powerpc_relobj::do_read_relocs): Add opd size checks.
4145         (Global_symbol_visitor_opd): New functor.
4146         (Target_powerpc::do_finalize_sections): Omit global symbols defined
4147         on deleted opd entries.
4148
4149 2012-09-15  Jiong Wang  <jiwang@tilera.com>
4150
4151         * tilegx.cc: New file.
4152         * Makefile.am (TARGETSOURCES): Add tilegx.cc
4153         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
4154         * configure.tgt: Add entries for tilegx*.
4155         * configure.ac: Likewise.
4156         * Makefile.in: Rebuild.
4157         * configure: Likewise.
4158         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
4159         tilegx.
4160
4161 2012-09-13  Alan Modra  <amodra@gmail.com>
4162
4163         * target-reloc.h (scan_relocs): Call scan.local for relocs
4164         against symbols in discarded sections.  Pass is_discarded
4165         param.
4166         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
4167         Add is_discarded param.
4168         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
4169         is_discarded to flag opd entry as discarded.  Don't emit dyn
4170         relocs on such entries.
4171         (Target_powerpc::Scan::global): Similarly detect and handle
4172         such opd entries.
4173         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
4174         opd_ent_.  Update all uses.
4175         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
4176         (Target_powerpc::relocate_section): Zero out discarded opd
4177         entry relocs.
4178
4179 2012-09-12  Ian Lance Taylor  <iant@google.com>
4180
4181         PR gold/14570
4182         * output.cc: Rename Output_data_got template parameter from size
4183         to got_size for all functions.  Compile all variants of
4184         Output_data_got.
4185         (Output_data_got::Got_entry::write): Correct use of size for
4186         symbol value.  Use local_is_tls rather than casting to
4187         Sized_relobj_file.
4188         * object.h (class Object): Add local_is_tls and do_local_is_tls.
4189         (class Sized_relobj_file): Add do_local_is_tls.
4190         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
4191
4192 2012-09-11  Alan Modra  <amodra@gmail.com>
4193
4194         PR gold/14566
4195         * layout.cc (Layout::set_segment_offsets): When using
4196         common-page-size alignment, ensure we are on a new max-page-size
4197         page.
4198         * output.cc (Output_segment::set_section_addresses): Use
4199         abi_pagesize, not common_pagesize for relro boundary.
4200         (Output_segment::set_offset): Likewise.
4201
4202 2012-09-11  Alan Modra  <amodra@gmail.com>
4203
4204         * output.h (Output_data_got::add_global_tls, add_local_tls,
4205         add_local_tls_pair): New functions.
4206         (Output_data_got::add_local_pair_with_rel): Remove second
4207         reloc param.  Expand comment.
4208         (Output_data_got::Got_entry): Rename use_plt_offset_ to
4209         use_plt_or_tls_offset_, similarly for constructor param.
4210         (Output_data_got::Got_entry::write): Add got_index param.
4211         * output.cc (Output_data_got::add_global_tls, add_local_tls,
4212         add_local_tls_pair): New functions.
4213         (Output_data_got::Got_entry::write): Handle tls symbols
4214         with use_plt_or_tls_offset_ set specially.
4215         (Output_data_got::add_local_pair_with_rel): Only one reloc.
4216         (Output_data_got::do_write): Replace iterator with index, pass
4217         index to entry write function.
4218         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
4219         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
4220         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
4221         call.
4222         * i386.cc (Target_i386::Scan::local): Likewise.
4223         * sparc.cc (Target_sparc::Scan::local): Likewise.
4224         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
4225         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
4226         do_tls_offset_for_global): New functions.
4227         (Target_powerpc::Scan::local): Correct TLS relocations and got
4228         entry values.
4229         (Target_powerpc::Scan::global): Don't emit unnecessary
4230         dynamic relocations on TLS GOT entries.
4231
4232 2012-09-10  Matthias Klose  <doko@ubuntu.com>
4233
4234         * config.in: Disable sanity check for kfreebsd.
4235
4236 2012-09-10  Sterling Augustine  <saugustine@google.com>
4237
4238         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
4239         (Gdb_index::pubtypes_read): New parameter.
4240         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
4241         to calls.
4242         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
4243         pubtypes_object_.
4244
4245 2012-09-09  Alan Modra  <amodra@gmail.com>
4246
4247         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
4248         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
4249         * gc.h (gc_process_relocs): Call target gc_add_reference.
4250         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
4251         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
4252         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
4253         unnecessary cast.
4254         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
4255         to cater for when we don't need code offset.  Update use.
4256         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
4257         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
4258         set_opd_valid): New functions.
4259         (Target_powerpc::do_gc_add_reference): New function.
4260         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
4261         stashed refs.
4262         (Target_powerpc::do_gc_mark_symbol): New function.
4263
4264 2012-09-06  Cary Coutant  <ccoutant@google.com>
4265
4266         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
4267         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
4268         (Dwarf_die::skip_attributes): Likewise.
4269         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
4270         * testsuite/gdb_index_test.cc (inline_func_1): New function.
4271         (main): Call it.
4272         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
4273
4274 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
4275
4276         * testsuite/script_test_3.t: Add .got.plt output section
4277         statement.
4278         * testsuite/script_test_4.t: Likewise.
4279
4280 2012-09-05  Alan Modra  <amodra@gmail.com>
4281
4282         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
4283         update all uses and lose "enum" when using type.
4284
4285 2012-09-05  Alan Modra  <amodra@gmail.com>
4286
4287         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
4288         * configure: Regenerate.
4289         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
4290         (plugin_final_layout.stdout): Likewise.
4291         (memory_test): Set page sizes to 0x1000.
4292         * testsuite/Makefile.in: Regenerate.
4293         * testsuite/discard_locals_test.sh: Add FIXME comment.
4294         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
4295         * testsuite/pr14265.t: Add .got output section statement.
4296         * testsuite/script_test_2.t: Likewise.
4297         * testsuite/script_test_3.t: Likewise.
4298         * testsuite/script_test_4.t: Likewise.
4299         * testsuite/script_test_5.t: Likewise.
4300         * testsuite/script_test_6.t: Likewise.
4301         * testsuite/script_test_7.t: Likewise.
4302         * testsuite/script_test_9.t: Likewise.
4303
4304 2012-09-05  Alan Modra  <amodra@gmail.com>
4305
4306         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
4307         (Powerpc_relocate_functions::Status): New typedef.
4308         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4309         (Target_powerpc::Scan::local): Handle REL64.
4310         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
4311         for REL32 and REL64.
4312         (Target_powerpc::symval_for_branch): New function, extracted from..
4313         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
4314         checks.  Report overflow errors.
4315
4316 2012-09-05  Alan Modra  <amodra@gmail.com>
4317
4318         * object.h (Sized_relobj_file::emit_relocs): Delete.
4319         (Sized_relobj_file::emit_relocs_reltype): Delete.
4320         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
4321         relocate_relocs for --emit-relocs.
4322         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
4323         * output.h: Update comment.
4324         (Output_segment::first_section): New function.
4325         (Output_segment::first_section_load_address): Use first_section.
4326         * output.cc (Output_segment::first_section): New function extracted..
4327         (Output_segment::first_section_load_address): ..from here.  Delete.
4328         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
4329         * target.h (Sized_target::relocate_for_relocatable): Likewise.
4330         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
4331         adjust call to target.h function.
4332         * i386.cc (Target_i386): Likewise.
4333         * sparc.cc (Target_sparc): Likewise.
4334         * x86_64.cc (Target_x86_64): Likewise.
4335         * powerpc.cc (Target_powerpc): Likewise.
4336         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
4337         first tls section has section symbol for optimised local dynamic
4338         output relocs.
4339         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
4340         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
4341         optimised tls code.
4342         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
4343         Rename to relocate_relocs.  Update error message.
4344
4345 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
4346
4347         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
4348         --just-symbols.
4349
4350 2012-08-31  Alan Modra  <amodra@gmail.com>
4351
4352         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
4353         (Powerpc_relobj::toc_base_offset): New stub function.
4354         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
4355         got_mod_index_offset to tlsld_got_offset.  Update all refs.
4356         (Target_powerpc::Relocate::enum skip_tls): New.
4357         (Target_powerpc::call_tls_get_addr_): New var.
4358         (Target_powerpc::is_branch_reloc): Move to file scope.
4359         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
4360         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
4361         New functions.
4362         (Target_powerpc::enum Got_type): Delete old values, add new ones.
4363         (powerpc_info): Correct common_pagesize for ppc64.
4364         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
4365         (Powerpc_relocate_functions): Add overflow check enums and functions.
4366         Add non-shift version of rela, rela_ua.  Delete all rel public
4367         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
4368         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
4369         addr16_ha3, addr14 functions.
4370         (Output_data_got_powerpc::add_constant_pair): New function.
4371         (Output_data_got_powerpc::got_base_offset): Likewise.
4372         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
4373         (instruction constants): Sort, add some more.
4374         (Output_data_glink::do_write): Add and use Address typedef.  Use
4375         object->toc_base_offset() stub for 64-bit.
4376         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
4377         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4378         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
4379         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
4380         Always treat .opd relocs as against locally defined symbol.
4381         Correct condition for RELATIVE relocs.
4382         (Target_powerpc::do_finalize_sections): Test for NULL sections.
4383         (Target_powerpc::Relocate::relocate): Use plt call stub as value
4384         for 32-bit syms with a plt entry.  Correct ppc64 toc base
4385         calculations.  Handle TLS relocs, and more.  Add overflow
4386         checking and adjust for Powerpc_relocate_functions changes.
4387         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
4388         Reinstate --emit-relocs code with FIXME.
4389
4390 2012-08-30  Alan Modra  <amodra@gmail.com>
4391
4392         * layout.cc (Layout::set_segment_offsets): Set p_align to
4393         abi_pagesize, not common_pagesize.
4394         (Layout::relaxation_loop_body): Similarly use abi_pagesize
4395         to determine whether file header can go in segment.
4396
4397 2012-08-30  Alan Modra  <amodra@gmail.com>
4398
4399         * output.h (Output_reloc::Output_reloc <output section>): Add
4400         is_relative param.  Adjust calls.
4401         (Output_reloc::add_output_section_relative): New functions.
4402         * output.cc (Output_reloc::Output_reloc <output section>): Handle
4403         is_relative.
4404         (Output_reloc::symbol_value): Handle SECTION_CODE.
4405
4406 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
4407
4408         * gold.cc (queue_middle_tasks): Call layout again when unique
4409         segments for sections is desired.
4410         * layout.cc (Layout::Layout): Initialize new members.
4411         (Layout::get_output_section_flags): New function.
4412         (Layout::choose_output_section): Call get_output_section_flags.
4413         (Layout::layout): Make output section for mapping to a unique segment.
4414         (Layout::insert_section_segment_map): New function.
4415         (Layout::attach_allocated_section_to_segment): Make unique segment for
4416         output sections marked so.
4417         (Layout::segment_precedes): Check for unique segments when sorting.
4418         * layout.h (Layout::Unique_segment_info): New struct.
4419         (Layout::Section_segment_map): New typedef.
4420         (Layout::insert_section_segment_map): New function.
4421         (Layout::get_output_section_flags): New function.
4422         (Layout::is_unique_segment_for_sections_specified): New function.
4423         (Layout::set_unique_segment_for_sections_specified): New function.
4424         (Layout::unique_segment_for_sections_specified_): New member.
4425         (Layout::section_segment_map_): New member.
4426         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
4427         Rename is_gc_pass_one to is_pass_one.
4428         Rename is_gc_pass_two to is_pass_two.
4429         Rename is_gc_or_icf to is_two_pass.
4430         Check for which pass based on whether symbols data is present.
4431         Make it two pass when unique segments for sections is desired.
4432         * output.cc (Output_section::Output_section): Initialize new
4433         members.
4434         * output.h (Output_section::is_unique_segment): New function.
4435         (Output_section::set_is_unique_segment): New function.
4436         (Output_section::is_unique_segment_): New member.
4437         (Output_section::extra_segment_flags): New function.
4438         (Output_section::set_extra_segment_flags): New function.
4439         (Output_section::extra_segment_flags_): New member.
4440         (Output_section::segment_alignment): New function.
4441         (Output_section::set_segment_alignment): New function.
4442         (Output_section::segment_alignment_): New member.
4443         (Output_segment::Output_segment): Initialize is_unique_segment_.
4444         (Output_segment::is_unique_segment): New function.
4445         (Output_segment::set_is_unique_segment): New function.
4446         (Output_segment::is_unique_segment_): New member.
4447         * plugin.cc (allow_unique_segment_for_sections): New function.
4448         (unique_segment_for_sections): New function.
4449         (Plugin::load): Add new functions to transfer vector.
4450         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
4451         * Makefile.in: Regenerate.
4452         * testsuite/plugin_final_layout.sh: Check if unique segment
4453         functionality works.
4454         * testsuite/plugin_section_order.c (onload): Check if new interfaces
4455         are available.
4456         (allow_unique_segment_for_sections): New global.
4457         (unique_segment_for_sections): New global.
4458         (claim_file_hook): Call allow_unique_segment_for_sections.
4459         (all_symbols_read_hook): Call unique_segment_for_sections.
4460
4461 2012-08-22  Cary Coutant  <ccoutant@google.com>
4462
4463         * layout.cc (Layout::include_section): Don't assert on GROUP
4464         sections with --emit-relocs.
4465
4466 2012-08-21  Cary Coutant  <ccoutant@google.com>
4467
4468         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
4469         if --export-dynamic-symbol names an undef symbol.
4470
4471 2012-08-18  Alan Modra  <amodra@gmail.com>
4472
4473         * powerpc.cc: Formatting and white space.
4474         (Powerpc_relobj): Rename got2_section_ to special_.
4475         Add opd_ent_shndx_ and opd_ent_off_ vectors.
4476         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
4477         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
4478         (Target_powerpc): Add Address typedef and invalid_address.  Use
4479         throughout.
4480         (Target_powerpc::is_branch_reloc): New function.
4481         (Powerpc_relocate_functions): Add Address typedef, use throughout.
4482         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
4483         for dst_mask, value and addend.
4484         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
4485         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
4486         (Output_data_glink::do_write): Correct toc base.  Don't try to use
4487         uint16_t for 24-bit offset.  Use get_output_section_offset and
4488         check return.
4489         (Target_powerpc::Scan::local): Handle more relocs.
4490         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
4491         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
4492         Plug in toc restoring insn after plt calls.  Translate branches
4493         to function descriptor symbols to corresponding entry point.
4494         (Target_powerpc::relocate_for_relocatable): Check return from
4495         get_output_section_offset.
4496         * symtab.h: Comment typo.
4497
4498 2012-08-14  Ian Lance Taylor  <iant@google.com>
4499
4500         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
4501         unsupported_relocal_local to call unsupported_reloc_global.
4502
4503 2012-08-14  Nick Clifton  <nickc@redhat.com>
4504
4505         PR ld/14265
4506         * script-sections.cc (Sections_element::output_section_name): Add
4507         keep return parameter.
4508         (Output_section_element::match_name): Add keep return parameter.
4509         Return the value of the keep_ member.
4510         * script-sections.h (class Output_section): Update
4511         output_section_name prototype.
4512         * layout.cc (Layout::keep_input_section): New public member
4513         function.
4514         (Layout::choose_output_section): Pass keep parameter to
4515         output_section_name.
4516         * layout.h (class Layout): Add keep_input_section.
4517         * object.cc (Sized_relobj_file::do_layout): Check for kept input
4518         sections.
4519         * testsuite/Makefile.am: Add a test.
4520         * testsuite/Makefile.in: Regenerate.
4521         * testsuite/pr14265.c: Source file for the test.
4522         * testsuite/pr14265.t: Linker script for the test.
4523         * testsuite/pr14265.sh: Shell script for the test.
4524
4525 2012-08-14  Alan Modra  <amodra@gmail.com>
4526
4527         * target.h (Target::output_section_name): New function.
4528         (Target::do_output_section_name): New function.
4529         * layout.cc (Layout::choose_output_section): Call the above.
4530         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
4531
4532 2012-08-14  Alan Modra  <amodra@gmail.com>
4533
4534         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
4535         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
4536         for replace_constant call.
4537         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
4538         (Output_data_glink::do_print_to_mapfile): New function.
4539         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
4540         (Target_powerpc::Relocate::relocate): Likewise.
4541
4542 2012-08-14  Alan Modra  <amodra@gmail.com>
4543
4544         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
4545         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
4546         (Output_data_glink::add_entry,find_entry): Remove shndx param.
4547         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
4548         all references to shndx_.  Handle special case for R_PPC_PLTREL24
4549         here.
4550         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
4551         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
4552         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
4553         here.
4554         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
4555         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
4556
4557 2012-08-12  Alan Modra  <amodra@gmail.com>
4558
4559         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
4560         (glink insn constants): Use uint32_t.
4561         (Output_data_glink::add_entry): Use insert, not [] operator.
4562
4563 2012-08-11  Alan Modra  <amodra@gmail.com>
4564
4565         * object.h (Sized_relobj_file::find_shdr): New function.
4566         (Sized_relobj_file::find_special_sections): New function.
4567         * object.cc (Sized_relobj_file::find_shdr): New function.
4568         (Sized_relobj_file::find_eh_frame): Use find_shdr.
4569         (Sized_relobj_file::find_special_sections): New function, split out..
4570         (Sized_relobj_file::do_read_symbols): ..from here.
4571         * output.h (Output_data_got::replace_constant): New function.
4572         (Output_data_got::num_entries): New function.
4573         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
4574         (Output_data_got::got_offset): Protected rather than private.
4575         (Output_data_got::replace_got_entry): New function.
4576         * output.cc (Output_data_got::replace_got_entry): New function.
4577         * powerpc.cc (class Powerpc_relobj): New.
4578         (class Powerpc_relocate_functions): Delete all psymval variants or
4579         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
4580         Implement _ha functions using corresponding _hi function.
4581         (Powerpc_relobj::find_special_sections): New function.
4582         (Target_powerpc::do_make_elf_object): New function.
4583         (class Output_data_got_powerpc): New.
4584         (class Output_data_glink): New.
4585         (class Powerpc_scan_relocatable_reloc): New.
4586         Many more changes througout file.
4587
4588 2012-08-09  Nick Clifton  <nickc@redhat.com>
4589
4590         * po/vi.po: Updated Vietnamese translation.
4591
4592 2012-08-07  Ian Lance Taylor  <iant@google.com>
4593
4594         * layout.cc (Layout::add_target_dynamic_tags): If
4595         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
4596         plt_rel.
4597
4598 2012-07-30  Nick Clifton  <nickc@redhat.com>
4599
4600         * po/gold.pot: Updated template.
4601         * po/es.po: Updated Spanish translation.
4602
4603 2012-07-18  Cary Coutant  <ccoutant@google.com>
4604
4605         PR gold/14344
4606         * configure.ac: Add check for -gpubnames support.
4607         * configure: Regenerate.
4608         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
4609         support; force -gno-pubnames.
4610         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
4611         support.
4612         (gdb_index_test_4): New test.
4613         * testsuite/Makefile.in: Regenerate.
4614         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
4615         * testsuite/gdb_index_test_2.sh: Likewise.
4616         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
4617         * testsuite/gdb_index_test_4.sh: New script.
4618         * testsuite/gdb_index_test_comm.sh: New script with common code;
4619         don't look for space after colon.
4620
4621 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
4622
4623         * gold.cc (queue_middle_tasks): Update function order only after
4624         deferred objects due to plugins are processed.
4625
4626 2012-07-11  Ian Lance Taylor  <iant@google.com>
4627
4628         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
4629         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
4630         (Target_arm::scan_reloc_for_stub): Likewise.
4631         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
4632         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
4633         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
4634         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
4635         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
4636
4637 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
4638             Ian Lance Taylor  <iant@google.com>
4639
4640         PR gold/14309
4641         * configure.ac: Test whether std::tr1::hash<off_t> works.
4642         * gold.h: Add a specialization for std::tr1::hash<off_t> if
4643         needed.
4644         * output.h (class Output_fill): Add virtual destructor.
4645         * configure, config.in: Rebuild.
4646
4647 2012-06-22  Roland McGrath  <mcgrathr@google.com>
4648
4649         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
4650
4651 2012-06-12  Rafael Ăvila de EspĂ­ndola <respindola@mozilla.com>
4652
4653         * plugin.cc (Plugin::load): Handle position independent executables.
4654
4655 2012-06-06  Cary Coutant  <ccoutant@google.com>
4656
4657         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
4658         add .debug_macro.
4659         (lines_only_debug_sections): Likewise.
4660         (gdb_fast_lookup_sections): New static array.
4661         (is_gdb_debug_section): Rename formal parameter.
4662         (is_lines_only_debug_section): Likewise.
4663         (is_gdb_fast_lookup_section): New function.
4664         (Layout::include_section): Check for ".zdebug_" prefix; pass
4665         section name suffix to is_gdb_debug_section, et al.; check for
4666         fast-lookup sections when building .gdb_index.
4667         * options.h (--strip-debug-gdb): Update GDB version number.
4668
4669 2012-06-06  Cary Coutant  <ccoutant@google.com>
4670
4671         * configure.ac: Add check for fallocate.
4672         * configure: Regenerate.
4673         * config.in: Regenerate.
4674
4675         * options.h (class General_options): Add --mmap-output-file and
4676         --posix-fallocate options.
4677         * output.cc: (posix_fallocate): Remove; replace with...
4678         (gold_fallocate): New function.
4679         (Output_file::map_no_anonymous): Call gold_fallocate.
4680         (Output_file::map): Check --mmap-output-file option.
4681
4682 2012-06-05  Jing Yu  <jingyu@google.com>
4683
4684         * gold.h (textdomain): Add do {} to empty while(0).
4685         (bindtextdomain): Likewise.
4686
4687 2012-06-04  Cary Coutant  <ccoutant@google.com>
4688
4689         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
4690         has_dynsym_index.
4691
4692 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
4693
4694         * symtab.cc (Symbol_table::define_special_symbol):
4695         Initialize *poldsym to prevent uninitialized variable errors.
4696
4697 2012-05-23  Cary Coutant  <ccoutant@google.com>
4698
4699         * layout.cc (Layout::section_name_mapping): Add rules to handle
4700         exact match on .data.rel.ro.local or .data.rel.ro.
4701         (Layout::output_section_name): Check for exact matches.
4702
4703 2012-05-23  Cary Coutant  <ccoutant@google.com>
4704
4705         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
4706         more carefully.
4707
4708 2012-05-22  Cary Coutant  <ccoutant@google.com>
4709
4710         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
4711         object before exporting symbol.
4712
4713 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
4714
4715         * testsuite/tls_test.cc: Include "config.h" first.
4716         * testsuite/tls_test_c.c: Likewise.
4717
4718 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
4719             Nick Clifton  <nickc@redhat.com>
4720
4721         PR 14072
4722         * configure.in: Add check that sysdep.h has been included before
4723         any system header files.
4724         * configure: Regenerate.
4725         * config.in: Regenerate.
4726
4727 2012-05-14  Cary Coutant  <ccoutant@google.com>
4728
4729         * layout.cc (Layout::make_output_section): Mark .tdata section
4730         as RELRO.
4731         * testsuite/relro_test.cc: Add a TLS variable.
4732
4733 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
4734
4735         PR gold/14091
4736         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
4737         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
4738         R_X86_64_64.
4739
4740 2012-05-08  Cary Coutant  <ccoutant@google.com>
4741
4742         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
4743         (lines_only_debug_sections): Likewise.
4744
4745 2012-05-02  Roland McGrath  <mcgrathr@google.com>
4746
4747         * nacl.cc: New file.
4748         * nacl.h: New file.
4749         * Makefile.am (CCFILES, HFILES): Add them.
4750         * Makefile.in: Regenerate.
4751         * i386.cc (Output_data_plt_i386_nacl): New class.
4752         (Output_data_plt_i386_nacl_exec): New class.
4753         (Output_data_plt_i386_nacl_dyn): New class.
4754         (Target_i386_nacl): New class.
4755         (Target_selector_i386_nacl): New class.
4756         (target_selector_i386): Use it instead of Target_selector_i386.
4757         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
4758         (Target_x86_64_nacl): New class.
4759         (Target_selector_x86_64_nacl): New class.
4760         (target_selector_x86_64, target_selector_x32): Use it instead of
4761         Target_selector_x86_64.
4762         * arm.cc (Output_data_plt_arm_nacl): New class.
4763         (Target_arm_nacl): New class.
4764         (Target_selector_arm_nacl): New class.
4765         (target_selector_arm, target_selector_armbe): Use it instead of
4766         Target_selector_arm.
4767
4768         * target-select.cc (select_target): Take new Input_file* and off_t
4769         arguments, pass them on to recognize method of selector.
4770         * object.cc (make_elf_sized_object): Update caller.
4771         * parameters.cc (parameters_force_valid_target): Likewise.
4772         * incremental.cc (make_sized_incremental_binary): Likewise.
4773         * target-select.h: Update decl.
4774         (Target_selector::recognize): Take new Input_file* argument,
4775         pass it on to do_recognize.
4776         (Target_selector::do_recognize): Take new Input_file* argument.
4777         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
4778         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
4779         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
4780         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
4781
4782         * target.h (Target::Target_info): New members isolate_execinstr
4783         and rosegment_gap.
4784         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
4785         * arm.cc (Target_arm::arm_info): Update initializer.
4786         * i386.cc (Target_i386::i386_info): Likewise.
4787         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
4788         * sparc.cc (Target_sparc::sparc_info): Likewise.
4789         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4790         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
4791         * layout.cc (Layout::attach_allocated_section_to_segment):
4792         Take new const Target* argument.  If target->isolate_execinstr(), act
4793         like --rosegment.
4794         (Layout::find_first_load_seg): Take new const Target* argument;
4795         if target->isolate_execinstr(), reject PF_X segments.
4796         (Layout::relaxation_loop_body): Update caller.
4797         (Layout::set_segment_offsets): If target->isolate_execinstr(),
4798         reset file offset to zero when we hit LOAD_SEG, and then do a second
4799         loop over the segments before LOAD_SEG to reassign offsets after
4800         addresses have been determined.  Handle target->rosegment_gap().
4801         (Layout::attach_section_to_segment): Take new const Target* argument;
4802         pass it to attach_allocated_section_to_segment.
4803         (Layout::make_output_section): Update caller.
4804         (Layout::attach_sections_to_segments): Take new const Target* argument;
4805         pass it to attach_section_to_segment.
4806         * gold.cc (queue_middle_tasks): Update caller.
4807         * layout.h (Layout): Update method decls with new arguments.
4808
4809         * arm.cc (Target_arm::Target_arm): Take optional argument for the
4810         Target_info pointer to use.
4811         (Target_arm::do_make_data_plt): New virtual method.
4812         (Target_arm::make_data_plt): New method that calls it.
4813         (Target_arm::make_plt_entry): Use it.
4814         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
4815         for the section alignment.
4816         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
4817         method.
4818         (Output_data_plt_arm::first_plt_entry_offset): Call it.
4819         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
4820         method.
4821         (Output_data_plt_arm::get_plt_entry_size): Call it.
4822         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
4823         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
4824         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
4825         method.
4826         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
4827         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
4828         method instead of sizeof(plt_entry).
4829         (Output_data_plt_arm::add_entry): Likewise.
4830         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
4831         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
4832         than static method.
4833         (Target_arm::plt_entry_size): Likewise.
4834         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
4835         Move to ...
4836         (Output_data_plt_arm_standard): ... here, new class.
4837         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
4838         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
4839         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
4840
4841         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4842         Take additional argument for the PLT entry size.
4843         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
4844         Use get_plt_entry_size method rather than plt_entry_size variable.
4845         (Output_data_plt_x86_64::reserve_slot): Likewise.
4846         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
4847         (Output_data_plt_x86_64::add_entry): Likewise.
4848         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
4849         (Output_data_plt_x86_64::address_for_global): Likewise.
4850         (Output_data_plt_x86_64::address_for_local): Likewise.
4851         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4852         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
4853         Make method non-static.
4854         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
4855         method.
4856         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
4857         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
4858         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
4859         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
4860         virtual method.
4861         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
4862         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
4863         virtual method.
4864         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
4865         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
4866         virtual method.
4867         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
4868         (Output_data_plt_x86_64::plt_entry_size)
4869         (Output_data_plt_x86_64::first_plt_entry)
4870         (Output_data_plt_x86_64::plt_entry)
4871         (Output_data_plt_x86_64::tlsdesc_plt_entry)
4872         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
4873         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
4874         (Output_data_plt_x86_64_standard): ... here, new class.
4875         (Target_x86_64::Target_x86_64): Take optional argument for the
4876         Target_info pointer to use.
4877         (Target_x86_64::do_make_data_plt): New virtual method.
4878         (Target_x86_64::make_data_plt): New method to call it.
4879         (Target_x86_64::init_got_plt_for_update): Use that.
4880         Call this->plt_->add_eh_frame method here.
4881         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
4882         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
4883         rather than static method.
4884         (Target_x86_64::plt_entry_size): Likewise.
4885         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
4886         rather than plt_entry_size variable.  Move guts of PLT filling to...
4887         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
4888         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
4889         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
4890
4891         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
4892         additional argument for the section alignment.
4893         Don't do add_eh_frame_for_plt here.
4894         (Output_data_plt_i386::first_plt_entry_offset): Make the method
4895         non-static.  Use get_plt_entry_size method rather than plt_entry_size
4896         variable.
4897         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
4898         method.
4899         (Output_data_plt_i386::get_plt_entry_size): Call it.
4900         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
4901         (Output_data_plt_i386::add_eh_frame): New method to call it.
4902         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
4903         method.
4904         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
4905         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
4906         method.
4907         (Output_data_plt_i386::fill_plt_entry): New method to call it.
4908         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
4909         method instead of plt_entry_size.
4910         (Output_data_plt_i386::plt_entry_size)
4911         (Output_data_plt_i386::plt_eh_frame_fde_size)
4912         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
4913         (Output_data_plt_i386_standard): ... here, new class.
4914         (Output_data_plt_i386_exec): New class.
4915         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
4916         (Output_data_plt_i386_exec::first_plt_entry): ... here.
4917         (Output_data_plt_i386::exec_plt_entry): Move to ...
4918         (Output_data_plt_i386_exec::plt_entry): ... here.
4919         (Output_data_plt_i386_dyn): New class.
4920         (Output_data_plt_i386::first_plt_entry): Move to ...
4921         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
4922         (Output_data_plt_i386::dyn_plt_entry): Move to ...
4923         (Output_data_plt_i386_dyn::plt_entry): ... here.
4924         (Target_i386::Target_i386): Take optional argument for the Target_info
4925         pointer to use.
4926         (Target_i386::do_make_data_plt): New virtual method.
4927         (Target_i386::make_data_plt): New method to call it.
4928         (Target_i386::make_plt_section): Use that.
4929         Call this->plt_->add_eh_frame method here.
4930         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
4931         rather than plt_entry_size variable.
4932         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
4933         (Output_data_plt_i386::address_for_local): Likewise.
4934         (Output_data_plt_i386::do_write): Likewise.
4935         Move guts of PLT filling to...
4936         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
4937         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
4938         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
4939         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
4940
4941 2012-05-01  Cary Coutant  <ccoutant@google.com>
4942
4943         * dwarf_reader.cc (Dwarf_die::read_attributes)
4944         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
4945         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
4946         * reduced_debug_output.cc
4947         (Output_reduced_debug_info_section::get_die_end): Remove
4948         DW_FORM_GNU_ref_index.  Add default case.
4949
4950 2012-04-26  Mark Wielaard  <mjw@redhat.com>
4951
4952         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
4953         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
4954         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
4955         DW_AT_high_pc as offset from DW_AT_low_pc.
4956
4957         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
4958         * testsuite/Makefile.in: Regenerate.
4959         * testsuite/gdb_index_test_3.c: New test source file.
4960         * testsuite/gdb_index_test_3.sh: New test source file.
4961
4962 2012-04-25  Ian Lance Taylor  <iant@google.com>
4963
4964         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
4965         pointer.
4966         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
4967         as a class, not a struct.
4968         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
4969         (Target_arm::apply_cortex_a8_workaround): Likewise.
4970         * gc.h: Declare Reloc_types as a struct, not a class.
4971         * object.h: Declare Symbols_data as a struct.
4972         * reloc.h: Declare Read_relocs_data as a struct.
4973         * target.h: Declare Relocate_info as a struct.
4974
4975 2012-04-24  David S. Miller  <davem@davemloft.net>
4976
4977         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
4978         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
4979         and R_SPARC_WPLT30.
4980
4981 2012-04-24  Cary Coutant  <ccoutant@google.com>
4982
4983         * incremental-dump.cc (find_input_containing_global): Replace
4984         magic number with symbolic constant.
4985         (dump_incremental_inputs): Update version number.
4986         * incremental.cc (Output_section_incremental_inputs): Update version
4987         number; import symbolic constants from Incremental_inputs_reader.
4988         (Incremental_inputs::create_data_sections): Align relocations
4989         section correctly for 64-bit targets.
4990         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
4991         constants; add padding.
4992         (Output_section_incremental_inputs::write_header): Add assert for
4993         header_size.
4994         (Output_section_incremental_inputs::write_input_files): Add assert
4995         for input_entry_size.
4996         (Output_section_incremental_inputs::write_info_blocks): Add padding;
4997         add assert for object_info_size, input_section_entry_size,
4998         global_sym_entry_size.
4999         * incremental.h (Incremental_inputs_reader): Add symbolic constants
5000         for data structure sizes; use them.
5001         (Incremental_input_entry_reader): Import symbolic constants from
5002         Incremental_inputs_reader; use them.
5003
5004 2012-04-23  David S. Miller  <davem@davemloft.net>
5005
5006         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
5007         and elf_flags_set_.
5008         (Target_sparc::Target_sparc): Initialize new fields.
5009         (Target_sparc::do_make_elf_object): New function.
5010         (Target_sparc::do_adjust_elf_header): New function.
5011
5012 2012-04-23  Cary Coutant  <ccoutant@google.com>
5013
5014         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
5015         CU range table of gdb index.
5016
5017 2012-04-20  David S. Miller  <davem@davemloft.net>
5018
5019         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
5020         instead of false.
5021
5022 2012-04-16  David S. Miller  <davem@davemloft.net>
5023
5024         * sparc.cc (Target_sparc::got_address): New function.
5025         (Sparc_relocate_functions::gdop_hix22): New function.
5026         (Sparc_relocate_functions::gdop_lox10): New function.
5027         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
5028         relocs.
5029         (Target_sparc::Scan::local): Likewise if the global symbol is not
5030         preemptible and is not IFUNC.
5031         (Target_sparc::Relocate::relocate): Perform GOTDATA code
5032         transformations for local and non-preemptible non-IFUNC global
5033         symbols.
5034
5035         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
5036         writing out 64-bit part of ranges.
5037
5038         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
5039         -fpic and -fpie respectively.
5040         * Makefile.in: Regenerate.
5041
5042         * sparc.cc (class Target_sparc): Add rela_ifunc_.
5043         (Target_sparc::Target_sparc): Initialize new field.
5044         (Target_sparc::do_plt_section_for_global): New function.
5045         (Target_sparc::do_plt_section_for_local): New function.
5046         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
5047         (Target_sparc::make_plt_section): New function, broken out of
5048         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
5049         (Target_sparc::make_plt_entry): Call make_plt_section.
5050         (Target_sparc::make_local_ifunc_plt_entry): New function.
5051         (Target_sparc::rela_ifunc_section): New function.
5052         (Target_sparc::plt_section): Remove const.
5053         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
5054         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
5055         and ifunc_count_ fields.
5056         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
5057         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
5058         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
5059         (Output_data_plt_sparc::rela_ifunc): New function.
5060         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
5061         (Output_data_plt_sparc::has_ifunc_section): New function.
5062         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
5063         (Output_data_plt_sparc::address_for_global): New function.
5064         (Output_data_plt_sparc::address_for_local): New function.
5065         (Output_data_plt_sparc::plt_index_to_offset): New function.
5066         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
5067         and entry_count.
5068         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
5069         entry_count.
5070         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
5071         R_SPARC_JMP_IREL to switch.
5072         (Target_sparc::Scan::check_non_pic): Likewise.
5073         (Target_sparc::Scan::local): Handle IFUNC symbols.
5074         (Target_sparc::Scan::local): Likewise.
5075         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
5076         and plt_address_for_local.
5077         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
5078         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
5079
5080         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
5081         (class Output_data_reloc): Adjust calls to Output_reloc_type.
5082         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
5083         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
5084         global relocs too.
5085         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
5086         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
5087         calls.
5088         * sparc.cc (Target_sparc::Scan::global): Likewise.
5089         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5090
5091 2012-04-16  Cary Coutant  <ccoutant@google.com>
5092
5093         * archive.cc (Library_base::should_include_member): Check for
5094         --export-dynamic-symbol.
5095         * options.h (class General_options): Add --export-dynamic-symbol.
5096         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
5097         --export-dynamic-symbol.
5098         (Symbol_table::gc_mark_undef_symbols): Likewise.
5099         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
5100
5101 2012-04-12  David S. Miller  <davem@davemloft.net>
5102
5103         * sparc.cc (Reloc::wdisp10): New relocation method.
5104         (Reloc::h34): Likewise.
5105         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
5106         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
5107         R_SPARC_WDISP10.
5108         (Target_sparc::Scan::local): Likewise.
5109         (Target_sparc::Scan::global): Likewise.
5110         (Target_sparc::Relocate::relocate): Likewise.
5111
5112 2012-04-09  Cary Coutant  <ccoutant@google.com>
5113
5114         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
5115         low_pc == 0.
5116
5117 2012-04-06  Ian Lance Taylor  <iant@google.com>
5118
5119         * timer.cc: #include <unistd.h>.
5120
5121 2012-04-06  Roland McGrath  <mcgrathr@google.com>
5122
5123         * configure.in (AC_CHECK_HEADERS): Add locale.h.
5124         * config.in: Regenerate.
5125         * configure: Regenerate.
5126
5127 2012-04-05  Nick Clifton  <nickc@redhat.com>
5128
5129         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
5130         (AM_LC_MESSAGES): Add.
5131         * aclocal.m4: Regenerate.
5132         * config.in: Regenerate.
5133         * configure: Regenerate.
5134
5135 2012-03-21  Cary Coutant  <ccoutant@google.com>
5136
5137         * Makefile.am: Add gdb-index.cc, gdb-index.h.
5138         * Makefile.in: Regenerate.
5139         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
5140         (Sized_elf_reloc_mapper::symbol_section): New function.
5141         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
5142         (make_elf_reloc_mapper): New function.
5143         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
5144         (Dwarf_abbrev_table::do_read_abbrevs): New function.
5145         (Dwarf_abbrev_table::do_get_abbrev): New function.
5146         (Dwarf_ranges_table::read_ranges_table): New function.
5147         (Dwarf_ranges_table::read_range_list): New function.
5148         (Dwarf_pubnames_table::read_section): New function.
5149         (Dwarf_pubnames_table::read_header): New function.
5150         (Dwarf_pubnames_table::next_name): New function.
5151         (Dwarf_die::Dwarf_die): New function.
5152         (Dwarf_die::read_attributes): New function.
5153         (Dwarf_die::skip_attributes): New function.
5154         (Dwarf_die::set_name): New function.
5155         (Dwarf_die::set_linkage_name): New function.
5156         (Dwarf_die::attribute): New function.
5157         (Dwarf_die::string_attribute): New function.
5158         (Dwarf_die::int_attribute): New function.
5159         (Dwarf_die::uint_attribute): New function.
5160         (Dwarf_die::ref_attribute): New function.
5161         (Dwarf_die::child_offset): New function.
5162         (Dwarf_die::sibling_offset): New function.
5163         (Dwarf_info_reader::check_buffer): New function.
5164         (Dwarf_info_reader::parse): New function.
5165         (Dwarf_info_reader::do_parse): New function.
5166         (Dwarf_info_reader::do_read_string_table): New function.
5167         (Dwarf_info_reader::lookup_reloc): New function.
5168         (Dwarf_info_reader::get_string): New function.
5169         (Dwarf_info_reader::visit_compilation_unit): New function.
5170         (Dwarf_info_reader::visit_type_unit): New function.
5171         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
5172         Sized_elf_reloc_mapper.
5173         (Sized_dwarf_line_info::symbol_section): Remove function.
5174         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
5175         (Sized_dwarf_line_info::read_line_mappings): Remove object
5176         parameter, adjust callers.
5177         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
5178         * dwarf_reader.h: Include <sys/types.h>.
5179         (class Track_relocs): Remove forward declaration.
5180         (class Elf_reloc_mapper): New class.
5181         (class Sized_elf_reloc_mapper): New class.
5182         (class Dwarf_abbrev_table): New class.
5183         (class Dwarf_range_list): New class.
5184         (class Dwarf_ranges_table): New class.
5185         (class Dwarf_pubnames_table): New class.
5186         (class Dwarf_die): New class.
5187         (class Dwarf_info_reader): New class.
5188         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
5189         (Sized_dwarf_line_info::symbol_section): Remove member function.
5190         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
5191         base class.
5192         * gdb-index.cc: New source file.
5193         * gdb-index.h: New source file.
5194         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
5195         and .debug_types sections, call Layout::add_to_gdb_index.
5196         (Sized_relobj_incr::do_section_name): Implement.
5197         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
5198         return type; Implement.
5199         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
5200         return type.
5201         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
5202         parameter list and return type.
5203         (Sized_incr_dynobj::do_section_contents): Likewise.
5204         * layout.cc: Include gdb-index.h.
5205         (Layout::Layout): Initialize gdb_index_data_.
5206         (Layout::init_fixed_output_section): Check for .gdb_index section.
5207         (Layout::add_to_gdb_index): New function. Instantiate.
5208         * layout.h: Add forward declaration for class Gdb_index.
5209         (Layout::add_to_gdb_index): New member function.
5210         (Layout::gdb_index_data_): New data member.
5211         * main.cc: Include gdb-index.h.
5212         (main): Print statistics for gdb index.
5213         * object.cc (Object::section_contents): Move code into
5214         do_section_contents.
5215         (need_decompressed_section): Check for sections needed when building
5216         gdb index.
5217         (build_compressed_section_map): Likewise.
5218         (Sized_relobj_file::do_read_symbols): Need local symbols when building
5219         gdb index.
5220         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
5221         sections; call Layout::add_to_gdb_index.
5222         (Sized_relobj_file::do_decompressed_section_contents): Call
5223         do_section_contents directly.
5224         * object.h (Object::do_section_contents): Adjust parameter list and
5225         return type.
5226         (Object::do_decompressed_section_contents): Call do_section_contents
5227         directly.
5228         (Sized_relobj_file::do_section_contents): Adjust parameter list and
5229         return type.
5230         * options.h (class General_options): Add --gdb-index option.
5231         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
5232         list and return type.
5233         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
5234         * reloc.h (Track_relocs::checkpoint): New function.
5235         (Track_relocs::reset): New function.
5236
5237         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
5238         New test cases.
5239         * testsuite/Makefile.in: Regenerate.
5240         * testsuite/gdb_index_test.cc: New test source file.
5241         * testsuite/gdb_index_test_1.sh: New test source file.
5242         * testsuite/gdb_index_test_2.sh: New test source file.
5243
5244 2012-03-19  Doug Kwan  <dougkwan@google.com>
5245
5246         * arm.cc (Target_arm::do_define_standard_symbols): New method.
5247         (Target_arm::do_finalize_sections): Remove code which defines
5248         __exidx_start and __exidx_end.  Make symbol table parameter
5249         anonymous as it is not used.
5250         * gold.cc (queue_middle_tasks): Call target hook to define any
5251         target-specific symbols.
5252         * target.h (Target::define_standard_symbols): New method.
5253         (Target::do_define_standard_symbols): Same.
5254         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
5255         * testsuite/Makefile.in: Regenerate.
5256         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
5257         and __exidx_end.
5258         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
5259         relocations are generated for __exidx_start and __exidx_end.
5260
5261 2012-03-16  Doug Kwan  <dougkwan@google.com>
5262
5263         * testsuite/Makefile.am: Disable test initpri3b.
5264         * testsuite/Makefile.in: Regenerate.
5265
5266 2012-03-15  Doug Kwan  <dougkwan@google.com>
5267
5268         * arm.cc (Target_arm::got_section): Make .got section read-only
5269         if -z now is given.
5270
5271 2012-03-15  Ian Lance Taylor  <iant@google.com>
5272
5273         PR gold/13850
5274         * layout.cc (Layout::make_output_section): Correctly mark
5275         SHT_INIT_ARRAY, et. al., as relro.
5276
5277 2012-03-14  Doug Kwan  <dougkwan@google.com>
5278
5279         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
5280         dynamic relocations for protected symbols in shared objects.
5281
5282 2012-03-13  Ian Lance Taylor  <iant@google.com>
5283
5284         * resolve.cc (Symbol_table::resolve): When merging common symbols,
5285         keep the larger alignment.
5286
5287 2012-03-12  Cary Coutant  <ccoutant@google.com>
5288
5289         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
5290         handling of DW_LNE_define_file.
5291
5292 2012-03-12  Cary Coutant  <ccoutant@google.com>
5293
5294         * reduced_debug_output.cc
5295         (Output_reduced_debug_info_section::get_die_end): Add new FORM
5296         codes to switch.
5297
5298 2012-02-29  Cary Coutant  <ccoutant@google.com>
5299
5300         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
5301
5302 2012-02-29  Cary Coutant  <ccoutant@google.com>
5303
5304         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5305         Call Object::decompressed_section_contents.
5306         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
5307         New dtor.
5308         (Sized_dwarf_line_info::buffer_start_): New data member.
5309         * merge.cc (Output_merge_data::do_add_input_section): Call
5310         Object::decompressed_section_contents.
5311         (Output_merge_string::do_add_input_section): Likewise.
5312         * object.cc (need_decompressed_section): New function.
5313         (build_compressed_section_map): Decompress sections needed later.
5314         (Sized_relobj_file::do_decompressed_section_contents): New function.
5315         (Sized_relobj_file::do_discard_decompressed_sections): New function.
5316         * object.h (Object::decompressed_section_contents): New function.
5317         (Object::discard_decompressed_sections): New function.
5318         (Object::do_decompressed_section_contents): New function.
5319         (Object::do_discard_decompressed_sections): New function.
5320         (Compressed_section_info): New type.
5321         (Compressed_section_map): Include decompressed section contents.
5322         (Sized_relobj_file::do_decompressed_section_contents): New function.
5323         (Sized_relobj_file::do_discard_decompressed_sections): New function.
5324
5325 2012-02-16  Cary Coutant  <ccoutant@google.com>
5326
5327         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
5328         * testsuite/Makefile.in: Regenerate.
5329
5330 2012-02-14  Cary Coutant  <ccoutant@google.com>
5331
5332         * options.cc (General_options::finalize): Disallow -pie and -static.
5333
5334 2012-02-03  Doug Kwan  <dougkwan@google.com>
5335
5336         * arm.cc (Arm_relocate_functions::abs8,
5337         Arm_relocate_functions::abs16): Use
5338         Bits::has_signed_unsigned_overflow32.
5339         (Arm_relocate_functions::thm_abs8): Correct range of
5340         overflow check.
5341         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
5342         in assertions.
5343
5344 2012-02-02  Doug Kwan  <dougkwan@google.com>
5345
5346         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
5347         position independent outputs, not just shared objects.
5348
5349 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
5350
5351         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
5352         * configure: Regenerated.
5353
5354 2012-01-27  Ian Lance Taylor  <iant@google.com>
5355
5356         * reloc.h (Bits): New class with static functions, copied from
5357         namespace utils in arm.cc.
5358         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
5359         instead.
5360
5361 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5362
5363         * incremental.cc (write_info_blocks): Correct relocation offset.
5364
5365 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5366
5367         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
5368         (Relocate::tls_gd_to_le): Likewise.
5369
5370 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5371
5372         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
5373
5374 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5375
5376         * configure.ac: Check if -mcmodel=medium works.
5377         * configure: Regenerated.
5378
5379 2012-01-24  Cary Coutant  <ccoutant@google.com>
5380
5381         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
5382         definition and ...
5383         (read_unsigned_LEB_128_x): ... this new function.
5384         (read_signed_LEB_128): Replaced with inline definition and ...
5385         (read_signed_LEB_128_x): ... this new function.
5386         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
5387         (read_unsigned_LEB_128): Add inline definition.
5388         (read_signed_LEB_128_x): New function.
5389         (read_signed_LEB_128): Add inline definition.
5390         * testsuite/Makefile.am (leb128_unittest): New unit test.
5391         * testsuite/Makefile.in: Regenerate.
5392         * testsuite/leb128_unittest.cc: New unit test.
5393
5394 2012-01-23  Ian Lance Taylor  <iant@google.com>
5395
5396         PR gold/13617
5397         * i386.cc (Target_i386::do_code_fill): When using a jmp
5398         instruction, pad with nop instructions.
5399         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5400
5401 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
5402
5403         * x86_64.cc (gc_process_relocs): Add typename on types used in
5404         template.
5405         (scan_relocs): Likewise.
5406         (relocate_section): Likewise.
5407         (apply_relocation): Likewise.
5408
5409 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
5410
5411         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
5412         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
5413         under x32.
5414
5415 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
5416
5417         * x86_64.cc: Initial support for x32.
5418
5419 2012-01-03  Cary Coutant  <ccoutant@google.com>
5420
5421         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
5422         Use abstract base class for GOT.
5423         * gold/output.h (class Output_data_got_base): New abstract base class.
5424         (class Output_data_got): Derive from new base class, adjust ctors.
5425         (Output_data_got::reserve_slot): Make virtual; rename to
5426         do_reserve_slot; Adjust callers.
5427         * gold/target.h (Sized_target::init_got_plt_for_update): Return
5428         pointer to abstract base class.
5429         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
5430
5431 2011-12-18  Ian Lance Taylor  <iant@google.com>
5432
5433         * object.h (Relobj::local_symbol_value): New function.
5434         (Relobj::local_plt_offset): New function.
5435         (Relobj::local_has_got_offset): New function.
5436         (Relobj::local_got_offset): New function.
5437         (Relobj::set_local_got_offset): New function.
5438         (Relobj::do_local_symbol_value): New pure virtual function.
5439         (Relobj::do_local_plt_offset): Likewise.
5440         (Relobj::do_local_has_got_offset): Likewise.
5441         (Relobj::do_local_got_offset): Likewise.
5442         (Relobj::do_set_local_got_offset): Likewise.
5443         (Sized_relobj::do_local_has_got_offset): Rename from
5444         local_has_got_offset.
5445         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
5446         (Sized_relobj::do_set_local_got_offset): Rename from
5447         set_local_got_offset.
5448         (Sized_relobj_file::do_local_plt_offset): Rename from
5449         local_plt_offset.
5450         (Sized_relobj_file::do_local_symbol_value): New function.
5451         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
5452         local_plt_offset.
5453         * output.cc (Output_data_got::Got_entry::write): Change object to
5454         Relobj.  Use local_symbol_value.
5455         (Output_data_got::add_global_with_rel): Change rel_dyn to
5456         Output_data_reloc_generic*.  Use add_global_generic.
5457         (Output_data_got::add_global_with_rela): Remove.  Change all
5458         callers to use add_global_with_rel.
5459         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
5460         Output_data_reloc_generic*.  Use add_global_generic.
5461         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
5462         callers to use add_global_pair_with_rel.
5463         (Output_data_got::add_local): Change object to Relobj*.
5464         (Output_data_got::add_local_plt): Likewise.
5465         (Output_data_got::add_local_with_rel): Change object to Relobj*,
5466         change rel_dyn to Output_data_reloc_generic*.  Use
5467         add_local_generic.
5468         (Output_data_got::add_local_with_rela): Remove.  Change all
5469         callers to use all_local_with_rel.
5470         (Output_data_got::add_local_pair_with_rel): Change object to
5471         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
5472         add_output_section_generic.
5473         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
5474         callers to use add_local_pair_with_rel.
5475         (Output_data_got::reserve_local): Change object to Relobj*.
5476         * output.h: (class Output_data_reloc_generic): Add pure virtual
5477         declarations for add_global_generic, add_local_generic,
5478         add_output_section_generic.
5479         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
5480         functions for Output_data_reloc_generic.  Update declarations for
5481         changes listed in output.cc.
5482         (class Output_data_got): Change template parameter to got_size.
5483         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
5484         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
5485         function.
5486         (Sized_relobj_incr::do_local_plt_offset): New function.
5487         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
5488         add_global_generic.
5489
5490 2011-12-17  Cary Coutant  <ccoutant@google.com>
5491
5492         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
5493         * resolve.cc (Symbol_table::resolve): Likewise.
5494         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
5495         arrays.
5496         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5497
5498 2011-12-16  Ian Lance Taylor  <iant@google.com>
5499
5500         * output.h (Output_data_reloc_generic::add): Only call
5501         add_dynamic_reloc if this is a dynamic reloc section.
5502
5503 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
5504
5505         PR gold/13505
5506         * target-reloc.h (apply_relocation): Replace <64, false> with
5507         <size, big_endian>.
5508
5509 2011-11-25  Nick Clifton  <nickc@redhat.com>
5510
5511         * po/it.po: New Italian translation.
5512
5513 2011-11-17  Sterling Augustine  <saugustine@google.com>
5514
5515         * script.cc (script_include_directive): Implement.
5516         (read_script_file): New local variables name and search_path. Update
5517         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
5518         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
5519         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
5520
5521 2011-11-11  Sterling Augustine  <saugustine@google.com>
5522
5523         * yyscript.y (section_cmd): Add support for INCLUDE directive.
5524         (file_or_sections_cmd): Likewise.
5525
5526 2011-11-11  Doug Kwan  <dougkwan@google.com>
5527
5528         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
5529         if --just-symbols is given.
5530
5531 2011-11-10  Doug Kwan  <dougkwan@google.com>
5532
5533         PR gold/13362
5534         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
5535         when processing data relocs.
5536         * reloc.h (Relocate_functions::rel_unaligned): New method.
5537         (Relocate_functions::pcrel_unaligned): Ditto.
5538         (Relocate_functions::rel32_unaligned): Ditto.
5539         (Relocate_functions::pcrel32_unaligned): Ditto.
5540
5541 2011-11-09  Doug Kwan  <dougkwan@google.com>
5542
5543         PR gold/13362
5544         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
5545         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
5546         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
5547         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5548         (Relocate_functions::rel_unaligned): New.
5549         (Relocate_functions::rel32_unaligned): New.
5550         * target-reloc.h (relocate_for_relocatable): Add code to handle
5551         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5552         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
5553         arm_unaligned_reloc_r): New targets.
5554         * testsuite/Makefile.in: Regenerate.
5555         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
5556         linking.
5557
5558 2011-11-02  Ian Lance Taylor  <iant@google.com>
5559
5560         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
5561         NATIVE_LINKER.
5562         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
5563         * options.cc (General_options::finalize): Use library search path
5564         from configure script if specified.  If not native and no sysroot,
5565         only search TOOLLIBDIR.
5566         * options.h (Search_directory::Search_directory): Change name to
5567         const std::string&.
5568         (General_options::add_to_library_path_with_sysroot): Change arg to
5569         const std::string&.
5570         * configure, Makefile.in, config.in: Rebuild.
5571
5572 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5573
5574         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
5575         we are working around the ARM1176 Erratum.
5576         * options.h (General_options::fix_arm1176): Add option.
5577         * testsuite/Makefile.am: Add testcases, and keep current ones
5578         working.
5579         * testsuite/Makefile.in: Regenerate.
5580         * testsuite/arm_fix_1176.s: New file.
5581         * testsuite/arm_fix_1176.sh: Likewise.
5582
5583 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5584
5585         * arm.cc (Target_arm::Target_arm): Remove initialisation of
5586         may_use_blx_.
5587         (Target_arm::may_use_blx): Remove method.
5588         (Target_arm::set_may_use_blx): Likewise.
5589         (Target_arm::may_use_v4t_interworking): New method.
5590         (Target_arm::may_use_v5t_interworking): Likewise.
5591         (Target_arm::may_use_blx_): Remove member variable.
5592         (Arm_relocate_functions::arm_branch_common): Check for v5T
5593         interworking.
5594         (Arm_relocate_functions::thumb_branch_common): Likewise.
5595         (Reloc_stub::stub_type_for_reloc): Likewise.
5596         (Target_arm::do_finalize_sections): Correct interworking checks.
5597         * testsuite/Makefile.am: Add new tests.
5598         * testsuite/Makefile.in: Regenerate.
5599         * testsuite/arm_farcall_arm_arm.s: New test.
5600         * testsuite/arm_farcall_arm_arm.sh: Likewise.
5601         * testsuite/arm_farcall_arm_thumb.s: Likewise.
5602         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
5603         * testsuite/arm_farcall_thumb_arm.s: Likewise.
5604         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
5605         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
5606         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
5607
5608 2011-10-31  Cary Coutant  <ccoutant@google.com>
5609
5610         PR gold/13023
5611         * expression.cc (Expression::eval_with_dot): Add
5612         is_section_dot_assignment parameter.
5613         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
5614         absolute and assigning to dot within a section.
5615         * script-sections.cc
5616         (Output_section_element_assignment::set_section_addresses): Pass
5617         dot_section to set_if_absolute.
5618         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
5619         as is_section_dot_assignment flag to eval_with_dot.
5620         (Output_section_element_dot_assignment::set_section_addresses):
5621         Likewise.
5622         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
5623         parameter.  Also set value if relative to dot_section; set the
5624         symbol's output_section.
5625         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
5626         parameter.  Adjust all callers.
5627         (Expression::eval_maybe_dot): Likewise.
5628         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
5629         Adjust all callers.
5630         * testsuite/script_test_2.t: Test assignment of an absolute value
5631         to dot within an output section element.
5632
5633 2011-10-31  Cary Coutant  <ccoutant@google.com>
5634
5635         * options.h (class General_options): Add --[no-]gnu-unique options.
5636         * symtab.cc (Symbol_table::sized_write_globals): Convert
5637         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
5638
5639 2011-10-31  Cary Coutant  <ccoutant@google.com>
5640
5641         PR gold/13359
5642         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
5643         unnecessary assertion.
5644         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
5645
5646 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
5647
5648         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5649         gc_mark_symbol.
5650         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5651         gc_mark_symbol.
5652         Change to just keep the section associated with symbol.
5653         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
5654         they are externally visible and --export-dynamic is turned on.
5655         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
5656
5657 2011-10-19  Ian Lance Taylor  <iant@google.com>
5658
5659         PR gold/13163
5660         * script-sections.cc
5661         (Output_section_element_dot_assignment::needs_output_section): New
5662         function.
5663
5664 2011-10-19  Ian Lance Taylor  <iant@google.com>
5665
5666         PR gold/13204
5667         * layout.cc (Layout::segment_precedes): Don't assert failure if a
5668         --section-start option was seen.
5669         * options.h (General_options::any_section_start): New function.
5670
5671 2011-10-18  David S. Miller  <davem@davemloft.net>
5672
5673         PR binutils/13301
5674         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
5675         member to track relocation locations that have moved during TLS
5676         reloc optimizations.
5677         (Target_sparc::Relocate::Relocate): Initialize to NULL.
5678         (Target_sparc::Relocate::relocate): Adjust view down by 4
5679         bytes if it matches reloc_adjust_addr_.
5680         (Target_sparc::Relocate::relocate_tls): Always move the
5681         __tls_get_addr call delay slot instruction forward 4 bytes when
5682         performing relaxation.
5683
5684 2011-10-18  Cary Coutant  <ccoutant@google.com>
5685
5686         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
5687         (Output_file::map_no_anonymous): Check for non-zero
5688         return code from posix_fallocate.
5689
5690 2011-10-17  Cary Coutant  <ccoutant@google.com>
5691
5692         PR gold/13245
5693         * plugin.cc (is_visible_from_outside): Check for symbols
5694         referenced from dynamic objects.
5695         * resolve.cc (Symbol_table::resolve): Don't count references
5696         from dynamic objects as references from real ELF files.
5697         * testsuite/plugin_test_2.sh: Adjust expected result.
5698
5699 2011-10-17  Cary Coutant  <ccoutant@google.com>
5700
5701         * gold.cc: Include timer.h.
5702         (queue_middle_tasks): Stamp time.
5703         (queue_final_tasks): Likewise.
5704         * main.cc (main): Store timer in parameters.  Print timers
5705         for each pass.
5706         * parameters.cc (Parameters::Parameters): Initialize timer_.
5707         (Parameters::set_timer): New function.
5708         (set_parameters_timer): New function.
5709         * parameters.h (Parameters::set_timer): New function.
5710         (Parameters::timer): New function.
5711         (Parameters::timer_): New data member.
5712         (set_parameters_timer): New function.
5713         * timer.cc (Timer::stamp): New function.
5714         (Timer::get_pass_time): New function.
5715         * timer.h (Timer::stamp): New function.
5716         (Timer::get_pass_time): New function.
5717         (Timer::pass_times_): New data member.
5718
5719 2011-10-17  Cary Coutant  <ccoutant@google.com>
5720
5721         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
5722         task for members of lib groups.
5723
5724 2011-10-17  Cary Coutant  <ccoutant@google.com>
5725
5726         PR gold/13288
5727         * fileread.cc (File_read::find_view): Add assert.
5728         (File_read::make_view): Move bounds check (replace with assert)...
5729         (File_read::find_or_make_view): ... to here.
5730
5731 2011-10-12  Cary Coutant  <ccoutant@google.com>
5732
5733         * output.cc (Output_file::open_base_file): Handle case where
5734         ::read returns less than requested size.
5735
5736 2011-10-10  Cary Coutant  <ccoutant@google.com>
5737
5738         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
5739         Initialize defined_count_.
5740         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
5741         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
5742         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
5743         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
5744         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
5745         * incremental.h (Sized_relobj_incr::defined_count_): New data
5746         member.
5747         (Sized_incr_dynobj::defined_count_): New data member.
5748         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
5749         Return zeroes instead of internal error.
5750
5751 2011-10-10  Cary Coutant  <ccoutant@google.com>
5752
5753         PR gold/13249
5754         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
5755         (Output_reloc::symbol_value): Return PLT offset if flag is set.
5756         * output.h (class Output_reloc): Add use_plt_offset flag.
5757         (Output_reloc::type_): Adjust size of bit field.
5758         (Output_reloc::use_plt_offset_): New bit field.
5759         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
5760         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
5761         flag.  Adjust all callers.
5762         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
5763         creating RELATIVE relocations.
5764
5765 2011-10-10  Nick Clifton  <nickc@redhat.com>
5766
5767         * po/es.po: Updated Spanish translation.
5768         * po/fi.po: Updated Finnish translation.
5769
5770 2011-10-03   Diego Novillo  <dnovillo@google.com>
5771
5772         * options.cc (parse_uint): Fix dereference of RETVAL.
5773
5774 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
5775
5776         * layout.h (section_order_map_): New member.
5777         (get_section_order_map): New member function.
5778         * output.cc (Output_section::add_input_section): Check for patterns
5779         only when --section-ordering-file is specified.
5780         * gold.cc (queue_middle_tasks): Delay updating order of sections till
5781         output_sections have been formed.
5782         * layout.cc (Layout_Layout): Initialize section_order_map_.
5783         * plugin.cc (update_section_order): Store order in order_map. Do not
5784         update the order.
5785         * testsuite/Makefile.am: Add test case for plugin_final_layout.
5786         * testsuite/Makefile.in: Regenerate.
5787         * testsuite/plugin_section_order.c: New file.
5788         * testsuite/plugin_final_layout.cc: New file.
5789         * testsuite/plugin_final_layout.sh: New file.
5790
5791 2011-09-29  Cary Coutant  <ccoutant@google.com>
5792
5793         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5794         Check for NULL.
5795         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
5796         symbols during incremental update.
5797         (Symbol_table::add_from_dynobj): Likewise.
5798
5799 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5800             Ian Lance Taylor  <iant@google.com>
5801
5802         * symtab.cc (Symbol_table::define_special_symbol): Always
5803         canonicalize version string.
5804
5805 2011-09-26  Cary Coutant  <ccoutant@google.com>
5806
5807         * gold.cc (queue_initial_tasks): Move option checks ...
5808         * options.cc (General_options::finalize): ... to here. Disable
5809         some options; make others fatal.
5810
5811 2011-09-26  Cary Coutant  <ccoutant@google.com>
5812
5813         gcc PR lto/47247
5814         * plugin.cc (get_symbols_v2): New function.
5815         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
5816         (is_referenced_from_outside): New function.
5817         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
5818         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
5819         (get_symbols): Pass version parameter.
5820         (get_symbols_v2): New function.
5821         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
5822         parameter.
5823         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
5824         (onload): Add LDPT_GET_SYMBOLS_V2.
5825         (all_symbols_read_hook): Use get_symbols_v2; check for
5826         LDPR_PREVAILING_DEF_IRONLY_EXP.
5827         * testsuite/plugin_test_3.sh: Update expected results.
5828
5829 2011-09-23  Simon Baldwin  <simonb@google.com>
5830
5831         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5832         configuration options.
5833         * configure: Regenerate.
5834         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
5835         * Makefile.in: Regenerate.
5836         * testsuite/Makefile.in: Regenerate.
5837
5838 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
5839
5840         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
5841
5842 2011-09-19  Cary Coutant  <ccoutant@google.com>
5843
5844         * incremental.cc (can_incremental_update): Fix typo in comment.
5845         * incremental.h (can_incremental_update): Likewise.
5846
5847 2011-09-18  Cary Coutant  <ccoutant@google.com>
5848
5849         * incremental.cc (can_incremental_update): New function.
5850         * incremental.h (can_incremental_update): New function.
5851         * layout.cc (Layout::init_fixed_output_section): Call it.
5852         (Layout::make_output_section): Don't allow patch space in .eh_frame.
5853         * object.cc (Sized_relobj_file::do_layout): Call
5854         can_incremental_update.
5855
5856 2011-09-13  Cary Coutant  <ccoutant@google.com>
5857
5858         * configure.ac: Check for glibc support for gnu_indirect_function
5859         support with static linking, setting automake conditional
5860         IFUNC_STATIC.
5861         * Makefile.in: Regenerate.
5862         * configure: Regenerate.
5863
5864         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
5865         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
5866         for IFUNC_STATIC.
5867         * testsuite/Makefile.in: Regenerate.
5868
5869 2011-09-13  Cary Coutant  <ccoutant@google.com>
5870
5871         * incremental.cc (Sized_relobj_incr::do_layout): Call
5872         report_comdat_group for kept comdat sections.
5873         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
5874         * testsuite/Makefile.in: Regenerate.
5875         * testsuite/incr_comdat_test_1.cc: New source file.
5876         * testsuite/incr_comdat_test_2_v1.cc: New source file.
5877         * testsuite/incr_comdat_test_2_v2.cc: New source file.
5878         * testsuite/incr_comdat_test_2_v3.cc: New source file.
5879
5880 2011-09-13  Ian Lance Taylor  <iant@google.com>
5881
5882         * object.cc (Sized_relobj_file::do_layout): Remove unused local
5883         variable external_symbols_offset.
5884
5885 2011-09-12  Ian Lance Taylor  <iant@google.com>
5886
5887         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
5888         triggered if object has no symbols.
5889
5890 2011-09-09  David S. Miller  <davem@davemloft.net>
5891
5892         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
5893         (Output_fill_debug_line::do_write): Likewise.
5894
5895 2011-08-29  Cary Coutant  <ccoutant@google.com>
5896
5897         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
5898         casts to match formatting specs.
5899         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
5900
5901 2011-08-26  Cary Coutant  <ccoutant@google.com>
5902
5903         * layout.cc (Free_list::allocate): Provide guarantee of minimum
5904         remaining hole size when allocating.
5905         (Layout::make_output_section): Set fill methods for debug sections.
5906         * layout.h (Free_list::Free_list_node): Move from private to
5907         public.
5908         (Free_list::set_min_hole_size): New function.
5909         (Free_list::begin, Free_list::end): New functions.
5910         (Free_list::min_hole_): New data member.
5911         * output.cc: Include dwarf.h.
5912         (Output_fill_debug_info::do_minimum_hole_size): New function.
5913         (Output_fill_debug_info::do_write): New function.
5914         (Output_fill_debug_line::do_minimum_hole_size): New function.
5915         (Output_fill_debug_line::do_write): New function.
5916         (Output_section::Output_section): Initialize new data member.
5917         (Output_section::set_final_data_size): Ensure patch space is larger
5918         than minimum hole size.
5919         (Output_section::do_write): Fill holes in debug sections.
5920         * output.h (Output_fill): New class.
5921         (Output_fill_debug_info): New class.
5922         (Output_fill_debug_line): New class.
5923         (Output_section::set_free_space_fill): New function.
5924         (Output_section::free_space_fill_): New data member.
5925         * testsuite/Makefile.am (incremental_test_3): Add
5926         --incremental-patch option.
5927         (incremental_test_4): Likewise.
5928         (incremental_test_5): Likewise.
5929         (incremental_test_6): Likewise.
5930         (incremental_copy_test): Likewise.
5931         (incremental_common_test_1): Likewise.
5932         * testsuite/Makefile.in: Regenerate.
5933
5934 2011-08-26  Nick Clifton  <nickc@redhat.com>
5935
5936         * po/es.po: Updated Spanish translation.
5937
5938 2011-08-01  Cary Coutant  <ccoutant@google.com>
5939
5940         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
5941         * gold/testsuite/Makefile.in: Regenerate.
5942         * gold/testsuite/justsyms_exec.c: New source file.
5943         * gold/testsuite/justsyms_lib.c: New source file.
5944
5945 2011-08-01  Cary Coutant  <ccoutant@google.com>
5946
5947         * layout.cc (Layout::set_segment_offsets): Don't realign text
5948         segment if -Ttext was specified.
5949         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
5950         file type.
5951         * object.h (Sized_relobj_file::e_type): New function.
5952         (Sized_relobj_file::e_type_): New data member.
5953         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
5954         base address for ET_EXEC files.
5955         * target.cc (Target::do_make_elf_object_implementation): Allow
5956         ET_EXEC files with --just-symbols option.
5957
5958 2011-07-28  Cary Coutant  <ccoutant@google.com>
5959
5960         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
5961         Add thread_number parameter.
5962         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
5963         * workqueue-threads.cc
5964         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
5965         current thread if its thread number is greater than desired thread
5966         count.
5967         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
5968         Add thread_number parameter.
5969         (Workqueue::should_cancel_thread): Likewise.
5970         (Workqueue::find_runnable_or_wait): Pass thread_number to
5971         should_cancel_thread.
5972         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
5973         parameter.
5974
5975 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
5976
5977         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
5978         only after checking if it cannot be forced local.
5979         * symtab.h (is_externally_visible): Check if the symbol is not forced
5980         local.
5981
5982 2011-07-15  Ian Lance Taylor  <iant@google.com>
5983
5984         * options.h (class General_options): Add --print-output-format.
5985         Move -EL next to -EB, for  better --help output.
5986         * target-select.cc: Include <cstdio>, "options.h", and
5987         "parameters.h".
5988         (Target_selector::do_target_bfd_name): New function.
5989         (print_output_format): New function.
5990         * target-select.h (class Target_selector): Update declarations.
5991         (Target_selector::target_bfd_name): New function.
5992         (print_output_format): Declare.
5993         * main.cc: Include "target-select.h".
5994         (main): Handle --print-output-format.
5995         * gold.cc: Include "target-select.h".
5996         (queue_initial_tasks): Handle --print-output-format when there are
5997         no input files.
5998         * parameters.cc (parameters_force_valid_target): Give a better
5999         error message if -EB/-EL does not match target.
6000         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
6001         function.
6002
6003 2011-07-15  Ian Lance Taylor  <iant@google.com>
6004
6005         * i386.cc (class Output_data_plt_i386): Add layout_ field.
6006         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
6007         (Output_data_plt_i386::do_write): Write address of .dynamic
6008         section to first entry in .got.plt section.
6009         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
6010         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
6011         Initialize layout_.
6012         (Output_data_plt_x86_64::do_write): Write address of .dynamic
6013         section to first entry in .got.plt section.
6014         * layout.h (Layout::dynamic_section): New function.
6015
6016 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
6017
6018         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
6019         to claim_file call.
6020         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
6021         input_section_position_, and input_section_glob_.
6022         (read_layout_from_file): Call function section_ordering_specified.
6023         * layout.h (is_section_ordering_specified): New function.
6024         (section_ordering_specified): New function.
6025         (section_ordering_specified_): New boolean member.
6026         * main.cc(main): Call load_plugins after layout object is defined.
6027         * output.cc (Output_section::add_input_section): Use
6028         function section_ordering_specified to check if section ordering is
6029         needed.
6030         * output.cc (Output_section::add_relaxed_input_section): Use
6031         function section_ordering_specified to check if section ordering is
6032         needed.
6033         (Output_section::update_section_layout): New function.
6034         (Output_section::sort_attached_input_sections): Check if input section
6035         must be reordered.
6036         * output.h (Output_section::update_section_layout): New function.
6037         * plugin.cc (get_section_count): New function.
6038         (get_section_type): New function.
6039         (get_section_name): New function.
6040         (get_section_contents): New function.
6041         (update_section_order): New function.
6042         (allow_section_ordering): New function.
6043         (Plugin::load): Add the new interfaces to the transfer vector.
6044         (Plugin_manager::load_plugins): New parameter.
6045         (Plugin_manager::all_symbols_read): New parameter.
6046         (Plugin_manager::claim_file): New parameter. Save the elf object for
6047         unclaimed objects.
6048         (Plugin_manager::get_elf_object): New function.
6049         (Plugin_manager::get_view): Change to directly use the bool to check
6050         if get_view is called from claim_file_hook.
6051         * plugin.h (input_objects): New function
6052         (Plugin__manager::load_plugins): New parameter.
6053         (Plugin_manager::claim_file): New parameter.
6054         (Plugin_manager::get_elf_object): New function.
6055         (Plugin_manager::in_claim_file_handler): New function.
6056         (Plugin_manager::in_claim_file_handler_): New member.
6057         (layout): New function.
6058         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
6059         handler with an extra parameter. Make the elf object before calling
6060         claim_file handler.
6061         * testsuite/plugin_test.c (get_section_count): New function pointer.
6062         (get_section_type): New function pointer.
6063         (get_section_name): New function pointer.
6064         (get_section_contents): New function pointer.
6065         (update_section_order): New function pointer.
6066         (allow_section_ordering): New function pointer.
6067         (onload): Check if the new interfaces exist.
6068
6069 2011-07-13  Ian Lance Taylor  <iant@google.com>
6070
6071         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
6072         relro section.
6073         * x86_64.cc (Target_x86_64::got_section): Likewise.
6074         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
6075         (relro_now_test_SOURCES): New variable.
6076         (relro_now_test_DEPENDENCIES): New variable.
6077         (relro_now_test_LDFLAGS): New variable.
6078         (relro_now_test_LDADD): New variable.
6079         (relro_now_test.so): New target.
6080         * testsuite/Makefile.in: Rebuild.
6081
6082 2011-07-12  Ian Lance Taylor  <iant@google.com>
6083
6084         PR gold/12980
6085         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
6086         GLOB_DAT relocation rather than a RELATIVE relocation for a
6087         protected symbol when creating a shared library.
6088         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6089         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
6090         * testsuite/protected_main_1.cc (main): Test that protected
6091         function has same address.
6092
6093 2011-07-11  Ian Lance Taylor  <iant@google.com>
6094
6095         PR gold/12979
6096         * options.h (class General_options): Add -Bgroup.
6097         * options.cc (General_options::finalize): If -Bgroup is set,
6098         default to --unresolved-symbols=report-all.
6099         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
6100         * target-reloc.h (issue_undefined_symbol_error): Handle
6101         --unresolved-symbols=report-all.
6102
6103 2011-07-08  Ian Lance Taylor  <iant@google.com>
6104
6105         PR gold/11985
6106         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
6107         if linker script discards key sections.
6108         (Layout::create_dynamic_symtab): Likewise.
6109         (Layout::assign_local_dynsym_offsets): Likewise.
6110         (Layout::sized_create_version_sections): Likewise.
6111         (Layout::create_interp): Likewise.
6112         (Layout::finish_dynamic_section): Likewise.
6113         (Layout::set_dynamic_symbol_size): Likewise.
6114
6115 2011-07-08  Ian Lance Taylor  <iant@google.com>
6116
6117         PR gold/12386
6118         * options.h (class General_options): Add --unresolved-symbols.
6119         * target-reloc.h (issue_undefined_symbol_error): Check
6120         --unresolved-symbols.  Add comments.
6121
6122 2011-07-08  Ian Lance Taylor  <iant@google.com>
6123
6124         * testsuite/odr_violation2.cc (Ordering::operator()): Make
6125         expression more complex.
6126
6127 2011-07-08  Ian Lance Taylor  <iant@google.com>
6128
6129         PR gold/11317
6130         * target-reloc.h (issue_undefined_symbol_error): New inline
6131         function, broken out of relocate_section.
6132         (relocate_section): Call issue_undefined_symbol_error.
6133         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
6134         there is no TLS segment if we are about to issue an undefined
6135         symbol error.
6136         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
6137
6138 2011-07-08  Ian Lance Taylor  <iant@google.com>
6139
6140         PR gold/12279
6141         * resolve.cc (Symbol_table::should_override): Add fromtype
6142         parameter.  Change all callers.  Give error when linking together
6143         TLS and non-TLS symbol.
6144         (Symbol_table::should_override_with_special): Add fromtype
6145         parameter.  Change all callers.
6146         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
6147         there is no TLS segment if we have reported some errors.
6148         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
6149
6150 2011-07-08  Ian Lance Taylor  <iant@google.com>
6151
6152         PR gold/12372
6153         * target.h (Target::plt_address_for_global): New function.
6154         (Target::plt_address_for_local): New function.
6155         (Target::plt_section_for_global): Remove.
6156         (Target::plt_section_for_local): Remove.
6157         (Target::do_plt_address_for_global): New virtual function.
6158         (Target::do_plt_address_for_local): New virtual function.
6159         (Target::do_plt_section_for_global): Remove.
6160         (Target::do_plt_section_for_local): Remove.
6161         (Target::register_global_plt_entry): Add Symbol_table and Layout
6162         parameters.
6163         * output.cc (Output_data_got::Got_entry::write): Use
6164         plt_address_for_global and plt_address_for_local.
6165         * layout.cc (Layout::add_target_dynamic_tags): Use size and
6166         address of output section.
6167         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
6168         got_irelative_, and irelative_count_ fields.  Update
6169         declarations.
6170         (Output_data_plt_i386::has_irelative_section): New function.
6171         (Output_data_plt_i386::entry_count): Add irelative_count_.
6172         (Output_data_plt_i386::set_final_data_size): Likewise.
6173         (class Target_i386): Add got_irelative_ and rel_irelative_
6174         fields.  Update declarations.
6175         (Target_i386::Target_i386): Initialize new fields.
6176         (Target_i386::do_plt_address_for_global): New function replacing
6177         do_plt_section_for_global.
6178         (Target_i386::do_plt_address_for_local): New function replacing
6179         do_plt_section_for_local.
6180         (Target_i386::got_section): Create got_irelative_.
6181         (Target_i386::rel_irelative_section): New function.
6182         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
6183         fields.  Don't define __rel_iplt_{start,end}.
6184         (Output_data_plt_i386::add_entry): Add symtab and layout
6185         parameters.  Change all callers.  Use different PLT and GOT for
6186         IFUNC symbols.
6187         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
6188         layout parameters.  Change all callers.  Use different PLT and
6189         GOT.
6190         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
6191         (Output_data_plt_i386::rel_irelative): New function.
6192         (Output_data_plt_i386::address_for_global): New function.
6193         (Output_data_plt_i386::address_for_local): New function.
6194         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
6195         IRELATIVE GOT when changing IFUNC GOT entries.
6196         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
6197         reloc.
6198         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
6199         if we didn't create an IRELATIVE GOT.
6200         (Target_i386::Relocate::relocate): Use plt_address_for_global and
6201         plt_address_for_local.
6202         (Target_i386::do_dynsym_value): Use plt_address_for_global.
6203         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
6204         got_irelative_, and irelative_count_ fields.  Update
6205         declarations.
6206         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
6207         Initialize new fields.  Remove symtab parameter.  Change all
6208         callers.
6209         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
6210         irelative_count_.
6211         (Output_data_plt_x86_64::has_irelative_section): New function.
6212         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
6213         (class Target_x86_64): Add got_irelative_ and rel_irelative_
6214         fields.  Update declarations.
6215         (Target_x86_64::Target_x86_64): Initialize new fields.
6216         (Target_x86_64::do_plt_address_for_global): New function replacing
6217         do_plt_section_for_global.
6218         (Target_x86_64::do_plt_address_for_local): New function replacing
6219         do_plt_section_for_local.
6220         (Target_x86_64::got_section): Create got_irelative_.
6221         (Target_x86_64::rela_irelative_section): New function.
6222         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
6223         all callers.  Don't create __rel_iplt_{start,end}.
6224         (Output_data_plt_x86_64::add_entry): Add symtab and layout
6225         parameters.  Change all callers.  Use different PLT and GOT for
6226         IFUNC symbols.
6227         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
6228         layout parameters.  Change all callers.  Use different PLT and
6229         GOT.
6230         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
6231         parameters.  Change all callers.  Use different PLT and GOT for
6232         IFUNC symbols.
6233         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
6234         (Output_data_plt_x86_64::rela_irelative): New function.
6235         (Output_data_plt_x86_64::address_for_global): New function.
6236         (Output_data_plt_x86_64::address_for_local): New function.
6237         (Output_data_plt_x86_64::set_final_data_size): Likewise.
6238         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
6239         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
6240         (Target_x86_64::register_global_plt_entry): Add symtab and layout
6241         parameters.
6242         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
6243         reloc.
6244         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
6245         symbols if we didn't create an IRELATIVE GOT.
6246         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
6247         plt_address_for_local.
6248         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
6249         * testsuite/ifuncvar1.c: New test file.
6250         * testsuite/ifuncvar2.c: New test file.
6251         * testsuite/ifuncvar3.c: New test file.
6252         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
6253         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
6254         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
6255         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
6256         * testsuite/Makefile.in: Rebuild.
6257
6258 2011-07-07  Cary Coutant  <ccoutant@google.com>
6259
6260         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
6261         (two_file_test_1_ndebug.o): Likewise.
6262         (two_file_test_1b_ndebug.o): Likewise.
6263         (two_file_test_2_ndebug.o): Likewise.
6264         (two_file_test_main_ndebug.o): Likewise.
6265         (incremental_test_2): Link with no-debug versions.
6266
6267 2011-07-06  Cary Coutant  <ccoutant@google.com>
6268
6269         * gold/incremental.cc
6270         (Output_section_incremental_inputs::write_info_blocks): Check for
6271         hidden and internal symbols.
6272
6273 2011-07-06  Cary Coutant  <ccoutant@google.com>
6274
6275         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
6276         Check disposition for startup file.
6277         (Incremental_inputs::report_command_line): Ignore
6278         --incremental-startup-unchanged option.
6279         * options.cc (General_options::parse_incremental_startup_unchanged):
6280         New function.
6281         (General_options::General_options): Initialize new data member.
6282         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
6283         (General_options): Add --incremental-startup-unchanged option.
6284         (General_options::incremental_startup_disposition): New function.
6285         (General_options::incremental_startup_disposition_): New data member.
6286
6287 2011-07-06  Cary Coutant  <ccoutant@google.com>
6288
6289         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
6290         input file index to Script_info ctor.
6291         (Sized_incremental_binary::do_file_has_changed): Find the
6292         command-line argument for files named in scripts.
6293         * incremental.h (Script_info::Script_info): New ctor
6294         with input file index.
6295         (Script_info::input_file_index): New function.
6296         (Script_info::input_file_index_): New data member.
6297         (Incremental_binary::get_library): Add const.
6298         (Incremental_binary::get_script_info): Add const.
6299         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
6300         * testsuite/Makefile.am (incremental_test_5): New test case.
6301         (incremental_test_6): New test case.
6302         * testsuite/Makefile.in: Regenerate.
6303
6304 2011-07-06  Cary Coutant  <ccoutant@google.com>
6305
6306         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
6307         debug output when command lines differ.
6308
6309 2011-07-06  Cary Coutant  <ccoutant@google.com>
6310
6311         * incremental.cc (Incremental_inputs::report_command_line): Ignore
6312         --incremental-patch option.
6313         * layout.cc (Free_list::allocate): Extend allocation beyond original
6314         end if enabled.
6315         (Layout::make_output_section): Mark sections that should get
6316         patch space.
6317         * options.cc (parse_percent): New function.
6318         * options.h (parse_percent): New function.
6319         (DEFINE_percent): New macro.
6320         (General_options): Add --incremental-patch option.
6321         * output.cc (Output_section::Output_section): Initialize new data
6322         members.
6323         (Output_section::add_input_section): Print section name when out
6324         of patch space.
6325         (Output_section::add_output_section_data): Likewise.
6326         (Output_section::set_final_data_size): Add patch space when
6327         doing --incremental-full.
6328         (Output_section::do_reset_address_and_file_offset): Remove patch
6329         space.
6330         (Output_segment::set_section_list_addresses): Print debug output
6331         only if --incremental-update.
6332         * output.h (Output_section::set_is_patch_space_allowed): New function.
6333         (Output_section::is_patch_space_allowed_): New data member.
6334         (Output_section::patch_space_): New data member.
6335         * parameters.cc (Parameters::incremental_full): New function.
6336         * parameters.h (Parameters::incremental_full): New function
6337         * testsuite/Makefile.am (incremental_test_2): Add test for
6338         --incremental-patch option.
6339         * testsuite/Makefile.in: Regenerate.
6340         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
6341         (t18): Remove function body.
6342
6343 2011-07-05  Doug Kwan  <dougkwan@google.com>
6344
6345         PR gold/12771
6346         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
6347         Arm_Address type for relocation result.
6348         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
6349         overflow check.
6350         (Arm_relocate_functions::abs32): Use unaligned access.
6351         (Arm_relocate_functions::rel32): Ditto.
6352         (Arm_relocate_functions::prel31): Ditto.
6353         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
6354         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
6355         static data relocations.
6356         * testsuite/Makefile.in: Regnerate.
6357         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
6358
6359 2011-07-05  Ian Lance Taylor  <iant@google.com>
6360
6361         PR gold/12392
6362         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
6363         symbols if necessary.
6364         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6365
6366 2011-07-05  Ian Lance Taylor  <iant@google.com>
6367
6368         PR gold/12952
6369         * resolve.cc (Symbol::override_base_with_special): Simply override
6370         version with special symbol version, ignoring previous version.
6371
6372 2011-07-05  Ian Lance Taylor  <iant@google.com>
6373
6374         * object.cc (Sized_relobj_file::include_section_group): Add
6375         information to comment about signature location.
6376
6377 2011-07-02  Ian Lance Taylor  <iant@google.com>
6378
6379         PR gold/12957
6380         * options.h (class General_options): Add -f and -F.
6381         * options.cc (General_options::finalize): Fatal error if -f/-F
6382         are used without -shared.
6383         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
6384
6385 2011-07-02  Ian Lance Taylor  <iant@google.com>
6386
6387         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
6388
6389 2011-07-01  Ian Lance Taylor  <iant@google.com>
6390
6391         PR gold/12525
6392         PR gold/12952
6393         * resolve.cc (Symbol::override_base_with_special): Don't override
6394         the version if the overriding symbol has a different name.
6395         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
6396         all callers.  If we give an error about an undefined version,
6397         define the base version if necessary.
6398         * dynobj.h (class Versions): Update declaration.
6399         * testsuite/weak_alias_test_5.cc: New file.
6400         * testsuite/weak_alias_test.script: New file.
6401         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
6402         and versioned_alias have the right value, and call t2.
6403         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
6404         weak_alias_test_5.so.
6405         (weak_alias_test_LDADD): Likewise.
6406         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
6407         * testsuite/Makefile.in: Rebuild.
6408
6409 2011-07-01  Ian Lance Taylor  <iant@google.com>
6410
6411         PR gold/12525
6412         * options.h (class General_options): Support -z notext.
6413         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
6414         -Wl,-z,notext.
6415         (two_file_shared_nonpic.so): Likewise.
6416         (two_file_shared_mixed.so): Likewise.
6417         (two_file_shared_mixed_1.so): Likewise.
6418         (weak_undef_lib_nonpic.so): Likewise.
6419         (alt/weak_undef_lib_nonpic.so): Likewise.
6420         (tls_test_shared_nonpic.so): Likewise.
6421         * testsuite/Makefile.in: Rebuild.
6422
6423 2011-07-01  Ian Lance Taylor  <iant@google.com>
6424
6425         PR gold/12525
6426         * configure.ac: Test whether static linking works, setting
6427         the automake conditional HAVE_STATIC.
6428         * testsuite/Makefile.am: Disable tests using -static if
6429         HAVE_STATIC is not true.
6430         * configure, testsuite/Makefile.in: Rebuild.
6431
6432 2011-07-01  Ian Lance Taylor  <iant@google.com>
6433
6434         PR gold/12525
6435         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
6436         Assert if we see DW_EH_PE_indirect.
6437         * target.h (Target::ehframe_datarel_base): New function.
6438         (Target::do_ehframe_datarel_base): New target function.
6439         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
6440         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
6441         function.
6442
6443 2011-07-01  Ian Lance Taylor  <iant@google.com>
6444
6445         PR gold/12571
6446         * options.h (class General_options): Add
6447         --ld-generated-unwind-info.
6448         * ehframe.cc (Fde::write): Add address parameter.  Change all
6449         callers.  If associated with PLT, fill in address and size.
6450         (Cie::set_output_offset): Only add merge mapping if there is an
6451         object.
6452         (Cie::write): Add address parameter.  Change all callers.
6453         (Eh_frame::add_ehframe_for_plt): New function.
6454         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
6455         input_offset_ fields into union u_, with new plt field.
6456         (Fde::Fde): Adjust for new union field.
6457         (Fde::Fde) [Output_data version]: New constructor.
6458         (Fde::add_mapping): Only add merge mapping if there is an object.
6459         (class Cie): Update declarations.
6460         (class Eh_frame): Declare add_ehframe_for_plt.
6461         * layout.cc (Layout::layout_eh_frame): Break out code into
6462         make_eh_frame_section, and call it.
6463         (Layout::make_eh_frame_section): New function.
6464         (Layout::add_eh_frame_for_plt): New function.
6465         * layout.h (class Layout): Update declarations.
6466         * merge.cc (Merge_map::add_mapping): Add assertion.
6467         * i386.cc: Include "dwarf.h".
6468         (class Output_data_plt_i386): Make first_plt_entry,
6469         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
6470         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6471         and plt_eh_frame_fde.
6472         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
6473         boundary.  Call add_eh_frame_for_plt if appropriate.
6474         * x86_64.cc: Include "dwarf.h".
6475         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
6476         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
6477         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6478         and plt_eh_frame_fde.
6479         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
6480         appropriate.
6481
6482 2011-06-29  Ian Lance Taylor  <iant@google.com>
6483
6484         PR gold/12629
6485         * object.cc (Sized_relobj_file::layout_section): Change shdr
6486         parameter to be const.
6487         (Sized_relobj_file::layout_eh_frame_section): New function, broken
6488         out of do_layout.
6489         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
6490         appropriate.  Call layout_eh_frame_section.
6491         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
6492         sections.
6493         * object.h (class Sized_relobj_file): Update declarations.
6494
6495 2011-06-29  Ian Lance Taylor  <iant@google.com>
6496
6497         PR gold/12652
6498         * script.cc (Token::integer_value): Accept trailing M/m/K/k
6499         modifier.
6500         (Lex::gather_token): Accept trailing M/m/K/k for integers.
6501
6502 2011-06-29  Ian Lance Taylor  <iant@google.com>
6503
6504         PR gold/12675
6505         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
6506         SHT_X86_64_UNWIND.
6507         * layout.cc (Layout::layout_eh_frame): Likewise.
6508
6509 2011-06-29  Ian Lance Taylor  <iant@google.com>
6510
6511         PR gold/12695
6512         * layout.cc (Layout::symtab_section_shndx): New function.
6513         * layout.h (class Layout): Declare symtab_section_shndx.
6514         * output.cc (Output_section::write_header): Call it.
6515
6516 2011-06-29  Ian Lance Taylor  <iant@google.com>
6517
6518         PR gold/12818
6519         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
6520         symbols which are not used in a relocation.
6521
6522 2011-06-28  Ian Lance Taylor  <iant@google.com>
6523
6524         PR gold/12898
6525         * layout.cc (Layout::segment_precedes): Don't crash if a linker
6526         script create indistinguishable segments.
6527         (Layout::set_segment_offsets): Use stable_sort when sorting
6528         segments.  Pass this to Compare_segments constructor.
6529         * layout.h (class Layout): Make segment_precedes non-static.
6530         (class Compare_segments): Change from struct to class.  Add
6531         layout_ field.  Add constructor.
6532         * script-sections.cc
6533         (Script_sections::attach_sections_using_phdrs_clause): Rename
6534         local orphan to is_orphan.  Don't report failure to put empty
6535         section in segment.  On attachment failure, report name of
6536         section, and attach to first PT_LOAD segment.
6537
6538 2011-06-28  Ian Lance Taylor  <iant@google.com>
6539
6540         PR gold/12934
6541         * target-select.cc (Target_selector::Target_selector): Add
6542         emulation parameter.  Change all callers.
6543         (select_target_by_bfd_name): Rename from select_target_by_name.
6544         Change all callers.
6545         (select_target_by_emulation): New function.
6546         (supported_emulation_names): New function.
6547         * target-select.h (class Target_selector): Add emulation_ field.
6548         Update declarations.
6549         (Target_selector::recognize_by_bfd_name): Rename from
6550         recognize_by_name.  Change all callers.
6551         (Target_selector::supported_bfd_names): Rename from
6552         supported_names.  Change all callers.
6553         (Target_selector::recognize_by_emulation): New function.
6554         (Target_selector::supported_emulations): New function.
6555         (Target_selector::emulation): New function.
6556         (Target_selector::do_recognize_by_bfd_name): Rename from
6557         do_recognize_by_name.  Change all callers.
6558         (Target_selector::do_supported_bfd_names): Rename from
6559         do_supported_names.  Change all callers.
6560         (Target_selector::do_recognize_by_emulation): New function.
6561         (Target_selector::do_supported_emulations): New function.
6562         (select_target_by_bfd_name): Change name in declaration.
6563         (select_target_by_emulation): Declare.
6564         (supported_emulation_names): Declare.
6565         * parameters.cc (parameters_force_valid_target): Try to find
6566         target based on emulation from -m option.
6567         * options.h (class General_options): Change doc string for -m.
6568         * options.cc (help): Print emulations.
6569         (General_options::parse_V): Likewise.
6570         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
6571         Add emulation parameter.  Change all callers.
6572
6573 2011-06-28  Ian Lance Taylor  <iant@google.com>
6574
6575         * target.h (class Target): Add osabi_ field.
6576         (Target::osabi): New function.
6577         (Target::set_osabi): New function.
6578         (Target::Target): Initialize osabi_.
6579         (Target::do_adjust_elf_header): Make pure virtual.
6580         (Sized_target::do_adjust_elf_header): Declare.
6581         * target.cc (Sized_target::do_adjust_elf_header): New function.
6582         (class Sized_target): Instantiate all versions.
6583         * freebsd.h (class Target_freebsd): Remove.
6584         (Target_selector_freebsd::do_recognize): Call set_osabi on
6585         Target.
6586         (Target_selector_freebsd::do_recognize_by_name): Likewise.
6587         (Target_selector_freebsd::set_osabi): Remove.
6588         * i386.cc (class Target_i386): Inherit from Sized_target rather
6589         than Target_freebsd.
6590         * x86_64.cc (class Target_x86_64): Likewise.
6591
6592 2011-06-28  Ian Lance Taylor  <iant@google.com>
6593
6594         * target.h (Target::can_check_for_function_pointers): Rewrite.
6595         Make non-virtual.
6596         (Target::can_icf_inline_merge_sections): Likewise.
6597         (Target::section_may_have_icf_unsafe_poineters): Likewise.
6598         (Target::Target_info): Add can_icf_inline_merge_sections field.
6599         (Target::do_can_check_for_function_pointers): New virtual
6600         function.
6601         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
6602         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
6603         from can_check_for_function_pointers, move in file.
6604         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
6605         section_may_have_icf_unsafe_poineters, move in file.
6606         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
6607         * i386.cc (Target_i386::do_can_check_for_function_pointers):
6608         Rename from can_check_for_function_pointers, move in file.
6609         (Target_i386::can_icf_inline_merge_sections): Remove.
6610         (Target_i386::i386_info): Initialize
6611         can_icf_inline_merge_sections.
6612         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6613         Initialize can_icf_inline_merge_sections.
6614         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
6615         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
6616         Rename from can_check_for_function_pointers, move in file.
6617         (Target_x86_64::can_icf_inline_merge_sections): Remove.
6618         (Target_x86_64::x86_64_info): Initialize
6619         can_icf_inline_merge_sections.
6620         * testsuite/testfile.cc (Target_test::test_target_info):
6621         Likewise.
6622         * icf.cc (get_section_contents): Correct formatting.
6623
6624 2011-06-27  Ian Lance Taylor  <iant@google.com>
6625
6626         * symtab.cc (Symbol::versioned_name): New function.
6627         (Symbol_table::add_to_final_symtab): Use versioned_name when
6628         appropriate.
6629         (Symbol_table::sized_write_symbol): Likewise.
6630         * symtab.h (class Symbol): Declare versioned_name.
6631         * stringpool.h (class Stringpool_template): Add variant of add
6632         which takes a std::basic_string.
6633         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
6634         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
6635         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
6636         (ver_test_12.o): New target.
6637         * testsuite/Makefile.in: Rebuild.
6638
6639 2011-06-27  Doug Kwan  <dougkwan@google.com>
6640
6641         * arm.cc (Arm_relocate_functions::thm_jump8,
6642         Arm_relocate_functions::thm_jump11): Use a wider signed
6643         type to compute offset.
6644         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
6645         arm_thm_jump8.
6646         * testsuite/Makefile.in: Regenerate.
6647         * testsuite/arm_branch_in_range.sh: Check test results of
6648         arm_thm_jump11 and arm_thm_jump8.
6649         * testsuite/arm_thm_jump11.s: New test source file.
6650         * testsuite/arm_thm_jump11.t: New linker script.
6651         * testsuite/arm_thm_jump8.s: New test source file.
6652         * testsuite/arm_thm_jump8.t: New linker script.
6653
6654 2011-06-24  Ian Lance Taylor  <iant@google.com>
6655
6656         * layout.cc: Include "object.h".
6657         (ctors_sections_in_init_array): New static variable.
6658         (Layout::is_ctors_in_init_array): New function.
6659         (Layout::layout): Add entry to ctors_sections_in_init_array if
6660         appropriate.
6661         * layout.h (class Layout): Declare is_ctors_in_init_array.
6662         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
6663         is_ctors_reverse_view is set.
6664         (Sized_relobj_file::write_sections): Add layout parameter.  Change
6665         all callers.  Set is_ctors_reverse_view field of View_size.
6666         (Sized_relobj_file::reverse_words): New function.
6667         * object.h (Sized_relobj_file::View_size): Add
6668         is_ctors_reverse_view field.
6669         (class Sized_relobj_file): Update declarations.
6670         * testsuite/initpri3.c: New test.
6671         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
6672         initpri3b.
6673         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
6674         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
6675         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
6676         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
6677         * testsuite/Makefile.in: Rebuild.
6678
6679 2011-06-24  Cary Coutant  <ccoutant@google.com>
6680
6681         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
6682         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
6683         (debug_msg_cdebug.err): New targets.
6684         * testsuite/Makefile.in: Regenerate.
6685         * testsuite/debug_msg.sh: Check output of link with compressed debug.
6686         Fix checks for link with shared library.
6687
6688 2011-06-24  Doug Kwan  <dougkwan@google.com>
6689
6690         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
6691         skip empty text sections.
6692         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
6693
6694 2011-06-22  Ian Lance Taylor  <iant@google.com>
6695
6696         PR gold/12910
6697         * options.h (class General_options): Add --ctors-in-init-array.
6698         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
6699         friends as SHT_PROGBITS for merging sections.
6700         (Layout::layout): Remove special handling of .init_array and
6701         friends.  Don't sort if doing relocatable link.  Sort for .ctors
6702         and .dtors if ctors_in_init_array.
6703         (Layout::make_output_section): Force correct section types for
6704         .init_array and friends.  Don't sort if doing relocatable link,
6705         Don't sort .ctors and .dtors if ctors_in_init_array.
6706         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
6707         (Layout::output_section_name): Add relobj parameter.  Change all
6708         callers.  Handle .ctors. and .dtors. in code rather than table.
6709         Handle .ctors and .dtors if ctors_in_init_array.
6710         (Layout::match_file_name): New function, moved from output.cc.
6711         * layout.h (class Layout): Update declarations.
6712         * output.cc: Include "layout.h".
6713         (Input_section_sort_entry::get_priority): New function.
6714         (Input_section_sort_entry::match_file_name): Just call
6715         Layout::match_file_name.
6716         (Output_section::Input_section_sort_init_fini_compare::operator()):
6717         Handle .ctors and .dtors.  Sort by explicit priority rather than
6718         by name.
6719         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
6720         * testsuite/initpri2.c: New test.
6721         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
6722         (check_PROGRAMS): Add initpri2.
6723         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
6724         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
6725         * configure, testsuite/Makefile.in: Rebuild.
6726
6727 2011-06-19  Ian Lance Taylor  <iant@google.com>
6728
6729         PR gold/12880
6730         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
6731         .interp section to a PT_INTERP segment even if we have seen a
6732         --dynamic-linker option.  Don't do it if we have seen a PHDRS
6733         clause in a linker script.
6734         (Layout::finalize): Don't create a .interp section if we've
6735         already create a PT_INTERP segment.
6736         (Layout::create_interp): Always call choose_output_section (revert
6737         patch of 2011-06-17).  Don't create PT_INTERP segment.
6738         * script-sections.cc
6739         (Script_sections::create_note_and_tls_segments): Add a .interp
6740         section to a PT_INTERP segment even if we have seen a
6741         --dynamic-linker option.
6742
6743 2011-06-18  Ian Lance Taylor  <iant@google.com>
6744
6745         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
6746         merely because a non-PT_LOAD segment has a dynamic reloc.
6747
6748 2011-06-18  Ian Lance Taylor  <iant@google.com>
6749
6750         * layout.cc (Layout::finish_dynamic_section): Don't create
6751         DT_FLAGS entry if not needed.
6752
6753 2011-06-18  Ian Lance Taylor  <iant@google.com>
6754
6755         PR gold/12745
6756         * layout.cc (Layout::layout_eh_frame): Correct handling of
6757         writable .eh_frame section.
6758
6759 2011-06-17  Ian Lance Taylor  <iant@google.com>
6760
6761         PR gold/12893
6762         * resolve.cc (Symbol_table::resolve): Don't give an error if a
6763         symbol is redefined with the exact same object and value.
6764
6765 2011-06-17  Ian Lance Taylor  <iant@google.com>
6766
6767         PR gold/12880
6768         * layout.h (class Layout): Add interp_segment_ field.
6769         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
6770         (Layout::attach_allocated_section_to_segment): If making shared
6771         library, put .interp section in PT_INTERP segment.
6772         (Layout::finalize): Also call create_interp if -dynamic-linker
6773         option was used.
6774         (Layout::create_interp): Assert that there is no PT_INTERP
6775         segment.  If not using a SECTIONS clause, use make_output_section.
6776         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
6777         * script-sections.cc
6778         (Script_sections::create_note_and_tls_segments): If making shared
6779         library, put .interp section in PT_INTERP segment.
6780
6781 2011-06-17  Ian Lance Taylor  <iant@google.com>
6782
6783         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
6784         when making a shared library.
6785
6786 2011-06-17  Ian Lance Taylor  <iant@google.com>
6787
6788         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
6789         parameter.  Change all callers.  Don't issue warning about PC32
6790         against locally defined symbol.
6791
6792 2011-06-16  Ian Lance Taylor  <iant@google.com>
6793
6794         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
6795         occurs in same object.
6796
6797 2011-06-14  Alan Modra  <amodra@gmail.com>
6798
6799         * po/POTFILES.in: Regenerate.
6800
6801 2011-06-09  Ian Lance Taylor  <iant@google.com>
6802
6803         * script-sections.cc
6804         (Orphan_output_section::set_section_addresses): For a relocatable
6805         link set address to 0.
6806
6807 2011-06-09  Cary Coutant  <ccoutant@google.com>
6808
6809         PR gold/12804
6810         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
6811         used with --compress-debug-sections.
6812         * gold/object.cc (Sized_relobj_file::do_layout): Report
6813         uncompressed size of compressed input sections.
6814
6815 2011-06-08  Cary Coutant  <ccoutant@google.com>
6816
6817         PR gold/12804
6818         * testsuite/two_file_test_2_v1.cc: Change initialization of
6819         v2 to keep it in .data.
6820
6821 2011-06-07  Cary Coutant  <ccoutant@google.com>
6822
6823         * common.cc (Symbol_table::do_allocate_commons_list): Call
6824         gold_fallback.
6825         * errors.cc (Errors::fatal): Adjust call to gold_exit.
6826         (Errors::fallback): New function.
6827         (gold_fallback): New function.
6828         * errors.h (Errors::fallback): New function.
6829         * gold.cc (gold_exit): Change status parameter to enum; adjust
6830         all callers.
6831         (queue_initial_tasks): Call gold_fallback.
6832         * gold.h: Include cstdlib.
6833         (Exit_status): New enum type.
6834         (gold_exit): Change status parameter to enum.
6835         (gold_fallback): New function.
6836         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
6837         (Layout::create_symtab_sections): Likewise.
6838         (Layout::create_shdrs): Likewise.
6839         * main.cc (main): Adjust call to gold_exit.
6840         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
6841         (Output_data_got::add_got_entry_pair): Likewise.
6842         (Output_section::add_input_section): Likewise.
6843         (Output_section::add_output_section_data): Likewise.
6844         (Output_segment::set_section_list_addresses): Likewise.
6845         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
6846
6847 2011-06-07  Cary Coutant  <ccoutant@google.com>
6848
6849         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
6850         for incremental links.
6851         * output.cc (Output_segment::set_section_list_addresses): Remove
6852         FIXME and test for TLS or BSS.
6853
6854 2011-06-07  Cary Coutant  <ccoutant@google.com>
6855
6856         * testsuite/Makefile.am: Add incremental_copy_test,
6857         incremental_common_test_1.
6858         * testsuite/Makefile.in: Regenerate.
6859         * testsuite/common_test_1_v1.c: New source file.
6860         * testsuite/common_test_1_v2.c: New source file.
6861         * testsuite/copy_test_v1.cc: New source file.
6862
6863 2011-06-07  Cary Coutant  <ccoutant@google.com>
6864
6865         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
6866         update, allocate common from bss section's free list.
6867         * incremental-dump.cc (dump_incremental_inputs): Print flag for
6868         linker-defined symbols.
6869         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
6870         Skip GOT and PLT entries that are no longer referenced.
6871         (Output_section_incremental_inputs::write_info_blocks): Mark
6872         linker-defined symbols.
6873         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
6874         * output.cc (Output_section::allocate): New function.
6875         * output.h (Output_section::allocate): New function.
6876         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
6877         linker-defined symbols.
6878         (Symbol::override_base_with_special): Copy is_predefined_ flag.
6879         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
6880         (Symbol::init_base_output_data): Likewise.
6881         (Symbol::init_base_output_segment): Likewise.
6882         (Symbol::init_base_constant): Likewise.
6883         (Sized_symbol::init_output_data): Likewise.
6884         (Sized_symbol::init_output_segment): Likewise.
6885         (Sized_symbol::init_constant): Likewise.
6886         (Symbol_table::do_define_in_output_data): Likewise.
6887         (Symbol_table::do_define_in_output_segment): Likewise.
6888         (Symbol_table::do_define_as_constant): Likewise.
6889         * symtab.h (Symbol::is_predefined): New function.
6890         (Symbol::init_base_output_data): Add is_predefined parameter.
6891         (Symbol::init_base_output_segment): Likewise.
6892         (Symbol::init_base_constant): Likewise.
6893         (Symbol::is_predefined_): New data member.
6894         (Sized_symbol::init_output_data): Add is_predefined parameter.
6895         (Sized_symbol::init_output_segment): Likewise.
6896         (Sized_symbol::init_constant): Likewise.
6897         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
6898
6899 2011-06-07  Cary Coutant  <ccoutant@google.com>
6900
6901         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
6902         instead of emit_copy_reloc.
6903         (Copy_relocs::emit_copy_reloc): Refactor.
6904         (Copy_relocs::make_copy_reloc): New function.
6905         (Copy_relocs::add_copy_reloc): Remove.
6906         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
6907         section.
6908         (Copy_relocs::make_copy_reloc): New function.
6909         (Copy_relocs::add_copy_reloc): Remove.
6910         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
6911         unchanged input files.
6912         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
6913         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
6914         Reserve BSS space for COPY relocations.
6915         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6916         (Output_section_incremental_inputs::write_info_blocks): Record
6917         whether a symbol is copied from a shared object.
6918         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
6919         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
6920         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
6921         (Incremental_input_entry_reader::get_output_symbol_index): Add
6922         is_copy parameter.
6923         (Incremental_binary::emit_copy_relocs): New function.
6924         (Incremental_binary::do_emit_copy_relocs): New function.
6925         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6926         new data member.
6927         (Sized_incremental_binary::add_copy_reloc): New function.
6928         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6929         (Sized_incremental_binary::Copy_reloc): New struct.
6930         (Sized_incremental_binary::Copy_relocs): New typedef.
6931         (Sized_incremental_binary::copy_relocs_): New data member.
6932         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
6933         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
6934         * target.h (Sized_target::emit_copy_reloc): New function.
6935         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
6936
6937 2011-06-02  Cary Coutant  <ccoutant@google.com>
6938
6939         PR gold/12163
6940         * gold/archive.cc (Archive::Archive): Initialize new data member.
6941         (Archive::include_all_members): Return if archive has already been
6942         included.
6943         * gold/archive.h (Archive::include_all_members_): New data member.
6944
6945 2011-06-02  Nick Clifton  <nickc@redhat.com>
6946
6947         * dynobj.h: Fix spelling mistake in comment.
6948         * output.cc: Likewise.
6949
6950 2011-05-31  Doug Kwan  <dougkwan@google.com>
6951             Asier Llano
6952
6953         PR gold/12826
6954         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
6955         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
6956         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
6957         redundant arm_exidx_test.so.
6958         * testsuite/Makefile.in: Regenerate.
6959         (check_SCRIPTS): Add pr12826.sh
6960         (check_DATA): Add pr12826.stdout
6961         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
6962         * testsuite/pr12826.sh: New file.
6963         * testsuite/pr12826_1.s: Ditto.
6964         * testsuite/pr12826_1.s: Ditto.
6965
6966 2011-05-30  Ian Lance Taylor  <iant@google.com>
6967
6968         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
6969         sections.
6970
6971 2011-05-29  Ian Lance Taylor  <iant@google.com>
6972
6973         PR gold/12804
6974         * testsuite/Makefile.am: Use different file name for two_file_test
6975         temporary file for each incremental test.
6976         * testsuite/Makefile.in: Rebuild.
6977
6978 2011-05-29  Ian Lance Taylor  <iant@google.com>
6979
6980         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
6981         binary input file is empty.
6982
6983 2011-05-27  Ian Lance Taylor  <iant@google.com>
6984
6985         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
6986         (ver_test_9.so): Likewise.
6987         * testsuite/Makefile.in: Rebuild.
6988
6989 2011-05-26 Cary Coutant  <ccoutant@google.com>
6990
6991         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
6992         * incremental.cc (Incremental_inputs::report_input_section): Fix
6993         comment, indentation.
6994         (Incremental_inputs::report_comdat_group): New function.
6995         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6996         of data for incremental input file entry.
6997         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
6998         group count, COMDAT group signatures.
6999         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
7000         an unchanged input file.
7001         * incremental.h (Incremental_object_entry::Incremental_object_entry):
7002         Initialize new data member.
7003         (Incremental_object_entry::add_comdat_group): New function.
7004         (Incremental_object_entry::get_comdat_group_count): New function.
7005         (Incremental_object_entry::get_comdat_signature_key): New function.
7006         (Incremental_object_entry::groups_): New data member.
7007         (Incremental_inputs::report_comdat_group): New function.
7008         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
7009         data for incremental input file entry.
7010         (Incremental_input_entry_reader::get_comdat_group_count): New function.
7011         (Incremental_input_entry_reader::get_input_section): Adjust size of
7012         data for incremental input file entry.
7013         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
7014         (Incremental_input_entry_reader::get_comdat_group_signature): New
7015         function.
7016         * object.cc (Sized_relobj::include_section_group): Report kept
7017         COMDAT groups for incremental links.
7018
7019 2011-05-24  David Meyer  <pdox@google.com>
7020
7021         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
7022         with name parameter.  Add found_name parameter.
7023         * fileread.cc (Input_file::find_file): Adjust code accordingly.
7024         * dirsearch.h (class Dirsearch): Update declaration.
7025
7026 2011-05-24  Ian Lance Taylor  <iant@google.com>
7027
7028         * archive.cc (Library_base::should_include_member): Pull in object
7029         from archive if it defines the entry symbol.
7030         * parameters.cc (Parameters::entry): New function.
7031         * parameters.h (class Parameters): Declare entry.
7032         * output.h (class Output_file_header): Remove entry_ field.
7033         * output.cc (Output_file_header::Output_file_header): Remove entry
7034         parameter.  Change all callers.
7035         (Output_file_header::entry): Use parameters->entry.
7036         * gold.cc (queue_middle_tasks): Likewise.
7037         * plugin.cc (Plugin_hook::run): Likewise.
7038
7039 2011-05-24 Cary Coutant  <ccoutant@google.com>
7040
7041         * gold.cc (queue_initial_tasks): Pass incremental base filename
7042         to Output_file::open_base_file; don't print error message.
7043         * incremental-dump.cc (main): Adjust call to
7044         Output_file::open_for_modification.
7045         * incremental-dump.cc (main): Likewise.
7046         * incremental.cc (Incremental_inputs::report_command_line):
7047         Ignore --incremental-base option when comparing command lines.
7048         Ignore parameter when given as separate argument.
7049         * options.h (class General_options): Add --incremental-base.
7050         * output.cc (Output_file::Output_file):
7051         (Output_file::open_base_file): Add base_name and writable parameters;
7052         read base file into new file; print error message here.
7053         (Output_file::map_no_anonymous): Add writable parameter; adjust all
7054         callers.
7055         * output.h (Output_file::open_for_modification): Rename to...
7056         (Output_file::open_base_file): ...this; add base_name and
7057         writable parameters; adjust all callers.
7058         (Output_file::map_no_anonymous): Add writable parameter; adjust all
7059         callers.
7060         * testsuite/Makefile.am (incremental_test_4): Test
7061         --incremental-base.
7062         * testsuite/Makefile.in: Regenerate.
7063
7064 2011-05-24 Cary Coutant  <ccoutant@google.com>
7065
7066         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
7067         incremental_test_4.
7068         * testsuite/Makefile.in: Regenerate.
7069         * testsuite/two_file_test_1_v1.cc: New test source file.
7070         * testsuite/two_file_test_1b_v1.cc: New test source file.
7071         * testsuite/two_file_test_2_v1.cc: New test source file.
7072
7073 2011-05-24 Cary Coutant  <ccoutant@google.com>
7074
7075         * dynobj.h (Dynobj::do_dynobj): New function.
7076         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
7077         flag and soname for shared objects.
7078         * incremental.cc (Incremental_inputs::report_object): Make
7079         either Incremental_object_entry or Incremental_dynobj_entry; add
7080         soname to string table.
7081         (Incremental_inputs::report_input_section): Add assertion.
7082         (Output_section_incremental_inputs::set_final_data_size): Adjust
7083         type of input file entry for shared libraries; adjust size of
7084         shared library info entry.
7085         (Output_section_incremental_inputs::write_input_files): Write
7086         as_needed flag for shared libraries.
7087         (Output_section_incremental_inputs::write_info_blocks): Adjust type
7088         of input file entry for shared libraries; write soname.
7089         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
7090         soname from incremental info.
7091         * incremental.h (enum Incremental_input_flags): Add
7092         INCREMENTAL_INPUT_AS_NEEDED.
7093         (Incremental_input_entry::Incremental_input_entry): Initialize new
7094         data member.
7095         (Incremental_input_entry::set_as_needed): New function.
7096         (Incremental_input_entry::as_needed): New function.
7097         (Incremental_input_entry::do_dynobj_entry): New function.
7098         (Incremental_input_entry::as_needed_): New data member.
7099         (Incremental_object_entry::Incremental_object_entry): Don't check
7100         for shared library.
7101         (Incremental_object_entry::do_type): Likewise.
7102         (class Incremental_dynobj_entry): New class.
7103         (Incremental_input_entry_reader::as_needed): New function.
7104         (Incremental_input_entry_reader::get_soname): New function.
7105         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
7106         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
7107         size of shared library info entry.
7108         * layout.cc (Layout::finish_dynamic_section): Don't test for
7109         incremental link when adding DT_NEEDED entries.
7110         * object.h (Object::Object): Initialize new data member.
7111         (Object::dynobj): New function.
7112         (Object::set_as_needed): New function.
7113         (Object::as_needed): New function.
7114         (Object::do_dynobj): New function.
7115         (Object::as_needed_): New data member.
7116
7117 2011-05-24 Cary Coutant  <ccoutant@google.com>
7118
7119         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
7120         info; adjust display of GOT entries.
7121         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7122         vector of input objects; remove file_status_.
7123         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
7124         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
7125         got_plt reader; call target hooks to reserve GOT entries.
7126         (Output_section_incremental_inputs::set_final_data_size): Adjust size
7127         of input file info header and GOT info entry.
7128         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
7129         relocation info.
7130         (Got_plt_view_info::got_descriptor): Remove.
7131         (Got_plt_view_info::sym_index): New data member.
7132         (Got_plt_view_info::input_index): New data member.
7133         (Local_got_offset_visitor::visit): Write input file index.
7134         (Global_got_offset_visitor::visit): Write 0 for input file index.
7135         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
7136         with sym_index and input_index.
7137         (Output_section_incremental_inputs::write_got_plt): Adjust size of
7138         incremental info GOT entry; replace got_descriptor with input_index.
7139         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
7140         map from input file index to object.
7141         (Sized_relobj_incr::do_layout): Replace direct data member reference
7142         with accessor function.
7143         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
7144         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
7145         Adjust size of input file info header.
7146         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
7147         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
7148         (Incremental_input_entry_reader::get_input_section): Adjust size of
7149         input file info header.
7150         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
7151         of incremental info GOT entry.
7152         (Incremental_got_plt_reader::get_got_desc): Remove.
7153         (Incremental_got_plt_reader::get_got_symndx): New function.
7154         (Incremental_got_plt_reader::get_got_input_index): New function.
7155         (Sized_incremental_binary::Sized_incremental_binary): Remove
7156         file_status_; add input_objects_.
7157         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
7158         (Sized_incremental_binary::set_file_is_unchanged): Remove.
7159         (Sized_incremental_binary::file_is_unchanged): Remove.
7160         (Sized_incremental_binary::set_input_object): New function.
7161         (Sized_incremental_binary::input_object): New function.
7162         (Sized_incremental_binary::file_status_): Remove.
7163         (Sized_incremental_binary::input_objects_): New data member.
7164         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
7165         references.
7166         (Sized_relobj_incr::invalid_address): Move to base class.
7167         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
7168         class.
7169         (Sized_relobj_incr::do_output_section_offset): Likewise.
7170         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
7171         (Sized_relobj_incr::section_offsets_): Likewise.
7172         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
7173         function.
7174         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
7175         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
7176         with accessor function.
7177         (Sized_relobj_file::do_layout): Likewise.
7178         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
7179         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
7180         (Sized_relobj_file::compute_final_local_value): Replace refs to
7181         section_offsets_ with accessor function.
7182         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
7183         * object.h (Relobj::Relobj): Initialize new data members.
7184         (Relobj::add_dyn_reloc): New function.
7185         (Relobj::first_dyn_reloc): New function.
7186         (Relobj::dyn_reloc_count): New function.
7187         (Relobj::first_dyn_reloc_): New data member.
7188         (Relobj::dyn_reloc_count_): New data member.
7189         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
7190         references.
7191         (Sized_relobj::Address): New typedef.
7192         (Sized_relobj::invalid_address): Move here from child class.
7193         (Sized_relobj::Sized_relobj): Initialize new data members.
7194         (Sized_relobj::sized_relobj): New function.
7195         (Sized_relobj::is_output_section_offset_invalid): Move here from
7196         child class.
7197         (Sized_relobj::get_output_section_offset): Likewise.
7198         (Sized_relobj::local_has_got_offset): Likewise.
7199         (Sized_relobj::local_got_offset): Likewise.
7200         (Sized_relobj::set_local_got_offset): Likewise.
7201         (Sized_relobj::do_for_all_local_got_entries): Likewise.
7202         (Sized_relobj::clear_got_offsets): New function.
7203         (Sized_relobj::section_offsets): Move here from child class.
7204         (Sized_relobj::do_output_section_offset): Likewise.
7205         (Sized_relobj::do_set_section_offset): Likewise.
7206         (Sized_relobj::Local_got_offsets): Likewise.
7207         (Sized_relobj::local_got_offsets_): Likewise.
7208         (Sized_relobj::section_offsets_): Likewise.
7209         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
7210         references.
7211         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
7212         class.
7213         (Sized_relobj_file::sized_relobj): New function
7214         (Sized_relobj_file::local_has_got_offset): Move to base class.
7215         (Sized_relobj_file::local_got_offset): Likewise.
7216         (Sized_relobj_file::set_local_got_offset): Likewise.
7217         (Sized_relobj_file::get_output_section_offset): Likewise.
7218         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
7219         (Sized_relobj_file::do_output_section_offset): Likewise.
7220         (Sized_relobj_file::do_set_section_offset): Likewise.
7221         (Sized_relobj_file::Local_got_offsets): Likewise.
7222         (Sized_relobj_file::local_got_offsets_): Likewise.
7223         (Sized_relobj_file::section_offsets_): Likewise.
7224         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
7225         (all constructors).
7226         (set_needs_dynsym_index): Convert relobj to derived class pointer.
7227         (Output_reloc::get_symbol_index): Likewise.
7228         (Output_reloc::local_section_offset): Likewise.
7229         (Output_reloc::get_address): Likewise.
7230         (Output_reloc::symbol_value): Likewise.
7231         (Output_data_got::reserve_slot): Move to class definition.
7232         (Output_data_got::reserve_local): New function.
7233         (Output_data_got::reserve_slot_for_global): Remove.
7234         (Output_data_got::reserve_global): New function.
7235         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
7236         (all constructors, two instantiations).
7237         (Output_reloc::get_relobj): New function (two instantiations).
7238         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
7239         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
7240         (Output_data_reloc::add_global): Adjust type of relobj.
7241         (Output_data_reloc::add_global_relative): Likewise.
7242         (Output_data_reloc::add_symbolless_global_addend): Likewise.
7243         (Output_data_reloc::add_local): Likewise.
7244         (Output_data_reloc::add_local_relative): Likewise.
7245         (Output_data_reloc::add_symbolless_local_addend): Likewise.
7246         (Output_data_reloc::add_local_section): Likewise.
7247         (Output_data_reloc::add_output_section): Likewise.
7248         (Output_data_reloc::add_absolute): Likewise.
7249         (Output_data_reloc::add_target_specific): Likewise.
7250         (Output_data_got::reserve_slot): Move definition here.
7251         (Output_data_got::reserve_local): New function.
7252         (Output_data_got::reserve_global): New function.
7253         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
7254         section_offsets_ with accessor function.
7255         (Sized_relobj_file::write_sections): Likewise.
7256         (Sized_relobj_file::do_relocate_sections): Likewise.
7257         * target.h (Sized_target::reserve_local_got_entry): New function.
7258         (Sized_target::reserve_global_got_entry): New function.
7259         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
7260         (Target_x86_64::reserve_global_got_entry): New function.
7261         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
7262
7263 2011-05-23 Cary Coutant  <ccoutant@google.com>
7264
7265         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
7266         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
7267         bit when checking got_type.
7268         * incremental.cc (Sized_incremental_binary::setup_readers):
7269         Store symbol table and string table locations; initialize bit vector
7270         of file status flags.
7271         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
7272         unchanged files.
7273         (Sized_incremental_binary::do_process_got_plt): New function.
7274         (Sized_incremental_binary::get_symtab_view): Use stored locations.
7275         (Output_section_incremental_inputs::set_final_data_size): Record
7276         file index for each input file.
7277         (Output_section_incremental_inputs::write_got_plt): Store file index
7278         instead of input entry offset for each GOT entry.
7279         * incremental.h
7280         (Incremental_input_entry::Incremental_input_entry): Initialize new
7281         data member.
7282         (Incremental_input_entry::set_offset): Store file index.
7283         (Incremental_input_entry::get_file_index): New function.
7284         (Incremental_input_entry::file_index_): New data member.
7285         (Incremental_binary::process_got_plt): New function.
7286         (Incremental_binary::do_process_got_plt): New function.
7287         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7288         data members.
7289         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
7290         (Sized_incremental_binary::set_file_is_unchanged): New function.
7291         (Sized_incremental_binary::file_is_unchanged): New function.
7292         (Sized_incremental_binary::do_process_got_plt): New function.
7293         (Sized_incremental_binary::file_status_): New data member.
7294         (Sized_incremental_binary::main_symtab_loc_): New data member.
7295         (Sized_incremental_binary::main_strtab_loc_): New data member.
7296         * output.cc (Output_data_got::Got_entry::write): Add case
7297         RESERVED_CODE.
7298         (Output_data_got::add_global): Call add_got_entry.
7299         (Output_data_got::add_global_plt): Likewise.
7300         (Output_data_got::add_global_with_rel): Likewise.
7301         (Output_data_got::add_global_with_rela): Likewise.
7302         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
7303         (Output_data_got::add_global_pair_with_rela): Likewise.
7304         (Output_data_got::add_local): Call add_got_entry.
7305         (Output_data_got::add_local_plt): Likewise.
7306         (Output_data_got::add_local_with_rel): Likewise.
7307         (Output_data_got::add_local_with_rela): Likewise.
7308         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
7309         (Output_data_got::add_local_pair_with_rela): Likewise.
7310         (Output_data_got::reserve_slot): New function.
7311         (Output_data_got::reserve_slot_for_global): New function.
7312         (Output_data_got::add_got_entry): New function.
7313         (Output_data_got::add_got_entry_pair): New function.
7314         (Output_section::add_output_section_data): Edit FIXME.
7315         * output.h
7316         (Output_section_data_build::Output_section_data_build): New
7317         constructor with size parameter.
7318         (Output_data_space::Output_data_space): Likewise.
7319         (Output_data_got::Output_data_got): Initialize new data member; new
7320         constructor with size parameter.
7321         (Output_data_got::add_constant): Call add_got_entry.
7322         (Output_data_got::reserve_slot): New function.
7323         (Output_data_got::reserve_slot_for_global): New function.
7324         (class Output_data_got::Got_entry): Add RESERVED_CODE.
7325         (Output_data_got::add_got_entry): New function.
7326         (Output_data_got::add_got_entry_pair): New function.
7327         (Output_data_got::free_list_): New data member.
7328         * target.h (Sized_target::init_got_plt_for_update): New function.
7329         (Sized_target::register_global_plt_entry): New function.
7330         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
7331         Initialize new data member; call init; add constructor with PLT count.
7332         (Output_data_plt_x86_64::init): New function.
7333         (Output_data_plt_x86_64::add_relocation): New function.
7334         (Output_data_plt_x86_64::reserve_slot): New function.
7335         (Output_data_plt_x86_64::free_list_): New data member.
7336         (Target_x86_64::init_got_plt_for_update): New function.
7337         (Target_x86_64::register_global_plt_entry): New function.
7338         (Output_data_plt_x86_64::add_entry): Allocate from free list for
7339         incremental updates.
7340         (Output_data_plt_x86_64::add_relocation): New function.
7341         * testsuite/object_unittest.cc (Object_test): Set default options.
7342
7343 2011-05-16  Ian Lance Taylor  <iant@google.com>
7344
7345         * options.h (class General_options): Make -i a synonym for -r.
7346
7347 2011-05-16  Ian Lance Taylor  <iant@google.com>
7348
7349         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
7350
7351 2011-05-10 Cary Coutant  <ccoutant@google.com>
7352
7353         * object.cc (Sized_relobj::do_count_local_symbols): Check for
7354         strip_all (-s).
7355
7356 2011-05-06  Ian Lance Taylor  <iant@google.com>
7357
7358         * layout.cc (Layout::layout): If the output section flags change,
7359         update the ordering.
7360
7361 2011-04-25 Cary Coutant  <ccoutant@google.com>
7362
7363         * incremental-dump.cc (dump_incremental_inputs): Print local
7364         symbol info for each input file.
7365         * incremental.cc
7366         (Output_section_incremental_inputs::set_final_data_size): Add local
7367         symbol info to input file entries in incremental info.
7368         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7369         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
7370         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
7371         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
7372         implementation.
7373         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
7374         (Sized_incr_relobj::do_relocate): Write the local symbols.
7375         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
7376         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
7377         Adjust size of input file header.
7378         (Incremental_inputs_reader::get_local_symbol_offset): New function.
7379         (Incremental_inputs_reader::get_local_symbol_count): New function.
7380         (Incremental_inputs_reader::get_input_section): Adjust size of input
7381         file header.
7382         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
7383         (Sized_incr_relobj::This): New typedef.
7384         (Sized_incr_relobj::sym_size): New const data member.
7385         (Sized_incr_relobj::Local_symbol): New struct.
7386         (Sized_incr_relobj::do_output_local_symbol_count): New function.
7387         (Sized_incr_relobj::do_local_symbol_offset): New function.
7388         (Sized_incr_relobj::local_symbol_count_): New data member.
7389         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
7390         (Sized_incr_relobj::local_symbol_index_): New data member.
7391         (Sized_incr_relobj::local_symbol_offset_): New data member.
7392         (Sized_incr_relobj::local_dynsym_offset_): New data member.
7393         (Sized_incr_relobj::local_symbols_): New data member.
7394         * object.h (Relobj::output_local_symbol_count): New function.
7395         (Relobj::local_symbol_offset): New function.
7396         (Relobj::do_output_local_symbol_count): New function.
7397         (Relobj::do_local_symbol_offset): New function.
7398         (Sized_relobj::do_output_local_symbol_count): New function.
7399         (Sized_relobj::do_local_symbol_offset): New function.
7400
7401 2011-04-22  Vladimir Simonov  <sv@sw.ru>
7402
7403         * descriptors.cc (set_close_on_exec): New function.
7404         (Descriptors::open): Use set_close_on_exec.
7405         * output.cc (S_ISLNK): Define if not defined.
7406
7407 2011-04-22 Cary Coutant  <ccoutant@google.com>
7408
7409         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7410         global symbol map.
7411         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7412         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
7413         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
7414         relocations.
7415         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
7416         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
7417         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
7418         * incremental.h
7419         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
7420         function.
7421         (Incremental_binary::apply_incremental_relocs): New function.
7422         (Incremental_binary::do_apply_incremental_relocs): New function.
7423         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7424         data member.
7425         (Sized_incremental_binary::add_global_symbol): New function.
7426         (Sized_incremental_binary::global_symbol): New function.
7427         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7428         (Sized_incremental_binary::symbol_map_): New data member.
7429         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
7430         * target.h (Sized_target::apply_relocation): New function.
7431         * target-reloc.h (apply_relocation): New function.
7432         * x86_64.cc (Target_x86_64::apply_relocation): New function.
7433
7434 2011-04-22  Doug Kwan  <dougkwan@google.com>
7435
7436         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
7437         flag of a SHT_ARM_EXIDX section.
7438         * testsuite/Makefile.am (arm_exidx_test): New test rules.
7439         * testsuite/Makefile.in: Regenerate.
7440         * testsuite/arm_exidx_test.s: New file.
7441         * testsuite/arm_exidx_test.sh: Same.
7442
7443 2011-04-20 Cary Coutant  <ccoutant@google.com>
7444
7445         PR gold/12689
7446         * archive.h (Incremental_archive_entry::Archive_member):
7447         Initialize arg_serial_ (second constructor).
7448
7449 2011-04-17  Ian Lance Taylor  <iant@google.com>
7450
7451         * object.cc (Relocate_info::location): Simplify location string.
7452         * errors.cc (Errors::error_at_location): Don't print program
7453         name.
7454         (Errors::warning_at_location): Likewise.
7455         (Errors::undefined_symbol): Likewise.
7456         * testsuite/debug_msg.sh: Update accordingly.
7457
7458 2011-04-14 Cary Coutant  <ccoutant@google.com>
7459
7460         * gold/layout.cc (Layout::symtab_section_offset): New function.
7461         * gold/layout.h (Layout::symtab_section_offset): New function.
7462         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
7463
7464 2011-04-12  Ian Lance Taylor  <iant@google.com>
7465
7466         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
7467         with MREMAP_MAYMOVE.
7468         * output.h (class Output_file): Add map_is_allocated_ field.
7469         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
7470         not available, provide stubs.  If mremap is not available, #define
7471         it to gold_mremap.
7472         (MREMAP_MAYMOVE): Define if not defined.
7473         (Output_file::Output_file): Initialize map_is_allocated_.
7474         (Output_file::resize): Check map_is_allocated_.
7475         (Output_file::map_anonymous): If mmap fails, use malloc.
7476         (Output_file::unmap): Don't do anything for an anonymous map.
7477         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
7478         is not available, provide stubs.
7479         (File_read::View::~View): Use free rather than delete[].
7480         (File_read::make_view): Use malloc rather than new[].  If mmap
7481         fails, use malloc.
7482         (File_read::find_or_make_view): Use malloc rather than new[].
7483         * gold.h: Remove HAVE_REMAP code.
7484         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
7485         exists.  Rename mremap to gold_mremap.  If mmap is not available
7486         don't do anything.
7487         * configure, config.in: Rebuild.
7488
7489 2011-04-11  Ian Lance Taylor  <iant@google.com>
7490
7491         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
7492         initialize local variable v.
7493
7494 2011-04-11  Cary Coutant  <ccoutant@google.com>
7495
7496         * archive.cc (Archive::include_member): Adjust call to
7497         report_object.
7498         (Add_archive_symbols::run): Track argument serial numbers.
7499         (Lib_group::include_member): Likewise.
7500         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
7501         * archive.h (Incremental_archive_entry::Archive_member):
7502         Initialize arg_serial_.
7503         (Archive_member::arg_serial_): New data member.
7504         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
7505         (Sized_dynobj::do_add_symbols): Track symbols when doing an
7506         incremental link.
7507         (Sized_dynobj::do_for_all_local_got_entries): New function.
7508         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
7509         function.
7510         * fileread.cc (get_mtime): New function.
7511         * fileread.h (get_mtime): New function.
7512         * gold.cc (queue_initial_tasks): Check for incremental update.
7513         (process_incremental_input): New function.
7514         (queue_middle_tasks): Don't force valid target for incremental
7515         update.
7516         * incremental-dump.cc (find_input_containing_global): Adjust
7517         size of symbol info entry.
7518         (dump_incremental_inputs): Dump argument serial number and
7519         in_system_directory flag; bias shndx by 1; print symbol names
7520         when dumping per-file symbol lists; use new symbol info readers.
7521         * incremental.cc
7522         (Output_section_incremental_inputs:update_data_size): New function.
7523         (Sized_incremental_binary::setup_readers): Setup input readers
7524         for each input file; build maps for files added from libraries
7525         and scripts.
7526         (Sized_incremental_binary::check_input_args): New function.
7527         (Sized_incremental_binary::do_check_inputs): Build map of argument
7528         serial numbers to input arguments.
7529         (Sized_incremental_binary::do_file_has_changed): Rename
7530         do_file_is_unchanged to this; compare file modification times.
7531         (Sized_incremental_binary::do_init_layout): New function.
7532         (Sized_incremental_binary::do_reserve_layout): New function.
7533         (Sized_incremental_binary::do_get_input_reader): Remove.
7534         (Sized_incremental_binary::get_symtab_view): New function.
7535         (Incremental_checker::can_incrementally_link_output_file): Remove.
7536         (Incremental_inputs::report_command_line): Exclude --debug options.
7537         (Incremental_inputs::report_archive_begin): Add parameter; track
7538         argument serial numbers; don't put input file entry for archive
7539         before archive members.
7540         (Incremental_inputs::report_archive_end): Put input file entry
7541         for archive after archive members.
7542         (Incremental_inputs::report_object): Add parameter; track argument
7543         serial numbers and in_system_directory flag.
7544         (Incremental_inputs::report_script): Add parameter; track argument
7545         serial numbers.
7546         (Output_section_incremental_inputs::set_final_data_size): Adjust
7547         size of symbol info entry; check for forwarding symbols.
7548         (Output_section_incremental_inputs::write_input_files): Write
7549         in_system_directory flag and argument serial number.
7550         (Output_section_incremental_inputs::write_info_blocks): Map section
7551         indices between incremental info and original input file; store
7552         input section index for each symbol.
7553         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
7554         change operator() to visit().
7555         (class Global_got_offset_visitor): Likewise.
7556         (class Global_symbol_visitor_got_plt):
7557         (Output_section_incremental_inputs::write_got_plt): Use new visitor
7558         classes.
7559         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
7560         (Sized_incr_relobj::do_read_symbols): New function.
7561         (Sized_incr_relobj::do_layout): New function.
7562         (Sized_incr_relobj::do_layout_deferred_sections): New function.
7563         (Sized_incr_relobj::do_add_symbols): New function.
7564         (Sized_incr_relobj::do_should_include_member): New function.
7565         (Sized_incr_relobj::do_for_all_global_symbols): New function.
7566         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
7567         (Sized_incr_relobj::do_section_size): New function.
7568         (Sized_incr_relobj::do_section_name): New function.
7569         (Sized_incr_relobj::do_section_contents): New function.
7570         (Sized_incr_relobj::do_section_flags): New function.
7571         (Sized_incr_relobj::do_section_entsize): New function.
7572         (Sized_incr_relobj::do_section_address): New function.
7573         (Sized_incr_relobj::do_section_type): New function.
7574         (Sized_incr_relobj::do_section_link): New function.
7575         (Sized_incr_relobj::do_section_info): New function.
7576         (Sized_incr_relobj::do_section_addralign): New function.
7577         (Sized_incr_relobj::do_initialize_xindex): New function.
7578         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
7579         (Sized_incr_relobj::do_read_relocs): New function.
7580         (Sized_incr_relobj::do_gc_process_relocs): New function.
7581         (Sized_incr_relobj::do_scan_relocs): New function.
7582         (Sized_incr_relobj::do_count_local_symbols): New function.
7583         (Sized_incr_relobj::do_finalize_local_symbols): New function.
7584         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
7585         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
7586         (Sized_incr_relobj::do_relocate): New function.
7587         (Sized_incr_relobj::do_set_section_offset): New function.
7588         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
7589         (Sized_incr_dynobj::do_read_symbols): New function.
7590         (Sized_incr_dynobj::do_layout): New function.
7591         (Sized_incr_dynobj::do_add_symbols): New function.
7592         (Sized_incr_dynobj::do_should_include_member): New function.
7593         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
7594         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
7595         (Sized_incr_dynobj::do_section_size): New function.
7596         (Sized_incr_dynobj::do_section_name): New function.
7597         (Sized_incr_dynobj::do_section_contents): New function.
7598         (Sized_incr_dynobj::do_section_flags): New function.
7599         (Sized_incr_dynobj::do_section_entsize): New function.
7600         (Sized_incr_dynobj::do_section_address): New function.
7601         (Sized_incr_dynobj::do_section_type): New function.
7602         (Sized_incr_dynobj::do_section_link): New function.
7603         (Sized_incr_dynobj::do_section_info): New function.
7604         (Sized_incr_dynobj::do_section_addralign): New function.
7605         (Sized_incr_dynobj::do_initialize_xindex): New function.
7606         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
7607         (make_sized_incremental_object): New function.
7608         (Incremental_library::copy_unused_symbols): New function.
7609         (Incremental_library::do_for_all_unused_symbols): New function.
7610         * incremental.h (enum Incremental_input_flags): New type.
7611         (class Incremental_checker): Remove.
7612         (Incremental_input_entry::Incremental_input_entry): Add argument
7613         serial number.
7614         (Incremental_input_entry::arg_serial): New function.
7615         (Incremental_input_entry::set_is_in_system_directory): New function.
7616         (Incremental_input_entry::is_in_system_directory): New function.
7617         (Incremental_input_entry::arg_serial_): New data member.
7618         (Incremental_input_entry::is_in_system_directory_): New data member.
7619         (class Script_info): Move here from script.h.
7620         (Script_info::Script_info): Add filename parameter.
7621         (Script_info::filename): New function.
7622         (Script_info::filename_): New data member.
7623         (Incremental_script_entry::Incremental_script_entry): Add argument
7624         serial number.
7625         (Incremental_object_entry::Incremental_object_entry): Likewise.
7626         (Incremental_object_entry::add_input_section): Build list of input
7627         sections with map to original shndx.
7628         (Incremental_object_entry::get_input_section_index): New function.
7629         (Incremental_object_entry::shndx_): New data member.
7630         (Incremental_object_entry::name_key_): Rename; adjust all refs.
7631         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
7632         (Incremental_archive_entry::Incremental_archive_entry): Add argument
7633         serial number.
7634         (Incremental_inputs::report_archive_begin): Likewise.
7635         (Incremental_inputs::report_object): Likewise.
7636         (Incremental_inputs::report_script): Likewise.
7637         (class Incremental_global_symbol_reader): New class.
7638         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
7639         and store flags and input file type.
7640         (Incremental_input_entry_reader::arg_serial): New function.
7641         (Incremental_input_entry_reader::type): Extract type from flags.
7642         (Incremental_input_entry_reader::is_in_system_directory): New function.
7643         (Incremental_input_entry_reader::get_input_section_count): Call
7644         accessor function for type.
7645         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
7646         function for type; adjust size of global symbol entry.
7647         (Incremental_input_entry_reader::get_global_symbol_count): Call
7648         accessor function for type.
7649         (Incremental_input_entry_reader::get_object_count): Likewise.
7650         (Incremental_input_entry_reader::get_object_offset): Likewise.
7651         (Incremental_input_entry_reader::get_member_count): Likewise.
7652         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
7653         (Incremental_input_entry_reader::get_member_offset): Likewise.
7654         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
7655         (Incremental_input_entry_reader::Global_symbol_info): Remove.
7656         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
7657         (Incremental_input_entry_reader::get_global_symbol_reader): New
7658         function.
7659         (Incremental_input_entry_reader::get_output_symbol_index): New
7660         function.
7661         (Incremental_input_entry_reader::type_): Remove.
7662         (Incremental_input_entry_reader::flags_): New data member.
7663         (Incremental_inputs_reader::input_file_offset): New function.
7664         (Incremental_inputs_reader::input_file_index): New function.
7665         (Incremental_inputs_reader::input_file): Call input_file_offset.
7666         (Incremental_inputs_reader::input_file_at_offset): New function.
7667         (Incremental_relocs_reader::get_r_type): Reformat.
7668         (Incremental_relocs_reader::get_r_shndx): Reformat.
7669         (Incremental_relocs_reader::get_r_offset): Reformat.
7670         (Incremental_relocs_reader::data): New function.
7671         (Incremental_binary::Incremental_binary): Initialize new data members.
7672         (Incremental_binary::check_inputs): Add cmdline parameter.
7673         (Incremental_binary::file_is_unchanged): Remove.
7674         (Input_reader::arg_serial): New function.
7675         (Input_reader::get_unused_symbol_count): New function.
7676         (Input_reader::get_unused_symbol): New function.
7677         (Input_reader::do_arg_serial): New function.
7678         (Input_reader::do_get_unused_symbol_count): New function.
7679         (Input_reader::do_get_unused_symbol): New function.
7680         (Incremental_binary::input_file_count): New function.
7681         (Incremental_binary::get_input_reader): Change signature to use
7682         index instead of filename.
7683         (Incremental_binary::file_has_changed): New function.
7684         (Incremental_binary::get_input_argument): New function.
7685         (Incremental_binary::get_library): New function.
7686         (Incremental_binary::get_script_info): New function.
7687         (Incremental_binary::init_layout): New function.
7688         (Incremental_binary::reserve_layout): New function.
7689         (Incremental_binary::output_file): New function.
7690         (Incremental_binary::do_check_inputs): New function.
7691         (Incremental_binary::do_file_is_unchanged): Remove.
7692         (Incremental_binary::do_file_has_changed): New function.
7693         (Incremental_binary::do_init_layout): New function.
7694         (Incremental_binary::do_reserve_layout): New function.
7695         (Incremental_binary::do_input_file_count): New function.
7696         (Incremental_binary::do_get_input_reader): Change signature.
7697         (Incremental_binary::input_args_map_): New data member.
7698         (Incremental_binary::library_map_): New data member.
7699         (Incremental_binary::script_map_): New data member.
7700         (Sized_incremental_binary::Sized_incremental_binary): Initialize
7701         new data members.
7702         (Sized_incremental_binary::output_section): New function.
7703         (Sized_incremental_binary::inputs_reader): Add const.
7704         (Sized_incremental_binary::symtab_reader): Add const.
7705         (Sized_incremental_binary::relocs_reader): Add const.
7706         (Sized_incremental_binary::got_plt_reader): Add const.
7707         (Sized_incremental_binary::get_symtab_view): New function.
7708         (Sized_incremental_binary::Inputs_reader): New typedef.
7709         (Sized_incremental_binary::Input_entry_reader): New typedef.
7710         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
7711         (Sized_incremental_binary::do_file_is_unchanged): Remove.
7712         (Sized_incremental_binary::do_file_has_changed): New function.
7713         (Sized_incremental_binary::do_init_layout): New function.
7714         (Sized_incremental_binary::do_reserve_layout): New function.
7715         (Sized_input_reader::Inputs_reader): Remove.
7716         (Sized_input_reader::Input_entry_reader): Remove.
7717         (Sized_input_reader::do_arg_serial): New function.
7718         (Sized_input_reader::do_get_unused_symbol_count): New function.
7719         (Sized_input_reader::do_get_unused_symbol): New function.
7720         (Sized_incremental_binary::do_input_file_count): New function.
7721         (Sized_incremental_binary::do_get_input_reader): Change signature;
7722         use index instead of filename.
7723         (Sized_incremental_binary::section_map_): New data member.
7724         (Sized_incremental_binary::input_entry_readers_): New data member.
7725         (class Sized_incr_relobj): New class.
7726         (class Sized_incr_dynobj): New class.
7727         (make_sized_incremental_object): New function.
7728         (class Incremental_library): New class.
7729         * layout.cc (Free_list::num_lists): New static data member.
7730         (Free_list::num_nodes): New static data member.
7731         (Free_list::num_removes): New static data member.
7732         (Free_list::num_remove_visits): New static data member.
7733         (Free_list::num_allocates): New static data member.
7734         (Free_list::num_allocate_visits): New static data member.
7735         (Free_list::init): New function.
7736         (Free_list::remove): New function.
7737         (Free_list::allocate): New function.
7738         (Free_list::dump): New function.
7739         (Free_list::print_stats): New function.
7740         (Layout_task_runner::run): Resize output file for incremental updates.
7741         (Layout::Layout): Initialize new data members.
7742         (Layout::set_incremental_base): New function.
7743         (Layout::init_fixed_output_section): New function.
7744         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
7745         incremental updates.
7746         (Layout::create_gold_note): Do not create gold note section for
7747         incremental updates.
7748         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
7749         for incremental updates.
7750         (Layout::set_section_offsets): For incremental updates, allocate space
7751         from free list.
7752         (Layout::create_symtab_sections): Layout with offsets relative to
7753         start of section; for incremental updates, allocate space from free
7754         list.
7755         (Layout::create_shdrs): For incremental updates, allocate space from
7756         free list.
7757         (Layout::finish_dynamic_section): For incremental updates, do not
7758         check --as-needed (fixed in subsequent patch).
7759         * layout.h (class Free_list): New class.
7760         (Layout::set_incremental_base): New function.
7761         (Layout::incremental_base): New function.
7762         (Layout::init_fixed_output_section): New function.
7763         (Layout::allocate): New function.
7764         (Layout::incremental_base_): New data member.
7765         (Layout::free_list_): New data member.
7766         * main.cc (main): Print Free_list statistics.
7767         * object.cc (Relobj::finalize_incremental_relocs): Add
7768         clear_counts parameter; clear counts only when clear_counts is set.
7769         (Sized_relobj::Sized_relobj): Initialize new base class.
7770         (Sized_relobj::do_layout): Don't report special sections.
7771         (Sized_relobj::do_for_all_local_got_entries): New function.
7772         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
7773         symtab_off to all symbol table offsets.
7774         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
7775         * object.h (class Got_offset_list): Move to top of file.
7776         (Object::Object): Allow case where input_file == NULL.
7777         (Object::~Object): Likewise.
7778         (Object::input_file): Assert that input_file != NULL.
7779         (Object::lock): Allow case where input_file == NULL.
7780         (Object::unlock): Likewise.
7781         (Object::is_locked): Likewise.
7782         (Object::token): Likewise.
7783         (Object::release): Likewise.
7784         (Object::is_incremental): New function.
7785         (Object::get_mtime): New function.
7786         (Object::for_all_local_got_entries): New function.
7787         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
7788         (Object::set_is_in_system_directory): New function.
7789         (Object::is_in_system_directory): New function.
7790         (Object::do_is_incremental): New function.
7791         (Object::do_get_mtime): New function.
7792         (Object::do_for_all_local_got_entries): New function.
7793         (Object::is_in_system_directory_): New data member.
7794         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
7795         (class Sized_relobj_base): New class.
7796         (class Sized_relobj): Derive from Sized_relobj_base.
7797         (class Sized_relobj::Symbols): Redeclare from base class.
7798         (class Sized_relobj::local_got_offset_list): Remove.
7799         (class Sized_relobj::Output_sections): Redeclare from base class.
7800         (class Sized_relobj::do_for_all_local_got_entries): New function.
7801         (class Sized_relobj::write_local_symbols): Add offset parameter.
7802         (class Sized_relobj::local_symbol_offset_): Update comment.
7803         (class Sized_relobj::local_dynsym_offset_): Update comment.
7804         * options.cc (Input_arguments::add_file): Remove const.
7805         * options.h (Input_file_argument::Input_file_argument):
7806         Initialize arg_serial_ (all constructors).
7807         (Input_file_argument::set_arg_serial): New function.
7808         (Input_file_argument::arg_serial): New function.
7809         (Input_file_argument::arg_serial_): New data member.
7810         (Input_arguments::Input_arguments): Initialize file_count_.
7811         (Input_arguments::add_file): Remove const.
7812         (Input_arguments::number_of_input_files): New function.
7813         (Input_arguments::file_count_): New data member.
7814         (Command_line::number_of_input_files): Call
7815         Input_arguments::number_of_input_files.
7816         * output.cc (Output_segment_headers::Output_segment_headers):
7817         Set current size.
7818         (Output_section::Input_section::current_data_size): New function.
7819         (Output_section::Output_section): Initialize new data members.
7820         (Output_section::add_input_section): Don't do merge sections for
7821         an incremental link; allocate space from free list for an
7822         incremental update.
7823         (Output_section::add_output_section_data): Allocate space from
7824         free list for an incremental update.
7825         (Output_section::update_data_size): New function.
7826         (Output_section::set_fixed_layout): New function.
7827         (Output_section::reserve): New function.
7828         (Output_segment::set_section_addresses): Remove const.
7829         (Output_segment::set_section_list_addresses): Remove const; allocate
7830         space from free list for an incremental update.
7831         (Output_segment::set_offset): Adjust size of RELRO segment for an
7832         incremental update.
7833         * output.h (Output_data::current_data_size): Move here from
7834         child classes.
7835         (Output_data::pre_finalize_data_size): New function.
7836         (Output_data::update_data_size): New function.
7837         (Output_section_headers::update_data_size): new function.
7838         (Output_section_data_build::current_data_size): Move to Output_data.
7839         (Output_data_strtab::update_data_size): New function.
7840         (Output_section::current_data_size): Move to Output_data.
7841         (Output_section::set_fixed_layout): New function.
7842         (Output_section::has_fixed_layout): New function.
7843         (Output_section::reserve): New function.
7844         (Output_section::update_data_size): New function.
7845         (Output_section::has_fixed_layout_): New data member.
7846         (Output_section::free_list_): New data member.
7847         (Output_segment::set_section_addresses): Remove const.
7848         (Output_segment::set_section_list_addresses): Remove const.
7849         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
7850         New function.
7851         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
7852         New function.
7853         * readsyms.cc (Read_symbols::do_read_symbols): Add library
7854         parameter when calling Add_symbols constructor; store argument
7855         serial number for members of a lib group.
7856         (Add_symbols::locks): Allow case where token == NULL.
7857         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
7858         (Read_member::~Read_member): New function.
7859         (Read_member::is_runnable): New function.
7860         (Read_member::locks): New function.
7861         (Read_member::run): New function.
7862         (Check_script::~Check_script): New function.
7863         (Check_script::is_runnable): New function.
7864         (Check_script::locks): New function.
7865         (Check_script::run): New function.
7866         (Check_library::~Check_library): New function.
7867         (Check_library::is_runnable): New function.
7868         (Check_library::locks): New function.
7869         (Check_library::run): New function.
7870         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
7871         (Add_symbols::library_): New data member.
7872         (class Read_member): New class.
7873         (class Check_script): New class.
7874         (class Check_library): New class.
7875         * reloc.cc (Read_relocs::is_runnable): Allow case where
7876         token == NULL.
7877         (Read_relocs::locks): Likewise.
7878         (Scan_relocs::locks): Likewise.
7879         (Relocate_task::locks): Likewise.
7880         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
7881         to clear counters.
7882         (Sized_relobj::incremental_relocs_scan): Fix comment.
7883         (Sized_relobj::do_relocate): Pass output file offset to
7884         write_local_symbols.
7885         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
7886         from class declaration.
7887         * script.cc (read_input_script): Allocate Script_info; pass
7888         argument serial number to report_script.
7889         * script.h (class Script_info): Move to incremental.h.
7890         * symtab.cc (Symbol_table::add_from_incrobj): New function.
7891         * symtab.h (Symbol_table::add_from_incrobj): New function.
7892         (Symbol_table::set_file_offset): New function.
7893
7894 2011-04-05  Cary Coutant  <ccoutant@google.com>
7895
7896         * incremental-dump.cc (dump_incremental_inputs): Change signature
7897         to take a Sized_incremental_binary; change caller.  Use readers
7898         in Sized_incremental_binary.
7899         * incremental.cc
7900         (Sized_incremental_binary::find_incremental_inputs_sections):
7901         Rename do_find_incremental_inputs_sections to this.
7902         (Sized_incremental_binary::setup_readers): New function.
7903         (Sized_incremental_binary::do_check_inputs): Check
7904         has_incremental_info_ flag; move setup code to setup_readers;
7905         use input readers.
7906         (Sized_incremental_binary::do_file_is_unchanged): New function.
7907         (Sized_incremental_binary::do_get_input_reader): New function.
7908         * incremental.h (class Incremental_binary): Move to end of file.
7909         (Incremental_binary::file_is_unchanged): New function.
7910         (Incremental_binary::do_file_is_unchanged): New function.
7911         (Incremental_binary::Input_reader): New class.
7912         (Incremental_binary::get_input_reader): New function.
7913         (class Sized_incremental_binary): Move to end of file.
7914         (Sized_incremental_binary::Sized_incremental_binary): Setup the
7915         input section reader classes.
7916         (Sized_incremental_binary::has_incremental_info): New function.
7917         (Sized_incremental_binary::inputs_reader): New function.
7918         (Sized_incremental_binary::symtab_reader): New function.
7919         (Sized_incremental_binary::relocs_reader): New function.
7920         (Sized_incremental_binary::got_plt_reader): New function.
7921         (Sized_incremental_binary::do_file_is_unchanged): New function.
7922         (Sized_incremental_binary::Sized_input_reader): New class.
7923         (Sized_incremental_binary::get_input_reader): New function.
7924         (Sized_incremental_binary::find_incremental_inputs_sections):
7925         Rename do_find_incremental_inputs_sections to this.
7926         (Sized_incremental_binary::setup_readers): New function.
7927         (Sized_incremental_binary::has_incremental_info_): New data member.
7928         (Sized_incremental_binary::inputs_reader_): New data member.
7929         (Sized_incremental_binary::symtab_reader_): New data member.
7930         (Sized_incremental_binary::relocs_reader_): New data member.
7931         (Sized_incremental_binary::got_plt_reader_): New data member.
7932         (Sized_incremental_binary::current_input_file_): New data member.
7933
7934 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
7935
7936         PR gold/12640
7937         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
7938         violation.
7939
7940 2011-03-30  Cary Coutant  <ccoutant@google.com>
7941
7942         * archive.cc (Archive::include_member): Adjust call to report_object.
7943         (Add_archive_symbols::run): Add script_info to call to
7944         report_archive_begin.
7945         (Lib_group::include_member): Adjust call to report_object.
7946         (Add_lib_group_symbols::run): Adjust call to report_object.
7947         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
7948         blocks.  Add object count for script input files.
7949         * incremental.cc (Incremental_inputs::report_archive_begin): Add
7950         script_info parameter; change all callers.
7951         (Incremental_inputs::report_object): Add script_info parameter;
7952         change all callers.
7953         (Incremental_inputs::report_script): Store backpointer to
7954         incremental info entry.
7955         (Output_section_incremental_inputs::set_final_data_size): Record
7956         additional information for scripts.
7957         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7958         * incremental.h (Incremental_script_entry::add_object): New function.
7959         (Incremental_script_entry::get_object_count): New function.
7960         (Incremental_script_entry::get_object): New function.
7961         (Incremental_script_entry::objects_): New data member; adjust
7962         constructor.
7963         (Incremental_inputs::report_archive_begin): Add script_info parameter.
7964         (Incremental_inputs::report_object): Add script_info parameter.
7965         (Incremental_inputs_reader::get_object_count): New function.
7966         (Incremental_inputs_reader::get_object_offset): New function.
7967         * options.cc (Input_arguments::add_file): Return reference to
7968         new input argument.
7969         * options.h (Input_argument::set_script_info): New function.
7970         (Input_argument::script_info): New function.
7971         (Input_argument::script_info_): New data member; adjust all
7972         constructors.
7973         (Input_file_group::add_file): Return reference to new input argument.
7974         (Input_file_lib::add_file): Likewise.
7975         (Input_arguments::add_file): Likewise.
7976         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
7977         * script.cc (Parser_closure::Parser_closure): Add script_info
7978         parameter; adjust all callers.
7979         (Parser_closure::script_info): New function.
7980         (Parser_closure::script_info_): New data member.
7981         (read_input_script): Report scripts earlier to incremental info.
7982         (script_add_file): Set script_info in Input_argument.
7983         (script_add_library): Likewise.
7984         * script.h (Script_options::Script_info): Rewrite class.
7985
7986 2011-03-29  Cary Coutant  <ccoutant@google.com>
7987
7988         * archive.cc (Library_base::should_include_member): Move
7989         method here from class Archive.
7990         (Archive::Archive): Initialize base class.
7991         (Archive::should_include_member): Move to base class.
7992         (Archive::do_for_all_unused_symbols): New function.
7993         (Add_archive_symbols::run): Remove redundant access to
7994         incremental_inputs.
7995         (Lib_group::Lib_group): Initialize base class.
7996         (Lib_group::do_filename): New function.
7997         (Lib_group::include_member): Pass pointer to Lib_group to
7998         report_object.
7999         (Lib_group::do_for_all_unused_symbols): New function.
8000         (Add_lib_group_symbols::run): Report archive information for
8001         incremental links.
8002         * archive.h (class Library_base): New base class.
8003         (class Archive): Derive from Library_base.
8004         (Archive::filename): Move to base class.
8005         (Archive::set_incremental_info): Likewise.
8006         (Archive::incremental_info): Likewise.
8007         (Archive::Should_include): Likewise.
8008         (Archive::should_include_member): Likewise.
8009         (Archive::Armap_entry): Remove.
8010         (Archive::Unused_symbol_iterator): Remove.
8011         (Archive::unused_symbols_begin): Remove.
8012         (Archive::unused_symbols_end): Remove.
8013         (Archive::do_filename): New function.
8014         (Archive::do_get_mtime): New function.
8015         (Archive::do_for_all_unused_symbols): New function.
8016         (Archive::task_): Move to base class.
8017         (Archive::incremental_info_): Likewise.
8018         (class Lib_group): Derive from Library_base.
8019         (Lib_group::do_filename): New function.
8020         (Lib_group::do_get_mtime): New function.
8021         (Lib_group::do_for_all_unused_symbols): New function.
8022         (Lib_group::task_): Move to base class.
8023         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
8024         function.
8025         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
8026         function.
8027         * incremental.cc (Incremental_inputs::report_archive_begin):
8028         Use Library_base; call library's get_mtime; add incremental inputs
8029         entry before members.
8030         (class Unused_symbol_visitor): New class.
8031         (Incremental_inputs::report_archive_end): Use Library_base; use
8032         visitor class to record unused symbols; don't add incremental inputs
8033         entry after members.
8034         (Incremental_inputs::report_object): Use Library_base.
8035         * incremental.h
8036         (Incremental_archive_entry::Incremental_archive_entry): Remove
8037         unused Archive parameter.
8038         (Incremental_inputs::report_archive_begin): Use Library_base.
8039         (Incremental_inputs::report_archive_end): Likewise.
8040         (Incremental_inputs::report_object): Likewise.
8041         * object.cc (Sized_relobj::do_for_all_global_symbols): New
8042         function.
8043         * object.h (Object::for_all_global_symbols): New function.
8044         (Object::do_for_all_global_symbols): New function.
8045         (Sized_relobj::do_for_all_global_symbols): New function.
8046         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
8047         function.
8048         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
8049         function.
8050
8051 2011-03-27  Ian Lance Taylor  <iant@google.com>
8052
8053         * archive.cc (Archive::interpret_header): Return -1 if something
8054         goes wrong.  Change callers accordingly.
8055
8056 2011-03-25  Cary Coutant  <ccoutant@google.com>
8057
8058         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
8059         * testsuite/Makefile.in: Regenerate.
8060
8061 2011-03-23  Rafael Ăvila de EspĂ­ndola <respindola@mozilla.com>
8062
8063         * plugin.cc (get_view): New.
8064         (Plugin::load): Pass get_view to the plugin.
8065         (Plugin_manager::get_view): New.
8066
8067 2011-03-21  Ian Lance Taylor  <iant@google.com>
8068
8069         * testsuite/final_layout.sh: Rewrite to not use dc.
8070         * testsuite/relro_test.sh: Fail if dc is not present.
8071
8072 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
8073
8074         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
8075         Change == to -eq.
8076         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
8077         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
8078         Change == to -eq.
8079         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
8080         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
8081
8082 2011-03-14  Ian Lance Taylor  <iant@google.com>
8083
8084         * script-sections.cc (Sort_output_sections::script_compare):
8085         Rename from is_before, change return type.
8086         (Sort_output_sections::operator()): Adjust accordingly.
8087
8088 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
8089
8090         PR gold/12572
8091         * testsuite/odr_violation2.cc: Add comment to make all error line
8092         numbers double digits.
8093         * testsuite/debug_msg.sh: Adjust expected errors.
8094
8095 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
8096
8097         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
8098         but mark earlier ones as non-canonical
8099         (offset_to_iterator): Update search target and example
8100         (do_addr2line): Return extra lines in a vector*
8101         (format_file_lineno): Extract from do_addr2line
8102         (one_addr2line): Add vector* out-param
8103         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
8104         when a lineno entry appeared last for its instruction
8105         (Dwarf_line_info): Add vector* out-param
8106         * object.cc (Relocate_info): Pass NULL for the vector* out-param
8107         * symtab.cc (Odr_violation_compare): Include the lineno in the
8108         comparison again.
8109         (linenos_from_loc): New. Combine the canonical line for an
8110         address with its other lines.
8111         (True_if_intersect): New. Helper functor to make
8112         std::set_intersection a query.
8113         (detect_odr_violations): Compare sets of lines instead of just
8114         one line for each function. This became less deterministic, but
8115         has fewer false positives.
8116         * symtab.h: Declarations.
8117         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
8118         mix an optimized and non-optimized object in the same binary
8119         (odr_violation2.so): Same.
8120         * testsuite/Makefile.in: Regenerate from Makefile.am.
8121         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
8122         * testsuite/debug_msg.sh: Update line numbers and add
8123         assertions.
8124         * testsuite/odr_violation1.cc: Use OdrDerived, in a
8125         non-optimized context.
8126         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
8127         isn't inlined, and use OdrDerived in an optimized context.
8128         * testsuite/odr_header1.h: Defines OdrDerived, where
8129         optimization will change the
8130         first-instruction-in-the-destructor's file and line number.
8131         * testsuite/odr_header2.h: Defines OdrBase.
8132
8133 2011-03-09  Ian Lance Taylor  <iant@google.com>
8134
8135         * fileread.cc (File_read::clear_views): Don't delete the whole
8136         file view.
8137
8138 2011-03-08  Ian Lance Taylor  <iant@google.com>
8139
8140         PR gold/12525
8141         * fileread.cc: #include <climits>.
8142         (GOLD_IOV_MAX): Define.
8143         (File_read::read_multiple): Limit number of entries by iov_max.
8144         * fileread.h (class File_read): Always set max_readv_entries to
8145         128.
8146
8147 2011-03-07  Ian Lance Taylor  <iant@google.com>
8148
8149         PR gold/12525
8150         * options.h (class General_options): Add -dy and -dn.
8151
8152 2011-03-02  Cary Coutant  <ccoutant@google.com>
8153
8154         * testsuite/script_test_9.t: Add TLS segment.
8155
8156 2011-03-02  Simon Baldwin  <simonb@google.com>
8157
8158         * configure.ac: Add check for gnu_indirect_function support in
8159         the toolchain building binutils.
8160         * configure: Rebuild.
8161
8162 2011-02-18  Rafael Ăvila de EspĂ­ndola <respindola@mozilla.com>
8163
8164         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
8165         plugin only symbols.
8166         (Symbol_table::sized_finalize_symbol) Mark symbol only present
8167         in plugin files as not needed in the symbol table.
8168
8169 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
8170
8171         * output.cc (Output_section::add_input_section): Delay fill
8172         generation for section ordering.
8173
8174 2011-02-09  Ian Lance Taylor  <iant@google.com>
8175
8176         PR gold/12316
8177         * object.h (class Sized_relobj): Remove clear_local_symbols.
8178         * reloc.cc (Sized_relobj::do_relocate): Don't call
8179         clear_local_symbols.
8180
8181 2011-02-08  Rafael Ăvila de EspĂ­ndola <respindola@mozilla.com>
8182
8183         * plugin.cc (is_visible_from_outside): Return true for symbols
8184         in the -u option.
8185
8186 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
8187
8188         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
8189         filename.
8190
8191 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
8192
8193         * icf.h (is_section_foldable_candidate): Change type of parameter
8194         to std::string.
8195         * icf.cc (Icf::find_identical_sections): Change type of local variable
8196         section_name to be std::string.
8197         (is_function_ctor_or_dtor): Change type of parameter to std::string.
8198
8199 2011-01-25  Ian Lance Taylor  <iant@google.com>
8200
8201         * script.cc (script_add_extern): Rewrite to use
8202         add_symbol_reference.
8203
8204 2011-01-25  Doug Kwan  <dougkwan@google.com>
8205
8206         * icf.cc (get_section_contents): Always lock section's object.
8207
8208 2011-01-24  Ian Lance Taylor  <iant@google.com>
8209
8210         * options.h (class General_options): Accept
8211         --no-detect-odr-violations.
8212
8213 2011-01-24  Ian Lance Taylor  <iant@google.com>
8214
8215         * version.cc (version_string): Bump to 1.11.
8216
8217 2011-01-24  Ian Lance Taylor  <iant@google.com>
8218
8219         * plugin.cc (class Plugin_rescan): Define new class.
8220         (Plugin_manager::claim_file): Set any_claimed_.
8221         (Plugin_manager::save_archive): New function.
8222         (Plugin_manager::save_input_group): New function.
8223         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
8224         necessary.
8225         (Plugin_manager::new_undefined_symbol): New function.
8226         (Plugin_manager::rescan): New function.
8227         (Plugin_manager::rescannable_defines): New function.
8228         (Plugin_manager::add_input_file): Set any_added_.
8229         * plugin.h (class Plugin_manager): define new fields rescannable_,
8230         undefined_symbols_, any_claimed_, and any_added_.  Declare
8231         Plugin_rescan as friend.  Declare new functions.
8232         (Plugin_manager::Rescannable): Define type.
8233         (Plugin_manager::Rescannable_list): Define type.
8234         (Plugin_manager::Undefined_symbol_list): Define type.
8235         (Plugin_manager::Plugin_manager): Initialize new fields.
8236         * archive.cc (Archive::defines_symbol): New function.
8237         (Add_archive_symbols::run): Pass archive to plugins if any.
8238         * archive.h (class Archive): Declare defines_symbol.
8239         * readsyms.cc (Input_group::~Input_group): New function.
8240         (Finish_group::run): Pass input_group to plugins if any.
8241         * readsyms.h (class Input_group): Declare destructor.
8242         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
8243         any.
8244
8245 2011-01-10  Ian Lance Taylor  <iant@google.com>
8246
8247         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
8248         section as relro.
8249         (Layout::set_segment_offsets): Reset increase_relro before calling
8250         set_section_addresses a second time.
8251
8252 2011-01-04  Cary Coutant  <ccoutant@google.com>
8253
8254         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
8255         sections before NOBITS sections.
8256
8257 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
8258
8259         * version.cc (print_version): Update copyright to 2011.
8260
8261 2010-12-23  Cary Coutant  <ccoutant@google.com>
8262
8263         * output.h (Output_data_reloc::add_output_section): Pass OD instead
8264         of OS to this->add.  Add OD parameter to second form of the function.
8265
8266 2010-12-20  Ian Lance Taylor  <iant@google.com>
8267
8268         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
8269         second of two consecutive entries with same offset.
8270
8271 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8272
8273         * testsuite/Makefile.am (ifuncmain2static_LDADD)
8274         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
8275         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
8276         to avoid unneeded links against $(LDADD).
8277         * testsuite/Makefile.in: Regenerate.
8278
8279 2010-12-15  Ian Lance Taylor  <iant@google.com>
8280
8281         PR gold/12324
8282         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
8283         for R_X86_64_32 and R_X86_64_PC32.
8284         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
8285         ver_matching_def_pic.o.
8286         (ver_matching_def_pic.o): New target.
8287
8288 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8289
8290         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
8291         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
8292         Move definition before File_read::View member definitions.
8293         (File_read::View::~View): Initialize and hold lock before
8294         updating current_mapped_bytes.
8295
8296 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8297
8298         * dwarf_reader.cc: Remove outdated comment.
8299         * gold-threads.cc: Fix typo in error message.
8300         * archive.cc: Fix typos in comments.
8301         * archive.h: Likewise.
8302         * arm-reloc-property.cc: Likewise.
8303         * arm-reloc-property.h: Likewise.
8304         * arm-reloc.def: Likewise.
8305         * arm.cc: Likewise.
8306         * attributes.h: Likewise.
8307         * cref.cc: Likewise.
8308         * ehframe.cc: Likewise.
8309         * fileread.h: Likewise.
8310         * gold.h: Likewise.
8311         * i386.cc: Likewise.
8312         * icf.cc: Likewise.
8313         * incremental.h: Likewise.
8314         * int_encoding.cc: Likewise.
8315         * layout.h: Likewise.
8316         * main.cc: Likewise.
8317         * merge.h: Likewise.
8318         * object.cc: Likewise.
8319         * object.h: Likewise.
8320         * options.cc: Likewise.
8321         * readsyms.cc: Likewise.
8322         * reduced_debug_output.cc: Likewise.
8323         * reloc.cc: Likewise.
8324         * script-sections.cc: Likewise.
8325         * sparc.cc: Likewise.
8326         * symtab.h: Likewise.
8327         * target-reloc.h: Likewise.
8328         * target.cc: Likewise.
8329         * target.h: Likewise.
8330         * timer.cc: Likewise.
8331         * timer.h: Likewise.
8332         * x86_64.cc: Likewise.
8333
8334 2010-12-09  Cary Coutant  <ccoutant@google.com>
8335
8336         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
8337         stack.
8338         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
8339         parameter; change all callers.
8340         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
8341         * options.h (warn_execstack): New option.
8342
8343 2010-12-07  Doug Kwan  <dougkwan@google.com>
8344
8345         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
8346         like function call relocations.
8347
8348 2010-12-07  Ian Lance Taylor  <iant@google.com>
8349
8350         * archive.cc (Archive::get_elf_object_for_member): Permit
8351         punconfigured to be NULL.
8352         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
8353         (Archive::include_member): Pass NULL to get_elf_object_for_member
8354         if we searched for the archive and this is the first included
8355         object.
8356
8357 2010-12-01  Ian Lance Taylor  <iant@google.com>
8358
8359         * dwarf_reader.h (class Sized_dwarf_line_info): Add
8360         track_relocs_type_ field.
8361         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8362         Set track_relocs_type_.
8363         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
8364         contents when using RELA relocs.
8365         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
8366         reloc_map_.
8367         * reloc.cc (Track_relocs::next_addend): New function.
8368         * reloc.h (class Track_relocs): Declare next_addend.
8369
8370 2010-12-01  Ian Lance Taylor  <iant@google.com>
8371
8372         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
8373         virtual destructor.
8374
8375 2010-12-01  Ian Lance Taylor  <iant@google.com>
8376
8377         * README: Update compilers known to work and fail.
8378
8379 2010-11-23  Matthias Klose  <doko@ubuntu.com>
8380
8381         * configure.in: For --enable-gold, handle value `default' instead of
8382         `both*'.  Always install ld as ld.bfd, install as ld if gold is
8383         not the default.
8384         * configure: Regenerate.
8385
8386 2010-11-18  Doug Kwan  <dougkwan@google.com>
8387
8388         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
8389         and right_alignment to be zero.  Store result alignment only if it is
8390         greater than existing alignment.
8391
8392 2010-11-16  Cary Coutant  <ccoutant@google.com>
8393
8394         PR gold/12220
8395         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8396         Check for ".zdebug_line".
8397
8398 2010-11-16  Doug Kwan  <dougkwan@google.com>
8399             Cary Coutant  <ccoutant@google.com>
8400
8401         * output.h (Output_segment::set_section_addresses): Pass increase_relro
8402         by reference; adjust all callers.
8403         * output.cc (Output_segment::set_section_addresses): Adjust references
8404         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
8405         list is empty.
8406         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
8407         end at page boundary.
8408
8409 2010-11-16  Cary Coutant  <ccoutant@google.com>
8410
8411         PR gold/12220
8412         * layout.cc (Layout::choose_output_section): Transform names of
8413         compressed sections even when using a script with a SECTIONS clause.
8414         (Layout::output_section_name): Remove code to transform
8415         compressed debug section names.
8416         * output.cc (Output_section::add_input_section): Use uncompressed
8417         section size when tracking input sections.
8418
8419 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
8420
8421         * symtab.h (Symbol::NON_PIC_REF): Remove.
8422         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
8423         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
8424         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
8425         (Symbol::use_plt_offset): Take a flags argument and pass it
8426         directly to needs_dynamic_reloc.  Restrict check for undefined
8427         weak symbols to function calls.
8428         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
8429         (Target_arm::Scan::global): Use it.
8430         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
8431         (Target_arm::Relocate::relocate): Likewise.
8432         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
8433         parameter with an r_type parameter.  Use get_reference_flags
8434         to get the flags.
8435         (Target_arm::Relocate::relocate): Update accordingly.
8436         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
8437         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
8438         (Target_i386::Scan::global): Likewise.
8439         (Target_i386::Relocate::relocate): Likewise.
8440         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
8441         parameter with an r_type parameter.  Use get_reference_flags
8442         to get the flags.
8443         (Target_i386::Relocate::relocate): Update accordingly.
8444         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
8445         (Target_powerpc::Scan::global): Use it.
8446         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
8447         (Target_powerpc::Relocate::relocate): Likewise.
8448         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
8449         (Target_sparc::Scan::global): Use it.
8450         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
8451         (Target_sparc::Relocate::relocate): Likewise.
8452         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
8453         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
8454         (Target_x86_64::Scan::global): Likewise.
8455         (Target_x86_64::Relocate::relocate): Likewise.
8456
8457 2010-11-08  Doug Kwan  <dougkwan@google.com>
8458             Cary Coutant  <ccoutant@google.com>
8459
8460         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
8461         (Arm_exidx_merge_section::section_contents_): New data member.
8462         (Arm_input_section::Arm_input_section): Initialize original_contents_.
8463         (Arm_input_section::~Arm_input_section): De-allocate memory.
8464         (Arm_input_section::original_contents_): New data member.
8465         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
8466         in parameters instead of calling Object::section_contents without
8467         locking.
8468         (Arm_output_section::group_section): New parameter TASK.  Pass it
8469         to callees that need locking objects.
8470         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
8471         to lock EXIDX input sections.  Fix a formatting issue.  Call
8472         Arm_exidx_merged_section::build_contents to create merged section
8473         contents.
8474         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
8475         to lock object of stub table owner.
8476         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
8477         TEXT_SIZE to initialize data member TEXT_SIZE_.
8478         (Arm_exidx_input_section::addralign): Fix typo in comment.
8479         (Arm_exidx_input_section::text_size): New method.
8480         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
8481         that require locking objects.  Lock objects before scanning for stubs
8482         and updating local symbols.
8483         (Arm_input_section<big_endian>::init): Copy contents of original
8484         input section.
8485         (Arm_input_section<big_endian>::do_write): Use saved contents of
8486         original input section instead of calling Object::section_contents
8487         without locking.
8488         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
8489         size without calling Object::section_size().
8490         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
8491         for size.  Allocate a buffer for merged EXIDX entries.
8492         (Arm_exidx_merged_section::build_contents): New method.
8493         (Arm_exidx_merged_section::do_write): Move merge section contents
8494         building code to Arm_exidx_merged_section::build_contetns.  Write
8495         out contetns in buffer instead of building it on the fly.
8496         (Arm_relobj::make_exidx_input_section): Also pass text section size
8497         to Arm_exidx_input_section constructor.
8498         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
8499         (Arm_dynobj::do_read_symbols): Fix memory leak.
8500         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
8501         * target.h: (class Task): Add forward declaration.
8502         (Target::relax): Add new parameter TASK and pass it to
8503         Target::do_relax().
8504         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
8505
8506 2010-11-05  Cary Coutant  <ccoutant@google.com>
8507
8508         PR gold/10708
8509         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
8510         object when reading from the file.
8511         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
8512         second layout pass.
8513         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
8514         when reading section contents.
8515         (get_section_contents): Likewise.
8516         (icf::find_identical_sections): Likewise.
8517         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
8518         object when reading from the file.
8519         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
8520         the object when doing deferred section layout.
8521
8522 2010-11-03  Nick Clifton  <nickc@redhat.com>
8523
8524         PR gold/12001
8525         * script.h (class Symbol_assignment: name): New member.  Returns
8526         the name of the symbol.
8527         * scrfipt.cc (Script_options::is_pending_assignment): New member.
8528         Returns true if the given symbol name is on the list of
8529         assignments wating to be processed.
8530         * archive.cc (should_incldue_member): If the symbol is undefined,
8531         check to see if it is on the list of symbols pending assignment.
8532
8533 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
8534
8535         * script-sections.cc (Script_sections::find_memory_region): Check
8536         for a NULL output section pointer.
8537
8538 2010-10-29  Doug Kwan  <dougkwan@google.com>
8539
8540         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
8541         Output_section::add_relaxed_input_section.
8542         * output.cc (Output_section::add_relaxed_input_section): Add new
8543         arguments LAYOUT and NAME.  Set section order index.
8544         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8545         Copy section order index.
8546         * output.h (Output_section::add_relaxed_input_section): Add new
8547         arguments LAYOUT and NAME.
8548
8549 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8550
8551         * testsuite/Makefile.am: Move gcctestdir/ld rule to
8552         NATIVE_OR_CROSS_LINKER.
8553         * testsuite/Makefile.in: Regenerate.
8554
8555 2010-10-20  Doug Kwan  <dougkwan@google.com>
8556
8557         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
8558         without SHF_LINK_ORDER flags.
8559         * layout.cc (Layout::choose_output_section): Do not filter
8560         SHF_LINK_ORDER flag in a relocatable link.
8561
8562 2010-10-17  Cary Coutant  <ccoutant@google.com>
8563
8564         * output.h (Output_segment::set_section_addresses): Change function
8565         signature.  Update all callers.
8566         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
8567         sections.
8568         (Output_segment::set_section_addresses): Align after last TLS
8569         section.  Add padding before last relro section instead of after.
8570
8571 2010-10-17  Doug Kwan  <dougkwan@google.com>
8572
8573         * gold/arm.cc (Target_arm::got_section): Use correct order and set
8574         GOT output section to be writable.
8575
8576 2010-10-14  Cary Coutant  <ccoutant@google.com>
8577
8578         * debug.h (DEBUG_INCREMENTAL): New flag.
8579         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
8580         * gold.cc (queue_initial_tasks): Check parameters for incremental link
8581         mode.
8582         * incremental.cc (report_command_line): Ignore all forms of
8583         --incremental.
8584         * layout.cc (Layout::Layout): Check parameters for incremental link
8585         mode.
8586         * options.cc (General_options::parse_incremental): New function.
8587         (General_options::parse_no_incremental): New function.
8588         (General_options::parse_incremental_full): New function.
8589         (General_options::parse_incremental_update): New function.
8590         (General_options::incremental_mode_): New data member.
8591         (General_options::finalize): Check incremental_mode_.
8592         * options.h (General_options): Update help text for --incremental.
8593         Add --no-incremental, --incremental-full, --incremental-update.
8594         (General_options::Incremental_mode): New enum type.
8595         (General_options::incremental_mode): New function.
8596         (General_options::incremental_mode_): New data member.
8597         * parameters.cc (Parameters::incremental_mode_): New data member.
8598         (Parameters::set_options): Set incremental_mode_.
8599         (Parameters::set_incremental_full): New function.
8600         (Parameters::incremental): New function.
8601         (Parameters::incremental_update): New function.
8602         (set_parameters_incremental_full): New function.
8603         * parameters.h (Parameters::set_incremental_full): New function.
8604         (Parameters::incremental): New function.
8605         (Parameters::incremental_update): New function.
8606         (Parameters::incremental_mode_): New data member.
8607         (set_parameters_incremental_full): New function.
8608         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
8609         incremental link mode.
8610         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
8611         (Sized_relobj::do_relocate_sections): Likewise.
8612         * testsuite/Makefile.am (incremental_test): Use --incremental-full
8613         option.
8614         * testsuite/Makefile.in: Regenerate.
8615         * testsuite/incremental_test.sh: Filter all forms of --incremental.
8616
8617 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8618
8619         * script-sections.h (class Script_sections): Make
8620         Sections_elements typedef public.
8621         * script-sections.cc (class Sort_output_sections): Add elements_
8622         field.  Add constructor which sets it; change all callers.
8623         (Sort_output_sections::is_before): New function.
8624         (Sort_output_sections::operator()): Call is_before.
8625         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
8626         conditional.
8627         * testsuite/script_test_10.sh: New test. Test script section
8628         order.
8629         * testsuite/script_test_10.t: Likewise.
8630         * testsuite/script_test_10.s: Likewise.
8631         * testsuite/Makefile.am: Wrap the cross linker tests and the
8632         common tests into NATIVE_OR_CROSS_LINKER.
8633         (check_SCRIPTS): Add script_test_10.sh.
8634         (check_DATA): Add script_test_10.stdout.
8635         (script_test_10.o, script_test_10): New targets.
8636         (script_test_10.stdout): New target.
8637         * configure, testsuite/Makefile.in: Regenerate.
8638
8639 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8640
8641         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
8642         error for the deprecated relocations.
8643         (Target_arm::Scan::global): Likewise.
8644         (Target_arm::Relocate::relocate): Likewise.
8645
8646 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
8647
8648         * fileread.cc (Input_file::find_file): Initialize *found_name
8649         and *namep when using the fallback search for case 4.
8650
8651 2010-10-11  Cary Coutant  <ccoutant@google.com>
8652
8653         * options.h (class General_options): Redefine -z lazy as an alias for
8654         the negation of -z now.
8655
8656 2010-10-11  Ian Lance Taylor  <iant@google.com>
8657
8658         * resolve.cc (symbol_to_bits): Report the value of the unsupported
8659         binding.
8660
8661 2010-10-06  Nick Clifton  <nickc@redhat.com>
8662
8663         * script-sections.cc(class Memory_region): Remove
8664         current_lma_offset_ field.  Rename current_vma_offset_ to
8665         current_offset_.  Add last_section_ field.
8666         (Memory_region::get_current_vma_address): Rename to
8667         get_current_address.
8668         (Memory_region::get_current_lma_address): Delete.
8669         (Memory_region::increment_vma_offset): Rename to
8670         increment_offset.
8671         (Memory_region::increment_lma_offset): Delete.
8672         (Memory_region::attributes_compatible): New method.  Returns
8673         true if the provided section is compatible with the region.
8674         (Memory_region::get_last_section): New method.  Returns the last
8675         section to use the region.
8676         (Memory_region::set_last_section): New method.  Stores the last
8677         section to use the region.
8678         (Script_sections::block_in_region): New method.  Returns true if
8679         a block of memory is contained within a region.
8680         (Script_sections::find_memory_region): New method.  Locates a
8681         memory region to be used to set a VMA or LMA address.
8682         (Output_section_definition::set_section_addresses): Add code to
8683         check for addresses set by memory regions.
8684         (Output_segment::set_section_addresses): Remove memory region
8685         walking code.
8686         (Script_sections::create_segment): Add a warning if a header
8687         segment is created outside of any region.
8688         * script-sections.h (class Script_sections): Add prototypes for
8689         find_memory_region and block_in_region methods.
8690         * testsuite/memory_test.s: Use .long instead of .word.
8691         * testsuite/memory_test.t: Add some more output sections.
8692         * testsuite/memory_test.sh: Update expected output.
8693
8694 2010-10-02  Doug Kwan  <dougkwan@google.com>
8695
8696         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
8697         defintion to symtab.h
8698         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
8699         declaration to defintion.
8700
8701 2010-10-01  Nick Clifton  <nickc@redhat.com>
8702
8703         * expression.cc (eval): Replace dummy argument with NULL.
8704         (eval_maybe_dot): Check for a NULL result section pointer.
8705         (Symbol_expression::value): Likewise.
8706         (Dot_expression::value): Likewise.
8707         (BINARY_EXPRESSION): Likewise.
8708         (Max_expression::value): Likewise.
8709         (Min_expression::value): Likewise.
8710         (Absolute_expression::value): Likewise.
8711         (Addr_expression::value_from_output_section): Likewise.
8712         (Loaddddr_expression::value_from_output_section): Likewise.
8713         (Segment_start_expression::value): Likewise.
8714         * script-sections.cc
8715         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
8716         argument with NULL.
8717         (Sections_elememt_dot_assignment::set_section_addresses):
8718         Likewise.
8719         (Output_data_expression::do_write_to_buffer): Likewise.
8720         (Output_section_definition::finalize_symbols): Likewise.
8721         (Output_section_definition::set_section_addresses): Likewise.
8722
8723 2010-09-30  Doug Kwan  <dougkwan@google.com>
8724
8725         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
8726
8727 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
8728
8729         * target.h (Target::can_icf_inline_merge_sections): New virtual
8730         function.
8731         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
8732         virtual function.
8733         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
8734         virtual function.
8735         * icf.cc (get_section_contents): Inline merge sections only when
8736         target allows it.
8737
8738 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8739
8740         * configure: Regenerate.
8741
8742 2010-09-17  Ian Lance Taylor  <iant@google.com>
8743
8744         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
8745         * testsuite/Makefile.am (memory_test.o): New target.
8746         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
8747         memory_test.t.
8748         * testsuite/Makefile.in: Rebuild.
8749
8750 2010-09-17  Doug Kwan  <dougkwan@google.com>
8751
8752         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
8753         defintion if relocation uses GOT entries of the symbol.
8754         * testsuite/icf_safe_test.sh: Fix test.
8755         * testsuite/icf_safe_so_test.sh: Fix test.
8756
8757 2010-09-16  Cary Coutant  <ccoutant@google.com>
8758
8759         * script_sections.cc (class Memory_region): Remove "NULL" from
8760         vector initializations.
8761
8762 2010-09-15  Cary Coutant  <ccoutant@google.com>
8763
8764         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
8765         Resolve forwarding symbols.
8766
8767 2010-09-15  Doug Kwan  <dougkwan@google.com>
8768
8769         * gold/testsuite/script_test_3.t: Add ARM special sections.
8770         * gold/testsuite/script_test_4.t: Same.
8771         * gold/testsuite/script_test_5.t: Same.
8772         * gold/testsuite/script_test_6.t: Same.
8773         * gold/testsuite/script_test_7.t: Same.
8774         * gold/testsuite/script_test_7.t: Same.
8775         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
8776
8777 2010-09-14  Cary Coutant  <ccoutant@google.com>
8778
8779         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
8780         (Target_x86_64::Relocate::relocate_tls): Replace check for
8781         saw_tls_block_reloc_ with test for executable section.
8782
8783 2010-09-12  Cary Coutant  <ccoutant@google.com>
8784
8785         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
8786         position-independent executables to shared libraries need dynamic
8787         relocations.
8788         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
8789         position-independent executables.
8790         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
8791         * testsuite/Makefile.in: Regenerate.
8792
8793 2010-09-10  Nick Clifton  <nickc@redhat.com>
8794
8795         PR gold/11997
8796         * testsuite/memory_test.t: Discard any sections that are not
8797         needed.
8798
8799 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
8800
8801         PR gold/11996
8802         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8803         "This::" to work around a bug in gcc 4.2.
8804
8805         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
8806
8807 2010-09-09  Rafael Espindola  <espindola@google.com>
8808
8809         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
8810         sections with different PF_X flags in the same segment.
8811         (Layout::find_first_load_seg): Search all segments to find the first
8812         one.
8813         * options.h (rosegment): New.
8814
8815 2010-09-08  Rafael Espindola  <espindola@google.com>
8816
8817         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
8818
8819 2010-09-08  Doug Kwan  <dougkwan@google.com>
8820
8821         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
8822         (Arm_relobj::do_relocate_sections): Add new parameter for output
8823         file to match the parent.
8824         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
8825         of local symbols instead of input values.  Update code to track
8826         changes in gold::relocate_section.
8827         * object.cc (Sized_relobj::compute_final_local_value): New methods.
8828         (Sized_relobj::compute_final_local_value_internal): New methods.
8829         (Sized_relobj::do_finalize_local_symbols): Move code from loop
8830         body into private version of Sized_relobj::compute_final_local_value.
8831         Call the inline method.
8832         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
8833         merged symbol value if there is one.
8834         (Symbol_value::has_output_value): New method defintiion.
8835         (Sized_relobj::Compute_final_local_value_status): New enum type.
8836         (Sized_relobj::compute_final_local_value): New methods.
8837         (Sized_relobj::compute_final_local_value_internal): New methods.
8838         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
8839         and arm_cortex_a8.sh.
8840         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
8841         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
8842         New tests.
8843         * Makefile.in: Regenerate.
8844         * testsuite/arm_bl_out_of_range.s: Update test.
8845         * testsuite/thumb_bl_out_of_range.s: Ditto.
8846         * testsuite/thumb_blx_out_of_range.s: Ditto.
8847         * testsuite/arm_branch_out_of_range.sh: New file.
8848         * testsuite/arm_cortex_a8.sh: Ditto.
8849         * testsuite/arm_cortex_a8_b.s: Ditto.
8850         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
8851         * testsuite/arm_cortex_a8_b_local.s: Ditto.
8852         * testsuite/arm_cortex_a8_bl.s: Ditto.
8853         * testsuite/arm_cortex_a8_blx.s: Ditto.
8854         * testsuite/arm_cortex_a8_local.s: Ditto.
8855         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
8856         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
8857
8858 2010-09-08  Rafael Espindola  <espindola@google.com>
8859
8860         * Makefile.am (memory_test.stdout): Run readelf with -W.
8861         * Makefile.in: Regenerate.
8862         * testsuite/memory_test.sh: Make the regexps accept both 32 and
8863         64 bit output.
8864
8865 2010-09-08  Rafael Espindola  <espindola@google.com>
8866
8867         * script-sections.cc (Script_sections::add_memory_region): Convert
8868         field precision to int.
8869         * script.cc (script_set_section_region, script_set_section_region):
8870         Convert field precision to int.
8871
8872 2010-09-08  Rafael Espindola  <espindola@google.com>
8873
8874         * arm.cc (do_finalize_sections): Create the __exidx_start and
8875         __exdix_end symbols even when the section is missing.
8876
8877 2010-09-08  Nick Clifton  <nickc@redhat.com>
8878
8879         * README: Remove claim that MEMORY is not supported.
8880         * expression.cc (script_exp_function_origin)
8881         (script_exp_function_length): Move from here to ...
8882         * script.cc: ... here.
8883         (script_set_section_region, script_add_memory)
8884         (script_parse_memory_attr, script_include_directive): New
8885         functions.
8886         * script-sections.cc
8887         (class Memory_region): New class.
8888         (class Output_section_definition): Add set_memory_region,
8889         set_section_vma, set_section_lma and get_section_name methods.
8890         (class Script_Sections): Add add_memory_region,
8891         find_memory_region, find_memory_region_origin,
8892         find_memory_region_length and set_memory_region methods.
8893         Have set_section_addresses method walk the list of set memory
8894         regions.
8895         Extend the print methos to display memory regions.
8896         * script-sections.h: Add prototypes for new methods.
8897         Add enum for MEMORY region attributes.
8898         * yyscript.y: Add support for parsing MEMORY regions.
8899         * script-c.h: Add prototypes for new functions.
8900         * testsuite/Makefile.am: Add test of MEMORY region functionality.
8901         * testsuite/Makefile.in: Regenerate.
8902         * testsuite/memory_test.sh: New script.
8903         * testsuite/memory_test.s: New assembler source file.
8904         * testsuite/memory_test.t: New linker script.
8905
8906 2010-08-27  Doug Kwan  <dougkwan@google.com>
8907
8908         * gold/resolve.cc (Symbol_table::should_override): Let a weak
8909         reference override an existing dynamic weak reference.
8910         * testsuite/Makefile.am: Add new test dyn_weak_ref.
8911         * testsuite/Makefile.in: Regenerate.
8912         * testsuite/dyn_weak_ref.sh: New file.
8913         * testsuite/dyn_weak_ref_1.c: Ditto.
8914         * testsuite/dyn_weak_ref_2.c: Ditto.
8915
8916 2010-08-27  Ian Lance Taylor  <iant@google.com>
8917
8918         * incremental.h (class Incremental_input_entry): Add virtual
8919         destructor.
8920
8921 2010-08-27  Ian Lance Taylor  <iant@google.com>
8922
8923         * testsuite/start_lib_test_3.c: Mark t3 as used.
8924
8925 2010-08-27  Nick Clifton  <nickc@redhat.com>
8926
8927         * options.cc (version_script): Fix small typo in previous
8928         whitespace tidyup.
8929
8930 2010-08-25  Nick Clifton  <nickc@redhat.com>
8931
8932         * archive.cc: Formatting fixes: Remove whitespace between
8933         typename and following asterisk.  Remove whitespace between
8934         function name and opening parenthesis.
8935         * archive.h: Likewise.
8936         * arm.cc: Likewise.
8937         * attributes.cc: Likewise.
8938         * attributes.h: Likewise.
8939         * common.cc: Likewise.
8940         * copy-relocs.cc: Likewise.
8941         * dirsearch.h: Likewise.
8942         * dynobj.cc: Likewise.
8943         * ehframe.cc: Likewise.
8944         * ehframe.h: Likewise.
8945         * expression.cc: Likewise.
8946         * fileread.cc: Likewise.
8947         * fileread.h: Likewise.
8948         * gc.h: Likewise.
8949         * gold-threads.cc: Likewise.
8950         * gold.cc: Likewise.
8951         * i386.cc: Likewise.
8952         * icf.h: Likewise.
8953         * incremental-dump.cc: Likewise.
8954         * incremental.cc: Likewise.
8955         * layout.cc: Likewise.
8956         * layout.h: Likewise.
8957         * main.cc: Likewise.
8958         * merge.cc: Likewise.
8959         * merge.h: Likewise.
8960         * object.cc: Likewise.
8961         * object.h: Likewise.
8962         * options.cc: Likewise.
8963         * options.h: Likewise.
8964         * output.cc: Likewise.
8965         * output.h: Likewise.
8966         * plugin.cc: Likewise.
8967         * plugin.h: Likewise.
8968         * powerpc.cc: Likewise.
8969         * reloc.cc: Likewise.
8970         * script-c.h: Likewise.
8971         * script-sections.cc: Likewise.
8972         * script.cc: Likewise.
8973         * stringpool.cc: Likewise.
8974         * symtab.cc: Likewise.
8975         * symtab.h: Likewise.
8976         * target.cc: Likewise.
8977         * timer.cc: Likewise.
8978         * timer.h: Likewise.
8979         * version.cc: Likewise.
8980         * x86_64.cc: Likewise.
8981
8982 2010-08-24  Nick Clifton  <nickc@redhat.com>
8983
8984         PR 11899
8985         * layout.cc (segment_precedes): Sort segments by their physical
8986         addresses, if they have been set.
8987
8988 2010-08-23  Cary Coutant  <ccoutant@google.com>
8989
8990         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
8991         symbols data.
8992         (Lib_group::include_member): Unlock object after deleting its
8993         symbols data.
8994         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
8995         the bug fixed here.
8996
8997 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
8998             Cary Coutant  <ccoutant@google.com>
8999
9000         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
9001         constructor, and set_blocker.
9002         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
9003         readsyms_blocker_.
9004         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
9005         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
9006         * testsuite/Makefile.am (start_lib_test): New test case.
9007         * testsuite/Makefile.in: Regenerate.
9008         * testsuite/start_lib_test_main.c: New file.
9009         * testsuite/start_lib_test_1.c: New file.
9010         * testsuite/start_lib_test_2.c: New file.
9011         * testsuite/start_lib_test_3.c: New file.
9012
9013 2010-08-19  Ian Lance Taylor  <iant@google.com>
9014
9015         * Makefile.in: Rebuild with automake 1.11.1.
9016         * aclocal.m4: Likewise.
9017         * testsuite/Makefile.in: Likewise.
9018
9019 2010-08-19  Ian Lance Taylor  <iant@google.com>
9020
9021         PR 10893
9022         * i386.cc (class Output_data_plt_i386): Update declarations.
9023         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
9024         local_ifuncs_ fields.
9025         (Target_i386::do_plt_section_for_global): New function.
9026         (Target_i386::do_plt_section_for_local): New function.
9027         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
9028         parameter; change all callers.  Initialize global_ifuncs_ and
9029         local_ifuncs_.  If doing a static link define __rel_iplt_start and
9030         __rel_iplt_end.
9031         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
9032         (Output_data_plt_i386::add_local_ifunc_entry): New function.
9033         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
9034         symbols.
9035         (Target_i386::make_plt_section): New function, broken out of
9036         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
9037         (Target_i386::make_plt_entry): Call make_plt_section.
9038         (Target_i386::make_local_ifunc_plt_entry): New function.
9039         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
9040         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
9041         R_386_IRELATIVE to switch.
9042         (Target_i386::Scan::global): Likewise.
9043         (Target_i386::Relocate::relocate): Likewise.
9044         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
9045         switch.
9046         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
9047         (Target_x86_64::do_plt_section_for_global): New function.
9048         (Target_x86_64::do_plt_section_for_local): New function.
9049         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
9050         parameter; change all callers.  If doing a static link define
9051         __rela_iplt_start and __rela_iplt_end.
9052         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
9053         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
9054         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
9055         to point to .plt.
9056         (Target_x86_64::make_local_ifunc_plt_entry): New function.
9057         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
9058         switch.
9059         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
9060         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
9061         R_X86_64_IRELATIVE to switch.
9062         (Target_x86_64::Scan::global): Likewise.
9063         (Target_x86_64::Relocate::relocate): Likewise.
9064         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
9065         switch.
9066         * target.h (class Target): Add plt_section_for_global and
9067         plt_section_for_local functions.  Add do_plt_section_for_global
9068         and do_plt_section_for_local virtual functions.
9069         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
9070         clarifying comments.
9071         (Symbol::use_plt_offset): Handle IFUNC symbol.
9072         * object.cc (Sized_relobj::Sized_relobj): Initialize
9073         local_plt_offsets_.
9074         (Sized_relobj::local_has_plt_offset): New function.
9075         (Sized_relobj::local_plt_offset): New function.
9076         (Sized_relobj::set_local_plt_offset): New function.
9077         (Sized_relobj::do_count): Handle IFUNC symbol.
9078         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
9079         a bit away from input_shndx_ field.  Add set_is_func_symbol and
9080         is_ifunc_symbol functions.
9081         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
9082         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
9083         local_plt_offsets_ field.
9084         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
9085         * output.h (class Output_section_data): Add non-const
9086         output_section function.
9087         (class Output_data_got): Update declarations.
9088         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
9089         Add use_plt_offset parameter to global and local constructors.
9090         Change all callers.  Change local_sym_index_ field to 31 bits.
9091         Change GSYM_CODE and CONSTANT_CODE accordingly.
9092         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
9093         doing a static link don't set sh_link field.
9094         (Output_data_got::Got_entry::write): Use PLT offset if
9095         appropriate.
9096         (Output_data_got::add_global_plt): New function.
9097         (Output_data_got::add_local_plt): New function.
9098         * target-reloc.h (relocate_section): Handle IFUNC symbol.
9099         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
9100         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
9101         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
9102         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
9103         IFUNC conditional.
9104         * testsuite/ifunc-sel.h: New file.
9105         * testsuite/ifuncmain1.c: New file.
9106         * testsuite/ifuncmain1vis.c: New file.
9107         * testsuite/ifuncmod1.c: New file.
9108         * testsuite/ifuncdep2.c: New file.
9109         * testsuite/ifuncmain2.c: New file.
9110         * testsuite/ifuncmain3.c: New file.
9111         * testsuite/ifuncmod3.c: New file.
9112         * testsuite/ifuncmain4.c: New file.
9113         * testsuite/ifuncmain5.c: New file.
9114         * testsuite/ifuncmod5.c: New file.
9115         * testsuite/ifuncmain6pie.c: New file.
9116         * testsuite/ifuncmod6.c: New file.
9117         * testsuite/ifuncmain7.c: New file.
9118         * configure, testsuite/Makefile.in: Rebuild.
9119
9120 2010-08-18  Ian Lance Taylor  <iant@google.com>
9121
9122         * incremental.cc
9123         (Output_section_incremental_inputs::write_input_files): Add cast
9124         to avoid signed/unsigned comparison warning.
9125         (Output_section_incremental_inputs::write_info_blocks): Likewise.
9126
9127 2010-08-12  Cary Coutant  <ccoutant@google.com>
9128
9129         * common.cc (Sort_commons::operator()): Remove unnecessary code.
9130
9131 2010-08-13  Ian Lance Taylor  <iant@google.com>
9132
9133         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
9134
9135 2010-08-12  Cary Coutant  <ccoutant@google.com>
9136             Doug Kwan  <dougkwan@google.com>
9137
9138         * resolve.cc (Symbol_table::should_override): When a weak dynamic
9139         defintion overrides non-weak undef, remember that the original undef
9140         is not weak.
9141         * symtab.cc (Symbol_table::sized_write_global): For undef without
9142         an original weak binding, set binding to global in output.
9143         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
9144         * testsuite/Makefile.in: Regenerate.
9145         * testsuite/strong_ref_weak_def.sh: New file.
9146         * testsuite/strong_ref_weak_def_1.c: Ditto.
9147         * testsuite/strong_ref_weak_def_2.c: Ditto.
9148
9149 2010-08-12  Cary Coutant  <ccoutant@google.com>
9150
9151         * testsuite/incremental_test.sh: Rewrite.
9152         * testsuite/incremental_test_1.c: Rewrite.
9153         * testsuite/incremental_test_2.c: Rewrite.
9154
9155 2010-08-12  Cary Coutant  <ccoutant@google.com>
9156
9157         * arm.cc (Target_arm::got_size): Add const.
9158         (Target_arm::got_entry_count): New function.
9159         (Target_arm::plt_entry_count): New function.
9160         (Target_arm::first_plt_entry_offset): New function.
9161         (Target_arm::plt_entry_size): New function.
9162         (Output_data_plt_arm::entry_count): New function.
9163         (Output_data_plt_arm::first_plt_entry_offset): New function.
9164         (Output_data_plt_arm::get_plt_entry_size): New function.
9165         * i386.cc (Target_i386::got_size): Add const.
9166         (Target_i386::got_entry_count): New function.
9167         (Target_i386::plt_entry_count): New function.
9168         (Target_i386::first_plt_entry_offset): New function.
9169         (Target_i386::plt_entry_size): New function.
9170         (Output_data_plt_i386::entry_count): New function.
9171         (Output_data_plt_i386::first_plt_entry_offset): New function.
9172         (Output_data_plt_i386::get_plt_entry_size): New function.
9173         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
9174         find_incremental_inputs_sections.  Dump incremental_got_plt section.
9175         * incremental.cc: Include target.h.
9176         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
9177         parameter.  Adjust all callers.  Find incremental_got_plt section.
9178         (Incremental_inputs::create_data_sections): Create incremental_got_plt
9179         section.
9180         (Output_section_incremental_inputs::set_final_data_size): Calculate
9181         size of incremental_got_plt section.
9182         (Output_section_incremental_inputs::do_write): Write the
9183         incremental_got_plt section.
9184         (Got_plt_view_info): New struct.
9185         (Local_got_offset_visitor): New class.
9186         (Global_got_offset_visitor): New class.
9187         (Global_symbol_visitor_got_plt): New class.
9188         (Output_section_incremental_inputs::write_got_plt): New function.
9189         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
9190         Add parameter.  Adjust all callers.
9191         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9192         (Incremental_inputs::got_plt_section): New function.
9193         (Incremental_inputs::got_plt_section_): New data member.
9194         (Incremental_got_plt_reader): New class.
9195         * layout.cc (Layout::create_incremental_info_sections): Add the
9196         incremental_got_plt section.
9197         * object.h (Got_offset_list::get_list): New function.
9198         (Got offset_list::for_all_got_offsets): New function.
9199         (Sized_relobj::local_got_offset_list): New function.
9200         * powerpc.cc (Target_powerpc::got_size): Add const.
9201         (Target_powerpc::got_entry_count): New function.
9202         (Target_powerpc::plt_entry_count): New function.
9203         (Target_powerpc::first_plt_entry_offset): New function.
9204         (Target_powerpc::plt_entry_size): New function.
9205         (Output_data_plt_powerpc::entry_count): New function.
9206         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
9207         (Output_data_plt_powerpc::get_plt_entry_size): New function.
9208         * sparc.cc (Target_sparc::got_size): Add const.
9209         (Target_sparc::got_entry_count): New function.
9210         (Target_sparc::plt_entry_count): New function.
9211         (Target_sparc::first_plt_entry_offset): New function.
9212         (Target_sparc::plt_entry_size): New function.
9213         (Output_data_plt_sparc::entry_count): New function.
9214         (Output_data_plt_sparc::first_plt_entry_offset): New function.
9215         (Output_data_plt_sparc::get_plt_entry_size): New function.
9216         * symtab.h (Symbol::got_offset_list): New function.
9217         (Symbol_table::for_all_symbols): New function.
9218         * target.h (Sized_target::got_entry_count): New function.
9219         (Sized_target::plt_entry_count): New function.
9220         (Sized_target::plt_entry_size): New function.
9221         * x86_64.cc (Target_x86_64::got_size): Add const.
9222         (Target_x86_64::got_entry_count): New function.
9223         (Target_x86_64::plt_entry_count): New function.
9224         (Target_x86_64::first_plt_entry_offset): New function.
9225         (Target_x86_64::plt_entry_size): New function.
9226         (Output_data_plt_x86_64::entry_count): New function.
9227         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
9228         (Output_data_plt_x86_64::get_plt_entry_size): New function.
9229
9230 2010-08-12  Cary Coutant  <ccoutant@google.com>
9231
9232         * archive.cc: Include incremental.h.
9233         (Archive::Archive): Initialize incremental_info_.
9234         (Archive::include_member): Record archive members in incremental info.
9235         (Add_archive_symbols::run): Record begin and end of an archive in
9236         incremental info.
9237         (Lib_group::include_member): Record objects in incremental info.
9238         * archive.h (Incremental_archive_entry): Forward declaration.
9239         (Archive::set_incremental_info): New member function.
9240         (Archive::incremental_info): New member function.
9241         (Archive::Unused_symbol_iterator): New class.
9242         (Archive::unused_symbols_begin): New member function.
9243         (Archive::unused_symbols_end): New member function.
9244         (Archive::incremental_info_): New data member.
9245         * incremental-dump.cc (find_input_containing_global): New function.
9246         (dump_incremental_inputs): Dump new incremental info sections.
9247         * incremental.cc: Include symtab.h.
9248         (Output_section_incremental_inputs): New class.
9249         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
9250         new incremental info sections.
9251         (Sized_incremental_binary::do_check_inputs): Likewise.
9252         (Incremental_inputs::report_archive): Remove.
9253         (Incremental_inputs::report_archive_begin): New function.
9254         (Incremental_inputs::report_archive_end): New function.
9255         (Incremental_inputs::report_object): New function.
9256         (Incremental_inputs::finalize_inputs): Remove.
9257         (Incremental_inputs::report_input_section): New function.
9258         (Incremental_inputs::report_script): Rewrite.
9259         (Incremental_inputs::finalize): Do nothing but finalize string table.
9260         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9261         (Incremental_inputs::sized_create_inputs_section_data): Remove.
9262         (Incremental_inputs::create_data_sections): New function.
9263         (Incremental_inputs::relocs_entsize): New function.
9264         (Output_section_incremental_inputs::set_final_data_size): New function.
9265         (Output_section_incremental_inputs::do_write): New function.
9266         (Output_section_incremental_inputs::write_header): New function.
9267         (Output_section_incremental_inputs::write_input_files): New function.
9268         (Output_section_incremental_inputs::write_info_blocks): New function.
9269         (Output_section_incremental_inputs::write_symtab): New function.
9270         * incremental.h (Incremental_script_entry): Forward declaration.
9271         (Incremental_object_entry): Forward declaration.
9272         (Incremental_archive_entry): Forward declaration.
9273         (Incremental_inputs): Forward declaration.
9274         (Incremental_inputs_header_data): Remove.
9275         (Incremental_inputs_header): Remove.
9276         (Incremental_inputs_header_write): Remove.
9277         (Incremental_inputs_entry_data): Remove.
9278         (Incremental_inputs_entry): Remove.
9279         (Incremental_inputs_entry_write): Remove.
9280         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
9281         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
9282         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9283         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
9284         Likewise.
9285         (Incremental_input_entry): New class.
9286         (Incremental_script_entry): New class.
9287         (Incremental_object_entry): New class.
9288         (Incremental_archive_entry): New class.
9289         (Incremental_inputs::Incremental_inputs): Initialize new data members.
9290         (Incremental_inputs::report_inputs): Remove.
9291         (Incremental_inputs::report_archive): Remove.
9292         (Incremental_inputs::report_archive_begin): New function.
9293         (Incremental_inputs::report_archive_end): New function.
9294         (Incremental_inputs::report_object): Change prototype.
9295         (Incremental_inputs::report_input_section): New function.
9296         (Incremental_inputs::report_script): Change prototype.
9297         (Incremental_inputs::get_reloc_count): New function.
9298         (Incremental_inputs::set_reloc_count): New function.
9299         (Incremental_inputs::create_data_sections): New function.
9300         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9301         (Incremental_inputs::inputs_section): New function.
9302         (Incremental_inputs::symtab_section): New function.
9303         (Incremental_inputs::relocs_section): New function.
9304         (Incremental_inputs::get_stringpool): Add const.
9305         (Incremental_inputs::command_line): Add const.
9306         (Incremental_inputs::inputs): Remove.
9307         (Incremental_inputs::command_line_key): New function.
9308         (Incremental_inputs::input_file_count): New function.
9309         (Incremental_inputs::input_files): New function.
9310         (Incremental_inputs::relocs_entsize): New function.
9311         (Incremental_inputs::sized_create_inputs_section_data): Remove.
9312         (Incremental_inputs::finalize_inputs): Remove.
9313         (Incremental_inputs::Input_info): Remove.
9314         (Incremental_inputs::lock_): Remove.
9315         (Incremental_inputs::inputs_): Change type.
9316         (Incremental_inputs::inputs_map_): Remove.
9317         (Incremental_inputs::current_object_entry_): New data member.
9318         (Incremental_inputs::inputs_section_): New data member.
9319         (Incremental_inputs::symtab_section_): New data member.
9320         (Incremental_inputs::relocs_section_): New data member.
9321         (Incremental_inputs::reloc_count_): New data member.
9322         (Incremental_inputs_reader): New class.
9323         (Incremental_symtab_reader): New class.
9324         (Incremental_relocs_reader): New class.
9325         * layout.cc (Layout::finalize): Move finalization of incremental info
9326         and creation of incremental info sections to follow finalization of
9327         symbol table.  Set offsets for postprocessing sections.
9328         (Layout::create_incremental_info_sections): Call
9329         Incremental_inputs::create_data_sections.  Add incremental symtab
9330         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
9331         sections to layout after input sections.
9332         * layout.h (struct Timespec): Forward declaration.
9333         (Layout::incremental_inputs): Add const.
9334         (Layout::create_incremental_info_sections): Add parameter.
9335         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
9336         * object.cc: Include incremental.h.
9337         (Relobj::finalize_incremental_relocs): New function.
9338         (Sized_relobj::do_layout): Record input sections in incremental info.
9339         * object.h (Object::output_section): New function.
9340         (Object::output_section_offset): Moved from Relobj.
9341         (Object::get_incremental_reloc_base): New function.
9342         (Object::get_incremental_reloc_count): New function.
9343         (Object::do_output_section): New function.
9344         (Object::do_output_section_offset): Moved from Relobj.
9345         (Object::do_get_incremental_reloc_base): New function.
9346         (Object::do_get_incremental_reloc_count): New function.
9347         (Object::Object): Initialize new data members.
9348         (Relobj::output_section): Renamed do_output_section and moved to
9349         protected.
9350         (Relobj::output_section_offset): Moved to Object.
9351         (Relobj::do_get_incremental_reloc_base): New function.
9352         (Relobj::do_get_incremental_reloc_count): New function.
9353         (Relobj::allocate_incremental_reloc_counts): New function.
9354         (Relobj::count_incremental_reloc): New function.
9355         (Relobj::finalize_incremental_relocs): New function.
9356         (Relobj::next_incremental_reloc_index): New function.
9357         (Relobj::reloc_counts_): New data member.
9358         (Relobj::reloc_bases_): New data member.
9359         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
9360         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
9361         (Sized_relobj::incremental_relocs_scan): New function.
9362         (Sized_relobj::incremental_relocs_scan_reltype): New function.
9363         (Sized_relobj::incremental_relocs_write): New function.
9364         (Sized_relobj::incremental_relocs_write_reltype): New function.
9365         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
9366         incremental link.
9367         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
9368         archives and object files elsewhere.
9369         (Add_symbols::run): Report object files here.
9370         (Finish_group::run): Report end of archive at end of group.
9371         * reloc.cc: Include layout.h, incremental.h.
9372         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
9373         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
9374         (Sized_relobj::incremental_relocs_scan): New function.
9375         (Sized_relobj::incremental_relocs_scan_reltype): New function.
9376         (Sized_relobj::do_relocate_sections): Write incremental relocations.
9377         (Sized_relobj::incremental_relocs_write): New function.
9378         (Sized_relobj::incremental_relocs_write_reltype): New function.
9379         * script.cc (read_input_script): Rewrite test for incremental link.
9380         Change call to Incremental_inputs::report_script.
9381         * symtab.h (Symbol_table::first_global_index): New function.
9382         (Symbol_table::output_count): New function.
9383
9384 2010-08-12  Doug Kwan  <dougkwan@google.com>
9385
9386         * arm.cc (Target_arm::merge_object_attributes): Check command line
9387         options --no-wchar-size-warning and --no-enum-size-warning.
9388         * options.h (General_options): Add ld-compatible options
9389         --no-enum-size-warning and --no-wchar-size-warning.
9390
9391 2010-08-04  Ian Lance Taylor  <iant@google.com>
9392
9393         * x86_64.cc (Target_x86_64::Scan::local): Use
9394         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
9395         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
9396         (Target_x86_64::Scan::global): Likewise.
9397         (Target_x86_64::Relocate::relocate): Likewise.
9398         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
9399         Likewise.
9400
9401 2010-08-03  Cary Coutant  <ccoutant@google.com>
9402
9403         * merge.cc (Output_merge_string::do_add_input_section): Count strings
9404         to reserve space in merged_strings vector. Keep total input size
9405         for stats.
9406         (Output_merge_string::do_print_merge_stats): Print total input size.
9407         * merge.h (Output_merge_string): Add input_size_ field.
9408         * stringpool.cc (Stringpool_template::string_length): Move
9409         implementations out of Stringpool_template class and place in
9410         stringpool.h.
9411         * stringpool.h (string_length): Move out of Stringpool_template.
9412
9413 2010-08-03  Ian Lance Taylor  <iant@google.com>
9414
9415         PR 11712
9416         * layout.cc (relaxation_loop_body): If address of load segment is
9417         set, adjust address to include headers if possible.
9418
9419 2010-08-03  Ian Lance Taylor  <iant@google.com>
9420
9421         * version.cc (version_string): Bump to 1.10.
9422
9423 2010-08-03  Ian Lance Taylor  <iant@google.com>
9424
9425         PR 11805
9426         * layout.h (enum Output_section_order): Define.
9427         (class Layout): Update declarations.
9428         * layout.cc (Layout::get_output_section): Add order parameter.
9429         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
9430         is_first_non_relro parameters.  Change all callers.
9431         (Layout::choose_output_section): Likewise.
9432         (Layout::add_output_section_data): Likewise.
9433         (Layout::make_output_section): Likewise.  Set order.
9434         (Layout::default_section_order): New function.
9435         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
9436         * output.cc (Output_section::Output_section): Initialize order_.
9437         Don't initialize deleted fields.
9438         (Output_segment::Output_segment): Don't initialize deleted
9439         fields.
9440         (Output_segment::add_output_section_to_load): New function
9441         replacing add_output_section.  Change all callers to call this or
9442         add_output_section_to_nonload.
9443         (Output_segment::add_output_section_to_nonload): New function.
9444         (Output_segment::remove_output_section): Rewrite.
9445         (Output_segment::add_initial_output_data): Likewise.
9446         (Output_segment::has_any_data_sections): Likewise.
9447         (Output_segment::is_first_section_relro): Likewise.
9448         (Output_segment::maximum_alignment): Likewise.
9449         (Output_segment::has_dynamic_reloc): New function replacing
9450         dynamic_reloc_count.  Change all callers.
9451         (Output_segment::has_dynamic_reloc_list): New function replacing
9452         dynamic_reloc_count_list.  Change all callers.
9453         (Output_segment::set_section_addresses): Rewrite.
9454         (Output_segment::set_offset): Rewrite.
9455         (Output_segment::find_first_and_last_list): Remove.
9456         (Output_segment::set_tls_offsets): Rewrite.
9457         (Output_segment::first_section_load_address): Likewise.
9458         (Output_segment::output_section_count): Likewise.
9459         (Output_segment::section_with_lowest_load_address): Likewise.
9460         (Output_segment::write_section_headers): Likewise.
9461         (Output_segment::print_sections_to_map): Likewise.
9462         * output.h (class Output_data): Remove dynamic_reloc_count_
9463         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
9464         (Output_data::add_dynamic_reloc): Rewrite.
9465         (Output_data::has_dynamic_reloc): New function.
9466         (Output_data::dynamic_reloc_count): Remove.
9467         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
9468         is_last_relro_, is_first_non_relro_, is_interp_,
9469         is_dynamic_linker_section_ fields.  Add order and set_order
9470         functions.  Remove is_relro_local, set_is_relro_local,
9471         is_last_relro, set_is_last_relro, is_first_non_relro,
9472         set_is_first_non_relro functions, is_interp, set_is_interp,
9473         is_dynamic_linker_section, and set_is_dynamic_linker_section
9474         functions.
9475         (class Output_segment): Change Output_data_list from std::list to
9476         std:;vector.  Add output_lists_ field.  Remove output_data_ and
9477         output_bss_ fields.  Update declarations.
9478
9479 2010-08-02  Ian Lance Taylor  <iant@google.com>
9480
9481         * arm.cc (Target_arm::gc_process_relocs): Use typename.
9482         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
9483         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
9484
9485 2010-08-02  Ian Lance Taylor  <iant@google.com>
9486
9487         PR 11855
9488         * script.cc (Script_options::Script_options): Initialize
9489         symbol_definitions_ and symbol_references_.
9490         (Script_options::add_symbol_assignment): Update
9491         symbol_definitions_ and symbol_references_.
9492         (Script_options::add_symbol_reference): New function.
9493         (script_symbol): New function.
9494         * script.h (class Script_options): Add symbol_definitions_ and
9495         symbol_references_ fields.
9496         (Script_options::referenced_const_iterator): New type.
9497         (Script_options::referenced_begin): New function.
9498         (Script_options::referenced_end): New function.
9499         (Script_options::is_referenced): New function.
9500         (Script_options::any_unreferenced): New function.
9501         * script-c.h (script_symbol): Declare.
9502         * yyscript.y (exp): Call script_symbol.
9503         * symtab.cc: Include "script.h".
9504         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
9505         Change all callers.  Check symbols referenced by scripts.
9506         (Symbol_table::add_undefined_symbols_from_command_line): Add
9507         layout parameter.  Change all callers.
9508         (Symbol_table::do_add_undefined_symbols_from_command_line):
9509         Likewise.  Break out loop body.  Check symbols referenced by
9510         scripts.
9511         (Symbol_table::add_undefined_symbol_from_command_line): New
9512         function broken out of
9513         do_add_undefined_symbols_from_command_line.
9514         * symtab.h (class Symbol_table): Update declarations.
9515         * archive.cc: Include "layout.h".
9516         (Archive::should_include_member): Add layout parameter.  Change
9517         all callers.  Check for symbol mentioned in expression.
9518         * archive.h (class Archive): Update declaration.
9519         * object.cc (Sized_relobj::do_should_include_member): Add layout
9520         parameter.
9521         * object.h (Object::should_include_member): Add layout parameter.
9522         Change all callers.
9523         (Object::do_should_include_member): Add layout parameter.
9524         (class Sized_relobj): Update declaration.
9525         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
9526         parameter.
9527         * dynobj.h (class Sized_dynobj): Update declaration.
9528         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
9529         layout parameter.
9530         * plugin.h (class Sized_pluginobj): Update declaration.
9531
9532 2010-08-02  Ian Lance Taylor  <iant@google.com>
9533
9534         PR 11866
9535         * output.cc (Output_segment::set_offset): Search for the first and
9536         last sections rather than assuming that the list is in order.
9537         (Output_segment::find_first_and_last_list): New function.
9538         * output.h (class Output_segment): Update declarations.
9539         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
9540         (relro_strip_test_SOURCES): New variable.
9541         (relro_strip_test_DEPENDENCIES): New variable.
9542         (relro_strip_test_LDFLAGS): New variable.
9543         (relro_strip_test_LDADD): New variable.
9544         (relro_strip_test.so): New target.
9545
9546 2010-08-02  Ian Lance Taylor  <iant@google.com>
9547
9548         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
9549         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
9550         (Target_i386::got_tlsdesc_section): New function.
9551         (Target_i386::got_section): Create space for GOT entries for
9552         TLSDESC relocations.
9553         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
9554         R_386_TLS_GOTDESC.
9555         (Target_i386::Scan::global): Likewise.
9556         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
9557         using TLSDESC GOT.
9558         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
9559         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
9560         (Target_x86_64::got_tlsdesc_section): New function.
9561         (Target_x86_64::got_section): Create space for GOT entries for
9562         TLSDESC relocations.
9563         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
9564         R_386_TLS_GOTDESC.
9565         (Target_x86_64::Scan::global): Likewise.
9566         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
9567         using TLSDESC GOT.
9568
9569 2010-08-02  Ian Lance Taylor  <iant@google.com>
9570
9571         * testsuite/final_layout.sh: Use dc to convert from hex to
9572         decimal.
9573
9574 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
9575
9576         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
9577         paramter to the call to gold::gc_process_relocs.
9578         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
9579         paramter to the call to gold::gc_process_relocs.
9580         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
9581         parameter to the call to gold::gc_process_relocs.
9582         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
9583         template parameter to the call to gold::gc_process_relocs.
9584         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
9585         paramter to the call to gold::gc_process_relocs.
9586         * gc.h (get_embedded_addend_size): New function.
9587         (gc_process_relocs): Save the size of the reloc for use by ICF.
9588         * icf.cc (get_section_contents): Get the addend from the text section
9589         for SHT_REL relocation sections.
9590         * icf.h (Icf::Reloc_addend_size_info): New typedef.
9591         (Icf::Reloc_info): Add new member reloc_addend_size_info.
9592         * int_encoding.h (read_from_pointer): New overloaded function.
9593         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
9594         * testsuite/icf_sht_rel_addend_test.sh: New file.
9595         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
9596         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
9597
9598 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9599
9600         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
9601         * Makefile.in: Regenerate.
9602         * testsuite/Makefile.in: Regenerate.
9603
9604 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
9605
9606         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
9607         * gold/testsuite/debug_msg.cc: Likewise.
9608         * gold/testsuite/odr_violation1.cc
9609         * gold/testsuite/odr_violation2.cc
9610
9611 2010-07-21  Cary Coutant  <ccoutant@google.com>
9612
9613         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
9614         string, and length fields.
9615         (Output_merge_string::Merged_strings_list): New type.
9616         (Output_merge_string::Merged_strings_lists): New typedef.
9617         (Output_merge_string): Replace merged_strings_ with
9618         merged_strings_lists_.
9619         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
9620         Merged_strings_list per input object and section.  Don't store pointer
9621         to the string.  Don't store length with each merged string entry.
9622         (Output_merge_string::finalize_merged_data): Loop over list of merged
9623         strings lists.  Recompute length of each merged string.
9624
9625 2010-07-15  Cary Coutant  <ccoutant@google.com>
9626
9627         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
9628         here.
9629
9630 2010-07-14  Ian Lance Taylor  <iant@google.com>
9631
9632         * descriptors.cc (Descriptors::open): Report correct name in error
9633         message.
9634
9635 2010-07-13  Doug Kwan  <dougkwan@google.com>
9636
9637         * arm.cc (Arm_input_section::Arm_input_section): For a
9638         SHT_ARM_EXIDX section, always keeps the input sections.
9639         (Arm_input_section::set_exidx_section_link): New method.
9640         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
9641         has_errors_ to false.
9642         (Arm_exidx_input_section::has_errors,
9643         Arm_exidx_input_section::set_has_errors): New methods.
9644         (Arm_exidx_input_section::has_errors_): New data member.
9645         (Arm_relobj::get_exidx_shndx_list): New method.
9646         (Arm_output_section::append_text_sections_to_list): Do not skip
9647         section without SHF_EXECINSTR.
9648         (Arm_output_section::fix_exidx_coverage): Skip input sections with
9649         errors.
9650         (Arm_relobj::make_exidx_input_section): Add new parameter for text
9651         section header.  Make error messages more verbose.  Check for
9652         a non-executable section linked to an EXIDX section.
9653         (Arm_relobj::do_read_symbols): Remove error checking, which has been
9654         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
9655         check that there is no deferred EXIDX section if we exit early.
9656         Instead of not making an EXIDX section in case of an error, make one
9657         and set the has_errors flag of it.
9658         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
9659         in a relocatable link.
9660         (Target_arm::do_relax): Look for the EXIDX output section instead of
9661         assuming that it is called .ARM.exidx.
9662         (Target_arm::fix_exidx_coverage): Add a new parameter for input
9663         section list.  Do not check for SHF_EXECINSTR section flags but
9664         skip any input section with errors.
9665         * output.cc (Output_section::Output_section): Initialize
9666         always_keeps_input_sections_ to false.
9667         (Output_section::add_input_section): Check for
9668         always_keeps_input_sections_.
9669         *  output.h (Output_section::always_keeps_input_sections,
9670         Output_section::set_always_keeps_input_sections): New methods.
9671         (Output_section::always_keeps_input_sections): New data member.
9672
9673 2010-07-13  Rafael Espindola  <espindola@google.com>
9674
9675         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
9676         * fileread.h (Input_file): Add try_extra_search_path and find_file.
9677
9678 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
9679             Ian Lance Taylor  <iant@google.com>
9680
9681         * output.h (Output_section_lookup_maps::add_merge_section):
9682         Correct check of whether value was inserted.
9683         (Output_section_lookup_maps::add_merge_input_section): Likewise.
9684         (Output_section_lookup_maps::add_relaxed_input_section):
9685         Likewise.
9686         * arm.cc (Target_arm::got_section): Remove used local os.
9687         * i386.cc (Target_i386::got_section): Likewise.
9688         * x86_64.cc (Target_x86_64::got_section): Likewise.
9689         * sparc.cc (Target_sparc::got_section): Likewise.
9690         (Target_sparc::relocate): Remove unused local have_got_offset.
9691         * powerpc.cc (Target_powerpc::relocate): Likewise.
9692
9693 2010-07-13  Ian Lance Taylor  <iant@google.com>
9694
9695         * compressed_output.cc (zlib_decompress): Fix signature in
9696         !HAVE_ZLIB_H case.
9697
9698         * archive.cc (Archive::include_member): Unlock an external member
9699         of a thin archive.  Don't bother to delete an object we know is
9700         NULL.
9701
9702 2010-07-12  Cary Coutant  <ccoutant@google.com>
9703
9704         * compressed_output.cc (zlib_decompress): New function.
9705         (get_uncompressed_size): New function.
9706         (decompress_input_section): New function.
9707         * compressed_output.h (get_uncompressed_size): New function.
9708         (decompress_input_section): New function.
9709         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
9710         Handle compressed debug sections.
9711         * layout.cc (is_compressed_debug_section): New function.
9712         (Layout::output_section_name): Map compressed section names to
9713         canonical names.
9714         * layout.h (is_compressed_debug_section): New function.
9715         (is_debug_info_section): Recognize compressed debug sections.
9716         * merge.cc: Include compressed_output.h.
9717         (Output_merge_data::do_add_input_section): Handle compressed
9718         debug sections.
9719         (Output_merge_string::do_add_input_section): Handle compressed
9720         debug sections.
9721         * object.cc: Include compressed_output.h.
9722         (Sized_relobj::Sized_relobj): Initialize new data members.
9723         (build_compressed_section_map): New function.
9724         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
9725         * object.h (Object::section_is_compressed): New method.
9726         (Object::do_section_is_compressed): New method.
9727         (Sized_relobj::Compressed_section_map): New type.
9728         (Sized_relobj::do_section_is_compressed): New method.
9729         (Sized_relobj::compressed_sections_): New data member.
9730         * output.cc (Output_section::add_input_section): Handle compressed
9731         debug sections.
9732         * reloc.cc: Include compressed_output.h.
9733         (Sized_relobj::write_sections): Handle compressed debug sections.
9734
9735 2010-07-08  Cary Coutant  <ccoutant@google.com>
9736
9737         * resolve.cc (Symbol_table::resolve): Remember whether undef was
9738         weak when resolving to a dynamic def.
9739         (Symbol_table::should_override): Add adjust_dyndef flag; set it
9740         for weak undef/dynamic def cases. Adjust callers.
9741         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
9742         undef_binding_weak_.
9743         (Symbol_table::sized_write_globals): Adjust symbol binding.
9744         (Symbol_table::sized_write_symbol): Add binding parameter.
9745         * symtab.h (Symbol::set_undef_binding): New method.
9746         (Symbol::is_undef_binding_weak): New method.
9747         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
9748         (Symbol_table::should_override): Add new parameter.
9749         (Symbol_table::sized_write_symbol): Add new parameter.
9750
9751         * testsuite/weak_undef_file1.cc: Add new test case.
9752         * testsuite/weak_undef_file2.cc: Fix header comment.
9753         * testsuite/weak_undef_test.cc: Add new test case.
9754
9755 2010-06-29  Doug Kwan  <dougkwan@google.com>
9756
9757         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
9758         Initialize USE_SYMBOL_.
9759         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
9760         definition.
9761         (Arm_reloc_property::uses_symbol_): New data member declaration.
9762         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
9763         uses symbol value and symbol is undefined but not weakly undefined.
9764
9765 2010-06-28  Rafael Espindola  <espindola@google.com>
9766
9767         * plugin.cc (Plugin::load): Use dlerror.
9768
9769 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
9770
9771         * symtab.cc (detect_odr_violations): When reporting an ODR
9772         violation, report an object where the symbol is defined.
9773
9774 2010-06-25  Doug Kwan  <dougkwan@google.com>
9775
9776         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
9777         (Target_arm::section_may_have_icf_unsafe_pointers): New method
9778         definition.
9779         (Target_arm::Scan::local_reloc_may_be_function_pointer,
9780         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
9781         target hook to detect function points.
9782         (Target_arm::Scan::possible_function_pointer_reloc): New method.
9783         * icf.h (Icf::check_section_for_function_pointers): Change type of
9784         parameter SECTION_NAME to const reference to std::string.  Use
9785         target hook to determine if section may have unsafe pointers.
9786         * target.h (Target::section_may_have_icf_unsafe_pointers): New
9787         method definition.
9788
9789 2010-06-21  Rafael Espindola  <espindola@google.com>
9790
9791         * fileread.cc (Input_file::find_fie): New
9792         (Input_file::open): Use Input_file::find_fie.
9793         * fileread.h (Input_file::find_fie): New
9794         * plugin.cc (set_extra_library_path): New.
9795         (Plugin::load): Add set_extra_library_path to the transfer vector.
9796         (Plugin_manager::set_extra_library_path): New.
9797         (Plugin_manager::add_input_file): Use the extra search path if set.
9798         (set_extra_library_path(): New.
9799         * plugin.h (Plugin_manager): Add set_extra_library_path and
9800         extra_search_path_.
9801
9802 2010-06-19  Cary Coutant  <ccoutant@google.com>
9803
9804         * layout.cc (gdb_sections): Add .debug_types.
9805         (lines_only_debug_sections): Likewise.
9806
9807 2010-06-18  Rafael Espindola  <espindola@google.com>
9808
9809         * plugin.cc (add_input_file,add_input_library)
9810         (Plugin_manager::add_input_file): Make filename arguments const.
9811         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
9812         const.
9813
9814 2010-06-16  Doug Kwan  <dougkwan@google.com>
9815
9816         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
9817         .ARM.attributes section if we have not merged any input
9818         attributes sections.
9819
9820 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9821
9822         * arm.cc: Allow combining objects with no EABI version
9823         information.
9824
9825 2010-06-15  Rafael Espindola  <espindola@google.com>
9826
9827         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
9828
9829 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9830
9831         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
9832         (struct iovec): Correct !HAVE_READV definition.
9833
9834 2010-06-10  Cary Coutant  <ccoutant@google.com>
9835
9836         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
9837         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
9838         reloc sections.
9839         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
9840
9841         PR 11683
9842         * symtab.h (Symbol::is_placeholder): New member function.
9843         * target-reloc.h (relocate_section): Check for placeholder symbols.
9844
9845         * testsuite/Makefile.am (plugin_test_8): New test.
9846         (plugin_test_9): New test.
9847         * testsuite/Makefile.in: Regenerate.
9848
9849 2010-06-09  Nick Clifton  <nickc@redhat.com>
9850
9851         * yyscript.y (input_list_element): Allow strings prefixed with
9852         the '-' character.  Treat these as libraries.
9853         * script.cc (script_add_library): New function.  Adds a library
9854         specified by "-l<name>" found in an input script.
9855         * script-c.h: Add prototype for script_add_library.
9856
9857 2010-06-07  Doug Kwan  <dougkwan@google.com>
9858
9859         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
9860         Restrict stub-group size to be within long conditional branch
9861         range when working around cortex-A8 erratum.
9862
9863 2010-06-07  Damien Diederen  <dd@crosstwine.com>
9864
9865         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
9866         #ifdef typo.
9867
9868 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
9869
9870         PR gold/11658
9871         * output.cc
9872         (Output_section::Input_section_sort_entry::compare_section_ordering):
9873         Change to return non-zero correctly.
9874         (Output_section::Input_section_sort_section_order_index_compare
9875         ::operator()): Change to fix ambiguity in comparisons.
9876
9877 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
9878
9879         * gold.h (is_wildcard_string): New function.
9880         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
9881         (Layout::layout_eh_frame): Ditto.
9882         (Layout::find_section_order_index): New method.
9883         (Layout::read_layout_from_file): New method.
9884         * layout.h (Layout::find_section_order_index): New method.
9885         (Layout::read_layout_from_file): New method.
9886         (Layout::input_section_position_): New private member.
9887         (Layout::input_section_glob_): New private member.
9888         * main.cc (main): Call read_layout_from_file here.
9889         * options.h (--section-ordering-file): New option.
9890         * output.cc (Output_section::input_section_order_specified_): New
9891         member.
9892         (Output_section::Output_section): Initialize new member.
9893         (Output_section::add_input_section): Add new parameter.
9894         Keep input sections when --section-ordering-file is used.
9895         (Output_section::set_final_data_size): Sort input sections when
9896         section ordering file is specified.
9897         (Output_section::Input_section_sort_entry): Add new parameter.
9898         Check sorting type.
9899         (Output_section::Input_section_sort_entry::compare_section_ordering):
9900         New method.
9901         (Output_section::Input_section_sort_compare::operator()): Change to
9902         consider section_order_index.
9903         (Output_section::Input_section_sort_init_fini_compare::operator()):
9904         Change to consider section_order_index.
9905         (Output_section::Input_section_sort_section_order_index_compare
9906         ::operator()): New method.
9907         (Output_section::sort_attached_input_sections): Change to sort
9908         according to section order when specified.
9909         (Output_section::add_input_section<32, true>): Add new parameter.
9910         (Output_section::add_input_section<64, true>): Add new parameter.
9911         (Output_section::add_input_section<32, false>): Add new parameter.
9912         (Output_section::add_input_section<64, false>): Add new parameter.
9913         * output.h (Output_section::add_input_section): Add new parameter.
9914         (Output_section::input_section_order_specified): New
9915         method.
9916         (Output_section::set_input_section_order_specified): New method.
9917         (Input_section::Input_section): Initialize section_order_index_.
9918         (Input_section::section_order_index): New method.
9919         (Input_section::set_section_order_index): New method.
9920         (Input_section::section_order_index_): New member.
9921         (Input_section::Input_section_sort_section_order_index_compare): New
9922         struct.
9923         (Output_section::input_section_order_specified_): New member.
9924         * script-sections.cc (is_wildcard_string): Delete and move modified
9925         method to gold.h.
9926         (Output_section_element_input::Output_section_element_input): Modify
9927         call to is_wildcard_string.
9928         (Output_section_element_input::Input_section_pattern
9929         ::Input_section_pattern): Ditto.
9930         (Output_section_element_input::Output_section_element_input): Ditto.
9931         * testsuite/Makefile.am (final_layout): New test case.
9932         * testsuite/Makefile.in: Regenerate.
9933         * testsuite/final_layout.cc: New file.
9934         * testsuite/final_layout.sh: New file.
9935
9936 2010-06-01  Rafael Espindola  <espindola@google.com>
9937
9938         * plugin.cc (Plugin::load): Pass the output name to the plugin.
9939
9940 2010-06-01  Rafael Espindola  <espindola@google.com>
9941
9942         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
9943         visibility of symbols.
9944
9945 2010-05-27  Doug Kwan  <dougkwan@google.com>
9946
9947         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
9948         from start of output section instead of address for a local symbol
9949         in a merged or relaxed section when doing a relocatable link.
9950
9951 2010-05-26  Rafael Espindola  <espindola@google.com>
9952
9953         PR 11604
9954         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
9955         adding sections the garbage collector removed.
9956         * gold/testsuite/Makefile.am: Add test.
9957         * gold/testsuite/Makefile.in: Regenerate.
9958         * gold/testsuite/plugin_test_7.sh: New.
9959         * gold/testsuite/plugin_test_7_1.c: New.
9960         * gold/testsuite/plugin_test_7_2.c: New.
9961
9962 2010-05-26  Rafael Espindola  <espindola@google.com>
9963
9964         * script-sections.cc (Output_section_definition::set_section_addresses):
9965         Check for --section-start.
9966
9967 2010-05-26  Doug Kwan  <dougkwan@google.com>
9968
9969         * arm.cc (Arm_scan_relocatable_relocs): New class.
9970         (Target_arm::relocate_special_relocatable): New method.
9971         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
9972         (Arm_relocate_functions::thumb_branch_common): Same.
9973         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
9974         instead of Default_scan_relocatable_relocs.
9975         * target-reloc.h (relocate_for_relocatable): Let target handle
9976         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
9977         * target.h (Sized_target::relocate_special_relocatable): New method.
9978
9979 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9980
9981         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
9982
9983 2010-05-23  Doug Kwan  <dougkwan@google.com>
9984
9985         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
9986         instead of a cast.
9987         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
9988         with a direct branch, not a conditional branch, to a stub.
9989         * merge.cc (Output_merge_base::record_input_section): New method
9990         defintion.
9991         (Output_merge_data::do_add_input_section): Record input section if
9992         keeps-input-sections flag is set.
9993         (Output_merge_string::do_add_input_section): Ditto.
9994         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
9995         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
9996         INPUT_SECTIONS_.
9997         (Output_merge_base::keeps_input_sections,
9998         Output_merge_base::set_keeps_input_sections,
9999         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
10000         method definitions.
10001         (Output_merge_base::Input_sections): New type declaration.
10002         (Output_merge_base::input_sections_begin,
10003         Output_merge_base::input_sections_end,
10004         Output_merge_base::do_set_keeps_input_sections): New method definitions.
10005         (Output_merge_base::bool keeps_input_sections_,
10006         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
10007         Output_merge_base::input_sections_): New data members.
10008         (Output_merge_data::do_set_keeps_input_sections): New method
10009         defintion.
10010         (Output_merge_string::do_set_keeps_input_sections): Ditto.
10011         * output.cc (Output_section::Input_section::relobj): Move method
10012         defintion from class declaration to here and handle merge sections.
10013         (Output_section::Input_section::shndx): Ditto.
10014         (Output_section::Output_section): Remove initializations of removed
10015         data members and initialize new data member LOOKUP_MAPS_.
10016         (Output_section::add_input_section): Set keeps-input-sections flag
10017         for a newly created merge output section as appropriate.  Adjust code
10018         to use Output_section_lookup_maps class.
10019         (Output_section::add_relaxed_input_section): Adjst code for lookup
10020         maps code refactoring.
10021         (Output_section::add_merge_input_section): Add a new parameter
10022         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
10023         class.  If adding input section to a newly created merge output
10024         section fails, remove the new merge section.
10025         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
10026         Adjust code for use of the Output_section_lookup_maps class.
10027         (Output_section::find_merge_section): Ditto.
10028         (Output_section::build_lookup_maps): New method defintion.
10029         (Output_section::find_relaxed_input_section): Adjust code to use
10030         Output_section_lookup_maps class.
10031         (Output_section::get_input_sections): Export merge sections.  Adjust
10032         code to use Output_section_lookup_maps class.
10033         (Output_section:::add_script_input_section): Adjust code to use
10034         Output_section_lookup_maps class.  Update lookup maps for merge
10035         sections also.
10036         (Output_section::discard_states): Use Output_section_lookup_maps.
10037         (Output_section::restore_states): Same.
10038         * output.h (Merge_section_properties): Move class defintion out of
10039         Output_section.
10040         (Output_section_lookup_maps): New class.
10041         (Output_section::Input_section::is_merge_section): New method
10042         defintion.
10043         (Output_section::Input_section::relobj): Move defintion out of class
10044         defintion.  Declare method only.
10045         (Output_section::Input_section::shndx): Ditto.
10046         (Output_section::Input_section::output_merge_base): New method defintion.
10047         (Output_section::Input_section::u2_.pomb): New union field.
10048         (Output_section::Merge_section_by_properties_map,
10049         Output_section::Output_section_data_by_input_section_map,
10050         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
10051         Remove types.
10052         (Output_section::add_merge_input_section): Add new parameter
10053         KEEPS_INPUT_SECTIONS.
10054         (Output_section::build_lookup_maps): New method declaration.
10055         (Output_section::merge_section_map_,
10056         Output_section::merge_section_by_properties_map_,
10057         Output_section::relaxed_input_section_map_,
10058         Output_section::is_relaxed_input_section_map_valid_): Remove data
10059         members.
10060         (Output_section::lookup_maps_): New data member.
10061
10062 2010-05-21  Doug Kwan  <dougkwan@google.com>
10063
10064         PR gold/11619
10065         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
10066         avoid a compilation error.
10067
10068 2010-05-19  Rafael Espindola  <espindola@google.com>
10069
10070         * script-sections.cc (Output_section_definition::allocate_to_segment):
10071         Update the phdrs_list even when the output section is NULL.
10072         * testsuite/Makefile.am: Add test.
10073         * testsuite/Makefile.in: Regenerate.
10074         * testsuite/script_test_9.cc: New.
10075         * testsuite/script_test_9.sh: New.
10076         * testsuite/script_test_9.t: New.
10077
10078 2010-05-19  Doug Kwan  <dougkwan@google.com>
10079
10080         * arm.cc (Arm_input_section::original_size): New method.
10081         (Arm_input_section::do_addralign): Add a cast.
10082         (Arm_input_section::do_output_offset): Remove static cast.
10083         (Arm_input_section::original_addralign,
10084          Arm_input_section::original_size_): Change type to uint32_t.
10085         (Arm_input_section::init): Add safe casts for section alignment
10086         and size.
10087         (Arm_input_section::set_final_data_size): Do not set address and
10088         offset of stub table.
10089         (Arm_output_section::fix_exidx_coverage): Change use of of
10090         Output_section::Simple_input_section to that of
10091         Output_section::Input_section.
10092         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
10093         except for the first pass.
10094         * output.cc (Output_section::get_input_sections): Change type of
10095         input_sections to std::list<Input_section>.
10096         (Output_section::add_script_input_section): Rename from
10097         Output_section::add_simple_input_section.  Change type of SIS
10098         parameter from Simple_input_section to Input_section.
10099         * output.h (Output_section::Simple_input_section): Remove class.
10100         (Output_section::Input_section): Change class visibility to public.
10101         (Output_section::Input_section::addralign): Use stored alignments
10102         for special input sections if set.
10103         (Output_section::Input_section::set_addralign): New method.
10104         (Output_section::get_input_sections): Change parameter type from
10105         list of Simple_input_section to list of Input_section.
10106         (Output_section::add_script_input_section): Rename from
10107         Output_section::add_simple_input_section. Change first parameter's
10108         type from Simple_input_section to Input_section and remove the
10109         second and third parameters.
10110         * script-sections.cc (Input_section::Input_section_list): Change
10111         type to list of Output_section::Input_section/
10112         (Input_section_info::Input_section_info): Change parameter type of
10113         INPUT_SECTION to Output_section::Input_section.
10114         (Input_section_info::input_section): Change return type.
10115         (Input_section_info::input_section_): Change type to
10116         Output_section::Input_section.
10117         (Output_section_element_input::set_section_addresses): Adjust code
10118         to use Output_section::Input_section instead of
10119         Output_section::Simple_input_section.  Adjust code for renaming
10120         of Output_section::add_simple_input_section.
10121         (Orphan_output_section::set_section_addresses): Ditto.
10122
10123 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10124
10125         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
10126         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
10127
10128 2010-05-18  Rafael Espindola  <espindola@google.com>
10129
10130         * options.cc (General_options::finalize): Handle -nostdlib.
10131         * options.h (nostdlib): New option.
10132         * script.cc (script_add_search_dir): Handle -nostdlib.
10133
10134 2010-05-12  Doug Kwan  <dougkwan@google.com>
10135
10136         * arm.cc (Target_arm::do_finalize_sections): Create an empty
10137         attributes section only if there no attributes section after merging.
10138         (Target_arm::merge_object_attributes): Move value of
10139         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
10140         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
10141         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
10142         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
10143         and arm_attr_merge_7.stdout.
10144         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
10145         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
10146         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
10147         arm_attr_merge_7b.o): New rules.
10148         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
10149         arm_attr_merge_7
10150         * testsuite/Makefile.in: Regenerate.
10151         * testsuite/arm_attr_merge.sh: New file.
10152         * testsuite/arm_attr_merge_[67][ab].s: Same.
10153
10154 2010-05-05  Nick Clifton  <nickc@redhat.com>
10155
10156         * po/es.po: Updated Spanish translation.
10157
10158 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
10159
10160         * Makefile.am (install-exec-local): Properly install gold as
10161         default cross linker.
10162         * Makefile.in: Regenerated.
10163
10164 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
10165             Nick Clifton  <nickc@redhat.com>
10166
10167         * configure.ac (install_as_default): Define and set to false
10168         unless --enable-gold or --enable-gold=both/gold has been
10169         specified.
10170         * configure: Regenerate.
10171
10172         * Makefile.am (install-exec-local): Install the executable as
10173         'ld.gold'.  If install_as_default is true then also install it as
10174         'ld'.
10175         * Makefile.in: Regenerated.
10176
10177 2010-04-24  Ian Lance Taylor  <iant@google.com>
10178
10179         * layout.cc (Layout::layout_reloc): In relocatable link don't
10180         combine reloc sections for grouped sections.
10181
10182 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
10183
10184         * gc.h (gc_process_relocs): Pass information on relocs pointing to
10185         sections that are not ordinary to icf.
10186         * icf.cc (get_section_contents): Handle relocation pointing to section
10187         with no object or shndx information.
10188         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
10189         * testsuite/Makefile.in: Regenerate.
10190         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
10191         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
10192
10193 2010-04-22  Ian Lance Taylor  <iant@google.com>
10194
10195         * expression.cc (Expression::Expression_eval_info): Add
10196         result_alignment_pointer field.
10197         (Expression::eval_with_dot): Add result_alignment_pointer
10198         parameter.  Change all callers.
10199         (Expression::eval_maybe_dot): Likewise.
10200         (class Binary_expression): Add alignment_pointer parameter to
10201         left_value and right_value.  Change all callers.
10202         (BINARY_EXPRESSION): Set result alignment.
10203         (class Trinary_expression): Add alignment_pointer parameter to
10204         arg2_value and arg3_value.  Change all callers.
10205         (Trinary_cond::value): Set result alignment.
10206         (Max_expression::value, Min_expression::value): Likewise.
10207         (Align_expression::value): Likewise.
10208         * script-sections.cc (class Sections_element): Add dot_alignment
10209         parameter to set_section_addresses virtual function.  Update
10210         instantiations.
10211         (class Output_section_element): Likewise.
10212         (Script_sections::create_segments): Add dot_alignment parameter.
10213         Change all callers.
10214         (Script_sections::create_segments_from_phdrs_clause): Likewise.
10215         (Script_sections::set_phdrs_clause_addresses): Likewise.
10216         * script-sections.h: Update declarations.
10217         * script.h: Update declarations.
10218         * output.h (Output_segment::set_minimum_p_align): Don't decrease
10219         min_p_align.
10220         * testsuite/script_test_3.t: Set large alignment.
10221         * testsuite/script_test_3.sh: Make sure that at least one LOAD
10222         segment has expected alignment.
10223
10224 2010-04-22  Nick Clifton  <nickc@redhat.com>
10225
10226         * po/gold.pot: Updated by the Translation project.
10227         * po/vi.po: Updated Vietnamese translation.
10228
10229 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
10230
10231         * testsuite/Makefile.am (check_PROGRAMS): Add
10232         icf_virtual_function_folding_test.
10233         * testsuite/Makefile.in: Regenerated.
10234
10235 2010-04-15  Andrew Haley  <aph@redhat.com>
10236
10237         * options.h (merge_exidx_entries): New option.
10238         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
10239         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
10240         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
10241         (Target_arm::merge_exidx_entries): New function.
10242         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
10243         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
10244         to Arm_exidx_fixup constructor.
10245         Add new arg, merge_exidx_entries.
10246         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
10247         Arm_output_section::fix_exidx_coverage.
10248
10249 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
10250
10251         * icf.cc (get_section_contents): Check for preemptible functions.
10252         Ignore addend when appropriate.
10253         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
10254         section folded.
10255         (add_from_relobj): Check for section folded.
10256         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
10257         * symtab.h (should_add_dynsym_entry): Add new parameter.
10258         * target-reloc.h (scan_relocs): Check for section folded.
10259         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
10260         Check reloc types for function pointers in shared objects.
10261         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
10262         case.
10263         (icf_preemptible_functions_test): New test case.
10264         (icf_string_merge_test): New test case.
10265         * testsuite.Makefile.in: Regenerate.
10266         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
10267         bar_glob.  Refactor code.
10268         * testsuite/icf_preemptible_functions_test.cc: New file.
10269         * testsuite/icf_preemptible_functions_test.sh: New file.
10270         * testsuite/icf_string_merge_test.cc: New file.
10271         * testsuite/icf_string_merge_test.sh: New file.
10272         * testsuite/icf_virtual_function_folding_test.cc: New file.
10273         * testsuite/icf_virtual_function_folding_test.sh: New file.
10274
10275 2010-04-14  Doug Kwan  <dougkwan@google.com>
10276
10277         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
10278         for local symbol recounting if we remove a section due to ICF.
10279         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
10280         there are no regular objects in input.
10281
10282 2010-04-13  Doug Kwan  <dougkwan@google.com>
10283
10284         * arm.cc (Arm_input_section::set_final_data_size): Compute
10285         accurate final data size instead of using current data size.
10286
10287 2010-04-09  Doug Kwan  <dougkwan@google.com>
10288
10289         * layout.cc (Layout::choose_output_section): Handle script section
10290         types.
10291         (Layout::make_output_section_for_script): Add section type parameter.
10292         Handle script section types.
10293         * layout.h (Layout::make_output_section_for_script): Add section
10294         type parameter.
10295         * output.cc (Output_section::Output_section): Initialize data member
10296         is_noload_.
10297         (Output_section::do_reset_address_and_file_offset): Do not set address
10298         to 0 if section is a NOLOAD section.
10299         * output.h (Output_section::is_noload): New method.
10300         (Output_section::set_is_noload): Ditto.
10301         (Output_section::is_noload_): New data member.
10302         * script-c.h (Script_section_type): New enum type.
10303         (struct Parser_output_section_header): Add new file section_type.
10304         * script-sections.cc (Sections_element::output_section_name): Add
10305         parameter for returning script section type.
10306         (Output_section_definition::output_section_name): Ditto.
10307         (Output_section_definition::section_type)P; New method.
10308         (Output_section_definiton::script_section_type_name): Ditto.
10309         (Output_section_definition::script_section_type_): New data member.
10310         (Output_section_definition::Output_section_definition): Initialize
10311         data member Output_section_definition::script_section_type_.
10312         (Output_section_definition::create_sections): Pass script section type
10313         to Layout::make_output_section_for_script.
10314         (Output_section_definition::output_section_name): Return script
10315         section type to caller.
10316         (Output_section_definition::set_section_address): Do not advance
10317         dot value and load address if section type is NOLOAD.  Set address
10318         of NOLOAD sections regardless of section flags.
10319         (Output_section_definition::print): Print section type if it is
10320         not SCRIPT_SECTION_TYPE_NONE.
10321         (Output_section_definition::section_type): New method.
10322         (Output_section_definition::script_section_type_name): Ditto.
10323         (Script_sections::output_section_name): Add new parameter
10324         PSECTION_TYPE for returning script section type.  Pass it to
10325         section elements.  Handle discard sections.
10326         (Sort_output_sections::operator()): Handle NOLOAD sections.
10327         * script-sections.h (Script_sections::Section_type): New enum type.
10328         (Script_sections::output_section_name): Add a new parameter for
10329         returning script section type.
10330         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
10331         INFO and NOLOAD.
10332         * yyscript.y (union): Add new field SECTION_TYPE.
10333         (COPY, DSECT, INFO, NOLOAD): New tokens.
10334         (opt_address_and_section_type): Change type to output_section_header.
10335         (section_type): New non-terminal
10336         (section_header): Handle section type.
10337         (opt_address_and_section_type): Return section type value.
10338
10339 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
10340
10341         * testsuite/plugin_common_test_1.c (foo): Add prototype.
10342         * testsuite/plugin_common_test_2.c (foo): Likewise.
10343
10344 2010-04-08  Doug Kwan  <dougkwan@google.com>
10345
10346         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
10347         Output_merge_data.
10348         * output.cc (Output_section::add_merge_input_section): Simplify
10349         code and return status of Output_merge_base::add_input_section.
10350         Update merge section map only if Output_merge_base::add_input_section
10351         returns true.
10352
10353 2010-04-07  Doug Kwan  <dougkwan@google.com>
10354
10355         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
10356         if section is marked as containing instructions but has no mapping
10357         symbols.
10358         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
10359         correct section index.
10360         (Arm_relobj::find_linked_text_section): Ditto.
10361
10362 2010-04-07  Cary Coutant  <ccoutant@google.com>
10363
10364         * archive.cc (include_member): Destroy Read_symbols_data object before
10365         releasing file.
10366         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
10367         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
10368         (Read_symbols_data::~Read_symbols_data) New destructor.
10369         (Section_relocs::Section_relocs) New constructor.
10370         (Section_relocs::~Section_relocs) New destructor.
10371         (Read_relocs_data::Read_relocs_data) New constructor.
10372         (Read_relocs_data::~Read_relocs_data) New destructor.
10373         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
10374         pointers to NULL after deleting.
10375
10376 2010-04-07  Doug Kwan  <dougkwan@google.com>
10377
10378         * arm.cc: Replace "endianity" with "endianness" in comments.
10379         (Arm_exidx_cantunwind): Ditto.
10380         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
10381         (Arm_relobj::merge_flags_and_attributes): New method.
10382         (Arm_relobj::merge_flags_and_attributes_): New data member.
10383         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
10384         (Arm_relobj::scan_sections_for_stubs): Ditto.
10385         (Arm_relobj::do_read_symbols): Check to see if we really want to
10386         merge processor-specific flags and attributes.  Exit early if
10387         an object is empty except for section names and the undefined symbol.
10388         (Target_arm::do_finalize_sections): Move check for ELF format to
10389         Arm_relobj::do_read_symbols.  Merge processor specific flags and
10390         attributes from a regular object only when we have determined that
10391         it is aapropriate.  Do not create an .ARM.attributes section in
10392         output if there is no regular input object.
10393         (Target_arm::merge_processor_specific_flags): Check
10394         --warn-mismatch before printing any error.
10395         (Target_arm::merge_object_attributes): Ditto.
10396         * gold.cc (queue_middle_tasks): Handle the case in which there is
10397         no regular object in input.
10398         * options.cc (General_options::parse_EB): New method.
10399         (General_options::parse_EL): Same.
10400         (General_options::General_options): Initialize endianness_.
10401         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
10402         New options.
10403         (General_options::Endianness): New enum.
10404         (General_options::endianness): New method.
10405         (General_options::endianness_): New data member.
10406         * parameters.cc (Parameters::set_options): Check target endianness.
10407         (Parameters::set_target_once): Ditto.
10408         (Parameters::check_target_endianness): New method.
10409         (parameters_force_valid_target): If either -EL or -EB is specified,
10410         use it to define endianness of default target.
10411         * parameters.h (Parameters::check_target_endianness): New method
10412         declaration.
10413         * target.h (class Target): Change "endianity" to "endianness"
10414         in comments.
10415
10416 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10417
10418         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
10419         * configure: Regenerate.
10420         * Makefile.in: Regenerate.
10421         * testsuite/Makefile.in: Regenerate.
10422
10423 2010-04-06  Cary Coutant  <ccoutant@google.com>
10424
10425         gcc PR lto/42757
10426         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
10427         prevailing definitions of common symbols.
10428         * testsuite/plugin_test_6.sh: New test case.
10429         * testsuite/plugin_common_test_1.c: New test case.
10430         * testsuite/plugin_common_test_2.c: New test case.
10431         * testsuite/Makefile.am (plugin_test_6): New test case.
10432         * testsuite/Makefile.in: Regenerate.
10433
10434 2010-04-06  Nick Clifton  <nickc@redhat.com>
10435
10436         * po/vi.po: New Vietnamese translation.
10437
10438 2010-03-30  Doug Kwan  <dougkwan@google.com>
10439
10440         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
10441
10442 2010-03-25  Doug Kwan  <dougkwan@google.com>
10443
10444         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
10445         to avoid a conversion warning on a 32-bit host.
10446
10447 2010-03-24  Ian Lance Taylor  <iant@google.com>
10448
10449         * testsuite/script_test_3.t: Add a TLS segment.
10450         * testsuite/Makefile.am (check_PROGRAMS): Add
10451         tls_phdrs_script_test.
10452         (tls_phdrs_script_test_SOURCES): Define.
10453         (tls_phdrs_script_test_DEPENDENCIES): Define.
10454         (tls_phdrs_script_test_LDFLAGS): Define.
10455         (tls_phdrs_script_test_LDADD): Define.
10456         * testsuite/Makefile.in: Rebuild.
10457
10458 2010-03-23  Cary Coutant  <ccoutant@google.com>
10459
10460         * fileread.cc (find_or_make_view): Fix comment.
10461
10462 2010-03-23  Ian Lance Taylor  <iant@google.com>
10463
10464         * script-sections.cc (class Orphan_section_placement): Define
10465         PLACE_TLS and PLACE_TLS_BSS.
10466         (Orphan_section_placement::Orphan_section_placement): Initialize
10467         new places.
10468         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
10469         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
10470         (tls_script_test_SOURCES): Define.
10471         (tls_script_test_DEPENDENCIES): Define.
10472         (tls_script_test_LDFLAGS): Define.
10473         (tls_script_test_LDADD): Define.
10474         * testsuite/Makefile.in: Rebuild.
10475
10476 2010-03-22  Doug Kwan  <dougkwan@google.com>
10477
10478         * arm.cc (Arm_relocate_functions::abs8,
10479         Arm_relocate_functions::abs16): Use correct check for overflow
10480         specified in the ARM ELF specs.
10481         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
10482         target of a BLX instruction specially.
10483         (Reloc_stub::stub_type_for_reloc): Ditto.
10484         (Relocate::relocate): Use symbolic names instead of numeric relocation
10485         codes to report error.
10486         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
10487         workaround.
10488         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
10489         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
10490         thumb2_blx_out_of_range.stdout
10491         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
10492         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
10493         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
10494         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
10495         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
10496         thumb2_blx_in_range, thumb2_blx_in_range.o,
10497         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
10498         thumb2_blx_out_of_range.o): New rules.
10499         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
10500         thumb2_blx_in_range and thumb2_blx_out_of_range.
10501         * testsuite/Makefile.in: Regenerate.
10502         * arm_branch_in_range.sh: Add tests for THUMB BLX.
10503         * testsuite/thumb_blx_in_range.s: New file.
10504         * testsuite/thumb_blx_out_of_range.s: New file.
10505
10506 2010-03-22  Rafael Espindola  <espindola@google.com>
10507
10508         * archive.cc (Should_include): Move to archive.h.
10509         (should_include_member): Make it a member of Archive.
10510         (Lib_group): New.
10511         (Add_lib_group_symbols): New.
10512         * archive.h: Include options.h.
10513         (Archive_member): Moved from Archive.
10514         (Should_include): Moved from archive.cc.
10515         (Lib_group): New.
10516         (Add_lib_group_symbols): New.
10517         * dynobj.cc (do_should_include_member): New.
10518         * dynobj.h (do_should_include_member): New.
10519         * gold.cc (queue_initial_tasks): Update call to queue.
10520         * main.cc (main): Print lib group stats.
10521         * object.cc (do_should_include_member): New.
10522         * object.h: Include archive.h.
10523         (Object::should_include_member): New.
10524         (Object::do_should_include_member): New.
10525         (Sized_relobj::do_should_include_member): New.
10526         * options.cc (General_options::parse_start_lib): New.
10527         (General_options::parse_end_lib): New.
10528         (Input_arguments::add_file): Handle lib groups.
10529         (Input_arguments::start_group): Check we are not in a lib.
10530         (Input_arguments::start_lib): New.
10531         (Input_arguments::end_lib): New.
10532         * options.h (General_options): Add start_lib and end_lib.
10533         (Input_argument::lib_): New.
10534         (Input_argument::lib): New.
10535         (Input_argument::is_lib): New.
10536         (Input_file_lib): New.
10537         (Input_arguments::in_lib_): New.
10538         (Input_arguments::in_lib): New.
10539         (Input_arguments::start_lib): New.
10540         (Input_arguments::end_lib_): New.
10541         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
10542         in unused members as preempted.
10543         (Sized_pluginobj::do_should_include_member): New.
10544         * plugin.h (Sized_pluginobj::do_should_include_member): New.
10545         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
10546         return the blocker.
10547         (Read_symbols::do_whole_lib_group): New.
10548         (Read_symbols::do_lib_group): New.
10549         (Read_symbols::do_read_symbols): Handle lib groups.
10550         (Read_symbols::get_name): Handle lib groups.
10551         * readsyms.h (Read_symbols): Add an archive member pointer.
10552         (Read_symbols::do_whole_lib_group): New.
10553         (Read_symbols::do_lib_group): New.
10554         (Read_symbols::member_): New.
10555         * script.cc (read_input_script): Update call to queue_soon.
10556
10557 2010-03-19  Doug Kwan  <dougkwan@google.com>
10558
10559         * arm.cc (Stub_table::Stub_table): Initialize new data members
10560         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10561         (Stub_table::add_reloc_stub): Assign stub offset and update
10562         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10563         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
10564         New data members.
10565         (Stub_table::update_data_size_and_addralign): Use
10566         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
10567         instead of going over all reloc stubs.
10568         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
10569         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10570         Stringpool_template::offset_ to size of Stringpool_char.
10571         (Stringpool_template::new_key_offset): Remove code to initialize
10572         Stringpool_template::offset_.
10573         * stringpool.h (Stringpool_template::set_no_zero_null): Set
10574         Stringpool_template::offset_ to zero.
10575
10576 2010-03-15  Doug Kwan  <dougkwan@google.com>
10577
10578         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10579         offset_.
10580         (Stringpool_template::new_key_offset): New method.
10581         (Stringpool_template::add_string): Assign offsets when adding new
10582         strings.
10583         (Stringpool_template::set_string_offsets): Do not set string offsets
10584         when not optimizing.
10585         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
10586         member size_.
10587         (Chunked_vector::clear): Clear size_.
10588         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
10589         (Chunked_vector::size): Return size_.
10590         (Chunked_vector::push_back): Use size_ to find insert position.
10591         (Chunked_vector::size_): New data member.
10592         (Stringpool_template::set_no_zero_null): Assert string set is empty.
10593         (Stringpool_template::new_key_offset): New method declaration.
10594         (Stringpool_template::offset_): New data member.
10595
10596 2010-03-15   Rafael Espindola  <espindola@google.com>
10597
10598         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
10599         Add_symbols' constructor.
10600         * readsyms.h (Add_symbols): Remove the input_group member.
10601
10602 2010-03-10  Ian Lance Taylor  <iant@google.com>
10603
10604         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
10605         target to ask whether a reference to a symbol requires a stack
10606         split.
10607         * target.h (Target::is_call_to_non_split): New function.
10608         (Target::do_is_call_to_non_split): Declare virtual function.
10609         * target.cc: Include "symtab.h".
10610         (Target::do_is_call_to_non_split): New function.
10611         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
10612
10613 2010-03-10  Cary Coutant  <ccoutant@google.com>
10614
10615         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
10616         (File_read::open[1]): Remove initial mapping of whole_file_view_.
10617         (File_read::open[2]): Add whole_file_view_ to list of views.
10618         (File_read::make_view): Remove test of whole_file_view_.
10619         (File_read::find_or_make_view): Create whole_file_view_ if
10620         necessary.
10621         (File_read::clear_views): Replace bool parameter with enum;
10622         adjust all callers.  Don't delete views with permanent data;
10623         do delete cached views and views from archives if
10624         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
10625         if clearing the corresponding view.
10626         * fileread.h (File_read::Clear_views_mode): New enum.
10627         (File_read::View::is_permanent_view): New method.
10628         (File_read::clear_views): Replace bool parameter
10629         with enum; adjust all callers.
10630         * options.h (General_options): Change keep_files_mapped option;
10631         add map_whole_files.
10632         * readsyms.cc (Add_symbols::run): Delete sd_ object before
10633         releasing the file.
10634         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
10635         the file.
10636
10637 2010-03-10  David S. Miller  <davem@davemloft.net>
10638
10639         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
10640
10641 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
10642
10643         * icf.cc (get_section_contents): Add '@' marker after processing the
10644         merge reloc.
10645
10646 2010-03-08  Doug Kwan  <dougkwan@google.com>
10647
10648         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
10649         due to a conversion warning.
10650         (Arm_relobj::update_output_local_symbol_count): Check for local
10651         symbol with unset output index.
10652
10653 2010-03-05  Ian Lance Taylor  <iant@google.com>
10654
10655         * options.h (class General_options): Add --spare-dynamic-tags.
10656         * output.cc (Output_data_dynamic::set_final_data_size): Implement
10657         --spare-dynamic-tags.
10658
10659 2010-03-05  Ian Lance Taylor  <iant@google.com>
10660
10661         * incremental.cc: Include "libiberty.h".
10662
10663 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
10664
10665         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
10666         function, is_info_ member.
10667         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
10668         (Versions::Versions): Update caller.
10669         (Versions::define_base_version): Likewise.
10670         (Versions::add_def): Likewise.
10671
10672 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
10673
10674         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
10675         (Scan::possible_function_pointer_reloc): New function.
10676         (Scan::local_reloc_may_be_function_pointer): Change to call
10677         possible_function_pointer_reloc.
10678         (Scan::global_reloc_may_be_function_pointer): Ditto.
10679         * icf.h (Icf::check_section_for_function_pointers): Change to reject
10680         relocations in ".data.rel.ro._ZTV" section.
10681         * testsuite/icf_safe_so_test.sh: Change to pass i386.
10682         * testsuite/icf_safe_so_test.cc: Ditto.
10683         * testsuite/icf_safe_test.cc: Ditto.
10684         * testsuite/icf_safe_test.sh: Ditto.
10685
10686 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10687             Ian Lance Taylor  <iant@google.com>
10688
10689         * target-reloc.h (relocate_section): Check the symbol table index
10690         for -1U before setting the local symbol index.
10691         (scan_relocatable_relocs): If copying the relocation, record that
10692         the local symbol is required.
10693         * object.h (Symbol_value::is_output_symtab_index_set): New
10694         function.
10695         (Symbol_value::may_be_discarded_from_output_symtab): New
10696         function.
10697         (Symbol_value::has_output_symtab_entry): New function.
10698         (Symbol_value::needs_output_symtab_entry): Remove.
10699         (Symbol_value::output_symtab_index): Make sure the symbol index is
10700         set.
10701         (Symbol_value::set_output_symtab_index): Make sure the symbol
10702         index is not set.  Make sure the new index is valid.
10703         (Symbol_value::set_must_have_output_symtab_entry): New function.
10704         (Symbol_value::has_output_dynsym_entry): New function.
10705         (Symbol_value::set_output_dynsym_index): Make sure the new index
10706         is valid.
10707         (Sized_relobj::set_must_have_output_symtab_entry): New function.
10708         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
10709         local symbol if permitted.
10710         (Sized_relobj::do_finalize_local_symbols): Call
10711         is_output_symtab_index_set rather than needs_output_symtab_entry.
10712         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
10713         rather than needs_output_symtab_entry.  Call
10714         has_output_dynsym_entry rather than needs_output_dynsym_entry.
10715         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
10716         is_output_symtab_index_set rather than needs_output_symtab_entry.
10717         * testsuite/discard_locals_relocatable_test.c: New file.
10718         * testsuite/discard_locals_test.sh: Test -r.
10719         * testsuite/Makefile.am (check_DATA): Add
10720         discard_locals_relocatable_test1.syms,
10721         discard_local_relocatable_test2.syms.
10722         (MOSTLYCLEANFILES): Likewise.  Also add
10723         discard_locals_relocatable_test1.lout and
10724         discard_locals_relocatable_test2.out.
10725         (discard_locals_relocatable_test1.syms): New target.
10726         (discard_locals_relocatable_test.o): New target.
10727         (discard_locals_relocatable_test1.out): New target.
10728         (discard_locals_relocatable_test2.syms): New target.
10729         (discard_locals_relocatable_test2.out): New target.
10730         (various): Add missing ../ld-new dependencies.
10731         * testsuite/Makefile.in: Rebuild.
10732
10733 2010-03-03  Nick Clifton  <nickc@redhat.com>
10734
10735         * po/fi.po: New Finnish translation.
10736
10737 2010-03-01  Doug Kwan  <dougkwan@google.com>
10738
10739         * layout.cc (Layout::Layout): Force section types of .init_array*,
10740         .preinit_array* and .fini_array* sections.
10741         * output.cc (Output_section::Input_section_sort_entry::has_priority):
10742         Fix check of return value of std::string::find.().
10743         (Output_section::Input_section_sort_compare::operator()): Remove
10744         comment about .init_array.
10745         (Output_section::Input_section_sort_init_fini_compare::operator()):
10746         New method.
10747         (Output_section::sort_attached_input_sections): Handle .init_array
10748         and .fini_array specially.
10749         * output.h (Output_section::Inut_section_sort_compare): Update
10750         comment.
10751         (Output_section::Input_section_sort_init_fini_compare): New struct.
10752
10753 2010-02-26  Doug Kwan  <dougkwan@google.com>
10754
10755         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
10756         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
10757         * testsuite/debug_msg.sh: Avoid matching source line number for
10758         use of global variable undef_int.
10759
10760 2010-02-26  Doug Kwan  <dougkwan@google.com>
10761
10762         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
10763         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
10764         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
10765         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
10766         * options.cc (General_options::General_options): Initialize member
10767         fix_v4bx_.
10768         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
10769         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
10770         and rm_no_fix_v4bx.stdout
10771         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
10772         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
10773         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
10774         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
10775         and arm_no_fix_v4bx.
10776         * Makefile.in: Regenerate.
10777         * testsuite/arm_fix_v4bx.s: New file.
10778         * testsuite/arm_fix_v4bx.sh: Ditto.
10779
10780 2010-02-24  Doug Kwan  <dougkwan@google.com>
10781
10782         * arm.cc (Target_arm::got_section): Make the .got section the first
10783         non RELRO section in the data segment.
10784         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
10785         suffixes of section names.
10786
10787 2010-02-24  Doug Kwan  <dougkwan@google.com>
10788
10789         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
10790         flags and attributes merging if an input file is a binary file.
10791         * fileread.cc (Input_file::open): Record format of original file.
10792         * fileread.h (Input_file::Format): New enum type.
10793         (Input_file::Input_file): Initialize data member format_.
10794         (Input_file::format): New method definition.
10795         (Input_file::format_):: New data member.
10796
10797 2010-02-24  Doug Kwan  <dougkwan@google.com>
10798
10799         * arm.cc (Arm_output_data_got): New class.
10800         (ARM_TCB_SIZE): New constant
10801         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
10802         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10803         If user uses a script with a SECTIONS clause, issue only a warning
10804         for a misplaced EXIDX input section.  Otherwise, issue an error.
10805         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
10806         garbage collection.
10807         (Target_arm::got_mode_index_entry): Handle static linking.
10808         (Target_arm::Scan::local): Ditto.
10809         (Target_arm::Scan::global): Ditto.
10810         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
10811         all incorrectly implemented relocations.
10812         (Target_arm::fix_exidx_coverage): Pass layout to
10813         Arm_output_section::fix_exidx_coverage.
10814         * layout.cc (Layout::section_name_mapping): Remove trailing dots
10815         from ".ARM.exidx." and ".ARM.extab.".
10816
10817 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10818
10819         * arm.cc (Target_arm::do_finalize_sections): Create attribute
10820         section if it does not already exist.
10821         * attributes.cc (Attributes_section_data::Attributes_section_data):
10822         Don't crash if size is zero.
10823
10824 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10825             Ian Lance Taylor  <iant@google.com>
10826
10827         * gold.cc (queue_middle_tasks): If no input files were opened,
10828         exit.
10829         * workqueue.h (Task_function::Task_function): Assert that there is
10830         a blocker.
10831
10832 2010-02-22  Doug Kwan  <dougkwan@google.com>
10833
10834         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
10835         * icf.cc (get_section_contents): Cast snprintf arguments to long long
10836         types to avoid warnings due to different uint64_t implementations
10837         on different hosts.
10838
10839 2010-02-21  Doug Kwan  <dougkwan@google.com>
10840
10841         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
10842         handling of the maximum backward branch offset.
10843         (Arm_relocate_functions::thumb_branch_common): Ditto.
10844         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
10845         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
10846         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
10847         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
10848         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
10849         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
10850         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
10851         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
10852         thumb_bl_out_of_range thumb_bl_out_of_range.o,
10853         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
10854         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
10855         thumb2_bl_out_of_range.o): New rules.
10856         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
10857         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
10858         thumb2_bl_out_of_range
10859         * testsuite/Makefile.in: Regenerate.
10860         * testsuite/arm_bl_in_range.s: New file.
10861         * testsuite/arm_bl_out_of_range.s: Ditto.
10862         * testsuite/arm_branch_in_range.sh: Ditto.
10863         * testsuite/arm_branch_range.t: Ditto.
10864         * testsuite/thumb2_branch_range.t: Ditto.
10865         * testsuite/thumb_bl_in_range.s: Ditto.
10866         * testsuite/thumb_bl_out_of_range.s: Ditto.
10867         * testsuite/thumb_branch_range.t: Ditto.
10868
10869 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
10870
10871         * gc.h (gc_process_relocs): Change vectors to point to the new list.
10872         Add reloc offset information.
10873         * icf.cc (get_section_contents): Change iterators to point to the new
10874         vectors. Add reloc offset information to the contents.
10875         * icf.h (Icf::Sections_reachable_info): New typedef.
10876         (Icf::Sections_reachable_list): New typedef.
10877         (Icf::Offset_info): New typedef.
10878         (Icf::Reloc_info): New struct typedef.
10879         (Icf::Reloc_info_list): New typedef.
10880         (Icf::symbol_reloc_list): Delete method.
10881         (Icf::addend_reloc_list): Delete method.
10882         (Icf::section_reloc_list): Delete method.
10883         (Icf::reloc_info_list): New method.
10884         (Icf::reloc_info_list_): New member.
10885
10886 2010-02-19  Doug Kwan  <dougkwan@google.com>
10887
10888         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
10889         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
10890         * arm.cc (Arm_relocation_functions): New forward declaration.
10891         (Target_arm::Target_arm): Initialize new data members
10892         got_mod_index_offset_ and tls_base_symbol_defined_.
10893         (Target_arm::Relocate::relocate_tls): New method.
10894         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
10895          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
10896         New methods.
10897         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
10898         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
10899         (Target_arm::got_mod_index_offset_,
10900         Target_arm::tls_base_symbol_defined_): New data members.
10901         (Target_arm::Scan::local, Target::Scan::global,
10902         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
10903         relocations.
10904
10905 2010-02-18  Doug Kwan  <dougkwan@google.com>
10906
10907         * arm.cc (Arm_relobj::find_linked_text_section): New method.
10908         (Arm_relobj::make_exidx_input_section): Pass section index of linked
10909         text section as a parameter becuase some broken tools may not set
10910         the link in section header.
10911         (Target_arm::has_got_section): New method.
10912         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
10913         without any mapping symbol as data only.  Remove warning.
10914         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
10915         link in its section header, try to discover the link by inspecting the
10916         REL31 relocation at the beginning of the section.
10917         (Target_arm::Scan::check_non_pic): Report name of offending relocation
10918         in error message.
10919         (Target_arm::Scan::global): Treat any reference to the symbol
10920         _GLOBAL_OFFSET_TABLE_ as a GOT access.
10921
10922 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
10923
10924         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
10925         (Scan::global_reloc_may_be_function_pointer): New function.
10926         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10927         (Scan::global_reloc_may_be_function_pointer): New function.
10928         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10929         (Scan::global_reloc_may_be_function_pointer): New function.
10930         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
10931         (Scan::global_reloc_may_be_function_pointer): New function.
10932         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
10933         (Scan::global_reloc_may_be_function_pointer): New function.
10934         (Scan::possible_function_pointer_reloc): New function.
10935         (Target_x86_64::can_check_for_function_pointers): New function.
10936         * gc.h (gc_process_relocs): Scan relocation types to determine if
10937         function pointers were taken for targets that support it.
10938         * icf.cc (Icf::find_identical_sections): Include functions for
10939         folding in safe ICF whose pointer is not taken.
10940         * icf.h (Secn_fptr_taken_set): New typedef.
10941         (fptr_section_id_): New member.
10942         (section_has_function_pointers): New function.
10943         (set_section_has_function_pointers): New function.
10944         (check_section_for_function_pointers): New function.
10945         * options.h: Fix comment for safe ICF option.
10946         * target.h (can_check_for_function_pointers): New function.
10947         * testsuite/Makefile.am: Add icf_safe_so_test test case.
10948         Modify icf_safe_test for X86-64.
10949         * testsuite/Makefile.in: Regenerate.
10950         * testsuite/icf_safe_so_test.cc: New file.
10951         * testsuite/icf_safe_so_test.sh: New file.
10952         * testsuite/icf_safe_test.cc (kept_func_3): New function.
10953         (main): Change to take pointer to function kept_func_3.
10954         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
10955         folding is done correctly for X86-64.
10956
10957 2010-02-12  David S. Miller  <davem@davemloft.net>
10958
10959         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
10960         is_symbolless parameter.
10961         (Output_reloc<SHT_REL>::is_symbolless): New.
10962         (Output_reloc<SHT_REL>::is_symbolless_): New.
10963         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
10964         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
10965         (Output_reloc<SHT_RELA>::is_symbolless): New.
10966         (Output_data_reloc::add_global): Handle is_symbolless.
10967         (Output_data_reloc::add_global_relative): Likewise.
10968         (Output_data_reloc::add_local): Likewise.
10969         (Output_data_reloc::add_local_relative): Likewise.
10970         (Output_data_reloc::add_symbolless_global_addend): New.
10971         (Output_data_reloc::add_symbolless_local_addend): New.
10972         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
10973         is_symbolless.
10974         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
10975         instead of ->is_relative_
10976         (Output_reloc::write): Likewise.
10977         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
10978         (Output_reloc::write_rel): Simplify.
10979
10980         * sparc.cc (Target_sparc::Scan::local): Use
10981         ->add_symbolless_local_addend as needed.
10982         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
10983         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
10984         based upon relocation offset.
10985
10986 2010-02-11  Doug Kwan  <dougkwan@google.com>
10987
10988         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
10989         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
10990         beginning of function.
10991         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
10992         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
10993         parameter is_32bit in calls to should_apply_static_reloc.
10994         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
10995         (check_DATA): Add arm_abs_global.stdout.
10996         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
10997         arm_abs_global.stdout): New rules.
10998         (MOSTLLYCLEANFILES): Add arm_abs_global
10999         * Makefile.in: Regenerate.
11000         * testsuite/arm_abs_global.s: New file.
11001         * testsuite/arm_abs_global.sh: Ditto.
11002         * testsuite/arm_abs_lib.s: Ditto.
11003
11004 2010-02-11  Ian Lance Taylor  <iant@google.com>
11005
11006         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
11007         Read_relocs task.
11008         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
11009         Allocate_commons_task first.
11010         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
11011         task, rather than symtab_lock_.
11012         (Gc_process_relocs::~Gc_process_relocs): New function.
11013         (Gc_process_relocs::is_runnable): Check this_blocker_.
11014         (Gc_process_relocs::locks): Use next_blocker_ rather than
11015         blocker_.
11016         (Scan_relocs::~Scan_relocs): New function.
11017         (Scan_relocs::is_runnable): Check this_blocker_ rather than
11018         symtab_lock_.
11019         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
11020         next_blocker_.
11021         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
11022         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
11023         constructor accordingly.
11024         (class Gc_process_relocs): Likewise.
11025         (class Scan_relocs): Likewise.
11026         * common.h (class Allocate_commons_task): Remove symtab_lock_
11027         field, and corresponding constructor parameter.
11028         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
11029         symtab_lock_.
11030         (Allocate_commons_task::locks): Likewise.
11031
11032 2010-02-11  Ian Lance Taylor  <iant@google.com>
11033
11034         * gold-threads.h (class Once): Define.
11035         (class Initialize_lock): Rewrite as child of Once.
11036         * gold-threads.cc (class Once_initialize): Define.
11037         (once_pointer_control): New static variable.
11038         (once_pointer, once_arg): New static variables.
11039         (c_run_once): New static function.
11040         (Once::Once, Once::run_once, Once::internal_run): New functions.
11041         (class Initialize_lock_once): Remove.
11042         (initialize_lock_control): Remove.
11043         (initialize_lock_pointer): Remove.
11044         (initialize_lock_once): Remove.
11045         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
11046         (Initialize_lock::initialize): Rewrite.
11047         (Initialize_lock::do_run_once): New function.
11048         * archive.cc (Archive::interpret_header): Only clear name if it is
11049         not already empty.
11050         * fileread.cc: Include "gold-threads.h"
11051         (file_counts_lock): New static variable.
11052         (file_counts_initialize_lock): Likewise.
11053         (File_read::release): Only increment counts when using --stats.
11054         Use a lock around the increment.
11055         * parameters.cc (class Set_parameters_target_once): Define.
11056         (set_parameters_target_once): New static variable.
11057         (Parameters::Parameters): Move here from parameters.h.
11058         (Parameters::set_target): Rewrite.
11059         (Parameters::set_target_once): New function.
11060         (Parameters::clear_target): Move here and rewrite.
11061         * parameters.h (class Parameters): Update declarations.  Add
11062         set_parameters_target_once_ field.
11063         (Parameters::Parameters): Move to parameters.cc.
11064         (Parameters::clear_target): Likewise.
11065         * readsyms.cc (Read_symbols::do_group): Create a Start_group
11066         task.
11067         (Start_group::~Start_group): New function.
11068         (Start_group::is_runnable): New function.
11069         (Start_group::locks, Start_group::run): New functions.
11070         (Finish_group::run): Change saw_undefined to size_t.
11071         * readsyms.h (class Start_group): Define.
11072         (class Finish_group): Change saw_undefined_ field to size_t.
11073         (Finish_group::Finish_group): Remove saw_undefined and
11074         this_blocker parameters.  Change all callers.
11075         (Finish_group::set_saw_undefined): New function.
11076         (Finish_group::set_blocker): New function.
11077         * symtab.h (class Symbol_table): Change saw_undefined to return
11078         size_t.  Change saw_undefined_ field to size_t.
11079         * target-select.cc (Set_target_once::do_run_once): New function.
11080         (Target_selector::Target_selector): Initialize set_target_once_
11081         field.  Don't initialize lock_ and initialize_lock_ fields.
11082         (Target_selector::instantiate_target): Rewrite.
11083         (Target_selector::set_target): New function.
11084         * target-select.h (class Set_target_once): Define.
11085         (class Target_selector): Update declarations.  Make
11086         Set_target_once a friend.  Remove lock_ and initialize_lock_
11087         fields.  Add set_target_once_ field.
11088
11089 2010-02-10  Ian Lance Taylor  <iant@google.com>
11090
11091         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
11092         queueing any tasks.
11093         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
11094         (queue_middle_tasks): Add all blockers before queueing any tasks.
11095         (queue_final_tasks): Likewise.
11096         * token.h (Task_token::add_blockers): New function.
11097         * object.h (Input_objects::number_of_relobjs): New function.
11098
11099 2010-02-10  Ian Lance Taylor  <iant@google.com>
11100
11101         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
11102         shared, not if not position independent.
11103         * x86_64.cc (Relocate::relocate_tls): Likewise.
11104         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
11105         (tls_pie_pic_test): New target.
11106         * testsuite/Makefile.in: Rebuild.
11107
11108         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
11109         (tls_test_main_pie.o, tls_test_pie.o): New targets.
11110         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
11111         * testsuite/Makefile.in: Rebuild.
11112
11113 2010-02-09  David S. Miller  <davem@davemloft.net>
11114
11115         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
11116         R_SPARC_RELATIVE using ->add_local_relative().
11117         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
11118
11119         * output.h (Output_data_dynamic::add_section_size): New method
11120         that takes two Output_data objects.
11121         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
11122         entry param.  Handle it in initializers.
11123         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
11124         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
11125         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
11126         arg.
11127         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
11128         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
11129         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
11130         for dynrel_includes_plt.
11131         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11132         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11133         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
11134         before .rela.plt
11135         (Target_sparc::do_finalize_sections): Update to pass true for
11136         dynrel_includes_plt.
11137         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
11138         output before .rela.plt
11139         (Target_powerpc::do_finalize_sections): Update to pass true for
11140         dynrel_includes_plt when 32-bit.
11141
11142 2010-02-08  Doug Kwan  <dougkwan@google.com>
11143
11144         * arm.cc (Arm_relobj::simple_input_section_output_address): New
11145         method.
11146         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
11147         Arm_relobj::scan_section_for_cortex_a8_stubs,
11148         Arm_relobj::do_relocation_section): Instead of calling
11149         Output_section::output_address, use faster
11150         Arm_relobj::simple_input_section_output_address.
11151
11152 2010-02-08  David S. Miller  <davem@davemloft.net>
11153
11154         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
11155         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
11156         relocation helper function.
11157
11158         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
11159         just like R_SPARC_GOT{10,13,22}.
11160         (Target_sparc::Scan::local): Likewise.
11161         (Target_sparc::Relocate:relocate): Likewise.
11162
11163 2010-02-06  Ian Lance Taylor  <iant@google.com>
11164
11165         * configure.ac: Rewrite targetobjs duplicate removal code to use
11166         only shell constructs.
11167         * configure: Rebuild.
11168
11169 2010-02-05  Doug Kwan  <dougkwan@google.com>
11170
11171         PR 11247
11172         * arm.cc (Arm_relobj::section_is_scannable): New method.
11173         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
11174         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
11175
11176 2010-02-04  Doug Kwan  <dougkwan@google.com>
11177
11178         PR 11247
11179         * arm-reloc-property.cc (cstdio): Include.
11180         * configure.ac (targetobjs): Remove duplicates.
11181         * configure: Regenerate.
11182         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
11183         big and little endian version for a given address size.
11184
11185 2010-02-03  Doug Kwan  <dougkwan@google.com>
11186
11187         * arm-reloc-property.cc
11188         (Arm_reloc_property_table::reloc_name_in_error_message): New method
11189         definition.
11190         * arm-reloc-property.h
11191         (Arm_reloc_property_table::get_implemented_static_reloc_property):
11192         New method definition.
11193         (Arm_reloc_property_table::reloc_name_in_error_message): New method
11194         declaration.
11195         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
11196         overflow to N.
11197         (GOT_PREL): Change implemented to Y.
11198         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
11199         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
11200         (Arm_relocate_functions::movw_abs_nc): Remove method.
11201         (Arm_relocate_functions::movt_abs): Ditto.
11202         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
11203         (Arm_relocate_functions::thm_movt_abs): Ditto.
11204         (Arm_relocate_functions::movw_rel_nc): Ditto.
11205         (Arm_relocate_functions::movw_rel): Ditto.
11206         (Arm_relocate_functions::movt_rel): Ditto.
11207         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
11208         (Arm_relocate_functions:thm_movw_rel): Ditto.
11209         (Arm_relocate_functions:thm_movt_rel): Ditto.
11210         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
11211         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
11212         New method definitions.
11213         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
11214         (Arm_relocation_functions::arm_grp_ldr): Ditto.
11215         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
11216         (Arm_relocation_functions::arm_grp_ldc): Ditto.
11217         (Target_arm::Relocate::relocate): Check for non-static or
11218         unimplemented relocation code and exit early.  Change calls to
11219         Target_arm::reloc_uses_thumb_bit and
11220         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
11221         instead.  Refactor code to handle similar relocations to increase
11222         code sharing.  Remove check for unsupported relocation code in switch
11223         statement.
11224         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
11225         relocation property table to find out size.  Change error message to
11226         print out the name of a relocation code instead of the numeric value.
11227         (Target_arm::scan_reloc_for_stub): Use relocation property table
11228         instead of calling Target_arm::reloc_uses_thumb_bit().
11229
11230 2010-02-02  Doug Kwan  <dougkwan@google.com>
11231
11232         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
11233         types of relaxed input section.
11234
11235 2010-02-02  Doug Kwan  <dougkwan@google.com>
11236
11237         * Makefile.am (HFILES): Add arm-reloc-property.h.
11238         (DEFFILES): New.
11239         (TARGETSOURCES): Add arm-reloc-property.cc
11240         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
11241         (libgold_a_SOURCES): $(DEFFILES)
11242         * Makefile.in: Regenerate.
11243         * arm-reloc-property.cc: New file.
11244         * arm-reloc-property.h: New file.
11245         * arm-reloc.def: New file.
11246         * arm.cc: Update comments.
11247         (arm-reloc-property.h): New included header.
11248         (arm_reloc_property_table): New global variable.
11249         (Target_arm::do_select_as_default_target): New method definition.
11250         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
11251         arm-reloc-property to targ_extra_obj.
11252         * parameters.cc (set_parameters_target): Call
11253         Target::select_as_default_target().
11254         * target.h (Target::select_as_default_target): New method definition.
11255         (Target::do_select_as_default_target): Same.
11256
11257 2010-02-01  Doug Kwan  <dougkwan@google.com>
11258
11259         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
11260         first_output_text_section_.
11261         (Arm_exidx_fixup::first_output_text_section): New method definition.
11262         (Arm_exidx_fixup::first_output_text_section_): New data member.
11263         (Arm_exidx_fixup::process_exidx_section): Record the first text
11264         output section seen.
11265         (Arm_output_section::fix_exidx_coverage): Set correct linked section
11266         and entsize in output section header.
11267
11268 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11269
11270         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
11271         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
11272         (Arm_relocate_functions::thm_alu11): New Method.
11273         (Arm_relocate_functions::thm_pc8): New Method.
11274         (Arm_relocate_functions::thm_pc12): New Method.
11275         (Target_arm::Scan::local): Handle the relocations.
11276         (Target_arm::Scan::global): Likewise.
11277         (Target_arm::Relocate::relocate): Likewise.
11278         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11279
11280 2010-01-29  Doug Kwan  <dougkwan@google.com>
11281
11282         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
11283         of relocation types as ld.
11284
11285 2010-01-29  Doug Kwan  <dougkwan@google.com>
11286
11287         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
11288         to public.
11289         (Arm_relocate_functions::thumb_branch_common): Ditto.
11290         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
11291         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
11292         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
11293         Arm_relocate_functions::jump24): Remove.
11294         (Target_arm::Relocate::relocate): Adjust code to call
11295         Arm_relocation_functions::arm_branch_common and
11296         Arm_relocation_functions::thumb_branch_common instead of their removed
11297         wrappers.  Merge switch-cases together to reduce source code size.
11298
11299 2010-01-29  Doug Kwan  <dougkwan@google.com>
11300
11301         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
11302         output_local_symbol_count_needs_update_.
11303         (Arm_relobj::output_local_symbol_count_needs_update,
11304          Arm_relobj::set_output_local_symbol_count_needs_update,
11305          Arm_relobj::update_output_local_symbol_count): New methods.
11306         (Arm_relobj::output_local_symbol_count_needs_update_): New data
11307         member.
11308         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
11309         of pointed function as in a R_ARM_PREL31 relocation.
11310         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
11311         for output local symbol count updating.
11312         (Target_arm::do_relax): Update output local symbol counts in objects
11313         if necessary.
11314         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
11315
11316 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11317
11318         * arm.cc: Added support for the ARM relocations:
11319         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
11320         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
11321         (Arm_relocate_functions::movw_rel_nc): Renamed (was
11322         movw_prel_nc).
11323         (Arm_relocate_functions::movw_rel): New method.
11324         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
11325         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
11326         thm_movw_prel_nc).
11327         (Arm_relocate_functions::thm_movw_rel): New method.
11328         (Arm_relocate_functions::thm_movt_rel): Renamed (was
11329         thm_movt_prel).
11330         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
11331         relocations.
11332         (Target_arm::Scan::global): Likewise.
11333         (Target_arm::Relocate::relocate): Likewise.
11334         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11335         Likewise.
11336
11337 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11338
11339         * arm.cc: Added support for ARM group relocations.
11340         (Target_arm::reloc_needs_sym_origin): New method.
11341         (Arm_relocate_functions::calc_grp_kn): New method.
11342         (Arm_relocate_functions::calc_grp_residual): New method.
11343         (Arm_relocate_functions::calc_grp_gn): New method.
11344         (Arm_relocate_functions::arm_grp_alu): New Method.
11345         (Arm_relocate_functions::arm_grp_ldr): New Method.
11346         (Arm_relocate_functions::arm_grp_ldrs): New Method.
11347         (Arm_relocate_functions::arm_grp_ldc): New Method.
11348         (Target_arm::Scan::local): Handle the ARM group relocations.
11349         (Target_arm::Scan::global): Likewise.
11350         (Target_arm::Relocate::relocate): Likewise.
11351         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11352         Likewise.
11353
11354 2010-01-26  Doug Kwan  <dougkwan@google.com>
11355
11356         * arm.cc (set): Include.
11357         (class Arm_exidx_fixup): Change type of last_input_section_ to const
11358         pointer type.
11359         (Arm_output_section::Text_section_list): New type.
11360         (Arm_output_section::append_text_sections_to_list): New method.
11361         (Arm_output_section::fix_exidx_coverage): Ditto.
11362         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
11363         (Arm_relobj::convert_input_section_to_relaxed_section): Use
11364         Relobj::set_section_offset() instead of
11365         Sized_relobj::invalidate_section_offset().
11366         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
11367         parameter for section headers. Ignore relocation sections for
11368         unallocated sections and EXIDX sections.
11369         (Target_arm::fix_exidx_coverage): New method.
11370         (Target_arm::output_section_address_less_than): New type.
11371         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
11372         linked text section instead of the EXIDX section.
11373         (Arm_output_section::create_stub_group): Add an assertion to check
11374         that this is not an EXIDX output section.
11375         (Arm_output_section::append_text_sections_to_list): New method.
11376         (Arm_output_section::fix_exidx_coverage): Ditto.
11377         (Arm_relobj::scan_sections_for_stubs): Adjust call to
11378         Arm_relobj::section_needs_reloc_stub_scanning.
11379         (Target_arm::do_relax): Fix EXIDX output section coverage in the
11380         first pass.
11381         (Target_arm::fix_exidx_coverage): New method.
11382         * object.h (Relobj::set_output_section): New method.
11383         (Sized_relobj::invalidate_section_offset): Remove method.
11384         (Sized_relobj::do_invalidate_section_offset): Remove method.
11385         (Sized_relobj::do_set_section_offset): Handle offset value -1.
11386
11387 2010-01-25  Doug Kwan  <dougkwan@google.com>
11388
11389         * arm.cc (Arm_exidx_merged_section::do_output_offset):
11390         Fix warning due to signed and unsigned comparison on a 32-bit host.
11391
11392 2010-01-22  Doug Kwan  <dougkwan@google.com>
11393
11394         * arm.cc (Target_arm::do_relax): Record an output section for section
11395         offset adjustment it contains any stub table that has changed.
11396         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
11397         offsets in an output section if necessary.
11398         * output.cc (Output_section::Output_section): Initialize
11399         section_offsets_need_adjustments_.
11400         (Output_section::add_input_section_for_script): Renamed to
11401         Output_section::add_simple_input_section.
11402         (Output_section::save_states): Add a comment.
11403         (Output_section::discard_states): New method defintion.
11404         (Output_section::adjust_section_offsets): Same.
11405         * output.h (Output_section::add_input_section_for_script): Renamed to
11406         Output_section::add_simple_input_section.
11407         (Output_section::discard_states): New method declaration.
11408         (Output_section::adjust_section_offsets): Same.
11409         (Output_section::section_offsets_need_adjustment,
11410         Output_section::set_section_offsets_need_adjustment): New method
11411         definitions.
11412         (Output_section::section_offsets_need_adjustment_): New data member.
11413         * script-sections.cc
11414         (Output_section_element_input::set_section_address): Adjust code for
11415         renaming of Output_section::add_input_section_for_script.
11416         (Orphan_output_section::set_section_address): Same.
11417
11418 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11419
11420         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
11421         Fix_v4bx enum values .
11422         * gold/options.h (General_options): New option definitions.
11423         (General_options::fix_v4bx): New method.
11424         (General_options::Fix_v4bx): New enum.
11425         * gold/options.cc (General_options::parse_fix_v4bx): New method.
11426         (General_options::parse_fix_v4bx_interworking): New method.
11427
11428 2010-01-22  Doug Kwan  <dougkwan@google.com>
11429
11430         * arm.cc (Arm_exidx_fixup): New class.
11431
11432 2010-01-21  Doug Kwan  <dougkwan@google.com>
11433
11434         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
11435         classes.
11436         (Arm_exidx_section_offset_map): New type.
11437
11438 2010-01-21  Doug Kwan  <dougkwan@google.com>
11439
11440         * arm.cc (Arm_exidx_input_section): New class.
11441         (Arm_relobj::exidx_input_section_by_link,
11442         Arm_relobj::exidx_input_section_by_shndx,
11443         Arm_relobj::make_exidx_input_section): New methods.
11444         (read_arm_attributes_section): Remove.
11445         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
11446         information about them.
11447         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
11448         to here.
11449
11450 2010-01-20  Doug Kwan  <dougkwan@google.com>
11451
11452         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
11453         Input_section_specifier to Section_id.
11454         (Target_arm::new_arm_input_section: Adjust code for change of key
11455         type.
11456         (Target_arm::find_arm_input_section): Ditto.
11457         * gc.h (object.h): Include for Section_id nand Section_id_hash.
11458         (Section_id): Remove.
11459         (Garbage_collection::Section_id_hash): Remove.
11460         * icf.h (object.h): Include for Section_id nand Section_id_hash.
11461         (Section_id): Remove.
11462         (Icf::Section_id_hash): Remove.
11463         * object.h (Section_id, Const_section_id, Section_id_hash,
11464         Const_section_id_hash): New type definitions.
11465         * output.cc (Output_section::add_relaxed_input_section): Change to
11466         use Const_section_id instead of Input_section_specifier as key type.
11467         (Output_section::add_merge_input_section): Ditto.
11468         (Output_section::build_relaxation_map): Change to use Section_id
11469         instead of Input_section_specifier as key type.
11470         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11471         Ditto.
11472         (Output_section::convert_input_sections_to_relaxed_sections): Change
11473         to use Const_section_id instead of Input_section_specifier as key type.
11474         (Output_section::find_merge_section): Ditto.
11475         (Output_section::find_relaxed_input_section): Ditto.
11476         * output.h (Input_section_specifier): Remove class.
11477         (Output_section::Output_section_data_by_input_section_map): Change
11478         key type to Const_section_id.
11479         (Output_section::Output_relaxed_input_section_by_input_section_map):
11480         Ditto.
11481         (Output_section::Relaxation_map): Change key type to Section_id.
11482
11483 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11484
11485         * gold/arm.cc: Added support for R_ARM_V4BX relocation
11486         (class Arm_v4bx_stub): New class.
11487         (DEF_STUBS): Updated definition to support v4_veneer_bx.
11488         (Stub_factory::make_arm_v4bx_stub): New method.
11489         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
11490         (Stub_table::empty): Handle v4bx stubs.
11491         (Stub_table::add_arm_v4bx_stub): New method.
11492         (Stub_table::find_arm_v4bx_stub): New method.
11493         (Arm_relocate_functions::v4bx): New method.
11494         (Target_arm::fix_v4bx): New method.
11495         (Target_arm::Target_arm): Handle R_ARM_V4BX.
11496         (Stub_table::relocate_stubs): Likewise.
11497         (Stub_table::do_write): Likewise.
11498         (Stub_table::update_data_size_and_addralign): Likewise.
11499         (Stub_table::finalize_stubs):  Likewise.
11500         (Target_arm::Scan::local): Likewise.
11501         (Target_arm::Scan::global): Likewise.
11502         (Target_arm::do_finalize_sections): Likewise.
11503         (Target_arm::Relocate::relocate): Likewise.
11504         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11505         Likewise.
11506         (Target_arm::scan_reloc_for_stub): Likewise.
11507         (Target_arm::scan_reloc_section_for_stubs): Likewise.
11508
11509 2010-01-19  Ian Lance Taylor  <iant@google.com>
11510
11511         * output.cc (Output_section_headers::do_sized_write): Write large
11512         segment count to sh_info field.
11513         (Output_file_header::do_sized_write): For large segment count,
11514         write PN_XNUM to e_phnum field.
11515
11516 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11517
11518         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
11519         (Arm_relocate_functions::thm_jump8): New function.
11520         (Arm_relocate_functions::thm_jump11): New function.
11521         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
11522         R_ARM_THM_JUMP11.
11523         (Target_arm::Scan::global): Likewise.
11524         (Target_arm::Relocate::relocate): Likewise.
11525         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11526         Likewise.
11527
11528 2010-01-14  Doug Kwan  <dougkwan@google.com>
11529
11530         * arm.cc (map, utility): Include headers.
11531         (Target_arm::apply_cortex_a8_workaround): New method.
11532         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
11533         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
11534         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
11535         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
11536         the --[no-]fix-cortex-a8 command line options.
11537         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
11538         (Target_arm::relocate_stub): Use addend in instruction template.
11539         * options.h (DEFINE_bool): Set the user-set flag.
11540         (General_options): Add --[no-]-fix-cortex options.
11541         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
11542         : Update fast look-up map after conversion.
11543
11544 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
11545
11546         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
11547         in the first pass of do_layout.
11548
11549 2010-01-13  Doug Kwan  <dougkwan@google.com>
11550
11551         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11552         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
11553         apparent compiler problem of not folding static constant integral
11554         data members of elfcpp::Elf_sizes<32>.
11555
11556 2010-01-13  Doug Kwan  <dougkwan@google.com>
11557
11558         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11559         Arm_relobj::section_needs_cortex_a8_stub_scanning,
11560         Arm_relobj::scan_section_for_cortex_a8_erratum,
11561         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
11562         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
11563         sections to scan for relocation stubs into a new method
11564         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
11565         relocation and Cortex-A8 stub scanning.
11566         (Target_arm::do_relax): Force stubs to be after stubbed sections
11567         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
11568         the beginning of a new relaxation pass.  Update a comment.
11569         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
11570
11571 2010-01-12  Ian Lance Taylor  <iant@google.com>
11572
11573         * target-reloc.h (visibility_error): New inline function.
11574         (relocate_section): Call visibility_error.
11575         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
11576         (MOSTLYCLEANFILES): Likewise.
11577         (protected_4_pic.o, protected_3.err): New targets.
11578         * testsuite/protected_4.cc: New file.
11579
11580 2010-01-12  Doug Kwan  <dougkwan@google.com>
11581
11582         * arm.cc (Cortex_a8_reloc): New class.
11583         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
11584         and cortex_a8_relocs_info_.
11585         (Target_arm::fix_cortex_a8): New method definition.
11586         (Target_arm::Cortex_a8_relocs_info): New type.
11587         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
11588         New data member declarations.
11589         (Target_arm::scan_reloc_for_stub): Record information about
11590         relocations for THUMB branches that might be exempted from the
11591         Cortex-A8 workaround.
11592         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
11593         at the beginning of a relaxation pass.
11594
11595 2010-01-12  Doug Kwan  <dougkwan@google.com>
11596
11597         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
11598         (Arm_relobj::Mapping_symbol_position,
11599          Arm_reloj::Mapping_symbol_position_less,
11600          Arm_relobj::Mapping_symbols_info): New types.
11601         (Target_arm::is_mapping_symbol_name): New method definition.
11602         (Arm_relobj::do_count_local_symbols): Save information about mapping
11603         symbols.
11604
11605 2010-01-11  Doug Kwan  <dougkwan@google.com>
11606
11607         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
11608         Arm_relocate_functions::thumb32_branch_upper,
11609         Arm_relocate_functions::thumb32_branch_lower,
11610         Arm_relocate_functions::thumb32_cond_branch_offset,
11611         Arm_relocate_functions::thumb32_cond_branch_upper,
11612         Arm_relocate_functions::thumb32_cond_branch_lower,
11613         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
11614         branch offset encoding.
11615         (Arm_relocate_functions::thumb_branch_common): Use new branch
11616         offset encoding methods to avoid code duplication.
11617         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
11618         (Stub_addend_reader::operator()): Use new branch encoding method
11619         to avoid code duplication.
11620
11621 2010-01-11  Doug Kwan  <dougkwan@google.com>
11622
11623         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
11624         (Target_arm::do_finalize_sections): Define special EXIDX section
11625         symbols only if referenced.
11626         * gc.h (Garbage_collection::add_reference): New method.
11627         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
11628         code duplication.
11629
11630 2010-01-11  Ian Lance Taylor  <iant@google.com>
11631
11632         * script.cc (Version_script_info::build_expression_list_lookup):
11633         Change complaing about duplicate wildcard match from error to
11634         warning.
11635
11636         * script.cc (class Lazy_demangler): Recreate--revert part of patch
11637         of 2009-12-30.
11638         (Version_script_info::Version_script_info): Initialize globs_,
11639         default_version_, default_is_global_, and exact_.  Don't
11640         initialize globals_ or locals_.
11641         (Version_script_info::build_lookup_tables): Build local symbols
11642         first.
11643         (Version_script_info::unquote): New function.
11644         (Version_script_info::add_exact_match): New function.
11645         (Version_script_info::build_expression_list_lookup): Remove lookup
11646         parameter.  Add is_global parameter.  Change all callers.  Handle
11647         wildcard pattern specially.  Unquote pattern.  Call
11648         add_exact_match.
11649         (Version_script_info::get_name_to_match): New function.
11650         (Version_script_info::get_symbol_version): New function.
11651         (Version_script_info::get_symbol_version_helper): Remove.
11652         (Version_script_info::check_unmatched_names): Call unquote.
11653         * script.h (class Version_script_info): Change get_symbol_version
11654         to be non-inline and add is_global parameter; change all callers.
11655         Rewrite symbol_is_local.  Update declarations.  Define struct
11656         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
11657         Remove globals_ and locals_ members.  Add exact_, globs_,
11658         default_version_, is_global_.
11659         (Version_script_info::Glob): Remove pattern, add expression and
11660         is_global.  Update constructor.  Change all callers.
11661         * dynobj.cc (Versions::finalize): Mark the version symbol as the
11662         default version.
11663         (Versions::symbol_section_contents): If a symbol is undefined, or
11664         defined in a dynamic object, set the version index to
11665         VER_NDX_LOCAL.
11666         * symtab.cc (Symbol_table::add_from_relobj): Don't call
11667         symbol_is_local.
11668         (Symbol_table::add_from_pluginobj): Likewise.
11669         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
11670
11671 2010-01-11  Doug Kwan  <dougkwan@google.com>
11672
11673         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
11674         (incremental_dump_LDADD): Add linking option for libintl.
11675         * Makefile.in: Regenerate.
11676
11677 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
11678
11679         PR gold/11144
11680         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
11681         instead of -Ds.
11682         * testsuite/Makefile.in: Regenerated.
11683
11684 2010-01-10  Doug Kwan  <dougkwan@google.com>
11685
11686         * options.h (DEFINE_var): Use parentheses around argument varname__
11687         in macro body to avoid any unintended subsequent substitutions.
11688
11689 2010-01-10  Ian Lance Taylor  <iant@google.com>
11690
11691         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
11692         candidates before doing symbol resolution.
11693
11694         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
11695         ODR candidates if only one is weak.
11696
11697 2010-01-08  Ian Lance Taylor  <iant@google.com>
11698
11699         * script.cc (Version_script_info::build_expression_list_lookup):
11700         Don't warn about ambiguous version, just record the ambiguity.
11701         (Version_script_info::get_symbol_version_helper): Give error if
11702         version is ambiguous.
11703
11704 2010-01-08  Doug Kwan  <dougkwan@google.com>
11705
11706         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
11707         prev_data_size_ and prev_addralign_.  Remove initializer for
11708         deleted data member has_been_changed_.
11709         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
11710         to determine if the table is empty.
11711         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
11712         Remove.
11713         (Stub_table::add_reloc_stub): Define method in class definition
11714         instead of just declaring it there.
11715         (Stub_table::add_cortex_a8_stub): New method definition.
11716         (Stub_table::update_data_size_and_addralign): Ditto.
11717         (Stub_table::finalize_stubs): Ditto.
11718         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
11719         (Stub_table::do_addralign_): Return address alignment in the
11720         (Stub_table::do_reset_address_and_file_offset): Define method in
11721         class definition instead of declaring it there.  Set current data
11722         size to be the data size of the previous pass.
11723         (Stub_table::set_final_data_size): Use current data size as the
11724         final data size.
11725         (Stub_table::relocate_stub): Change parameter type of stub from
11726         Reloc_stub pointer to Stub pointer.
11727         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
11728         (Stub_table::Cortex_a8_stub_list): New typedef.
11729         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
11730          Stub_table::prev_addralign_): New data member.
11731         (Arm_relobj::Arm_relobj): Initialize data member
11732         section_has_cortex_a8_workaround_.
11733         (Arm_relobj::section_has_cortex_a8_workaround,
11734          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
11735          definitions.
11736         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
11737         declarations.
11738         (Target_arm::relocate_stub): Change parameter type of stub from
11739         Reloc_stub pointer to Stub pointer.
11740         (Insn_template::size, Insn_template::alignment): Handle
11741         THUMB16_SPECIAL_TYPE.
11742         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
11743          Stub_table::update_data_size_and_addralign,
11744          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
11745         definitions.
11746         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
11747         (Stub_table::do_write): Ditto.
11748         (Target_arm::do_relax): Adjust code for changes in Stub_table.
11749
11750 2010-01-08  Ian Lance Taylor  <iant@google.com>
11751
11752         PR 11108
11753         * symtab.h (class Symbol): Remove fields is_target_special_ and
11754         has_plt_offset_.  Add field is_defined_in_discarded_section_.
11755         (Symbol::is_defined_in_discarded_section): New function.
11756         (Symbol::set_is_defined_in_discarded_section): New function.
11757         (Symbol::has_plt_offset): Rewrite.
11758         (Symbol::set_plt_offset): Verify that new offset is not -1U.
11759         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
11760         Don't initialize is_target_special_ or has_plt_offset_.
11761         Initialize is_defined_in_discarded_section_.
11762         (Symbol_table::add_from_relobj): If appropriate, set
11763         is_defined_in_discarded_section.
11764         * resolve.cc (Symbol::override_base_with_special): Don't test
11765         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
11766         * target-reloc.h (relocate_section): Do special handling for
11767         symbols defined in discarded sections for global symbols as well
11768         as local symbols.
11769
11770 2010-01-08  Ian Lance Taylor  <iant@google.com>
11771
11772         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
11773         the SHT_SYMTAB case.
11774
11775 2010-01-08  Ian Lance Taylor  <iant@google.com>
11776
11777         * object.cc (Sized_relobj::do_layout): Don't get confused if
11778         layout_eh_frame returns NULL.
11779
11780 2010-01-08  Ian Lance Taylor  <iant@google.com>
11781
11782         PR 11084
11783         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
11784         dynamic symbol table, use the normal symbol table.
11785         (Sized_dynobj::do_read_symbols): Remove assertion about type of
11786         symbol table.
11787
11788 2010-01-08  Ian Lance Taylor  <iant@google.com>
11789
11790         PR 11072
11791         * layout.cc (Layout::include_section): Remove .gnu_debuglink
11792         sections.
11793
11794 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
11795
11796         * version.cc (print_version): Change to "Copyright 2010".
11797
11798 2010-01-08  Ian Lance Taylor  <iant@google.com>
11799
11800         PR 10287
11801         PR 11063
11802         * i386.cc (class Target_i386): Change return type of plt_section
11803         to be non-const.
11804         (class Output_data_plt_i386): Add tls_desc_rel_ field.
11805         (Output_data_plt_i386::Output_data_plt_i386): Initialize
11806         tls_desc_rel_ field.
11807         (Output_data_plt_i386::rel_tls_desc): New function.
11808         (Target_i386::rel_tls_desc_section): New function.
11809         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
11810         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
11811         R_386_TLS_DESC reloc in rel_tls_desc_section.
11812         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
11813         Define struct Tlsdesc_info.
11814         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
11815         (Target_x86_64::do_reloc_symbol_index): New function.
11816         (Target_x86_64::add_tlsdesc_info): New function.
11817         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
11818         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
11819         tlsdesc_rel_ field.
11820         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
11821         all callers.
11822         (Output_data_plt_x86_64::rela_tlsdesc): New function.
11823         (Target_x86_64::rela_tlsdesc_section): New function.
11824         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
11825         handling.
11826         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
11827         (Target_x86_64::do_reloc_addend): New function.
11828         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
11829         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
11830         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
11831         (Output_reloc::type): New function.
11832         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
11833         (Output_reloc::is_target_specific): New function.
11834         (Output_reloc::target_arg): New function.
11835         (class Output_reloc) [SHT_RELA]: Add four new constructors for
11836         absolute relocs and target specific relocs.
11837         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
11838         add_target_specific.
11839         (class Output_data_reloc) [SHT_RELA]: Likewise.
11840         * output.cc (Output_reloc::Output_reloc): Add four new versions
11841         for absolute relocs and target specific relocs.
11842         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
11843         (Output_reloc::get_symbol_index): Likewise.
11844         (Output_reloc::local_section_offset): Check that local_sym_index_
11845         is not TARGET_CODE or 0.
11846         (Output_reloc::symbol_value): Likewise.
11847         (Output_reloc::write) [SHT_RELA]: Call target for target specific
11848         reloc.
11849         * target.h (class Target): Add reloc_symbol_index and reloc_addend
11850         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
11851         functions.
11852         * layout.cc (add_target_dynamic_tags): Use output section for
11853         DT_PLTRELSZ and DT_JMPREL.
11854
11855 2010-01-07  Ian Lance Taylor  <iant@google.com>
11856
11857         PR 11061
11858         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
11859         function.
11860         (class Output_data_reloc_generic): Define.
11861         (class Output_data_reloc_base): Change base class to
11862         Output_data_reloc_generic.  Change add() method to call
11863         bump_relative_reloc_count for a relative reloc.  Remove
11864         sort_relocs_ field.
11865         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
11866         to sort_relocs().
11867         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
11868         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
11869         appropriate.
11870         * layout.h (class Layout): Update declaration.
11871
11872 2010-01-07  Ian Lance Taylor  <iant@google.com>
11873
11874         * output.h (class Output_data): Add const version of
11875         output_section and do_output_section.
11876         (class Output_section_data): Add const version of
11877         do_output_section.
11878         (class Output_section): Likewise.
11879         * layout.cc (Layout::add_target_dynamic_tags): New function.
11880         * layout.h (class Layout): Update declarations.
11881         * arm.cc (Target_arm::do_finalize_sections): Use
11882         add_target_dynamic_tags.
11883         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11884         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11885         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11886         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11887
11888 2010-01-07  Ian Lance Taylor  <iant@google.com>
11889
11890         PR 11042
11891         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
11892         object as needed.
11893
11894 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
11895             Ian Lance Taylor  <iant@google.com>
11896
11897         PR 11019
11898         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
11899         Xindex::read_symtab_xindex.
11900
11901 2010-01-07  Doug Kwan  <dougkwan@google.com>
11902
11903         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
11904         (Insn_template::thumb16_bcond_insn): New method declaration.
11905         (Insn_template): Fix spelling.
11906         (Stub::thumb16_special): New method declaration.
11907         (Stub::do_write): Define virtual method which was previously pure
11908         virtual.
11909         (Stub::do_thumb16_special): New method declaration.
11910         (Stub::do_fixed_endian_write): New template member.
11911         (Reloc_stub::do_write): Remove.
11912         (Reloc_stub::do_fixed_endian_write): Remove.
11913         (Cortex_a8_stub): New class definition.
11914         (Stub_factory::make_cortex_a8_stub): New method definition.
11915         (Stub_factory::Stub_factory): Add missing static storage class
11916         qualifier for elf32_arm_stub_a8_veneer_blx.
11917
11918 2010-01-07  Ian Lance Taylor  <iant@google.com>
11919
11920         PR 10980
11921         * options.h (class General_options): Add --warn-unresolved-symbols
11922         and --error-unresolved-symbols.
11923         * errors.cc (Errors::undefined_symbol): Implement
11924         --warn-unresolved-symbols.
11925
11926         * options.h (class General_options): Add -z text and -z textoff.
11927         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
11928
11929 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
11930
11931         * gc.h (Garbage_collection::Cident_section_map): New typedef.
11932         (Garbage_collection::cident_sections): New function.
11933         (Garbage_collection::add_cident_section): New function.
11934         (Garbage_collection::cident_sections_): New member.
11935         (gc_process_relocs): Add references to sections whose names are C
11936         identifiers.
11937         * gold.h (cident_section_start_prefix): New constant.
11938         (cident_section_stop_prefix): New constant.
11939         (is_cident): New function.
11940         * layout.cc (Layout::define_section_symbols): Replace string constants
11941         with the newly defined constants.
11942         * object.cc (Sized_relobj::do_layout): Track sections whose names are
11943         C identifiers.
11944         * testsuite/Makefile.am: Add gc_orphan_section_test.
11945         * testsuite/Makefile.in: Regenerate.
11946         * testsuite/gc_orphan_section_test.cc: New file.
11947         * testsuite/gc_orphan_section_test.sh: New file.
11948
11949 2010-01-06  Ian Lance Taylor  <iant@google.com>
11950
11951         PR 10980
11952         * options.h (class General_options): Add --warn-shared-textrel.
11953         * layout.cc (Layout::finish_dynamic_section): Implement
11954         --warn-shared-textrel.
11955
11956         PR 10980
11957         * options.h (class General_options): Add --warn-multiple-gp.
11958
11959 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11960
11961         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
11962         $(THREADSLIB) and $(LIBDL).
11963         * Makefile.in: Rebuild.
11964
11965 2010-01-06  Ian Lance Taylor  <iant@google.com>
11966
11967         PR 10980
11968         * options.cc (General_options::parse_section_start): New function.
11969         (General_options::section_start): New function.
11970         (General_options::General_options): Initialize all members.
11971         * options.h: Include <map>
11972         (class General_options): Add --section-start.  Add section_starts_
11973         member.
11974         * layout.cc (Layout::attach_allocated_section_to_segment): If
11975         --section-start was used, set the address of the segment.  Remove
11976         local sort_sections.
11977         (Layout::relaxation_loop_body): If the address of the load segment
11978         has been set by --section-start, don't use it.
11979         * output.h (Output_segment::update_flags_for_output_section): New
11980         function.
11981         * output.cc (Output_segment::add_output_section): Call
11982         update_flags_for_output_section.
11983
11984 2010-01-05  Ian Lance Taylor  <iant@google.com>
11985
11986         PR 10980
11987         * options.h (class General_options): Add --undefined-version.
11988         * script.cc (struct Version_expression): Add was_matched_by_symbol
11989         field.
11990         (Version_script_info::matched_symbol): New function.
11991         (Version_script_info::get_symbol_version_helper): Call
11992         matched_symbol.
11993         (Version_script_info::check_unmatched_names): New function.
11994         * script.h (class Version_script_info): Update declarations.
11995         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
11996
11997         * options.h (class General_options): Use DEFINE_bool_alias for
11998         allow_multiple_definition.
11999         * resolve.cc (Symbol_table::should_override): Don't test
12000         allow_multiple_definition.
12001
12002         PR 10980
12003         * options.h (class General_options): Add --cref.
12004         * main.cc (main): Print cref table if --cref.  Don't close mapfile
12005         until after printing cref table.
12006         * cref.cc: Include "symtab.h".
12007         (class Cref_inputs): Define Cref_table_compare and Cref_table.
12008         (Cref_table_compare::operator()): New function.
12009         (Cref_inputs::gather_cref): New function.
12010         (filecol): New static const.
12011         (Cref_inputs::print_cref): New function.
12012         (Cref::print_cref): New function.
12013         * cref.h: Include <cstdio>.
12014         (class Cref): Update declarations.
12015         * mapfile.h (Mapfile::file): New function.
12016         * object.h (class Object): Define Symbols.  Declare virtual
12017         do_get_global_symbols.
12018         (Object::get_global_symbols): New function.
12019         * object.cc (Input_objects::add_object): Pass object to cref_ if
12020         --cref.
12021         (Input_objects::archive_start): Likewise.
12022         (Input_objects::archive_stop): Likewise.
12023         (Input_objects::print_cref): New function.
12024         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
12025         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
12026         --cref.
12027         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
12028         function.
12029         * plugin.h (class Sized_pluginobj): Update declarations.
12030
12031 2010-01-05  Ian Lance Taylor  <iant@google.com>
12032
12033         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
12034         to is_default_version.  Rename insdef to insdefault.
12035         (Symbol_table::add_from_relobj): Rename def to is_default_version
12036         and local to is_forced_local.
12037         (Symbol_table::add_from_pluginobj): Likewise.
12038         (Symbol_table::add_from_dynobj): Likewise.
12039         (Symbol_table::define_special_symbol): Rename insdef to
12040         insdefault.
12041
12042 2010-01-04  Ian Lance Taylor  <iant@google.com>
12043
12044         PR 10980
12045         * options.h (class General_options): Add
12046         --allow-multiple-definition and -z muldefs.
12047         * resolve.cc (Symbol_table::should_override): Don't warn about a
12048         multiple symbol definition if --allow-multiple-definition or -z
12049         muldefs.
12050
12051         PR 10980
12052         * options.h (class General_options): Add --add-needed and
12053         --copy-dt-needed-entries.  Tweak --as-needed help entry.
12054         * object.cc (Input_objects::check_dynamic_dependencies): Give an
12055         error if --copy-dt-needed-entries aka --add-needed is used and
12056         would cause a change in behaviour.
12057
12058         PR 10980
12059         * options.h (class General_options): Add -G as a short version of
12060         --shared.  Add no-op options -assert, -g, and -i.
12061
12062 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
12063
12064         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
12065         check for .text or .gnu.linkonce.t sections.
12066         * icf.cc (Icf::find_identical_sections): Ditto.
12067         Change the detection for mangled function name within the section
12068         name.
12069         * icf.h (is_section_foldable_candidate): New function.
12070
12071 2009-12-30  Ian Lance Taylor  <iant@google.com>
12072
12073         PR 10980
12074         * options.h (class General_options): Permit two dashes with
12075         --retain-symbols-file.
12076
12077 2009-12-30  Ian Lance Taylor  <iant@google.com>
12078
12079         PR 10979
12080         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
12081         don't put the file header and segment headers in the text
12082         segment.
12083
12084         PR 10979
12085         * common.cc (Sort_commons::operator()): Stabilize sort when both
12086         entries are NULL.
12087         (Symbol_table::do_allocate_commons_list): When allocating common
12088         symbols, skip a symbol which is no longer common.
12089         * symtab.h (Symbol::is_common): Test whether the symbol comes from
12090         an object before checking its type.
12091         * testsuite/common_test_2.c: New file.
12092         * testsuite/common_test_3.c: New file.
12093         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
12094         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
12095         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
12096         (common_test_2_pic.o, common_test_2.so): New targets.
12097         (common_test_3_pic.o, common_test_3.so): New targets.
12098         * testsuite/Makefile.in: Rebuild.
12099
12100         PR 10979
12101         * script.cc (read_input_script): If we see a new SECTIONS clause,
12102         and we have added an input section, give an error.
12103         * layout.h (class Layout): Add have_added_input_section function.
12104         Add have_added_input_section_ field.
12105         * layout.cc (Layout::Layout): Initialize
12106         have_added_input_section_.
12107         (Layout::layout): Set have_added_input_section_.
12108         (Layout::layout_eh_frame): Likewise.
12109
12110 2009-12-30  Ian Lance Taylor  <iant@google.com>
12111
12112         PR 10931
12113         * options.h (class General_options): Add --sort-common option.
12114         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
12115         * common.cc (Sort_common): Add sort_order parameter to
12116         constructor.  Add sort_order_ field.
12117         (Sort_commons::operator): Check sort_order_.
12118         (Symbol_table::allocate_commons): Determine the sort order.
12119         (Symbol_table::do_allocate_commons): Add sort_order parameter.
12120         Change all callers.
12121         (Symbol_table::do_allocate_commons_list): Likewise.
12122
12123 2009-12-30  Ian Lance Taylor  <iant@google.com>
12124
12125         PR 10916
12126         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
12127         symbols from this object, don't change the visibility of an
12128         undefined symbol.
12129         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
12130
12131 2009-12-30  Ian Lance Taylor  <iant@google.com>
12132
12133         PR 10861
12134         * script.h (class Version_script_info): Define Language enum.
12135         Update declarations.  Define Glob, Exact, and Lookup types.  Add
12136         new fields globals_, locals_, and is_finalized_.
12137         * script.cc: Various formatting fixes.
12138         (class Parser_closure): Change language_stack_ from a vector of
12139         std::string to one of Version_script_info::Language.  Adjust all
12140         uses accordingly.
12141         (class Lazy_demangler): Remove.
12142         (struct Version_expression): Change language from std::string to
12143         Version_script_info::Language.
12144         (Version_script_info::Version_script_info): New function.
12145         (Version_script_info::~Version_script_info): Don't call clear.
12146         (Version_script_info::finalize): New function.
12147         (Version_script_info::build_lookup_tables): New function.
12148         (Version_script_info::build_expression_list_lookup): New
12149         function.
12150         (Version_script_info::get_symbol_version_helper): Rewrite to use
12151         lookup tables.
12152         (Version_script_info::print_expression_list): Adjust to use
12153         Version_script_info::Language.
12154         (script_push_lex_into_version_mode): Check that the version script
12155         has not been finalized.
12156         (version_script_push_lang): Change language string to
12157         Version_script_info::Language.
12158         * options.cc (Command_line::version_script): New function.
12159         * options.h (class General_options): Add finalize_dynamic_list
12160         function.  Change version_script from declaration to definition.
12161         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
12162         * testsuite/version_script.map: Remove duplicate def of foo.
12163         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
12164         version_script.map.
12165         * testsuite/Makefile.in: Rebuild.
12166
12167 2009-12-30  Ian Lance Taylor  <iant@google.com>
12168
12169         PR 10843
12170         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
12171         if the input symbol index is 0, make the output symbol index 0.
12172
12173 2009-12-30  Ian Lance Taylor  <iant@google.com>
12174
12175         PR 10670
12176         * options.h (class General_options): Add -x/--discard-all.
12177         * object.cc (Sized_relobj::do_count_local_symbols): Handle
12178         --discard-all.  If the local symbol needs a dynamic entry, check
12179         that before handling --discard-locals.
12180
12181 2009-12-30  Ian Lance Taylor  <iant@google.com>
12182
12183         PR 10450
12184         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
12185         flags to PF_R.
12186         (Output_segment::add_output_section): Don't change the flags if
12187         the type is PT_TLS.
12188
12189         PR 10450
12190         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
12191         GNU hash table if they need a dynamic value.  Otherwise, don't add
12192         them if they are defined in a dynamic object or are forced local.
12193
12194 2009-12-29  Ian Lance Taylor  <iant@google.com>
12195
12196         PR 10450
12197         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
12198         .gnu.hash table for a 32-bit target.
12199
12200         PR 10450
12201         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
12202         regular and a dynamic object only needs a dynamic symbol table
12203         entry if it is externally visible.
12204
12205         PR 10450
12206         * i386.cc (class Target_i386): Initialize global_offset_table_ in
12207         constructor.  Add global_offset_table_ field.
12208         (Target_i386::got_section): Set global_offset_table_.
12209         (Target_i386::do_finalize_sections): Set global_offset_table_
12210         size.
12211         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
12212         in constructor.  Add global_offset_table_ field.
12213         (Target_x86_64::got_section): Set global_offset_table_.
12214         (Target_x86_64::do_finalize_sections): Set global_offset_table_
12215         size.
12216
12217         * layout.cc (Layout::Layout): Initialize increase_relro_.
12218         (Layout::get_output_section): Add is_relro, is_last_relro, and
12219         is_first_non_relro parameters.  Change all callers.
12220         (Layout::choose_output_section): Likewise.
12221         (Layout::add_output_section_data): Likewise.
12222         (Layout::make_output_section): Likewise.
12223         (Layout::set_segment_offsets): Clear increase_relro when using a
12224         linker script.
12225         * layout.h (class Layout): Add increase_relro method.  Add
12226         increase_relro_ field.  Update declarations.
12227         * output.cc (Output_section::Output_section): Initialize
12228         is_last_relro_ and is_first_non_relro_.
12229         (Output_segment::add_output_section): Group relro sections is
12230         do_sort is true.  Handle is_last_relro and is_first_non_relro.
12231         (Output_segment::maximum_alignment): Remove relro handling.
12232         (Output_segment::set_section_addresses): Add increase_relro
12233         parameter.  Change all callers.  Add initial alignment to align
12234         relro sections on separate page.  Remove old relro handling.
12235         (Output_segment::set_section_list_addresses): Remove in_relro
12236         parameter.  Change all callers.
12237         (Output_segment::set_offset): Add increase parameter.  Change all
12238         callers.  Remove old relro handling.
12239         * output.h (class Output_section): Add new methods: is_last_relro,
12240         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
12241         Add is_last_relro_ and is_first_non_relro_ fields.
12242         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
12243         Create separate .got.plt section.  Call increase_relro.
12244         * x86_64.cc (Target_x86_64::got_section): Likewise.
12245         * testsuite/relro_script_test.t: Add .got.plt.
12246
12247         PR 10450
12248         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
12249         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
12250         (Layout::finalize): Call set_dynamic_symbol_size.
12251         (Layout::set_dynamic_symbol_size): New function.
12252         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
12253         set_dynamic_symbol_size.
12254
12255         PR 10450
12256         * output.h (class Output_section): Add is_entsize_zero_ field.
12257         * output.cc (Output_section::Output_section): Initialize
12258         is_entsize_zero_.
12259         (Output_section::set_entsize): If two different entsizes are
12260         requested, force it to zero.
12261         (Output_section::add_input_section): Set flags for .debug_str
12262         before updating section flags.  Set entsize.
12263         (Output_section::update_flags_for_input_section): Set SHF_MERGE
12264         and SHF_STRING if all input sections have those flags.
12265
12266 2009-12-29   Rafael Espindola  <espindola@google.com>
12267
12268         * main.cc (main): Fix the sys time reporting.
12269         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
12270         reporting.
12271
12272 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
12273
12274         * options.cc (General_options::parse_version): Allow -v to exit
12275         without an error if there is nothing to link.
12276
12277 2009-12-29  Ian Lance Taylor  <iant@google.com>
12278
12279         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
12280         using a version of gcc before 4.1.
12281         * configure: Rebuild.
12282
12283 2009-12-28  Chris Demetriou  <cgd@google.com>
12284
12285         * attributes.cc (Output_attributes_section_data::do_write): Use
12286         std::vector::front rather than std::vector::data.
12287
12288 2009-12-28  Ian Lance Taylor  <iant@google.com>
12289
12290         * symtab.h (class Symbol_table): Add enum Defined.
12291         * resolve.cc (Symbol_table::should_override): Add defined
12292         parameter.  Change all callers.  Test whether object is NULL
12293         before calling a method on it.
12294         (Symbol_table::report_resolve_problem): Add defined parameter.
12295         Change all callers.
12296         (Symbol_table::should_override_with_special): Likewise.
12297         * symtab.cc (Symbol_table::define_in_output_data): Add defined
12298         parameter.  Change all callers.
12299         (Symbol_table::do_define_in_output_data): Likewise.
12300         (Symbol_table::define_in_output_segment): Likewise.
12301         (Symbol_table::do_define_in_output_segment): Likewise.
12302         (Symbol_table::define_as_constant): Likewise.
12303         (Symbol_table::do_define_as_constant): Likewise.
12304         * script.h (class Symbol_assignment): Add is_defsym parameter to
12305         constructor; change all callers.
12306         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
12307         parameter.  Change all callers.  Add is_defsym_ field.
12308         (class Parser_closure): Add parsing_defsym parameter to
12309         constructor; change all callers.  Add parsing_defsym accessor
12310         function.  Add parsing_defsym_ field.
12311
12312 2009-12-28  Ian Lance Taylor  <iant@google.com>
12313
12314         * gold.cc (queue_middle_tasks): Fix formatting.
12315         * object.cc (Relobj::is_section_name_included): Likewise.
12316
12317 2009-12-23  Ian Lance Taylor  <iant@google.com>
12318
12319         * i386.cc (Target_i386::do_calls_non_split): Recognize
12320         -fsplit-stack prologue for a function with a static chain.
12321         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
12322         -fsplit-stack prologue when using %r11.
12323
12324 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
12325
12326         * options.cc (General_options::parse_version): Make -v continue and do
12327         the link like GNU ld does.
12328
12329 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
12330
12331         * Makefile.am (CCFILES): Add timer.cc.
12332         (HFILES): Add timer.h.
12333         * configure.ac: Check for sysconf and times.
12334         * main.cc: include timer.h.
12335         (main): Use Timer instead of get_run_time.
12336         * timer.cc: New.
12337         * timer.h: New.
12338         * workqueue.cc: include timer.h.
12339         (Workqueue::find_and_run_task):
12340         Report user, sys and wall time.
12341         * Makefile.in: Regenerate.
12342         * config.in: Regenerate.
12343         * configure: Regenerate.
12344
12345 2009-12-16  Doug Kwan  <dougkwan@google.com>
12346
12347         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
12348         sections.
12349         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
12350         relaxed input sections.
12351         * output.cc (Output_section::find_relaxed_input_section): Change
12352         return type to Output_relaxed_input_section pointer.  Adjust code
12353         for new type of relaxed_input_section_map_.
12354         * output.h (Output_section::find_relaxed_input_section): Change
12355         return type to Output_relaxed_input_section pointer.
12356         (Output_section::Output_relaxed_input_section_by_input_section_map):
12357         New type.
12358         (Output_section::relaxed_input_section_map_): Change type to
12359         Output_section::Output_relaxed_input_section_by_input_section_map.
12360         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
12361         input section.
12362
12363 2009-12-15  Ian Lance Taylor  <iant@google.com>
12364
12365         * layout.cc (Layout::create_shstrtab): Only write out after input
12366         sections if we are compressing debug sections.
12367
12368 2009-12-15  Ian Lance Taylor  <iant@google.com>
12369
12370         * archive.cc (Archive::add_symbols): Only look up a symbol without
12371         a version if there is, in fact, a version.
12372
12373 2009-12-14  Ian Lance Taylor  <iant@google.com>
12374
12375         Revert -Wshadow changes, all changes from:
12376         2009-12-11  Doug Kwan  <dougkwan@google.com>
12377         2009-12-11  Nick Clifton  <nickc@redhat.com>
12378         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
12379
12380 2009-12-11  Doug Kwan  <dougkwan@google.com>
12381
12382         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
12383         due to -Wshadow.
12384         * attributes.cc (Object_attribute::size): Ditto.
12385         (Attributes_section_data::size): Ditto.
12386         (Attributes_section_data::Attributes_section_data): Ditto.
12387         (Output_attributes_section_data::do_write): Ditto.
12388         * attributes.h (Object_attribute::set_type): Ditto.
12389         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
12390
12391 2009-12-11  Nick Clifton  <nickc@redhat.com>
12392
12393         * archive.cc: Fix shadowed variable warnings.
12394         * arm.cc: Likewise.
12395         * compressed_output.cc: Likewise.
12396         * compressed_output.h: Likewise.
12397         * configure: Likewise.
12398         * dwarf_reader.cc: Likewise.
12399         * dynobj.cc: Likewise.
12400         * dynobj.h: Likewise.
12401         * ehframe.cc: Likewise.
12402         * ehframe.h: Likewise.
12403         * errors.cc: Likewise.
12404         * expression.cc: Likewise.
12405         * fileread.cc: Likewise.
12406         * fileread.h: Likewise.
12407         * freebsd.h: Likewise.
12408         * i386.cc: Likewise.
12409         * icf.cc: Likewise.
12410         * incremental.h: Likewise.
12411         * layout.cc: Likewise.
12412         * layout.h: Likewise.
12413         * mapfile.cc: Likewise.
12414         * merge.cc: Likewise.
12415         * merge.h: Likewise.
12416         * object.cc: Likewise.
12417         * object.h: Likewise.
12418         * options.h: Likewise.
12419         * output.cc: Likewise.
12420         * output.h: Likewise.
12421         * parameters.cc: Likewise.
12422         * plugin.cc: Likewise.
12423         * powerpc.cc: Likewise.
12424         * reduced_debug_output.cc: Likewise.
12425         * reduced_debug_output.h: Likewise.
12426         * reloc.cc: Likewise.
12427         * reloc.h: Likewise.
12428         * resolve.cc: Likewise.
12429         * script-sections.cc: Likewise.
12430         * script.cc: Likewise.
12431         * script.h: Likewise.
12432         * sparc.cc: Likewise.
12433         * symtab.cc: Likewise.
12434         * symtab.h: Likewise.
12435         * target-select.cc: Likewise.
12436         * target-select.h: Likewise.
12437         * token.h: Likewise.
12438         * workqueue.cc: Likewise.
12439         * workqueue.h: Likewise.
12440         * x86_64.cc: Likewise.
12441
12442 2009-12-10  Doug Kwan  <dougkwan@google.com>
12443
12444         * arm.cc (attributes.h): New include.
12445         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
12446         (Arm_relobj::~Arm_relobj): Delete object pointed by
12447         attributes_section_data_.
12448         (Arm_relobj::attributes_section_data): New method definition.
12449         (Arm_relobj::attributes_section_data_): New data member declaration.
12450         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
12451         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
12452         attributes_section_data_.
12453         (Arm_dynobj::attributes_section_data): New method definition.
12454         (Arm_dynobj::attributes_section_data_): New data member declaration.
12455         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
12456         initialization value of may_use_blx_ to false.
12457         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
12458         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
12459         object attributes to compute results instead of hard-coding.
12460         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
12461         Target_arm::get_secondary_compatible_arch,
12462         Target_arm::set_secondary_compatible_arch
12463         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12464         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
12465         New method declarations.
12466         (Target_arm::get_aeabi_object_attribute): New method definition.
12467         (Target_arm::attributes_section_data_): New data member declaration.
12468         (read_arm_attributes_section): New template definition.
12469         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
12470         (Arm_dynobj::do_read_symbols): Ditto.
12471         (Target_arm::do_finalize_sections): Merge attributes sections from
12472         input.  Check for BLX use after attributes section merging.
12473         Fix __exidx_start and __exidx_end visibility.  Create an
12474         .ARM.attributes section if necessary.
12475         (Target_arm::get_secondary_compatible_arch,
12476         Target_arm::set_secondary_compatible_arch,
12477         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12478         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
12479         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
12480         New method definitions.
12481
12482 2009-12-09  Ian Lance Taylor  <iant@google.com>
12483
12484         * plugin.cc (Plugin::load): Don't cast from void* to a function
12485         pointer.
12486
12487 2009-12-09  Ian Lance Taylor  <iant@google.com>
12488
12489         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
12490         information fields.
12491
12492 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
12493
12494         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
12495         Replace two_file_shared_1.so with two_file_shared_2.so.
12496         * testsuite/Makefile.in: Regenerated.
12497
12498 2009-12-08  Doug Kwan  <dougkwan@google.com>
12499
12500         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
12501         (HFILES): Add attributes.h and int_encoding.h.
12502         * Makefile.in: Regenerate.
12503         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
12504         function definitions to int_encoding.cc
12505         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
12506         prototypes to int_encoding.h
12507         * reduced_debug_output.cc (int_encoding.h): New include.
12508         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
12509         function definitions to int_encoding.cc
12510         (insert_into_vector, read_from_pointer): Move template definitions to
12511         int_encoding.h
12512         * attributes.cc: New file.
12513         * attributes.h: New file.
12514         * int_encoding.cc: New file.
12515         * int_encoding.h: New file.
12516
12517 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
12518
12519         PR gold/11055
12520         * incremental-dump.cc (dump_incremental_inputs): New.
12521         (main): Use dump_incremental_inputs.
12522
12523 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
12524
12525         PR gold/10893
12526         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
12527         checking elfcpp::STT_FUNC.
12528         (Target_i386::Relocate::relocate): Likewise.
12529         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
12530
12531         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
12532         symbols from shared libraries into normal FUNC symbols.
12533
12534         * symtab.h (Symbol): Add is_func and use it.
12535
12536 2009-12-05  Doug Kwan  <dougkwan@google.com>
12537
12538         * arm.cc (Target_arm::arm_info): Initialize new fields
12539         attributes_section and attributes_vendor.
12540         * i386.cc (Target_i386::i386_info): Same.
12541         * object.cc (Sized_relobj::do_layout): Skip attribute section.
12542         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
12543         fields attributes_section and attributes_vendor.
12544         * sparc.cc (Target_sparc::sparc_info): Same.
12545         * target.h (Target::attributes_section, Target::attributes_vendor,
12546         Target::is_attributes_section, Target::attribute_arg_type,
12547         Target::attributes_order): New method definitions.
12548         (Target::Target_info::attributes_section,
12549         Target::Target_info::attributes_vendor): New fields.
12550         (Target::do_attribute_arg_type, Target::do_attributes_order): New
12551         virtual method definitions.
12552         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
12553         attributes_section and attributes_vendor.
12554         * testsuite/testfile.cc (Target_test::test_target_info): Same.
12555
12556 2009-12-05  Doug Kwan  <dougkwan@google.com>
12557
12558         * arm.cc: Update comments about interworking and stub generation.
12559         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
12560         considered as non-PIC.
12561         (Arm_relocate_functions::base_abs): Fix formatting.
12562         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
12563         of function to use GOT entry address instead of offset.
12564         (Target_arm::Scan::global): Issue an error if a symbol would need a
12565         PLT does not get one because it is untyped.  Remove code to create
12566         dynamic symbols for relative branches.
12567         (Target_arm::Relocate::relocate: Use 0 instead of false since function
12568         takes unsigned integer instead of boolean.
12569
12570 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
12571
12572         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
12573         (two_file_test_LDADD): Likewise.
12574         (common_test_1_LDADD): Likewise.
12575         (exception_test_LDADD) Likewise.
12576         (weak_test_LDADD): Likewise.
12577         (many_sections_test_LDADD): Likewise.
12578         (initpri1_LDADD): Likewise.
12579         (script_test_1_LDADD): Likewise.
12580         (script_test_2_LDADD): Likewise.
12581         (justsyms_LDADD): Likewise.
12582         (binary_test_LDADD): Likewise.
12583         (large_LDADD): Likewise.
12584         * testsuite/Makefile.in: Regenerated.
12585
12586 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
12587
12588         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
12589         (Symbol_table::override_with_special): Likewise.
12590         (Symbol_table::add_from_object): Likewise.
12591
12592 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12593
12594         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12595         Don't set the data_offset twice.
12596
12597 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12598
12599         * testsuite/Makefile.in: Regenerate.
12600
12601 2009-12-03  Doug Kwan  <dougkwan@google.com>
12602
12603         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
12604         (Target_arm::do_finalize_sections): Add parameter for symbol table
12605         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
12606         * i386.cc (Target_i386::do_finalize_sections): Add an additional
12607         parameter for symbol table pointer.
12608         * layout.cc (Layout::finalize): Call Target::finalize_sections with
12609         an additional parameter for a pointer to symbol table.
12610         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
12611         parameter for a symbol table pointer.
12612         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
12613         * target.h (Target::finalize_sections, Target::do_finalize_sections):
12614         Ditto.
12615         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
12616         parameter for a symbol table pointer.
12617
12618 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
12619
12620         * incremental.cc (Incremental_inputs_header)
12621         (Incremental_inputs_header_write, Incremental_inputs_entry)
12622         (Incremental_inputs_entry_write): Move ...
12623         * incremental.h (Incremental_inputs_header)
12624         (Incremental_inputs_header_write, Incremental_inputs_entry)
12625         (Incremental_inputs_entry_write): here.
12626
12627 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12628
12629         * incremental.cc (make_sized_incremental_binary): Set the target.
12630         Error if it is incompatible.
12631         * output.h (Output_file): Add filename method.
12632
12633 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12634
12635         * incremental.cc (Incremental_inputs_entry): Remove unused argument
12636         from the get_* methods.
12637
12638 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12639
12640         * incremental-dump.cc (main): Check that the offeset of a script is 0.
12641         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12642         Write 0 for the data_offset of scripts.
12643
12644 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12645
12646         * testsuite/Makefile.am: Add the incremental_test.sh test.
12647         * testsuite/incremental_test.sh: New.
12648         * testsuite/incremental_test_1.c: New.
12649         * testsuite/incremental_test_2.c: New.
12650
12651 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
12652
12653         * incremental-dump.cc (main): Fix typos.
12654
12655 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
12656
12657         PR gold/11025
12658         * incremental-dump.cc (main): Use llu to print 64 bit values.
12659
12660 2009-11-26  Per Ă˜yvind Karlsen <peroyvind@mandriva.org>
12661             H.J. Lu  <hongjiu.lu@intel.com>
12662
12663         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
12664         $(LIBDL).
12665         (incremental_dump_LDADD): Likewise.
12666         * Makefile.in: Regenerated.
12667
12668 2009-11-25  Doug Kwan  <dougkwan@google.com>
12669
12670         Revert:
12671
12672         2009-11-25  Doug Kwan  <dougkwan@google.com>
12673
12674                 * arm.cc (Target_arm::Target_arm): Move method definition
12675                 outside of class definition.  Add code to handle
12676                 --target1-rel, --target1-abs and --target2= options.
12677                 (Target_arm::get_reloc_reloc_type): Change method to be
12678                 non-static and const.
12679                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
12680                 New data member declaration.
12681                 (Target_arm::Scan::local, Target_arm::Scan::global,
12682                 Target_arm::Relocate::relocate,
12683                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12684                 Adjust call to Target_arm::get_real_reloc_type.
12685                 (Target_arm::get_real_reloc_type): Use command line options
12686                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12687                 * options.h (--target1-rel, --target1-abs, --target2): New
12688                 ARM-only options.
12689
12690 2009-11-25  Doug Kwan  <dougkwan@google.com>
12691
12692         * arm.cc (Target_arm::Target_arm): Move method definition outside of
12693         class definition.  Add code to handle --target1-rel, --target1-abs
12694         and --target2= options.
12695         (Target_arm::get_reloc_reloc_type): Change method to be non-static
12696         and const.
12697         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
12698         member declaration.
12699         (Target_arm::Scan::local, Target_arm::Scan::global,
12700         Target_arm::Relocate::relocate,
12701         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
12702         call to Target_arm::get_real_reloc_type.
12703         (Target_arm::get_real_reloc_type): Use command line options to
12704         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12705         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
12706         options.
12707
12708 2009-11-25  Doug Kwan  <dougkwan@google.com>
12709
12710         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
12711         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
12712         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
12713         formatting.
12714         (Arm_relocate_functions::thm_call): Replace body with a call to
12715         Arm_relocate_functions::thumb_branch_common.
12716         (Arm_relocate_functions::thm_jump24,
12717         Arm_relocate_functions::thm_xpc22): New method definitions.
12718         (Arm_relocate_functions::thumb_branch_common): New method definition.
12719         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
12720         operator.
12721         (Target_arm::Relocate::relocate): Adjust call to thm_call.
12722         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
12723
12724 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12725
12726         * Makefile.am: Build incremental-dump
12727         * Makefile.in: Regenerate.
12728         * incremental-dump.cc: New.
12729         * incremental.cc (Incremental_inputs_header_data,
12730         Incremental_inputs_entry_data): Move to incremental.h
12731         * incremental.h: (Incremental_inputs_header_data,
12732         Incremental_inputs_entry_data): Move from incremental.cc
12733
12734 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12735
12736         * incremental.cc (Incremental_inputs_header,
12737         Incremental_inputs_header_write, Incremental_inputs_entry,
12738         Incremental_inputs_entry_write): Add a typedef with the data type.
12739
12740 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12741
12742         * incremental.cc (Incremental_inputs_header,
12743         Incremental_inputs_header_write, Incremental_inputs_entry,
12744         Incremental_inputs_entry_write): Update comment about which
12745         type has the filed descriptions.
12746
12747 2009-11-15  Doug Kwan  <dougkwan@google.com>
12748
12749         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
12750         (Arm_relocate_functions::arm_branch_common): Change method defintion
12751         in class definition to a method declaration and update list of formal
12752         parameters.
12753         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
12754         Arm_relocation_functions::jump24): Adjust call to
12755         Arm_relocate_functions::arm_branch_common.  Update list of formal
12756         parameters.
12757         (Arm_relocate_functions::xpc25): New method definition.
12758         (Arm_relocate_functions::arm_branch_common): Move method defintion
12759         out from class definition.  Use stubs for mode-switching and extending
12760         branch ranges.
12761         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
12762         specially.  Change code to enable use of stubs in ARM branches.
12763
12764 2009-11-10  Doug Kwan  <dougkwan@google.com>
12765
12766         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
12767         in method declaration.
12768         (Target_arm::relocate_stub): New method declaration.
12769         (Target_arm::default_target): Change to return a pointer instead of
12770         a const reference.
12771         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
12772         Target_arm::default_target.
12773         (Arm_Relobj::do_relocate_sections): Remove options paramater in
12774         method definition.
12775         (Target_arm::relocate_section): Adjust view.
12776         (Target_arm::relocate_stub): New method definition.
12777
12778 2009-11-10  Doug Kwan  <dougkwan@google.com>
12779
12780         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
12781         a format warning.
12782         * incremental.cc (open_incremental_binary): Initialized local
12783         variables to avoid warnings.
12784         * object.cc (make_elf_object): Ditto.
12785         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
12786         a format warning.
12787
12788 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
12789
12790         PR gold/10930
12791         * testsuite/plugin_test.c: Include "config.h".
12792
12793 2009-11-09  Doug Kwan  <dougkwan@google.com>
12794
12795         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
12796         (arm_symbol_value): Remove.
12797         (Arm_relocate_functions::arm_branch_common,
12798         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
12799         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
12800         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
12801         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
12802         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12803         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12804         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12805         Arm_relocate_functions::thm_mobw_abs_nc,
12806         Arm_relocate_functions::thm_mov_abs,
12807         Arm_relocate_functions::movw_prel_nc,
12808         Arm_relocate_functions::thm_movt_abs,
12809         Arm_relocate_functions::movt_prel,
12810         Arm_relocate_functions::thm_movw_prel_nc,
12811         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
12812         (Target_arm::Relocate::relocate): Only decompose address into two
12813         parts if relocation type uses the thumb-bit and pass the actual
12814         bit instead of a flag indicating that the thumb-bit is used.  Adjust
12815         calls to methods in Arm_relocate_functions for this change.
12816
12817 2009-11-08  Ian Lance Taylor  <iant@google.com>
12818
12819         PR 10925
12820         * reloc.cc: Instantiate
12821         Sized_relobj::initialize_input_to_output_maps and
12822         Sized_relobj:free_input_to_output_maps.
12823
12824 2009-11-06  Ian Lance Taylor  <iant@google.com>
12825
12826         PR 10876
12827         * defstd.cc (in_segment): Set only_if_ref true for "end".
12828
12829 2009-11-06  Doug Kwan  <dougkwan@google.com>
12830
12831         * arm.cc (class Reloc_stub): Correct a comment.
12832         (Target_arm::Target_arm): Initialize arm_input_section_map_.
12833         (Target_arm::scan_section_for_stubs): New method declaration.
12834         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
12835         Change methods from private to protected.
12836         (Target_arm::do_may_relax): New method definition.
12837         (Target_arm::do_relax, Target_arm::group_sections,
12838         Target_arm::scan_reloc_for_stub,
12839         Target_arm::scan_reloc_section_for_stubs): New method declarations.
12840         (Target_arm::arm_input_section_map_): New data member declaration.
12841         (Target_arm::scan_reloc_for_stub,
12842         Target_arm::scan_reloc_section_for_stubs,
12843         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
12844         Target_arm::do_relax): New method definitions.
12845
12846 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
12847
12848         * configure.ac: Check for (struct stat)::st_mtim
12849         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
12850         * config.in: Regenerate.
12851         * configure: Regenerate.
12852
12853 2009-11-05  Ian Lance Taylor  <iant@google.com>
12854
12855         PR 10910
12856         * output.cc (Output_segment::add_output_section): Add missing
12857         return statement.
12858
12859 2009-11-04  Ian Lance Taylor  <iant@google.com>
12860
12861         PR 10880
12862         * object.h (class Object): Add is_needed and set_is_needed
12863         methods.  Add is_needed_ field.  Make bool fields into bitfields.
12864         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
12865         defined in a dynamic object and referenced by a regular object,
12866         set is_needed for the dynamic object.
12867         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
12868         if the file is marked with as_needed and it is not needed.
12869
12870 2009-11-04  Ian Lance Taylor  <iant@google.com>
12871
12872         PR 10887
12873         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
12874         tags if data is discarded by linker script.
12875         * i386.cc (Target_i386::do_finalize_sections): Likewise.
12876         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12877         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12878         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12879
12880 2009-11-04  Ian Lance Taylor  <iant@google.com>
12881
12882         * layout.cc (Layout::get_output_section): Add is_interp and
12883         is_dynamic_linker_section parameters.  Change all callers.
12884         (Layout::choose_output_section): Likewise.
12885         (Layout::make_output_section): Likewise.
12886         (Layout::add_output_section_data): Add is_dynamic_linker_section
12887         parameter.  Change all callers.
12888         * layout.h (class Layout): Update declarations.
12889         * output.h (class Output_section): Add is_interp, set_is_interp,
12890         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
12891         Add is_interp_, is_dynamic_linker_section_ fields.  Change
12892         generate_code_fills_at_write_ to a bitfield.
12893         * output.cc (Output_section::Output_sections): Initialize new
12894         fields.
12895         (Output_segment::add_output_section): Add do_sort parameter.
12896         Change all callers.
12897
12898 2009-11-03  Ian Lance Taylor  <iant@google.com>
12899
12900         PR 10860
12901         * options.h (class General_options): Add --warn-common.
12902         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
12903         merging two common symbols.
12904         (Symbol_table::should_override): Handle --warn-common when merging
12905         a common symbol with a defined symbol.  Use report_resolve_problem
12906         for multiple definitions.
12907         (Symbol_table::report_resolve_problem): New function.
12908         * symtab.h (class Symbol_table): Declare report_resolve_problem.
12909
12910 2009-11-03  Doug Kwan  <dougkwan@google.com>
12911
12912         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
12913         stub_factory_.
12914         (Target_arm::stub_factory): New method definition.
12915         (Target_arm::new_arm_input_section,
12916         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
12917         Target_arm::reloc_uses_thumb_bit): New method declarations.
12918         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
12919         New type definitions.
12920         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
12921         member declarations.
12922         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
12923         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
12924         New method definitions.
12925
12926 2009-11-03  Ian Lance Taylor  <iant@google.com>
12927
12928         * options.h (class General_options): Add --warn_constructors.
12929
12930 2009-11-03  Ian Lance Taylor  <iant@google.com>
12931
12932         PR 10893
12933         * defstd.cc (in_section): Add entries for __rel_iplt_start,
12934         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
12935
12936 2009-11-03  Ian Lance Taylor  <iant@google.com>
12937
12938         PR 10895
12939         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
12940         --msgid-bugs-address.
12941         (install-pdf): New target.
12942         (install-data_yes): Look up one directory to find mkinstalldirs.
12943
12944 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
12945
12946         * po/Make-in (.po.gmo): Don't generate .gmo files in source
12947         tree.
12948
12949 2009-10-30  Doug Kwan  <dougkwan@google.com>
12950
12951         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
12952
12953 2009-10-30  Doug Kwan  <dougkwan@google.com>
12954
12955         * arm.cc (Stub_addend_reader): New struct template definition
12956         and partial specializations.
12957         (Stub_addend_reader::operator()): New method definition for a
12958         partially specialized template.
12959
12960 2009-10-30  Doug Kwan  <dougkwan@google.com>
12961
12962         * arm.cc (Arm_relobj::processor_specific_flags): New method
12963         definition.
12964         (Arm_relobj::do_read_symbols): New method declaration.
12965         (Arm_relobj::processor_specific_flags_): New data member declaration.
12966         (Arm_dynobj): New class definition.
12967         (Target_arm::do_finalize_sections): Add input_objects parameter.
12968         (Target_arm::do_adjust_elf_header): New method declaration.
12969         (Target_arm::are_eabi_versions_compatible,
12970         (Target_arm::merge_processor_specific_flags): New method declaration.
12971         (Target_arm::do_make_elf_object): New overloaded method definitions
12972         and declaration.
12973         (Arm_relobj::do_read_symbols): New method definition.
12974         (Arm_dynobj::do_read_symbols): Ditto.
12975         (Target_arm::do_finalize_sections): Add input_objects parameters.
12976         Merge processor-specific flags from all input objects.
12977         (Target_arm::are_eabi_versions_compatible,
12978         Target_arm::merge_processor_specific_flags,
12979         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
12980         New method definitions.
12981         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
12982         Input_objects pointer type parameter.
12983         * layout.cc (Layout::finalize): Pass input objects to target's.
12984         finalize_sections function.
12985         * output.cc (Output_file_header::do_sized_write): Set ELF file
12986         header's processor-specific flags.
12987         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
12988         Input_objects pointer type parameter.
12989         * sparc.cc (Target_sparc::do_finalize_sections): Same.
12990         * target.h (Input_objects): New forward class declaration.
12991         (Target::processor_specific_flags,
12992         Target::are_processor_specific_flags_sect): New method definitions.
12993         (Target::finalize_sections): Add input_objects parameter.
12994         (Target::Target): Initialize processor_specific_flags_ and
12995         are_processor_specific_flags_set_.
12996         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
12997         parameter.
12998         (Target::set_processor_specific_flags): New method definition.
12999         (Target::processor_specific_flags_,
13000         Target::are_processor_specific_flags_set_): New data member
13001         declarations.
13002         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
13003         Input_objects pointer type parameter.
13004
13005 2009-10-30  Doug Kwan  <dougkwan@google.com>
13006
13007         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
13008
13009 2009-10-28  Ian Lance Taylor  <iant@google.com>
13010
13011         * object.h (class Relobj): Drop options parameter from
13012         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
13013         do_scan_relocs, do_relocate.  Change all callers.
13014         (class Sized_relobj): Drop options parameters from
13015         do_gc_process_relocs, do_scan_relocs, do_relocate,
13016         do_relocate_sections, relocate_sections, emit_relocs_scan,
13017         emit_relocs_scan_reltype.  Change all callers.
13018         (struct Relocate_info): Remove options field and all references to
13019         it.
13020         * reloc.h (class Read_relocs): Remove options constructor
13021         parameter and options_ field.  Change all callers.
13022         (class Gc_process_relocs, class Scan_relocs): Likewise.
13023         (class Relocate_task): Likewise.
13024         * target-reloc.h (scan_relocs): Remove options parameter.  Change
13025         all callers.
13026         (scan_relocatable_relocs): Likewise.
13027         * target.h (class Sized_target): Remove options parameter from
13028         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
13029         all callers.
13030         * gc.h (gc_process_relocs): Remove options parameter.  Change all
13031         callers.
13032         * arm.cc: Update functions to remove options parameters.
13033         * i386.cc: Likewise.
13034         * powerpc.cc: Likewise.
13035         * sparc.cc: Likewise.
13036         * x86_64.cc: Likewise.
13037         * testsuite/testfile.cc: Likewise.
13038
13039 2009-10-28  Doug Kwan  <dougkwan@google.com>
13040
13041         * arm.cc (Arm_relobj): New class definition.
13042         (Arm_relobj::scan_sections_for_stubs,
13043         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
13044         New method definitions.
13045
13046 2009-10-28  Cary Coutant  <ccoutant@google.com>
13047
13048         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
13049         (Plugin::cleanup_done_): New member.
13050         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
13051         (Plugin_manager::cleanup_done_): Remove.
13052         (Plugin_manager::add_input_file): Edit error message.
13053         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
13054         (Plugin_manager::cleanup): Remove use of cleanup_done_.
13055
13056 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
13057
13058         * fileread.cc: (File_read::View::~View): Use the new
13059         data_ownership_ filed.
13060         (File_read::~File_read): Dispose the new whole_file_view_.
13061         (File_read::open): Mmap the whole file if needed.
13062         (File_read::open): Use whole_file_view_ instead of contents_.
13063         (File_read::find_view): Use whole_file_view_ if applicable.
13064         (File_read::do_read): Use whole_file_view_ instead of contents_.
13065         (File_read::make_view): Use whole_file_view_ instead of contents_,
13066         update File_read::View::View call.
13067         (File_read::find_or_make_view): Update File_read::View::View
13068         call.
13069         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
13070         remove contents_
13071         (File_read::View::Data_ownership): New enum.
13072         (File_read::View::View): Replace bool mapped_ with Data_ownership
13073         argument.
13074         (File_read::View::mapped_): Remove (replaced by data_ownership_).
13075         (File_read::View::data_ownership_): New field.
13076         (File_read::contents_): Remove (replaced by whole_file_view_).
13077         (File_read::whole_file_view_): New field.
13078         * options.h (class General_options): Add --keep-files-mapped.
13079
13080 2009-10-27  Cary Coutant  <ccoutant@google.com>
13081
13082         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
13083         * testsuite/Makefile.am (plugin_test_5): New test case.
13084         * testsuite/Makefile.in: Regenerate.
13085
13086 2009-10-25  Doug Kwan  <dougkwan@google.com>
13087
13088         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
13089         from private to protected to allow access by child class.
13090         (Sized_relobj::do_relocate_sections): New method declaration.
13091         (Sized_relobj::relocate_sections): Virtualize.
13092         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
13093         Sized_relobj::relocate_sections.  Instantiate template explicitly
13094         for different target sizes and endianity.
13095
13096 2009-10-24  Doug Kwan  <dougkwan@google.com>
13097
13098         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
13099         (Arm_input_section::as_arm_input_section): New method.
13100         (Arm_output_section): New class definition.
13101         (Arm_output_section::create_stub_group,
13102         Arm_output_section::group_sections): New method definitions.
13103
13104 2009-10-22  Doug Kwan  <dougkwan@google.com>
13105
13106         * arm.cc (Arm_input_section): New class definition.
13107         (Arm_input_section::init, Arm_input_section:do_write,
13108         Arm_input_section::set_final_data_size,
13109         Arm_input_section::do_reset_address_and_file_offset): New method
13110         definitions.
13111
13112 2009-10-21  Doug Kwan  <dougkwan@google.com>
13113
13114         * arm.cc (Stub_table, Arm_input_section): New forward class
13115         declarations.
13116         (Stub_table): New class defintion.
13117         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
13118         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
13119         New method definition.
13120
13121 2009-10-21  Doug Kwan  <dougkwan@google.com>
13122
13123         * arm.cc: Update copyright comments.
13124         (Target_arm): New forward class template declaration.
13125         (Arm_address): New type.
13126         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
13127         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
13128         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
13129         constants.
13130         (Insn_template): Same.
13131         (DEF_STUBS): New macro.
13132         (Stub_type): New enum type.
13133         (Stub_template): New class definition.
13134         (Stub): Same.
13135         (Reloc_stub): Same.
13136         (Stub_factory): Same.
13137         (Target_arm::Target_arm): Initialize may_use_blx_ and
13138         should_force_pic_veneer_.
13139         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
13140         Target_arm::should_force_pic_veneer,
13141         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
13142         Target_arm::using_thumb_only, Target_arm:;default_target): New
13143         method defintions.
13144         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
13145         New data member declarations.
13146         (Insn_template::size, Insn_template::alignment): New method defintions.
13147         (Stub_template::Stub_template): New method definition.
13148         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
13149         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
13150         (Stub_factory::Stub_factory): New method definition.
13151         * gold.h (string_hash): New template.
13152         * output.h (Input_section_specifier::hash_value): Use
13153         gold::string_hash.
13154         (Input_section_specifier::string_hash): Remove.
13155         * stringpool.cc (Stringpool_template::string_hash): Use
13156         gold::string_hash.
13157
13158 2009-10-20  Doug Kwan  <dougkwan@google.com>
13159
13160         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
13161         symbols of relaxed input sections.
13162         * output.h (Output_section::find_relaxed_input_section): Make
13163         method public.
13164
13165 2009-10-16  Doug Kwan  <dougkwan@google.com>
13166
13167         * dynobj.cc (Versions::Versions): Initialize version_script_.
13168         Only insert base version symbol definition for a shared object
13169         if version script defines any version versions.
13170         (Versions::define_base_version): New method definition.
13171         (Versions::add_def): Check that base version is not needed.
13172         (Versions::add_need): Define base version lazily.
13173         * dynobj.h (Versions::define_base_version): New method declaration.
13174         (Versions::needs_base_version_): New data member declaration.
13175         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
13176         (check_DATA): Add no_version_test.stdout.
13177         (libno_version_test.so, no_version_test.o no_version_test.stdout):
13178         New make rules.
13179         * testsuite/Makefile.in: Regenerate.
13180         * testsuite/no_version_test.c: New file.
13181         * testsuite/no_version_test.sh: Ditto.
13182
13183 2009-10-16  Doug Kwan  <dougkwan@google.com>
13184
13185         * expression.cc (class Segment_start_expression): New class definition.
13186         (Segment_start_expression::value): New method definition.
13187         (script_exp_function_segment_start): Return a new
13188         Segment_start_expression.
13189         * gold/script-c.h (script_saw_segment_start_expression): New function
13190         prototype.
13191         * script-sections.cc (Script_sections::Script_sections): Initialize
13192         SAW_SEGMENT_START_EXPRESSION_ to false.
13193         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
13194         and -Tbbs options to specify section addresses if given in
13195         command line and no SEGMENT_START expression is seen in a script.
13196         * script-sections.h (Script_sections::saw_segment_start_expression,
13197         Script_sections::set_saw_segment_start_expression): New method
13198         definition.
13199         (Script_sections::saw_segment_start_expression_): New data member
13200         declaration.
13201         * script.cc (script_saw_segment_start_expression): New function.
13202         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
13203         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
13204         script_test_7.sh and script_test_8.sh.
13205         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
13206         script_test_8.stdout.
13207         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
13208         (script_test_6, script_test_6.stdout, script_test_7,
13209         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
13210         * Makefile.in: Regenerate.
13211         * testsuite/script_test_6.sh: New file.
13212         * testsuite/script_test_6.t: Same.
13213         * testsuite/script_test_7.sh: Same.
13214         * testsuite/script_test_7.t: Same.
13215         * testsuite/script_test_8.sh: Same.
13216
13217 2009-10-16  Doug Kwan  <dougkwan@google.com>
13218
13219         * output.cc (Output_segment::set_section_list_address): Cast
13220         expressions to unsigned long long type to avoid format warnings.
13221
13222 2009-10-15  Ian Lance Taylor  <iant@google.com>
13223
13224         * script.cc (Script_options::add_symbol_assignment): Always add a
13225         dot assignment to script_sections_.
13226         * script-sections.cc (Script_sections::add_dot_assignment):
13227         Initialize if necessary.
13228
13229         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
13230         program headers with no load segment if there is a linker script.
13231
13232         * layout.cc (Layout::set_segment_offsets): Align the file offset
13233         to the segment aligment for -N or -n with no load segment.
13234         * output.cc (Output_segment::add_output_section): Don't crash if
13235         the first section is a TLS section.
13236         (Output_segment::set_section_list_addresses): Print an error
13237         message if the address moves backward in a linker script.
13238         * script-sections.cc
13239         (Output_section_element_input::set_section_addresses): Don't
13240         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
13241         (Orphan_output_section::set_section_addresses): Likewise.
13242
13243 2009-10-15  Doug Kwan  <dougkwan@google.com>
13244
13245         * layout.cc (Layout::finish_dynamic_section): Generate tags
13246         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
13247         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
13248         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
13249
13250 2009-10-14  Ian Lance Taylor  <iant@google.com>
13251
13252         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
13253         fields.
13254         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
13255         data_shdr fields of relinfo.
13256         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
13257         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
13258         R_386_TLS_LDO_32, adjust based on section flags.
13259         (Target_i386::Relocate::fix_up_ldo): Remove.
13260
13261 2009-10-13  Ian Lance Taylor  <iant@google.com>
13262
13263         Add support for -pie.
13264         * options.h (class General_options): Add -pie and
13265         --pic-executable.
13266         (General_options::output_is_position_independent): Test -pie.
13267         (General_options::output_is_executable): Return true if not shared
13268         and not relocatable.
13269         (General_options::output_is_pie): Remove.
13270         * options.cc (General_options::finalize): Reject incompatible uses
13271         of -pie.
13272         * gold.cc (queue_middle_tasks): A -pie link is not static.
13273         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
13274         * symtab.cc (Symbol::final_value_is_known): Return false if
13275         output_is_position_independent.
13276         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
13277         output_is_position_independent.
13278         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
13279         output_is_position_independent.
13280         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
13281         output_is_position_independent.
13282         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
13283         two_file_pie_test.
13284         (basic_pie_test.o, basic_pie_test): New targets.
13285         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
13286         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
13287         (two_file_pie_test): New target.
13288         * testsuite/Makefile.in: Rebuild.
13289         * README: Remove note saying that -pie is not supported.
13290
13291 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
13292
13293         * options.h (class General_options): Add -init and -fini.
13294         * layout.cc (Layout::finish_dynamic_section): Emit
13295         given init and fini functions.
13296
13297 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
13298
13299         * gc.h (gc_process_relocs): Check if icf is enabled using new
13300         function.
13301         * gold.cc (queue_initial_tasks): Likewise.
13302         (queue_middle_tasks): Likewise.
13303         * object.cc (do_layout): Likewise.
13304         * symtab.cc (is_section_folded): Likewise.
13305         * main.cc (main): Likewise.
13306         * reloc.cc (Read_relocs::run): Likewise.
13307         (Sized_relobj::do_scan_relocs): Likewise.
13308         * icf.cc (is_function_ctor_or_dtor): New function.
13309         (Icf::find_identical_sections): Check if function is ctor or dtor when
13310         safe icf is chosen.
13311         * options.h (General_options::icf): Change option to be an enum.
13312         (Icf_status): New enum.
13313         (icf_enabled): New method.
13314         (icf_safe_folding): New method.
13315         (set_icf_status): New method.
13316         (icf_status_): New variable.
13317         * (options.cc) (General_options::finalize): Set icf_status_.
13318         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
13319         icf_test and icf_keep_unique_test to use the --icf enum flag.
13320         * testsuite/icf_safe_test.sh: New file.
13321         * testsuite/icf_safe_test.cc: New file.
13322
13323 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
13324
13325         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
13326         includes to gc.h and icf.h.
13327         * arm.cc: Include gc.h.
13328         * gold.cc: Likewise.
13329         * i386.cc: Likewise.
13330         * powerpc.cc: Likewise.
13331         * sparc.cc: Likewise.
13332         * x86_64.cc: Likewise.
13333         * gc.h: Include icf.h.
13334
13335 2009-10-11  Ian Lance Taylor  <iant@google.com>
13336
13337         * plugin.cc: Include "gold.h" before other header files.
13338
13339 2009-10-10  Chris Demetriou  <cgd@google.com>
13340
13341         * options.h (Input_file_argument::Input_file_type): New enum.
13342         (Input_file_argument::is_lib_): Replace with...
13343         (Input_file_argument::type_): New member.
13344         (Input_file_argument::Input_file_argument): Take Input_file_type
13345         'type' rather than boolean 'is_lib' as second argument.
13346         (Input_file_argument::is_lib): Use type_.
13347         (Input_file_argument::is_searched_file): New function.
13348         (Input_file_argument::may_need_search): Handle is_searched_file.
13349         * options.cc (General_options::parse_library): Support -l:filename.
13350         (General_options::parse_just_symbols): Update for Input_file_argument
13351         changes.
13352         (Command_line::process): Likewise.
13353         * archive.cc (Archive::get_file_and_offset): Likewise.
13354         * plugin.cc (Plugin_manager::release_input_file): Likewise.
13355         * script.cc (read_script_file, script_add_file): Likewise.
13356         * fileread.cc (Input_file::Input_file): Likewise.
13357         (Input_file::will_search_for): Handle is_searched_file.
13358         (Input_file::open): Likewise.
13359         * readsyms.cc (Read_symbols::get_name): Likewise.
13360         * testsuite/Makefile.am (searched_file_test): New test.
13361         * testsuite/Makefile.in: Regenerate.
13362         * testsuite/searched_file_test.cc: New file.
13363         * testsuite/searched_file_test_lib.cc: New file.
13364
13365 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13366             Ian Lance Taylor  <iant@google.com>
13367
13368         * descriptor.cc: Include <cstdio> and "binary-io.h".
13369         (Descriptors::open): Open the files in binary mode always.
13370         * script.cc (Lex::get_token): Treat \r as whitespace.
13371
13372 2009-10-09  Ian Lance Taylor  <iant@google.com>
13373
13374         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
13375
13376 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13377             Ian Lance Taylor  <iant@google.com>
13378
13379         * configure.ac: Check for readv function also.
13380         * fileread.cc (readv): Define if not HAVE_READV.
13381         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
13382         does not exist.
13383         * config.in: Regenerate.
13384         * configure: Regenerate.
13385
13386 2009-10-09  Doug Kwan  <dougkwan@google.com>
13387
13388         * layout.cc (Layout::make_output_section): Call target hook to make
13389         ordinary output section.
13390         (Layout::finalize): Adjust parameter list of call the
13391         Target::may_relax().
13392         * layout.h (class Layout::section_list): New method.
13393         * merge.h (Output_merge_base::entsize): Change visibility to public.
13394         (Output_merge_base::is_string, Output_merge_base::do_is_string):
13395         New methods.
13396         (Output_merge_string::do_is_string): New method.
13397         * object.cc (Sized_relobj::do_setup): renamed from
13398         Sized_relobj::set_up.
13399         * object.h (Sized_relobj::adjust_shndx,
13400         Sized_relobj::initializ_input_to_output_maps,
13401         Sized_relobj::free_input_to_output_maps): Change visibilities to
13402         protected.
13403         (Sized_relobj::setup): Virtualize.
13404         (Sized_relobj::do_setup): New method declaration.
13405         (Sized_relobj::invalidate_section_offset,
13406         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
13407         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
13408         * options.cc (parse_int): New function.
13409         * options.h (parse_int): New declaration.
13410         (DEFINE_int): New macro.
13411         (stub_group_size): New option.
13412         * output.cc (Output_section::Output_section): Initialize memebers
13413         merge_section_map_, merge_section_by_properties_map_,
13414         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
13415         (Output_section::add_input_section): Handled deferred code-fill
13416         generation and remove an old comment.
13417         (Output_section::add_relaxed_input_section): New method definition.
13418         (Output_section::add_merge_input_section): Use merge section by
13419         properties map to speed to search.  Update merge section maps
13420         as appropriate.
13421         (Output_section::build_relaxation_map): New method definition.
13422         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
13423         Same.
13424         (Output_section::relax_input_section): Renamed to
13425         Output_section::convert_input_sections_to_relaxed_sections and change
13426         interface to take a vector of pointers to relaxed sections.
13427         (Output_section::find_merge_section,
13428         Output_section::find_relaxed_input_section): New method definitions.
13429         (Output_section::is_input_address_mapped,
13430         Output_section::output_offset, Output_section::output_address):
13431         Use output section data maps to speed up searching.
13432         (Output_section::find_starting_output_address): Add comments.
13433         (Output_section::do_write,
13434         Output_section::write_to_postprocessing_buffer): Do code-fill
13435         generation as appropriate.
13436         (Output_section::get_input_sections): Invalidate relaxed input section
13437         map.
13438         (Output_section::restore_states): Adjust type of checkpoint .
13439         Invalidate relaxed input section map.
13440         * output.h (Output_merge_base): New class declaration.
13441         (Input_section_specifier): New class defintion.
13442         (class Output_relaxed_input_section) Change base class to
13443         Output_section_data_build.
13444         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
13445         base class initializer.
13446         (Output_section::add_relaxed_input_section): New method declaration.
13447         (Output_section::Input_section): Change visibility to protected.
13448         (Output_section::Input_section::relobj,
13449         Output_section::Input_section::shndx): Handle relaxed input sections.
13450         Output_section::input_sections) Change visibility to protected.  Also
13451         define overload to return a non-const pointer.
13452         (Output_section::Merge_section_properties): New class defintion.
13453         (Output_section::Merge_section_by_properties_map,
13454         Output_section::Output_section_data_by_input_section_map,
13455         Output_section::Relaxation_map): New types.
13456         (Output_section::relax_input_section): Rename method to
13457         Output_section::convert_input_sections_to_relaxed_sections and change
13458         interface to take a vector of relaxed section pointers.
13459         (Output_section::find_merge_section,
13460         Output_section::find_relaxed_input_section,
13461         Output_section::build_relaxation_map,
13462         Output_section::convert_input_sections_in_list_to_relaxed_sections):
13463         New method declarations.
13464         (Output_section::merge_section_map_
13465         Output_section::merge_section_by_properties_map_,
13466         Output_section::relaxed_input_section_map_,
13467         Output_section::is_relaxed_input_section_map_valid_,
13468         Output_section::generate_code_fills_at_write_): New data members.
13469         * script-sections.cc
13470         (Output_section_element_input::set_section_addresses): Call
13471         current_data_size and addralign methods of relaxed input sections.
13472         (Orphan_output_section::set_section_addresses): Call current_data_size
13473         and addralign methods of relaxed input sections.
13474         * symtab.cc (Symbol_table::compute_final_value): Extract template
13475         from the body of Symbol_table::sized_finalize_symbol.
13476         (Symbol_table::sized_finalized_symbol): Call
13477         Symbol_table::compute_final_value.
13478         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
13479         (Symbol_table::compute_final_value): New templated method declaration.
13480         * target.cc (Target::do_make_output_section): New method defintion.
13481         * target.h (Target::make_output_section): New method declaration.
13482         (Target::relax): Add more parameters for input objects, symbol table
13483         and layout.  Adjust call to do_relax.
13484         (Target::do_make_output_section): New method declaration.
13485         (Target::do_relax): Add parameters for input objects, symbol table
13486         and layout.
13487
13488 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13489
13490         * pread.c: Include stdio.h.
13491
13492 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13493
13494         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
13495         defined.
13496
13497 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13498
13499         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
13500         Change read_shndx type to unsigned int.
13501         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13502         int.
13503         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13504         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
13505         Change read_shndx type to unsigned int.
13506         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13507         int.
13508         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13509         * layout.cc (Layout::create_symtab_sections): Cast the result of
13510         local_symcount * symsize to off_t in the gold_assert.
13511
13512 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13513
13514         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
13515         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
13516         R_ARM_BASE_ABS.
13517         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
13518         (Arm_relocate_functions::thm_abs5): New function.
13519         (Arm_relocate_functions::abs12): New function.
13520         (Arm_relocate_functions::abs16): New function.
13521         (Arm_relocate_functions::base_abs): New function.
13522         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
13523         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
13524         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
13525         R_ARM_BASE_ABS.
13526         (Scan::global): Likewise.
13527         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
13528         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
13529         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
13530         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
13531         R_ARM_BASE_ABS.
13532
13533 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13534
13535         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
13536         (Arm_relocate_functions::movt_prel): New function.
13537         (Arm_relocate_functions::thm_movw_prel_nc): New function.
13538         (Arm_relocate_functions::thm_movt_prel): New function.
13539         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
13540         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
13541         (Scan::global, Relocate::relocate): Likewise.
13542         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13543
13544 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13545
13546         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
13547         Incremental_checker.
13548         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
13549         unsigned int.
13550         (class Incremental_inputs_header): New class.
13551         (Incremental_inputs_header_writer): Edit comment.
13552         (Incremental_inputs_entry): New class.
13553         (Incremental_inputs_entry_writer): Edit comment.
13554         (Sized_incremental_binary::do_find_incremental_inputs_section):
13555         Add *strtab_shndx parameter, fill it.
13556         (Sized_incremental_binary::do_check_inputs): New method.
13557         (Incremental_checker::can_incrementally_link_output_file): Use
13558         Sized_incremental_binary::check_inputs.
13559         (Incremental_inputs::report_command_line): Save command line in
13560         command_line_.
13561         * incremental.h:
13562         (Incremental_binary::find_incremental_inputs_section): New
13563         method.
13564         (Incremental_binary::do_find_incremental_inputs_section): Add
13565         strtab_shndx parameter.
13566         (Incremental_binary::do_check_inputs): New pure virtual method.
13567         (Sized_incremental_binary::do_check_inputs): Declare.
13568         (Incremental_checker::Incremental_checker): Add incremental_inputs
13569         parameter, use it to initialize incremental_inputs_.
13570         (Incremental_checker::incremental_inputs_): New field.
13571         (Incremental_checker::command_line): New method.
13572         (Incremental_checker::inputs): New method.
13573         (Incremental_checker::command_line_): New field.
13574
13575 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13576
13577         * incremental.cc: Include <cstdarg> and "target-select.h".
13578         (vexplain_no_incremental): New function.
13579         (explain_no_incremental): New function.
13580         (Incremental_binary::error): New method.
13581         (Sized_incremental_binary::do_find_incremental_inputs_section): New
13582         method.
13583         (make_sized_incremental_binary): New function.
13584         (open_incremental_binary): New function.
13585         (can_incrementally_link_file): Add checks if output is ELF and has
13586         inputs section.
13587         * incremental.h: Include "elfcpp_file.h" and "output.h".
13588         (Incremental_binary): New class.
13589         (Sized_incremental_binary): New class.
13590         (open_incremental_binary): Declare.
13591         * object.cc (is_elf_object): Use
13592         elfcpp::Elf_recognizer::is_elf_file.
13593         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
13594         * output.h (Output_file::filesize): New method.
13595
13596 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13597
13598         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
13599         New function.
13600         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
13601         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
13602         function.
13603         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
13604         function.
13605         (Arm_relocate_functions::movw_abs_nc): New function.
13606         (Arm_relocate_functions::movt_abs): New function.
13607         (Arm_relocate_functions::thm_movw_abs_nc): New function.
13608         (Arm_relocate_functions::thm_movt_abs): New function.
13609         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
13610         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
13611         (Scan::global): Likewise.
13612         (Relocate::relocate): Likewise.
13613         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13614
13615 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13616
13617         * arm.cc (Arm_relocate_functions::got_prel) New function.
13618         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
13619         (Relocate::relocate): Likewise.
13620         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13621
13622 2009-10-06  Ian Lance Taylor  <iant@google.com>
13623
13624         * options.h (class General_options): Define
13625         split_stack_adjust_size parameter.
13626         * object.h (class Object): Add uses_split_stack_ and
13627         has_no_split_stack_ fields.  Add uses_split_stack and
13628         has_no_split_stack accessor functions.  Declare
13629         handle_split_stack_section.
13630         (class Reloc_symbol_changes): Define.
13631         (class Sized_relobj): Define Function_offsets.  Declare
13632         split_stack_adjust, split_stack_adjust_reltype, and
13633         find_functions.
13634         * object.cc (Object::handle_split_stack_section): New function.
13635         (Sized_relobj::do_layout): Call handle_split_stack_section.
13636         * dynobj.cc (Sized_dynobj::do_layout): Call
13637         handle_split_stack_section.
13638         * reloc.cc (Sized_relobj::relocate_sections): Call
13639         split_stack_adjust for executable sections in split_stack
13640         objects.  Pass reloc_map to relocate_section.
13641         (Sized_relobj::split_stack_adjust): New function.
13642         (Sized_relobj::split_stack_adjust_reltype): New function.
13643         (Sized_relobj::find_functions): New function.
13644         * target-reloc.h: Include "object.h".
13645         (relocate_section): Add reloc_symbol_changes parameter.  Change
13646         all callers.
13647         * target.h (class Target): Add calls_non_split method.  Declare
13648         do_calls_non_split virtual method.  Declare match_view and
13649         set_view_to_nop.
13650         * target.cc: Include "elfcpp.h".
13651         (Target::do_calls_non_split): New function.
13652         (Target::match_view): New function.
13653         (Target::set_view_to_nop): New function.
13654         * gold.cc (queue_middle_tasks): Give an error if mixing
13655         split-stack and non-split-stack objects with -r.
13656         * i386.cc (Target_i386::relocate_section): Add
13657         reloc_symbol_changes parameter.
13658         (Target_i386::do_calls_non_split): New function.
13659         * x86_64.cc (Target_x86_64::relocate_section): Add
13660         reloc_symbol_changes parameter.
13661         (Target_x86_64::do_calls_non_split): New function.
13662         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
13663         parameter.
13664         * powerpc.cc (Target_powerpc::relocate_section): Add
13665         reloc_symbol_changes parameter.
13666         * sparc.cc (Target_sparc::relocate_section): Add
13667         reloc_symbol_changes parameter.
13668         * configure.ac: Call AM_CONDITIONAL for the default target.
13669         * configure: Rebuild.
13670         * testsuite/Makefile.am (TEST_AS): New variable.
13671         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
13672         (check_DATA): Add split_i386 and split_x86_64 files.
13673         (SPLIT_DEFSYMS): Define.
13674         (split_i386_[1234n].o): New targets.
13675         (split_i386_[124]): New targets.
13676         (split_i386_[1234r].stdout): New targets.
13677         (split_x86_64_[1234n].o): New targets.
13678         (split_x86_64_[124]): New targets.
13679         (split_x86_64_[1234r].stdout): New targets.
13680         (MOSTLYCLEANFILES): Add new executables.
13681         * testsuite/split_i386.sh: New file.
13682         * testsuite/split_x86_64.sh: New file.
13683         * testsuite/split_i386_1.s: New file.
13684         * testsuite/split_i386_2.s: New file.
13685         * testsuite/split_i386_3.s: New file.
13686         * testsuite/split_i386_4.s: New file.
13687         * testsuite/split_i386_n.s: New file.
13688         * testsuite/split_x86_64_1.s: New file.
13689         * testsuite/split_x86_64_2.s: New file.
13690         * testsuite/split_x86_64_3.s: New file.
13691         * testsuite/split_x86_64_4.s: New file.
13692         * testsuite/split_x86_64_n.s: New file.
13693         * testsuite/testfile.cc (Target_test): Update relocation_section
13694         function.
13695         * testsuite/Makefile.in: Rebuild.
13696
13697 2009-10-06  Ian Lance Taylor  <iant@google.com>
13698
13699         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
13700         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
13701         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
13702         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
13703         the address on ldo_addrs_.
13704         (Target_i386::Relocate::fix_up_ldo): New function.
13705
13706 2009-10-06   Rafael Espindola  <espindola@google.com>
13707
13708         * plugin.cc (add_input_library): New.
13709         (Plugin::load): Add add_input_library to tv.
13710         (Plugin_manager::add_input_file): Add the is_lib argument.
13711         (add_input_file): Update call to Plugin_manager::add_input_file.
13712         (add_input_library): New.
13713         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
13714
13715 2009-09-30  Doug Kwan  <dougkwan@google.com>
13716
13717         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
13718         symbol and call Symbol::may_need_copy_reloc to determine if
13719         a copy reloc is needed.
13720         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
13721         nocopyreloc is given in command line.
13722         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
13723         given in command line.
13724         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
13725         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
13726         of the removed Target_i386::may_need_copy_reloc.
13727         * options.h (copyreloc): New option with default value false.
13728         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13729         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
13730         instead of the removed Target_powerpc::may_need_copy_reloc.
13731         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13732         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
13733         instead of the removed Target_sparc::may_need_copy_reloc.
13734         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
13735         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
13736         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
13737         instead of the removed Target_x86_64::may_need_copy_reloc.
13738
13739 2009-09-30  Ian Lance Taylor  <iant@google.com>
13740
13741         * object.h (class Object): Remove target_ field, and target,
13742         sized_target, and set_target methods.
13743         (Object::sized_target): Remove.
13744         (class Sized_relobj): Update declarations.  Remove sized_target.
13745         * object.cc (Sized_relobj::setup): Remove target parameter.
13746         Change all callers.
13747         (Input_objects::add_object): Don't do anything with the target.
13748         (make_elf_sized_object): Add punconfigured parameter.  Change all
13749         callers.  Set or test parameter target.
13750         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
13751         Change all callers.
13752         * parameters.cc (Parameters::set_target): Change parameter type to
13753         be non-const.
13754         (Parameters::default_target): Remove.
13755         (set_parameters_target): Change parameter type to be non-const.
13756         (parameters_force_valid_target): New function.
13757         (parameters_clear_target): New function.
13758         * parameters.h (class Parameters): Update declarations.  Remove
13759         default_target method.  Add sized_target and clear_target
13760         methods.  Change target_ to be non-const.
13761         (set_parameters_target): Update declaration.
13762         (parameters_force_valid_target): Declare.
13763         (parameters_clear_target): Declare.
13764         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
13765         as NULL if we aren't searching.
13766         (Add_symbols::run): Don't check for compatible target.
13767         * fileread.cc (Input_file::open_binary): Call
13768         parameters_force_valid_target.
13769         * gold.cc (queue_middle_tasks): Likewise.
13770         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
13771         set_target on object.
13772         * dynobj.h (class Sized_dynobj): Update declarations.
13773         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
13774         make_elf_object returns NULL.
13775         (Archive::include_member): Don't check whether object target is
13776         compatible.
13777         * output.cc (Output_section::add_input_section): Get target from
13778         parameters.
13779         (Output_section::relax_input_section): Likewise.
13780         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
13781         parameters.
13782         (Sized_relobj::do_scan_relocs): Likewise.
13783         (Sized_relobj::relocate_sections): Likewise.
13784         * resolve.cc (Symbol_table::resolve): Likewise.
13785         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
13786         parameter.  Change all callers.
13787         (Symbol_table::add_from_object): Get target from parameters.
13788         (Symbol_table::add_from_relobj): Don't check object target.
13789         (Symbol_table::add_from_dynobj): Likewise.
13790         (Symbol_table::define_special_symbol): Get target from
13791         parameters.
13792         * symtab.h (class Symbol_table): Update declaration.
13793         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
13794         parameter.  Change all callers.  Clear parameter target.
13795         (Binary_test): Test target here.
13796         * testsuite/object_unittest.cc (gold_testsuite): Remove
13797         target_test_pointer parameter.  Change all callers.
13798         (Object_test): Test target here.
13799
13800 2009-09-26  Ian Lance Taylor  <iant@google.com>
13801
13802         * testsuite/initpri1.c: Don't try to use constructor priorities if
13803         compiling with gcc before 4.3.
13804
13805 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
13806
13807         * testsuite/retain_symbols_file_test.sh (check_present): Change
13808         output file name to retain_symbols_file_test.stdout.
13809         (check_absent): Likewise.
13810
13811 2009-09-18  Craig Silverstein  <csilvers@google.com>
13812
13813         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
13814         * options.cc: Include <cerrno> and <fstream>.
13815         (General_options::finalize): Parse -retain-symbols-file tag.
13816         * options.h: New flag.
13817         (General_options): New method should_retain_symbol, new
13818         variable symbols_to_retain.
13819         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
13820         should_retain_symbol map.
13821         * testsuite/Makefile.am (retain_symbols_file_test): New test.
13822         * testsuite/Makefile.in: Regenerate.
13823         * testsuite/retain_symbols_file_test.sh: New file.
13824
13825 2009-09-18  Nick Clifton  <nickc@redhat.com>
13826
13827         * po/es.po: Updated Spanish translation.
13828
13829 2009-09-17  Doug Kwan  <dougkwan@google.com>
13830
13831         * debug.h (DEBUG_RELAXATION): New constant.
13832         (DEBUG_ALL): Add DEBUG_RELAXATION.
13833         (debug_string_to_enum): Add relaxation debug option.
13834         * layout.cc
13835         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
13836         Layout::Relaxation_debug_check::read_sections,
13837         Layout::Relaxation_debug_check::read_sections): New method definitions.
13838         (Layout::Layout): Initialize data members
13839         record_output_section_data_from_scrips_,
13840         script_output_section_data_list_ and relaxation_debug_check_.
13841         (Layout::save_segments, Layout::restore_segments,
13842         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13843         Layout::relaxation_loop_body): New method definitions.
13844         (Layout::finalize): Support relaxation.  Move section layout code to
13845         Layout::relaxation_loop_body.
13846         (Layout::set_asection_address_from_script): Move code for orphan
13847         section placement out.
13848         (Layout::place_orphan_sections_in_script): New method definition.
13849         * layout.h (Output_segment_headers, Output_file_header):
13850         New forward class declarations.
13851         (Layout::~Layout): Define.
13852         (Layout::new_output_section_data_from_script): New method definition.
13853         (Layout::place_orphan_sections_in_script): New method declaration.
13854         (Layout::Segment_states): New type declaration.
13855         (Layout::save_segments, Layout::restore_segments,
13856         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13857         Layout::relaxation_loop_body): New method declarations.
13858         (Layout::Output_section_data_list): New type declaration.
13859         (Layout::Relaxation_debug_check): New class definition.
13860         (Layout::record_output_section_data_from_script_,
13861         Layout::script_output_section_data_list_, Layout::segment_states_,
13862         Layout::relaxation_debug_check_): New data members.
13863         * output.cc: (Output_section_headers::do_size): New method definition.
13864         (Output_section_headers::Output_section_headers): Move size
13865         computation to Output_section_headers::do_size.
13866         (Output_segment_headers::do_size): New method definition.
13867         (Output_file_header::Output_file_header): Move size computation to
13868         Output_file_header::do_size and call it.
13869         (Output_file_header::do_size): New method definition.
13870         (Output_data_group::Output_data_group): Adjust call to
13871         Output_section_data.
13872         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
13873         (Output_symtab_xindex::do_write): Add array bound check.
13874         (Output_section::Input_section::print_to_mapfile): Handle
13875         RELAXED_INPUT_SECTION_CODE.
13876         (Output_section::Output_section): Initialize data member checkpoint_.
13877         (Output_section::~Output_section): Delete checkpoint object pointed
13878         by checkpoint_.
13879         (Output_section::add_input_section): Always add an Input_section if
13880         relaxing.
13881         (Output_section::add_merge_input_section): Add assert.
13882         (Output_section::relax_input_section): New method definition.
13883         (Output_section::set_final_data_size): Set load address to zero for
13884         an unallocated section.
13885         (Output_section::do_address_and_file_offset_have_reset_values):
13886         New method definition.
13887         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
13888         Handle relaxed input section.
13889         (Output_section::sort_attached_input_sections): Checkpoint input
13890         section list lazily.
13891         (Output_section::get_input_sections): Change type of input_sections to
13892         list of Simple_input_section pointers.  Checkpoint input section list
13893         lazily.  Also handle relaxed input sections.
13894         (Output_section::add_input_section_for_script): Take a reference to
13895         a Simple_input_section object instead of Relobj pointer and section
13896         index as parameter.  Handle relaxed input sections.
13897         (Output_section::save_states, Output_section::restore_states): New
13898         method definitions.
13899         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
13900         (Output_data::is_data_size_fixed): New method definition.
13901         (Output_data::reset_addresss_and_file_offset): Do not reset data size
13902         if it is fixed.
13903         (Output_data::address_and_file_offset_have_reset_values): New method
13904         definition.
13905         (Output_data::do_address_and_file_offset_have_reset_values): New method
13906         definition.
13907         (Output_data::set_data_size): Check that data size is not fixed.
13908         (Output_data::fix_data_size): New method definition.
13909         (Output_data::is_data_size_fixed_): New data member.
13910         (Output_section_headers::set_final_data_size): New method definition.
13911         (Output_section_headers::do_size): New method declaration.
13912         (Output_segment_headers::set_final_data_size): New method definition.
13913         (Output_segment_headers::do_size): New method declaration.
13914         (Output_file_header::set_final_data_size)::New method definition.
13915         (Output_file_header::do_size)::New method declaration.
13916         (Output_section_data::Output_section_data): Add new parameter
13917         is_data_size_fixed and use it to fix data size.
13918         (Output_data_const::Output_data_const): Adjust call to base class
13919         constructor and fix data size.
13920         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
13921         base class constructor and fix data size.
13922         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
13923         base class constructor and fix data size.
13924         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
13925         class constructor and fix data size.
13926         (Output_data_group::set_final_data_size): New method definition.
13927         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
13928         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
13929         class constructor and fix data size.
13930         (Output_relaxed_input_section): New class definition.
13931         (Output_section::Simple_input_section): New class definition.
13932         (Output_section::get_input_sections): Adjust parameter list.
13933         (Output_section::add_input_section_for_script): Same.
13934         (Output_section::save_states, Output_section::restore_states,
13935         Output_section::do_address_and_file_offset_have_reset_values,
13936         (Output_section::Input_section::Input_section): Handle
13937         RELAXED_INPUT_SECTION_CODE.  Add new overload for
13938         Output_relaxed_input_section.
13939         (Output_section::Input_section::is_input_section,
13940         Output_section::Input_section::set_output_section): Handle relaxed
13941         input section.
13942         (Output_section::Input_section::is_relaxed_input_section,
13943         Output_section::Input_section::output_section_data,
13944         Output_section::Input_section::relaxed_input_section): New method
13945         definitions.
13946         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
13947         value.
13948         (Output_section::Input_section::u1_): Update comments.
13949         (Output_section::Input_section::u2_): Add new union member poris.
13950         (Output_section::Checkpoint_output_section): New classs definition.
13951         (Output_section::relax_input_section): New method declaration.
13952         (Output_section::checkpoint_): New data member.
13953         (Output_segment): Update comments.
13954         (Output_segment::Output_segment): Un-privatize copy constructor.
13955         (Output_segment::operator=): Un-privatize.
13956         * script-sections.cc (Output_section_element::Input_section_list):
13957         Change element type to Output_section::Simple_input_section.
13958         (Output_section_element_dot_assignment::set_section_addresses):
13959         Register output section data for relaxation clean up.
13960         (Output_data_exression::Output_data_expression): Adjust call to base
13961         constructor to fix data size.
13962         (Output_section_element_data::set_section_addresses): Register
13963         Output_data_expression object for relaxation clean up.
13964         (struct Input_section_info): Replace Relobj pointer and section index
13965         pair with Output_section::Simple_input_section and Convert struct to a
13966         class.
13967         (Input_section_sorter::operator()): Adjust access to
13968         Input_section_info data member to use accessors.
13969         (Output_section_element_input::set_section_addresses): Use layout
13970         parameter.  Adjust code to use Output_section::Simple_input_section
13971         and Input_secction_info classes.  Register filler for relaxation
13972         clean up.
13973         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
13974         and section index pair with Output_section::Simple_input_section
13975         class.  Adjust code accordingly.
13976         (Phdrs_element::release_segment): New method definition.
13977         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
13978         segment list.
13979         (Script_sections::release_segments): New method definition.
13980         * gold/script-sections.h (Script_sections::release_segments): New
13981         method declaration.
13982         * gold/target.h (Target::may_relax, Target::relax,
13983         Target::do_may_relax, Target::do_relax): New method definitions.
13984
13985 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13986
13987         * arm.cc (has_signed_unsigned_overflow): New function.
13988         (Arm_relocate_functions::abs8): New function.
13989         (Target_arm::Scan::local): Handle R_ARM_ABS8.
13990         (Target_arm::Scan::global): Likewise.
13991         (Target_arm::relocate::relocate): Likewise.
13992         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
13993         Likewise.
13994
13995 2009-09-16  Cary Coutant  <ccoutant@google.com>
13996
13997         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
13998         * testsuite/Makefile.in: Regenerate.
13999
14000 2009-09-11  Nick Clifton  <nickc@redhat.com>
14001
14002         * po/gold.pot: Updated by the Translation project.
14003
14004 2009-09-08  Cary Coutant  <ccoutant@google.com>
14005
14006         * output.cc (Output_file::open): Add execute permission to empty file.
14007         * testsuite/Makefile.am (permission_test): New test.
14008         * testsuite/Makefile.in: Regenerate.
14009
14010 2009-09-02  Ian Lance Taylor  <iant@google.com>
14011
14012         * output.cc (Output_file::resize): Call map_no_anonymous rather
14013         than map.
14014
14015 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
14016
14017         * gold.cc: Include "incremental.h".
14018         (queue_initial_tasks): Call Incremental_checker methods.
14019         * incremental.cc: Include "output.h".
14020         (Incremental_checker::can_incrementally_link_output_file): New
14021         method.
14022         * incremental.h (Incremental_checker): New class.
14023
14024         * output.cc (Output_file::open_for_modification): New method.
14025         (Output_file::map_anonymous): Changed return type to bool.  Record
14026         map in base_ field.
14027         (Output_file::map_no_anonymous): New method, broken out of map.
14028         (Output_file::map): Use map_no_anonymous and map_anonymous.
14029         * output.h (class Output_file): Update declarations.
14030
14031 2009-08-24  Cary Coutant  <ccoutant@google.com>
14032
14033         * options.h (Command_line::Pre_options): New class.
14034         (Command_line::pre_options): New member.
14035         * options.cc (gold::options::ready_to_register): New variable.
14036         (One_option::register_option): Do nothing if not registering options.
14037         Assert if same short option registered twice.
14038         (General_options::General_options): Turn off option registration when
14039         done constructing.
14040         (Command_line::Pre_options::Pre_options): New constructor.
14041
14042 2009-08-24  Cary Coutant  <ccoutant@google.com>
14043
14044         * options.h (General_options::no_keep_memory): Remove incorrect
14045         short option.
14046
14047 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
14048
14049         * Makefile.am (am__skiplex, am__skipyacc): New.
14050         * Makefile.in: Regenerate.
14051
14052 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
14053
14054         * Makefile.am (AM_CPPFLAGS): Renamed from ...
14055         (INCLUDES): ... this.
14056         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
14057         (AM_CPPFLAGS): Renamed from ...
14058         (INCLUDE): ... this.
14059         * Makefile.in, testsuite/Makefile.in: Regenerate.
14060
14061         * Makefile.in: Regenerate.
14062         * aclocal.m4: Likewise.
14063         * config.in: Likewise.
14064         * configure: Likewise.
14065         * testsuite/Makefile.in: Likewise.
14066
14067         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
14068         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
14069         * Makefile.in: Regenerate.
14070         * testsuite/Makefile.in: Regenerate.
14071
14072 2009-08-19  Cary Coutant  <ccoutant@google.com>
14073
14074         * resolve.cc (Symbol_table::resolve): Don't complain about defined
14075         symbols in shared libraries overridden by hidden or internal symbols
14076         in the main program.
14077
14078 2009-08-19  Chris Demetriou  <cgd@google.com>
14079
14080         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
14081         checking source file names in error messages.
14082
14083 2009-08-18  Doug Kwan  <dougkwan@google.com>
14084
14085         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
14086         an elcpp::Ehdr as parameter.  Adjust call to set_target.
14087         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
14088         an elfcpp::Ehdr as parameter.
14089         * object.cc (Object::set_target): Remove the version that looks up
14090         a target and sets it.
14091         (Sized_relobj::setup): Take a Target object instead of
14092         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
14093         (make_elf_sized_object): Find target and ask target to
14094         make an ELF object.
14095         * object.h: (Object::set_target): Remove the version that looks up
14096         a target and sets it.
14097         (Sized_relobj::setup): Take a Target object instead of
14098         an elfcpp:Ehdr as parameter.
14099         * target.cc: Include dynobj.h.
14100         (Target::do_make_elf_object_implementation): New.
14101         (Target::do_make_elf_object): New.
14102         * target.h (Target::make_elf_object): New template declaration.
14103         (Target::do_make_elf_object): New method declarations.
14104         (Target::do_make_elf_object_implementation): New template declaration.
14105
14106 2009-08-14  Ian Lance Taylor  <iant@google.com>
14107
14108         * gold.h (FUNCTION_NAME): Define.
14109         (gold_unreachable): Use FUNCTION_NAME.
14110
14111 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
14112
14113         * icf.cc (Icf::find_identical_sections): Issue a warning when a
14114         symbol in the --keep-unique list is not found.
14115
14116 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
14117
14118         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
14119         been maked as --keep-unique.
14120         (Icf::unfold_section): New function.
14121         * icf.h (Icf::unfold_section): New function.
14122         * options.h (General_options::keep_unique): New option.
14123         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
14124         * testsuite/Makefile.in: Regenerate.
14125         * testsuite/icf_keep_unique_test.sh: New file.
14126         * testsuite/icf_keep_unique_test.cc: New file.
14127
14128 2009-08-12  Cary Coutant  <ccoutant@google.com>
14129
14130         PR 10471
14131         * resolve.cc (Symbol_table::resolve): Check for references from
14132         dynamic objects to hidden and internal symbols.
14133         * testsuite/Makefile.am (hidden_test.sh): New test.
14134         * testsuite/Makefile.in: Regenerate.
14135         * testsuite/hidden_test.sh: New script.
14136         * testsuite/hidden_test_1.c: New test source.
14137         * testsuite/hidden_test_main.c: New test source.
14138
14139 2009-08-11  Doug Kwan  <dougkwan@google.com>
14140
14141         * arm.cc: Update comments.
14142         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
14143         segment to locate the .ARM.exidx section if present.
14144
14145 2009-08-09  Doug Kwan  <dougkwan@google.com>
14146
14147         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
14148         patch.
14149
14150 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
14151         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
14152         compiler warnings.
14153
14154 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
14155
14156         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
14157         valid tls_segment only for non-debug-section relocations.
14158         * testsuite/Makefile.am: Add gc_tls_test.
14159         * testsuite/Makefile.in: Regenerate.
14160         * testsuite/gc_tls_test.cc: New file.
14161         * testsuite/gc_tls_test.sh: New file.
14162
14163 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
14164
14165         * icf.cc: New file.
14166         * icf.h: New file.
14167         * Makefile.am (CCFILES): Add icf.cc.
14168         (HFILES): Add icf.h
14169         * Makefile.in: Regenerate.
14170         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
14171         * gc.h (gc_process_relocs): Populate lists used by icf to contain
14172         section, symbol and addend information for the relocs.
14173         * gold.cc (queue_middle_tasks): Call identical code folding.
14174         * gold.h: Add defines for multimap.
14175         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
14176         to the call of finalize_local_symbols.
14177         * main.cc (main): Create object of class Icf.
14178         * object.cc (Sized_relobj::do_layout): Allow this function to be
14179         called twice during icf.
14180         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
14181         to sections marked as identical by icf.
14182         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
14183         when available.
14184         (Sized_relobj::do_section_entsize): New function.
14185         * object.h (Object::section_entsize): New function.
14186         (Object::do_section_entsize): New pure virtual function.
14187         (Relobj::finalize_local_symbols): Add new parameter.
14188         (Relobj::do_section_entsize): New function.
14189         * options.h (General_options::icf): New option.
14190         (General_options::icf_iterations): New option.
14191         (General_options::print_icf_sections): New option.
14192         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
14193         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
14194         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
14195         icf.
14196         * symtab.cc (Symbol_table::is_section_folded): New function.
14197         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
14198         to sections marked as identical by icf.
14199         * symtab.h (Symbol_table::set_icf): New function.
14200         (Symbol_table::icf): New function.
14201         (Symbol_table::is_section_folded): New function.
14202         (Symbol_table::icf_): New data member.
14203         * target-reloc.h (relocate_section): Ignore sections folded by icf.
14204         * testsuite/Makefile.am: Add commands to build icf_test.
14205         * testsuite/Makefile.in: Regenerate.
14206         * testsuite/icf_test.sh: New file.
14207         * testsuite/icf_test.cc: New file.
14208
14209 2009-07-24  Chris Demetriou  <cgd@google.com>
14210
14211         * layout.cc (is_compressible_debug_section): Fix incorrect
14212         comment about compressed section names.
14213
14214 2009-07-20  Ian Lance Taylor  <ian@airs.com>
14215
14216         PR 10419
14217         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
14218
14219 2009-07-16  Ian Lance Taylor  <iant@google.com>
14220
14221         PR 10400
14222         * layout.h: #include <map>.
14223         (class Kept_section): Change from struct to class.  Add accessors
14224         and setters.  Add section size to Comdat_group mapping.  Change
14225         Comdat_group to std::map.  Add is_comdat_ field.  Add
14226         linkonce_size field in union.
14227         (class Layout): Update declaration of find_or_add_kept_section.
14228         Don't declare find_kept_object.
14229         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
14230         parameter.  Add object, shndx, is_comdat, and is_group_name
14231         parameters.  Change all callers.  Adjust for new Kept_section.
14232         (Layout::find_kept_object): Remove.
14233         * object.cc (Sized_relobj::include_section_group): Update use of
14234         Kept_section.  Rename secnum to shndx.  Only record
14235         Kept_comdat_section if sections are the same size.
14236         (Sized_relobj::include_linkonce_section): Update use of
14237         Kept_section.  Only record Kept_comdat_section if sections are the
14238         same size.  Set size of linkonce section.
14239         (Sized_relobj::map_to_kept_section): Update call to
14240         get_kept_comdat_section.
14241         * object.h (class Sized_relobj): Rename fields in
14242         Kept_comdat_section to drop trailing underscores; change object
14243         field to Relobj*.  Change Kept_comdat_section_table to store
14244         struct rather than pointer.
14245         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
14246         Add kept_object and kept_shndx parameters.  Change all callers.
14247         (Sized_relobj::get_kept_comdat_section): Change return type to
14248         bool.  Add kept_object and kept_shndx parameters.  Change all
14249         callers.
14250         * plugin.cc (Pluginobj::include_comdat_group): Update call to
14251         Layout::find_or_add_kept_section.
14252
14253 2009-07-09  Ian Lance Taylor  <iant@google.com>
14254
14255         * merge.cc (Object_merge_map::initialize_input_to_output_map):
14256         Reserve space in the hash table.
14257
14258 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
14259
14260         * fileread.cc (File_read::get_mtime): New method.
14261         * fileread.h (Timespec): New structure.
14262         (File_read::get_mtime): New method.
14263         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
14264         Renamed from timestamp_nsec.
14265         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
14266         Elf_Xword.
14267         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
14268         timestamp_nsec.
14269         (Incremental_inputs::report_archive): Save mtime; style fix.
14270         (Incremental_inputs::report_obejct): Save mtime; style fix.
14271         (Incremental_inputs::report_script): Save mtime; style fix.
14272         (Incremental_inputs::finalize_inputs): Style fix.
14273         (Incremental_inputs::finalize): Style fix.
14274         (Incremental_inputs::create_input_section_data): Store inputs
14275         mtime.
14276         * incremental.h (Incremental_inputs::report_script): Add mtime
14277         argument.
14278         (Incremental_inputs::Input_info::Input_info): Intialize only one
14279         union member.
14280         (Incremental_inputs::Input_info::archive): Move to nameless
14281         union.
14282         (Incremental_inputs::Input_info::obejct): Move to nameless union.
14283         (Incremental_inputs::Input_info::script): Move to nameless union.
14284         (Incremental_inputs::mtime): New field.
14285         * script.cc (read_input_script): Pass file mtime to
14286         Incremental_input.
14287         * script.h (Script_info::inputs): Style fix.
14288
14289 2009-07-01  Ian Lance Taylor  <ian@airs.com>
14290
14291         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
14292         instead of 32.
14293
14294 2009-06-24  Ian Lance Taylor  <iant@google.com>
14295
14296         PR 10156
14297         * layout.cc (Layout::choose_output_section): If we find an
14298         existing section, update the flags.
14299         (Layout::create_notes): New function, broken out of
14300         Layout::finalize.
14301         (Layout::finalize): Don't create note sections.
14302         (Layout::create_note): Don't crash if linker script discards
14303         section.
14304         (Layout::create_gold_note): Likewise.
14305         (Layout::create_build_id): Likewise.  Don't set
14306         after_input_sections on the section.
14307         (Layout::create_executable_stack_info): Remove target parameter.
14308         Change caller.
14309         * layout.h (class Layout): Declare create_notes.  Update
14310         declaration of create_executable_stack_info.
14311         * gold.cc (queue_middle_tasks): Call create_notes.
14312         * output.cc (Output_section::update_flags_for_input_section): Move
14313         here from output.h.  If SHF_ALLOC flag is newly set, mark address
14314         invalid.
14315         * output.h (Output_data::mark_address_invalid): New function.
14316         (class Output_section): Only declare, not define,
14317         update_flags_for_input_section.  Remove set_flags.
14318
14319 2009-06-24  Ian Lance Taylor  <iant@google.com>
14320
14321         * script-sections.cc (Output_section_definition::
14322         set_section_addresses): Rename shadowing local load_address to
14323         laddr.
14324
14325 2009-06-24  Ian Lance Taylor  <iant@google.com>
14326
14327         PR 10244
14328         * reloc.cc (relocate_sections): Skip empty relocation sections.
14329
14330 2009-06-23  Ian Lance Taylor  <iant@google.com>
14331
14332         PR 10156
14333         * layout.cc (Layout::create_note): Use choose_output_section
14334         rather than make_output_section.
14335
14336 2009-06-23  Ian Lance Taylor  <iant@google.com>
14337
14338         PR 10237
14339         * options.cc (General_options::parse_V): Set printed_version_.
14340         (General_options::General_options): Initialize printed_version_.
14341         * options.h (class General_options): Add printed_version_ field.
14342         * gold.cc (queue_initial_tasks): If there are no input files,
14343         don't give a fatal error if we printed the version information.
14344         (queue_middle_tasks): If using -r with a shared object, give a
14345         fatal error rather than an ordinary error.
14346
14347 2009-06-23  Ian Lance Taylor  <iant@google.com>
14348
14349         PR 10219
14350         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
14351         (Layout::make_output_section): Set have_stabstr_section_ if we see
14352         a .stab*str section.
14353         (Layout::finalize): Call link_stabs_sections.
14354         (Layout::link_stabs_sections): New file.
14355         * layout.h (class Layout): Add have_stabstr_section_ field.
14356         Declare link_stabs_sections.
14357
14358 2009-06-23  Doug Kwan  <dougkwan@google.com>
14359
14360         * Makefile.am (libgold_a_LIBADD): New.
14361         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
14362         * Makefile.in: Regenerate.
14363         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
14364         * configure: Regenerate.
14365         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
14366         * fileread.cc: Include sys/state.h
14367         * gold.h: Declare memmem and strndup if found missing.
14368         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
14369
14370 2009-06-23  Ian Lance Taylor  <iant@google.com>
14371
14372         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
14373         * configure: Rebuild.
14374
14375 2009-06-23  Ian Lance Taylor  <iant@google.com>
14376
14377         PR 10147
14378         * object.cc (Object::section_contents): Don't try to get a view if
14379         the section has length zero.
14380         (Object::handle_gnu_warning_section): If the section is empty, use
14381         the name of the section as the warning.
14382
14383 2009-06-23  Ian Lance Taylor  <iant@google.com>
14384
14385         PR 10133
14386         * stringpool.h (class Stringpool_template): Add optimize_ field.
14387         (Stringpool_template::set_optimize): New function.
14388         * stringpool.cc (Stringpool_template::Stringpool_template):
14389         Initialize optimize_ field.
14390         (Stringpool_template::set_string_offsets): Test local optimize
14391         fild rather than parameter.
14392         * layout.cc (Layout::Layout): Call set_optimize on the section
14393         name stringpool.
14394
14395 2009-06-22  Ian Lance Taylor  <iant@google.com>
14396
14397         PR 10030
14398         * yyscript.y: Parse TARGET.
14399         * script.cc (script_set_target): New function.
14400         * script-c.h (script_set_target): Declare.
14401         * options.cc (General_options::string_to_object_format): Rename
14402         from string_to_object_format in anonymous namespace.  Change
14403         callers.
14404         * options.h (class General_options): Declare
14405         string_to_object_format.
14406
14407 2009-06-22  Ian Lance Taylor  <iant@google.com>
14408
14409         * script-sections.cc (Script_sections::create_segments): Don't put
14410         program headers in a PT_LOAD segment if -n or -N.
14411
14412 2009-06-22  Ian Lance Taylor  <iant@google.com>
14413
14414         PR 10141
14415         * options.h (class General_options): Add -z lazy and -z now.  Sort
14416         -z options into alphabetical order.
14417         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
14418
14419 2009-06-21  Ian Lance Taylor  <iant@google.com>
14420
14421         * layout.cc (Layout::make_output_section): Call
14422         Target::new_output_section.
14423         (Layout::attach_allocated_section_to_segment): Put large section
14424         sections in a separate load segment with the large segment flag
14425         set.
14426         (Layout::segment_precedes): Sort large data segments after other
14427         load segments.
14428         (align_file_offset): New static function.
14429         (Layout::set_segment_offsets): Use align_file_offset.
14430         * output.h (class Output_section): Add is_small_section_ and
14431         is_large_section_ fields.
14432         (Output_section::is_small_section): New function.
14433         (Output_section::set_is_small_section):  New function.
14434         (Output_section::is_large_section): New function.
14435         (Output_section::set_is_large_section): New function.
14436         (Output_section::is_large_data_section): New function.
14437         (class Output_segment): Add is_large_data_segment_ field.
14438         (Output_segment::is_large_data_segment): New function.
14439         (Output_segment::set_is_large_data_segment): New function.
14440         * output.cc (Output_section::Output_section): Initialize new
14441         fields.
14442         (Output_segment::Output_segment): Likewise.
14443         (Output_segment::add_output_section): Add assertion that large
14444         data sections always go in large data segments.  Force small data
14445         sections to the end of the list of data sections.  Force small BSS
14446         sections to the start of the list of BSS sections.  For large BSS
14447         sections to the end of the list of BSS sections.
14448         * symtab.h (class Symbol): Declare is_common_shndx.
14449         (Symbol::is_defined): Check Symbol::is_common_shndx.
14450         (Symbol::is_common): Likewise.
14451         (class Symbol_table): Define enum Commons_section_type.  Update
14452         declarations.  Add small_commons_ and large_commons_ fields.
14453         * symtab.cc (Symbol::is_common_shndx): New function.
14454         (Symbol_table::Symbol_table): Initialize new fields.
14455         (Symbol_table::add_from_object): Put small and large common
14456         symbols in the right list.
14457         (Symbol_table::sized_finalized_symbol): Check
14458         Symbol::is_common_shndx.
14459         (Symbol_table::sized_write_globals): Likewise.
14460         * common.cc (Symbol_table::do_allocate_commons): Allocate new
14461         common symbol lists.  Don't call do_allocate_commons_list if the
14462         list is empty.
14463         (Symbol_table::do_allocate_commons_list): Remove is_tls
14464         parameter.  Add comons_section_type parameter.  Change all
14465         callers.  Handle small and large common symbols.
14466         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
14467         Symbol::is_common_shndx.
14468         * resolve.cc (symbol_to_bits): Likewise.
14469         * target.h (Target::small_common_shndx): New function.
14470         (Target::small_common_section_flags): New function.
14471         (Target::large_common_shndx): New function.
14472         (Target::large_common_section_flags): New function.
14473         (Target::new_output_section): New function.
14474         (Target::Target_info): Add small_common_shndx, large_common_shndx,
14475         small_common_section_flags, and large_common_section_flags
14476         fields.
14477         (Target::do_new_output_section): New virtual function.
14478         * arm.cc (Target_arm::arm_info): Initialize new fields.
14479         * i386.cc (Target_i386::i386_info): Likewise.
14480         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
14481         Likewise.
14482         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
14483         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14484         (Target_x86_64::do_new_output_section): New function.
14485         * configure.ac: Define conditional MCMODEL_MEDIUM.
14486         * testsuite/Makefile.am (check_PROGRAMS): Add large.
14487         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
14488         (large_LDFLAGS): Define.
14489         * testsuite/large.c: New file.
14490         * testsuite/testfile.cc (Target_test::test_target_info):
14491         Initialize new fields.
14492         * configure, testsuite/Makefile.in: Rebuild.
14493
14494 2009-06-05  Doug Kwan  <dougkwan@google.com>
14495
14496         * Makefile.am (CCFILES): Add target.cc.
14497         * Makefile.in: Regenerate.
14498         * i386.cc (class Target_i386): Define new virtual method to
14499         override do_is_local_label_name in parent.
14500         * object.cc (Sized_relobj::do_count_local_symbols): Discard
14501         local symbols if --discard-locals or -X is given.
14502         * options.h (class General_options): Declare new options
14503         '--discard-locals' and '-X' for discarding locals.
14504         * target.h (class Target): Define new methods is_local_label_name.
14505         Declare new virtual method do_is_local_label_name.
14506         * target.cc: New file.
14507         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
14508         (check_SCRIPTS): Add discard_locals_test.sh.
14509         (check_DATA): Add discard_local_tests.syms.
14510         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
14511         (discard_local_tests.syms, discard_locals_test.o): New make rules.
14512         * testsuite/Makefile.in: Regenerate.
14513         * testsuite/discard_locals_test.c: New file.
14514         * testsuite/discard_locals_test.sh: Same.
14515
14516 2009-06-05  Doug Kwan  <dougkwan@google.com>
14517
14518         * object.cc (Sized_relobj::Sized_relobj): Initialize
14519         discarded_eh_frame_shndx_ to -1U.
14520         (Sized_relobj::do_layout): Record index of a discard .eh_frame
14521         section.
14522         (Sized_relobj::do_count_local_symbols): Skip local symbols in
14523         a discarded .eh_frame section.
14524         (Sized_relobj::do_finalize_local_symbols): Ditto.
14525         * object.h (class Sized_relobj): Declare new member
14526         discarded_eh_frame_shndx_.
14527         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
14528         (local_labels_test.o, local_labels_test): New rules.
14529         * testsuite/Makefile.in: Regenerate.
14530
14531 2009-06-04  Doug Kwan  <dougkwan@google.com>
14532
14533         * layout.cc (Layout::section_name_mapping): Add mapping for
14534         special ARM sections.
14535
14536 2009-06-03  Doug Kwan  <dougkwan@google.com>
14537
14538         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
14539         (utils::has_overflow): Same.
14540
14541 2009-06-03  Ian Lance Taylor  <iant@google.com>
14542
14543         * layout.cc (Layout::section_name_mapping): New array, replacing
14544         Layout::linkonce_mapping.
14545         (Layout::section_name_mapping_count): New variable, replacing
14546         Layout::linkonce_mapping_count.
14547         (Layout::linkonce_output_name): Remove.
14548         (Layout::output_section_name): Rewrite.
14549         * layout.h (class Layout): Rename Linkonce_mapping to
14550         Section_name_mapping, linkonce_mapping to section_name_mapping,
14551         linkonce_mapping_count to section_name_mapping_count.  Don't
14552         declare linkonce_output_name.
14553
14554 2009-06-03  Doug Kwan  <dougkwan@google.com>
14555
14556         * gold/arm.cc (namespace utils): New.
14557         (Target_arm::reloc_is_non_pic): Define new method.
14558         (class Arm_relocate_functions): New.
14559         (Target_arm::Relocate::relocate): Handle relocation types used by
14560         Android.
14561
14562 2009-06-03  Ian Lance Taylor  <iant@google.com>
14563
14564         * arm.cc (Target_arm::scan::global): Use || instead of |.
14565
14566 2009-06-02  Doug Kwan  <dougkwan@google.com>
14567
14568         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
14569         issued_non_pic_error_.
14570         (class Target_arm::Scan): Declare new method check_non_pic.
14571         Define new method symbol_needs_plt_entry.
14572         Declare new data member issued_non_pic_error_.
14573         (class Target_arm::Relocate): Declare new method
14574         should_apply_static_reloc.
14575         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
14576         (Target_arm::Scan::check_non_pic): Define new method.
14577         (Target_arm::Scan::local): Handle a small subset of reloc types used
14578         by Android.
14579         (Target_arm::Scan::local): Same.
14580         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
14581
14582 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
14583
14584         * incremental.cc (Incremental_inputs::report_command_line): Filter
14585         out --incremental-* options.
14586
14587 2009-05-29  Doug Kwan  <dougkwan@google.com>
14588
14589         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
14590         template class.
14591         (class Target_arm): Update comment.
14592         (Target_arm::Target_arm): Initialize new data members GOT_,
14593         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
14594         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
14595         and Target_arm::rel_dyn_section.
14596         Declare new_enum Target_arm::Got_type.
14597         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
14598         and DYNBSS_.
14599         Update commments for member do_dynsym_value.
14600         (Target_arm::got_size, Target_arm::plt_section,
14601         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
14602         new methods inside class defintion.
14603         (Target_arm::got_section): Define new method.
14604         (Target_arm::rel_dyn_section): Same.
14605         (Output_data_plt_arm): New template class.
14606         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
14607         (Output_data_plt_arm:do_adjust_output_section): Define new method.
14608         (Output_data_plt_arm::add_entry): Same.
14609         (Output_data_plt_arm::first_plt_entry): Define new
14610         static data member for PLT instruction template.
14611         (Output_data_plt_arm::plt_entry): Same.
14612         (Output_data_plt_arm::do_write): Define new method.
14613         (Target_arm::make_plt_entry): Same.
14614         (Target_arm::do_finalize_sections): Same.
14615         (Target_arm::do_dynsym_value): Same.
14616
14617 2009-05-28  Doug Kwan  <dougkwan@google.com>
14618
14619         * Makefile.am (TARGETSOURCES): Add arm.cc.
14620         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
14621         * Makefile.in: Regenerate.
14622         * arm.cc: New file.
14623         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
14624
14625 2009-05-26  Doug Kwan  <dougkwan@google.com>
14626
14627         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
14628         (General_options::check_excluded_libs): Strip off directories in
14629         archive name before matching like GNU ld does.
14630         * testsuite/Makefile.am (MOSTLYCLEANFILES,
14631         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
14632         (exclude_libs_test_LDFLAGS): Add linker option
14633         -Wl,--exclude-libs,libexclude_libs_test_3
14634         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
14635         an explicit archive without using -l.
14636         (alt/libexclude_libs_test_3.a): New make rule.
14637         * testsuite/Makefile.in: Regenerate.
14638         * testsuite/exclude_libs_test.c : Declare lib3_default().
14639         (main): Call it.
14640         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
14641         * exclude_libs_test_3.c: New file.
14642
14643 2009-05-26  Nick Clifton  <nickc@redhat.com>
14644
14645         * po/id.po: New Indonesian translation.
14646         * po/gold.pot: Updated template file.
14647
14648 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
14649
14650         * testsuite/Makefile.am: Add -ffunction-sections to compile
14651         gc_comdat_test files.  Add -Wl,--gc-sections to build
14652         gc_comdat_test.
14653         * testsuite/Makefile.in: Regenerate.
14654         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
14655
14656 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
14657
14658         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
14659         kept comdat section was garbage collected.
14660         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
14661         * testsuite/Makefile.in: Regenerate.
14662         * testsuite/gc_comdat_test.sh: New file.
14663         * testsuite/gc_comdat_test_1.cc: New file.
14664         * testsuite/gc_comdat_test_2.cc: New file.
14665
14666 2009-05-19  Doug Kwan  <dougkwan@google.com>
14667
14668         * archive.cc (Archive::Archive): Move constructor from archive.h
14669         to here.  Initialize no_export_.
14670         (Archive::get_elf_object_for_member): Set no_export flag of object.
14671         * archive.h (Archive::Archive): Move constructor body to
14672         archive.cc.
14673         (Archive::no_export): New method.
14674         (Archive::no_export_): New field.
14675         * object.h (Object::Object): Initialize no_export_ to false.
14676         (Object::no_export, Object::set_no_export): New methods.
14677         (Object::no_export_): New field.
14678         * options.cc (General_options::parse_exclude_libs): New method.
14679         (General_options::check_excluded_libs) Same.
14680         * options.h (exclude_libs): New option.
14681         (General_options::check_excluded_libs): New method declaration.
14682         (General_options::excluded_libs_): New field.
14683         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
14684         default or protected visibility if an object has no-export flag set.
14685         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
14686         (check_SCRIPTS): Add exclude_libs_test.sh.
14687         (check_DATA): Add exclude_libs_test.syms.
14688         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
14689         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
14690         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
14691         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
14692         (exclude_libs_test.syms, libexclude_libs_test_1.a,
14693         libexclude_libs_test_2.a): New rules.
14694         * testsuite/Makefile.in: Regenerate.
14695         * testsuite/exclude_libs_test.c: New file.
14696         * testsuite/exclude_libs_test.sh: Ditto.
14697         * testsuite/exclude_libs_test_1.c: Ditto.
14698         * testsuite/exclude_libs_test_2.c: Ditto.
14699
14700 2009-05-15  Ian Lance Taylor  <iant@google.com>
14701
14702         * configure.ac: Check for declarations for cases where libiberty.h
14703         checks HAVE_DECL_xxx.
14704         * configure, config.in: Rebuild.
14705
14706 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
14707
14708         * gold.h (Incremental_argument_list): Remove (invalid) forward
14709         declaration.
14710         * incremental.cc (Incremental_inputs::report_achive): New method.
14711         (Incremental_inputs::report_object): New method.
14712         (Incremental_inputs::report_script): New method.
14713         (Incremental_inputs::finalize_inputs): New method.
14714         (Incremental_inputs::finalize): Call finalize_inputs().
14715         (Incremental_inputs::sized_create_incremental_inputs_section_data):
14716         Create inputs entries.
14717         * incremental.h (Incremental_input_type): New enum.
14718         (Incremental_inputs::Incremental_input): Initialize new fields.
14719         (Incremental_inputs::report_inputs): New method.
14720         (Incremental_inputs::report_achive): New method.
14721         (Incremental_inputs::report_object): New method.
14722         (Incremental_inputs::report_script): New method.
14723         (Incremental_inputs::finalize_inputs): New method.
14724         (Incremental_inputs::Input_info): New struct.
14725         (Incremental_inputs::Input_info_map): New typedef.
14726         (Incremental_inputs::lock_): New field.
14727         (Incremental_inputs::Inputs_): New field.
14728         (Incremental_inputs::Inputs_map): New field.
14729         * main.cc (main): Call Incremental_input::report_inputs.
14730         * options.h (Input_argument_list): Typedef moved from
14731         Input_arguments.
14732         (Input_file_group::Files): Remove, use ::Input_argument_list.
14733         (Input_file_group::Input_argument_list): Remove, use
14734         ::Input_argument_list.
14735         * plugin.cc (Plugin_manager::add_input_file): Add error in
14736         incremental build.
14737         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
14738         functions.
14739         * script.cc (read_input_script): Call
14740         Incremental_input::report_script.
14741         * script.h (Script_info): New class.
14742
14743 2009-04-27  Ian Lance Taylor  <iant@google.com>
14744
14745         * x86_64.cc (do_adjust_output_section): Set entsize to
14746         plt_entry_size.
14747
14748 2009-04-23  Elliott Hughes  <enh@google.com>
14749
14750         * output.cc (Output_file::close): After short writes, continue
14751         writing from the correct offset in the buffer being written.
14752
14753 2009-04-23  Chris Demetriou  <cgd@google.com>
14754
14755         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
14756         * configure: Regenerate.
14757         * config.in: Regenerate.
14758         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
14759         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
14760
14761 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
14762
14763         * incremental.cc (Incremental_inputs_header_data): Renamed from
14764         Incremental_input_header_data.
14765         (Incremental_inputs_header_data::data_size): New field.
14766         (Incremental_inputs_header_data::put_input_file_count): Renamed
14767         from input_file_count.
14768         (Incremental_inputs_header_data::put_command_line_offset): Renamed
14769         from command_line_offset.
14770         (Incremental_inputs_header_data::put_reserved): Renamed from
14771         put_reserved.
14772         (Incremental_inputs_entry_data): Renamed from
14773         Incremental_input_entry_data.
14774         (Incremental_inputs_entry_data::data_size): New field.
14775         (Incremental_inputs::report_command_line): New method.
14776         (Incremental_inputs::finalize): New method.
14777         (Incremental_inputs::create_incremental_inputs_data): New method.
14778         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
14779         * incremental.h: New file.
14780         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
14781         (Layout::finalize): Create incremental inputs section in
14782         incremental builds.
14783         (Layout::create_incremental_info_sections): New method.
14784         * layout.h (Layout::incremental_inputs): New method.
14785         (Layout::create_incremental_info_sections): New method.
14786         (Layout::incremental_inputs_): New field.
14787         * main.cc (main): Notify Incremental_input of the command line.
14788
14789 2009-04-01  Ian Lance Taylor  <iant@google.com>
14790             Mikolaj Zalewski  <mikolajz@google.com>
14791
14792         * gold.h (reserve_unordered_map): Define, three versions, one for
14793         each version of Unordered_map.
14794         * layout.cc (Layout::Layout): Remove options parameter.  Add
14795         number_of_input_files parameter.  Don't initialize options_.
14796         Initialize number_of_input_files_ and resized_signatures_.  Move
14797         sections_are_attached_.
14798         (Layout::layout_group): Reserve space for group_signatures_.
14799         (Layout::find_or_add_kept_section): Change name parameter to be a
14800         reference.  Resize signatures_ map when it gets large enough.
14801         (Layout::layout_eh_frame): Use parameters->options() instead of
14802         this->options_.
14803         (Layout::make_output_section): Likewise.
14804         (Layout::attach_allocated_section_to_segment): Likewise.
14805         (Layout::finalize, Layout::create_executable_stack): Likewise.
14806         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
14807         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
14808         * layout.h (class Layout): Update declarations.  Remove options_
14809         field.  Add number_of_input_files_ and resized_signatures_
14810         fields.  Move sections_are_attached_ field.
14811         * main.cc (main): Pass number of input files to Layout
14812         constructor.  Don't pass options.
14813
14814 2009-03-30  Ian Lance Taylor  <iant@google.com>
14815
14816         * ffsll.c (ffsll): Correct implementation.
14817
14818 2009-03-27  Ian Lance Taylor  <iant@google.com>
14819
14820         * ffsll.c: New file.
14821         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
14822         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
14823         * ftruncate.c (ftruncate): Declare before definition.
14824         * mremap.c (mremap): Likewise.
14825         * pread.c (pread): Likewise.
14826         * configure, Makefile.in, config.in: Rebuild.
14827
14828         * mremap.c: New file.
14829         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
14830         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
14831         (mremap): Declare if HAVE_MREMAP is not defined.
14832         * configure, Makefile.in, config.in: Rebuild.
14833
14834 2009-03-27  Cary Coutant  <ccoutant@google.com>
14835
14836         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
14837         position independent.
14838         * sparc.cc (Target_sparc::check_non_pic): Likewise.
14839         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
14840
14841 2009-03-24  Cary Coutant  <ccoutant@google.com>
14842
14843         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
14844         an executable.
14845         (needs_dynamic_reloc): Likewise.
14846
14847 2009-03-24  Ian Lance Taylor  <iant@google.com>
14848
14849         * yyscript.y (file_cmd): Recognize EXTERN.
14850         (extern_name_list, extern_name_list_body): New nonterminals.
14851         * script.cc (script_add_extern): Define.
14852         * script-c.h (script_add_extern): Declare.
14853
14854 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
14855
14856         * object.cc (is_elf_object): Define.
14857         * object.h (is_elf_object): Declare.
14858         * archive.cc (Archive::get_elf_object_for_member): Call
14859         is_elf_object.
14860         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
14861
14862 2009-03-24  Elliott Hughes  <enh@google.com>
14863
14864         * output.cc (Output_file::map_anonymous): Define.
14865         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
14866         try an anonymous one.  Report the size if the mmap fails.
14867         * output.h (class Output_file): Declare map_anonymous.
14868
14869 2009-03-24  Ian Lance Taylor  <iant@google.com>
14870
14871         * target-select.cc (instantiate_target): Don't acquire the lock if
14872         the instantiated_target_ field has already been set.
14873
14874 2009-03-23  Ian Lance Taylor  <iant@google.com>
14875
14876         * gold-threads.h (class Initialize_lock): Define.
14877         * gold-threads.cc (class Initialize_lock_once): Define.
14878         (initialize_lock_control): New static variable.
14879         (initialize_lock_pointer): New static variable.
14880         (initialize_lock_once): New static function.
14881         (Initialize_lock::Initialize_lock): Define.
14882         (Initialize_lock::initialize): Define.
14883         * target-select.h: Include "gold-threads.h".
14884         (class Target_selector): Add lock_ and initialize_lock_ fields.
14885         Don't define instantiate_target, just declare it.
14886         * target-select.cc (Target_selector::Target_selector): Initialize
14887         new fields.
14888         (Target_selector::instantiate_target): Define.
14889         * descriptors.h: Include "gold-threads.h".
14890         (class Descriptors): Add initialize_lock_ field.
14891         * descriptors.cc (Descriptors::Descriptors): Initialize new
14892         field.
14893         (Descriptors::open): Use initialize_lock_ field
14894         * errors.h (class Errors): Add initialize_lock_ field.
14895         * errors.cc (Errors::Errors): Initialize new field.
14896         (Errors::initialize_lock): Use initialize_lock_ field.
14897         * powerpc.cc (class Target_selector_powerpc): Remove
14898         instantiated_target_ field.  In do_recognize call
14899         instantiate_target rather than do_instantiate_target.  In
14900         do_instantiate_target just allocate a new target.
14901         * sparc.cc (class Target_selector_sparc): Likewise.
14902
14903         * freebsd.h: New file.
14904         * i386.cc: Include "freebsd.h".
14905         (Target_i386): Derive from Target_freebsd rather than
14906         Sized_target.
14907         (Target_selector_i386): Derive from Target_selector_freebsd rather
14908         than Target_selector.
14909         * x86_64.cc: Include "freebsd.h".
14910         (Target_x86_64): Derive from Target_freebsd rather than
14911         Sized_target.
14912         (Target_selector_x86_64): Derive from Target_selector_freebsd
14913         rather than Target_selector.
14914         * target.h (class Target): Add adjust_elf_header and
14915         do_adjust_elf_header.
14916         * output.cc (Output_file_header:: do_sized_write): Call target
14917         adjust_elf_header routine.
14918         * configure.tgt: Set targ_osabi.
14919         * configure.ac: Define GOLD_DEFAULT_OSABI.
14920         * parameters.cc (Parameters::default_target): Pass
14921         GOLD_DEFAULT_OSABI to select_target.
14922         * target-select.h (class Target_selector): Make instantiate_target
14923         protected rather than private.
14924         * Makefile.am (HFILES): Add freebsd.h.
14925         * configure, Makefile.in, config.in: Rebuild.
14926
14927         * merge.cc (do_add_input_section): Correct pend value.  Change
14928         message about last entry not being null terminated from error to
14929         warning.
14930
14931 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
14932
14933         * incremental.cc: New file.
14934         * Makefile.am (CCFILES): Add incremental.cc.
14935         * Makefile.in: Rebuild.
14936
14937 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
14938
14939         * layout.cc (Layout::output_section_name): Preserve names
14940         of '.note.' sections.
14941
14942 2009-03-19  Ian Lance Taylor  <iant@google.com>
14943
14944         * descriptors.cc (Descriptors::open): Check that the options are
14945         valid before using them.
14946
14947 2009-03-18  Ian Lance Taylor  <iant@google.com>
14948
14949         * script-sections.h: Include <list>.
14950         (class Script_sections): Change Sections_elements from std::vector
14951         to std::list.  Typedef public Elements_iterator.  Add
14952         orphan_section_placement_, data_segment_align_start_, and
14953         saw_data_segment_align_ fields.  Remove data_segment_align_index_
14954         field.
14955         * script-sections.cc (class Orphan_section_placement): New class.
14956         (class Sections_element): Add virtual functions is_relro and
14957         orphan_section_init.  Remove virtual function place_orphan_here.
14958         (class Output_section_definition): Add is_relro and
14959         orphan_section_init.  Remove place_orphan_here.
14960         (class Orphan_output_section): Likewise.
14961         (Script_sections::Script_sections): Update for field changes.
14962         (Script_sections::data_segment_align): Set saw_data_segment_align_
14963         and data_segment_align_start_, not data_segment_align_index.
14964         (Script_sections::data_segment_relro_end): Check
14965         saw_data_segment_align_.  Use data_segment_align_start_ rather
14966         than data_segment_align_index_.
14967         (Script_sections::place_orphan): Rewrite to use
14968         Orphan_section_placement.
14969
14970 2009-03-17  Ian Lance Taylor  <iant@google.com>
14971
14972         * archive.cc (Archive::add_symbols): Check for a version attached
14973         to the symbol name in the archive map.
14974         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
14975         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
14976         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
14977         (ver_test_11.a): New target.
14978         * testsuite/Makefile.in: Rebuild.
14979
14980         * configure.ac: Check for chsize and posix_fallocate.  Replace
14981         ftruncate.
14982         * ftruncate.c: New file, from gnulib.
14983         * output.cc (posix_fallocate): Define dummy version if not
14984         HAVE_POSIX_FALLOCATE.
14985         (Output_file::map): Call posix_fallocate rather than lseek and
14986         write.
14987         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
14988         * configure, Makefile.in, config.in: Rebuild.
14989
14990 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
14991
14992         * layout.h (Layout::create_note): Add section_name parameter.
14993         * layout.cc (Layout::create_note): Likewise.
14994         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
14995
14996 2009-03-17  Ian Lance Taylor  <iant@google.com>
14997
14998         * descriptors.cc: Include "options.h".
14999         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
15000         (Descriptors::open): Always use O_CLOEXEC when opening a new
15001         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
15002         then set FD_CLOEXEC.
15003
15004         * sparc.cc (class Target_sparc): Add has_got_section.
15005         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
15006         make sure we have a GOT section.
15007
15008         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
15009         (Target_sparc::Scan::local): Likewise.
15010         (Target_sparc::Scan::global): Likewise.
15011         (Target_sparc::Relocate::relocate): Likewise.
15012         (Target_sparc::Relocate::relocate_tls): Likewise.
15013
15014         * symtab.cc (Symbol_table::define_default_version): New function,
15015         broken out of add_from_object.
15016         (Symbol_table::add_from_object): Call define_default_version.
15017         (Symbol_table::define_special_symbol): Add resolve_oldsym
15018         parameter.  Change all callers.  If the version for a symbol comes
15019         from a version script, resolve it with the symbol with the same
15020         name with no version.  Also add the symbol without a version if
15021         appropriate.
15022         (do_define_in_output_data): If resolving with oldsym, don't delete
15023         sym.
15024         (do_define_in_output_segment): Likewise.
15025         (do_define_as_constant): Likewise.
15026         * symtab.h (class Symbol_table): Update declarations.
15027
15028 2009-03-13  Ian Lance Taylor  <iant@google.com>
15029
15030         * readsyms.cc (Read_symbols::incompatible_warning): New function.
15031         (Read_symbols::requeue): New function.
15032         (Read_symbols::do_read_symbols): If make_elf_object fails because
15033         the target type is not configured, and the file was searched for,
15034         issue a warning and retry with the next directory.
15035         (Add_symbols::run): If the file has an incompatible format, and
15036         it was searched for, requeue the Read_symbols task.  On error,
15037         release the object.
15038         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
15039         dirindex parameter to constructor.  Change all callers.  Declare
15040         incompatible_warning and requeue.
15041         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
15042         input_argument_ and input_group_ fields.  Add them to
15043         constructor.  Change all callers.
15044         (class Read_script): Add dirindex_ field.  Add it to constructor.
15045         Change all callers.
15046         * archive.cc (Archive::setup): Remove input_objects parameter.
15047         Change all callers.
15048         (Archive::get_file_and_offset): Likewise.
15049         (Archive::read_all_symbols): Likewise.
15050         (Archive::read_symbols): Likewise.
15051         (Archive::get_elf_object_for_member): Remove input_objects
15052         parameter.  Add punconfigured parameter.  Change all callers.
15053         (Archive::add_symbols): Change return type to bool.  Check return
15054         value of include_member.
15055         (Archive::include_all_members): Likewise.
15056         (Archive::include_member): Change return type to bool.  Return
15057         false if first included object has incompatible target.  Set
15058         included_member_ field.
15059         (Add_archive_symbols::run): If add_symbols returns false, requeue
15060         Read_symbols task.
15061         * archive.h (class Archive): Add included_member_ field.
15062         Initialize it in constructor.  Add input_file and searched_for
15063         methods.  Update declarations.
15064         (class Add_archive_symbols): Add dirpath_, dirindex_, and
15065         input_argument_ fields.  Add them to constructor.  Change all
15066         callers.
15067         * script.cc: Include "target-select.h".
15068         (class Parser_closure): Add skip_on_incompatible_target_ and
15069         found_incompatible_target_ fields.  Add
15070         skip_on_incompatible_target parameter to constructor.  Change all
15071         callers.  Add methods skip_on_incompatible_target,
15072         clear_skip_on_incompatible_target, found_incompatible_target, and
15073         set_found_incompatible_target.
15074         (read_input_script): Add dirindex parameter.  Change all callers.
15075         If parser finds an incompatible target, requeue Read_symbols
15076         task.
15077         (script_set_symbol): Clear skip_on_incompatible_target in
15078         closure.
15079         (script_add_assertion, script_parse_option): Likewise.
15080         (script_start_sections, script_add_phdr): Likewise.
15081         (script_check_output_format): New function.
15082         * script.h (read_input_script): Update declaration.
15083         * script-c.h (script_check_output_format): Declare.
15084         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
15085         (ignore_cmd): Remove OUTPUT_FORMAT.
15086         * fileread.cc (Input_file::Input_file): Add explicit this.
15087         (Input_file::will_search_for): New function.
15088         (Input_file::open): Add pindex parameter.  Change all callers.
15089         * fileread.h (class Input_file): Add input_file_argument method.
15090         Declare will_search_for.  Update declarations.
15091         * object.cc (make_elf_object): Add punconfigured parameter.
15092         Change all callers.
15093         * object.h (class Object): Make input_file public.  Add
15094         searched_for method.
15095         (make_elf_object): Update declaration.
15096         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
15097         restart search.
15098         * dirsearch.h (class Dirsearch): Update declaration.
15099         * options.h (class General_options): Add --warn-search-mismatch.
15100         * parameters.cc (Parameters::is_compatible_target): New function.
15101         * parameters.h (class Parameters): Declare is_compatible_target.
15102         * workqueue.cc (Workqueue::add_blocker): New function.
15103         * workqueue.h (class Workqueue): Declare add_blocker.
15104
15105         * fileread.cc (Input_file::open): Remove options parameter.
15106         Change all callers.
15107         (Input_file::open_binary): Likewise.
15108         * script.cc (read_input_script): Likewise.
15109         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
15110         options parameter from constructor.  Change all callers.
15111         (class Read_script): Likewise.
15112         * fileread.h (class Input_file): Update declarations.
15113         * script.h (read_input_script): Update declaration.
15114
15115 2009-03-10  Nick Clifton  <nickc@redhat.com>
15116
15117         * po/es.po: New Spanish translation.
15118
15119 2009-03-06  Cary Coutant  <ccoutant@google.com>
15120
15121         * options.cc (parse_short_option): Keep dash_z from registering itself.
15122
15123 2009-03-03  Ian Lance Taylor  <iant@google.com>
15124
15125         PR 9918
15126         * target-reloc.h (relocate_section): Pass output_section to
15127         relocate.
15128         * i386.cc (Target_i386::should_apply_static_reloc): Add
15129         output_section parameter.  Change all callers.
15130         (Target_i386::Relocate::relocate): Add output_section parameter.
15131         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15132         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
15133         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
15134         * testsuite/two_file_shared.sh: New script.
15135         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
15136         (check_DATA): Add two_file_shared.dbg.
15137         (two_file_shared.dbg): New target.
15138         * testsuite/Makefile.in: Rebuild.
15139
15140 2009-03-01  Ian Lance Taylor  <iant@google.com>
15141
15142         * configure.ac: Check for byteswap.h.
15143         * configure: Rebuild.
15144         * config.in: Rebuild.
15145
15146 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
15147
15148         * layout.cc (Layout::find_or_add_kept_section): New function.
15149         (Layout::add_comdat): Removed.
15150         * layout.h (struct Kept_section): Move out of class Layout.
15151         Remove trailing underscores from field names.  Add group_sections
15152         field.  Rename group_ field to is_group.  Change all uses.
15153         (class Layout): Declare find_or_add_kept_section, not add_comdat.
15154         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
15155         comdat_groups_ field.
15156         (Sized_relobj::include_section_group): Use
15157         find_or_add_kept_section and Kept_section::group_sections.
15158         (Sized_relobj::include_linkonce_section): Likewise.
15159         * object.cc (class Sized_relobj): Don't define Comdat_group or
15160         Comdat_group_table.  Remove find_comdat_group and
15161         add_comdat_group.  Remove comdat_groups_ field.
15162         * plugin.cc (include_comdat_group): Use
15163         Layout::find_or_add_kept_section.
15164
15165 2009-02-28  Ian Lance Taylor  <iant@google.com>
15166
15167         * README: --gc-sections and map files are now supported.  Document
15168         some build requirements.
15169
15170         PR 6992
15171         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
15172         relocatable link set the value of the section symbol to zero.
15173         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
15174         relocatable link don't include the section address in the local
15175         symbol value.
15176
15177 2009-02-27  Ian Lance Taylor  <iant@google.com>
15178
15179         PR 6811
15180         * options.h (class Search_directory): Add is_system_directory.
15181         (class General_options): Declare is_in_system_directory.
15182         * options.cc (get_relative_sysroot): Make static.
15183         (get_default_sysroot): Make static.
15184         (General_optoins::is_in_system_directory): New function.
15185         * fileread.cc (Input_file::is_in_system_directory): New function.
15186         * fileread.h (class Input_file): Declare is_in_system_directory.
15187         * object.h (class Object): Add is_in_system_directory.
15188         (class Input_objects): Remove system_library_directory_ field.
15189         * object.cc (Input_objects::add_object): Don't set
15190         system_library_directory_.
15191         (input_objects::found_in_system_library_directory): Remove.
15192         * symtab.cc (Symbol_table::write_globals): Remove input_objects
15193         parameter.  Change all callers.
15194         (Symbol_table::sized_write_globals): Likewise.
15195         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
15196         Call Object::is_in_system_directory.
15197         * symtab.h (class Symbol_table): Update declarations.
15198
15199         PR 5990
15200         * descriptors.h (Open_descriptor): Add is_on_stack field.
15201         * descriptors.cc (Descriptors::open): If the descriptor is on the
15202         top of the stack, remove it.  Initialize is_on_stack field.
15203         (Descriptors::release): Only add pod to stack if it is not on the
15204         stack already.
15205         (Descriptors::close_some_descriptor): Clear stack_next and
15206         is_on_stack fields.
15207
15208         PR 7091
15209         * output.cc (Output_section::find_starting_output_address): Rename
15210         from starting_output_address; add PADDR parameter; change return
15211         type.
15212         * output.h (class Output_section): Declare
15213         find_starting_output_address instead of starting_output_address.
15214         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
15215         section symbol for which we can't find a merge section.
15216
15217         PR 9836
15218         * symtab.cc (Symbol_table::add_from_object): If the visibility is
15219         hidden or internal, force the symbol to be local.
15220         * resolve.cc (Symbol::override_visibility): Define.
15221         (Symbol::override_base): Use override_visibility.
15222         (Symbol_table::resolve): Likewise.
15223         (Symbol::override_base_with_special): Likewise.
15224         (Symbol_table::override_with_special): If the visibility is hidden
15225         or internal, force the symbol to be local.
15226         * symtab.h (class Symbol): Add set_visibility and
15227         override_visibility.
15228         * testsuite/ver_test_1.sh: New file.
15229         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
15230         (check_DATA): Add ver_test_1.syms.
15231         (ver_test_1.syms): New target.
15232         * testsuite/Makefile.in: Rebuild.
15233
15234 2009-02-25  Cary Coutant  <ccoutant@google.com>
15235
15236         * layout.cc (Layout::choose_output_section): Don't rename sections
15237         when using a linker script that has a SECTIONS clause.
15238         * Makefile.in: Regenerate.
15239
15240         * testsuite/Makefile.am (script_test_5.sh): New test case.
15241         * testsuite/Makefile.in: Regenerate.
15242         * testsuite/script_test_5.cc: New file.
15243         * testsuite/script_test_5.sh: New file.
15244         * testsuite/script_test_5.t: New file.
15245
15246 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
15247
15248         * archive.cc (Archive::include_member): Update calls to add_symbols.
15249         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
15250         the Layout argument.
15251         * dynobj.h (do_add_symbols): Add the Layout argument.
15252         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
15253         Layout argument.
15254         * object.h (Object::add_symbols): Add the Layout argument.
15255         (Object::do_add_symbols): Add the Layout argument.
15256         (Sized_relobj::do_add_symbols): Add the Layout argument.
15257         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
15258         Unify the two versions.
15259         (Add_plugin_symbols): Remove.
15260         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
15261         (Sized_pluginobj::do_add_symbols): Unify the two versions.
15262         (Add_plugin_symbols): Remove.
15263         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
15264         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
15265         (Add_symbols::run): Make it work with Pulginobj.
15266
15267 2009-02-06  Ian Lance Taylor  <iant@google.com>
15268
15269         * object.cc (Sized_relobj::do_layout): Make info message start
15270         with lower case letter.
15271
15272 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
15273
15274         * binary.cc: Fix file comment.
15275
15276         * options.h (enum Incremental_disposition): Define.
15277         (class General_options): Add new options: --incremental,
15278         --incremental_changed, --incremental_unchanged,
15279         --incremental_unknown.  Add incremental_disposition_ and
15280         implicit_incremental_ fields.
15281         (General_options::incremental_disposition): New function.
15282         (class Position_dependent_options): Add incremental_disposition
15283         option.
15284         (Position_dependent_options::copy_from_options): Set incremental
15285         dispositions.
15286         * options.cc (General_options::parse_incremental_changed): New
15287         function.
15288         (General_options::parse_incremental_unchanged): New function.
15289         (General_options::parse_incremental_unknown): New function.
15290         (General_options::General_options): Initialize new fields
15291         incremental_disposition_ and implicit_incremental_.
15292         (General_options::finalize): Check for uasge of --incremental-*
15293         without --incremental.
15294
15295 2009-02-06  Chris Demetriou  <cgd@google.com>
15296
15297         * gold.h (gold_undefined_symbol): Change to take only a Symbol
15298         pointer and to report location as the file name associated with
15299         the symbol.
15300         (gold_undefined_symbol_at_location): New function to replace the
15301         old gold_undefined_symbol functionality.
15302         * target-reloc.h (relocate_section): Update to use
15303         gold_undefined_symbol_at_location.
15304         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15305         Call gold_undefined_symbol function rather than gold_error.
15306         * errors.h (Errors::undefined_symbol): Take location as a
15307         string, rather than calculating it from a relocation.
15308         * errors.cc (Errors::fatal): Print "fatal error:" before the
15309         formatted message.
15310         (Errors::error, Errors::error_at_location): Print "error: "
15311         before the formatted message.
15312         (Errors::undefined_symbol): Take location as a string, rather
15313         than calculating it from a relocation.
15314         (gold_undefined_symbol_at_location): New function akin to
15315         old gold_undefined_symbol, calculates location from relocation.
15316         (gold_undefined_symbol): Change to take only a Symbol pointer
15317         and to report location as the file name associated with the symbol.
15318         * testsuite/debug_msg.sh: Update for changed error messages.
15319         * testsuite/undef_symbol.sh: Likewise.
15320
15321 2009-02-04  Duncan Sands  <baldrick@free.fr>
15322
15323         PR 9812
15324         * reduced_debug_output.h
15325         (Output_reduced_debug_abbrev_section::failed): Use format for
15326         gold_warning.
15327         (Output_reduced_debug_info_section::faild): Likewise.
15328
15329 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
15330
15331         * script.cc (Lazy_demangler): New class.
15332         (Version_script_info::get_symbol_version_helper): Demangle a
15333         symbol only once.
15334
15335 2009-01-29  Cary Coutant  <ccoutant@google.com>
15336
15337         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
15338         to __tls_get_addr.
15339         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15340
15341 2009-01-28  Ian Lance Taylor  <iant@google.com>
15342
15343         * version.cc (version_string): Bump to 1.9.
15344
15345         * gold.h: Include <cstring> and <stdint.h>.
15346         * version.cc: Include <cstdio>.
15347         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
15348         warning.
15349         * reduced_debug_output.cc (insert_into_vector): Rename from
15350         Insert_into_vector; change all callers.  Use Swap_unaligned to
15351         avoid aliasing issue; remove union since it is unnecessary.
15352
15353 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
15354
15355         * Makefile.am (CCFILES): Add gc.cc.
15356         (HFILES): Add gc.h.
15357         * Makefile.in: Regenerate.
15358         * gold.cc (Gc_runner): New class.
15359         (queue_initial_tasks): Call garbage collection related tasks
15360         when corresponding options are invoked.
15361         (queue_middle_gc_tasks): New function.
15362         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
15363         processed early before laying out sections during garbage collection.
15364         * gold.h (queue_middle_gc_tasks): New function.
15365         (is_prefix_of): Move from "layout.cc".
15366         * i386.cc (Target_i386::gc_process_relocs): New function.
15367         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
15368         * main.cc (main): Create object of class "Garbage_collection".
15369         * object.cc (Relobj::copy_symbols_data): New function.
15370         (Relobj::is_section_name_included): New function.
15371         (Sized_relobj::do_layout): Allow this function to be called twice
15372         during garbage collection and defer layout of section during the
15373         first call.
15374         * object.h (Relobj::get_symbols_data): New function.
15375         (Relobj::is_section_name_included): New function.
15376         (Relobj::copy_symbols_data): New function.
15377         (Relobj::set_symbols_data): New function.
15378         (Relobj::get_relocs_data): New function.
15379         (Relobj::set_relocs_data): New function.
15380         (Relobj::is_output_section_offset_invalid): New pure virtual function.
15381         (Relobj::gc_process_relocs): New function.
15382         (Relobj::do_gc_process_relocs): New pure virtual function.
15383         (Relobj::sd_): New data member.
15384         (Sized_relobj::is_output_section_offset_invalid): New function.
15385         (Sized_relobj::do_gc_process_relocs): New function.
15386         * options.h (General_options::gc_sections): Modify to not be a no-op.
15387         (General_options::print_gc_sections): New option.
15388         * plugin.cc (Plugin_finish::run): Remove function call to
15389         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
15390         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
15391         * reloc.cc (Read_relocs::run): Add task to process relocs and
15392         determine unreferenced sections when doing garbage collection.
15393         (Gc_process_relocs): New class.
15394         (Sized_relobj::do_gc_process_relocs): New function.
15395         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
15396         sections that are garbage collected.
15397         * reloc.h (Gc_process_relocs): New class.
15398         * sparc.cc (Target_sparc::gc_process_relocs): New function.
15399         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
15400         symbols whose corresponding sections are garbage collected.
15401         (Symbol_table::Symbol_table): Add new parameter for the garbage
15402         collection object.
15403         (Symbol_table::gc_mark_undef_symbols): New function.
15404         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15405         (Symbol_table::gc_mark_dyn_syms): New function.
15406         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
15407         as garbage.
15408         (Symbol_table::add_from_object): Likewise.
15409         (Symbol_table::add_from_relobj): When building shared objects, do not
15410         treat externally visible symbols as garbage.
15411         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
15412         table information for static and relocatable links.
15413         * symtab.h (Symbol_table::set_gc): New function.
15414         (Symbol_table::gc): New function.
15415         (Symbol_table::gc_mark_undef_symbols): New function.
15416         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15417         (Symbol_table::gc_mark_dyn_syms): New function.
15418         (Symbol_table::gc_): New data member.
15419         * target.h (Sized_target::gc_process_relocs): New pure virtual
15420         function.
15421         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
15422         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
15423
15424 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
15425
15426         * options.h (General_options::gc_sections): Define as a no-op for now.
15427         (General_options::no_keep_memory): Ditto.
15428         (General_options::Bshareable): Define.
15429         * options.cc (General_options::finalize): Honor -Bshareable.
15430
15431 2009-01-20  Andreas Schwab  <schwab@suse.de>
15432
15433         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
15434         read the value in the contents, since we don't use it.  Use the
15435         template endianness when writing.
15436         (Relocate::relocate): Use it for R_PPC_REL16_HA.
15437
15438 2009-01-19  Andreas Schwab  <schwab@suse.de>
15439
15440         * configure.tgt (powerpc64-*): Fix targ_obj.
15441
15442 2009-01-15  Ian Lance Taylor  <iant@google.com>
15443
15444         * object.cc (Sized_relobj::write_local_symbols): Don't write out
15445         local symbols when stripping all symbols.
15446
15447 2009-01-14  Cary Coutant  <ccoutant@google.com>
15448
15449         * output.cc (Output_reloc): Add explicit instantiations.
15450
15451 2009-01-14  Cary Coutant  <ccoutant@google.com>
15452
15453         * archive.cc (Archive::get_elf_object_for_member): Remove call
15454         to File_read::claim_for_plugin.
15455         * descriptors.cc (Descriptors::open): Remove reference to
15456         is_claimed.
15457         (Descriptors::claim_for_plugin): Remove.
15458         * descriptors.h (Descriptors::claim_for_plugin): Remove.
15459         (Descriptors::is_claimed): Remove.
15460         (claim_descriptor_for_plugin): Remove.
15461         * fileread.cc (File_read::claim_for_plugin): Remove.
15462         * fileread.h (File_read::claim_for_plugin): Remove.
15463         (File_read::descriptor): Reopen descriptor if necessary.
15464         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
15465         (Plugin_manager::all_symbols_read): Add task parameter. Change
15466         all callers.
15467         (Plugin_manager::get_input_file): New function.
15468         (Plugin_manager::release_input_file): New function.
15469         (Pluginobj::Pluginobj): Add filesize parameter and initialize
15470         corresponding data member.
15471         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
15472         and pass to base constructor. Change all callers.
15473         (get_input_file, release_input_file): New functions.
15474         (make_sized_plugin_object): Add filesize parameter. Change all callers.
15475         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
15476         (Plugin_manager::all_symbols_read): Add task parameter.
15477         (Plugin_manager::get_input_file): New function.
15478         (Plugin_manager::release_input_file): New function.
15479         (Plugin_manager::task_): New data member.
15480         (Pluginobj::Pluginobj): Add filesize parameter.
15481         (Pluginobj::filename): New function.
15482         (Pluginobj::descriptor): New function.
15483         (Pluginobj::filesize): New function.
15484         (Pluginobj::filesize_): New data member.
15485         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
15486         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
15487         File_read::claim_for_plugin; use Object::unlock to unlock the file.
15488
15489         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
15490         with archive libraries.
15491         * testsuite/Makefile.in: Regenerate.
15492         * testsuite/plugin_test.c (struct sym_info): New type.
15493         (get_input_file, release_input_file): New static variables.
15494         (onload): Capture new transfer vector entries.
15495         (claim_file_hook): Stop reading at end of file according to filesize.
15496         Factor out parsing of readelf output into separate function.
15497         (all_symbols_read_hook): Exercise get_input_file and release_input_file
15498         APIs and get the source file name from the symbol table.  Convert
15499         source file name to corresponding object file name.  Print info
15500         message when adding new input files.
15501         (parse_readelf_line): New function.
15502         * testsuite/plugin_test_1.sh: Add checks for new info messages.
15503         * testsuite/plugin_test_2.sh: Likewise.
15504         * testsuite/plugin_test_3.sh: Likewise.
15505         * testsuite/plugin_test_4.sh: New test case.
15506
15507 2009-01-07  Ian Lance Taylor  <iant@google.com>
15508
15509         * version.cc (version_string): Bump to 1.8.
15510
15511 2008-12-23  Cary Coutant  <ccoutant@google.com>
15512
15513         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
15514         * plugin.cc (Plugin_manager::finish): Rename as
15515         layout_deferred_objects.  Move cleanup to separate function.
15516         (Plugin_manager::cleanup): New function.
15517         (Plugin_finish::run): Call layout_deferred_objects and cleanup
15518         separately.
15519         * plugin.h (Plugin_manager::finish): Rename as
15520         layout_deferred_objects.
15521         (Plugin_manager::cleanup): New function.
15522         (Plugin_manager::cleanup_done): New field.
15523
15524 2008-12-23  Cary Coutant  <ccoutant@google.com>
15525
15526         * plugin.cc (is_visible_from_outside): New function.
15527         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
15528         so we don't return "IR only" status for exported symbols or -r links.
15529
15530         * testsuite/Makefile.am (plugin_test_3): New test case.
15531         * testsuite/Makefile.in: Regenerate.
15532         * testsuite/plugin_test_3.sh: New file.
15533
15534 2008-12-22  Cary Coutant  <ccoutant@google.com>
15535
15536         * object.cc (Sized_relobj::layout_section): New function.
15537         (Sized_relobj::do_layout): Defer layout of input sections until after
15538         plugin has provided replacement files.
15539         (Sized_relobj::do_layout_deferred_sections): New function.
15540         * object.h (Relobj::set_section_offset): Remove virtual keyword.
15541         (Relobj::layout_deferred_sections): New function.
15542         (Relobj::do_layout_deferred_sections): New function.
15543         (Sized_relobj::do_layout_deferred_sections): New function.
15544         (Sized_relobj::layout_section): New function.
15545         (Sized_relobj::Deferred_layout): New structure.
15546         (Sized_relobj::deferred_layout_): New field.
15547         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
15548         Change all callers.  Layout deferred sections.
15549         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
15550         references.
15551         (Plugin_hook::run): Move code from do_plugin_hook inline.
15552         (Plugin_hook::do_plugin_hook): Remove.
15553         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
15554         (Plugin_manager::finish): Renamed, was cleanup.
15555         (Plugin_manager::should_defer_layout): New function.
15556         (Plugin_manager::add_deferred_layout_object): New function.
15557         (Plugin_manager::Deferred_layout_list): New type.
15558         (Plugin_manager::deferred_layout_objects_): New field.
15559         (Plugin_hook::do_plugin_hook): Remove.
15560
15561 2008-12-17  Ian Lance Taylor  <iant@google.com>
15562
15563         * options.h (class General_options): Add --no case for
15564         --export-dynamic.
15565
15566 2008-12-16  Cary Coutant  <ccoutant@google.com>
15567
15568         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
15569         vector.
15570         (Plugin_manager::claim_file): Create plugin object even if
15571         plugin did not call the add_symbols callback.
15572         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
15573         asking for more symbols than were added.
15574         * testsuite/Makefile.am (plugin_test_1): Add test case with
15575         no global symbols.
15576         (empty.syms): New target.
15577         * testsuite/Makefile.in: Regenerate.
15578         * testsuite/plugin_test.c (claim_file_hook): Add new debug
15579         message. Don't call add_symbols if no globals.
15580         (all_symbols_read_hook): Don't provide replacement for empty
15581         claimed file.
15582
15583 2008-12-12  Ian Lance Taylor  <iant@google.com>
15584
15585         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
15586         r_type == 0 for a local symbol with r_sym == 0.
15587         (scan_relocatable_relocs): Pass r_sym to
15588         local_non_section_strategy.
15589         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
15590         r_sym parameter.
15591
15592         * configure.ac: Update test for TLS descriptors: they are
15593         supported as of glibc 2.9.
15594         * configure: Rebuild.
15595
15596 2008-12-11  Ian Lance Taylor  <iant@google.com>
15597
15598         PR 7091
15599         * target-reloc.h (Default_scan_relocatable_relocs): For each
15600         function, map r_type == 0 to RELOC_DISCARD.
15601
15602 2008-12-10  Cary Coutant  <ccoutant@google.com>
15603
15604         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
15605         object to override a kept COMDAT group from a plugin object.
15606
15607 2008-12-09  Ian Lance Taylor  <iant@google.com>
15608
15609         PR 7088
15610         * yyscript.y (file_cmd): Handle INPUT.
15611
15612         * testsuite/initpri1.c: Change all declarations to be full
15613         prototypes by adding void, to avoid compiler warnings.
15614
15615 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
15616
15617         * options.cc (General_options::parse_plugin_opt): New.
15618         (General_options::add_plugin): The argument now is just the filename.
15619         (General_options::add_plugin_option): New.
15620         * options.h (plugin_opt): New.
15621         (add_plugin): Change argument name.
15622         (add_plugin_option): New.
15623         * plugin.cc (Plugin::load): Don't parse the plugin option.
15624         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
15625         (Plugin::add_option): New.
15626         (Plugin::args_): Change type.
15627         (Plugin::filename_): New.
15628         (Plugin_manager::add_plugin_option): New.
15629         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
15630         * testsuite/Makefile.in: Regenerate.
15631
15632 2008-12-05  Cary Coutant  <ccoutant@google.com>
15633
15634         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
15635         Handle --strip-lto-sections option.
15636         * options.h (strip_lto_sections): New option.
15637
15638 2008-12-01  Cary Coutant  <ccoutant@google.com>
15639
15640         * plugin.cc (ld_plugin_message): Change format parameter to const.
15641         Fix mismatch between new[] and delete.
15642
15643 2008-11-14  Cary Coutant  <ccoutant@google.com>
15644
15645         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
15646         instead of -1U.
15647
15648 2008-11-05  Craig Silverstein  <csilvers@google.com>
15649
15650         * options.cc (General_options::parse_dynamic_list): New function.
15651         * options.h (General_options): New flags dynamic_list,
15652         dynamic_list_data, dynamic_list_cpp_new, and
15653         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
15654         (General_options::in_dynamic_list): New function.
15655         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
15656         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
15657         (Lex::can_continue_name): Likewise.
15658         (yylex): Likewise.
15659         (read_script_file): New parameter script_options.
15660         (read_dynamic_list): New function.
15661         (Script_options::define_dynamic_list): New function.
15662         (dynamic_list_keyword_parsecodes): New variable.
15663         (dynamic_list_keywords): New variable.
15664         * script.h (Script_options::define_dynamic_list): New function
15665         prototype.
15666         (read_dynamic_list): New function prototype.
15667         * symtab.cc (strprefix): New macro.
15668         (Symbol::should_add_dynsym_entry): Support dynamic_list,
15669         dynamic_list_data, dynamic_list_cpp_new, and
15670         dynamic_list_cpp_typeinfo.
15671         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
15672         (dynamic_list_expr): New rule.
15673         (dynamic_list_nodes): Likewise.
15674         (dynamic_list_node): Likewise.
15675         * testsuite/Makefile.am (dynamic_list): New test.
15676         * testsuite/Makefile.in: Regenerated.
15677         * testsuite/dynamic_list.t: New file.
15678         * testsuite/dynamic_list.sh: New file.
15679
15680 2008-11-05  Craig Silverstein  <csilvers@google.com>
15681
15682         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
15683         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
15684         (t11_last): Likewise.
15685         * testsuite/ver_test_6.c (main): Likewise.
15686
15687 2008-10-07  Cary Coutant  <ccoutant@google.com>
15688
15689         * options.c (General_options::finalize): Add check for -static and
15690         -shared.
15691         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
15692         is not empty.
15693
15694 2008-10-02  Cary Coutant  <ccoutant@google.com>
15695
15696         * plugin.cc (make_sized_plugin_object): Fix conditional
15697         compilation to work when not all targets are enabled.
15698
15699 2008-09-29  Cary Coutant  <ccoutant@google.com>
15700
15701         * archive.cc (Archive::get_file_and_offset): Use filename instead
15702         of name to get library path.
15703         (Archive::include_member): Unlock external member of a thin archive.
15704
15705         * testsuite/Makefile.am (TEST_AR): New variable.
15706         (thin_archive_test_1): New test.
15707         (thin_archive_test_2): New test.
15708         * testsuite/Makefile.in: Regenerate.
15709         * testsuite/thin_archive_main.cc: New file.
15710         * testsuite/thin_archive_test_1.cc: New file.
15711         * testsuite/thin_archive_test_2.cc: New file.
15712         * testsuite/thin_archive_test_3.cc: New file.
15713         * testsuite/thin_archive_test_4.cc: New file.
15714
15715 2008-09-29  Cary Coutant  <ccoutant@google.com>
15716
15717         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
15718         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
15719         instead of -1U.
15720         (Sized_relobj::do_finalize_local_symbols): Likewise.
15721         (Sized_relobj::map_to_kept_section): Likewise.
15722         * object.h (Sized_relobj::invalid_address): New constant.
15723         (Sized_relobj::do_output_section_offset): Check for invalid_address
15724         and return -1ULL.
15725         * output.cc (Output_reloc::local_section_offset): Use constant
15726         invalid_address instead of -1U.
15727         (Output_reloc::get_address): Likewise.
15728         (Output_section::output_address): Change -1U to -1ULL.
15729         * output.h (Output_reloc::invalid_address): New constant.
15730         * reloc.cc (Sized_relobj::write_sections): Use constant
15731         invalid_address instead of -1U.
15732         (Sized_relobj::relocate_sections): Likewise.
15733         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
15734         values for merge sections.
15735         * target-reloc.h (relocate_for_relocatable): Use constant
15736         invalid_address instead of -1U.
15737
15738 2008-09-19  Cary Coutant  <ccoutant@google.com>
15739
15740         Add plugin functionality for link-time optimization (LTO).
15741         * configure.ac (plugins): Add --enable-plugins option.
15742         * configure: Regenerate.
15743         * config.in: Regenerate.
15744         * Makefile.am (LIBDL): New variable.
15745         (CCFILES): Add plugin.cc.
15746         (HFILES): Add plugin.h.
15747         (ldadd_var): Add LIBDL.
15748         * Makefile.in: Regenerate.
15749
15750         * archive.cc: Include "plugin.h".
15751         (Archive::setup): Don't preread archive symbols when using a plugin.
15752         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
15753         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
15754         files.
15755         (Archive::include_member): Add symbols from plugin objects.
15756         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
15757         * descriptors.cc (Descriptors::open): Check for file descriptors
15758         abandoned by plugins.
15759         (Descriptors::claim_for_plugin): New function.
15760         * descriptors.h (Descriptors::claim_for_plugin): New function.
15761         (Open_descriptor::is_claimed): New field.
15762         (claim_descriptor_for_plugin): New function.
15763         * fileread.cc (File_read::claim_for_plugin): New function.
15764         * fileread.h (File_read::claim_for_plugin): New function.
15765         (File_read::descriptor): New function.
15766         * gold.cc: Include "plugin.h".
15767         (queue_initial_tasks): Add task to call plugin hooks for generating
15768         new object files.
15769         * main.cc: Include "plugin.h".
15770         (main): Load plugin libraries.
15771         * object.h (Pluginobj): Declare.
15772         (Object::pluginobj): New function.
15773         (Object::do_pluginobj): New function.
15774         (Object::set_target): New function.
15775         * options.cc: Include "plugin.h".
15776         (General_options::parse_plugin): New function.
15777         (General_options::General_options): Initialize plugins_ field.
15778         (General_options::add_plugin): New function.
15779         * options.h (Plugin_manager): Declare.
15780         (General_options): Add --plugin option.
15781         (General_options::has_plugins): New function.
15782         (General_options::plugins): New function.
15783         (General_options::add_plugin): New function.
15784         (General_options::plugins_): New field.
15785         * plugin.cc: New file.
15786         * plugin.h: New file.
15787         * readsyms.cc: Include "plugin.h".
15788         (Read_symbols::do_read_symbols): Check for archive before checking
15789         for ELF file.  Call plugin hooks to claim files.
15790         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
15791         from a real object file; force override when processing replacement
15792         files.
15793         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
15794         (Symbol::init_base_object): Likewise.
15795         (Symbol::init_base_output_data): Likewise.
15796         (Symbol::init_base_output_segment): Likewise.
15797         (Symbol::init_base_constant): Likewise.
15798         (Symbol::init_base_undefined): Likewise.
15799         (Symbol::output_section): Assert that object is not a plugin.
15800         (Symbol_table::add_from_pluginobj): New function.
15801         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15802         undefined.
15803         (Symbol_table::sized_write_globals): Likewise.
15804         (Symbol_table::add_from_pluginobj): Instantiate template.
15805         * symtab.h (Sized_pluginobj): Declare.
15806         (Symbol::in_real_elf): New function.
15807         (Symbol::set_in_real_elf): New function.
15808         (Symbol::in_real_elf_): New field.
15809         (Symbol_table::add_from_pluginobj): New function.
15810
15811         * testsuite/Makefile.am (AM_CFLAGS): New variable.
15812         (LIBDL): New variable.
15813         (LDADD): Add LIBDL.
15814         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
15815         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
15816         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
15817         (MOSTLYCLEANFILES): Likewise.
15818         * testsuite/Makefile.in: Regenerate.
15819         * testsuite/plugin_test.c: New file.
15820         * testsuite/plugin_test_1.sh: New file.
15821         * testsuite/plugin_test_2.sh: New file.
15822
15823 2008-09-16  Ian Lance Taylor  <iant@google.com>
15824
15825         * target-reloc.h (relocate_section): Check whether a symbol is
15826         defined by the ABI before reporting an undefined symbol error.
15827         * target.h (Target::is_defined_by_abi): Make parameter const.
15828         (Target::do_is_defined_by_abi): Likewise.
15829         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
15830         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
15831         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
15832         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
15833         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
15834         * testsuite/Makefile.in: Rebuild.
15835
15836         * fileread.cc (make_view): Add casts to avoid warning.
15837
15838 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15839
15840         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
15841         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15842
15843 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15844
15845         * options.h (General_options::output_is_executable): New.
15846         (General_options::output_is_pie): New.
15847         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
15848         for shared libraries.
15849         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15850
15851 2008-09-11  Chris Demetriou  <cgd@google.com>
15852
15853         * options.h (origin): New -z option.
15854         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
15855         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
15856         in DT_FLAGS_1.
15857
15858 2008-09-05  Cary Coutant  <ccoutant@google.com>
15859
15860         * fileread.cc (File_read::make_view): Add check for attempt to map
15861         beyond end of file.
15862
15863 2008-09-05  Cary Coutant  <ccoutant@google.com>
15864
15865         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
15866         explicit instantiations.
15867
15868 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
15869
15870         PR gold/6858
15871         * options.cc (General_options::finalize): Allow undefined symbols
15872         in shlibs if linking -shared.
15873
15874         PR gold/6859
15875         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
15876         symbols as not needing a dynsym entry.
15877
15878 2008-08-20  Craig Silverstein  <csilvers@google.com>
15879
15880         * fileread.cc (File_read::open): Do not lock the file unless it
15881         was successfully opened.
15882
15883 2008-08-14  Cary Coutant  <ccoutant@google.com>
15884
15885         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
15886         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
15887         * testsuite/tls_test.cc (struct int128): 128-bit struct
15888         for testing TLS relocs with non-zero addend.
15889         (v12): New TLS variable.
15890         (t12): New test.
15891         (t_last): Add check for v12.
15892         * testsuite/tls_test.h (t12): New function.
15893         * testsuite/tls_test_main.cc (thread_routine): Call new test.
15894
15895 2008-08-13  Ian Lance Taylor  <iant@google.com>
15896
15897         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
15898         set tls_segment_ or relro_segment_.
15899         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
15900         when appropriate.
15901         * output.h (Output_section::clear_is_relro): New function.
15902         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
15903         sections specially even when output_data_ is empty.
15904         (Output_segment::maximum_alignment): When first section is relro,
15905         only force alignment for PT_LOAD segments.
15906         * script.cc (script_data_segment_align): New function.
15907         (script_data_segment_relro_end): New function.
15908         * script-c.h (script_data_segment_align): Declare.
15909         (script_data_segment_relro_end): Declare.
15910         * script-sections.h (class Script_sections): Declare
15911         data_segment_align and data_segment_relro_end.  Add fields
15912         segment_align_index_ and saw_relro_end_.
15913         * script-sections.cc (class Sections_element): Add set_is_relro
15914         virtual function.  Add new bool* parameter to place_orphan_here.
15915         Add get_output_section virtual function.
15916         (class Output_section_definition): Add set_is_relro.  Add new
15917         bool* parameter to place_orphan_here.  Add get_output_section.
15918         Add is_relro_ field.
15919         (Output_section_definition::Output_section_definition): Initialize
15920         evaluated_address_, evaluated_load_address, evaluated_addralign_,
15921         and is_relro_ fields.
15922         (Output_section_definition::place_orphan_here): Add is_relro
15923         parameter.
15924         (Output_section_definition::set_section_addresses): Set relro for
15925         output section.
15926         (Output_section_definition::alternate_constraint): Likewise.
15927         (class Orphan_output_section): Add new bool* parameter to
15928         place_orphan_here.  Add get_output_section.
15929         (Orphan_output_section::place_orphan_here): Add is_relro
15930         parameter.
15931         (Script_sections::Script_sections): Initialize
15932         data_segment_align_index_ and saw_relro_end_.
15933         (Script_sections::data_segment_align): New function.
15934         (Script_sections::data_segment_relro_end): New function.
15935         (Script_sections::place_orphan): Set or clear is_relro.
15936         (Script_sections::set_section_addresses): Force alignment of first
15937         TLS section.
15938         * yyscript.y (exp): Call script_data_segment_align and
15939         script_data_segment_relro_end.
15940         * testsuite/relro_script_test.t: New file.
15941         * testsuite/relro_test.cc (using_script): Declare.
15942         (t1, t2): Test using_script.
15943         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
15944         (relro_script_test_SOURCES): Define.
15945         (relro_script_test_DEPENDENCIES): Define.
15946         (relro_script_test_LDFLAGS): Define.
15947         (relro_script_test_LDADD): Define.
15948         (relro_script_test.so): New target.
15949         * testsuite/Makefile.in: Rebuild.
15950
15951 2008-08-06  Cary Coutant <ccoutant@google.com>
15952
15953         * archive.cc (Archive::total_archives, Archive::total_members)
15954         (Archive::total_members_loaded): New variables.
15955         (Archive::setup): Add parameter.  Add option to preread
15956         archive symbols.
15957         (Archive::read_armap): Add counter.
15958         (Archive::get_file_and_offset): New function.
15959         (Archive::get_elf_object_for_member): New function.
15960         (Archive::read_all_symbols): New function.
15961         (Archive::read_symbols): New function.
15962         (Archive::add_symbols): Add counters.
15963         (Archive::include_all_members): Use armap to find members if it's
15964         already built.
15965         (Archive::include_member): Skip reading symbols if already read.
15966         Factored code into Archive::get_file_and_offset and
15967         Archive::get_elf_object_for_member.  Changed call to
15968         Mapfile::report_include_archive_member.
15969         (Archive::print_stats): New function.
15970         * archive.h: Declare Object and Read_symbols_data classes.
15971         (Archive::Archive): Add initializers for new members.
15972         (Archive::setup): Add parameter.
15973         (Archive::print_stats): New function.
15974         (Archive::total_archives, Archive::total_members)
15975         (Archive::total_members_loaded): New variables.
15976         (Archive::get_file_and_offset): New function.
15977         (Archive::get_elf_object_for_member): New function.
15978         (Archive::read_all_symbols): New function.
15979         (Archive::read_symbols): New function.
15980         (Archive::Archive_member): New class.
15981         (Archive::members_): New member.
15982         (Archive::num_members_): New member.
15983         * main.cc: Include archive.h.
15984         (main): Call Archive::print_stats.
15985         * mapfile.cc (Mapfile::report_include_archive_member): Delete
15986         archive parameter; member_name is now the fully-decorated name.
15987         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
15988         * options.h: (General_options): Add --preread-archive-symbols option.
15989         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
15990         Archive::setup.
15991
15992 2008-08-04  Ian Lance Taylor  <iant@google.com>
15993
15994         * symtab.h (Symbol::use_plt_offset): New function.
15995         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
15996         * powerpc.cc (Relocate::relocate): Likewise.
15997         * sparc.cc (Relocate::relocate): Likewise.
15998         * x86_64.cc (Relocate::relocate): Likewise.
15999         * testsuite/weak_plt.sh: New test.
16000         * testsuite/weak_plt_main.cc: New test.
16001         * testsuite/weak_plt_shared.cc: New test.
16002         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
16003         (check_PROGRAMS): Add weak_plt.
16004         (check_DATA): Add weak_plt_shared.so.
16005         (weak_plt_main_pic.o, weak_plt): New targets.
16006         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
16007         * testsuite/Makefile.in: Rebuild.
16008
16009         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
16010         gcctestdir/ld.
16011         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
16012         * testsuite/Makefile.in: Rebuild.
16013
16014 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
16015
16016         * Makefile.am (POTFILES.in): Set LC_ALL=C.
16017         * Makefile.in: Regenerate.
16018         * po/POTFILES.in: Regenerate.
16019
16020 2008-07-29  Ian Lance Taylor  <iant@google.com>
16021
16022         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
16023         symbols before other symbols.
16024         * testsuite/script_test_2.cc (test_addr): Declare.
16025         (test_addr_alias): Declare.
16026         (main): Check that test_addr and test_addr_alias have the right
16027         values.
16028         * testsuite/script_test_2.t: Define test_addr_alias and
16029         test_addr.
16030
16031 2008-07-24  Ian Lance Taylor  <iant@google.com>
16032
16033         PR 5990
16034         * descriptors.cc: New file.
16035         * descriptors.h: New file.
16036         * gold-threads.h (class Hold_optional_lock): New class.
16037         * fileread.cc: Include "descriptors.h".
16038         (File_read::~File_read): Release descriptor rather than closing
16039         it.
16040         (File_read::open) [file]: Call open_descriptor rather than open.
16041         Set is_descriptor_opened_.
16042         (File_read::open) [memory]: Assert that descriptor is not open.
16043         (File_read::reopen_descriptor): New function.
16044         (File_read::release): Release descriptor.
16045         (File_read::do_read): Make non-const.  Reopen descriptor.
16046         (File_read::read): Make non-const.
16047         (File_read::make_view): Reopen descriptor.
16048         (File_read::do_readv): Likewise.
16049         * fileread.h (class File_read): Add is_descriptor_opened_ field.
16050         Update declarations.
16051         * layout.cc: Include "descriptors.h".
16052         (Layout::create_build_id): Use open_descriptor rather than open.
16053         * output.cc: Include "descriptors.h".
16054         (Output_file::open): Use open_descriptor rather than open.
16055         * archive.cc (Archive::const_iterator): Change Archive to be
16056         non-const.
16057         (Archive::begin, Archive::end): Make non-const.
16058         (Archive::count_members): Likewise.
16059         * archive.h (class Archive): Update declarations.
16060         * object.h (Object::read): Make non-const.
16061         * Makefile.am (CCFILES): Add descriptors.cc.
16062         (HFILES): Add descriptors.h.
16063         * Makefile.in: Rebuild.
16064
16065         PR 6716
16066         * gold.h: Always include <clocale>.  Add Solaris workarounds
16067         following code in binutils/sysdep.h.
16068
16069         PR 6048
16070         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
16071         this->eh_frame_hdr_ is NULL before using it.
16072
16073         * dynobj.cc (Versions::Versions): Update comment.
16074
16075         * dynobj.cc (Versions::Versions): If there is an soname, use it as
16076         the base version name.
16077
16078         * stringpool.cc (Stringpool_template::add_with_length): Set key to
16079         array size plus one.
16080         (Stringpool_template::set_string_offsets): Subtract one from key
16081         before using it as an array index.
16082         (Stringpool_template::get_offset_with_length): Likewise.
16083         (Stringpool_template::write_to_buffer): Likewise.
16084         * stringpool.h (Stringpool_template::get_offset_from_key):
16085         Likewise.
16086
16087 2008-07-23  Ian Lance Taylor  <iant@google.com>
16088
16089         PR 6658
16090         * object.h (Merged_symbol_value::value): Do our best to handle a
16091         negative addend.
16092
16093         PR 6647
16094         * script.cc (Version_script_info::get_versions): Don't add empty
16095         version tag to return value.
16096         (Version_script_info::get_symbol_version_helper): Change return
16097         type to bool.  Add pversion parameter.  Change all callers.
16098         (script_register_vers_node): Don't require a non-NULL tag.
16099         * script.h (class Version_script_info): Update declarations.
16100         (Version_script_info::get_symbol_version): Change return type to
16101         bool.  Add version parameter.  Change all callers.
16102         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
16103         handling.  Handle an empty version from a version script.
16104         (Symbol_table::define_special_symbol): Likewise.
16105         * testsuite/ver_test_10.script: New file.
16106         * testsuite/ver_test_10.sh: New file.
16107         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
16108         (check_DATA): Add ver_test_10.syms.
16109         (ver_test_10.syms, ver_test_10.so): New target.
16110         * testsuite/Makefile.in: Rebuild.
16111
16112 2008-07-23  Simon Baldwin  <simonb@google.com>
16113
16114         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
16115         to zero for undefined symbols from dynamic libraries.
16116
16117 2008-07-23  Ian Lance Taylor  <iant@google.com>
16118
16119         * symtab.cc (Symbol_table::resolve): Remove version parameter.
16120         Change all callers.
16121         * symtab.h (class Symbol_table): Update declaration.
16122         * testsuite/ver_test_9.cc: New file.
16123         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
16124         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
16125         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
16126         (ver_test_9.so, ver_test_9.o): New targets.
16127         * testsuite/Makefile.in: Rebuild.
16128
16129 2008-07-22  Ian Lance Taylor  <iant@google.com>
16130
16131         * options.h (class General_options): Define --check-sections.
16132         * layout.cc (Layout::set_segment_offsets): Handle
16133         --check-sections.
16134
16135         * options.h (class General_options): Define -n/--nmagic and
16136         -N/--omagic.
16137         * options.cc (General_options::finalize): For -n/--nmagic or
16138         -N/--omagic, set -static.
16139         * layout.cc (Layout::attach_allocated_section_to_segment): If
16140         -N/--omagic, don't put read-only and read-write sections in
16141         different segments.
16142         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
16143         finding a read-only segment.
16144         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
16145         don't set the minimum segment alignment to the common page size,
16146         and don't set the file offset to the address modulo the page size.
16147         * script-sections.cc (Script_sections::create_segments): If
16148         -n/--omagic, don't put read-only and read-write sections in
16149         different segments.
16150
16151         * cref.cc: New file.
16152         * cref.h: New file.
16153         * options.h (class General_options): Add --print-symbol-counts.
16154         * main.cc (main): Issue defined symbol report if requested.
16155         * archive.cc (Archive::interpret_header): Make into a const member
16156         function.
16157         (Archive::add_symbols): Call Input_objects::archive_start and
16158         archive_stop.
16159         (Archive::const_iterator): Define new class.
16160         (Archive::begin, Archive::end): New functions.
16161         (Archive::include_all_members): Rewrite to use iterator.
16162         (Archive::count_members): New function.
16163         * archive.h (class Archive): Update declarations.
16164         (Archive::filename): New function.
16165         * object.cc: Include "cref.h".
16166         (Sized_relobj::Sized_relobj): Initialize defined_count_.
16167         (Sized_relobj::do_get_global_symbol_counts): New function.
16168         (Input_objects::add_object): Add object to cross-referencer.
16169         (Input_objects::archive_start): New function.
16170         (Input_objects::archive_stop): New function.
16171         (Input_objects::print_symbol_counts): New function.
16172         * object.h: Declare Cref and Archive.
16173         (Object::get_global_symbol_counts): New function.
16174         (Object::do_get_global_symbol_counts): New pure virtual function.
16175         (class Sized_relobj): Add defined_count_ field.  Update
16176         declarations.
16177         (class Input_objects): Add cref_ field.  Update constructor.
16178         Update declarations.
16179         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
16180         defined_count_.
16181         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
16182         symbol counts.
16183         (Sized_dynobj::do_get_global_symbol_counts): New function.
16184         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
16185         defined_count_.  Update declarations.  Define Symbols typedef.
16186         * symtab.cc (Symbol_table::add_from_relobj): Add defined
16187         parameter.  Change all callers.
16188         (Symbol_table::add_from_dynobj): Add sympointers and defined
16189         parameters.  Change all callers.
16190         * symtab.h (class Symbol_table): Update declarations.
16191         * Makefile.am (CCFILES): Add cref.cc.
16192         (HFILES): Add cref.h.
16193         * Makefile.in: Rebuild.
16194
16195 2008-07-22  Simon Baldwin  <simonb@google.com>
16196
16197         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
16198         to zero when writing undefined symbols.
16199
16200 2008-07-22  Ian Lance Taylor  <iant@google.com>
16201
16202         * output.cc (Output_section::add_input_section): Don't try to
16203         merge empty merge sections.
16204
16205 2008-07-21  Craig Silverstein  <csilvers@google.com>
16206
16207         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
16208         Include symbol version in error message.
16209
16210 2008-07-20  Chris Demetriou  <cgd@google.com>
16211
16212         * configure.ac (gold_cv_c_random_seed): New configured variable.
16213         (RANDOM_SEED_CFLAGS): New substituted variable.
16214         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
16215         * configure: Rebuild.
16216         * Makefile.in: Likewise.
16217         * testsuite/Makefile.in: Likewise.
16218
16219 2008-07-18  Ian Lance Taylor  <iant@google.com>
16220
16221         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
16222         where we see NAME/NULL and NAME/VERSION  as separate symbols.
16223         * testsuite/ver_test_main.cc (main): Call t4.
16224         (t4, t4_2a): Define.
16225         * testsuite/ver_test_2.cc (t4_2): Define.
16226         * testsuite/ver_test_2.script: Put t4_2a in VER2.
16227         * testsuite/ver_test_4.cc (t4_2a): Define.
16228         * testsuite/ver_test_4.script: Put t4_2a in VER2.
16229         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
16230
16231 2008-07-17  Ian Lance Taylor  <iant@google.com>
16232
16233         * dynobj.cc (Versions::add_def): If we give an error about a
16234         missing version, go ahead and create the version anyhow.
16235
16236 2008-07-10  Ian Lance Taylor  <iant@google.com>
16237
16238         Handle output sections with more than 0x7fffffff bytes.
16239         * object.h (class Relobj): Change map_to_output_ to
16240         output_sections_, and just keep a section pointer.  Change all
16241         uses.  Move comdat group support to Sized_relobj.
16242         (Relobj::is_section_specially_mapped): Remove.
16243         (Relobj::output_section): Remove poff parameter.  Change all
16244         callers.
16245         (Relobj::output_section_offset): New function.
16246         (Relobj::set_section_offset): Rewrite.
16247         (Relobj::map_to_output): Remove.
16248         (Relobj::output_sections): New function.
16249         (Relobj::do_output_section_offset): New pure virtual function.
16250         (Relobj::do_set_section_offset): Likewise.
16251         (class Sized_relobj): Add section_offsets_ field.  Add comdat
16252         group support from Relobj.  Update declarations.
16253         (Sized_relobj::get_output_section_offset): New function.
16254         (Sized_relobj::do_output_section_offset): New function.
16255         (Sized_relobj::do_set_section_offset): New function.
16256         * object.cc (Relobj::output_section_address): Remove.
16257         (Sized_relobj::Sized_relobj): Initialize new fields.
16258         (Sized_relobj::include_section_group): Cast find_kept_object to
16259         Sized_relobj.
16260         (Sized_relobj::include_linkonce_section): Likewise.
16261         (Sized_relobj::do_layout): Use separate arrays for output section
16262         and output offset.
16263         (Sized_relobj::do_count_local_symbols): Change map_to_output to
16264         output_sections.
16265         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
16266         output_sections and section_offsets.
16267         (Sized_relobj::write_local_symbols): Likewise.
16268         (map_to_kept_section): Compute output address directly.
16269         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
16270         output_sections and section_offsets.
16271         (Sized_relobj::write_sections): Likewise.
16272         (Sized_relobj::relocate_sections): Likewise.
16273         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
16274         * output.h (class Output_reloc): Update declarations.  Change
16275         u2_.relobj to Sized_relobj*.
16276         (class Output_data_reloc): Change add functions to use
16277         Sized_relobj*.
16278         * output.cc (Output_reloc::Output_reloc): Change relobj to
16279         Sized_relobj*.
16280         (Output_reloc::local_section_offset): Change return type to
16281         Elf_Addr.  Use get_output_section_offset.
16282         (Output_reloc::get_address): Likewise.
16283         (Output_section::is_input_address_mapped): Don't call
16284         is_section_specially_mapped.
16285         (Output_section::output_offset): Likewise.
16286         (Output_section::output_address): Likewise.
16287         (Output_section::starting_output_address): Likewise.
16288         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
16289         parameter to Sized_relobj*.
16290         (Copy_relocs::need_copy_reloc): Likewise.
16291         (Copy_relocs::save): Likewise.
16292         * copy-relocs.h (class Copy_relocs): Update declarations.
16293         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
16294         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
16295         * target-reloc.h (relocate_for_relocatable): Change
16296         offset_in_output_section type to Elf_Addr.  Change code that uses
16297         it as well.
16298         * layout.cc (Layout::layout): Always set *off.
16299         * mapfile.cc (Mapfile::print_input_section): Use
16300         output_section_offset.
16301         * i386.cc (Target_i386::copy_reloc): Change object parameter to
16302         Sized_relobj*.
16303         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
16304         * sparc.cc (Target_sparc::copy_reloc): Likewise.
16305         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
16306
16307 2008-07-03  Ian Lance Taylor  <iant@google.com>
16308
16309         * layout.cc (Layout::include_section): Do not discard unrecognized
16310         SHT_STRTAB sections.
16311
16312 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
16313
16314         * script.cc (Lex::can_continue_name): Make '?' allowable in
16315         version-script names.
16316         * testsuite/version_script.map: Change glob pattern to use '?'
16317
16318 2008-06-30  Manish Singh  <yosh@gimp.org>
16319
16320         PR 6585
16321         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
16322         Correct typo.
16323
16324 2008-06-30  Ian Lance Taylor  <iant@google.com>
16325
16326         PR 6660
16327         PR 6682
16328         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
16329         versions]: Don't try to read the value in the contents, since we
16330         don't use it.  Use the template endianness when writing.
16331
16332 2008-06-25  Cary Coutant  <ccoutant@google.com>
16333
16334         * fileread.cc (File_read::make_view): Assert on zero-length view.
16335         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
16336         symbol table when there are no symbols to read.
16337
16338 2008-06-23  Craig Silverstein  <csilvers@google.com>
16339
16340         * version.cc (version_string): Bump to 1.7
16341
16342 2008-06-18  Craig Silverstein  <csilvers@google.com>
16343
16344         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
16345         constant 0xFFFF to type Valtype.
16346         (Powerpc_relocate_functions::rel16_ha): Likewise.
16347
16348 2008-06-17  Ian Lance Taylor  <iant@google.com>
16349
16350         * output.h (Output_section::Input_section): Initialize p2align_ to
16351         zero for Output_section_data constructors.
16352         (Output_section::Input_section::addralign): If not an input
16353         section, return the alignment of the Output_section_data.
16354         * testsuite/copy_test.cc: New file.
16355         * testsuite/copy_test_1.cc: New file.
16356         * testsuite/copy_test_2.cc: New file.
16357         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
16358         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
16359         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
16360         (copy_test_1_pic.o, copy_test_1.so): New targets.
16361         (copy_test_2_pic.o, copy_test_2.so): New targets.
16362         * testsuite/Makefile.in: Rebuild.
16363
16364         * script-sections.cc (Script_sections::place_orphan): Initialize
16365         local variable exact.
16366
16367 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
16368
16369         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
16370
16371 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
16372             David S. Miller  <davem@davemloft.net>
16373
16374         * powerpc.cc: New file.
16375         * Makefile.am (TARGETSOURCES): Add powerpc.cc
16376         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
16377         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
16378         * Makefile.in: Rebuild.
16379
16380 2008-06-09  Ian Lance Taylor  <iant@google.com>
16381
16382         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
16383         <exception>.
16384         (throwing, orig_terminate): New static variables.
16385         (terminate_handler): New static function.
16386         (t2): Set terminate handler.
16387
16388 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
16389
16390         PR 6584
16391         * binary.cc (Binary_to_elf::sized_convert): Fix .data
16392         alignment.
16393
16394 2008-05-30  Cary Coutant  <ccoutant@google.com>
16395
16396         * archive.cc (Archive::include_all_members) Correct to step
16397         over symbol table and extended name table in thin archives.
16398
16399 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
16400
16401         PR 6407
16402         * target-reloc.h (relocate_for_relocatable): Fix new_offset
16403         calculation.
16404
16405 2008-05-28  Caleb Howe  <cshowe@google.com>
16406
16407         * reduced_debug_output.cc: New file.
16408         * reduced_debug_output.h: New file.
16409         * options.h (class General_options): Add --strip-debug-non-line.
16410         * options.cc (General_options::finalize): Add strip_debug_non_line
16411         to the strip heirarchy.
16412         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
16413         fields.
16414         * layout.cc: Include "reduced_debug_output.h".
16415         (Layout::Layout): Initialize new fields.
16416         (line_only_debug_sections): New static array.
16417         (is_lines_only_debug_sections): New static inline function.
16418         (Layout::include_section): Handle --strip-debug-non-line.
16419         (Layout::make_output_section): If --strip-debug-non-line, build
16420         new output sections for .debug_abbrev and .debug_info.
16421         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
16422         gold.  Warn about possible overflow.
16423         (read_signed_LEB_128): Likewise.
16424         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
16425         (read_signed_LEB_128): Declare.
16426         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
16427         (HFILES): Add reduced_debug_output.h.
16428         * Makefile.in: Rebuild.
16429
16430 2008-05-21  Ian Lance Taylor  <iant@google.com>
16431
16432         * mapfile.cc: New file.
16433         * mapfile.h: New file.
16434         * options.h (class General_options): Add -M/--print-map and -Map.
16435         * options.cc (General_options::finalize): Make -M equivalent to
16436         -Map -.
16437         * main.cc: Include <cstdio> and "mapfile.h".
16438         (main): Open mapfile if requested.
16439         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
16440         constructor.  Change caller.
16441         (queue_initial_tasks): Add mapfile parameter.  Change caller.
16442         (queue_middle_tasks): Likewise.
16443         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
16444         declarations.
16445         * archive.cc: Include "mapfile.h".
16446         (Archive::add_symbols): Add mapfile parameter.  Change all
16447         callers.  Pass mapfile, symbol, and reason to include_member.
16448         (Archive::include_all_members): Add mapfile parameter.  Change all
16449         callers.
16450         (Archive::include_member): Add mapfile, sym, and why parameters.
16451         Change all callers.  Report inclusion to map file.
16452         * archive.h: Include "fileread.h".
16453         (class Archive): Update declarations.
16454         (Archive::file): New const method.
16455         (class Add_archive_symbols): Add mapfile_ field.  Update
16456         constructor.  Change all callers.
16457         * readsyms.h (class Read_symbols): Likewise.
16458         (class Finish_group): Likewise.
16459         (class Read_script): Likewise.
16460         * common.cc: Include "mapfile.h".
16461         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
16462         all callers.
16463         (Symbol_table::do_allocate_commons): Likewise.
16464         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
16465         symbol allocation to mapfile.
16466         * common.h (class Allocate_commons_task): Add mapfile_ field.
16467         Update constructor.  Change all callers.
16468         * symtab.h (class Symbol_table): Update declarations.
16469         * layout.cc: Include "mapfile.h".
16470         (Layout_task_runner::run): Print information to mapfile.
16471         (Layout::create_gold_note): Change Output_data_fixed_space to
16472         Output_data_zero_fill.
16473         (Layout::create_build_id): Likewise.
16474         (Layout::print_to_mapfile): New function.
16475         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
16476         constructor.  Change caller.
16477         (class Layout): Declare print_to_mapfile.
16478         * output.cc (Output_section::Input_section::print_to_mapfile): New
16479         function.
16480         (Output_section::add_input_section): If producing a map, always
16481         add to input_sections_ list.
16482         (Output_section::do_print_to_mapfile): New function.
16483         (Output_segment::print_sections_to_mapfile): New function.
16484         (Output_segment::print_section_list_to_mapfile): New function.
16485         * output.h: Include "mapfile.h".
16486         (Output_data::print_to_mapfile): New function.
16487         (Output_data::do_print_to_mapfile): New virtual function.
16488         (Output_segment_headers::do_print_to_mapfile): New function.
16489         (Output_file_header::do_print_to_mapfile): New function.
16490         (Output_data_const::do_print_to_mapfile): New function.
16491         (class Output_data_const_buffer): Add map_name_ field.  Update
16492         constructor.  Change all callers.  Add do_print_to_mapfile
16493         function.
16494         (class Output_data_fixed_space): Likewise.
16495         (class Output_data_space): Likewise.
16496         (class Output_data_zero_fill): New class.
16497         (Output_data_strtab::do_print_to_mapfile): New function.
16498         (Output_data_reloc_base::do_print_to_mapfile): New function.
16499         (Output_relocatable_relocs::do_print_to_mapfile): New function.
16500         (Output_data_group::do_print_to_mapfile): New function.
16501         (Output_data_got::do_print_to_mapfile): New function.
16502         (Output_data_dynamic::do_print_to_mapfile): New function.
16503         (Output_symtab_xindex::do_print_to_mapfile): New function.
16504         (class Output_section): Declare do_print_to_mapflie.  Declare
16505         print_to_mapfile in Input_section.
16506         (class Output_segment): Declare new functions.
16507         * object.h (Sized_relobj::symbol_count): New function.
16508         * script-sections.cc
16509         (Output_section_element_dot_assignment::set_section_addresses):
16510         Change Output_data_fixed_space to Output_data_zero_fill.
16511         (Output_data_expression::do_print_to_mapfile): New function.
16512         * script.cc (read_input_script): Add mapfile parameter.  Change
16513         all callers.
16514         * script.h (read_input_script): Update declaration.
16515         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
16516         (Eh_frame::do_print_to_mapfile): New function.
16517         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
16518         (Output_merge_string::do_print_to_mapfile): New function.
16519         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
16520         function.
16521         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
16522         function.
16523         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
16524         function.
16525         * Makefile.am (CCFILES): Add mapfile.cc.
16526         (HFILES): Add mapfile.h.
16527         * Makefile.in: Rebuild.
16528
16529 2008-05-19  Ian Lance Taylor  <iant@google.com>
16530
16531         * options.h (class General_options): Add -z relro.
16532         * layout.cc (Layout::Layout): Initialize relro_segment_.
16533         (Layout::add_output_section_data): Return the output section.
16534         (Layout::make_output_section): Rcognize relro sections and mark
16535         them appropriately.
16536         (Layout::attach_allocated_section_to_segment): Put relro sections
16537         in a PT_GNU_RELRO segment.
16538         (Layout::create_initial_dynamic_sections): Mark the .dynamic
16539         section as relro.
16540         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
16541         PT_TLS segments.
16542         (Layout::linkonce_mapping): Map d.rel.ro.local to
16543         .data.rel.ro.local.
16544         (Layout::output_section_name): Us .data.rel.ro.local for any
16545         section which begins with that.
16546         * layout.h (class Layout): Update add_output_section_data
16547         declaration.  Add relro_segment_ field.
16548         * output.cc (Output_section::Output_section): Initialize is_relro_
16549         and is_relro_local_ fields.
16550         (Output_segment::add_output_section): Group relro sections.
16551         (Output_segment::is_first_section_relro): New function.
16552         (Output_segment::maximum_alignment): If there is a relro section,
16553         align the segment to the common page size.
16554         (Output_segment::set_section_addresses): Track whether we are
16555         looking at relro sections.  If the last section is a relro
16556         section, align to the common page size.
16557         (Output_segment::set_section_list_addresses): Add in_relro
16558         parameter.  Change all callers.  Align to the page size when
16559         moving from relro to non-relro section.
16560         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
16561         segment.
16562         * output.h (class Output_section): Add is_relro_ and
16563         is_relro_local_ fields.
16564         (Output_section::is_relro): New function.
16565         (Output_section::set_is_relro): New function.
16566         (Output_section::is_relro_local): New function.
16567         (Output_section::set_is_relro_local): New function.
16568         (class Output_segment): Update declarations.
16569         * i386.cc (Target_i386::got_section): Mark .got section as relro.
16570         * sparc.cc (Target_sparc::got_section): Likewise.
16571         * x86_64.cc (Target_x86_64::got_section): Likewise.
16572         * testsuite/relro_test_main.cc: New file.
16573         * testsuite/relro_test.cc: New file.
16574         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
16575         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
16576         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
16577         (relro_test.so, relro_test_pic.o): New targets.
16578         * testsuite/Makefile.in: Rebuild.
16579
16580 2008-05-16  Ian Lance Taylor  <iant@google.com>
16581
16582         * output.cc (Output_segment::add_output_section): Remove front
16583         parameter.
16584         * output.h (class Output_segment): Remove
16585         add_initial_output_section and overloaded add_output_section.
16586         Update declaration of remaining add_output_section.
16587         * layout.cc (Layout::create_interp): Call add_output_section
16588         rather than add_initial_output_section.
16589         (Layout::finish_dynamic_section): Likewise.
16590
16591         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
16592         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
16593         know the dynamic type.
16594         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
16595         field.  Initialize it in constructor.
16596         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
16597         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
16598         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
16599         reloc.
16600
16601         * output.cc (Output_reloc::get_address): Change return type to
16602         Elf_Addr.
16603         * output.h (class Output_reloc): Update get_address declaration.
16604         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
16605         for section addresses.
16606
16607 2008-05-09  Ian Lance Taylor  <iant@google.com>
16608
16609         PR 6493
16610         * gold.cc (gold_nomem): Use return value of write.
16611
16612 2008-05-08  Ian Lance Taylor  <iant@google.com>
16613
16614         * symtab.c (Symbol::init_base_output_data): Add version
16615         parameter.  Change all callers.
16616         (Symbol::init_base_output_segment): Likewise.
16617         (Symbol::init_base_constant): Likewise.
16618         (Symbol::init_base_undefined): Likewise.
16619         (Sized_symbol::init_output_data): Likewise.
16620         (Sized_symbol::init_output_segment): Likewise.
16621         (Sized_symbol::init_constant): Likewise.
16622         (Sized_symbol::init_undefined): Likewise.
16623         (Symbol_table::do_define_in_output_data): If the new symbol has a
16624         version, mark it as the default.
16625         (Symbol_table::do_define_in_output_segment): Likewise.
16626         (Symbol_table::do_define_as_constant): Likewise.
16627         * symtab.h (class Symbol): Update declarations.
16628         (class Sized_symbol): Likewise.
16629         * resolve.cc (Symbol::override_version): New function.
16630         (Symbol::override_base): Call override_version.
16631         (Symbol::override_base_with_special): Likewise.
16632         * testsuite/ver_script_8.script: New file.
16633         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
16634         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
16635         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
16636         (ver_test_8_1.so, ver_test_8_2.so): New targets.
16637
16638 2008-05-06  Ian Lance Taylor  <iant@google.com>
16639
16640         PR 6049
16641         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
16642         functions.
16643         (class General_options): Remove existing --undefined, and add
16644         --no-undefined instead.  Add new --undefined as synonym for -u.
16645         * archive.cc (Archive::add_symbols): Check whether symbol was
16646         named with -u.
16647         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
16648         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
16649         all uses.  Add IS_UNDEFINED.  Update declarations to split
16650         different versions of init_base.  Declare init_base_undefined.
16651         (Symbol::is_defined): Handle IS_UNDEFINED.
16652         (Symbol::is_undefined): Likewise.
16653         (Symbol::is_weak_undefined): Call is_undefined.
16654         (Symbol::is_absolute): Handle IS_CONSTANT.
16655         (class Sized_symbol): Update declarations to split different
16656         versions of init.  Declare init_undefined.
16657         (class Symbol_table): Declare new functions.
16658         * symtab.cc (Symbol::init_base_object): Rename from init_base.
16659         Change all callers.
16660         (Symbol::init_base_output_data): Likewise.
16661         (Symbol::init_base_output_segment): Likewise.
16662         (Symbol::init_base_constant): Likewise.
16663         (Symbol::init_base_undefined): New function.
16664         (Sized_symbol::init_object): Rename from init.  Change all
16665         callers.
16666         (Sized_symbol::init_output_data): Likewise.
16667         (Sized_symbol::init_output_segment): Likewise.
16668         (Sized_symbol::init_constant): Likewise.
16669         (Sized_symbol::init_undefined): New function.
16670         (Symbol_table::add_undefined_symbols_from_command_line): New
16671         function.
16672         (Symbol_table::do_add_undefined_symbols_from_command_line): New
16673         function.
16674         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
16675         (Symbol::output_section): Likewise.
16676         (Symbol::set_output_section): Likewise.
16677         (Symbol_table::sized_finalize_symbol): Likewise.
16678         (Symbol_table::sized_write_globals): Likewise.
16679         * resolve.cc (Symbol_table::should_override): Likewise.
16680         (Symbol::override_base_with_special): Likewise.
16681
16682         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
16683         symbol, change it to have default visibility.
16684         * testsuite/protected_1.cc: New file.
16685         * testsuite/protected_2.cc: New file.
16686         * testsuite/protected_3.cc: New file.
16687         * testsuite/protected_main_1.cc: New file.
16688         * testsuite/protected_main_2.cc: New file.
16689         * testsuite/protected_main_3.cc: New file.
16690         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
16691         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
16692         (protected_1_LDFLAGS, protected_1_LDADD): Define.
16693         (protected_1.so): New target.
16694         (protected_1_pic.o, protected_2_pic.o): New targets.
16695         (protected_3_pic.o): New target.
16696         (check_PROGRAMS): Add protected_2.
16697         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
16698         (protected_2_LDFLAGS, protected_2_LDADD): Define.
16699         * testsuite/Makefile.in: Rebuild.
16700
16701         * options.h (DEFINE_var): Add set_user_set_##varname__.
16702         (DEFINE_bool_alias): New macro.
16703         (class General_options): Define -Bstatic using DEFINE_bool_alias
16704         rather than DEFINE_special.  Add --undefined as an alias for -z
16705         defs.
16706         * options.cc (General_options::parse_Bstatic): Remove.
16707
16708         * options.h (class General_options): Add --fatal-warnings.
16709         * main.cc (main): Implement --fatal-warnings.
16710         * errors.h (Errors::warning_count): New function.
16711
16712         * options.h (class General_options): Add -Bsymbolic-functions.
16713         * symtab.h (Symbol::is_preemptible): Check for
16714         -Bsymbolic-functions.
16715
16716 2008-05-05  Ian Lance Taylor  <iant@google.com>
16717
16718         * options.h (DEFINE_bool): For DASH_Z, create the negative option
16719         as noVARNAME rather than no-VARNAME.
16720         (class General_options): Add option -z combreloc.
16721         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
16722         get_address.
16723         (Output_reloc::sort_before) [SHT_REL]: New function.
16724         (Output_reloc::sort_before) [SHT_RELA]: New function.
16725         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
16726         Sort_relocs_comparison.
16727         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
16728         parameter.  Change all callers.
16729         (Output_data_reloc::Output_data_reloc) [both versions]: Add
16730         sort_relocs parameter.  Change all callers.
16731         * output.cc (Output_reloc::get_address): New function, broken out
16732         of write_rel.
16733         (Output_reloc::write_rel): Call it.
16734         (Output_reloc::compare): New function.
16735         (Output_data_reloc_base::do_write): Optionally sort relocs.
16736
16737         * configure.ac: If targ_extra_obj is set, link it in.
16738         * configure.tgt: Initialize all variables.
16739         (x86_64*): Set targ_extra_obj and targ_extra_size.
16740         * configure: Rebuild.
16741
16742         * object.cc (Sized_relobj::include_section_group): Adjust section
16743         indexes read from group data.  Build vector to pass to
16744         layout_group.
16745         * layout.cc (Layout::layout_group): Add flags and shndxes
16746         parameters.  Remove contents parameter.  Change caller.  Update
16747         explicit instantiations.
16748         * layout.h (class Layout): Update layout_group declaration.
16749         * output.cc (Output_data_group::Output_data_group): Add flags and
16750         input_shndxes parameters.  Remove contents parameter.  Change
16751         caller.
16752         (Output_data_group::do_write): Change input_sections_ to
16753         input_shndxes_.
16754         * output.h (class Output_data_group): Update constructor
16755         declaration.  Rename input_sections_ to input_shndxes_.
16756         * testsuite/many_sections_test.cc: Add template.
16757
16758 2008-04-30  Cary Coutant  <ccoutant@google.com>
16759
16760         * target-reloc.h (relocate_section): Fix dead-pointer bug.
16761
16762         * layout.cc (Layout::include_section): Refactored check for debug
16763         info section.
16764         (Layout::add_comdat): Add new parameters.  Change type
16765         of signature parameter.  Add object and shndx to signatures table.
16766         (Layout::find_kept_object): New function.
16767         * layout.h: Include <cstring>.
16768         (Layout::is_debug_info_section): New function.
16769         (Layout::add_comdat): Add new parameters.
16770         (Layout::find_kept_object): New function.
16771         (Layout::Kept_section): New struct.
16772         (Layout::Signatures): Change type of map range.
16773         * object.cc (Relobj::output_section_address): New function.
16774         (Sized_relobj::include_section_group): Add new parameters.  Change
16775         calls to Layout::add_comdat.  Change to build table of kept comdat
16776         groups and table mapping discarded sections to kept sections.
16777         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
16778         (Sized_relobj::do_layout): Change calls to include_section_group and
16779         include_linkonce_section.
16780         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
16781         value to zero when section is discarded.
16782         (Sized_relobj::map_to_kept_section): New function.
16783         * object.h (Relobj::output_section_address): New function.
16784         (Relobj::Comdat_group): New type.
16785         (Relobj::find_comdat_group): New function.
16786         (Relobj::Comdat_group_table): New type.
16787         (Relobj::Kept_comdat_section): New type.
16788         (Relobj::Kept_comdat_section_table): New type.
16789         (Relobj::add_comdat_group): New function.
16790         (Relobj::set_kept_comdat_section): New function.
16791         (Relobj::get_kept_comdat_section): New function.
16792         (Relobj::comdat_groups_): New field.
16793         (Relobj::kept_comdat_sections_): New field.
16794         (Symbol_value::input_value): Update comment.
16795         (Sized_relobj::map_to_kept_section) New function.
16796         (Sized_relobj::include_linkonce_section): Add new parameter.
16797         * target-reloc.h (Comdat_behavior): New type.
16798         (get_comdat_behavior): New function.
16799         (relocate_section): Add code to map a discarded section to the
16800         corresponding kept section when applying a relocation.
16801
16802 2008-04-30  Craig Silverstein  <csilvers@google.com>
16803
16804         * dwarf_reader.cc (next_generation_count): New static var.
16805         (Addr2line_cache_entry): New struct.
16806         (addr2line_cache): New static var.
16807         (Dwarf_line_info::one_addr2line): Added caching.
16808         (Dwarf_line_info::clear_addr2line_cache): New function.
16809         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
16810         cache-size parameter.
16811         (Dwarf_line_info::one_addr2line_cache): New function.
16812         * symtab.cc (Symbol_table::detect_odr_violations): Pass
16813         new cache-size argument to one_addr2line(), and clear cache.
16814
16815 2008-04-28  Cary Coutant  <ccoutant@google.com>
16816
16817         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
16818         R_386_PC8 relocations.
16819
16820 2008-04-23  Ian Lance Taylor  <iant@google.com>
16821
16822         * object.cc (Sized_relobj::include_section_group): Check for
16823         invalid section group.
16824
16825         * object.cc (make_elf_object): Correct test for 64-bit ELF file
16826         header size.
16827
16828         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
16829         than read for file header.
16830         * archive.cc (Archive::include_member): Likewise.
16831
16832 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
16833
16834         * aclocal.m4: Regenerate.
16835         * configure: Regenerate.
16836
16837 2008-04-19  Ian Lance Taylor  <iant@google.com>
16838
16839         * version.cc (version_string): Bump to 1.6.
16840
16841         * testsuite/Makefile.am (many_sections_r_test): New target.
16842         (many_sections_r_test_SOURCES): Remove.
16843         (many_sections_r_test_DEPENDENCIES): Remove.
16844         (many_sections_r_test_LDFLAGS): Remove.
16845         (many_sections_r_test_LDADD): Remove.
16846
16847         * object.cc (Sized_relobj::do_add_symbols): Always pass
16848         local_symbol_count_ to add_from_relobj.
16849
16850         * testsuite/Makefile.am (many_sections_check.h): Only check one in
16851         every thousand variables.
16852         * testsuite/Makefile.in: Rebuild.
16853
16854         * object.cc (Xindex::initialize_symtab_xindex): New function.
16855         (Xindex::read_symtab_xindex): New function.
16856         (Xindex::sym_xindex_to_shndx): New function.
16857         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
16858         available.
16859         (Sized_relobj::do_initialize_xindex): New function.
16860         (Sized_relobj::do_read_symbols): Adjust section links.
16861         (Sized_relobj::symbol_section_and_value): Add is_ordinary
16862         parameter.  Change all callers.
16863         (Sized_relobj::include_section_group): Adjust section links and
16864         symbol section indexes.
16865         (Sized_relobj::do_layout): Adjust section links.
16866         (Sized_relobj::do_count_local_symbols): Adjust section links and
16867         symbol section indexes.
16868         (Sized_relobj::do_finalize_local_symbols): Distinguish between
16869         ordinary and special symbols.
16870         (Sized_relobj::write_local_symbols): Add symtab_xindex and
16871         dynsym_xindex parameters.  Change all callers.  Adjust section
16872         links.  Use SHN_XINDEX when needed.
16873         (Sized_relobj::get_symbol_location_info): Adjust section links.
16874         Don't get fooled by special symbols.
16875         * object.h (class Xindex): Define.
16876         (class Object): Add xindex_ parameter.  Declare virtual functoin
16877         do_initialize_xindex.
16878         (Object::adjust_sym_shndx): New function.
16879         (Object::set_xindex): New protected function.
16880         (class Symbol_value): Add is_ordinary_shndx_ field.
16881         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
16882         (Symbol_value::value): Assert ordinary section.
16883         (Symbol_value::initialize_input_to_output_map): Likewise.
16884         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
16885         Change all callers.
16886         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
16887         all callers.
16888         (class Sized_relobj): Update declarations.
16889         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
16890         parameter.  Change all callers.
16891         (Sized_relobj::adjust_shndx): New function.
16892         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
16893         field.
16894         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
16895         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
16896         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
16897         (Sized_dynobj::read_dynsym_section): Adjust section links.
16898         (Sized_dynobj::read_dynamic): Likewise.
16899         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
16900         section links.
16901         (Sized_dynobj::do_initialize_xindex): New function.
16902         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
16903         do_initialize_xindex.
16904         (Sized_dynobj::adjust_shndx): New function.
16905         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
16906         dynsym_xindex_ fields.
16907         (Layout::finalize): Add a call to set_section_indexes before
16908         creating the symtab sections.
16909         (Layout::set_section_indexes): Don't do anything if the section
16910         already has a section index.
16911         (Layout::create_symtab_sections): Add shnum parameter.  Change
16912         caller.  Create .symtab_shndx section if needed.
16913         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
16914         caller.
16915         (Layout::allocated_output_section_count): New function.
16916         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
16917         needed.
16918         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
16919         fields.  Update declarations.
16920         (Layout::symtab_xindex): New function.
16921         (Layout::dynsym_xindex): New function.
16922         (class Write_symbols_task): Add layout_ field.
16923         (Write_symbols_task::Write_symbols_task): Add layout parameter.
16924         Change caller.
16925         * output.cc (Output_section_headers::Output_section_headers): Add
16926         shstrtab_section parameter.  Change all callers.
16927         (Output_section_headers::do_sized_write): Store overflow values
16928         for section count and section string table section index in
16929         section header zero.
16930         (Output_file_header::do_sized_write): Check for overflow of
16931         section count and section string table section index.
16932         (Output_symtab_xindex::do_write): New function.
16933         (Output_symtab_xindex::endian_do_write): New function.
16934         * output.h (class Output_section_headers): Add shstrtab_section_.
16935         Update declarations.
16936         (class Output_symtab_xindex): Define.
16937         (Output_section::has_out_shndx): New function.
16938         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
16939         field.
16940         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
16941         Change all callers.
16942         (Sized_symbol::init): Likewise.
16943         (Symbol::output_section): Check for ordinary symbol.
16944         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
16945         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
16946         callers.
16947         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
16948         Change all callers.  Simplify handling of symbols from sections
16949         not included in the link.
16950         (Symbol_table::add_from_dynobj): Handle ordinary symbol
16951         distinction.
16952         (Weak_alias_sorter::operator()): Assert that symbols are
16953         ordinary.
16954         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
16955         distinction.
16956         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
16957         parameters.  Change all callers.
16958         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
16959         symbol distinction.  Use SHN_XINDEX when needed.
16960         (Symbol_table::write_section_symbol): Add symtab_xindex
16961         parameter.  Change all callers.
16962         (Symbol_table::sized_write_section_symbol): Likewise.  Use
16963         SHN_XINDEX when needed.
16964         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
16965         declarations.
16966         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
16967         (Symbol::is_defined): Check is_ordinary.
16968         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
16969         (Symbol::is_absolute, Symbol::is_common): Likewise.
16970         (class Sized_symbol): Update declarations.
16971         (class Symbol_table): Update declarations.
16972         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
16973         parameters.  Change all callers.
16974         (Sized_symbol::override): Likewise.
16975         (Symbol_table::override): Likewise.
16976         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
16977         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
16978         is_ordinary, and orig_st_shndx parameters.  Change all callers.
16979         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
16980         to be in an ordinary section.
16981         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
16982         object and is_ordinary parameters.  Change all callers.
16983         (Sized_dwarf_line_info::read_relocs): Add object parameter.
16984         Change all callers.  Don't add undefined or non-ordinary symbols
16985         to reloc_map_.
16986         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
16987         Change all callers.
16988         * dwarf_reader.h (class Sized_dwarf_line_info): Update
16989         declarations.
16990         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
16991         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
16992         (Sized_relobj::relocate_sections): Likewise.
16993         * target-reloc.h (scan_relocs): Adjust section symbol index.
16994         (scan_relocatable_relocs): Likewise.
16995         * i386.cc (Scan::local): Check for ordinary symbols.
16996         * sparc.cc (Scan::local): Likewise.
16997         * x86_64.cc (Scan::local): Likewise.
16998         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
16999         to symbol_section_and_value.
17000         * testsuite/many_sections_test.cc: New file.
17001         * testsuite/Makefile.am (BUILT_SOURCES): Define.
17002         (check_PROGRAMS): Add many_sections_test.
17003         (many_sections_test_SOURCES): Define.
17004         (many_sections_test_DEPENDENCIES): Define.
17005         (many_sections_test_LDFLAGS): Define.
17006         (BUILT_SOURCES): Add many_sections_define.h.
17007         (many_sections_define.h): New target.
17008         (BUILT_SOURCES): Add many_sections_check.h.
17009         (many_sections_check.h): New target.
17010         (check_PROGRAMS): Add many_sections_r_test.
17011         (many_sections_r_test_SOURCES): Define.
17012         (many_sections_r_test_DEPENDENCIES): Define.
17013         (many_sections_r_test_LDFLAGS): Define.
17014         (many_sections_r_test_LDADD): Define.
17015         (many_sections_r_test.o): New target.
17016         * testsuite/Makefile.in: Rebuild.
17017
17018 2008-04-17  Cary Coutant  <ccoutant@google.com>
17019
17020         * errors.cc (Errors::info): New function.
17021         (gold_info): New function.
17022         * errors.h (Errors::info): New function.
17023         * gold.h (gold_info): New function.
17024         * object.cc (Input_objects::add_object): Print trace output.
17025         * options.cc (options::parse_set): New function.
17026         (General_options::parse_wrap): Deleted.
17027         (General_options::General_options): Deleted initializer.
17028         * options.h (options::String_set): New typedef.
17029         (options::parse_set): New function.
17030         (DEFINE_set): New macro.
17031         (General_options::wrap): Changed to use DEFINE_set. Changed
17032         callers of any_wrap_symbols and is_wrap_symbol.
17033         (General_options::trace, General_options::trace_symbol):
17034         New options.
17035         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
17036         (General_options::wrap_symbols_): Deleted.
17037         * symtab.cc (Symbol_table::add_from_object): Print trace output.
17038
17039 2008-04-17  David S. Miller  <davem@davemloft.net>
17040
17041         * options.cc (General_options::parse_V): New function.
17042         * options.h: Add entries for -V and -Qy.
17043
17044 2008-04-17  Ian Lance Taylor  <iant@google.com>
17045
17046         * common.cc (Symbol_table::allocate_commons): Remove options
17047         parameter.  Change caller.
17048         (Symbol_table::do_allocate_commons): Remove options parameter.
17049         Change caller.  Just call do_allocate_commons_list twice.
17050         (Symbol_table::do_allocate_commons_list): New function, broken out
17051         of do_allocate_commons.
17052         * common.h (class Allocate_commons_task): Remove options_ field.
17053         Update constructor.
17054         * symtab.cc (Symbol_table::Symbol_table): Initialize
17055         tls_commons_.
17056         (Symbol_table::add_from_object): Put TLS common symbols on
17057         tls_commons_ list.
17058         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
17059         which are IN_OUTPUT_DATA.
17060         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
17061         allocate_commons and do_allocate_commons declarations.  Declare
17062         do_allocate_commons_list.
17063         * gold.cc (queue_middle_tasks): Update creation of
17064         Allocate_commons_task to not pass options.
17065         * testsuite/Makefile.am (INCLUDES): Add -I.. .
17066         (TLS_TEST_C_FLAGS): New variable.
17067         (tls_test_c_pic.o): New target.
17068         (tls_test_shared.so): Link in tls_test_c_pic.o.
17069         (tls_test_c_pic_ie.o): New target.
17070         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
17071         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
17072         (tls_test_c.o): New target.
17073         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
17074         (tls_pic_test_LDADD): Likewise.
17075         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
17076         (tls_shared_gd_to_ie_test_LDADD): Likewise.
17077         (tls_test_c_gnu2.o): New target.
17078         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
17079         tls_test_c_gnu2.o.
17080         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
17081         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
17082         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
17083         * testsuite/tls_test.cc: Include "config.h".
17084         (t_last): Call t11_last.
17085         * testsuite/tls_test.h (t11, t11_last): Declare.
17086         * testsuite/tls_test_c.c: New file.
17087         * testsuite/tls_test_main.cc (thread_routine): Call t11.
17088         * configure.ac: Check for OpenMP support.
17089         * configure, config.in, Makefile.in: Rebuild.
17090         * testsuite/Makefile.in: Rebuild.
17091
17092 2008-04-16  Cary Coutant  <ccoutant@google.com>
17093
17094         * i386.cc (Target_i386::define_tls_base_symbol): New function.
17095         (Target_i386::tls_base_symbol_defined_): New field.
17096         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
17097         (Target_i386::Scan::global): Likewise.
17098         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
17099         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
17100         (Target_x86_64::tls_base_symbol_defined_): New field.
17101         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
17102         (Target_x86_64::Scan::global): Likewise.
17103
17104 2008-04-16  Cary Coutant  <ccoutant@google.com>
17105
17106         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
17107         (Symbol::needs_plt_entry): Allow weak undefined symbols.
17108         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
17109         building shared libraries.
17110         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
17111         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
17112         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
17113         * testsuite/Makefile.in: Rebuild.
17114         * testsuite/weak_undef.h: New file.
17115         * testsuite/weak_undef_file1.cc: Add extra test cases.
17116         * testsuite/weak_undef_file2.cc: Likewise.
17117         * testsuite/weak_undef_test.cc: Likewise.
17118
17119 2008-04-16  David S. Miller  <davem@davemloft.net>
17120
17121         * sparc.cc (Target_sparc::Scan): Change from struct to class.
17122         Add issued_non_pic_error_ field.  Declare check_non_pic.
17123         (Target_sparc::Scan::check_non_pic): New function.
17124         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
17125         (Target_sparc::Scan::global): Likewise.
17126
17127         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
17128         * configure: Rebuild.
17129
17130         * options.h (DEFINE_enable): New macro.
17131         (new_dtags): New enable option.
17132         (initfirst, interpose, loadfltr, nodefaultlib,
17133         nodelete, nodlopen, nodump): New -z options.
17134         * layout.cc (Layout:finish_dynamic_section): If new
17135         dtags enabled, emit DT_RUNPATH.  Also, emit a
17136         DT_FLAGS_1 containing any specified -z flags.
17137
17138 2008-04-16  Ian Lance Taylor  <iant@google.com>
17139
17140         * copy-relocs.cc: New file.
17141         * copy-relocs.h: New file.
17142         * reloc.cc: Remove Copy_relocs code.
17143         * reloc.h: Likewise.
17144         * reloc-types.h (struct Reloc_types) [both versions]: Add
17145         get_reloc_addend_noerror.
17146         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
17147         variants of add_global which take an addend which must be zero.
17148         * i386.cc: Include "copy-relocs.h".
17149         (class Target_i386): Change type of copy_relocs_ to variable,
17150         update initializer.
17151         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
17152         Change all callers.
17153         (Target_i386::do_finalize_sections): Change handling of
17154         copy_relocs_.
17155         * sparc.cc: Include "copy-relocs.h".
17156         (class Target_sparc): Change type of copy_relocs_ to variable,
17157         update initializer.
17158         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
17159         Change all callers.
17160         (Target_sparc::do_finalize_sections): Change handling of
17161         copy_relocs_.
17162         * x86_64.cc: Include "copy-relocs.h".
17163         (class Target_x86_64): Change type of copy_relocs_ to variable,
17164         update initializer.
17165         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
17166         class.  Change all callers.
17167         (Target_x86_64::do_finalize_sections): Change handling of
17168         copy_relocs_.
17169         * Makefile.am (CCFILES): Add copy-relocs.cc.
17170         (HFILES): Add copy-relocs.h.
17171
17172         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
17173
17174         * testsuite/script_test_4.sh: Permit leading zeroes.
17175
17176 2008-04-15  Ian Lance Taylor  <iant@google.com>
17177
17178         * script-sections.cc (Script_sections::create_segments): Use
17179         header_size_adjustment even when there is enough room for the
17180         headers.
17181         * testsuite/script_test_4.sh: New file.
17182         * testsuite/script_test_4.t: New file.
17183         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
17184         (check_DATA): Add script_test_4.stdout.
17185         (MOSTLYCLEANFILES): Likewise.
17186         (script_test_4): New target.
17187         (script_test_4.stdout): New target.
17188         * testsuite/Makefile.in: Rebuild.
17189
17190         * sparc.cc: Add definitions for Output_data_plt_sparc class
17191         constants.
17192
17193 2008-04-14  David S. Miller  <davem@davemloft.net>
17194
17195         * sparc.cc: New file.
17196         * Makefile.am (TARGETSOURCES): Add sparc.cc
17197         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
17198         * configure.tgt: Document targ_extra_size and
17199         targ_extra_big_endian.  Add entries for sparc-* and
17200         sparc64-*.
17201         * configure.ac: Handle targ_extra_size and
17202         targ_extra_big_endian.
17203         * Makefile.in: Rebuild.
17204         * configure: Likewise.
17205         * po/POTFILES.in: Likewise.
17206         * po/gold.pot: Likewise.
17207
17208 2008-04-14  Ian Lance Taylor  <iant@google.com>
17209
17210         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
17211         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
17212         in the name/type/flags to section mapping.  Don't call
17213         allocate_output_section.
17214         (Layout::choose_output_section): Change parameter from adjust_name
17215         to is_input_section.  Don't permit input sections after sections
17216         are attached to segments.  Don't call allocate_output_section.
17217         (Layout::layout_eh_frame): Call update_flags_for_input_section,
17218         not write_enable_output_section.
17219         (Layout::make_output_section): Don't push to
17220         unattached_section_list_ nor call attach_to_segment.  Call
17221         attach_section_to_segment if sections are attached.
17222         (Layout::attach_sections_to_segments): New function.
17223         (Layout::attach_section_to_segment): New function.
17224         (Layout::attach_allocated_section_to_segment): Rename from
17225         attach_to_segment.  Remove flags parameter.
17226         (Layout::allocate_output_section): Remove function.
17227         (Layout::write_enable_output_section): Remove function.
17228         * layout.h (class Layout): Update for above changes.  Add new
17229         field sections_are_attached_.
17230         * output.h (Output_section::update_flags_for_input_section): New
17231         function.
17232         * output.cc (Output_section::add_input_section): Call
17233         update_flags_for_input_section.
17234         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
17235
17236 2008-04-11  Cary Coutant  <ccoutant@google.com>
17237
17238         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
17239         thought unnecessary.
17240         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
17241
17242 2008-04-11  Ian Lance Taylor  <iant@google.com>
17243
17244         * output.h (class Output_section_data): Remove inline definition
17245         of set_addralign.
17246         * output.cc (Output_section_data::set_addralign): New function.
17247
17248 2008-04-11  Cary Coutant  <ccoutant@google.com>
17249
17250         Add support for TLS descriptors for i386 and x86_64.
17251         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
17252         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
17253         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
17254         GOT_TYPE_TLS_DESC.
17255         (Target_i386::got_mod_index_entry): Remove unnecessary code.
17256         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
17257         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
17258         relocations.
17259         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
17260         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
17261         Fix problem with initial-exec relocations.
17262         (Target_i386::Relocate::relocate_tls): Likewise.
17263         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
17264         relaxation.
17265         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
17266         support for section-plus-offset dynamic table entries.
17267         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
17268         (Output_data_dynamic::Dynamic_entry): Add support for
17269         section-plus-offset dynamic table entries.
17270         (Output_data_dynamic::Classification): Likewise.
17271         (Output_data_dynamic::classification_): Renamed offset_.
17272         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
17273         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
17274         (Target_x86_64::make_plt_section): New function.
17275         (Target_x86_64::reserve_tlsdesc_entries): New function.
17276         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
17277         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
17278         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
17279         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
17280         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
17281         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
17282         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
17283         add extra PLT entry for TLS descriptors.
17284         (Output_data_plt_x86_64::got_): New field.
17285         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
17286         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
17287         fields.
17288         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
17289         descriptors.
17290         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
17291         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
17292         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
17293         R_386_TLS_DESC_CALL relocations.
17294         (Target_x86_64::Scan::global): Likewise.
17295         (Target_x86_64::do_finalize_sections): Add dynamic table entries
17296         for TLS descriptors.
17297         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
17298         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
17299         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
17300         GD-to-IE relaxation.
17301         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
17302         and TLS_DESCRIPTORS.
17303         * Makefile.in: Rebuild.
17304         * configure: Rebuild.
17305         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
17306         (tls_test_shared2.so): New target.
17307         (tls_shared_gd_to_ie_test_SOURCES): New variable.
17308         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
17309         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
17310         (tls_shared_gd_to_ie_test_LDADD): New variable.
17311         (tls_shared_gnu2_gd_to_ie_test): New target.
17312         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
17313         New targets.
17314         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
17315         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
17316         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
17317         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
17318         (tls_shared_gnu2_test): New target.
17319         (tls_test_gnu2_shared.so): New target.
17320         (tls_shared_gnu2_test_SOURCES): New variable.
17321         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
17322         (tls_shared_gnu2_test_LDFLAGS): New variable.
17323         (tls_shared_gnu2_test_LDADD): New variable.
17324         * testsuite/Makefile.in: Rebuild.
17325         * testsuite/Makefile.
17326
17327 2008-04-11  Ian Lance Taylor  <iant@google.com>
17328
17329         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
17330         justsyms.t.
17331         * testsuite/Makefile.in: Rebuild.
17332
17333         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
17334         long.
17335         * testsuite/script_test_2.cc (main): Adjust test.
17336
17337 2008-04-11  David S. Miller  <davem@davemloft.net>
17338             Ian Lance Taylor  <iant@google.com>
17339
17340         * options.h (General_options): Add entries for '-Y' and
17341         '-relax'.
17342         * options.cc (General_options:finalize): If -Y was used, add those
17343         entries to the library path instead of the default "/lib" and
17344         "/usr/lib".
17345
17346 2008-04-11  David S. Miller  <davem@davemloft.net>
17347
17348         * testsuite/justsyms.t: Start at 0x100.
17349         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
17350         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
17351         long.
17352         * testsuite/script_test_2.cc: Adjust string and section length
17353         checks.
17354
17355 2008-04-09  Ian Lance Taylor  <iant@google.com>
17356
17357         PR gold/5996
17358         * script-sections.cc (Sections_element::allocate_to_segment): Add
17359         orphan parameter.
17360         (Output_section_definition::allocate_to_segment): Likewise.
17361         (Orphan_output_section::allocate_to_segment): Likewise.
17362         (Script_sections::attach_sections_using_phdrs_clause): Don't
17363         propagate non-PT_LOAD segments to orphan sections.
17364         * testsuite/Makefile.am (script_test_3.stdout): Generate using
17365         readelf rather than objdump.
17366         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
17367         .interp section and PT_INTERP segment are the same size.
17368         * testsuite/Makefile.in: Rebuild.
17369
17370         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
17371         aliases for symbols defined in the same object.
17372         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
17373         (weak_alias_test_SOURCES): New variable.
17374         (weak_alias_test_DEPENDENCIES): New variable.
17375         (weak_alias_test_LDFLAGS): New variable.
17376         (weak_alias_test_LDADD): New variable.
17377         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
17378         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
17379         (weak_alias_test_3.o): New target.
17380         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
17381         * testsuite/weak_alias_test_main.cc: New file.
17382         * testsuite/weak_alias_test_1.cc: New file.
17383         * testsuite/weak_alias_test_2.cc: New file.
17384         * testsuite/weak_alias_test_3.cc: New file.
17385
17386 2008-04-08  Ian Lance Taylor  <iant@google.com>
17387
17388         * options.h (class General_options): Add --noinhibit-exec option.
17389         * main.cc (main): Check --noinhibit-exec.
17390
17391         * options.h (class General_options): Define --wrap as a special
17392         option.  Add wrap_symbols_ field.
17393         (General_options::any_wrap_symbols): New function.
17394         (General_options::is_wrap_symbol): New function.
17395         * options.cc (General_options::parse_wrap): New function.
17396         (General_options::General_options): Initialize wrap_symbols_.
17397         * symtab.cc (Symbol_table::wrap_symbol): New function.
17398         (Symbol_table::add_from_object): Handle --wrap.
17399         * symtab.h (class Symbol_table): Declare wrap_symbol.
17400         * target.h (Target::wrap_char): New function.
17401         (Target::Target_info): Add wrap_char field.
17402         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
17403         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
17404         * testsuite/testfile.cc (Target_test::test_target_info):
17405         Likewise.
17406
17407         * errors.cc (Errors::undefined_symbol): Mention symbol version if
17408         there is one.
17409
17410         * layout.h (class Layout): Add added_eh_frame_data_ field.
17411         * layout.cc (Layout::Layout): Initialize new field.
17412         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
17413         output section until we find a section we merged successfully.
17414         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
17415         that the size be non-zero.
17416
17417         * merge.cc (Object_merge_map::get_output_offset): Remove inline
17418         qualifier.
17419
17420 2008-04-08  Craig Silverstein  <csilvers@google.com>
17421
17422         * configure.ac: Export new conditional variable HAVE_ZLIB.
17423         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
17424         on HAVE_ZLIB.
17425         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
17426         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17427
17428 2008-04-07  Ian Lance Taylor  <iant@google.com>
17429
17430         * version.cc (version_string): Set to "1.5".
17431
17432         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
17433         Add issued_non_pic_error_ field.  Declare check_non_pic.
17434         (Target_x86_64::Scan::check_non_pic): New function.
17435         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
17436         (Target_x86_64::Scan::global): Likewise.
17437
17438         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
17439         addend parameter.  Change caller.  Handle merge sections.
17440         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
17441         Address to Addend.  Don't add in the result of
17442         local_section_offset, pass down the addend and use the returned
17443         value.
17444         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
17445         Update declarations of local_section_offset and symbol_value.
17446         * testsuite/two_file_test_1.cc (t18): New function.
17447         * testsuite/two_file_test_2.cc (f18): New function.
17448         * testsuite/two_file_test_main.cc (main): Call t18.
17449         * testsuite/two_file_test.h (t18, f18): Declare.
17450
17451         * configure.ac: Don't test for objdump, c++filt, or readelf.
17452         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
17453         conditionals.
17454         (TEST_READELF): New variable.
17455         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
17456         (check_PROGRAMS): Add two_file_strip_test.
17457         (two_file_strip_test): New target.
17458         (check_PROGRAMS): Add two_file_same_shared_strip_test.
17459         (two_file_same_shared_strip_test_SOURCES): New variable.
17460         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
17461         (two_file_same_shared_strip_test_LDFLAGS): New variable.
17462         (two_file_same_shared_strip_test_LDADD): New variable.
17463         (two_file_shared_strip.so): New target.
17464         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
17465         (ver_test_5.syms, ver_test_7.syms): Likewise.
17466         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
17467         (strip_test_3.stdout): Use TEST_OBJDUMP.
17468         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17469
17470 2008-04-04  Cary Coutant  <ccoutant@google.com>
17471
17472         * symtab.h (Symbol::is_weak_undefined): New function.
17473         (Symbol::is_strong_undefined): New function.
17474         (Symbol::is_absolute): New function.
17475         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
17476         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
17477         absolute symbols.
17478         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
17479         (weak_undef_test): New target.
17480         * testsuite/Makefile.in: Rebuild.
17481         * testsuite/weak_undef_file1.cc: New file.
17482         * testsuite/weak_undef_file2.cc: New file.
17483         * testsuite/weak_undef_test.cc: New file.
17484
17485 2008-04-03  Craig Silverstein  <csilvers@google.com>
17486
17487         * compressed_output.h (class Output_compressed_section): Use
17488         unsigned buffer.
17489         * compressed_output.cc (zlib_compress): Use unsigned buffers,
17490         add zlib header.
17491         (zlib_compressed_suffix): Removed.
17492         (Output_compressed_section::set_final_data_size): Use unsigned
17493         buffers.
17494         * testsuite/Makefile.am (flagstest_compress_debug_sections):
17495         Fix linker invocation.
17496         (flagstest_o_specialfile_and_compress_debug_sections):
17497         Likewise.
17498         * testsuite/Makefile.in: Regenerated.
17499
17500 2008-04-02  David S. Miller  <davem@davemloft.net>
17501
17502         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
17503         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
17504
17505 2008-04-02  Craig Silverstein  <csilvers@google.com>
17506
17507         * TODO: New file.
17508
17509 2008-04-02  Ian Lance Taylor  <iant@google.com>
17510
17511         * fileread.cc (File_read::find_view): Add byteshift and vshifted
17512         parameters.  Update for new key type to views_.  Change all
17513         callers.
17514         (File_read::read): Adjust for byteshift in returned view.
17515         (File_read::add_view): New function, broken out of
17516         find_and_make_view.
17517         (File_read::make_view): New function, broken out of
17518         find_and_make_view.
17519         (File_read::find_or_make_view): Add offset and aligned
17520         parameters.  Rewrite accordingly.  Change all callers.
17521         (File_read::get_view): Add offset and aligned parameters.  Adjust
17522         for byteshift in return value.
17523         (File_read::get_lasting_view): Likewise.
17524         * fileread.h (class File_read): Update declarations.
17525         (class File_read::View): Add byteshift_ field.  Add byteshift to
17526         constructor.  Add byteshift method.
17527         * archive.h (Archive::clear_uncached_views): New function.
17528         (Archive::get_view): Add aligned parameter.  Change all callers.
17529         * object.h (Object::get_view): Add aligned parameter.  Change all
17530         callers.
17531         (Object::get_lasting_view): Likewise.
17532
17533         * fileread.cc (File_read::release): Don't call clear_views if
17534         there are multiple objects.
17535         * fileread.h (File_read::clear_uncached_views): New function.
17536         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
17537         on the archive.
17538
17539 2008-03-31  Cary Coutant  <ccoutant@google.com>
17540
17541         Add thin archive support.
17542         * archive.cc (Archive::armagt): New const.
17543         (Archive::setup): Remove task parameter and calls to unlock.
17544         (Archive::unlock_nested_archives): New function.
17545         (Archive::read_header): Add nested_off parameter. Change
17546         all callers.
17547         (Archive::interpret_header): Likewise.
17548         (Archive::include_all_members): Change to handle thin
17549         archives.
17550         (Archive::include_member): Likewise.
17551         * archive.h (Archive::Archive): Add new parameters and
17552         initializers.
17553         (Archive::armagt): New const.
17554         (Archive::setup): Remove task parameter.
17555         (Archive::unlock_nested_archives): New function.
17556         (Archive::read_header): Add nested_off parameter.
17557         (Archive::interpret_header): Likewise.
17558         (Archive::Nested_archive_table): New typedef.
17559         (Archive::is_thin_archive_): New field.
17560         (Archive::nested_archives_): New field.
17561         (Archive::options_): New field.
17562         (Archive::dirpath_): New field.
17563         (Archive::task_): New field.
17564         * readsyms.cc (Read_symbols::do_read_symbols): Add check
17565         for thin archives.  Pass additional parameters to
17566         Archive::Archive.  Unlock the archive file after calling
17567         Archive::setup.
17568
17569 2008-03-29  Ian Lance Taylor  <iant@google.com>
17570
17571         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
17572         version symbol to be local.
17573         * testsuite/ver_test_4.sh: New file.
17574         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
17575         (check_DATA): Add ver_test_4.syms.
17576         (ver_test_4.syms): New target.
17577         * testsuite/Makefile.in: Rebuild.
17578
17579         * output.cc
17580         (Output_section::Input_section_sort_entry::has_priority): New
17581         function.
17582         (Output_section::Input_section_sort_entry::match_file_name): New
17583         function.
17584         (Output_section::Input_section_sort_entry::match_section_name):
17585         Remove.
17586         (Output_section::Input_section_sort_entry::match_section_name_prefix):
17587         Remove.
17588         (Output_section::Input_section_sort_entry::match_section_file):
17589         Remove.
17590         (Output_section::Input_section_sort_compare::operator()): Rewrite
17591         using new Input_section_sort_entry functions.  Sort crtbegin and
17592         crtend first.  Sort sections with no priority before sections with
17593         a priority.
17594         * testsuite/initpri1.c (d3): Check j != 4.
17595         (cd5): New constructor/destructor function.
17596         (main): Check j != 2.
17597
17598         * symtab.cc (Symbol_table::add_from_object): If we don't use the
17599         new symbol when resolving, don't call set_is_default.
17600         * testsuite/ver_test_7.cc: New file.
17601         * testsuite/ver_test_7.sh: New file.
17602         * testsuite/Makefile.am (ver_test_7.so): New target.
17603         (ver_test_7.o): New target.
17604         (check_SCRIPTS): Add ver_test_7.sh.
17605         (check_DATA): Add ver_test_7.syms.
17606         (ver_test_7.syms): New target.
17607
17608 2008-03-28  Ian Lance Taylor  <iant@google.com>
17609
17610         * layout.cc (Layout::layout): If we see an input section with a
17611         name that needs sorting, set the must_sort flag for the output
17612         section.
17613         (Layout::make_output_section): If the name of the output section
17614         indicates that it might require sorting, set the may_sort flag.
17615         * output.h (Output_section::may_sort_attached_input_sections): New
17616         function.
17617         (Output_section::set_may_sort_attached_input_sections): New
17618         function.
17619         (Output_section::must_sort_attached_input_sections): New
17620         function.
17621         (Output_section::set_must_sort_attached_input_sections): New
17622         function.
17623         (class Output_section): Declare Input_section_sort_entry.  Define
17624         Input_section_sort_compare.  Declare
17625         sort_attached_input_sections.  Add new fields:
17626         may_sort_attached_input_sections_,
17627         must_sort_attached_input_sections_,
17628         attached_input_sections_are_sorted_.
17629         * output.cc (Output_section::Output_section): Initialize new
17630         fields.
17631         (Output_section::add_input_section): Add an entry to
17632         input_sections_ if may_sort or must_sort are true.
17633         (Output_section::set_final_data_size): Call
17634         sort_attached_input_sections if necessary.
17635         (Output_section::Input_section_sort_entry): Define new class.
17636         (Output_section::Input_section_sort_compare::operator()): New
17637         function.
17638         (Output_section::sort_attached_input_sections): New function.
17639         * configure.ac: Check whether the compiler supports constructor
17640         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
17641         * testsuite/initpri1.c: New file.
17642         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
17643         CONSTRUCTOR_PRIORITY.
17644         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
17645         (initpri1_LDFLAGS): New variable.
17646         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17647
17648 2008-03-27  Ian Lance Taylor  <iant@google.com>
17649
17650         * common.cc (Sort_commons::operator): Correct sorting algorithm.
17651         * testsuite/common_test_1.c: New file.
17652         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
17653         (common_test_1_SOURCES): New variable.
17654         (common_test_1_DEPENDENCIES): New variable.
17655         (common_test_1_LDFLAGS): New variable.
17656
17657         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
17658         and commons_ correctly when NAME/VERSION does not override
17659         NAME/NULL.
17660         * testsuite/ver_test_6.c: New file.
17661         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
17662         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
17663         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
17664
17665 2008-03-26  Ian Lance Taylor  <iant@google.com>
17666
17667         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
17668         of an undefined symbol from a version script.
17669         * testsuite/Makefile.am (ver_test_5.so): New target.
17670         (ver_test_5.o): New target.
17671         (check_SCRIPTS): Add ver_test_5.sh.
17672         (check_DATA): Add ver_test_5.syms.
17673         (ver_test_5.syms): New target.
17674         * testsuite/ver_test_5.cc: New file.
17675         * testsuite/ver_test_5.script: New file.
17676         * testsuite/ver_test_5.sh: New file.
17677         * Makefile.in, testsuite/Makefile.in: Rebuild.
17678
17679         PR gold/5986
17680         Fix problems building gold with gcc 4.3.0.
17681         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
17682         (gold_error_at_location, gold_warning_at_location): Use it.
17683         * configure.ac: Check whether we can compile and use a template
17684         function with a printf attribute.
17685         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
17686         when jumping over bytes.
17687         * object.cc: Instantiate Object::read_section_data.
17688         * debug.h: Include <cstring>
17689         * dwarf_reader.cc: Include <algorithm>
17690         * main.cc: Include <cstring>.
17691         * options.cc: Include <cstring>.
17692         * output.cc: Include <cstring>.
17693         * script.cc: Include <cstring>.
17694         * script.h: Include <string>.
17695         * symtab.cc: Include <cstring> and <algorithm>.
17696         * target-select.cc: Include <cstring>.
17697         * version.cc: Include <string>.
17698         * testsuite/testmain.cc: Include <cstdlib>.
17699         * configure, config.in: Rebuild.
17700
17701 2008-03-25  Ian Lance Taylor  <iant@google.com>
17702
17703         * options.cc: Include "../bfd/bfdver.h".
17704         (options::help): Print bug reporting address.
17705
17706         * version.cc (print_version): Adjust output for current value of
17707         BFD_VERSION_STRING.
17708
17709         * NEWS: New file.
17710
17711         * options.cc (options::help): Print list of supported targets.
17712         * target-select.h: Include <vector>.
17713         (class Target_selector): Make machine_, size_, and is_big_endian_
17714         fields const.  Add bfd_name_ and instantiated_target_ fields.
17715         (Target_selector::Target_selector): Add bfd_name parameter.
17716         (Target_selector::recognize): Make non-virtual, call
17717         do_recognize.
17718         (Target_selector::recognize_by_name): Make non-virtual, call
17719         do_recognize_by_name.
17720         (Target_selector::supported_names): New function.
17721         (Target_selector::bfd_name): New function.
17722         (Target_selector::do_instantiate_target): New pure virtual
17723         function.
17724         (Target_selector::do_recognize): New virtual function.
17725         (Target_selector::do_recognize_by_name): New virtual function.
17726         (Target_selector::instantiate_target): New private function.
17727         (supported_target_names): Declare.
17728         * target-select.cc (Target_selector::Target_selector): Update for
17729         new parameter and fields.
17730         (select_target_by_name): Check that the name matches before
17731         calling recognize_by_name.
17732         (supported_target_names): New function.
17733         * i386.cc (class Target_selector_i386): Update Target_selector
17734         constructor call.  Remove recognize and recognize_by_name.  Add
17735         do_instantiate_target.
17736         * x86_64.cc (class Target_selector_x86_64): Likewise.
17737         * testsuite/testfile.cc (class Target_selector_test): Update for
17738         changes to Target_selector.
17739
17740         * README: Rewrite, with some notes on unsupported features.
17741
17742 2008-03-24  Cary Coutant  <ccoutant@google.com>
17743
17744         * i386.cc (Target_i386::Got_type): New enum declaration.
17745         (Target_i386::Scan::local): Updated callers of Output_data_got
17746         member functions.
17747         (Target_i386::Scan::global): Likewise.
17748         (Target_i386::Relocate::relocate): Likewise.
17749         (Target_i386::Relocate::relocate_tls): Likewise.
17750         * object.h (Got_offset_list): New class.
17751         (Sized_relobj::local_has_got_offset): Added got_type parameter.
17752         (Sized_relobj::local_got_offset): Likewise.
17753         (Sized_relobj::set_local_got_offset): Likewise.
17754         (Sized_relobj::local_has_tls_got_offset): Removed.
17755         (Sized_relobj::local_tls_got_offset): Removed.
17756         (Sized_relobj::set_local_tls_got_offset): Removed.
17757         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
17758         * output.cc (Output_data_got::add_global): Added got_type parameter.
17759         (Output_data_got::add_global_with_rel): Likewise.
17760         (Output_data_got::add_global_with_rela): Likewise.
17761         (Output_data_got::add_global_pair_with_rel): New function.
17762         (Output_data_got::add_global_pair_with_rela): New function.
17763         (Output_data_got::add_local): Added got_type parameter.
17764         (Output_data_got::add_local_with_rel): Likewise.
17765         (Output_data_got::add_local_with_rela): Likewise.
17766         (Output_data_got::add_local_pair_with_rel): New function.
17767         (Output_data_got::add_local_pair_with_rela): New function.
17768         (Output_data_got::add_global_tls): Removed.
17769         (Output_data_got::add_global_tls_with_rel): Removed.
17770         (Output_data_got::add_global_tls_with_rela): Removed.
17771         (Output_data_got::add_local_tls): Removed.
17772         (Output_data_got::add_local_tls_with_rel): Removed.
17773         (Output_data_got::add_local_tls_with_rela): Removed.
17774         * output.h (Output_data_got::add_global): Added got_type parameter.
17775         (Output_data_got::add_global_with_rel): Likewise.
17776         (Output_data_got::add_global_with_rela): Likewise.
17777         (Output_data_got::add_global_pair_with_rel): New function.
17778         (Output_data_got::add_global_pair_with_rela): New function.
17779         (Output_data_got::add_local): Added got_type parameter.
17780         (Output_data_got::add_local_with_rel): Likewise.
17781         (Output_data_got::add_local_with_rela): Likewise.
17782         (Output_data_got::add_local_pair_with_rel): New function.
17783         (Output_data_got::add_local_pair_with_rela): New function.
17784         (Output_data_got::add_global_tls): Removed.
17785         (Output_data_got::add_global_tls_with_rel): Removed.
17786         (Output_data_got::add_global_tls_with_rela): Removed.
17787         (Output_data_got::add_local_tls): Removed.
17788         (Output_data_got::add_local_tls_with_rel): Removed.
17789         (Output_data_got::add_local_tls_with_rela): Removed.
17790         * resolve.cc (Symbol::override_base_with_special): Removed
17791         reference to has_got_offset_ field.
17792         * symtab.cc (Symbol::init_fields): Replaced initialization
17793         of got_offset_ with got_offsets_.  Removed initialization
17794         of has_got_offset_
17795         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
17796         (Symbol::got_offset): Likewise.
17797         (Symbol::set_got_offset): Likewise.
17798         (Symbol::has_tls_got_offset): Removed.
17799         (Symbol::tls_got_offset): Removed.
17800         (Symbol::set_tls_got_offset): Removed.
17801         (Symbol::got_offset_): Removed.
17802         (Symbol::tls_mod_got_offset_): Removed.
17803         (Symbol::tls_pair_got_offset_): Removed.
17804         (Symbol::got_offsets_): New field.
17805         (Symbol::has_got_offset): Removed.
17806         (Symbol::has_tls_mod_got_offset): Removed.
17807         (Symbol::has_tls_pair_got_offset): Removed.
17808         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
17809         (Target_x86_64::Scan::local): Updated callers of Output_data_got
17810         member functions.
17811         (Target_x86_64::Scan::global): Likewise.
17812         (Target_x86_64::Relocate::relocate): Likewise.
17813         (Target_x86_64::Relocate::relocate_tls): Likewise.
17814
17815 2008-03-25  Ben Elliston  <bje@au.ibm.com>
17816
17817         * yyscript.y: Fix spelling error in comment.
17818
17819 2008-03-24  Ian Lance Taylor  <iant@google.com>
17820
17821         * options.h (class General_options): Define build_id option.
17822         * layout.h (class Layout): Declare write_build_id, create_note,
17823         create_build_id.  Add build_id_note_ member.
17824         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
17825         "libiberty.h", "md5.h", "sha1.h".
17826         (Layout::Layout): Initialize eh_frame_data_,
17827         eh_frame_hdr_section_, and build_id_note_.
17828         (Layout::finalize): Call create_build_id.
17829         (Layout::create_note): New function, broken out of
17830         Layout::create_gold_note.
17831         (Layout::create_gold_note): Call create_note.
17832         (Layout::create_build_id): New function.
17833         (Layout::write_build_id): New function.
17834         (Close_task_runner::run): Call write_build_id.
17835
17836         * x86_64.cc: Correct license to GPLv3.
17837
17838 2008-03-23  Ian Lance Taylor  <iant@google.com>
17839
17840         * options.cc: Include "demangle.h".
17841         (parse_optional_string): New function.
17842         (parse_long_option): Handle takes_optional_argument.
17843         (parse_short_option): Update dash_z initializer.  Handle
17844         takes_optional_argument.
17845         (General_options::General_options): Initialize do_demangle_.
17846         (General_options::finalize): Set do_demangle_.  Handle demangling
17847         style.
17848         * options.h (parse_optional_string): Declare.
17849         (struct One_option): Add optional_arg field.  Update constructor.
17850         Update call constructor calls.  Add takes_optional_argument
17851         function.
17852         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
17853         (DEFINE_optional_string): Define.
17854         (General_options::demangle): Change from DEFINE_bool to
17855         DEFINE_optional_string.
17856         (General_options::no_demangle): New function.
17857         (General_options::do_demangle): New function.
17858         (General_options::set_do_demangle): New function.
17859         (General_options::execstack_status_): Move definition to end of
17860         class definition.
17861         (General_options::static_): Likewise.
17862         (General_options::do_demangle_): New field.
17863         * object.cc (big_endian>::get_symbol_location_info): Call
17864         Options::do_demangle, not Options::demangle.
17865         * symtab.cc (demangle): Likewise.
17866
17867 2008-03-22  Ian Lance Taylor  <iant@google.com>
17868
17869         * gold.h: Include <cstddef> and <sys/types.h>
17870         * options.h: Include <cstring>.
17871
17872 2008-03-21  Ian Lance Taylor  <iant@google.com>
17873
17874         * Added source code to GNU binutils.
17875 \f
17876 Copyright (C) 2008-2015 Free Software Foundation, Inc.
17877
17878 Copying and distribution of this file, with or without modification,
17879 are permitted in any medium without royalty provided the copyright
17880 notice and this notice are preserved.
17881
17882 Local Variables:
17883 mode: change-log
17884 left-margin: 8
17885 fill-column: 74
17886 version-control: never
17887 End: