Remove unnecessary target dependencies on relocation format.
[external/binutils.git] / gold / ChangeLog
1 2015-11-09  Cary Coutant  <ccoutant@gmail.com>
2             Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
3
4         * copy-relocs.h (Copy_relocs::copy_reloc): Replace reloc parameter
5         with type, offset, addend.
6         (Copy_relocs::save): Likewise.
7         * copy-relocs.cc (Copy_relocs::copy_reloc): Likewise.
8         (Copy_relocs::save): Likewise.
9         * aarch64.cc (Target_aarch64::copy_reloc): Pass r_type, r_offset,
10         and r_addend to Copy_relocs::copy_reloc.
11         * arm.cc (Target_arm::copy_reloc): Likewise.
12         * i386.cc (Target_i386::copy_reloc): Likewise.
13         * mips.cc (Target_mips::copy_reloc): Likewise.
14         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
15         * s390.cc (Target_s390::copy_reloc): Likewise.
16         * sparc.cc (Target_sparc::copy_reloc): Likewise.
17         * tilegx.cc (Target_tilegx::copy_reloc): Likewise.
18         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
19
20 2015-11-05  Cary Coutant  <ccoutant@gmail.com>
21
22         PR gold/19119
23         PR gold/19172
24         PR gold/19197
25         Revert commit 6457197210144f50a696097c0d308d81d46d5510:
26         2015-10-16  H.J. Lu  <hongjiu.lu@intel.com>
27                 * options.h (General_options): Remove "obsolete" from -m.
28                 * parameters.cc (set_parameters_target): Check if input target
29                 is compatible with output emulation set by "-m emulation".
30
31 2015-11-05  Cary Coutant  <ccoutant@gmail.com>
32
33         PR gold/19163
34         * aarch64.cc (Target_aarch64::Relocate::relocate): Don't apply
35         certain relocations if --no-apply-dynamic-relocs is set.
36         * options.h (--apply-dynamic-relocs): New aarch64-specific option.
37
38 2015-11-03  Alan Modra  <amodra@gmail.com>
39
40         * po/POTFILES.in: Regenerate.
41
42 2015-10-30  Nick Clifton  <nickc@redhat.com>
43
44         * po/zh_CN.po: New (simplified) Chinese translation.
45
46 2015-10-29  H.J. Lu  <hongjiu.lu@intel.com>
47
48         PR gold/19184
49         * incremental.cc (Got_plt_view_info): Add got_entry_size.
50         (Local_got_offset_visitor::visit): Replace got_entry_size_
51         with info_.got_entry_size.
52         (Local_got_offset_visitor::got_entry_size_): Removed.
53         (Global_got_offset_visitor::visit): Replace got_entry_size_
54         with info_.got_entry_size.
55         (Global_got_offset_visitor::got_entry_size_): Removed.
56         (Output_section_incremental_inputs::write_got_plt): Initialize
57         view_info.got_entry_size.
58         * target.h (Sized_target::got_entry_size): New virtual function.
59         * x86_64.cc (Target_x86_64::got_entry_size): New function.
60
61 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
62
63         * testsuite/binary_test.cc: Add __attribute__((aligned(1))).
64         * testsuite/script_test_12a.c: Likewise.
65         * testsuite/script_test_1a.cc: Likewise.
66         * testsuite/script_test_2.cc: Likewise.
67
68 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
69
70         * testsuite/debug_msg.sh: Accept more fuzz in line numbers.
71
72 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
73
74         PR gold/18959
75         * stringpool.cc (Stringpool_template::new_key_offset): Align all
76         strings, even zero-length.
77         (Stringpool_template::set_string_offsets): Likewise.
78
79 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
80
81         * s390.cc: New file.
82         * Makefile.am (TARGETSOURCES): Add s390.cc.
83         (ALL_TARGETOBJS): Add s390.o.
84         * Makefile.in: Regenerate.
85         * configure.ac: Add s390 support.
86         * configure: Regenerate.
87         * configure.tgt: Add s390-*-* and s390x-*-*.
88         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Add s390
89         support.
90
91 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
92
93         * archive.cc (Archive::sym64name): New const.
94         (Archive::setup): Add support for SYM64 armap.
95         (Archive::read_armap): Likewise.
96         (Archive::interpret_header): Likewise.
97         (Archive::const_iterator::read_next_header): Likewise.
98         * archive.h (Archive::sym64name): New const.
99         (Archive::read_armap): Add mapsize template parameter.
100
101 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
102
103         * dynobj.cc (Dynobj::create_elf_hash_table): Create hash table with
104         target-specific entry size.
105         (Dynobj::sized_create_elf_hash_table): Add size template parameter.
106         * dynobj.h (Dynobj::sized_create_elf_hash_table): Likewise.
107         * layout.cc (Layout::create_dynamic_symtab): Set entsize to
108         hash_entry_size.
109         * target.h (Target::hash_entry_size): New method.
110         (Target::Target_info::hash_entry_size): New data member.
111
112         * aarch64.cc (Target_aarch64::aarch64_info): Add hash_entry_size.
113         * arm.cc (Target_arm::arm_info): Likewise.
114         (Target_arm_nacl::arm_nacl_info): Likewise.
115         * i386.cc (Target_i386::i386_info): Likewise.
116         (Target_i386_nacl::i386_nacl_info): Likewise.
117         (Target_iamcu::iamcu_info): Likewise.
118         * mips.cc (Target_mips::mips_info): Likewise.
119         (Target_mips_nacl::mips_nacl_info): Likewise.
120         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
121         * sparc.cc (Target_sparc::sparc_info): Likewise.
122         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
123         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
124         (Target_x86_64_nacl::x86_64_nacl_info): Likewise.
125         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
126
127 2015-10-28  H.J. Lu  <hongjiu.lu@intel.com>
128
129         PR gold/19177
130         * i386.cc (Target_i386::Relocate::relocate): Check R_386_GOT32
131         and R_386_GOT32X relocations without base register.
132
133 2015-10.27  Han Shen  <shenhan@google.com>
134
135         PR gold/19042 - unsupported reloc 311/312.
136
137         * aarch64.cc (Target_aarch64::Scan::local): Add support for
138         reloc 311/312.
139
140 2015-10-22  H.J. Lu  <hongjiu.lu@intel.com>
141
142         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
143         Treat R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX the same
144         as R_X86_64_GOTPCREL.
145         (Target_x86_64<size>::Scan::local): Likewise.
146         (Target_x86_64<size>::Scan::possible_function_pointer_reloc):
147         Likewise.
148         (Target_x86_64<size>::Scan::global): Likewise.
149         (Target_x86_64<size>::Relocate::relocate): Likewise.
150         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
151         Likewise.
152
153 2015-10-22  H.J. Lu  <hongjiu.lu@intel.com>
154
155         * i386.cc (Target_i386::Scan::get_reference_flags(): Treat
156         R_386_GOT32X the same as R_386_GOT32.
157         (Target_i386::Scan::local): Likewise.
158         (Target_i386::Scan::possible_function_pointer_reloc): Likewise.
159         (Target_i386::Scan::global): Likewise.
160         (Target_i386::Relocate::relocate): Likewise.
161         (Target_i386::Relocatable_size_for_reloc::get_size_for_reloc):
162         Likewise.
163
164 2015-10-20  H.J. Lu  <hongjiu.lu@intel.com>
165
166         * testsuite/Makefile.am (x86_64_mov_to_lea11): Replace
167         x86_64_mov_to_lea1.o with x86_64_mov_to_lea2.o.
168         (x86_64_mov_to_lea12): Replace x86_64_mov_to_lea2.o with
169         x86_64_mov_to_lea1.o.
170         * testsuite/Makefile.in: Regenerated.
171
172 2015-10-16  H.J. Lu  <hongjiu.lu@intel.com>
173
174         PR gold/19119
175         * options.h (General_options): Remove "obsolete" from -m.
176         * parameters.cc (set_parameters_target): Check if input target
177         is compatible with output emulation set by "-m emulation".
178
179 2015-10-13  H.J. Lu  <hongjiu.lu@intel.com>
180
181         PR gold/19118
182         * i386.cc (Target_iamcu): New class.
183         (Target_selector_iamcu): Likewise.
184         (Target_iamcu::iamcu_info): New variable.
185         (target_selector_iamcu): Likewise.
186
187 2015-10-07  Andreas Schwab  <schwab@suse.de>
188
189         * aarch64.cc (aarch64_info): Set abi_pagesize to 64K.
190
191 2015-10-06  Cary Coutant  <ccoutant@gmail.com>
192
193         PR gold/18855
194         * sparc.cc (Sparc_relocate_functions::gdop_hix22): Remove addend
195         parameter.
196         (Sparc_relocate_functions::gdop_lox10): Likewise.
197         (Target_sparc::Relocate::relocate): Use addend when computing
198         symbol value for R_SPARC_GOTDATA_OP*.
199
200 2015-09-07  Cary Coutant  <ccoutant@gmail.com>
201
202         PR gold/18930
203         PR gold/18886
204         * resolve.cc (Symbol::override_base): Don't convert IFUNC symbols here.
205         * symtab.cc (Symbol_table::add_from_dynobj): Convert them here instead.
206
207 2015-09-02  H.J. Lu  <hongjiu.lu@intel.com>
208
209         PR gold/18886
210         * resolve.cc (Symbol::override_base): Turn IFUNC symbols from
211         shared libraries into normal FUNC symbols.
212         * symtab.cc (Symbol_table::sized_write_symbol): Assert IFUNC
213         symbols aren't from shared libraries.
214
215 2015-09-02  Alan Modra  <amodra@gmail.com>
216
217         PR 18878
218         * powerpc.cc (Target_powerpc): Add savres_section_ and accessor.
219         (Target_powerpc::Branch_info::make_stub): Determine whether long
220         branch stub is for save/restore function.
221         (Branch_stub_ent): Add save_res_, and extra parm to constructor.
222         (Stub_table): Add need_save_res_.
223         (Stub_table:clear_stubs): Clear need_save_res_.
224         (Stub_table:set_address_and_size): Add save/restore section size.
225         (Stub_table::add_long_branch_entry): Add save_res param.  Set
226         need_save_res_, but don't add space for save/restore stubs.
227         (Stub_table::find_long_branch_entry): Return offset to local copy
228         of save/restore func.
229         (Stub_table::do_write): Don't output save/restore stubs.  Instead
230         copy the save/restore functions.
231         (Output_data_save_res:contents): New accessor.
232         (Target_powerpc::define_save_restore_funcs): Set savres_section_.
233
234 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
235
236         PR gold/18847
237         * script-sections.cc (Memory_region::set_address): New method.
238         (Script_sections::find_memory_region): Add explicit_only parameter.
239         (Output_section_definition::set_section_addresses): Handle case where
240         script specifies both address and vma region.
241         * script-sections.h (Script_sections::find_memory_region): Add
242         explicit_only parameter.
243
244 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
245
246         PR gold/18859
247         * object.cc (Input_objects::add_object): Store objects in a map,
248         indexed by soname; update as-needed flag when necessary.
249         * object.h (Object::clear_as_needed): New method.
250         (Input_objects::so_names_): Change from set to map.
251
252 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
253
254         PR gold/14746
255         * expression.cc (Expression::Expression_eval_info): Add
256         is_valid_pointer field.
257         (Expression::eval_maybe_dot): Add is_valid_pointer parameter.
258         Adjust all callers.
259         (Addr_expression::value_from_output_section): Check whether address
260         is valid.
261         * script.cc (Symbol_assignment::set_if_absolute): Defer assignment
262         if evaluation failed due to address that is not yet valid.
263         * script.h: (Expression::eval_maybe_dot): Add is_valid_pointer
264         parameter.
265
266 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
267
268         PR gold/18866
269         PR gold/18703
270         * symtab.cc (Symbol_table): Reorder conditions to avoid internal error.
271
272 2015-08-20  Alan Modra  <amodra@gmail.com>
273
274         PR gold/18846
275         * target-reloc.h (relocate_relocs <RELOC_ADJUST_FOR_SECTION_RELA>):
276         Subtract os->address() from addend.
277         * powerpc.cc (relocate_relocs): Likewise.
278
279 2015-08-12  Simon Dardis  <simon.dardis@imgtec.com>
280
281         * mips.cc (plt0_entry_o32, plt0_entry_n32, plt0_entry_n64,
282         lazy_stub_normal_1, lazy_stub_normal_1_n64,
283         lazy_stub_normal_2, lazy_stub_normal_2_n64, lazy_stub_big,
284         lazy_stub_big_n64, lazy_stub_micromips32_normal_1_n64,
285         lazy_stub_micromips32_normal_2_n64, lazy_stub_micromips32_big,
286         lazy_stub_micromips32_big_n64): Update to use 'or' for move instead
287         of 'addu/daddu'.
288
289 2015-07-27  H.J. Lu  <hongjiu.lu@intel.com>
290
291         * configure: Regenerated.
292
293 2015-07-26  Doug Kwan  <dougkwan@google.com>
294
295         * testsuite/arm_unaligned_reloc.{s,sh}: Make test less sensitive to
296           disassembler output format.
297
298 2015-07-23  Ian Coolidge  <icoolidge@google.com>
299         Plumb --pic-veneer option for gold.
300
301         * arm.cc (Reloc_stub::stub_type_for_reloc): Plumb to stub
302         generation.
303         * options.h (General_options): Add --pic-veneer option.
304
305 2015-07-22  H.J. Lu  <hongjiu.lu@intel.com>
306
307         PR gold/18663
308         * testsuite/Makefile.am (script_test_1_SOURCES): Set to
309         script_test_1a.cc script_test_1b.cc.
310         (script_test_11_r.o): Replace script_test_11.o with
311         script_test_11a.o script_test_11b.o.
312         (script_test_11.o): Removed.
313         (script_test_11a.o): New.
314         (script_test_11b.o): Likewise.
315         * testsuite/Makefile.in: Regenerated.
316         * testsuite/script_test_1.h: New file.
317         * testsuite/script_test_1b.cc: Likewise.
318         * testsuite/script_test_11.h: Likewise.
319         * testsuite/script_test_11b.c: Likewise.
320         * testsuite/script_test_1.cc: Renamed to ...
321         * testsuite/script_test_1a.cc: This.
322         Include "script_test_1.h".
323         (main): Call check_int and check_ptr.
324         * testsuite/script_test_11.c: Renamed to ...
325         * testsuite/script_test_11a.c: This.
326         Include "script_test_11.h".
327         (main): Call ptr_equal.
328
329 2015-07-22  H.J. Lu  <hongjiu.lu@intel.com>
330
331         PR gold/18628
332         * testsuite/ifuncdep2.c (global): Change protected to hidden.
333         * testsuite/ifuncmod1.c (global): Likewise.
334         * testsuite/ifuncmod5.c (global): Likewise.
335
336 2015-07-22  Alan Modra  <amodra@gmail.com>
337
338         * aarch64.cc (try_fix_erratum_843419_optimized): Warning fix.
339
340 2015-07-21  Cary Coutant  <ccoutant@gmail.com>
341
342         PR gold/18548
343         * symtab.cc (Symbol_table::do_define_in_output_data): Check for
344         forced local symbol even when oldsym != NULL.
345         (Symbol_table::do_define_in_output_segment): Likewise.
346         (Symbol_table::do_define_as_constant): Likewise.
347
348 2015-07-21  Cary Coutant  <ccoutant@gmail.com>
349
350         PR gold/18698
351         * archive.cc (Library_base::should_include_member): Don't use entry
352         point for relocatable links, or if target is not yet valid.
353         * parameters.cc (Parameters::entry): Check target_valid().
354
355 2015-07-20  Han Shen  <shenhan@google.com>
356
357         Optimize erratum 843419 fix.
358
359         * aarch64.cc (AArch64_insn_utilities::is_adr): New method.
360         (AArch64_insn_utilities::aarch64_adr_encode_imm): New method.
361         (AArch64_insn_utilities::aarch64_adrp_decode_imm): New method.
362         (E843419_stub): New sub-class of Erratum_stub.
363         (AArch64_relobj::try_fix_erratum_843419_optimized): New method.
364         (AArch64_relobj::section_needs_reloc_stub_scanning): Try optimized fix.
365         (AArch64_relobj::create_erratum_stub): Add 1 argument.
366         (Target_aarch64::scan_erratum_843419_span): Pass in adrp insn offset.
367
368 2015-07-20  Han Shen  <shenhan@google.com>
369
370         Fix arm elf header flags wrt hardfp bit.
371
372         * arm.cc (Target_arm::do_adjust_elf_header): Set flags into view.
373
374 2015-07-20  H.J. Lu  <hongjiu.lu@intel.com>
375
376         PR gold/18689
377         * layout.cc (Layout::layout): Clear the SHF_COMPRESSED flag bit
378         from input group section for relocatable link.
379         * testsuite/Makefile.am (check_SCRIPTS): Add pr18689.sh.
380         (check_DATA): Add pr18689.stdout.
381         (MOSTLYCLEANFILES): Add pr18689a.o pr18689b.o.
382         (pr18689.stdout): New rule.
383         (pr18689a.o): Likewise.
384         (pr18689b.o): Likewise.
385         (pr18689.o): Likewise.
386         * testsuite/pr18689.c: New file.
387         * testsuite/pr18689.sh: Likewise.
388         * testsuite/Makefile.in: Regenerated.
389
390 2015-07-20  Yiran Wang  <yiran@google.com>
391         Cary Coutant  <ccoutant@gmail.com>
392
393         PR gold/15574
394         * resolve.cc (Symbol_table): Remove warning about references
395         from shared objects to hidden symbols.
396         * testsuite/Makefile.am (hidden_test): Add hidden_test.syms.
397         * testsuite/Makefile.in: Regenerate.
398         * testsuite/hidden_test.sh: Check dynamic symbol table; update
399         expected error messages.
400
401 2015-07-14  H.J. Lu  <hongjiu.lu@intel.com>
402
403         * compressed_output.cc (Output_compressed_section::set_final_data_size):
404         Make --compress-debug-sections=zlib the same as
405         --compress-debug-sections=zlib-gabi.
406         * testsuite/Makefile.am (flagstest_compress_debug_sections.check):
407         Expect ".debug_.*" with the SHF_COMPRESSED bit, instead of
408         ".zdebug_".
409         * testsuite/Makefile.in: Regenerated.
410
411 2015-07-12  H.J. Lu  <hongjiu.lu@intel.com>
412
413         PR gold/18322
414         * compressed_output.cc (zlib_compress): Add argument for
415         compression header size.  Set header size to compression header
416         size if it isn't 0.  Don't write out the zlib header here.
417         (Output_compressed_section::set_final_data_size): Support
418         zlib-gnu and zlib-gabi compressions.  Pass compression header
419         size to zlib_compress and write out compression header.  Set
420         the SHF_COMPRESSED bit for zlib-gabi compression.  Otherwise
421         clear the SHF_COMPRESSED bit
422         * options.h (compress_debug_sections): Add zlib-gnu and
423         zlib-gabi.
424         * output.h (Output_section::set_flags): New.
425         * testsuite/Makefile.am (check_PROGRAMS): Add
426         flagstest_compress_debug_sections_none,
427         flagstest_compress_debug_sections_gnu and
428         flagstest_compress_debug_sections_gabi.
429         (check_DATA): Add flagstest_compress_debug_sections_none.stdout.
430         flagstest_compress_debug_sections.stdout,
431         flagstest_compress_debug_sections.cmp,
432         flagstest_compress_debug_sections.check,
433         flagstest_compress_debug_sections_gnu.stdout,
434         flagstest_compress_debug_sections_gnu.cmp,
435         flagstest_compress_debug_sections_gnu.check,
436         flagstest_compress_debug_sections_gabi.stdout,
437         flagstest_compress_debug_sections_gabi.cmp and
438         flagstest_compress_debug_sections_gabi.check.
439         (flagstest_compress_debug_sections_none): New.
440         (flagstest_compress_debug_sections_none.stdout): Likewise.
441         (flagstest_compress_debug_sections.stdout): Likewise.
442         (flagstest_compress_debug_sections.check): Likewise.
443         (flagstest_compress_debug_sections.cmp): Likewise.
444         (flagstest_compress_debug_sections_gnu): Likewise.
445         (flagstest_compress_debug_sections_gnu.stdout): Likewise.
446         (flagstest_compress_debug_sections_gnu.check): Likewise.
447         (flagstest_compress_debug_sections_gnu.cmp): Likewise.
448         (flagstest_compress_debug_sections_gabi): Likewise.
449         (flagstest_compress_debug_sections_gabi.stdout): Likewise.
450         (flagstest_compress_debug_sections_gnu.check): Likewise.
451         (flagstest_compress_debug_sections_gnu.cmp): Likewise.
452         * testsuite/Makefile.in: Regenerated.
453
454 2015-07-12  H.J. Lu  <hongjiu.lu@intel.com>
455
456         PR gold/18321
457         * compressed_output.h (decompress_input_section): Add arguments
458         for ELF class, big endian and sh_flags.
459         * compressed_output.cc (decompress_input_section): Likewise.
460         Support the SHF_COMPRESSED section.
461         * dynobj.h (Dynobj): Add elfsize and is_big_endian member
462         functions.
463         * plugin.h (Pluginobj): Likewise.
464         * layout.cc (Layout::get_output_section_flags): Also clear the
465         SHF_COMPRESSED bit.
466         * object.h (Compressed_section_info): Add flag to store sh_flags.
467         (Object): Add pure virtual elfsize and is_big_endian member
468         functions.
469         * object.cc (need_decompressed_section): Don't skip the ".zdebug"
470         prefix here.
471         (build_compressed_section_map): Check SHF_COMPRESSED for
472         uncompressed size.  Store sh_flags in Compressed_section_info.
473         Pass size, big_endian and sh_flags to decompress_input_section.
474         Skip the ".debug"/".zdebug" prefix when passing section name to
475         need_decompressed_section.
476         (Sized_relobj_file<size, big_endian>::do_find_special_section):
477         Don't check ".zdebug_*" sections.
478         (Object::decompressed_section_contents): Pass ELF class, big
479         endian and sh_flags to decompress_input_section.
480         * reloc.cc (Sized_relobj_file<size, big_endian>::write_sections):
481         Likewise.
482         * testsuite/Makefile.am (check_DATA): Add
483         debug_msg_cdebug_gabi.err and gdb_index_test_2_gabi.stdout.
484         (MOSTLYCLEANFILES): Add debug_msg_cdebug_gabi.err and
485         gdb_index_test_2_gabi.stdout.
486         (debug_msg_cdebug_gabi.o): New.
487         (odr_violation1_cdebug_gabi.o): Likewise.
488         (odr_violation2_cdebug_gabi.o): Likewise.
489         (debug_msg_cdebug_gabi.err): Likewise.
490         (check_SCRIPTS): Add gdb_index_test_2_gabi.sh.
491         (gdb_index_test_cdebug_gabi.o): Likewise.
492         (gdb_index_test_2_gabi): Likewise.
493         (gdb_index_test_2_gabi.stdout): Likewise.
494         * testsuite/gdb_index_test_2_gabi.sh: New file.
495         * testsuite/Makefile.in: Regenerated.
496
497 2015-07-09  Han Shen  <shenhan@google.com>
498
499         Use "gold_info" instead of "gold_warning" for erratum fix.
500
501         * aarch64.cc (Target_aarch64::scan_erratum_843419_span): Use
502         'gold_info'.
503         (Target_aarch64::scan_erratum_835769_span): USe 'gold_info'.
504
505 2015-07-09  Han Shen  <shenhan@google.com>
506
507         Drop missing symbol warning for arm/aarch64.
508
509         * aarch64.cc (AArch64_relobj::scan_errata): Drop missing symbol warning.
510         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Drop missing
511         symbol warning.
512
513 2015-07-07  Han Shen  <shenhan@google.com>
514
515         Make gold aarch64 accept long form of mapping symbols.
516
517         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Make legal
518         of mapping symbols.
519
520 2015-06-29  Doug Kwan  <dougkwan@google.com>
521
522         * testsuite/arm_bl_out_of_range.s: Align stub table so that it appears
523           at address expected by test.
524         * testsuite/arm_cortex_a8_b.s: Ditto.
525         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
526         * testsuite/arm_cortex_a8_bl.s: Ditto.
527         * testsuite/arm_cortex_a8_blx.s: Ditto.
528         * testsuite/arm_cortex_a8_local.s: Ditto.
529         * testsuite/arm_fix_v4bx.s: Ditto.
530         * testsuite/arm_unaligned_reloc.s: Ditto.
531         * testsuite/thumb_bl_out_of_range.s: Ditto.
532         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
533         * testsuite/thumb_blx_out_of_range.s: Ditto.
534
535 2015-06-29  Han Shen  <shenhan@google.com>
536
537         Patch for erratum 843419 internal error.
538
539         * aarch64.cc (Erratum_stub::Insn_utilities): New typedef.
540         (Erratum_stub::update_erratum_insn): New method.
541         (Stub_table::relocate_stubs): Modified to place relocated insn.
542         (AArch64_relobj::fix_errata): Modified gold_assert.
543
544 2015-06-12  Han Shen  <shenhan@google.com>
545
546         Fix erratum 835769.
547
548         * aarch64.cc (AArch64_insn_utilities::BYTES_PER_INSN): Move
549         defintion outside class definition.
550         (AArch64_insn_utilities::AARCH64_ZR): New static constant.
551         (AArch64_insn_utilities::aarch64_op31): New member.
552         (AArch64_insn_utilities::aarch64_ra): New member.
553         (AArch64_insn_utilities::aarch64_mac): New member.
554         (AArch64_insn_utilities::aarch64_mlxl): New member.
555         (ST_E_835769): New global enum member.
556         (Stub_table::relocate_stubs): Add 835769 handler.
557         (Stub_template_repertoire::Stub_template_repertoire): Install new
558         stub type.
559         (AArch64_relobj::scan_errata): This func is renamed from
560         scan_erratum_843419.
561         (AArch64_relobj::do_count_local_symbols): Add 835769 handler.
562         (AArch64_relobj::do_relocate_sections): Add 835769 handler.
563         (AArch64_relobj::scan_sections_for_stubs): Add 835769 handler.
564         (Target_aarch64::scan_erratum_835769_span): New method.
565         (Target_aarch64::create_erratum_stub): New method.
566         (Target_aarch64::is_erratum_835769_sequence): New method.
567         (Target_aarch64::scan_erratum_843419_sequence): Move part of the
568         code into create_erratum_stub.
569         * options.h (fix_cortex_a53_835769): New option.
570
571 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
572
573         * aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
574         outside class body.
575         (Reloc_stub::STUB_ADDR_ALIGN): Likewise.
576
577 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
578
579         PR gold/17731
580         * layout.cc (corresponding_uncompressed_section_name): New function.
581         (Layout::choose_output_section): Call it.
582         * layout.h (corresponding_uncompressed_section_name): New function.
583         * script-sections.cc (Input_section_info::set_section_name): Check
584         for compressed debug section (.zdebug style).
585
586 2015-06-11  Jing Yu  <jingyu@google.com>
587
588         * testsuite/Makefile.am: Add -O0 for script_test_12 test.
589         * testsuite/Makefile.in: Regenerate.
590
591 2015-06-11  Davide Italiano  <dccitaliano@gmail.com>
592
593         * gold.h (is_cident): Correct typo.
594
595 2015-06-10  Han Shen  <shenhan@google.com>
596         Patch for erratum-843419 (2 of 2 - fix erratum occurrences).
597
598         Now fixing for 843419 is fully functional.
599
600         The first part of the erratum fix CL is here -
601         https://sourceware.org/ml/binutils/2015-04/msg00229.html
602
603         * aarch64.cc(global enum): New constants representing stub types.
604         (Stub_template): New POD struct.
605         (Stub_template_repertoire): New class.
606         (Stub_base): New class.
607         (Erratum_stub): New class.
608         (Reloc_stub): Refactored to be a subclass of Stub_base.
609         (Reloc_stub::Stub_type): Removed.
610         (Reloc_stub::offset): Moved to Stub_base.
611         (Reloc_stub::set_offset): Moved to Stub_base.
612         (Reloc_stub::destination_address): Moved to Stub_base.
613         (Reloc_stub::set_destination_address): Moved to Stub_base.
614         (Reloc_stub::reset_destination_address): Moved to Stub_base.
615         (Reloc_stub::stub_type): Renamed and moved to Stub_base.
616         (Reloc_stub::stub_size): Renamed and moved to Stub_base.
617         (Reloc_stub::stub_insns): Renamed and moved to Stub_base.
618         (Reloc_stub::write): Moved to Stub_base.
619         (Reloc_stub::invalid_offset): Moved to Stub_base.
620         (Reloc_stub::invalid_address): Moved to Stub_base.
621         (Reloc_stub::stub_type_): Renamed and moved to Stub_base.
622         (Reloc_stub::stub_insns_): Moved to Stub_base.
623         (Reloc_stub::offset_): Moved to Stub_base.
624         (Reloc_stub::destination_address_): Moved to Stub_base.
625         (Stub_table::The_aarch64_relobj): New typedef.
626         (Stub_table::The_erratum_stub): New typedef.
627         (Stub_table::The_erratum_stub_less): New typedef.
628         (Stub_table::The_erratum_stub_set): New typedef.
629         (Stub_table::The_erratum_stub_set_iter): New typedef.
630         (Stub_table::empty): Added emptiness testing for erratum stubs.
631         (Stub_table::add_erratum_stub): New method to add an erratum stub.
632         (Stub_table::find_erratum_stub): New method.
633         (Stub_table::find_erratum_stubs_for_input_section): New method.
634         (Stub_table::erratum_stub_address): New method.
635         (Stub_table::update_date_size_changed_p): Modified to handle erratum stubs.
636         (Stub_table::do_addralign): Modified to handle erratum stubs.
637         (Stub_table::erratum_stubs_): New member.
638         (Stub_table::erratum_stub_size_): New member.
639         (Stub_table::relocate_stubs): Modified to handle erratum stubs.
640         (Stub_table::do_write): Modified to handle erratum stubs.
641         (AArch64_relobj::The_erratum_stub): New typedef.
642         (AArch64_relobj::Erratum_stub_set_iter): New typedef.
643         (AArch64_relobj::fix_errata): New method.
644         (Target_aarch64::The_reloc_stub_type): Removed.
645         (Target_aarch64::The_erratum_stub): New typede.
646         (AArch64_relocate_functions::construct_b): New method.
647
648 2015-06-08  Nick Clifton  <nickc@redhat.com>
649
650         * po/fr.po: New French Translation.
651
652 2015-06-07  Cary Coutant  <ccoutant@gmail.com>
653
654         PR gold/18288
655         * resolve.cc (symbol_to_bits): Remove type parameter; adjust all
656         callers. Don't use STT_COMMON to check for common symbols.
657         (Symbol_table::resolve): Warn if relocatable object has STT_COMMON
658         symbol that's not in a common section.
659         * symtab.h (Symbol::is_common): Don't use STT_COMMON to check for
660         common symbols.
661
662 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
663
664         PR gold/18200
665         * Makefile.am (diststuff): Add target.
666         * Makefile.in: Regenerate.
667
668 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
669
670         PR gold/17498
671         * object.cc (Sized_relobj_file::do_count_local_symbols): Discard
672         temporary locals in merge sections.
673         * options.cc (General_options::parse_discard_all): New method.
674         (General_options::parse_discard_locals): New method.
675         (General_options::parse_discard_none): New method.
676         (General_options::General_options): Initialize discard_locals_.
677         * options.h (--discard-all): Convert to special option.
678         (--discard-locals): Likewise.
679         (--discard-none): New option.
680         (General_options::discard_all): New method.
681         (General_options::discard_locals): New method.
682         (General_options::discard_sec_merge): New method.
683         (General_options::Discard_locals): New enum.
684         (General_options::discard_locals_): New data member.
685
686 2015-06-03  Cary Coutant  <cary@google.com>
687
688         * script-sections.cc (Script_sections::Script_sections): Initialize
689         segments_created_.
690         (Script_sections::create_note_and_tls_segments): Set flag when
691         segments are created.
692         (Script_sections::expected_segment_count): Count PT_INTERP.
693         (Script_sections::attach_sections_using_phdrs_clause): Set flag when
694         segments are created.
695         * script-sections.h (Script_sections::segments_created_): New data
696         member.
697
698 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
699
700         PR gold/15370
701         * script-sections.cc
702         (Output_section_element_input::set_section_addresses): When there
703         are several patterns with no sort spec, put all sections in the same
704         bin.
705         * testsuite/Makefile.am (script_test_12): New testcase.
706         (script_test_12i): New testcase.
707         * testsuite/Makefile.in: Regenerate.
708         * testsuite/script_test_12.t: New test linker script.
709         * testsuite/script_test_12i.t: New test linker script.
710         * testsuite/script_test_12a.c: New test source file.
711         * testsuite/script_test_12b.c: New test source file.
712
713 2015-06-02  Cary Coutant  <ccoutant@gmail.com>
714
715         * nacl.h (Sniff_file): Switch parameters to get_view to get an
716         aligned view.
717
718 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
719
720         PR gold/17819
721         * gold.cc (queue_final_tasks): When --build-id=tree, queue a
722         separate task to schedule the build id computation.
723         * layout.cc (Hash_task::Hash_task): Remove build_id_blocker,
724         add Output_file and offset.
725         (Hash_task::run): Get and release the input views.
726         (Hash_task::is_runnable): Always return NULL (always runnable).
727         (Layout::queue_build_id_tasks): Remove.
728         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
729         parameters; use them instead of class members.
730         (Build_id_task_runner::run): New function.
731         (Close_task_runner::run): Pass array_of_hashes and size_of_hashes
732         to write_build_id.
733         * layout.h (Layout::queue_build_id_tasks): Remove.
734         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
735         parameters.
736         (Layout::array_of_hashes_): Remove.
737         (Layout::size_of_array_of_hashes_): Remove.
738         (Layout::input_view_): Remove.
739         (Build_id_task_runner): New class.
740         (Close_task_runner::Close_task_runner): Add array_of_hashes and
741         size_of_hashes parameters.
742         (Close_task_runner::array_of_hashes_): New data member.
743         (Close_task_runner::size_of_hashes_): New data member.
744         * testsuite/Makefile.am
745         (flagstest_compress_debug_sections_and_build_id_tree): New test.
746         * testsuite/Makefile.in: Regenerate.
747
748 2015-06-01  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
749
750         * merge.cc (get_input_merge_map): Update for data structure change.
751         (get_or_make_input_merge_map): Update for data structure change.
752         * merge.h (Object_merge_map): Use a std::vector<std::pair>> instead of
753         a std::map. Remove first_shnum_, first_map_, second_shnum_, second_map_.
754
755 2015-05-16  Alan Modra  <amodra@gmail.com>
756
757         * reloc.cc (Sized_relobj_file::find_functions): Use function_location.
758         * powerpc.cc (Target_powerpc::do_calls_non_split): New function.
759         (addi_12_1, addis_2_12, addis_12_1, cmpld_7_12_0): New constants.
760         (lis_0): Rename from lis_0_0.
761
762 2015-04-29  Cary Coutant  <cary@google.com>
763             Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
764
765         * gc.h (Garbage_collection::is_section_garbage): Change Object*
766         to Relobj*.
767         (Garbage_collection::add_reference): Likewise.
768         (Garbage_collection::gc_process_relocs): Likewise. Don't push
769         object/shndx pair onto *secvec for dynamic objects. Don't follow
770         relocations pointing to dynamic objects for GC.
771         * icf.cc (Icf::find_identical_sections): Change Object* to Relobj*.
772         (Icf::unfold_section): Likewise.
773         (Icf::is_section_folded): Likewise.
774         (Icf::get_folded_section): Likewise.
775         * icf.h: (Icf::get_folded_section): Likewise.
776         (Icf::unfold_section): Likewise.
777         (Icf::is_section_folded): Likewise.
778         (Icf::section_has_function_pointers): Likewise.
779         (Icf::set_section_has_function_pointers): Likewise.
780         * object.h (Section_id): Likewise.
781         (Const_section_id): Likewise.
782         * output.cc (Output_section::update_section_layout): Likewise.
783         * output.h: (Output_section_lookup_maps::find_relaxed_input_section):
784         Likewise.
785         * plugin.cc (update_section_order): Likewise.
786         (unique_segment_for_sections): Likewise.
787         * powerpc.cc (Powerpc_relobj::add_reference): Likewise.
788         (Target_powerpc::do_gc_add_reference): Likewise.
789         (Target_powerpc::gc_process_relocs): Likewise.
790         (Target_powerpc::do_gc_add_reference): Likewise.
791         * symtab.cc (Symbol_table::is_section_folded): Likewise.
792         (Symbol_table::gc_mark_symbol): Likewise.
793         * symtab.h: (Symbol_table::is_section_folded): Likewise.
794         * target.h: (Sized_target::gc_add_reference): Likewise.
795         (Sized_target::do_gc_add_reference): Likewise.
796
797 2015-04-29  Nick Clifton  <nickc@redhat.com>
798
799         * po/fi.po: Updated Finnish translation.
800
801 2015-04-28  Alan Modra  <amodra@gmail.com>
802
803         * powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather
804         than unsigned int for find_global_entry result temp.  Compare
805         against invalid_address.
806         (Target_powerpc::do_plt_address_for_global): Likewise.
807         (Target_powerpc::Relocate::relocate): Likewise.  Don't assert
808         on plt call stub existence for debug info.  Do assert for plt
809         and global entry stub existence if an alloc section.
810
811 2015-04-28  Alan Modra  <amodra@gmail.com>
812
813         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert
814         on missing global entry stub due to bogus debug info.
815
816 2015-04-27  Han Shen  <shenhan@google.com>
817
818         * options.h (--fix-cortex-a53-843419): Rename option.
819         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Use renamed
820         option.
821         (AArch64_relobj::scan_sections_for_stubs): Use renamed option.
822
823 2015-04-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
824
825         PR gold/18327
826         * output.cc (Output_section::is_input_address_mapped): Assume a missing
827         entry is mapped.
828         * testsuite/Makefile.am: Add the eh_test test.
829         * testsuite/Makefile.in: Regenerate.
830         * testsuite/eh_test_a.cc: New test.
831         * testsuite/eh_test_b.cc: New test.
832
833 2015-04-23  Sriraman Tallam  <tmsriram@google.com>
834
835         * options.h (--weak-unresolved-symbols): New option.
836         * symtab.cc (Symbol_table::sized_write_globals): Change symbol
837         binding to weak with new option.
838         * symtab.h (is_weak_undefined): Check for new option.
839         (is_strong_undefined): Check for new option.
840         * testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
841         * testsuite/Makefile.in: Regenerate.
842         * testsuite/weak_unresolved_symbols_test.cc: New file.
843
844 2015-04-20  Ian Coolidge  <icoolidge@google.com>
845
846         * symtab.cc (Symbol::should_add_dynsym_entry): Return true for
847         GNU_UNIQUE.
848
849 2015-04-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
850
851         * gc.cc (Garbage_collection::do_transitive_closure): Use back and
852         push_back.
853         * gc.h (Garbage_collection): Use a std::vector instead of a std::queue.
854         * object.cc (Sized_relobj_file::do_layout): Use push_back.
855         * powerpc.cc (process_gc_mark): Use push_back.
856         (Target_powerpc::do_gc_mark_symbol): Use push_back.
857         * symtab.cc (Symbol_table::gc_mark_symbol): Use push_back.
858
859 2015-04-16  Han Shen  <shenhan@google.com>
860
861         * aarch64.cc (AArch64_insn_utilities): New utility class.
862         (AArch64_relobj::Mapping_symbol_position): New struct.
863         (AArch64_relobj::Mapping_symbol_info): New typedef.
864         (AArch64_relobj::do_count_local_symbols): New function overriding
865         parent's implementation.
866         (AArch64_relobj::mapping_symbol_info_): New member
867         (AArch64_relobj::scan_erratum_843419): New method.
868         (Target_aarch64::scan_erratum_843419_span): New method.
869         (Target_aarch64::is_erratum_843419_sequence): New method.
870         * options.h (fix_cortex_a53): New option.
871
872 2015-04-09  Cary Coutant  <ccoutant@google.com>
873
874         * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
875         in a PIE link.
876         * testsuite/Makefile.am (tls_pie_test.sh): New test.
877         * testsuite/Makefile.in: Regenerate.
878         * testsuite/tls_pie_test.sh: New.
879
880 2015-04-09  Cary Coutant  <ccoutant@google.com>
881
882         * debug.h (DEBUG_LOCATION): New.
883         (DEBUG_ALL): Include DEBUG_LOCATION.
884         (debug_string_to_enum): Add DEBUG_LOCATION.
885         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
886         output to print correct context.
887         (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
888         up to 4 more locations at the beginning of the function.
889         * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
890         result before sorting list of line numbers.
891         * testsuite/debug_msg.sh: Allow range of line numbers for
892         canonical results on optimized code.
893
894 2015-04-07  HC Yen <hc.yen@mediatek.com>
895
896         Add AArch32 support for gold linker.
897         gold/
898         * arm.cc: Add V8 arch combine table.
899
900 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
901
902         * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
903
904 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
905
906         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
907         to find by using the return value of insert.
908
909 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
910
911         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
912         constructor call.
913
914 2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>
915
916         PR gold/17641
917         * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
918         (Target_x86_64::Scan::local): Don't create GOT entry, when we
919         can convert mov to lea.
920         (Target_x86_64::Scan::global): Ditto.
921         (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
922         %reg to lea foo(%rip), %reg if possible.
923         * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
924         * testsuite/x86_64_mov_to_lea1.s: New.
925         * testsuite/x86_64_mov_to_lea2.s: Ditto.
926         * testsuite/x86_64_mov_to_lea3.s: Ditto.
927         * testsuite/x86_64_mov_to_lea4.s: Ditto.
928         * testsuite/x86_64_mov_to_lea.sh: Ditto.
929
930 2015-04-02  H.J. Lu  <hongjiu.lu@intel.com>
931
932         * configure: Regenerated.
933
934 2015-04-01  Ilya Tocar  <ilya.tocar@intel.com>
935
936         PR gold/17640
937         * i386.cc (Target_i386::can_convert_mov_to_lea): New.
938         (Target_i386::Scan::local): Don't create GOT entry, when we
939         can convert GOT to GOTOFF.
940         (Target_i386::Scan::global): Ditto.
941         (Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
942         lea foo@GOTOFF(%reg), %reg if possible.
943         * testsuite/Makefile.am (i386_mov_to_lea): New test.
944         * testsuite/i386_mov_to_lea1.s: New.
945         * testsuite/i386_mov_to_lea2.s: Ditto.
946         * testsuite/i386_mov_to_lea3.s: Ditto.
947         * testsuite/i386_mov_to_lea4.s: Ditto.
948         * testsuite/i386_mov_to_lea5.s: Ditto.
949         * testsuite/i386_mov_to_lea.sh: Ditto.
950
951 2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>
952
953         * Makefile.am (ZLIB): New.
954         (ZLIBINC): Likewise.
955         (AM_CFLAGS): Add $(ZLIBINC).
956         (AM_CXXFLAGS): Likewise.
957         (ldadd_varldadd_var): Add $(ZLIB).
958         (incremental_dump_LDADD): Likewise.
959         (dwp_LDADD): Likewise.
960         * compressed_output.cc: Don't check HAVE_ZLIB_H to include
961         <zlib.h>.
962         (zlib_compress): Don't check HAVE_ZLIB_H.
963         (zlib_decompress): Likewise.
964         * options.h (compress_debug_sections): Likewise.
965         * configure.ac (AM_CONDITIONAL): Removed.
966         * testsuite/Makefile.am (ZLIB): New.
967         (LDADD): Add $(ZLIB).
968         Don't check HAVE_ZLIB.
969         * Makefile.in: Regenerated.
970         * config.in: Likewise.
971         * configure: Likewise.
972         * testsuite/Makefile.in: Likewise.
973
974 2015-03-30  Jing Yu  <jingyu@google.com>
975
976         * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
977         TLSLD_ADD_DTPREL_LO12_NC.
978         * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
979         _TLS_MODULE_BASE_ point to the start of tls segment.
980         (Target_aarch64::optimize_tls_reloc): Add cases for
981         R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
982         R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
983         (Target_aarch64::Scan::local): Likewise.
984         (Target_aarch64::Scan::global): Likewise.
985         (Target_aarch64::Relocate::relocate): Likewise.
986         (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
987         subtracting tls segment size from symbol value for TLSLD_*_DTPREL
988         relocations.
989
990 2015-03-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
991
992         * merge.cc (Object_merge_map::add_mapping): call
993         Object_merge_map::Input_merge_map::add_mapping.
994         (Object_merge_map::Input_merge_map::add_mapping): New.
995         (Output_merge_data::do_add_input_section): Call
996         get_or_make_input_merge_map before a loop.
997         (Output_merge_string<Char_type>::finalize_merged_data): Call
998         get_or_make_input_merge_map before a loop.
999         * merge.h (Object_merge_map): Make Input_merge_map public.
1000         * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
1001         (Relobj::get_or_create_merge_map): New.
1002         * object.h (Relobj::get_or_create_merge_map): New.
1003
1004 2015-03-24  Alan Modra  <amodra@gmail.com>
1005
1006         PR 18147
1007         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
1008         relocation errors for branches to strong undefined symbols.
1009
1010 2015-03-23  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1011
1012         * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
1013         (Object_merge_map::is_merge_section_for): Remove.
1014         (Object_merge_map::find_merge_section): New.
1015         * merge.h (Object_merge_map::is_merge_section_for): Remove.
1016         (Object_merge_map::find_merge_section): New.
1017         (Object_merge_map::get_input_merge_map): Add a const version.
1018         * object.cc (Relobj::is_merge_section_for): Remove.
1019         (Relobj::find_merge_section): New.
1020         * object.h (Relobj::is_merge_section_for): Remove.
1021         (Relobj::find_merge_section): New.
1022         * output.cc
1023         (Output_section::Input_section::is_merge_section_for): Remove.
1024         (Output_section::add_merge_input_section): Don't call
1025         add_merge_input_section.
1026         (Output_section::find_merge_section): Return const. Use
1027         object->find_merge_section.
1028         (Output_section::build_lookup_maps): Don't build a map for
1029         merge sections.
1030         (Output_section::is_input_address_mapped): Return false if
1031         section is not found.
1032         (Output_section::find_starting_output_address): Use
1033         find_merge_section instead of is_merge_section_for.
1034         (Output_section::add_script_input_section):  Don't build a map for
1035         merge sections.
1036         * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
1037         (Output_section_lookup_maps::find_merge_section): Remove.
1038         (Output_section_lookup_maps::add_merge_input_section) Remove.
1039         (Output_section::find_merge_section): Return const.
1040
1041 2015-03-22  Cary Coutant  <cary@google.com>
1042
1043         PR gold/18106
1044         * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
1045         non-SIB form of lea, with nop after the call.
1046
1047 2015-03-21  Cary Coutant  <cary@google.com>
1048
1049         PR gold/14217
1050         * output.cc (Output_segment::is_first_section_relro): Don't ignore
1051         .tdata section.
1052         (Output_segment::set_section_addresses): Don't align size of relro
1053         segment for .tbss.
1054
1055 2015-03-21  Cary Coutant  <cary@google.com>
1056
1057         PR gold/18010
1058         * stringpool.cc (Stringpool_template): Don't optimize if section
1059         alignment is greater than sizeof(char).
1060
1061 2015-03-21  Cary Coutant  <cary@google.com>
1062
1063         PR gold/18048
1064         * script-c.h (script_include_directive): Add first_token parameter.
1065         * script.cc (script_include_directive): Add first_token parameter, and
1066         pass it to read_script_file.
1067         * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
1068         (PARSING_MEMORY_DEF): New tokens.
1069         (top): Add new productions for INCLUDE files.
1070         (file_cmd): Replace file_or_sections_cmd with copy of its productions.
1071         Pass PARSING_LINKER_SCRIPT to script_include_directive.
1072         (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
1073         (section_cmd): Pass PARSING_SECTION_CMDS.
1074         (file_or_sections_cmd): Remove.
1075         (memory_def): Pass PARSING_MEMORY_DEF.
1076         * testsuite/Makefile.am (memory_test_2): New test.
1077         * testsuite/Makefile.in: Regenerate.
1078         * testsuite/memory_test_inc.t: New script file.
1079         * testsuite/memory_test_inc_1.t.src: New script file.
1080         * testsuite/memory_test_inc_2.t.src: New script file.
1081         * testsuite/memory_test_inc_3.t.src: New script file.
1082
1083 2015-03-21  Cary Coutant  <cary@google.com>
1084
1085         * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
1086         (Sized_relobj_dwo::setup): Build compressed section map.
1087         (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
1088         * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
1089         section map.
1090         * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
1091         compressed_sections_ field.
1092         (build_compressed_section_map): Take Object instead of
1093         Sized_relobj_file parameter; add decompress_if_needed parameter.
1094         (Sized_relobj_file::do_find_special_sections): Store compressed
1095         section map in parent Object.
1096         (Sized_relobj_file::do_decompressed_section_contents): Move
1097         implementation to Object::decompressed_section_contents.
1098         (Sized_relobj_file::do_discard_decompressed_sections): Move
1099         implementation to Object::discard_decompressed_sections.
1100         * object.h (build_compressed_section_map): Declare.
1101         (Object::Object): Add compressed_sections_ field.
1102         (Object::section_is_compressed): Move implementation here.
1103         (Object::decompressed_section_contents): De-virtualize.
1104         (Object::discard_decompressed_sections): De-virtualize.
1105         (Object::do_section_is_compressed): Delete.
1106         (Object::do_decompressed_section_contents): Delete.
1107         (Object::set_compressed_sections): New method.
1108         (Object::compressed_sections): New method.
1109         (Object::compressed_sections_): New data member.
1110         (Compressed_section_info, Compressed_section_map): Move to top of file.
1111         (Sized_relobj_file::do_section_is_compressed): Delete.
1112         (Sized_relobj_file::do_decompressed_section_contents): Delete.
1113         (Sized_relobj_file::do_discard_decompressed_sections): Delete.
1114         (Sized_relobj_file::compressed_sections_): Move to Object class.
1115
1116 2015-03-21  Cary Coutant  <ccoutant@google.com>
1117
1118         PR gold/18152
1119         * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
1120         deferred objects.
1121
1122 2015-03-11  Cary Coutant  <ccoutant@google.com>
1123
1124         * options.cc (General_options::finalize): Don't allow -z relro
1125         with incremental linking.
1126         * testsuite/Makefile.am (incremental_test): Add -z norelro.
1127         (incremental_test_2): Likewise.
1128         (incremental_test_3): Likewise.
1129         (incremental_test_4): Likewise.
1130         (incremental_test_5): Likewise.
1131         (incremental_test_6): Likewise.
1132         (incremental_copy_test): Likewise.
1133         (incremental_common_test_1): Likewise.
1134         (incremental_comdat_test_1): Likewise.
1135         * testsuite/Makefile.in: Regenerate.
1136
1137 2015-03-09  Cary Coutant  <ccoutant@google.com>
1138
1139         PR gold/14675
1140         * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
1141         return enum indicating whether .eh_frame section is empty, optimizable,
1142         unrecognized, or an end marker. Adjust explicit instantiations.
1143         * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
1144         (Eh_frame::add_ehframe_input_section): Change return type.
1145         * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
1146         * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
1147         to the .eh_frame output section until we see the end marker.
1148         (Layout::finalize_eh_frame_section): New.
1149         * layout.h: (Layout::finalize_eh_frame_section): New.
1150
1151 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
1152
1153         * output.cc (Relobj::initialize_input_to_output_map<size>):
1154         Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
1155
1156 2015-03-04  Cary Coutant  <ccoutant@google.com>
1157
1158         * parameters.cc (Parameters::set_target_once): Call
1159         Target::select_as_default_target just once from here...
1160         (set_parameters_target): ...instead of from here.
1161
1162 2015-03-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1163
1164         * ehframe.cc (Cie::set_output_offset): Pass in and use a
1165         Output_section_data instead of a Merge_map.
1166         (Eh_frame::Eh_frame): Don't initialize merge_map_.
1167         (Eh_frame::read_cie): Use add_merge_mapping instead of
1168         Merge_map::add_mapping.
1169         (Eh_frame::read_fde): Ditto.
1170         (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
1171         (Eh_frame::do_output_offset): Use merge_output_offset istead of
1172         merge_map_->get_output_offset.
1173         (Eh_frame::do_is_merge_section_for): Delete.
1174         * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
1175         instead of a Merge_map.
1176         (Cie::set_output_offset): Pass in a Output_section_data instead of a
1177         Merge_map.
1178         (Eh_frame::do_is_merge_section_for): Delete.
1179         (Eh_frame::merge_map_): Delete.
1180         * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
1181         and use a Output_section_data instead of a Merge_map.
1182         (Object_merge_map::add_mapping): Ditto.
1183         (Object_merge_map::get_output_offset): Remove the merge_map argument.
1184         (Object_merge_map::is_merge_section_for): Pass in and use a
1185         Output_section_data instead of a Merge_map.
1186         (Merge_map): Delete.
1187         (Output_merge_base::do_output_offset): Use merge_output_offset instead
1188         of merge_map_.get_output_offset.
1189         (Output_merge_base::do_is_merge_section_for): Delete.
1190         (Output_merge_data::do_add_input_section): Use
1191         object->add_merge_mapping instead of add_mapping.
1192         (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
1193         * merge.h (Merge_map): Delete forward declaration.
1194         (Object_merge_map::add_mapping): Pass in and use a Output_section_data
1195         instead of a Merge_map.
1196         (Object_merge_map::get_output_offset): Remove the merge_map argument.
1197         (Object_merge_map::is_merge_section_for): Pass in and use a
1198         Output_section_data instead of a Merge_map.
1199         (Input_merge_map::Object_merge_map::merge_map): Replace with
1200         output_data.
1201         (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
1202         Output_section_data instead of a Merge_map.
1203         (Merge_map): Delete.
1204         (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
1205         (Output_merge_base::do_is_merge_section_for): Delete.
1206         (Output_merge_base::add_mapping): Delete.
1207         (Output_merge_base::merge_map_): Delete.
1208         * object.cc (Relobj::initialize_input_to_output_map): New.
1209         (Relobj::initialize_input_to_output_map): New.
1210         (Relobj::merge_output_offset): New.
1211         (Relobj::is_merge_section_for): New.
1212         (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
1213         bits.
1214         * object.h (Relobj::merge_map): Delete.
1215         (initialize_input_to_output_map): New.
1216         (set_merge_map): Delete.
1217         (add_merge_mapping): New.
1218         (merge_output_offset): New.
1219         (is_merge_section_for): New.
1220         * output.cc (Output_section::Input_section::is_merge_section_for):
1221         Use object->is_merge_section_for.
1222         * output.h (Output_section_data::is_merge_section_for): Delete.
1223         (Output_section_data::do_is_merge_section_for): Delete.
1224         * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
1225         Use object->initialize_input_to_output_map.
1226         (Merged_symbol_value<size>::value_from_output_section): Use
1227         object->merge_output_offset.
1228
1229 2015-03-02  Peter Collingbourne  <pcc@google.com>
1230             Cary Coutant  <ccoutant@google.com>
1231
1232         * output.cc (Output_section::add_merge_input_section): Do not
1233         attempt to merge sections with an entsize of 0.
1234
1235 2015-03-02  Khem Raj  <raj.khem@gmail.com>
1236
1237         * attributes.h (class Output_attributes_section_data ): Add
1238         do_print_to_mapfile function.
1239
1240 2015-02-24  Alan Modra  <amodra@gmail.com>
1241
1242         PR 18010
1243         * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
1244         complain if value is not a multiple of four.
1245         (Target_powerpc::Relocate::relocate): Correct handling of
1246         R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
1247
1248 2015-02-21  H.J. Lu  <hongjiu.lu@intel.com>
1249
1250         * configure.ac (default_size): Set to 32 for x32.
1251         * configure: Regenerated.
1252
1253 2015-02-18  Alan Modra  <amodra@gmail.com>
1254
1255         PR 17954
1256         * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
1257         visibility.
1258
1259 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1260
1261         * gc.h (Garbage_collection::add_reference): Don't use find.
1262
1263 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1264
1265         * object.cc (write_local_symbols): avoid std::vector copy.
1266
1267 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1268
1269         * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
1270
1271 2015-02-09  Mark Wielaard  <mjw@redhat.com>
1272
1273         * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
1274         DW_LANG_Fortran03 and DW_LANG_Fortran08.
1275
1276 2015-02-16  Cary Coutant  <ccoutant@google.com>
1277
1278         PR gold/13577
1279         PR gold/16992
1280         * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
1281         DF_SYMBOLIC if --dynamic-list option is used.
1282         * options.cc (General_options::finalize): --dynamic-list is not
1283         mutually exclusive with -Bsymbolic.
1284         * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
1285         listed in --dynamic-list.
1286         * testsuite/Makefile.am (dynamic_list_lib2.so): Add
1287         -Bsymbolic-functions.
1288         * testsuite/Makefile.in: Regenerate.
1289
1290 2015-02-16  Cary Coutant  <ccoutant@google.com>
1291
1292         PR gold/17971
1293         * incremental.cc: Remove redundant include of "output.h".
1294
1295 2015-02-12  Jing Yu  <jingyu@google.com>
1296
1297         * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
1298         TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
1299         New relocation.
1300         * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
1301         TLSLE_MOVW_* relocations.
1302         (Target_aarch64::Scan::global): Likewise.
1303         (Target_aarch64::Relocate::relocate): Likewise.
1304         (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
1305         for new TLSLE_MOVW_* relocations.
1306
1307 2015-02-11  Will Newton  <will.newton@linaro.org>
1308
1309         PR gold/13321
1310         * arm.cc (Target_arm::make_plt_section): Create an ARM
1311         state mapping symbol at the start of the PLT.
1312
1313 2015-02-09  H.J. Lu  <hongjiu.lu@intel.com>
1314
1315         * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
1316         Replace two_file_shared_2.so with two_file_shared_1.so.
1317         * testsuite/Makefile.in: Regenerated.
1318
1319 2015-02-09  Alan Modra  <amodra@gmail.com>
1320
1321         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
1322         plugin_test_thin.a and defsym_test.
1323         * testsuite/Makefile.in: Regenerate.
1324
1325 2015-02-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1326
1327         * merge.cc (do_add_input_section): Combine loop epilogue into main loop
1328         body.
1329
1330 2015-02-04  Peter Collingbourne  <pcc@google.com>
1331
1332         * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
1333         forwarding symbols when computing symbol resolution info for plugins.
1334         * plugin.h (Plugin_manager::symtab): New method.
1335         (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
1336
1337 2015-02-03  Cary Coutant  <ccoutant@google.com>
1338             Peter Collingbourne  <pcc@google.com>
1339
1340         PR gold/15660
1341         * archive.cc (Thin_archive_object_unlocker): New class.
1342         (Archive::include_member): Unlock external members of thin archives.
1343         * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
1344         (plugin_test_2): Likewise.
1345         (plugin_test_3): Likewise.
1346         (plugin_test_4): Likewise.
1347         (plugin_test_5): Likewise.
1348         (plugin_test_6): Likewise.
1349         (plugin_test_7): Likewise.
1350         (plugin_test_8): Likewise.
1351         (plugin_test_9): Likewise.
1352         (plugin_test_10): Likewise.
1353         (plugin_test_11): New test case.
1354         * testsuite/Makefile.in: Regenerate.
1355         * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
1356         file to decide whether to claim file.
1357         (all_symbols_read_hook): Likewise.
1358         * testsuite/plugin_test_1.sh: Adjust expected output.
1359         * testsuite/plugin_test_2.sh: Likewise.
1360         * testsuite/plugin_test_3.sh: Likewise.
1361         * testsuite/plugin_test_6.sh: Likewise.
1362         * testsuite/plugin_test_tls.sh: Likewise.
1363         * testsuite/plugin_test_11.sh: New testcase.
1364
1365 2015-02-03  Cary Coutant  <ccoutant@google.com>
1366
1367         * descriptors.cc (Descriptors::open): Set artificially-low limit for
1368         file descriptors when debugging enabled. Add debug output.
1369         (Descriptors::release): Add debug output.
1370         (Descriptors::close_some_descriptor): Likewise.
1371         (Descriptors::close_all): Likewise.
1372         * fileread.cc (File_read::lock): Likewise.
1373         (File_read::unlock): Likewise.
1374
1375 2015-02-02  Cary Coutant  <ccoutant@google.com>
1376
1377         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
1378         executable output file.
1379
1380 2015-01-22  Han Shen  <shenhan@google.com>
1381
1382         * arm.cc (Target_arm::Target_arm): Add initialization for new members.
1383         (Target_arm::do_plt_address_for_global): New method.
1384         (Target_arm::do_plt_address_for_local): New method.
1385         (Target_arm::rel_irelative_section): New method.
1386         (Target_arm::make_data_plt): Add more parameters for plt ctor.
1387         (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
1388         (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
1389         (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
1390         (Target_arm::Scan::check_non_pic): Add ifunc support.
1391         (Target_arm::Scan::local): Add ifunc support.
1392         (Target_arm::Scan::global): Add ifunc support.
1393         (Target_arm::make_plt_section): New method.
1394         (Target_arm::make_plt_entry): Change to call to make_plt_section.
1395         (Target_arm::make_local_ifunc_plt_entry): New method.
1396         (Target_arm::got_irelative_): New member.
1397         (Target_arm::rel_irelative_): New member.
1398         (Target_arm::got_section): Add creation for got_irelative_.
1399         (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
1400         (Target_arm::Relocate::relocate): Properly set local ifunc address.
1401         (Target_arm::do_dynsym_value): Properly set global ifunc address.
1402         (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
1403         (Output_data_plt_arm::IRelative_data): New type.
1404         (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
1405         (Output_data_plt_arm::add_entry): Add more parameters.
1406         (Output_data_plt_arm::add_relocation): New method.
1407         (Output_data_plt_arm::add_local_ifunc_entry): New method.
1408         (Output_data_plt_arm::rel_irelative): New method.
1409         (Output_data_plt_arm::entry_count): Modified.
1410         (Output_data_plt_arm::address_for_global): New method.
1411         (Output_data_plt_arm::address_for_local): New method.
1412 gold/
1413         (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
1414         (Output_data_plt_arm::insert_irelative_data): New method.
1415         (Output_data_plt_arm::irelative_rel_): New member.
1416         (Output_data_plt_arm::got_): New member.
1417         (Output_data_plt_arm::got_irelative_): New member.
1418         (Output_data_plt_arm::irelative_count_): New member.
1419         (Output_data_plt_arm::IRelative_data_vec): New typedef.
1420         (Output_data_plt_arm::irelative_data_vec_): New member.
1421         (Output_data_plt_arm::do_write): Write out irelative entries.
1422         (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
1423         more parameters to ctor.
1424         (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
1425         more parameters to ctor.
1426         * output.h (Output_data_reloc::add_local_relative): New method.
1427         * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
1428
1429 2015-01-29  Alan Modra  <amodra@gmail.com>
1430
1431         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
1432         and GOT_TLSGD to LE optimization.
1433
1434 2015-01-28  Cary Coutant  <ccoutant@google.com>
1435
1436         * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
1437         for undef TLS symbols.
1438         (Target_x86_64::Relocate::relocate_tls): Likewise.
1439         (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
1440
1441 2015-01-25  Cary Coutant  <ccoutant@google.com>
1442
1443         * output.cc (Output_segment::set_section_addresses): Fix calculation
1444         of size of relro segment.
1445
1446 2015-01-22  Alan Modra  <amodra@gmail.com>
1447
1448         * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
1449         condition for need of ifunc plt entry.
1450         (Target_powerpc::Scan::global <got relocs>): Likewise.
1451
1452 2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1453
1454         * mips.cc (reloc_high): Add r_sym.
1455         (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
1456         reloc_high constructor.
1457         (Mips_relocate_functions::relgot16_local): Likewise.
1458         (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
1459         r_type to decide whether LO16 matches HI16.
1460         (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
1461         rello16 and relgot16_local.
1462
1463 2015-01-09  Cary Coutant  <ccoutant@google.com>
1464
1465         * layout.cc (Layout::set_segment_offsets): Don't align start of segment
1466         unless alignment is larger than page size.
1467
1468 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1469             Cary Coutant  <ccoutant@google.com>
1470
1471         PR gold/17729
1472         * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
1473         (DEFAULT_TARGET_X32): Set for x32.
1474         * x86_64.cc (cmp_insn_32): New.
1475         (lea_r10_insn_32): Likewise.
1476         (lea_r11_insn_32): Likewise.
1477         (cmp_insn_64): Likewise.
1478         (lea_r10_insn_64): Likewise.
1479         (lea_r11_insn_64): Likewise.
1480         (Target_x86_64<size>::do_calls_non_split): Handle x32.
1481         * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
1482         (check_DATA): Add split_x32 files.
1483         (split_x32_[1234n].o): New targets.
1484         (split_x32_[124]): New targets.
1485         (split_x32_[1234r].stdout): New targets.
1486         * testsuite/split_x32.sh: New file.
1487         * testsuite/split_x32_1.s: Likewise.
1488         * testsuite/split_x32_2.s: Likewise.
1489         * testsuite/split_x32_3.s: Likewise.
1490         * testsuite/split_x32_4.s: Likewise.
1491         * testsuite/split_x32_n.s: Likewise.
1492         * configure: Regenerated.
1493         * testsuite/Makefile.in: Likewise.
1494
1495 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1496
1497         PR gold/17809
1498         * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
1499         x32.
1500
1501 2015-01-02  Alan Modra  <amodra@gmail.com>
1502
1503         * version.cc (print_version): Just print current year.
1504         * dwp.cc (print_version): Likewise.
1505
1506 2015-01-01  Alan Modra  <amodra@gmail.com>
1507
1508         Update year range in copyright notice of all files.
1509
1510 2014-12-25  Alan Modra  <amodra@gmail.com>
1511
1512         * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
1513         new enums.
1514         (Target_arm::merge_object_attributes, ): Likewise.
1515
1516 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
1517
1518         * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
1519         as hard float only when Tag_ABI_VFP_args is 1, using new enum value
1520         AEABI_VFP_args_vfp to check that.
1521         (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
1522         value and replace hardcoded values by enum values.
1523
1524 2014-12-22  Cary Coutant  <ccoutant@google.com>
1525
1526         * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
1527
1528 2014-12-20  H.J. Lu  <hongjiu.lu@intel.com>
1529
1530         PR gold/14608
1531         * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
1532         to "return i * i * 3;".
1533
1534 2014-12-16  Cary Coutant  <ccoutant@google.com>
1535
1536         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
1537         (Mapfile::print_output_data): Use current_data_size() to avoid
1538         assert for sections requiring postprocessing; if address is not valid,
1539         print 0.
1540         (Mapfile::print_output_section): Use current_data_size(); print note
1541         that addresses and sizes are before compression.
1542
1543 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
1544
1545         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1546         Cast current_group_size to unsigned long when reporting error.
1547
1548 2014-12-10  Jing Yu  <jingyu@google.com>
1549
1550         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
1551         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
1552         Update error message.
1553         (Target_aarch64::do_relax): Use absolute value of option
1554         stub_group_size. Replace local variable with class member
1555         stub_group_size_.
1556
1557 2014-12-04  Alan Modra  <amodra@gmail.com>
1558
1559         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
1560         addend of PLTREL24 reloc when not generating a plt stub.  Make
1561         max_branch_offset an "Address".
1562         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
1563         (Target_powerpc::Relocate::relocate): Likewise.
1564
1565 2014-12-04  Alan Modra  <amodra@gmail.com>
1566
1567         PR 17670
1568         * symtab.cc (Symbol::set_undefined): Remove assertion.
1569         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1570         on symbols defined in discarded sections, instead return false.
1571         Rearrange params, update all callers.
1572         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
1573         branches to syms in discarded sections.
1574         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
1575         undefined and flag as discarded.
1576         (Target_powerpc::Relocate::relocate): Localize variable.
1577
1578 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
1579
1580         PR gold/17675
1581         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
1582         * testsuite/Makefile.in: Regenerated.
1583
1584 2014-12-03  Alan Modra  <amodra@gmail.com>
1585
1586         PR 17566
1587         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
1588         when adding dynamic relocations against section symbols.
1589
1590 2014-12-01  Dimitry Ivanov <dimitry@google.com>
1591
1592         * layout.cc (Layout::finish_dynamic_section): When '-z global'
1593         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
1594         * options.h (General_options): New -z option (global).
1595
1596 2014-12-01  Cary Coutant  <ccoutant@google.com>
1597
1598         PR gold/17578
1599         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
1600         is given.
1601         (Layout::create_executable_stack_info): Warn when -z noexecstack is
1602         given but some inputs require executable stack.
1603
1604 2014-11-26  Cary Coutant  <ccoutant@google.com>
1605
1606         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
1607         .debug_str_offsets; strip .debug_gnu_pubnames and
1608         .debug_gnu_pubtypes.
1609         (lines_only_debug_sections): Strip all four new sections.
1610
1611 2014-11-26  Jing Yu  <jingyu@google.com>
1612
1613         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
1614         register to be x0 when to relax TLSDESC_LD64_LO12.
1615
1616 2014-11-26  Alan Modra  <amodra@gmail.com>
1617
1618         * powerpc.cc (struct Stub_table_owner): New.
1619         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
1620         unsigned int vector.  Update all references.
1621         (powerpc_relobj::set_stub_table): Take an unsigned int param
1622         rather than a Stub_table.  Update callers.
1623         (Powerpc_relobj::clear_stub_table): New function.
1624         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
1625         stub_group_size_ vars.
1626         (Target_powerpc::new_stub_table): Delete.
1627         (max_branch_delta): New function, extracted from..
1628         (Target_powerpc::Relocate::relocate): ..here..
1629         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
1630         status on whether stub created successfully.
1631         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
1632         default sizing to..
1633         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
1634         reduce on relax failure.
1635         (Target_powerpc::group_sections): Add "no_size_errors" param.
1636         Use stub_group_size_.  Set up group info in a temp vector,
1637         before building Stub_table vector.  Account for input sections
1638         possibly already converted to relaxed sections.
1639         (Stub_table::init): Delete.  Merge into..
1640         (Stub_table::Stub_table): ..here.
1641         (Stub_table::can_reach_stub): New function.
1642         (Stub_table::add_plt_call_entry): Add "from" parameter and
1643         return true iff stub could be reached.
1644         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
1645         param too.
1646         (Stub_table::clear_stubs): Add "all" param.
1647
1648 2014-11-26  Alan Modra  <amodra@gmail.com>
1649
1650         * powerpc.cc (Stub_control::set_output_and_owner): New function.
1651         (Target_powerpc::group_sections): Use it.
1652
1653 2014-11-25  Cary Coutant  <ccoutant@google.com>
1654
1655         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
1656         (Binary_to_elf::write_symbol): Add st_size parameter.
1657         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
1658
1659 2014-11-25  Cary Coutant  <ccoutant@google.com>
1660
1661         PR gold/17639
1662         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
1663         (Sized_relobj_file::do_layout): Handle deferred sections properly
1664         during GC pass 1. Don't add reloc sections to deferred list twice.
1665         * object.h (Sized_relobj_file::is_deferred_layout): New function.
1666         (Sized_relobj_file::is_deferred_layout_): New data member.
1667
1668 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
1669
1670         PR gold/17619
1671         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
1672         Check PC-relative offset overflow in PLT entry.
1673
1674 2014-11-21  Alan Modra  <amodra@gmail.com>
1675
1676         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
1677         for undefined weaks.
1678
1679 2014-11-20  Alan Modra  <amodra@gmail.com>
1680
1681         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
1682         from --stub-group-size parameter divided by 1024.
1683         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
1684         template parameter.  Update all uses.
1685         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
1686         has_stub_value.  Set for long branches.  Don't report overflow for
1687         branch to undefined weak symbols.  Print info message on
1688         overflowing branch to stub.
1689
1690 2014-11-20  Alan Modra  <amodra@gmail.com>
1691
1692         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
1693
1694 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
1695
1696         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
1697         entry for R_X86_64_GOTPLT64.
1698         (Target_x86_64<size>::Relocate::relocate): Update comments for
1699         R_X86_64_GOTPLT64.
1700
1701 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
1702
1703         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
1704         * plugin.h: add lock definition
1705
1706 2014-10-29  Han Shen  <shenhan@google.com>
1707             Jing Yu   <jingyu@google.com>
1708
1709         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
1710         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1711         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
1712         Symbol::TLS_REF.
1713         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
1714         method.
1715         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
1716         (Target_aarch64::tls_ld_to_le): New method.
1717         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
1718         for 64bit targets.
1719         (Output_data_plt_aarch64::irelative_rel_): New data member.
1720         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
1721         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
1722         (Output_data_plt_aarch64::add_relocation): New method.
1723         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
1724         offset. Add got_irelative size to got size.
1725         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
1726         type string with the new typename.
1727         (AArch64_relocate_functions::update_adr): Replace parameter x with
1728         immed.
1729         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
1730         (AArch64_relocate_functions::reloc_common): New method.
1731         (AArch64_relocate_funcsions::rela_general): Extract common part out
1732         into reloc_common method.
1733         (AArch64_relocate_functions::rela_general): Likewise.
1734         (AArch64_relocate_functions::pcrela_general): Likewise.
1735         (AArch64_relocate_functions::adr): New method.
1736         (AArch64_relocate_functions::adrp): Calculate immed before calling
1737         update_adr.
1738         (AArch64_relocate_functions::adrp): Likewise.
1739         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
1740         comparing x to 0. Calculate immed from ~x when x < 0.
1741         (Target_aarch64::optimize_tls_reloc): Add new cases for
1742         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1743         TLSLD_MOVW_DTPREL_G0_NC.
1744         (Target_aarch64::possible_function_pointer_reloc): Implement this
1745         method.
1746         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
1747         comment.
1748         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
1749         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1750         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1751         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
1752         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1753         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1754         (Target_aarch64::make_plt_entry): Call add_entry with two more
1755         parameters.
1756         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1757         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
1758         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1759         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1760         (Target_aarch64::Relocate::relocate_tls): Add cases for
1761         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1762         TLSLD_MOVW_DTPREL_G0_NC.
1763         * testsuite/icf_safe_so_test.cc: Correct test comment.
1764         * testsuite/icf_safe_test.sh: Add AArch64 arch.
1765
1766 2014-10-22  Alan Modra  <amodra@gmail.com>
1767
1768         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
1769         thread_starter.
1770
1771 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
1772
1773         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
1774
1775 2014-10-17  Cary Coutant  <ccoutant@google.com>
1776
1777         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1778         Add "typename" keyword.
1779
1780 2014-10-15  Han Shen  <shenhan@google.com>
1781             Jing Yu   <jingyu@google.com>
1782
1783         Patch for gold aarch64 backend to support relaxation.
1784         * aarch64-reloc.def: Change format.
1785         * aarch64.cc (class Reloc_stub): New class.
1786         (class Stub_table): New class.
1787         (class AArch64_relobj): New class.
1788         (class AArch64_input_section): New class.
1789         (class AArch64_output_section): New class.
1790         (Target_aarch64::new_stub_table): New method.
1791         (Target_aarch64::new_aarch64_input_section): New method.
1792         (Target_aarch64::find_aarch64_input_section): New method.
1793         (Target_aarch64::scan_section_for_stubs): New method.
1794         (Target_aarch64::scan_reloc_section_for_stubs): New method.
1795         (Target_aarch64::relocate_stub): New method.
1796         (Target_aarch64::current_target): New method.
1797         (Target_aarch64::do_make_elf_object): New method.
1798         (Target_aarch64::do_may_relax): New method.
1799         (Target_aarch64::do_relax): New method.
1800         (Target_aarch64::group_sections): New method.
1801         (Target_aarch64::scan_reloc_for_stub): New method.
1802         (Target_aarch64::do_make_output_section): New method.
1803         (Target_aarch64::stub_tables_): New data member.
1804         (Target_aarch64::aarch64_input_section_map_): New data member.
1805         (AArch64_relocate_functions::maybe_apply_stub): New method.
1806
1807 2014-09-30  Cary Coutant  <ccoutant@google.com>
1808
1809         PR gold/17432
1810         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
1811
1812 2014-09-30  Kito Cheng  <kito@0xlab.org>
1813
1814         PR gold/13597
1815         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
1816         hash table before sysv-style hash table.
1817
1818 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
1819
1820         * options.h (--pic-executable): Add negative to alias to -no-pie.
1821
1822 2014-09-26  Cary Coutant  <ccoutant@google.com>
1823
1824         PR gold/16773
1825         * object.cc (Sized_relobj_file): Compute value of section symbols
1826         for TLS sections the same as TLS symbols.
1827
1828 2014-09-25  Cary Coutant  <ccoutant@google.com>
1829
1830         PR gold/17432
1831         * resolve.cc (Symbol_table::resolve): Override common placeholder
1832         symbols, but adjust sizes.
1833         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
1834         symbols to common lists.
1835
1836 2014-09-24  Alan Modra  <amodra@gmail.com>
1837
1838         * po/POTFILES.in: Regenerate.
1839
1840 2014-09-23  Taiju Tsuiki  <tzik@google.com>
1841             Cary Coutant  <ccoutant@google.com>
1842
1843         PR gold/14860
1844         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
1845         on input_sections_blocker.
1846         * layout.cc (Write_sections_task::locks): Unblock
1847         input_sections_blocker_.
1848         * layout.h (Write_sections_task::Write_sections_task): Add
1849         input_sections_blocker.
1850         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
1851         to DEPENDENCIES.
1852         * testsuite/Makefile.in: Regenerate.
1853
1854 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1855
1856         * testsuite/Makefile.am (plugin_test_10): New test.
1857         * testsuite/Makefile.in: Regenerate
1858         * testsuite/plugin_common_test_2.c (c1): Align to 8.
1859         * testsuite/plugin_test_10.sh: New file.
1860
1861 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1862
1863         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
1864         * resolve.cc (Symbol_table::resolve): Don't override common symbols
1865         during the replacement phase.
1866
1867 2014-09-17  Han Shen  <shenhan@google.com>
1868             Jing Yu  <jingyu@google.com>
1869
1870         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
1871         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
1872         * aarch64.cc (Target_aarch64): Add data members
1873         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
1874         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
1875         constructor.
1876         (Target_aarch64::do_reloc_symbol_index): New method.
1877         (Target_aarch64::do_reloc_addend): New method.
1878         (Target_aarch64::add_tlsdesc_info): New method.
1879         (Target_aarch64::do_dynsym_value): New method.
1880         (Target_aarch64::do_make_data_plt): Add new parameters: got,
1881         got_irelative. Pass them to Output_data_plt_aarch64_standard.
1882         (Target_aarch64::make_data_plt): Add new parameters: got,
1883         got_irelative. Pass them to do_make_data_plt.
1884         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
1885         (Target_aarch64::Relocate:tls_gd_to_le): New method.
1886         (Target_aarch64::Relocate:tls_ie_to_le): New method.
1887         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
1888         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
1889         (Target_aarch64::got_tlsdesc_section): New method.
1890         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1891         (Target_aarch64::define_tls_base_symbol): New method.
1892         (Target_aarch64::reserve_tlsdesc_entries): New method.
1893         (Target_aarch64::got_mod_index_entry): New method.
1894         (Target_aarch64::rela_tlsdesc_section): New method.
1895         (Target_aarch64::rela_irelative_section): New method.
1896         (Target_aarch64::Tlsdesc_info): New struct.
1897         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
1898         relocations and tlsdesc relocations.
1899         (Target_aarch64::optimize_tls_reloc): Implement method.
1900         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
1901         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
1902         in constructor.
1903         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
1904         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
1905         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
1906         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
1907         (Output_data_plt_aarch64::rela_tlsdesc): New method.
1908         (Output_data_plt_aarch64::rela_irelative): New method.
1909         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
1910         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
1911         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
1912         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
1913         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
1914         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
1915         (Output_data_plt_aarch64_standard): New member variables:
1916         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
1917         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
1918         New parameter: got, got_irelative.
1919         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
1920         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
1921         (Output_data_plt_aarch64::do_write): Replace got_address with
1922         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
1923         (AArch64_relocate_functions::update_movnz): New method.
1924         (AArch64_relocate_functions): Correct format.
1925         (AArch64_relocate_functions::movnz): New method.
1926         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
1927         before the switch. Add new cases to switch.
1928         Check ie_to_le relaxation on tlsie relocations. Add code handling
1929         tlsgd tlsdesc cases.
1930         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
1931         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
1932         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
1933         Call reloc_name_in_error_message to print unsupported reloc.
1934         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
1935         make_data_plt.
1936         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
1937         relocs. Fill in some more dynamic tags.
1938         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
1939         Skip call tls_get_addr when tlsgd is relaxed.
1940         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
1941         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
1942         tlsdesc->ie relaxation.
1943
1944 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1945
1946         * mips.cc (Target_mips_nacl): New class.
1947         (Target_selector_mips_nacl): New class.
1948         (target_selector_mips32): Rename from target_selector_mips32be and use
1949         Target_selector_mips_nacl instead of Target_selector_mips.
1950         (target_selector_mips32el): Rename from target_selector_mips32 and use
1951         Target_selector_mips_nacl instead of Target_selector_mips.
1952         (target_selector_mips64): Rename from target_selector_mips64be and use
1953         Target_selector_mips_nacl instead of Target_selector_mips.
1954         (target_selector_mips64el): Rename from target_selector_mips64 and use
1955         Target_selector_mips_nacl instead of Target_selector_mips.
1956         (Target_mips::mips_info): Add const attribute.
1957
1958 2014-09-02  Cary Coutant  <ccoutant@google.com>
1959
1960         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
1961         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
1962         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
1963         (Sized_incr_dynobj::do_section_name): Likewise.
1964         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
1965         (Sized_incr_dynobj::do_section_name): Likewise.
1966         * object.h (Object::section_name): Likewise.
1967         (Object::do_section_name): Likewise.
1968         (Sized_relobj_file::do_section_name): Likewise.
1969         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
1970         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
1971
1972 2014-09-02  Cary Coutant  <ccoutant@google.com>
1973
1974         PR gold/17005
1975         * ehframe.cc (Fde::write): Add output_offset parameter.
1976         (Cie::write): Likewise.
1977         (Eh_frame::set_final_data_size): Account for offset within output
1978         section.
1979         (Eh_frame::do_sized_write): Likewise.
1980         * ehframe.h (Fde::write): Add output_offset parameter.
1981         (Cie::write): Likewise.
1982         * output.cc (Output_section::Input_section_sort_entry): Remove
1983         section_has_name_; add output_section_name parameter. Use
1984         output section name for non-input sections.
1985         (Output_section::Input_section_sort_entry::section_has_name): Remove.
1986         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
1987         (Output_section::Input_section_sort_compare): Remove logic for
1988         sections without names.
1989         (Output_section::Input_section_sort_init_fini_compare): Likewise.
1990         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
1991         Likewise.
1992         (Output_section::Input_section_sort_section_name_compare): Likewise.
1993
1994 2014-08-29 Han Shen <shenhan@google.com>
1995            Jing Yu <jingyu@google.com>
1996
1997         * aarch64-reloc-property.cc
1998         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
1999         reference reloc property in the table.
2000         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
2001         3 other entries.
2002         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
2003         2 new overloaded methods.
2004         (Output_data_got_aarch64::do_write): Add code to write out
2005         static relocs.
2006         (class Output_data_got_aarch64::Static_reloc): New class to wrap
2007         static relocs.
2008         (Output_data_got_aarch64::static_relocs): New vector to
2009         hold static relocs.
2010         (Target_aarch64::TCB_SIZE): New const static memeber.
2011         (Target_aarch64::tcb_size): New method.
2012         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
2013         (Target_aarch64::Relocate::relocate_tls): New method.
2014         (Target_aarch64::Scan::local): Add code handling new reloc types.
2015         (Target_aarch64::Scan::global): Add code handling new reloc types.
2016
2017 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
2018
2019         * options.h (-no-pie): Add option.
2020
2021 2014-08-08  Jing Yu  <jingyu@google.com>
2022             Han Shen  <shenhan@google.com>
2023
2024         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
2025         (DEFFILES): add aarch64-reloc.def.
2026         (TARGETSOURCES): Add aarch64-reloc-property.cc.
2027         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
2028         * Makefile.in: Regenerate.
2029         * aarch64-reloc-property.cc: New file.
2030         * aarch64-reloc-property.h: New file.
2031         * aarch64-reloc.def: New file.
2032         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
2033         with tab to make the format consistent.
2034         (Output_data_got_aarch64::symbol_table_): New method.
2035         (Target_aarch64::do_plt_address_for_global): New method.
2036         (Target_aarch64::do_plt_address_for_local): New method.
2037         (Target_aarch64::do_select_as_default_target): New method.
2038         (Target_aarch64::do_make_data_plt): New method.
2039         (Target_aarch64::make_data_plt): New method.
2040         (Output_data_plt_aarch64::has_irelative_section): New method.
2041         (Output_data_plt_aarch64::address_for_global): New method.
2042         (Output_data_plt_aarch64::address_for_local): New method.
2043         (Output_data_plt_aarch64::irelative_rel_): New parameter.
2044         (Output_data_plt_aarch64::add_entry): Implement contents.
2045         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
2046         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
2047         the got_pov entry to plt0.
2048         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
2049         Implement contents.
2050         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
2051         (AArch64_howto): New struct.
2052         (aarch64_howto[]): New static const array.
2053         (AArch64_relocate_functions): New class.
2054         (Target_aarch64::Scan::get_reference_flags): Remove method.
2055         (Target_aarch64::Scan::local): Implement to support a few relocations.
2056         (Target_aarch64::Scan::global): Implement to support a few relocations.
2057         (Target_aarch64::make_plt_section): Implement contents.
2058         (Target_aarch64::make_plt_entry): Implement contents.
2059         (Target_aarch64::do_finalize_sections): Implement contents.
2060         (Target_aarch64::Relocate::relocate): Implement a few relocations.
2061         (Target_aarch64::relocate_section): Implement contents.
2062
2063 2014-08-06  Alan Modra  <amodra@gmail.com>
2064
2065         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
2066
2067 2014-08-06  Alan Modra  <amodra@gmail.com>
2068
2069         PR 13227
2070         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
2071
2072 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
2073
2074         * object.cc (Relobj::is_section_name_included): Add
2075         ".rodata.nptl_version" to not garbage collect this section.
2076
2077 2014-07-08  Cary Coutant  <ccoutant@google.com>
2078
2079         * expression.cc (struct Expression::Expression_eval_info): Add
2080         new fields type_pointer, vis_pointer, and nonvis_pointer.
2081         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
2082         nonvis_pointer parameters. Adjust all calls.
2083         (Symbol_expression::value): Update type, visibility, and nonvis bits
2084         in caller.
2085         * script.cc (Symbol_assignment::sized_finalize): Update type,
2086         visibility, and remaining st_other bits for new symbol.
2087         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
2088         vis_pointer, and nonvis_pointer parameters.
2089         * symtab.h (Symbol::set_type): New method.
2090
2091         * testsuite/Makefile.am (defsym_test): New test.
2092         * testsuite/Makefile.in: Regenerate.
2093         * testsuite/defsym_test.c: New file.
2094         * testsuite/defsym_test.sh: New file.
2095
2096 2014-07-08  Cary Coutant  <ccoutant@google.com>
2097
2098         PR gold/15639
2099         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
2100         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
2101         (Sized_dynobj::base_read_symbols): ...new method.
2102         * object.h (Sized_relobj_file::base_read_symbols): New method.
2103         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
2104         (Sized_relobj_file::base_read_symbols): ...new method.
2105         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
2106         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
2107         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
2108
2109 2014-07-04  Alan Modra  <amodra@gmail.com>
2110
2111         * po/POTFILES.in: Regenerate.
2112
2113 2014-07-02  Jing Yu  <jingyu@google.com>
2114
2115         * aarch64.cc: New file
2116         * Makefile.am (TARGETSOURCES): Add aarch64.cc
2117         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
2118         * Makefile.in: Regenerate.
2119         * configure.tgt: Add entries for aarch64*.
2120         * configure.ac:  Likewise.
2121         * configure: Likewise.
2122
2123 2014-06-27  Alan Modra  <amodra@gmail.com>
2124
2125         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
2126
2127 2014-06-24  Cary Coutant  <ccoutant@google.com>
2128
2129         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
2130         sections.
2131         (Dwo_file::sized_read_unit_index): Likewise.
2132
2133 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2134
2135         * mips.cc: New file.
2136         * Makefile.am (TARGETSOURCES): Add mips.cc
2137         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
2138         * configure.tgt: Add entries for mips*.
2139         * configure.ac: Likewise.
2140         * Makefile.in: Regenerate.
2141         * configure: Likewise.
2142
2143 2014-06-09  Cary Coutant  <ccoutant@google.com>
2144
2145         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
2146         unit_length is within section bounds.
2147
2148 2014-06-09  Cary Coutant  <ccoutant@google.com>
2149
2150         PR gold/16980
2151         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
2152         map.
2153
2154 2014-06-07  Alan Modra  <amodra@gmail.com>
2155
2156         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
2157
2158 2014-06-06  Cary Coutant  <ccoutant@google.com>
2159
2160         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
2161         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
2162         (Dwarf_pubnames_table::read_header): Likewise.
2163         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
2164         .debug_gnu_pubtypes.
2165
2166 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
2167
2168         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
2169         * Makefile.in, configure: Regenerate.
2170
2171 2014-06-03  Alan Modra  <amodra@gmail.com>
2172
2173         * powerpc.cc (addis_12_2): Define.
2174         (Stub_table::do_write): Support fusion on ELFv2 stubs.
2175
2176 2014-06-03  Alan Modra  <amodra@gmail.com>
2177
2178         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
2179         st_other output.
2180
2181 2014-06-02  Alan Modra  <amodra@gmail.com>
2182
2183         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
2184         Only ignore relocs on ELFv1.
2185         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
2186
2187 2014-05-30  Cary Coutant  <ccoutant@google.com>
2188
2189         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
2190         * testsuite/Makefile.in: Regenerate.
2191         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
2192
2193 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
2194
2195         PR gold/16945
2196         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
2197         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
2198
2199 2014-05-15  Alan Modra  <amodra@gmail.com>
2200
2201         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
2202         Compare FDE contents with DW_CFA_nop rather than 0.
2203
2204 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
2205
2206         * symtab.h (may_need_copy_reloc): Remove check for position independent
2207         code.
2208         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
2209         position independence before pc absolute may_need_copy_reloc call.
2210         Add check for executable output befor pc relative may_need_copy_reloc
2211         call.
2212         * i386.cc: Ditto.
2213         * arm.cc: Ditto.
2214         * sparc.cc: Ditto.
2215         * tilegx.cc: Ditto.
2216         * powerpc.cc: Add check for no position independence before
2217         may_need_copy_reloc calls.
2218         * testsuite/pie_copyrelocs_test.cc: New file.
2219         * testsuite/pie_copyrelocs_shared_test.cc: New file.
2220         * Makefile.am (pie_copyrelocs_test): New test.
2221         * Makefile.in: Regenerate.
2222
2223 2014-05-08  Martin Liška  <mliska@suse.cz>
2224
2225         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
2226
2227 2014-05-06  Cary Coutant  <ccoutant@google.com>
2228
2229         PR gold/16900
2230         * i386.cc (Output_data_got_plt_i386): New class.
2231         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
2232         parameter. Change all callers.
2233         (Output_data_plt_i386::layout_): Remove.
2234         (Output_data_plt_i386::got_plt_): Change type.
2235         (Target_i386::got_plt_): Change type. Change all references.
2236         (Target_i386::got_section): Create instance of new class.
2237         (Output_data_got_plt_i386::do_write): New function.
2238         * x86_64.cc (Output_data_got_plt_x86_64): New class.
2239         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
2240         parameter. Change all callers.
2241         (Output_data_plt_x86_64::layout_): Remove.
2242         (Output_data_plt_x86_64::got_plt_): Change type.
2243         (Target_x86_64::got_plt_): Change type. Change all references.
2244         (Target_x86_64::got_section): Create instance of new class.
2245         (Output_data_got_plt_x86_64::do_write): New function.
2246         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
2247         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
2248         class.
2249
2250 2014-05-05  Cary Coutant  <ccoutant@google.com>
2251
2252         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
2253         if we have pubnames/pubtypes.
2254
2255 2014-05-02  Cary Coutant  <ccoutant@google.com>
2256
2257         * defstd.cc (in_segment): Define __ehdr_start here...
2258         * layout.cc (Layout::finalize): ...Instead of here.  Set the
2259         output segment when known.
2260         * resolve.cc (Symbol::override_base_with_special): Remember
2261         the original binding.
2262         * symtab.cc (Symbol::set_output_segment): New function.
2263         (Symbol::set_undefined): New function.
2264         * symtab.h (Symbol::is_weak_undefined): Check original undef
2265         binding.
2266         (Symbol::is_strong_undefined): New function.
2267         (Symbol::set_output_segment): New function.
2268         (Symbol::set_undefined): New function.
2269         * target-reloc.h (is_strong_undefined): Remove.
2270         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
2271         Check for hidden undefs.
2272         (relocate_section): Call Symbol::is_strong_undefined.
2273
2274         * testsuite/Makefile.am (ehdr_start_test_1)
2275         (ehdr_start_test_2, ehdr_start_test_3)
2276         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
2277         * testsuite/Makefile.in: Regenerate.
2278         * testsuite/ehdr_start_def.cc: New source file.
2279         * testsuite/ehdr_start_test.cc: New source file.
2280         * testsuite/ehdr_start_test.t: New linker script.
2281         * testsuite/ehdr_start_test_4.sh: New shell script.
2282
2283 2014-04-23  Cary Coutant  <ccoutant@google.com>
2284
2285         PR gold/16870
2286         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
2287
2288 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2289
2290         * layout.cc (Layout::include_section): Allow a target to decide
2291         whether to include a section.
2292         * target.h (Target::should_include_section): New function.
2293         (Target::do_should_include_section): New function.
2294
2295 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2296
2297         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
2298         inline into ...
2299         (Copy_relocs::emit): ... here.
2300         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
2301         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
2302         (Copy_reloc_entry::entries_): Change from private to protected.
2303
2304 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
2305
2306         * icf.cc (get_section_contents): Replace copies of reloc
2307         vectors with const references.
2308
2309 2014-04-02  Cary Coutant  <ccoutant@google.com>
2310
2311         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
2312         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
2313         * configure: Regenerate.
2314         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
2315         -fno-use-linker-plugin.
2316         (LINK1, CXXLINK1): Add it to the link command.
2317         * testsuite/Makefile.in: Regenerate.
2318
2319 2014-03-12  Alan Modra  <amodra@gmail.com>
2320
2321         * Makefile.in: Regenerate.
2322
2323 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2324
2325         * symtab.h (Symbol::set_nonvis): New function.
2326
2327 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2328
2329         * symtab.cc (Sized_symbol<32>::init_output_data):
2330         Instantiate the template.
2331         (Sized_symbol<64>::init_output_data): Likewise.
2332
2333 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2334
2335         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
2336         adjust dynamic symbol value.
2337         * target.h (Target::adjust_dyn_symbol): New function.
2338         (Target::do_adjust_dyn_symbol): New function.
2339
2340 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2341
2342         * output.cc (Output_data_dynamic::Dynamic_entry::write):
2343         Get the value of DYNAMIC_CUSTOM dynamic entry.
2344         * output.h (Output_data_dynamic::add_custom): New function.
2345         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
2346         dynamic entry.
2347         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
2348         * target.h (Target::dynamic_tag_custom_value): New function.
2349         (Target::do_dynamic_tag_custom_value): New function.
2350
2351 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2352
2353         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
2354         dynsym indexes.
2355         * target.h (Target::has_custom_set_dynsym_indexes): New function.
2356         (Target::do_has_custom_set_dynsym_indexes): New function.
2357         (Target::set_dynsym_indexes): New function.
2358         (Target::do_set_dynsym_indexes): New function.
2359
2360 2014-03-07  Alan Modra  <amodra@gmail.com>
2361
2362         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
2363         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
2364         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
2365         (Powerpc_relocate_functions::has_overflow_bitfield,
2366         overflowed): Use the above.
2367         (Target_powerpc::Relocate::relocate): Correct overflow checking
2368         for a number of relocations.  Modify overflow test for 16-bit
2369         fields in instructions to signed/unsigned according to whether
2370         the field takes a signed or unsigned value.
2371
2372 2014-03-05  Alan Modra  <amodra@gmail.com>
2373
2374         Update copyright years.
2375
2376 2014-03-05  Alan Modra  <amodra@gmail.com>
2377
2378         * powerpc.cc (Target_powerpc::Scan::local, global): Support
2379         R_PPC64_ADDR64_LOCAL.
2380         (Target_powerpc::Relocate::relocate): Likewise.
2381
2382 2014-03-03  Alan Modra  <amodra@gmail.com>
2383
2384         * dwp.cc (print_version): Update copyright year to current.
2385
2386 2014-02-10  Alan Modra  <amodra@gmail.com>
2387
2388         * po/gold.pot: Regenerate.
2389
2390 2014-02-06  Cary Coutant  <ccoutant@google.com>
2391
2392         Fix problem where -u is ignored when a weak undef is seen.
2393
2394         * archive.cc (Library_base::should_include_member): Reorder
2395         code to check for -u option if a weak undef has already been seen.
2396         * testsuite/Makefile.am (weak_undef_test_2): New test case.
2397         * testsuite/Makefile.in: Regenerate.
2398         * testsuite/weak_undef_file3.cc: New file.
2399         * testsuite/weak_undef_file4.cc: New file.
2400         * testsuite/weak_undef_test_2.cc: New file.
2401
2402 2014-02-05  Cary Coutant  <ccoutant@google.com>
2403
2404         Fix issues with gold undefined symbol diagnostics.
2405
2406         PR binutils/15435
2407         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
2408         check to here.
2409         * target-reloc.h (is_strong_undefined): New function.
2410         (relocate_section): Move undef vtable symbol check from here.
2411         Check for is_strong_undefined.
2412
2413 2014-02-05  Cary Coutant  <ccoutant@google.com>
2414
2415         Fix problems with the --dynamic-list option.
2416
2417         PR gold/13577
2418         * options.cc (General_options::parse_dynamic_list):
2419         Set have_dynamic_list_.
2420         (General_options::General_options): Initialize have_dynamic_list_.
2421         (General_options::finalize): Turn off -Bsymbolic and
2422         -Bsymbolic-functions if --dynamic-list provided.
2423         * options.h (General_options::have_dynamic_list): New function.
2424         (General_options::have_dynamic_list_): New data member.
2425         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
2426         correctly.
2427
2428         PR gold/16530
2429         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
2430         in --dynamic-list, mark it.
2431
2432         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
2433         (dynamic_list_2): New test case.
2434         * testsuite/Makefile.in: Regenerate.
2435         * testsuite/dynamic_list_2.cc: New file.
2436         * testsuite/dynamic_list_2.t: New file.
2437         * testsuite/dynamic_list_lib1.cc: New file.
2438         * testsuite/dynamic_list_lib2.cc: New file.
2439         * testsuite/gc_dynamic_list_test.c: New file.
2440         * testsuite/gc_dynamic_list_test.sh: New file.
2441         * testsuite/gc_dynamic_list_test.t: New file.
2442
2443 2014-01-28  Cary Coutant  <ccoutant@google.com>
2444
2445         Add .gdb_index version 7 support.
2446
2447         * gold/dwarf_reader.cc: include <utility> (for make_pair).
2448         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
2449         debug sections.
2450         (Dwarf_ranges_table::read_ranges_table): Likewise.
2451         (Dwarf_pubnames_table::read_section): Check for GNU-style
2452         sections, and for compressed debug sections.
2453         (Dwarf_pubnames_table::read_header): Compute end address of table.
2454         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
2455         for end of list by offset, not by offset == 0.
2456         (Dwarf_info_reader::do_read_string_table): Check for compressed
2457         debug sections.
2458         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2459         Initialize new data members.
2460         (Dwarf_pubnames_table::next_name): return flag_byte.
2461         (Dwarf_pubnames_table::end_of_table_): New data member.
2462         (Dwarf_pubnames_table::is_gnu_style_): New data member.
2463         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
2464         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
2465         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
2466         read skeleton type unit DIEs.
2467         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
2468         (Gdb_index::do_write): Write flag_byte.
2469         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
2470         (Gdb_index::Cu_vector): Store flags along with cu indexes.
2471         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
2472         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
2473
2474 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
2475
2476         * version.cc (print_version): Update copyright year to 2014.
2477
2478 2013-12-19  Dimitry Andric  <dimitry@andric.com>
2479
2480         * stringpool.cc (Stringpool_template::reserve): Add
2481         HAVE_UNORDERED_MAP case.
2482         * stringpool.cc (Stringpool_template::print_stats): Likewise.
2483
2484 2013-12-18  Cary Coutant  <ccoutant@google.com>
2485
2486         * configure.ac: Check for <unordered_set> and <unordered_map>.
2487         * config.in: Regenerate.
2488         * configure: Regenerate.
2489         * system.h: Use <unordered_set> and <unordered_map> if available.
2490
2491 2013-12-10  Roland McGrath  <mcgrathr@google.com>
2492
2493         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
2494         with $(INSTALL_PROGRAM_ENV).
2495         * Makefile.in: Regenerate.
2496
2497 2013-11-22  Cary Coutant  <ccoutant@google.com>
2498
2499         * configure.ac: Add check for which library is needed for
2500         dlopen.
2501         * configure: Regenerate.
2502
2503 2013-11-22  Cary Coutant  <ccoutant@google.com>
2504
2505         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
2506         assembler.
2507         * testsuite/Makefile.in: Regenerate.
2508
2509 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
2510
2511         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
2512         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
2513         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
2514         (Target_x86_64<size>::Scan::local): Likewise.
2515         (Target_x86_64<size>::Scan::global): Likewise.
2516         (Target_x86_64<size>::Relocate::relocate): Likewise.
2517         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
2518         Likewise.
2519         (Target_x86_64<size>::Scan::check_non_pic(): Handle
2520         R_X86_64_PC32_BND.
2521
2522         * testsuite/Makefile.am (check_PROGRAMS): Add
2523         exception_x86_64_bnd_test.
2524         (exception_x86_64_bnd_test_SOURCES): New macro.
2525         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
2526         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
2527         (exception_x86_64_bnd_test_LDADD): Likewise.
2528         (exception_x86_64_bnd_1.o): New rule.
2529         (exception_x86_64_bnd_2.o): Likewise.
2530         * testsuite/Makefile.in: Regenerated.
2531
2532 2013-11-15  Alan Modra  <amodra@gmail.com>
2533
2534         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
2535         accessor.
2536         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
2537         Only call ppc64_local_entry_offset for 64-bit.  Restrict
2538         symval_for_branch lookup to ELFv1.
2539         (Stub_table::add_plt_call_entry): Use unsigned int off.
2540         (Output_data_glink::Address, invalid_address): New.
2541         (Output_data_glink::add_eh_frame): Move out of line.  Add
2542         support for ELFv2.
2543         (Output_data_glink::add_global_entry, find_global_entry,
2544         global_entry_address): New functions.
2545         (Output_data_glink::global_entry_stubs_, end_branch_table_,
2546         ge_size): New variables.
2547         (Output_data_glink::set_final_data_size): Add global entry
2548         stub sizing.
2549         (Output_data_glink::do_write): Write global entry stubs.
2550         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
2551         parameter.  Return true for ELFv2.  Adjust callers.
2552         (Target_powerpc::Scan::local, global): Restrict opd lookup to
2553         ELFv1.  Similarly for ifunc and dynamic relocation processing
2554         specific to ELFv1.  Recognize that symbols are defined on
2555         their plt entries for ELFv2.
2556         (Target_powerpc::symval_for_branch): Assert if called for
2557         ELFv2 or ppc32.
2558         (Target_powerpc::Relocate::relocate): Use global entry plt
2559         stub for symbol value if such exists on ELFv2.
2560         (Target_powerpc::Relocate::relocate): Don't call
2561         symval_for_branch when ELFv2.  Do adjust for local entry
2562         offset when ELFv2.
2563         (Target_powerpc::do_dynsym_value): Set symbols to global entry
2564         plt stub for ELFv2.
2565         (Target_powerpc::do_plt_address_for_global): Similarly.
2566
2567 2013-11-14  Cary Coutant  <ccoutant@google.com>
2568
2569         Revert patch -- this did not fix the problem, and there is
2570         no race there.
2571
2572         2013-11-14  Cary Coutant  <ccoutant@google.com>
2573
2574             PR gold/14860
2575             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2576             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2577             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2578             updating fde_offsets_.
2579             (Eh_frame_hdr::lock_): New data member.
2580
2581 2013-11-14  Cary Coutant  <ccoutant@google.com>
2582
2583         * dwp.cc (Dwo_file_entry): New type.
2584         (File_list): Use Dwo_file_entry.
2585         (Dwo_file::verify): New function.
2586         (Dwo_file::verify_dwo_list): New function.
2587         (Dwo_file::sized_verify_dwo_list): New function.
2588         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
2589         list.
2590         (Dwp_options): New enum type.
2591         (dwp_options): Add --verify-only.
2592         (usage): Likewise.
2593         (main): Likewise.
2594         * dwp.h (gold_info): Add declaration.
2595
2596 2013-11-14  Cary Coutant  <ccoutant@google.com>
2597
2598         PR gold/14860
2599         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2600         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2601         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2602         updating fde_offsets_.
2603         (Eh_frame_hdr::lock_): New data member.
2604
2605 2013-11-06  Cary Coutant  <ccoutant@google.com>
2606
2607         PR gold/15758
2608         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
2609         before reloc sections.
2610
2611 2013-11-04  Alan Modra  <amodra@gmail.com>
2612
2613         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
2614         (Symbol::needs_dynamic_reloc): Test new flag.
2615         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
2616         (Target_powerpc::Scan::get_reference_flags): Add target param.
2617         Return FUNC_DESC_ABI for 64-bit ELFv1.
2618         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
2619         call.
2620         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
2621         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
2622
2623 2013-10-31  Cary Coutant  <ccoutant@google.com>
2624
2625         Restore support for dwp v2 DWARF package file format.
2626
2627         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2628         tu_length parameter.  Adjust all callers.
2629         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2630         * dwp.cc: Include dwarf.h.
2631         (Section_bounds): New struct type.
2632         (Unit_set): New struct type.
2633         (Dwo_file::Dwo_file): Initialize new data member.
2634         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2635         Combine and rename to...
2636         (Dwo_file::read_unit_index): ...this.
2637         (Dwo_file::sized_read_compunit_index)
2638         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2639         (Dwo_file::sized_read_unit_index): ...this.
2640         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2641         parameters; add section_id parameter.
2642         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2643         (Dwo_file::add_unit_set): ...this.
2644         (Dwo_file::shndx_map_): Remove.
2645         (Dwo_file::sect_offsets_): New data member.
2646         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2647         (Dwp_output_file::add_section): Rename to...
2648         (Dwp_output_file::add_contribution): ...this.
2649         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2650         (Dwp_output_file::add_tu_set): Likewise.
2651         (Dwp_output_file::Contribution): New type.
2652         (Dwp_output_file::Section::contributions): New data member.
2653         (Dwp_output_file::Cu_or_tu_set): Remove.
2654         (Dwp_output_file::Section::Section): New ctor.
2655         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2656         (Dwp_output_file::Dwp_index::Section_table): New type.
2657         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2658         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2659         parameter.
2660         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2661         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2662         (Dwp_output_file::Dwp_index::section_table): New member function.
2663         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2664         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2665         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2666         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2667         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2668         (Dwp_output_file::Dwp_index::section_table_): New data member.
2669         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2670         (Dwp_output_file::add_output_section): New member function.
2671         (Dwp_output_file::write_new_section): New member function.
2672         (Dwp_output_file::write_contributions): New member function.
2673         (Dwp_output_file::section_id_map_): New data member.
2674         (class Dwo_id_info_reader): Remove.
2675         (class Unit_reader): New class.
2676         (get_dwarf_section_name): New function.
2677         (Dwo_file::read_executable): Adjust initializations of class data.
2678         (Dwo_file::read): Add support for v2 package file format.
2679         (Dwo_file::read_unit_index): Likewise.
2680         (Dwo_file::sized_read_unit_index): Likewise.
2681         (Dwo_file::copy_section): Likewise.
2682         (Dwo_file::add_unit_set): Likewise.
2683         (Dwp_output_file::add_output_section): Likewise.
2684         (Dwp_output_file::add_contribution): Likewise.
2685         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2686         for empty slot.
2687         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2688         file format.
2689         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2690         slot.
2691         (Dwp_output_file::initialize): Remove unused function.
2692         (Dwp_output_file::finalize): Add support for v2 package file format.
2693         (Dwp_output_file::write_index): Likewise.
2694         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2695         function prototype.
2696
2697 2013-10-31  Cary Coutant  <ccoutant@google.com>
2698
2699         * configure.ac: Fix check for -fmerge-constants.
2700         * configure.ac: Regenerate.
2701
2702 2013-10-30  Roland McGrath  <mcgrathr@google.com>
2703
2704         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
2705         Correct 9-byte nop sequence to match what the assembler generates.
2706
2707 2013-10-30  Alan Modra  <amodra@gmail.com>
2708
2709         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
2710         ppc64_local_entry_offset, ppc64_local_entry_offset,
2711         do_read_symbols): New functions.
2712         (Powerpc_relobj::e_flags_, st_other_): New vars.
2713         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
2714         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
2715         (Powerpc_relobj::e_flags_): New var.
2716         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
2717         and adjust for ELFv2.
2718         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
2719         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
2720         (Powerpc_dynobj::do_find_special_sections): Likewise.
2721         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
2722         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
2723         to ELFv2 local entry.
2724         (Target_powerpc::do_relax): No thread safe barriers needed for
2725         ELFv2.
2726         (Output_data_plt_powerpc::initial_plt_entry_size_,
2727         plt_entry_size): Delete.  Replace all uses with
2728         first_plt_entry_offset() and plt_entry_size().
2729         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
2730         reserved_size parm.  Update callers.
2731         (Output_data_plt_powerpc::entry_count): Update.
2732         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
2733         and use Target_powerpc::first_plt_entry_offset().
2734         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
2735         rename to plt_entry_size.
2736         (Output_data_plt_powerpc::add_ifunc_entry,
2737         add_local_ifunc_entry): Adjust reloc for ELFv2.
2738         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
2739         (glink_eh_frame_fde_64v2): New.
2740         (Stub_table::plt_call_size): Support ELFv2 sizing.
2741         (Output_data_glink::add_eh_frame): Use the new FDE.
2742         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
2743         (Stub_table::do_write): Write ELFv2 stubs and glink.
2744         (Target_powerpc::Relocate::relocate): Replaces nop after call
2745         with ld 2,24(1) and adjust local offset destination for ELFv2.
2746
2747 2013-10-30  Alan Modra  <amodra@gmail.com>
2748
2749         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
2750         (Target_powerpc::Scan::global, local): Likewise.
2751         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
2752         on all ppc64 @h and @ha relocs.
2753
2754 2013-10-14  Alan Modra  <amodra@gmail.com>
2755
2756         * output.h (Output_data_got::add_constant): Tidy.
2757         (Output_data_got::add_constant_pair): New function.
2758         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
2759         methods used so as to first call reserve_ent().
2760
2761 2013-10-11  Roland McGrath  <mcgrathr@google.com>
2762
2763         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
2764         add_got_entry and add_got_entry_pair.
2765
2766         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
2767         (HAVE_PUBNAMES): Likewise.
2768         * configure: Regenerate.
2769
2770         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
2771         * testsuite/Makefile.in: Regenerate.
2772
2773         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
2774         Remove const from declaration.
2775         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
2776         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
2777         * output.h (Output_file_header): Remove const from member target_
2778         and corresponding constructor argument.
2779         * output.cc (Output_file_header::Output_file_header): Update prototype.
2780         (Output_file_header::do_sized_write): Use this->target_ in place
2781         of parameters()->target().
2782
2783         * testsuite/undef_symbol.cc (Foo::get_a): New method.
2784
2785         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
2786         * configure: Regenerate.
2787         * Makefile.in: Regenerate.
2788         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
2789         * testsuite/merge_string_literals_2.c: Likewise.
2790         * testsuite/Makefile.am
2791         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
2792         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
2793         literal -fmerge-constants.
2794         * testsuite/Makefile.in: Regenerate.
2795
2796         * i386.cc (Target_i386): Remove unused member dynbss_.
2797         * arm.cc (Target_arm): Likewise.
2798         * powerpc.cc (Target_powerpc): Likewise.
2799         * sparc.cc (Target_sparc): Likewise.
2800         * tilegx.cc (Target_tilegx): Likewise.
2801         * x86_64.cc (Target_x86_64): Likewise.
2802         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
2803         type_signature_, type_offset_.
2804         * plugin.h (Plugin_hook): Remove unused member layout_.
2805         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
2806         mapfile_.
2807         (Read_member): Remove unused members input_objects_, symtab_,
2808         mapfile_, layout_.
2809         (Check_library): Remove unused member symtab_.
2810         * archive.h (Lib_group): Remove unused member lib_.
2811         * archive.cc (Lib_group::Lib_group): Update initializer.
2812         * incremental.h (Incremental_binary): Remove unused member target_.
2813         (Incremental_script_entry): Removed unused member script_.
2814         * layout.h (Write_symbols_task): Remove unused member input_objects_.
2815         * icf.h (Icf): Remove unused member num_tracked_relocs.
2816
2817         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
2818         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
2819         its only use.
2820         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
2821
2822         * archive.h: Use struct rather than class for forward declaration
2823         of Read_symbols_data.
2824
2825 2013-10-07  Cary Coutant  <ccoutant@google.com>
2826
2827         PR gold/16010
2828         * testsuite/Makefile.am (icf_test): Fix dependencies.
2829         (icf_safe_test): Likewise.
2830         (icf_safe_so_test): Likewise.
2831         (large_symbol_alignment): Add empty _LDADD rule.
2832         * testsuite/Makefile.in: Regenerate.
2833
2834 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
2835
2836         PR gold/15927
2837         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
2838         relocation for R_X86_64_32 on x32.
2839
2840 2013-08-27  Roland McGrath  <mcgrathr@google.com>
2841
2842         * output.cc (Output_segment::set_section_addresses): Take new
2843         Target* argument.  If target->isolate_execinstr() and the segment
2844         is executable and starts at a target->abi_pagesize() boundary,
2845         pad its end out to a target->abi_pagesize() boundary with code fill.
2846         * output.h (Output_segment::set_section_addresses): Update decl.
2847         * layout.h (Layout::check_output_data_for_reset_values): Take new
2848         argument RELAX_OUTPUTS.
2849         (Layout): New member relax_output_list_.
2850         (Layout::add_relax_output): New method.
2851         * layout.cc (Layout::Layout): Update constructor.
2852         (Layout::reset_relax_output): New method.
2853         (Layout::clean_up_after_relaxation): Call it.
2854         (Layout::prepare_for_relaxation): Update caller.
2855         (Layout::set_segment_offsets): Update callers of set_section_addresses.
2856         Call reset_relax_output before re-processing segments for
2857         isolate_execinstr case.
2858         (Layout::write_data): Handle relax_output_list_.
2859         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
2860         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
2861
2862 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
2863
2864         PR binutils/15834
2865         * object.h: Fix typos.
2866
2867 2013-08-16  Roland McGrath  <mcgrathr@google.com>
2868
2869         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
2870         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
2871
2872 2013-08-07  Cary Coutant  <ccoutant@google.com>
2873
2874         Revert support for v2 DWP files:
2875
2876         2013-03-01  Cary Coutant  <ccoutant@google.com>
2877
2878             Add dwp support for v2 DWARF package file format.
2879             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2880             tu_length parameter.  Adjust all callers.
2881             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2882             * dwp.cc: Include dwarf.h.
2883             (Section_bounds): New struct type.
2884             (Unit_set): New struct type.
2885             (Dwo_file::Dwo_file): Initialize new data member.
2886             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2887             Combine and rename to...
2888             (Dwo_file::read_unit_index): ...this.
2889             (Dwo_file::sized_read_compunit_index)
2890             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2891             (Dwo_file::sized_read_unit_index): ...this.
2892             (Dwo_file::copy_section): Remove section_name, is_str_offsets
2893             parameters; add section_id parameter.
2894             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2895             (Dwo_file::add_unit_set): ...this.
2896             (Dwo_file::shndx_map_): Remove.
2897             (Dwo_file::sect_offsets_): New data member.
2898             (Dwp_output_file::Dwp_output_file): Initialize new data members.
2899             (Dwp_output_file::add_section): Rename to...
2900             (Dwp_output_file::add_contribution): ...this.
2901             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2902             (Dwp_output_file::add_tu_set): Likewise.
2903             (Dwp_output_file::Contribution): New type.
2904             (Dwp_output_file::Section::contributions): New data member.
2905             (Dwp_output_file::Cu_or_tu_set): Remove.
2906             (Dwp_output_file::Section::Section): New ctor.
2907             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2908             (Dwp_output_file::Dwp_index::Section_table): New type.
2909             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2910             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2911             parameter.
2912             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2913             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2914             (Dwp_output_file::Dwp_index::section_table): New member function.
2915             (Dwp_output_file::Dwp_index::section_table_end): New member function.
2916             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2917             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2918             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2919             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2920             (Dwp_output_file::Dwp_index::section_table_): New data member.
2921             (Dwp_output_file::Dwp_index::section_mask_): New data member.
2922             (Dwp_output_file::add_output_section): New member function.
2923             (Dwp_output_file::write_new_section): New member function.
2924             (Dwp_output_file::write_contributions): New member function.
2925             (Dwp_output_file::section_id_map_): New data member.
2926             (class Dwo_id_info_reader): Remove.
2927             (class Unit_reader): New class.
2928             (get_dwarf_section_name): New function.
2929             (Dwo_file::read_executable): Adjust initializations of class data.
2930             (Dwo_file::read): Add support for v2 package file format.
2931             (Dwo_file::read_unit_index): Likewise.
2932             (Dwo_file::sized_read_unit_index): Likewise.
2933             (Dwo_file::copy_section): Likewise.
2934             (Dwo_file::add_unit_set): Likewise.
2935             (Dwp_output_file::add_output_section): Likewise.
2936             (Dwp_output_file::add_contribution): Likewise.
2937             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2938             for empty slot.
2939             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2940             file format.
2941             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2942             slot.
2943             (Dwp_output_file::initialize): Remove unused function.
2944             (Dwp_output_file::finalize): Add support for v2 package file format.
2945             (Dwp_output_file::write_index): Likewise.
2946             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2947             function prototype.
2948
2949 2013-07-31  Cary Coutant  <ccoutant@google.com>
2950
2951         * object.cc (Sized_relobj::do_output_section_address): New function.
2952         (Sized_relobj): Instantiate explicitly.
2953         * object.h (Object::output_section_address): New function.
2954         (Object::do_output_section_address): New function.
2955         (Sized_relobj::do_output_section_address): New function.
2956         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
2957
2958 2013-07-30  Cary Coutant  <ccoutant@google.com>
2959             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2960
2961         * parameters.cc (Parameters::entry): Return target-specific entry
2962         symbol name.
2963         * target.h (Target::entry_symbol_name): New function.
2964         (Target_info::entry_symbol_name): New data member.
2965
2966         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
2967         * i386.cc (Target_i386::i386_info): Likewise.
2968         (Target_i386_nacl::i386_nacl_info): Likewise.
2969         * sparc.cc (Target_sparc::sparc_info): Likewise.
2970         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
2971         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
2972         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
2973         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2974
2975 2013-07-22  Sterling Augustine  <saugustine@google.com>
2976
2977         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
2978         Convert parameter shndx to local variable. Add parameters symtab
2979         and symtab_size.  Scan over section names.  Find relocation
2980         section corresponding to current section.  Create and initialize
2981         reloc_mapper_ and reloc_type_.
2982         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
2983         unit_length to off_t.  Initialize member unit_length_.  Fill in field
2984         cu_offset_.
2985         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2986         Initialize new fields unit_length_ and cu_offset_.
2987         (Dwarf_pubnames_table::read_section): Update prototype.
2988         (Dwarf_pubnames_table::cu_offset): New member function.
2989         (Dwarf_pubnames_table::subsection_size): Likewise.
2990         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
2991         New fields.
2992         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
2993         member functions public.
2994         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
2995         Update comment.  Rework logic.  Move repeated parts to...
2996         (Gdb_index_info_reader::read_pubtable): ...here. New function.
2997         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
2998         pubtypes_table_, and stmt_list_offset.
2999         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
3000         Gdb_index::find_pubtype_offset,
3001         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
3002         (Gdb_index::pubnames_read): Update prototype and rework logic.
3003         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
3004         Forward declare.
3005         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
3006         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
3007         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
3008         Gdb_index::map_pubtable_to_dies):
3009         Declare functions.
3010         (Gdb_index::pubnames_read): Update declaration.
3011         (Gdb_index::Pubname_offset_map): New type.
3012         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
3013         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
3014         Gdb_index::stmt_list_offset): Declare.
3015         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
3016         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
3017         Gdb_index::pubtypes_offset_): Remove.
3018
3019 2013-07-19  Roland McGrath  <mcgrathr@google.com>
3020
3021         * options.h (General_options): Add -Trodata-segment option.
3022         * parameters.cc (Parameters::check_rodata_segment): New function.
3023         (Parameters::set_target_once): Call it.
3024         * parameters.h (Parameters): Declare it (private member function).
3025         * layout.cc (load_seg_unusable_for_headers): New function, broken
3026         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
3027         then validate rodata segment rather than text segment.
3028         (relaxation_loop_body): Call that.
3029         (is_text_segment): New function.  Don't admit a non-executable
3030         segment if TARGET->isolate_execinstr().
3031         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
3032
3033 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
3034
3035         PR gold/15070
3036         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
3037         * nacl.h (Sniff_file::View::View): Request aligned view.
3038
3039 2013-07-11  Cary Coutant  <ccoutant@google.com>
3040
3041         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
3042         correct BRLT entry size.
3043
3044 2013-07-03  Alan Modra  <amodra@gmail.com>
3045
3046         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
3047         comment.
3048
3049 2013-07-01  Cary Coutant  <ccoutant@google.com>
3050
3051         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
3052         reloc_type_.
3053         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
3054         (Dwarf_ranges_table::lookup_reloc): New function.
3055         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
3056         reloc_type_.
3057         (Dwarf_ranges_table::lookup_reloc): New function.
3058         (Dwarf_ranges_table::reloc_type_): New data member.
3059
3060 2013-06-27  Jing Yu  <jingyu@google.com>
3061
3062         PR gold/15662
3063         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
3064         function.
3065         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
3066         (Target_powerpc::do_relax): Call the above.
3067
3068 2013-06-27  Cary Coutant  <ccoutant@google.com>
3069
3070         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
3071         on garbage collected .opd section.
3072
3073 2013-06-27  Alan Modra  <amodra@gmail.com>
3074
3075         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
3076         is non-zero.
3077         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
3078         (Target_powerpc::do_function_location): Likewise for loc->shndx.
3079
3080 2013-06-14  Cary Coutant  <ccoutant@google.com>
3081
3082         * resolve.cc (Symbol::override_base): Don't override st_type
3083         from plugin placeholder symbols.
3084         (Symbol_table::resolve): Likewise.
3085         (Symbol_table::should_override): Don't complain about TLS mismatch
3086         if the TO symbol is a plugin placeholder.
3087         * testsuite/Makefile.am (plugin_test_tls): New test.
3088         * testsuite/Makefile.in: Regenerate.
3089         * testsuite/plugin_test_tls.sh: New test script.
3090         * testsuite/two_file_test_2_tls.cc: New test source.
3091         * testsuite/two_file_test_tls.cc: New test source.
3092
3093 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3094
3095         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
3096         the maximum segment alignment is larger than the page size.
3097         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
3098         correctly aligns the symbols with large alignemnt.
3099         * testsuite/Makefile.in: Regenerate.
3100         * testsuite/large_symbol_alignment.cc: New file.
3101
3102 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3103             Sriraman Tallam  <tmsriram@google.com>
3104
3105         * options.h (sort_section): New option.
3106         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
3107         Rename from Input_section_sort_section_name_special_ordering_compare.
3108         (Input_section_sort_section_name_compare): New struct.
3109         * output.cc (Output_section::Input_section_sort_section_name_compare::
3110         operator()): New function.
3111         (Output_section::sort_attached_input_sections): Use new sort function
3112         for .text if --sort-section=name is specified.
3113         * layout.cc (Layout::make_output_section):
3114         Add sorting by name when --sort-section=name is specified.
3115         * testsuite/Makefile.am (text_section_grouping): Test option
3116         --sort-section=name.
3117         * testsuite/Makefile.in: Regenerate.
3118         * testsuite/section_sorting_name.cc: New file.
3119         * testsuite/section_sorting_name.sh: New file.
3120
3121 2013-05-21  Cary Coutant  <ccoutant@google.com>
3122
3123         * symtab.h (Symbol::is_cxx_vtable): New function.
3124         * target-reloc.h (relocate_section): Check for vtable symbol.
3125         * testsuite/Makefile.am (missing_key_func.sh): New test case.
3126         * testsuite/Makefile.in: Regenerate.
3127         * testsuite/missing_key_func.cc: New test source.
3128         * testsuite/missing_key_func.sh: New test script.
3129
3130 2013-05-21  Cary Coutant  <ccoutant@google.com>
3131
3132         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
3133         type of enclosing symbol.
3134         (Relocate_info::location): Check symbol type when describing symbol.
3135         * object.h (Symbol_location_info): Remove unused line_number;
3136         add enclosing_symbol_type.
3137         * testsuite/debug_msg.sh: Adjust expected output.
3138
3139 2013-05-13  Cary Coutant  <ccoutant@google.com>
3140
3141         * configure.ac: Export DEFAULT_TARGET.
3142         * configure: Regenerate.
3143         * Makefile.in: Regenerate.
3144         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
3145         * testsuite/Makefile.in: Regenerate.
3146         * testsuite/debug_msg.sh: Delete duplicate tests.
3147         Don't check undef_int error message match for powerpc where the
3148         source file and line number aren't available.
3149
3150 2013-05-10  Roland McGrath  <mcgrathr@google.com>
3151
3152         * options.h (General_options): Add --rosegment-gap option.
3153         * options.cc (finalize): --rosegment-gap implies --rosegment.
3154         * layout.cc (set_segment_offsets): Let user option override
3155         target->rosegment_gap().
3156
3157 2013-05-10  Roland McGrath  <mcgrathr@google.com>
3158
3159         * options.h (General_options): Remove leading space from help
3160         messages for -nostdlib and --rosegment.
3161
3162 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
3163
3164         PR ld/15365
3165         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
3166
3167 2013-05-03  Alan Modra  <amodra@gmail.com>
3168
3169         * merge.cc (Output_merge_string::do_add_input_section): Correct
3170         scan for number of strings.  Rename vars to avoid shadowing.
3171         Include missing terminator in input_size_.
3172
3173 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
3174
3175         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
3176         Restore empty string handling.
3177
3178 2013-05-01  Cary Coutant  <ccoutant@google.com>
3179
3180         * stringpool.cc (Stringpool_template::new_key_offset): Fix
3181         uninitialized warning.
3182
3183 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3184
3185         * output.cc (Output_section::add_merge_input_section): Allow
3186         to merge sections if the alignment is more than character size.
3187         * merge.h (Output_merge_string::Output_merge_string): Remove
3188         assert.
3189         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
3190         only not-null strings. Check the alignment of strings.
3191         * stringpool.h
3192         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
3193         alignment as the argument.
3194         (Stringpool_template<Stringpool_char>::addralign_): New class member.
3195         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
3196         Align non-zero length strings according to the addralign_.
3197         (Stringpool_template<Stringpool_char>::set_string_offsets):
3198         Updating offsets according to the given alignment.
3199         * testsuite/Makefile.am (text_section_grouping): Test if string
3200         literals are getting merged.
3201         * testsuite/Makefile.in: Regenerate.
3202         * testsuite/merge_string_literals_1.c: New file.
3203         * testsuite/merge_string_literals_2.c: Ditto.
3204         * testsuite/merge_string_literals.sh: Ditto.
3205
3206 2013-04-26  Ian Lance Taylor  <iant@google.com>
3207
3208         * target-reloc.h (relocate_section): If the reloc offset is out of
3209         range, pass VIEW as NULL to relocate.relocate.
3210         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
3211         * i386.cc (Target_i386::Relocate::relocate): Likewise.
3212         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
3213         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
3214         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
3215         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3216
3217 2013-04-26  Geoff Pike  <gpike@chromium.org>
3218
3219         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
3220         * layout.cc (Hash_task): New class.
3221         (Layout::queue_build_id_tasks): New function.
3222         (Layout::write_build_id): Handle single-thread portion of build ID
3223         computation.  (In some cases, all of it is single-threaded.)  Replace
3224         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
3225         functionality in fewer lines of code.
3226         * layout.h (Layout::queue_build_id_tasks): New function declaration.
3227         * options.h (General_options): make "--build-id" default to tree
3228         rather than sha1.  Add two new options related to --build-id=tree:
3229         --build-id-chunk-size-for-treehash and
3230         --build-id-min-file-size-for-treehash.
3231         * Makefile.am: add testing of --build-id=tree and related new options
3232         (these tests will be invoked by "make check").
3233         * Makefile.in: Regenerate.
3234
3235 2013-04-25  Alan Modra  <amodra@gmail.com>
3236
3237         * configure.tgt: Add powerpcle and powerpc64le.
3238
3239 2013-04-22  Alan Modra  <amodra@gmail.com>
3240
3241         PR gold/15355
3242         * layout.cc (Layout::segment_precedes): Allow more than one
3243         segment with the same type and flags.
3244
3245 2013-04-15  Cary Coutant  <ccoutant@google.com>
3246
3247         * layout.cc (Layout::set_relocatable_section_offsets): Don't
3248         allocate space in file for BSS sections.
3249
3250 2013-04-15  Cary Coutant  <ccoutant@google.com>
3251
3252         * script-sections.cc (Orphan_output_section): Reset address
3253         to zero after each orphaned section for relocatable links.
3254
3255 2013-04-15  Cary Coutant  <ccoutant@google.com>
3256
3257         * symtab.cc (Symbol_table::sized_write_globals): Subtract
3258         section starting address for relocatable link.
3259         * testsuite/Makefile.am (script_test_11): New test.
3260         * testsuite/Makefile.in: Regenerate.
3261         * testsuite/script_test_11.c: New source file.
3262         * testsuite/script_test_11.t: New linker script.
3263
3264 2013-04-13  Alan Modra  <amodra@gmail.com>
3265
3266         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
3267         owner when sections are not adjacent and exceed group size.
3268         (Target_powerpc::group_sections): Handle corner case.
3269         (Target_powerpc::Branch_info::make_stub): Handle case where
3270         stub table doesn't exist due to branches in non-exec sections.
3271         (Target_powerpc::Relocate::relocate): Likewise.
3272
3273 2013-04-11  Alan Modra  <amodra@gmail.com>
3274
3275         PR gold/15354
3276         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
3277         .branch_lt to match bfd ld.  Adjust comments throughout file.
3278
3279 2013-04-04  Ian Lance Taylor  <iant@google.com>
3280
3281         GCC PR c++/56840
3282         * object.cc (do_layout_deferred_sections): Handle .eh_frame
3283         sections before checking whether they are included in the link.
3284
3285 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
3286
3287         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
3288         object before calling the plugin claim_file handler.  Pass the elf
3289         object of the archive to the plugin. Delete the elf object if the
3290         plugin claims the file.
3291
3292 2013-03-21  Alan Modra  <amodra@gmail.com>
3293
3294         * layout.cc (Layout::set_segment_offsets): Accept writable .text
3295         segment when omagic.
3296
3297 2013-03-21  Alan Modra  <amodra@gmail.com>
3298
3299         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
3300         comparison warning.
3301         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
3302         uninitialized" warning.
3303
3304 2013-03-20  Alan Modra  <amodra@gmail.com>
3305
3306         * symtab.h (Symbol::clear_version): New function.
3307         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
3308         is_needed by weak references.  Clear version for symbols defined
3309         in as-needed objects that are not needed.
3310
3311 2013-03-15  Alan Modra  <amodra@gmail.com>
3312
3313         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
3314         static and public.  Add report_err param.  Return false for data refs.
3315         (Target_powerpc::rela_dyn_section): New overloaded function.
3316         (Target_powerpc::plt_, iplt_): Elucidate.
3317         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
3318         (Output_data_plt_powerpc::do_write): Don't write .iplt.
3319         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
3320         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
3321         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
3322         push_branch and make_plt_entry for ifunc syms when
3323         reloc_needs_plt_for_ifunc.
3324         (Target_powerpc::Relocate::relocate): Don't use plt entry value
3325         for ifunc unless reloc_needs_plt_for_ifunc.
3326
3327 2013-03-15  Alan Modra  <amodra@gmail.com>
3328
3329         * gc.h (gc_process_relocs): Don't look through function descriptors.
3330         * icf.cc (get_section_contents): Do so here instead.
3331
3332 2013-03-13  Alan Modra  <amodra@gmail.com>
3333
3334         * powerpc.cc (is_branch_reloc): Forward declare.
3335         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
3336         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
3337         false for 64-bit, true for 32-bit non-branch relocs.
3338         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
3339         * testsuite/Makefile.am (icf_test): Use linker map file instead of
3340         nm output.
3341         (icf_safe_test): Generate linker map file as well as nm output.
3342         (icf_safe_so_test): Likewise.
3343         * testsuite/Makefile.in: Regenerate.
3344         * testsuite/icf_test.sh: Parse linker map file to determine
3345         section folding.
3346         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
3347         * testsuite/icf_safe_so_test.sh: Likewise.
3348         (X86_32_or_ARM_specific_safe_fold): Merge into..
3349         (arch_specific_safe_fold): ..this.
3350         (X86_64_specific_safe_fold): Delete unused function.
3351
3352 2013-03-12  Alan Modra  <amodra@gmail.com>
3353
3354         * gc.h (gc_process_relocs): Look through function descriptors
3355         to determine shndx, symvalue and addend used by ICF.  Tidy
3356         variable duplication.
3357
3358 2013-03-11  Alan Modra  <amodra@gmail.com>
3359
3360         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
3361         * layout.cc (Layout_task_runner::run): ..to here.
3362         * symtab.h (struct Symbol_location): Extract from..
3363         (class Symbol_table): ..here.
3364         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
3365         * target.h (class Target): Add function_location and
3366         do_function_location functions.
3367         (class Sized_target): Add do_function_location.
3368         * object.h (class Sized_relobj_file): Move find_shdr..
3369         (class Object): ..to here.
3370         * object.cc: Likewise.  Update to suit.  Instantiate.
3371         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
3372         * powerpc.cc (class Powerpc_dynobj): New.
3373         (Target_powerpc::do_function_location): New function.
3374         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
3375         (Powerpc_dynobj::do_read_symbols): New function.
3376         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
3377
3378 2013-03-08  Ian Lance Taylor  <iant@google.com>
3379
3380         * options.cc (General_options::string_to_object_format): Accept
3381         "default".
3382
3383 2013-03-08  Alan Modra  <amodra@gmail.com>
3384
3385         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
3386         pointer to Post_fde.
3387         (struct Post_fde): Move definition to here..
3388         * ehframe.cc (struct Post_fde): ..from here.
3389         (Cie::write): Don't alloc Post_fde.
3390         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
3391
3392 2013-03-07  Alan Modra  <amodra@gmail.com>
3393
3394         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
3395         relocation referencing .LC0.
3396         * testsuite/discard_locals_test.sh: Remove FIXMEs.
3397
3398 2013-03-07  Alan Modra  <amodra@gmail.com>
3399
3400         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
3401         always_inline.  Add assembly for powerpc to avoid GOT.
3402
3403 2013-03-07  Alan Modra  <amodra@gmail.com>
3404
3405         * testsuite/script_test_10.sh: Don't test .bss section
3406         header number.
3407
3408 2013-03-06  Alan Modra  <amodra@gmail.com>
3409
3410         * powerpc.cc (class Powerpc_relobj): Move some member functions.
3411         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
3412         all callers.  Handle folded sections.
3413         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
3414         to Powerpc_relobj.
3415         (Global_symbol_visitor_opd::operator()): Likewise.
3416
3417 2013-03-04  Alan Modra  <amodra@gmail.com>
3418
3419         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
3420         * testsuite/Makefile.in: Regenerate.
3421
3422 2013-03-01  Cary Coutant  <ccoutant@google.com>
3423
3424         Add dwp support for v2 DWARF package file format.
3425         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
3426         tu_length parameter.  Adjust all callers.
3427         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
3428         * dwp.cc: Include dwarf.h.
3429         (Section_bounds): New struct type.
3430         (Unit_set): New struct type.
3431         (Dwo_file::Dwo_file): Initialize new data member.
3432         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
3433         Combine and rename to...
3434         (Dwo_file::read_unit_index): ...this.
3435         (Dwo_file::sized_read_compunit_index)
3436         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
3437         (Dwo_file::sized_read_unit_index): ...this.
3438         (Dwo_file::copy_section): Remove section_name, is_str_offsets
3439         parameters; add section_id parameter.
3440         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
3441         (Dwo_file::add_unit_set): ...this.
3442         (Dwo_file::shndx_map_): Remove.
3443         (Dwo_file::sect_offsets_): New data member.
3444         (Dwp_output_file::Dwp_output_file): Initialize new data members.
3445         (Dwp_output_file::add_section): Rename to...
3446         (Dwp_output_file::add_contribution): ...this.
3447         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
3448         (Dwp_output_file::add_tu_set): Likewise.
3449         (Dwp_output_file::Contribution): New type.
3450         (Dwp_output_file::Section::contributions): New data member.
3451         (Dwp_output_file::Cu_or_tu_set): Remove.
3452         (Dwp_output_file::Section::Section): New ctor.
3453         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
3454         (Dwp_output_file::Dwp_index::Section_table): New type.
3455         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
3456         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
3457         parameter.
3458         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
3459         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
3460         (Dwp_output_file::Dwp_index::section_table): New member function.
3461         (Dwp_output_file::Dwp_index::section_table_end): New member function.
3462         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
3463         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
3464         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
3465         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
3466         (Dwp_output_file::Dwp_index::section_table_): New data member.
3467         (Dwp_output_file::Dwp_index::section_mask_): New data member.
3468         (Dwp_output_file::add_output_section): New member function.
3469         (Dwp_output_file::write_new_section): New member function.
3470         (Dwp_output_file::write_contributions): New member function.
3471         (Dwp_output_file::section_id_map_): New data member.
3472         (class Dwo_id_info_reader): Remove.
3473         (class Unit_reader): New class.
3474         (get_dwarf_section_name): New function.
3475         (Dwo_file::read_executable): Adjust initializations of class data.
3476         (Dwo_file::read): Add support for v2 package file format.
3477         (Dwo_file::read_unit_index): Likewise.
3478         (Dwo_file::sized_read_unit_index): Likewise.
3479         (Dwo_file::copy_section): Likewise.
3480         (Dwo_file::add_unit_set): Likewise.
3481         (Dwp_output_file::add_output_section): Likewise.
3482         (Dwp_output_file::add_contribution): Likewise.
3483         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
3484         for empty slot.
3485         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
3486         file format.
3487         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
3488         slot.
3489         (Dwp_output_file::initialize): Remove unused function.
3490         (Dwp_output_file::finalize): Add support for v2 package file format.
3491         (Dwp_output_file::write_index): Likewise.
3492         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
3493         function prototype.
3494
3495 2013-03-01  Cary Coutant  <ccoutant@google.com>
3496
3497         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
3498         function into class definition in header file.
3499         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
3500         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
3501         New function.
3502         (Dwarf_info_reader::check_buffer): Move here from .cc file.
3503
3504 2013-02-28  Alan Modra  <amodra@gmail.com>
3505
3506         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
3507         * target.cc (Target::do_plt_fde_location): New function.
3508         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
3509         accessor function, and constructor param.
3510         (struct Post_fde, Post_fdes): Declare.
3511         (Cie::write): Add post_fdes param.
3512         * ehframe.cc (Fde::write): Use plt_fde_location.
3513         (struct Post_fde): Define.
3514         (Cie::write): Stash FDEs added post merge mapping.
3515         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
3516         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
3517         (Eh_frame::do_sized_write): Arrange to write post map FDES after
3518         other FDEs.
3519         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
3520         (Target_powerpc::has_glink): New function.
3521         (Target_powerpc::do_relax): Add eh_frame info for stubs.
3522         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
3523         glink_eh_frame_fde_32, default_fde): New data.
3524         (Stub_table::eh_frame_added_): New var.
3525         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
3526         Make const.
3527         (Stub_table::add_eh_frame): New function.
3528         (Output_data_glink::add_eh_frame): New function.
3529         (Target_powerpc::make_glink_section): Call add_eh_frame.
3530
3531 2013-02-15  Ian Lance Taylor  <iant@google.com>
3532
3533         * options.h (DEFINE_uint64_alias): Define.
3534         (class General_options): Add -Ttext-segment as an alias for
3535         -Ttext.
3536
3537 2013-02-15  Alan Modra  <amodra@gmail.com>
3538
3539         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
3540         (Stub_table::do_write): ..here, two places.
3541         (Stub_table::plt_call_size): Use it here too.
3542
3543 2013-02-11  Ian Lance Taylor  <iant@google.com>
3544
3545         * descriptors.cc (Descriptors::close_all): New function.
3546         * descriptors.h (class Descriptors): Declare close_all.
3547         (close_all_descriptors): New inline function.
3548         * plugin.cc: Include "descriptors.h".
3549         (Plugin_manager::cleanup): Call close_all_descriptors.
3550
3551 2013-02-06  Alan Modra  <amodra@gmail.com>
3552
3553         * README: Update coding style link.
3554
3555 2013-01-28  Cary Coutant  <ccoutant@google.com>
3556
3557         * dwp.cc (File_list): New typedef.
3558         (Dwo_name_info_reader): New class.
3559         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
3560         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
3561         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
3562         (Dwo_file::read_executable): New function.
3563         (Dwo_file::read): Move common setup code to ...
3564         (Dwo_file::make_object): ... here.
3565         (dwp_options): Add --exec/-e.
3566         (usage): Likewise.
3567         (main): Likewise.
3568
3569 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
3570
3571         * layout.cc (Layout::layout): Check for option text_reorder.
3572         (Layout::make_output_section): Ditto.
3573         * options.h (text_reorder): New option.
3574         * output.cc (Input_section_sort_compare): Remove special ordering
3575         of section names.
3576         (Output_section::
3577          Input_section_sort_section_name_special_ordering_compare::
3578          operator()): New function.
3579         (Output_section::sort_attached_input_sections): Use new sort function
3580         for .text.
3581         * output.h (Input_section_sort_section_name_special_ordering_compare):
3582         New struct.
3583         * testsuite/Makefile.am (text_section_grouping): Test option
3584         --no-text-reorder
3585         * testsuite/Makefile.in: Regenerate.
3586         * testsuite/text_section_grouping.sh: Check order of functions without
3587         default text reordering.
3588
3589 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3590
3591         * options.h (General_options): Change default to true for new_dtags.
3592
3593 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3594
3595         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
3596         when enable_new_dtags is false.  Only add DT_RUNPATH when
3597         enable_new_dtags is true.
3598
3599 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
3600
3601         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
3602         used in declaration and definition consistent.
3603         (Target_powerpc::symval_for_branch): Ditto.
3604
3605 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3606
3607         * testsuite/plugin_final_layout.cc: Fix comment.
3608
3609 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3610
3611         * layout.cc (Layout::layout): Do not do default sorting for
3612         text sections when section ordering is specified.
3613         (make_output_section): Ditto.
3614         * testsuite/plugin_final_layout.cc: Name the function sections
3615         to catch reordering issues.
3616
3617 2013-01-15  Alan Modra  <amodra@gmail.com>
3618
3619         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
3620         plt-thread-safe.
3621
3622 2013-01-15  Alan Modra  <amodra@gmail.com>
3623
3624         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
3625         * testsuite/Makefile.in: Regenerate.
3626
3627 2013-01-14  Alan Modra  <amodra@gmail.com>
3628
3629         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
3630         * testsuite/Makefile.in: Regenerate.
3631
3632 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
3633
3634         PR bfd/14430
3635         Fix mingw gold build with plugins enabled
3636         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
3637         * configure.ac: Export DLOPEN_LIBS and add headers check.
3638         * plugin.cc: Handle non-dlfcn case.
3639         * Makefile.in: Regenerate.
3640         * config.in: Regenerate.
3641         * configure: Regenerate.
3642         * testsuite/Makefile.in: Regenerate.
3643
3644 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
3645
3646         * output.h (sort_attached_input_sections): Change to be public.
3647         * script-sections.cc
3648         (Output_section_definition::set_section_addresses): Sort
3649         attached input sections according to section order before linker
3650         script assigns section addresses.
3651         (Orphan_output_section::set_section_addresses): Sort
3652         attached input sections according to section order before linker
3653         script assigns section addresses.
3654         * Makefile.am (final_layout.sh): Use a simple linker script to
3655         check if section ordering still works.
3656         * Makefile.in: Regenerate.
3657
3658 2013-01-09  Ben Cheng  <bccheng@google.com>
3659
3660         * arm.cc (Target_arm::attributes_accept_div): New function.
3661         (Target_arm::attributes_forbid_div): New function.
3662         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
3663         attribute using the same new functions as what bfd/elf32_arm.c
3664         does.
3665
3666 2013-01-07  Cary Coutant  <ccoutant@google.com>
3667
3668         PR gold/14993
3669         * output.cc (Output_section::add_input_section): For incremental
3670         updates, don't track input sections that are allocated from patch
3671         space.
3672
3673 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3674             Ian Lance Taylor  <iant@google.com>
3675
3676         PR gold/14897
3677         * configure.ac (--enable-ld): Removed.
3678         (install_as_default): Set to yes only for --enable-gold=default
3679         or --disable-ld.
3680         * configure: Regenerated.
3681
3682 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3683
3684         * options.h (General_options): Add -fuse-ld= for GCC linker
3685         option compatibility.
3686
3687 2013-01-04  Cary Coutant  <ccoutant@google.com>
3688
3689         * configure.ac: Fix typo restoring CXXFLAGS.
3690         * configure: Regenerate.
3691
3692 2013-01-04  Cary Coutant  <ccoutant@google.com>
3693
3694         * testsuite/Makefile.am (CXXLINK_S): New macro.
3695         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
3696         * testsuite/Makefile.in: Regenerate.
3697
3698 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
3699
3700         * version.cc (print_version): Update copyright year to 2013.
3701
3702 2012-12-20  Ian Lance Taylor  <iant@google.com>
3703
3704         * layout.cc (Layout::special_ordering_of_input_section): New
3705         function.
3706         (Layout::layout): If input section requires special ordering, must
3707         sort input sections.
3708         (Layout::make_output_section): May sort .text input sections.
3709         (Layout::is_section_name_prefix_grouped): Remove.
3710         * layout.h (class Layout): Declare
3711         special_ordering_of_input_section.  Don't declare
3712         is_section_name_prefix_grouped.
3713         * output.cc (Output_section::add_input_section): Revert last
3714         change.
3715         (Output_section::Input_section_sort::match_file_name): Don't crash
3716         if called on output section data.
3717         (Output_section::Input_section_sort_compare): Sort based on
3718         special ordering.
3719         (Output_section::Input_section_sort_section_order_index_compare):
3720         Revert last patch.
3721         (Output_section::sort_attached_input_sections): Likewise.
3722
3723 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
3724
3725         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
3726         * layout.h (Layout::is_section_name_prefix_grouped): New function.
3727         * output.cc (Output_section::add_input_section): Check if section
3728         name contains special prefix.  Keep input sections to sort such
3729         sections.
3730         (Output_section::Input_section_sort_section_order_index_compare
3731          ::operator()): Group sections according to prefixes.
3732         (Output_section::sort_attached_input_sections): Add condition to
3733         Input_section_entry constructor call.
3734         * testsuite/Makefile.am (text_section_grouping): New test.
3735         * testsuite/Makefile.in: Regenerate.
3736         * testsuite/text_section_grouping.cc: New file.
3737         * testsuite/text_section_grouping.sh: New file.
3738
3739 2012-12-17  Nick Clifton  <nickc@redhat.com>
3740
3741         * Makefile.am: Add copyright notice.
3742         * NEWS: Likewise.
3743         * README: Likewise.
3744         * configure.ac: Likewise.
3745         * ftruncate.c: Likewise.
3746         * Makefile.in: Regenerate.
3747
3748 2012-12-14  Cary Coutant  <ccoutant@google.com>
3749
3750         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
3751         --no-as-needed flag.
3752         (exception_separate_shared_12_test): Likewise.
3753         (incremental_copy_test): Likewise.
3754         * testsuite/Makefile.in: Regenerate.
3755
3756 2012-12-14  Cary Coutant  <ccoutant@google.com>
3757
3758         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
3759         (Dwp_output_file::Dwp_index::enter_set): Add assert.
3760
3761 2012-12-12  Alan Modra  <amodra@gmail.com>
3762
3763         * powerpc.cc (class Track_tls): New.
3764         (class Relocate, class Scan): Inherit Track_tls.
3765         (Target_powerpc::Scan::local, global): Track tls optimization
3766         and avoid creating plt entry for __tls_get_addr if all uses
3767         are optimized away.
3768         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
3769
3770 2012-12-12  Alan Modra  <amodra@gmail.com>
3771
3772         * options.h (General_options): Add --toc-sort/--no-toc-sort.
3773         Replace no_toc_optimize with toc_optimize.
3774         * output.h (Output_section::input_sections): Provide non-const variant.
3775         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
3776         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
3777         accessors.
3778         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
3779         (class Sort_toc_sections): New.
3780         (Target_powerpc::do_finalize_sections): Sort toc sections.
3781         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
3782
3783 2012-12-10  Roland McGrath  <mcgrathr@google.com>
3784
3785         * testsuite/binary_unittest.cc (read_all): New function.
3786         (Sized_binary_test): Use it instead of ::read.
3787         * fileread.cc (do_read): Don't assume pread always reads the whole
3788         amount in a single call.
3789
3790 2012-12-10  Alan Modra  <amodra@gmail.com>
3791
3792         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
3793         Set EM_PPC64 or EM_PPC here.
3794         (Target_selector_powerpc::do_recognize): Delete.
3795
3796 2012-12-10  Alan Modra  <amodra@gmail.com>
3797
3798         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
3799         stub_table_.
3800         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
3801
3802 2012-12-07  Roland McGrath  <mcgrathr@google.com>
3803
3804         * testsuite/binary_unittest.cc (Sized_binary_test):
3805         Use open_descriptor rather than ::open.
3806
3807 2012-12-07  Alan Modra  <amodra@gmail.com>
3808
3809         * powerpc.cc (Stub_table::do_write): Delete redundant Address
3810         typedef and invalid_address constant.
3811         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
3812         instantiate constants.
3813
3814 2012-12-06  Roland McGrath  <mcgrathr@google.com>
3815
3816         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
3817         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
3818         * aclocal.m4: Regenerate.
3819         * configure: Regenerate.
3820         * Makefile.in: Regenerate.
3821         * testsuite/Makefile.in: Regenerate.
3822
3823 2012-12-07  Alan Modra  <amodra@gmail.com>
3824
3825         * options.h (General_options): Add no_toc_optimize.
3826         * powerpc.cc (ok_lo_toc_insn): New function.
3827         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
3828
3829 2012-12-06  Alan Modra  <amodra@gmail.com>
3830
3831         * options.h (General_options): Add plt_align, plt_static_chain,
3832         plt_thread_safe.  Update stub_group_size help text.
3833         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
3834         for new plt_thread_safe_ var.
3835         (use_plt_offset): Correct comments.
3836         (Target_powerpc::do_relax): Look for thread creation symbols to
3837         determine default plt_thread_safe value.  Clear plt call stubs
3838         as well as branch stubs each iteration.
3839         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
3840         insn constants.
3841         (l, hi, ha, write_insn): Move earlier.
3842         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
3843         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
3844         plt stubs too.
3845         (Stub_table::update_size): Adjust.
3846         (Stub_table::prev_size, set_prev_size): Delete.
3847         (Stub_table::stub_align): Let --plt-align affect result.
3848         (Stub_table::plt_call_size): Calculate sizes for various stubs.
3849         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
3850         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
3851         (Stub_table::do_write): Support more stub variants.
3852
3853 2012-12-04  Alan Modra  <amodra@gmail.com>
3854
3855         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
3856         (Target_powerpc::do_define_standard_symbols): New function.
3857
3858 2012-12-03  Alan Modra  <amodra@gmail.com>
3859
3860         * output.h: Formatting, whitespace.
3861
3862 2012-12-03  Alan Modra  <amodra@gmail.com>
3863
3864         * layout.h (Layout::get_executable_sections): Declare.
3865         * layout.cc (Layout::get_executable_sections): New function.
3866         * arm.cc (Target_arm::group_sections): Use it.
3867         (Arm_output_section::group_sections): Delete now redundant test.
3868         * output.cc (Output_reloc::Output_reloc): Add is_relative.
3869         param to handle relative relocs.
3870         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
3871         (Output_data_reloc::add_absolute): Adjust.
3872         (Output_data_reloc::add_relative): New function.
3873         (Output_data::reset_data_size): New function.
3874         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
3875         (Output_section::set_addralign): New function.
3876         (Output_section::checkpoint_set_addralign): New function.
3877         (Output_section::clear_section_offsets_need_adjustment): New function.
3878         (Output_section::input_sections): Make public.
3879         * powerpc.cc (class Output_data_brlt_powerpc): New.
3880         (class Stub_table, class Stub_control): New.
3881         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
3882         stub_table_, set_stub_table, stub_table): New vectors and accessor
3883         functions.
3884         (Target_powerpc::do_may_relax, do_relax, push_branch,
3885         new_stub_table, stub_tables, brlt_section, group_sections,
3886         add_branch_lookup_table, find_branch_lookup_table,
3887         write_branch_lookup_table, make_brlt_section): New functions.
3888         (Target_powerpc::struct Sort_sections, class Branch_info): New.
3889         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
3890         branch_info_): New vars.
3891         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
3892         make call stubs here.
3893         (Output_data_glink): Remove all call stub handling from this class.
3894         (Target_powerpc::Scan::local, global): Save interesting branch
3895         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
3896         (Target_powerpc::do_finalize_sections): Only make reg save/restore
3897         functions on final link.
3898         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
3899         Handle long branch destinations too.
3900         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
3901         do_plt_address_for_local): Adjust lookup of plt call stubs.
3902
3903 2012-11-30  Alan Modra  <amodra@gmail.com>
3904
3905         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
3906         relocs against protected symbols when building 32-bit shared libs.
3907
3908 2012-11-30  Alan Modra  <amodra@gmail.com>
3909
3910         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
3911         param.  Call got_section() to make .got.  Update all callers
3912         and their callers and so on.
3913
3914 2012-11-30  Alan Modra  <amodra@gmail.com>
3915
3916         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
3917         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
3918         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
3919         value if it already exists.
3920
3921 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
3922
3923         PR gold/14858
3924         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
3925
3926 2012-11-14  Roland McGrath  <mcgrathr@google.com>
3927
3928         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
3929         than bfc instruction for data sandboxing.
3930
3931 2012-11-08  Alan Modra  <amodra@gmail.com>
3932
3933         * po/POTFILES.in: Regenerate.
3934
3935 2012-11-05  Alan Modra  <amodra@gmail.com>
3936
3937         * configure.ac: Apply 2012-09-10 change to config.in here.
3938         * configure: Regenerate.
3939
3940 2012-11-05  Alan Modra  <amodra@gmail.com>
3941
3942         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
3943         (struct Opd_ent): Use "Address" rather than "Offset".
3944         (Output_data_got_powerpc::got_base_offset): Return Valtype.
3945         (Target_powerpc::got_section): Make public.
3946         (Target_powerpc::scan_relocs): Move code setting symbols..
3947         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
3948         Create _SDA_BASE_ only when referenced.
3949
3950 2012-11-02  Roland McGrath  <mcgrathr@google.com>
3951
3952         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
3953         from last change.
3954
3955 2012-11-01  Roland McGrath  <mcgrathr@google.com>
3956
3957         * target.h (Sized_target::relocate_relocs): Use Elf_Off
3958         for offset_in_output_section parameter.
3959         (Sized_target::relocate_special_relocatable): Likewise.
3960         * arm.cc (Target_arm::relocate_relocs): Likewise.
3961         (Target_arm::relocate_special_relocatable): Likewise.
3962         * i386.cc (Target_i386::relocate_relocs): Likewise.
3963         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
3964         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
3965         * target-reloc.h (relocate_relocs): Likewise.
3966         * testsuite/testfile.cc (Target_test): Likewise.
3967         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
3968         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
3969
3970         * system.h: Move inclusion of <clocale> to after <libintl.h> in
3971         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
3972
3973         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
3974         parameter, which is unused in the [!F_SETFD] case.
3975
3976         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
3977         SYMNDX to off_t before comparing it to this->data_size().
3978         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
3979         * incremental.cc (Output_section_incremental_inputs::do_write):
3980         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
3981
3982         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
3983
3984 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
3985
3986         * gold.cc (Target_arm::do_adjust_elf_header): Add the
3987         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
3988         in EABI_VER5.
3989
3990 2012-10-29  Cary Coutant  <ccoutant@google.com>
3991
3992         * dwp.cc (usage): Add file and exit status parameters;
3993         add --help and --version options.
3994         (print_version): New function.
3995         (main): Add --help and --version options.
3996
3997 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3998
3999         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
4000         final_layout_sequence.txt.
4001         * testsuite/Makefile.in: Regenerated.
4002
4003 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4004
4005         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
4006         COMPILE generated by automake.
4007         (LINK1): Likewise.
4008         (CXXCOMPILE1): Likewise.
4009         (CXXLINK1): Likewise.
4010         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
4011         (LINK): Likewise.
4012         (CXXCOMPILE): Likewise.
4013         (CXXLINK): Likewise.
4014         * testsuite/Makefile.in: Regenerated.
4015
4016 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4017
4018         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
4019         on bad fwrite return.
4020
4021 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4022
4023         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
4024         on val.
4025
4026 2012-10-23  Cary Coutant  <ccoutant@google.com>
4027
4028         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
4029         * testsuite/Makefile.in: Regenerate.
4030         * testsuite/dwp_test.h: New source file.
4031         * testsuite/dwp_test_1.cc: New source file.
4032         * testsuite/dwp_test_1.s: New source file.
4033         * testsuite/dwp_test_1.sh: New source file.
4034         * testsuite/dwp_test_1b.cc: New source file.
4035         * testsuite/dwp_test_1b.s: New source file.
4036         * testsuite/dwp_test_2.cc: New source file.
4037         * testsuite/dwp_test_2.s: New source file.
4038         * testsuite/dwp_test_2.sh: New source file.
4039         * testsuite/dwp_test_main.cc: New source file.
4040         * testsuite/dwp_test_main.s: New source file.
4041
4042 2012-10-23  Cary Coutant  <ccoutant@google.com>
4043
4044         * dwp.h: New header file.
4045         * dwp.cc: New source file.
4046         * gold.h: Move shared declarations to system.h.
4047         * system.h: New header file.
4048         * Makefile.am: Add dwp.
4049         * Makefile.in: Regenerate.
4050
4051 2012-10-23  Cary Coutant  <ccoutant@google.com>
4052
4053         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
4054         Dwarf_info_reader::read_from_pointer.
4055         (Dwarf_pubnames_table::read_header): Likewise.
4056         (Dwarf_pubnames_table::next_name): Likewise.
4057         (Dwarf_die::read_attributes): Likewise.
4058         (Dwarf_die::skip_attributes): Likewise.
4059         (Dwarf_info_reader::read_from_pointer): New function template.
4060         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
4061         (Dwarf_pubnames_table): Likewise.
4062         (Dwarf_info_reader::read_from_pointer): New function template.
4063         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
4064         Dwarf_pubnames_table ctor.
4065
4066 2012-10-23  Cary Coutant  <ccoutant@google.com>
4067
4068         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
4069         abbrev_shndx.
4070         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
4071         abbrev_shndx_.
4072         (Dwarf_info_reader::set_abbrev_shndx): New method.
4073         (Dwarf_info_reader::abbrev_shndx_): New data member.
4074
4075 2012-10-23  Cary Coutant  <ccoutant@google.com>
4076
4077         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
4078         from object, not parameters.
4079         (Dwarf_info_reader::parse): Likewise.
4080         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
4081         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
4082         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
4083         methods.
4084
4085 2012-10-23  Cary Coutant  <ccoutant@google.com>
4086
4087         * fileread.cc (Input_file::Input_file): New constructor.
4088         * fileread.h (class Input_file): Add new constructor.
4089
4090 2012-10-18  Alan Modra  <amodra@gmail.com>
4091
4092         PR gold/14727
4093         * object.cc (Relobj::is_section_name_included): Also match
4094         .sdata personality section.
4095
4096 2012-10-18  Alan Modra  <amodra@gmail.com>
4097
4098         * target-reloc.h (class Default_comdat_behavior): New, package up..
4099         (get_comdat_behaviour): ..this.
4100         (relocate_section): Add Relocate_comdat_behavior template arg,
4101         adjust code to suit.
4102         * arm.cc (Target_arm::relocate_section): Adjust to suit.
4103         (Target_arm::scan_reloc_section): Likewise.
4104         * i386.cc (Target_i386::relocate_section): Likewise.
4105         * sparc.cc (Target_sparc::relocate_section): Likewise.
4106         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
4107         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
4108         * powerpc.cc (class Relocate_comdat_behavior): New.
4109         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
4110         gold::relocate_section with new template arg.
4111
4112 2012-10-18  Alan Modra  <amodra@gmail.com>
4113
4114         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
4115         dynamic relocs for GOT_TPREL got entries, without symbol if
4116         resolving locally.
4117         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
4118         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
4119         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
4120
4121 2012-10-17  Alan Modra  <amodra@gmail.com>
4122
4123         PR gold/14726
4124         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
4125
4126 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
4127
4128         * layout.cc (Layout::include_section): Keep sections marked
4129         SHF_EXCLUDE when doing relocatable links.
4130
4131 2012-10-16  Alan Modra  <amodra@gmail.com>
4132
4133         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
4134         (Target_powerpc::do_finalize_sections): Call it.
4135         (Output_data_save_res): New class and supporting functions.
4136         (Target_powerpc::symval_for_branch): Only look up .opd entry for
4137         normal symbols defined in object files.
4138
4139 2012-10-12  Alan Modra  <amodra@gmail.com>
4140
4141         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
4142         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
4143         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
4144         section if scan_opd_relocs not yet called.
4145         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
4146
4147 2012-10-12  Alan Modra  <amodra@gmail.com>
4148
4149         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
4150         add_local_ifunc_entry): Revert last change.
4151         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
4152
4153 2012-10-05  Alan Modra  <amodra@gmail.com>
4154
4155         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
4156         do_plt_address_for_global): New functions.
4157         (Output_data_got_powerpc::do_write): Don't segfault when linking
4158         statically.
4159         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
4160         add_local_ifunc_entry): Return true on adding entry..
4161         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
4162         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
4163         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
4164         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
4165         set up symbols here.
4166         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
4167         syms here.  Do so even when no .iplt.  Don't segfault when linking
4168         statically.
4169         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
4170         new variants without reloc param.
4171         (Glink_sym_ent::Glink_sym_ent): Likewise.
4172         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
4173         reloc when refs will resolve to plt call stub.
4174         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
4175         R_PPC_PLTREL24 to resolve locally.
4176         (Target_powerpc::Scan::global): Correct ifunc handling.
4177         (Target_powerpc::Relocate::relocate): Correct local sym glink
4178         lookup.  Don't destroy "value" when we have a plt call stub,
4179         and when checking plt call validity.
4180         (Target_powerpc::do_dynsym_value): Simplify.
4181
4182 2012-10-05  Alan Modra  <amodra@gmail.com>
4183
4184         * i386.cc (Output_data_plt_i386::address_for_global,
4185         address_for_local): Add plt offset to returned value.  Adjust uses.
4186         * sparc.cc (Output_data_plt_sparc::address_for_global,
4187         address_for_local): Likewise.
4188         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
4189         address_for_local): Likewise.
4190         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
4191         address_for_local): Likewise.
4192         * target.h (Target::plt_address_for_global, plt_address_for_local):
4193         Update comment.
4194         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
4195         (Output_data_got::Got_entry::write): Nor here.
4196         * output.h: Comment fix.
4197
4198 2012-10-02  Jiong Wang  <jiwang@tilera.com>
4199
4200         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
4201         global_offset_table_ value for larget got.
4202         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
4203
4204 2012-09-29  Alan Modra  <amodra@gmail.com>
4205
4206         * powerpc.cc (Target_powerpc::iplt_): New output section.
4207         (Target_powerpc::iplt_section, make_iplt_section,
4208         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
4209         (Target_powerpc::make_plt_entry): Handle ifunc syms.
4210         Target_powerpc::plt_entry_count): Count iplt entries too.
4211         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
4212         reloc section in constructor.  New params.
4213         (Target_powerpc::make_plt_section): Create reloc section here instead.
4214         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
4215         functions.
4216         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
4217         (Output_data_glink::add_entry, find_entry): New functions to
4218         deal with local syms.
4219         (Glink_sym_ent): Add support for local syms.
4220         (Output_data_glink::do_write): Handle ifunc plt entries.
4221         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4222         (Target_powerpc::Scan::local, global): Handle ifunc syms.
4223         (Target_powerpc::Relocate::relocate): Likewise.
4224         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
4225
4226 2012-09-25  Alan Modra  <amodra@gmail.com>
4227
4228         * object.h (Sized_relobj_file::adjust_local_symbol,
4229         do_adjust_local_symbol): New functions.
4230         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
4231         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
4232         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
4233         and irregular opd entry spacing.
4234         (Powerpc_relobj::do_read_relocs): Add opd size checks.
4235         (Global_symbol_visitor_opd): New functor.
4236         (Target_powerpc::do_finalize_sections): Omit global symbols defined
4237         on deleted opd entries.
4238
4239 2012-09-15  Jiong Wang  <jiwang@tilera.com>
4240
4241         * tilegx.cc: New file.
4242         * Makefile.am (TARGETSOURCES): Add tilegx.cc
4243         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
4244         * configure.tgt: Add entries for tilegx*.
4245         * configure.ac: Likewise.
4246         * Makefile.in: Rebuild.
4247         * configure: Likewise.
4248         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
4249         tilegx.
4250
4251 2012-09-13  Alan Modra  <amodra@gmail.com>
4252
4253         * target-reloc.h (scan_relocs): Call scan.local for relocs
4254         against symbols in discarded sections.  Pass is_discarded
4255         param.
4256         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
4257         Add is_discarded param.
4258         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
4259         is_discarded to flag opd entry as discarded.  Don't emit dyn
4260         relocs on such entries.
4261         (Target_powerpc::Scan::global): Similarly detect and handle
4262         such opd entries.
4263         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
4264         opd_ent_.  Update all uses.
4265         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
4266         (Target_powerpc::relocate_section): Zero out discarded opd
4267         entry relocs.
4268
4269 2012-09-12  Ian Lance Taylor  <iant@google.com>
4270
4271         PR gold/14570
4272         * output.cc: Rename Output_data_got template parameter from size
4273         to got_size for all functions.  Compile all variants of
4274         Output_data_got.
4275         (Output_data_got::Got_entry::write): Correct use of size for
4276         symbol value.  Use local_is_tls rather than casting to
4277         Sized_relobj_file.
4278         * object.h (class Object): Add local_is_tls and do_local_is_tls.
4279         (class Sized_relobj_file): Add do_local_is_tls.
4280         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
4281
4282 2012-09-11  Alan Modra  <amodra@gmail.com>
4283
4284         PR gold/14566
4285         * layout.cc (Layout::set_segment_offsets): When using
4286         common-page-size alignment, ensure we are on a new max-page-size
4287         page.
4288         * output.cc (Output_segment::set_section_addresses): Use
4289         abi_pagesize, not common_pagesize for relro boundary.
4290         (Output_segment::set_offset): Likewise.
4291
4292 2012-09-11  Alan Modra  <amodra@gmail.com>
4293
4294         * output.h (Output_data_got::add_global_tls, add_local_tls,
4295         add_local_tls_pair): New functions.
4296         (Output_data_got::add_local_pair_with_rel): Remove second
4297         reloc param.  Expand comment.
4298         (Output_data_got::Got_entry): Rename use_plt_offset_ to
4299         use_plt_or_tls_offset_, similarly for constructor param.
4300         (Output_data_got::Got_entry::write): Add got_index param.
4301         * output.cc (Output_data_got::add_global_tls, add_local_tls,
4302         add_local_tls_pair): New functions.
4303         (Output_data_got::Got_entry::write): Handle tls symbols
4304         with use_plt_or_tls_offset_ set specially.
4305         (Output_data_got::add_local_pair_with_rel): Only one reloc.
4306         (Output_data_got::do_write): Replace iterator with index, pass
4307         index to entry write function.
4308         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
4309         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
4310         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
4311         call.
4312         * i386.cc (Target_i386::Scan::local): Likewise.
4313         * sparc.cc (Target_sparc::Scan::local): Likewise.
4314         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
4315         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
4316         do_tls_offset_for_global): New functions.
4317         (Target_powerpc::Scan::local): Correct TLS relocations and got
4318         entry values.
4319         (Target_powerpc::Scan::global): Don't emit unnecessary
4320         dynamic relocations on TLS GOT entries.
4321
4322 2012-09-10  Matthias Klose  <doko@ubuntu.com>
4323
4324         * config.in: Disable sanity check for kfreebsd.
4325
4326 2012-09-10  Sterling Augustine  <saugustine@google.com>
4327
4328         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
4329         (Gdb_index::pubtypes_read): New parameter.
4330         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
4331         to calls.
4332         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
4333         pubtypes_object_.
4334
4335 2012-09-09  Alan Modra  <amodra@gmail.com>
4336
4337         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
4338         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
4339         * gc.h (gc_process_relocs): Call target gc_add_reference.
4340         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
4341         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
4342         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
4343         unnecessary cast.
4344         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
4345         to cater for when we don't need code offset.  Update use.
4346         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
4347         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
4348         set_opd_valid): New functions.
4349         (Target_powerpc::do_gc_add_reference): New function.
4350         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
4351         stashed refs.
4352         (Target_powerpc::do_gc_mark_symbol): New function.
4353
4354 2012-09-06  Cary Coutant  <ccoutant@google.com>
4355
4356         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
4357         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
4358         (Dwarf_die::skip_attributes): Likewise.
4359         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
4360         * testsuite/gdb_index_test.cc (inline_func_1): New function.
4361         (main): Call it.
4362         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
4363
4364 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
4365
4366         * testsuite/script_test_3.t: Add .got.plt output section
4367         statement.
4368         * testsuite/script_test_4.t: Likewise.
4369
4370 2012-09-05  Alan Modra  <amodra@gmail.com>
4371
4372         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
4373         update all uses and lose "enum" when using type.
4374
4375 2012-09-05  Alan Modra  <amodra@gmail.com>
4376
4377         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
4378         * configure: Regenerate.
4379         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
4380         (plugin_final_layout.stdout): Likewise.
4381         (memory_test): Set page sizes to 0x1000.
4382         * testsuite/Makefile.in: Regenerate.
4383         * testsuite/discard_locals_test.sh: Add FIXME comment.
4384         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
4385         * testsuite/pr14265.t: Add .got output section statement.
4386         * testsuite/script_test_2.t: Likewise.
4387         * testsuite/script_test_3.t: Likewise.
4388         * testsuite/script_test_4.t: Likewise.
4389         * testsuite/script_test_5.t: Likewise.
4390         * testsuite/script_test_6.t: Likewise.
4391         * testsuite/script_test_7.t: Likewise.
4392         * testsuite/script_test_9.t: Likewise.
4393
4394 2012-09-05  Alan Modra  <amodra@gmail.com>
4395
4396         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
4397         (Powerpc_relocate_functions::Status): New typedef.
4398         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4399         (Target_powerpc::Scan::local): Handle REL64.
4400         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
4401         for REL32 and REL64.
4402         (Target_powerpc::symval_for_branch): New function, extracted from..
4403         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
4404         checks.  Report overflow errors.
4405
4406 2012-09-05  Alan Modra  <amodra@gmail.com>
4407
4408         * object.h (Sized_relobj_file::emit_relocs): Delete.
4409         (Sized_relobj_file::emit_relocs_reltype): Delete.
4410         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
4411         relocate_relocs for --emit-relocs.
4412         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
4413         * output.h: Update comment.
4414         (Output_segment::first_section): New function.
4415         (Output_segment::first_section_load_address): Use first_section.
4416         * output.cc (Output_segment::first_section): New function extracted..
4417         (Output_segment::first_section_load_address): ..from here.  Delete.
4418         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
4419         * target.h (Sized_target::relocate_for_relocatable): Likewise.
4420         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
4421         adjust call to target.h function.
4422         * i386.cc (Target_i386): Likewise.
4423         * sparc.cc (Target_sparc): Likewise.
4424         * x86_64.cc (Target_x86_64): Likewise.
4425         * powerpc.cc (Target_powerpc): Likewise.
4426         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
4427         first tls section has section symbol for optimised local dynamic
4428         output relocs.
4429         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
4430         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
4431         optimised tls code.
4432         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
4433         Rename to relocate_relocs.  Update error message.
4434
4435 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
4436
4437         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
4438         --just-symbols.
4439
4440 2012-08-31  Alan Modra  <amodra@gmail.com>
4441
4442         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
4443         (Powerpc_relobj::toc_base_offset): New stub function.
4444         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
4445         got_mod_index_offset to tlsld_got_offset.  Update all refs.
4446         (Target_powerpc::Relocate::enum skip_tls): New.
4447         (Target_powerpc::call_tls_get_addr_): New var.
4448         (Target_powerpc::is_branch_reloc): Move to file scope.
4449         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
4450         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
4451         New functions.
4452         (Target_powerpc::enum Got_type): Delete old values, add new ones.
4453         (powerpc_info): Correct common_pagesize for ppc64.
4454         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
4455         (Powerpc_relocate_functions): Add overflow check enums and functions.
4456         Add non-shift version of rela, rela_ua.  Delete all rel public
4457         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
4458         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
4459         addr16_ha3, addr14 functions.
4460         (Output_data_got_powerpc::add_constant_pair): New function.
4461         (Output_data_got_powerpc::got_base_offset): Likewise.
4462         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
4463         (instruction constants): Sort, add some more.
4464         (Output_data_glink::do_write): Add and use Address typedef.  Use
4465         object->toc_base_offset() stub for 64-bit.
4466         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
4467         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4468         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
4469         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
4470         Always treat .opd relocs as against locally defined symbol.
4471         Correct condition for RELATIVE relocs.
4472         (Target_powerpc::do_finalize_sections): Test for NULL sections.
4473         (Target_powerpc::Relocate::relocate): Use plt call stub as value
4474         for 32-bit syms with a plt entry.  Correct ppc64 toc base
4475         calculations.  Handle TLS relocs, and more.  Add overflow
4476         checking and adjust for Powerpc_relocate_functions changes.
4477         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
4478         Reinstate --emit-relocs code with FIXME.
4479
4480 2012-08-30  Alan Modra  <amodra@gmail.com>
4481
4482         * layout.cc (Layout::set_segment_offsets): Set p_align to
4483         abi_pagesize, not common_pagesize.
4484         (Layout::relaxation_loop_body): Similarly use abi_pagesize
4485         to determine whether file header can go in segment.
4486
4487 2012-08-30  Alan Modra  <amodra@gmail.com>
4488
4489         * output.h (Output_reloc::Output_reloc <output section>): Add
4490         is_relative param.  Adjust calls.
4491         (Output_reloc::add_output_section_relative): New functions.
4492         * output.cc (Output_reloc::Output_reloc <output section>): Handle
4493         is_relative.
4494         (Output_reloc::symbol_value): Handle SECTION_CODE.
4495
4496 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
4497
4498         * gold.cc (queue_middle_tasks): Call layout again when unique
4499         segments for sections is desired.
4500         * layout.cc (Layout::Layout): Initialize new members.
4501         (Layout::get_output_section_flags): New function.
4502         (Layout::choose_output_section): Call get_output_section_flags.
4503         (Layout::layout): Make output section for mapping to a unique segment.
4504         (Layout::insert_section_segment_map): New function.
4505         (Layout::attach_allocated_section_to_segment): Make unique segment for
4506         output sections marked so.
4507         (Layout::segment_precedes): Check for unique segments when sorting.
4508         * layout.h (Layout::Unique_segment_info): New struct.
4509         (Layout::Section_segment_map): New typedef.
4510         (Layout::insert_section_segment_map): New function.
4511         (Layout::get_output_section_flags): New function.
4512         (Layout::is_unique_segment_for_sections_specified): New function.
4513         (Layout::set_unique_segment_for_sections_specified): New function.
4514         (Layout::unique_segment_for_sections_specified_): New member.
4515         (Layout::section_segment_map_): New member.
4516         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
4517         Rename is_gc_pass_one to is_pass_one.
4518         Rename is_gc_pass_two to is_pass_two.
4519         Rename is_gc_or_icf to is_two_pass.
4520         Check for which pass based on whether symbols data is present.
4521         Make it two pass when unique segments for sections is desired.
4522         * output.cc (Output_section::Output_section): Initialize new
4523         members.
4524         * output.h (Output_section::is_unique_segment): New function.
4525         (Output_section::set_is_unique_segment): New function.
4526         (Output_section::is_unique_segment_): New member.
4527         (Output_section::extra_segment_flags): New function.
4528         (Output_section::set_extra_segment_flags): New function.
4529         (Output_section::extra_segment_flags_): New member.
4530         (Output_section::segment_alignment): New function.
4531         (Output_section::set_segment_alignment): New function.
4532         (Output_section::segment_alignment_): New member.
4533         (Output_segment::Output_segment): Initialize is_unique_segment_.
4534         (Output_segment::is_unique_segment): New function.
4535         (Output_segment::set_is_unique_segment): New function.
4536         (Output_segment::is_unique_segment_): New member.
4537         * plugin.cc (allow_unique_segment_for_sections): New function.
4538         (unique_segment_for_sections): New function.
4539         (Plugin::load): Add new functions to transfer vector.
4540         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
4541         * Makefile.in: Regenerate.
4542         * testsuite/plugin_final_layout.sh: Check if unique segment
4543         functionality works.
4544         * testsuite/plugin_section_order.c (onload): Check if new interfaces
4545         are available.
4546         (allow_unique_segment_for_sections): New global.
4547         (unique_segment_for_sections): New global.
4548         (claim_file_hook): Call allow_unique_segment_for_sections.
4549         (all_symbols_read_hook): Call unique_segment_for_sections.
4550
4551 2012-08-22  Cary Coutant  <ccoutant@google.com>
4552
4553         * layout.cc (Layout::include_section): Don't assert on GROUP
4554         sections with --emit-relocs.
4555
4556 2012-08-21  Cary Coutant  <ccoutant@google.com>
4557
4558         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
4559         if --export-dynamic-symbol names an undef symbol.
4560
4561 2012-08-18  Alan Modra  <amodra@gmail.com>
4562
4563         * powerpc.cc: Formatting and white space.
4564         (Powerpc_relobj): Rename got2_section_ to special_.
4565         Add opd_ent_shndx_ and opd_ent_off_ vectors.
4566         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
4567         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
4568         (Target_powerpc): Add Address typedef and invalid_address.  Use
4569         throughout.
4570         (Target_powerpc::is_branch_reloc): New function.
4571         (Powerpc_relocate_functions): Add Address typedef, use throughout.
4572         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
4573         for dst_mask, value and addend.
4574         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
4575         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
4576         (Output_data_glink::do_write): Correct toc base.  Don't try to use
4577         uint16_t for 24-bit offset.  Use get_output_section_offset and
4578         check return.
4579         (Target_powerpc::Scan::local): Handle more relocs.
4580         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
4581         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
4582         Plug in toc restoring insn after plt calls.  Translate branches
4583         to function descriptor symbols to corresponding entry point.
4584         (Target_powerpc::relocate_for_relocatable): Check return from
4585         get_output_section_offset.
4586         * symtab.h: Comment typo.
4587
4588 2012-08-14  Ian Lance Taylor  <iant@google.com>
4589
4590         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
4591         unsupported_relocal_local to call unsupported_reloc_global.
4592
4593 2012-08-14  Nick Clifton  <nickc@redhat.com>
4594
4595         PR ld/14265
4596         * script-sections.cc (Sections_element::output_section_name): Add
4597         keep return parameter.
4598         (Output_section_element::match_name): Add keep return parameter.
4599         Return the value of the keep_ member.
4600         * script-sections.h (class Output_section): Update
4601         output_section_name prototype.
4602         * layout.cc (Layout::keep_input_section): New public member
4603         function.
4604         (Layout::choose_output_section): Pass keep parameter to
4605         output_section_name.
4606         * layout.h (class Layout): Add keep_input_section.
4607         * object.cc (Sized_relobj_file::do_layout): Check for kept input
4608         sections.
4609         * testsuite/Makefile.am: Add a test.
4610         * testsuite/Makefile.in: Regenerate.
4611         * testsuite/pr14265.c: Source file for the test.
4612         * testsuite/pr14265.t: Linker script for the test.
4613         * testsuite/pr14265.sh: Shell script for the test.
4614
4615 2012-08-14  Alan Modra  <amodra@gmail.com>
4616
4617         * target.h (Target::output_section_name): New function.
4618         (Target::do_output_section_name): New function.
4619         * layout.cc (Layout::choose_output_section): Call the above.
4620         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
4621
4622 2012-08-14  Alan Modra  <amodra@gmail.com>
4623
4624         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
4625         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
4626         for replace_constant call.
4627         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
4628         (Output_data_glink::do_print_to_mapfile): New function.
4629         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
4630         (Target_powerpc::Relocate::relocate): Likewise.
4631
4632 2012-08-14  Alan Modra  <amodra@gmail.com>
4633
4634         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
4635         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
4636         (Output_data_glink::add_entry,find_entry): Remove shndx param.
4637         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
4638         all references to shndx_.  Handle special case for R_PPC_PLTREL24
4639         here.
4640         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
4641         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
4642         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
4643         here.
4644         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
4645         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
4646
4647 2012-08-12  Alan Modra  <amodra@gmail.com>
4648
4649         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
4650         (glink insn constants): Use uint32_t.
4651         (Output_data_glink::add_entry): Use insert, not [] operator.
4652
4653 2012-08-11  Alan Modra  <amodra@gmail.com>
4654
4655         * object.h (Sized_relobj_file::find_shdr): New function.
4656         (Sized_relobj_file::find_special_sections): New function.
4657         * object.cc (Sized_relobj_file::find_shdr): New function.
4658         (Sized_relobj_file::find_eh_frame): Use find_shdr.
4659         (Sized_relobj_file::find_special_sections): New function, split out..
4660         (Sized_relobj_file::do_read_symbols): ..from here.
4661         * output.h (Output_data_got::replace_constant): New function.
4662         (Output_data_got::num_entries): New function.
4663         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
4664         (Output_data_got::got_offset): Protected rather than private.
4665         (Output_data_got::replace_got_entry): New function.
4666         * output.cc (Output_data_got::replace_got_entry): New function.
4667         * powerpc.cc (class Powerpc_relobj): New.
4668         (class Powerpc_relocate_functions): Delete all psymval variants or
4669         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
4670         Implement _ha functions using corresponding _hi function.
4671         (Powerpc_relobj::find_special_sections): New function.
4672         (Target_powerpc::do_make_elf_object): New function.
4673         (class Output_data_got_powerpc): New.
4674         (class Output_data_glink): New.
4675         (class Powerpc_scan_relocatable_reloc): New.
4676         Many more changes througout file.
4677
4678 2012-08-09  Nick Clifton  <nickc@redhat.com>
4679
4680         * po/vi.po: Updated Vietnamese translation.
4681
4682 2012-08-07  Ian Lance Taylor  <iant@google.com>
4683
4684         * layout.cc (Layout::add_target_dynamic_tags): If
4685         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
4686         plt_rel.
4687
4688 2012-07-30  Nick Clifton  <nickc@redhat.com>
4689
4690         * po/gold.pot: Updated template.
4691         * po/es.po: Updated Spanish translation.
4692
4693 2012-07-18  Cary Coutant  <ccoutant@google.com>
4694
4695         PR gold/14344
4696         * configure.ac: Add check for -gpubnames support.
4697         * configure: Regenerate.
4698         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
4699         support; force -gno-pubnames.
4700         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
4701         support.
4702         (gdb_index_test_4): New test.
4703         * testsuite/Makefile.in: Regenerate.
4704         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
4705         * testsuite/gdb_index_test_2.sh: Likewise.
4706         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
4707         * testsuite/gdb_index_test_4.sh: New script.
4708         * testsuite/gdb_index_test_comm.sh: New script with common code;
4709         don't look for space after colon.
4710
4711 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
4712
4713         * gold.cc (queue_middle_tasks): Update function order only after
4714         deferred objects due to plugins are processed.
4715
4716 2012-07-11  Ian Lance Taylor  <iant@google.com>
4717
4718         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
4719         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
4720         (Target_arm::scan_reloc_for_stub): Likewise.
4721         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
4722         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
4723         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
4724         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
4725         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
4726
4727 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
4728             Ian Lance Taylor  <iant@google.com>
4729
4730         PR gold/14309
4731         * configure.ac: Test whether std::tr1::hash<off_t> works.
4732         * gold.h: Add a specialization for std::tr1::hash<off_t> if
4733         needed.
4734         * output.h (class Output_fill): Add virtual destructor.
4735         * configure, config.in: Rebuild.
4736
4737 2012-06-22  Roland McGrath  <mcgrathr@google.com>
4738
4739         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
4740
4741 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
4742
4743         * plugin.cc (Plugin::load): Handle position independent executables.
4744
4745 2012-06-06  Cary Coutant  <ccoutant@google.com>
4746
4747         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
4748         add .debug_macro.
4749         (lines_only_debug_sections): Likewise.
4750         (gdb_fast_lookup_sections): New static array.
4751         (is_gdb_debug_section): Rename formal parameter.
4752         (is_lines_only_debug_section): Likewise.
4753         (is_gdb_fast_lookup_section): New function.
4754         (Layout::include_section): Check for ".zdebug_" prefix; pass
4755         section name suffix to is_gdb_debug_section, et al.; check for
4756         fast-lookup sections when building .gdb_index.
4757         * options.h (--strip-debug-gdb): Update GDB version number.
4758
4759 2012-06-06  Cary Coutant  <ccoutant@google.com>
4760
4761         * configure.ac: Add check for fallocate.
4762         * configure: Regenerate.
4763         * config.in: Regenerate.
4764
4765         * options.h (class General_options): Add --mmap-output-file and
4766         --posix-fallocate options.
4767         * output.cc: (posix_fallocate): Remove; replace with...
4768         (gold_fallocate): New function.
4769         (Output_file::map_no_anonymous): Call gold_fallocate.
4770         (Output_file::map): Check --mmap-output-file option.
4771
4772 2012-06-05  Jing Yu  <jingyu@google.com>
4773
4774         * gold.h (textdomain): Add do {} to empty while(0).
4775         (bindtextdomain): Likewise.
4776
4777 2012-06-04  Cary Coutant  <ccoutant@google.com>
4778
4779         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
4780         has_dynsym_index.
4781
4782 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
4783
4784         * symtab.cc (Symbol_table::define_special_symbol):
4785         Initialize *poldsym to prevent uninitialized variable errors.
4786
4787 2012-05-23  Cary Coutant  <ccoutant@google.com>
4788
4789         * layout.cc (Layout::section_name_mapping): Add rules to handle
4790         exact match on .data.rel.ro.local or .data.rel.ro.
4791         (Layout::output_section_name): Check for exact matches.
4792
4793 2012-05-23  Cary Coutant  <ccoutant@google.com>
4794
4795         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
4796         more carefully.
4797
4798 2012-05-22  Cary Coutant  <ccoutant@google.com>
4799
4800         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
4801         object before exporting symbol.
4802
4803 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
4804
4805         * testsuite/tls_test.cc: Include "config.h" first.
4806         * testsuite/tls_test_c.c: Likewise.
4807
4808 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
4809             Nick Clifton  <nickc@redhat.com>
4810
4811         PR 14072
4812         * configure.in: Add check that sysdep.h has been included before
4813         any system header files.
4814         * configure: Regenerate.
4815         * config.in: Regenerate.
4816
4817 2012-05-14  Cary Coutant  <ccoutant@google.com>
4818
4819         * layout.cc (Layout::make_output_section): Mark .tdata section
4820         as RELRO.
4821         * testsuite/relro_test.cc: Add a TLS variable.
4822
4823 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
4824
4825         PR gold/14091
4826         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
4827         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
4828         R_X86_64_64.
4829
4830 2012-05-08  Cary Coutant  <ccoutant@google.com>
4831
4832         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
4833         (lines_only_debug_sections): Likewise.
4834
4835 2012-05-02  Roland McGrath  <mcgrathr@google.com>
4836
4837         * nacl.cc: New file.
4838         * nacl.h: New file.
4839         * Makefile.am (CCFILES, HFILES): Add them.
4840         * Makefile.in: Regenerate.
4841         * i386.cc (Output_data_plt_i386_nacl): New class.
4842         (Output_data_plt_i386_nacl_exec): New class.
4843         (Output_data_plt_i386_nacl_dyn): New class.
4844         (Target_i386_nacl): New class.
4845         (Target_selector_i386_nacl): New class.
4846         (target_selector_i386): Use it instead of Target_selector_i386.
4847         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
4848         (Target_x86_64_nacl): New class.
4849         (Target_selector_x86_64_nacl): New class.
4850         (target_selector_x86_64, target_selector_x32): Use it instead of
4851         Target_selector_x86_64.
4852         * arm.cc (Output_data_plt_arm_nacl): New class.
4853         (Target_arm_nacl): New class.
4854         (Target_selector_arm_nacl): New class.
4855         (target_selector_arm, target_selector_armbe): Use it instead of
4856         Target_selector_arm.
4857
4858         * target-select.cc (select_target): Take new Input_file* and off_t
4859         arguments, pass them on to recognize method of selector.
4860         * object.cc (make_elf_sized_object): Update caller.
4861         * parameters.cc (parameters_force_valid_target): Likewise.
4862         * incremental.cc (make_sized_incremental_binary): Likewise.
4863         * target-select.h: Update decl.
4864         (Target_selector::recognize): Take new Input_file* argument,
4865         pass it on to do_recognize.
4866         (Target_selector::do_recognize): Take new Input_file* argument.
4867         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
4868         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
4869         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
4870         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
4871
4872         * target.h (Target::Target_info): New members isolate_execinstr
4873         and rosegment_gap.
4874         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
4875         * arm.cc (Target_arm::arm_info): Update initializer.
4876         * i386.cc (Target_i386::i386_info): Likewise.
4877         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
4878         * sparc.cc (Target_sparc::sparc_info): Likewise.
4879         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4880         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
4881         * layout.cc (Layout::attach_allocated_section_to_segment):
4882         Take new const Target* argument.  If target->isolate_execinstr(), act
4883         like --rosegment.
4884         (Layout::find_first_load_seg): Take new const Target* argument;
4885         if target->isolate_execinstr(), reject PF_X segments.
4886         (Layout::relaxation_loop_body): Update caller.
4887         (Layout::set_segment_offsets): If target->isolate_execinstr(),
4888         reset file offset to zero when we hit LOAD_SEG, and then do a second
4889         loop over the segments before LOAD_SEG to reassign offsets after
4890         addresses have been determined.  Handle target->rosegment_gap().
4891         (Layout::attach_section_to_segment): Take new const Target* argument;
4892         pass it to attach_allocated_section_to_segment.
4893         (Layout::make_output_section): Update caller.
4894         (Layout::attach_sections_to_segments): Take new const Target* argument;
4895         pass it to attach_section_to_segment.
4896         * gold.cc (queue_middle_tasks): Update caller.
4897         * layout.h (Layout): Update method decls with new arguments.
4898
4899         * arm.cc (Target_arm::Target_arm): Take optional argument for the
4900         Target_info pointer to use.
4901         (Target_arm::do_make_data_plt): New virtual method.
4902         (Target_arm::make_data_plt): New method that calls it.
4903         (Target_arm::make_plt_entry): Use it.
4904         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
4905         for the section alignment.
4906         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
4907         method.
4908         (Output_data_plt_arm::first_plt_entry_offset): Call it.
4909         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
4910         method.
4911         (Output_data_plt_arm::get_plt_entry_size): Call it.
4912         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
4913         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
4914         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
4915         method.
4916         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
4917         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
4918         method instead of sizeof(plt_entry).
4919         (Output_data_plt_arm::add_entry): Likewise.
4920         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
4921         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
4922         than static method.
4923         (Target_arm::plt_entry_size): Likewise.
4924         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
4925         Move to ...
4926         (Output_data_plt_arm_standard): ... here, new class.
4927         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
4928         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
4929         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
4930
4931         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4932         Take additional argument for the PLT entry size.
4933         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
4934         Use get_plt_entry_size method rather than plt_entry_size variable.
4935         (Output_data_plt_x86_64::reserve_slot): Likewise.
4936         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
4937         (Output_data_plt_x86_64::add_entry): Likewise.
4938         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
4939         (Output_data_plt_x86_64::address_for_global): Likewise.
4940         (Output_data_plt_x86_64::address_for_local): Likewise.
4941         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4942         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
4943         Make method non-static.
4944         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
4945         method.
4946         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
4947         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
4948         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
4949         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
4950         virtual method.
4951         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
4952         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
4953         virtual method.
4954         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
4955         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
4956         virtual method.
4957         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
4958         (Output_data_plt_x86_64::plt_entry_size)
4959         (Output_data_plt_x86_64::first_plt_entry)
4960         (Output_data_plt_x86_64::plt_entry)
4961         (Output_data_plt_x86_64::tlsdesc_plt_entry)
4962         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
4963         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
4964         (Output_data_plt_x86_64_standard): ... here, new class.
4965         (Target_x86_64::Target_x86_64): Take optional argument for the
4966         Target_info pointer to use.
4967         (Target_x86_64::do_make_data_plt): New virtual method.
4968         (Target_x86_64::make_data_plt): New method to call it.
4969         (Target_x86_64::init_got_plt_for_update): Use that.
4970         Call this->plt_->add_eh_frame method here.
4971         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
4972         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
4973         rather than static method.
4974         (Target_x86_64::plt_entry_size): Likewise.
4975         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
4976         rather than plt_entry_size variable.  Move guts of PLT filling to...
4977         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
4978         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
4979         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
4980
4981         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
4982         additional argument for the section alignment.
4983         Don't do add_eh_frame_for_plt here.
4984         (Output_data_plt_i386::first_plt_entry_offset): Make the method
4985         non-static.  Use get_plt_entry_size method rather than plt_entry_size
4986         variable.
4987         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
4988         method.
4989         (Output_data_plt_i386::get_plt_entry_size): Call it.
4990         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
4991         (Output_data_plt_i386::add_eh_frame): New method to call it.
4992         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
4993         method.
4994         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
4995         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
4996         method.
4997         (Output_data_plt_i386::fill_plt_entry): New method to call it.
4998         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
4999         method instead of plt_entry_size.
5000         (Output_data_plt_i386::plt_entry_size)
5001         (Output_data_plt_i386::plt_eh_frame_fde_size)
5002         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
5003         (Output_data_plt_i386_standard): ... here, new class.
5004         (Output_data_plt_i386_exec): New class.
5005         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
5006         (Output_data_plt_i386_exec::first_plt_entry): ... here.
5007         (Output_data_plt_i386::exec_plt_entry): Move to ...
5008         (Output_data_plt_i386_exec::plt_entry): ... here.
5009         (Output_data_plt_i386_dyn): New class.
5010         (Output_data_plt_i386::first_plt_entry): Move to ...
5011         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
5012         (Output_data_plt_i386::dyn_plt_entry): Move to ...
5013         (Output_data_plt_i386_dyn::plt_entry): ... here.
5014         (Target_i386::Target_i386): Take optional argument for the Target_info
5015         pointer to use.
5016         (Target_i386::do_make_data_plt): New virtual method.
5017         (Target_i386::make_data_plt): New method to call it.
5018         (Target_i386::make_plt_section): Use that.
5019         Call this->plt_->add_eh_frame method here.
5020         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
5021         rather than plt_entry_size variable.
5022         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
5023         (Output_data_plt_i386::address_for_local): Likewise.
5024         (Output_data_plt_i386::do_write): Likewise.
5025         Move guts of PLT filling to...
5026         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
5027         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
5028         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
5029         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
5030
5031 2012-05-01  Cary Coutant  <ccoutant@google.com>
5032
5033         * dwarf_reader.cc (Dwarf_die::read_attributes)
5034         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
5035         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
5036         * reduced_debug_output.cc
5037         (Output_reduced_debug_info_section::get_die_end): Remove
5038         DW_FORM_GNU_ref_index.  Add default case.
5039
5040 2012-04-26  Mark Wielaard  <mjw@redhat.com>
5041
5042         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
5043         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
5044         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
5045         DW_AT_high_pc as offset from DW_AT_low_pc.
5046
5047         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
5048         * testsuite/Makefile.in: Regenerate.
5049         * testsuite/gdb_index_test_3.c: New test source file.
5050         * testsuite/gdb_index_test_3.sh: New test source file.
5051
5052 2012-04-25  Ian Lance Taylor  <iant@google.com>
5053
5054         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
5055         pointer.
5056         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
5057         as a class, not a struct.
5058         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
5059         (Target_arm::apply_cortex_a8_workaround): Likewise.
5060         * gc.h: Declare Reloc_types as a struct, not a class.
5061         * object.h: Declare Symbols_data as a struct.
5062         * reloc.h: Declare Read_relocs_data as a struct.
5063         * target.h: Declare Relocate_info as a struct.
5064
5065 2012-04-24  David S. Miller  <davem@davemloft.net>
5066
5067         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
5068         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
5069         and R_SPARC_WPLT30.
5070
5071 2012-04-24  Cary Coutant  <ccoutant@google.com>
5072
5073         * incremental-dump.cc (find_input_containing_global): Replace
5074         magic number with symbolic constant.
5075         (dump_incremental_inputs): Update version number.
5076         * incremental.cc (Output_section_incremental_inputs): Update version
5077         number; import symbolic constants from Incremental_inputs_reader.
5078         (Incremental_inputs::create_data_sections): Align relocations
5079         section correctly for 64-bit targets.
5080         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
5081         constants; add padding.
5082         (Output_section_incremental_inputs::write_header): Add assert for
5083         header_size.
5084         (Output_section_incremental_inputs::write_input_files): Add assert
5085         for input_entry_size.
5086         (Output_section_incremental_inputs::write_info_blocks): Add padding;
5087         add assert for object_info_size, input_section_entry_size,
5088         global_sym_entry_size.
5089         * incremental.h (Incremental_inputs_reader): Add symbolic constants
5090         for data structure sizes; use them.
5091         (Incremental_input_entry_reader): Import symbolic constants from
5092         Incremental_inputs_reader; use them.
5093
5094 2012-04-23  David S. Miller  <davem@davemloft.net>
5095
5096         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
5097         and elf_flags_set_.
5098         (Target_sparc::Target_sparc): Initialize new fields.
5099         (Target_sparc::do_make_elf_object): New function.
5100         (Target_sparc::do_adjust_elf_header): New function.
5101
5102 2012-04-23  Cary Coutant  <ccoutant@google.com>
5103
5104         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
5105         CU range table of gdb index.
5106
5107 2012-04-20  David S. Miller  <davem@davemloft.net>
5108
5109         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
5110         instead of false.
5111
5112 2012-04-16  David S. Miller  <davem@davemloft.net>
5113
5114         * sparc.cc (Target_sparc::got_address): New function.
5115         (Sparc_relocate_functions::gdop_hix22): New function.
5116         (Sparc_relocate_functions::gdop_lox10): New function.
5117         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
5118         relocs.
5119         (Target_sparc::Scan::local): Likewise if the global symbol is not
5120         preemptible and is not IFUNC.
5121         (Target_sparc::Relocate::relocate): Perform GOTDATA code
5122         transformations for local and non-preemptible non-IFUNC global
5123         symbols.
5124
5125         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
5126         writing out 64-bit part of ranges.
5127
5128         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
5129         -fpic and -fpie respectively.
5130         * Makefile.in: Regenerate.
5131
5132         * sparc.cc (class Target_sparc): Add rela_ifunc_.
5133         (Target_sparc::Target_sparc): Initialize new field.
5134         (Target_sparc::do_plt_section_for_global): New function.
5135         (Target_sparc::do_plt_section_for_local): New function.
5136         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
5137         (Target_sparc::make_plt_section): New function, broken out of
5138         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
5139         (Target_sparc::make_plt_entry): Call make_plt_section.
5140         (Target_sparc::make_local_ifunc_plt_entry): New function.
5141         (Target_sparc::rela_ifunc_section): New function.
5142         (Target_sparc::plt_section): Remove const.
5143         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
5144         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
5145         and ifunc_count_ fields.
5146         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
5147         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
5148         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
5149         (Output_data_plt_sparc::rela_ifunc): New function.
5150         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
5151         (Output_data_plt_sparc::has_ifunc_section): New function.
5152         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
5153         (Output_data_plt_sparc::address_for_global): New function.
5154         (Output_data_plt_sparc::address_for_local): New function.
5155         (Output_data_plt_sparc::plt_index_to_offset): New function.
5156         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
5157         and entry_count.
5158         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
5159         entry_count.
5160         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
5161         R_SPARC_JMP_IREL to switch.
5162         (Target_sparc::Scan::check_non_pic): Likewise.
5163         (Target_sparc::Scan::local): Handle IFUNC symbols.
5164         (Target_sparc::Scan::local): Likewise.
5165         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
5166         and plt_address_for_local.
5167         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
5168         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
5169
5170         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
5171         (class Output_data_reloc): Adjust calls to Output_reloc_type.
5172         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
5173         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
5174         global relocs too.
5175         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
5176         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
5177         calls.
5178         * sparc.cc (Target_sparc::Scan::global): Likewise.
5179         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5180
5181 2012-04-16  Cary Coutant  <ccoutant@google.com>
5182
5183         * archive.cc (Library_base::should_include_member): Check for
5184         --export-dynamic-symbol.
5185         * options.h (class General_options): Add --export-dynamic-symbol.
5186         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
5187         --export-dynamic-symbol.
5188         (Symbol_table::gc_mark_undef_symbols): Likewise.
5189         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
5190
5191 2012-04-12  David S. Miller  <davem@davemloft.net>
5192
5193         * sparc.cc (Reloc::wdisp10): New relocation method.
5194         (Reloc::h34): Likewise.
5195         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
5196         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
5197         R_SPARC_WDISP10.
5198         (Target_sparc::Scan::local): Likewise.
5199         (Target_sparc::Scan::global): Likewise.
5200         (Target_sparc::Relocate::relocate): Likewise.
5201
5202 2012-04-09  Cary Coutant  <ccoutant@google.com>
5203
5204         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
5205         low_pc == 0.
5206
5207 2012-04-06  Ian Lance Taylor  <iant@google.com>
5208
5209         * timer.cc: #include <unistd.h>.
5210
5211 2012-04-06  Roland McGrath  <mcgrathr@google.com>
5212
5213         * configure.in (AC_CHECK_HEADERS): Add locale.h.
5214         * config.in: Regenerate.
5215         * configure: Regenerate.
5216
5217 2012-04-05  Nick Clifton  <nickc@redhat.com>
5218
5219         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
5220         (AM_LC_MESSAGES): Add.
5221         * aclocal.m4: Regenerate.
5222         * config.in: Regenerate.
5223         * configure: Regenerate.
5224
5225 2012-03-21  Cary Coutant  <ccoutant@google.com>
5226
5227         * Makefile.am: Add gdb-index.cc, gdb-index.h.
5228         * Makefile.in: Regenerate.
5229         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
5230         (Sized_elf_reloc_mapper::symbol_section): New function.
5231         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
5232         (make_elf_reloc_mapper): New function.
5233         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
5234         (Dwarf_abbrev_table::do_read_abbrevs): New function.
5235         (Dwarf_abbrev_table::do_get_abbrev): New function.
5236         (Dwarf_ranges_table::read_ranges_table): New function.
5237         (Dwarf_ranges_table::read_range_list): New function.
5238         (Dwarf_pubnames_table::read_section): New function.
5239         (Dwarf_pubnames_table::read_header): New function.
5240         (Dwarf_pubnames_table::next_name): New function.
5241         (Dwarf_die::Dwarf_die): New function.
5242         (Dwarf_die::read_attributes): New function.
5243         (Dwarf_die::skip_attributes): New function.
5244         (Dwarf_die::set_name): New function.
5245         (Dwarf_die::set_linkage_name): New function.
5246         (Dwarf_die::attribute): New function.
5247         (Dwarf_die::string_attribute): New function.
5248         (Dwarf_die::int_attribute): New function.
5249         (Dwarf_die::uint_attribute): New function.
5250         (Dwarf_die::ref_attribute): New function.
5251         (Dwarf_die::child_offset): New function.
5252         (Dwarf_die::sibling_offset): New function.
5253         (Dwarf_info_reader::check_buffer): New function.
5254         (Dwarf_info_reader::parse): New function.
5255         (Dwarf_info_reader::do_parse): New function.
5256         (Dwarf_info_reader::do_read_string_table): New function.
5257         (Dwarf_info_reader::lookup_reloc): New function.
5258         (Dwarf_info_reader::get_string): New function.
5259         (Dwarf_info_reader::visit_compilation_unit): New function.
5260         (Dwarf_info_reader::visit_type_unit): New function.
5261         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
5262         Sized_elf_reloc_mapper.
5263         (Sized_dwarf_line_info::symbol_section): Remove function.
5264         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
5265         (Sized_dwarf_line_info::read_line_mappings): Remove object
5266         parameter, adjust callers.
5267         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
5268         * dwarf_reader.h: Include <sys/types.h>.
5269         (class Track_relocs): Remove forward declaration.
5270         (class Elf_reloc_mapper): New class.
5271         (class Sized_elf_reloc_mapper): New class.
5272         (class Dwarf_abbrev_table): New class.
5273         (class Dwarf_range_list): New class.
5274         (class Dwarf_ranges_table): New class.
5275         (class Dwarf_pubnames_table): New class.
5276         (class Dwarf_die): New class.
5277         (class Dwarf_info_reader): New class.
5278         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
5279         (Sized_dwarf_line_info::symbol_section): Remove member function.
5280         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
5281         base class.
5282         * gdb-index.cc: New source file.
5283         * gdb-index.h: New source file.
5284         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
5285         and .debug_types sections, call Layout::add_to_gdb_index.
5286         (Sized_relobj_incr::do_section_name): Implement.
5287         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
5288         return type; Implement.
5289         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
5290         return type.
5291         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
5292         parameter list and return type.
5293         (Sized_incr_dynobj::do_section_contents): Likewise.
5294         * layout.cc: Include gdb-index.h.
5295         (Layout::Layout): Initialize gdb_index_data_.
5296         (Layout::init_fixed_output_section): Check for .gdb_index section.
5297         (Layout::add_to_gdb_index): New function. Instantiate.
5298         * layout.h: Add forward declaration for class Gdb_index.
5299         (Layout::add_to_gdb_index): New member function.
5300         (Layout::gdb_index_data_): New data member.
5301         * main.cc: Include gdb-index.h.
5302         (main): Print statistics for gdb index.
5303         * object.cc (Object::section_contents): Move code into
5304         do_section_contents.
5305         (need_decompressed_section): Check for sections needed when building
5306         gdb index.
5307         (build_compressed_section_map): Likewise.
5308         (Sized_relobj_file::do_read_symbols): Need local symbols when building
5309         gdb index.
5310         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
5311         sections; call Layout::add_to_gdb_index.
5312         (Sized_relobj_file::do_decompressed_section_contents): Call
5313         do_section_contents directly.
5314         * object.h (Object::do_section_contents): Adjust parameter list and
5315         return type.
5316         (Object::do_decompressed_section_contents): Call do_section_contents
5317         directly.
5318         (Sized_relobj_file::do_section_contents): Adjust parameter list and
5319         return type.
5320         * options.h (class General_options): Add --gdb-index option.
5321         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
5322         list and return type.
5323         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
5324         * reloc.h (Track_relocs::checkpoint): New function.
5325         (Track_relocs::reset): New function.
5326
5327         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
5328         New test cases.
5329         * testsuite/Makefile.in: Regenerate.
5330         * testsuite/gdb_index_test.cc: New test source file.
5331         * testsuite/gdb_index_test_1.sh: New test source file.
5332         * testsuite/gdb_index_test_2.sh: New test source file.
5333
5334 2012-03-19  Doug Kwan  <dougkwan@google.com>
5335
5336         * arm.cc (Target_arm::do_define_standard_symbols): New method.
5337         (Target_arm::do_finalize_sections): Remove code which defines
5338         __exidx_start and __exidx_end.  Make symbol table parameter
5339         anonymous as it is not used.
5340         * gold.cc (queue_middle_tasks): Call target hook to define any
5341         target-specific symbols.
5342         * target.h (Target::define_standard_symbols): New method.
5343         (Target::do_define_standard_symbols): Same.
5344         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
5345         * testsuite/Makefile.in: Regenerate.
5346         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
5347         and __exidx_end.
5348         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
5349         relocations are generated for __exidx_start and __exidx_end.
5350
5351 2012-03-16  Doug Kwan  <dougkwan@google.com>
5352
5353         * testsuite/Makefile.am: Disable test initpri3b.
5354         * testsuite/Makefile.in: Regenerate.
5355
5356 2012-03-15  Doug Kwan  <dougkwan@google.com>
5357
5358         * arm.cc (Target_arm::got_section): Make .got section read-only
5359         if -z now is given.
5360
5361 2012-03-15  Ian Lance Taylor  <iant@google.com>
5362
5363         PR gold/13850
5364         * layout.cc (Layout::make_output_section): Correctly mark
5365         SHT_INIT_ARRAY, et. al., as relro.
5366
5367 2012-03-14  Doug Kwan  <dougkwan@google.com>
5368
5369         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
5370         dynamic relocations for protected symbols in shared objects.
5371
5372 2012-03-13  Ian Lance Taylor  <iant@google.com>
5373
5374         * resolve.cc (Symbol_table::resolve): When merging common symbols,
5375         keep the larger alignment.
5376
5377 2012-03-12  Cary Coutant  <ccoutant@google.com>
5378
5379         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
5380         handling of DW_LNE_define_file.
5381
5382 2012-03-12  Cary Coutant  <ccoutant@google.com>
5383
5384         * reduced_debug_output.cc
5385         (Output_reduced_debug_info_section::get_die_end): Add new FORM
5386         codes to switch.
5387
5388 2012-02-29  Cary Coutant  <ccoutant@google.com>
5389
5390         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
5391
5392 2012-02-29  Cary Coutant  <ccoutant@google.com>
5393
5394         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5395         Call Object::decompressed_section_contents.
5396         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
5397         New dtor.
5398         (Sized_dwarf_line_info::buffer_start_): New data member.
5399         * merge.cc (Output_merge_data::do_add_input_section): Call
5400         Object::decompressed_section_contents.
5401         (Output_merge_string::do_add_input_section): Likewise.
5402         * object.cc (need_decompressed_section): New function.
5403         (build_compressed_section_map): Decompress sections needed later.
5404         (Sized_relobj_file::do_decompressed_section_contents): New function.
5405         (Sized_relobj_file::do_discard_decompressed_sections): New function.
5406         * object.h (Object::decompressed_section_contents): New function.
5407         (Object::discard_decompressed_sections): New function.
5408         (Object::do_decompressed_section_contents): New function.
5409         (Object::do_discard_decompressed_sections): New function.
5410         (Compressed_section_info): New type.
5411         (Compressed_section_map): Include decompressed section contents.
5412         (Sized_relobj_file::do_decompressed_section_contents): New function.
5413         (Sized_relobj_file::do_discard_decompressed_sections): New function.
5414
5415 2012-02-16  Cary Coutant  <ccoutant@google.com>
5416
5417         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
5418         * testsuite/Makefile.in: Regenerate.
5419
5420 2012-02-14  Cary Coutant  <ccoutant@google.com>
5421
5422         * options.cc (General_options::finalize): Disallow -pie and -static.
5423
5424 2012-02-03  Doug Kwan  <dougkwan@google.com>
5425
5426         * arm.cc (Arm_relocate_functions::abs8,
5427         Arm_relocate_functions::abs16): Use
5428         Bits::has_signed_unsigned_overflow32.
5429         (Arm_relocate_functions::thm_abs8): Correct range of
5430         overflow check.
5431         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
5432         in assertions.
5433
5434 2012-02-02  Doug Kwan  <dougkwan@google.com>
5435
5436         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
5437         position independent outputs, not just shared objects.
5438
5439 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
5440
5441         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
5442         * configure: Regenerated.
5443
5444 2012-01-27  Ian Lance Taylor  <iant@google.com>
5445
5446         * reloc.h (Bits): New class with static functions, copied from
5447         namespace utils in arm.cc.
5448         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
5449         instead.
5450
5451 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5452
5453         * incremental.cc (write_info_blocks): Correct relocation offset.
5454
5455 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5456
5457         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
5458         (Relocate::tls_gd_to_le): Likewise.
5459
5460 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5461
5462         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
5463
5464 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5465
5466         * configure.ac: Check if -mcmodel=medium works.
5467         * configure: Regenerated.
5468
5469 2012-01-24  Cary Coutant  <ccoutant@google.com>
5470
5471         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
5472         definition and ...
5473         (read_unsigned_LEB_128_x): ... this new function.
5474         (read_signed_LEB_128): Replaced with inline definition and ...
5475         (read_signed_LEB_128_x): ... this new function.
5476         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
5477         (read_unsigned_LEB_128): Add inline definition.
5478         (read_signed_LEB_128_x): New function.
5479         (read_signed_LEB_128): Add inline definition.
5480         * testsuite/Makefile.am (leb128_unittest): New unit test.
5481         * testsuite/Makefile.in: Regenerate.
5482         * testsuite/leb128_unittest.cc: New unit test.
5483
5484 2012-01-23  Ian Lance Taylor  <iant@google.com>
5485
5486         PR gold/13617
5487         * i386.cc (Target_i386::do_code_fill): When using a jmp
5488         instruction, pad with nop instructions.
5489         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5490
5491 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
5492
5493         * x86_64.cc (gc_process_relocs): Add typename on types used in
5494         template.
5495         (scan_relocs): Likewise.
5496         (relocate_section): Likewise.
5497         (apply_relocation): Likewise.
5498
5499 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
5500
5501         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
5502         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
5503         under x32.
5504
5505 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
5506
5507         * x86_64.cc: Initial support for x32.
5508
5509 2012-01-03  Cary Coutant  <ccoutant@google.com>
5510
5511         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
5512         Use abstract base class for GOT.
5513         * gold/output.h (class Output_data_got_base): New abstract base class.
5514         (class Output_data_got): Derive from new base class, adjust ctors.
5515         (Output_data_got::reserve_slot): Make virtual; rename to
5516         do_reserve_slot; Adjust callers.
5517         * gold/target.h (Sized_target::init_got_plt_for_update): Return
5518         pointer to abstract base class.
5519         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
5520
5521 2011-12-18  Ian Lance Taylor  <iant@google.com>
5522
5523         * object.h (Relobj::local_symbol_value): New function.
5524         (Relobj::local_plt_offset): New function.
5525         (Relobj::local_has_got_offset): New function.
5526         (Relobj::local_got_offset): New function.
5527         (Relobj::set_local_got_offset): New function.
5528         (Relobj::do_local_symbol_value): New pure virtual function.
5529         (Relobj::do_local_plt_offset): Likewise.
5530         (Relobj::do_local_has_got_offset): Likewise.
5531         (Relobj::do_local_got_offset): Likewise.
5532         (Relobj::do_set_local_got_offset): Likewise.
5533         (Sized_relobj::do_local_has_got_offset): Rename from
5534         local_has_got_offset.
5535         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
5536         (Sized_relobj::do_set_local_got_offset): Rename from
5537         set_local_got_offset.
5538         (Sized_relobj_file::do_local_plt_offset): Rename from
5539         local_plt_offset.
5540         (Sized_relobj_file::do_local_symbol_value): New function.
5541         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
5542         local_plt_offset.
5543         * output.cc (Output_data_got::Got_entry::write): Change object to
5544         Relobj.  Use local_symbol_value.
5545         (Output_data_got::add_global_with_rel): Change rel_dyn to
5546         Output_data_reloc_generic*.  Use add_global_generic.
5547         (Output_data_got::add_global_with_rela): Remove.  Change all
5548         callers to use add_global_with_rel.
5549         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
5550         Output_data_reloc_generic*.  Use add_global_generic.
5551         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
5552         callers to use add_global_pair_with_rel.
5553         (Output_data_got::add_local): Change object to Relobj*.
5554         (Output_data_got::add_local_plt): Likewise.
5555         (Output_data_got::add_local_with_rel): Change object to Relobj*,
5556         change rel_dyn to Output_data_reloc_generic*.  Use
5557         add_local_generic.
5558         (Output_data_got::add_local_with_rela): Remove.  Change all
5559         callers to use all_local_with_rel.
5560         (Output_data_got::add_local_pair_with_rel): Change object to
5561         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
5562         add_output_section_generic.
5563         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
5564         callers to use add_local_pair_with_rel.
5565         (Output_data_got::reserve_local): Change object to Relobj*.
5566         * output.h: (class Output_data_reloc_generic): Add pure virtual
5567         declarations for add_global_generic, add_local_generic,
5568         add_output_section_generic.
5569         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
5570         functions for Output_data_reloc_generic.  Update declarations for
5571         changes listed in output.cc.
5572         (class Output_data_got): Change template parameter to got_size.
5573         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
5574         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
5575         function.
5576         (Sized_relobj_incr::do_local_plt_offset): New function.
5577         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
5578         add_global_generic.
5579
5580 2011-12-17  Cary Coutant  <ccoutant@google.com>
5581
5582         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
5583         * resolve.cc (Symbol_table::resolve): Likewise.
5584         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
5585         arrays.
5586         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5587
5588 2011-12-16  Ian Lance Taylor  <iant@google.com>
5589
5590         * output.h (Output_data_reloc_generic::add): Only call
5591         add_dynamic_reloc if this is a dynamic reloc section.
5592
5593 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
5594
5595         PR gold/13505
5596         * target-reloc.h (apply_relocation): Replace <64, false> with
5597         <size, big_endian>.
5598
5599 2011-11-25  Nick Clifton  <nickc@redhat.com>
5600
5601         * po/it.po: New Italian translation.
5602
5603 2011-11-17  Sterling Augustine  <saugustine@google.com>
5604
5605         * script.cc (script_include_directive): Implement.
5606         (read_script_file): New local variables name and search_path. Update
5607         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
5608         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
5609         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
5610
5611 2011-11-11  Sterling Augustine  <saugustine@google.com>
5612
5613         * yyscript.y (section_cmd): Add support for INCLUDE directive.
5614         (file_or_sections_cmd): Likewise.
5615
5616 2011-11-11  Doug Kwan  <dougkwan@google.com>
5617
5618         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
5619         if --just-symbols is given.
5620
5621 2011-11-10  Doug Kwan  <dougkwan@google.com>
5622
5623         PR gold/13362
5624         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
5625         when processing data relocs.
5626         * reloc.h (Relocate_functions::rel_unaligned): New method.
5627         (Relocate_functions::pcrel_unaligned): Ditto.
5628         (Relocate_functions::rel32_unaligned): Ditto.
5629         (Relocate_functions::pcrel32_unaligned): Ditto.
5630
5631 2011-11-09  Doug Kwan  <dougkwan@google.com>
5632
5633         PR gold/13362
5634         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
5635         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
5636         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
5637         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5638         (Relocate_functions::rel_unaligned): New.
5639         (Relocate_functions::rel32_unaligned): New.
5640         * target-reloc.h (relocate_for_relocatable): Add code to handle
5641         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5642         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
5643         arm_unaligned_reloc_r): New targets.
5644         * testsuite/Makefile.in: Regenerate.
5645         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
5646         linking.
5647
5648 2011-11-02  Ian Lance Taylor  <iant@google.com>
5649
5650         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
5651         NATIVE_LINKER.
5652         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
5653         * options.cc (General_options::finalize): Use library search path
5654         from configure script if specified.  If not native and no sysroot,
5655         only search TOOLLIBDIR.
5656         * options.h (Search_directory::Search_directory): Change name to
5657         const std::string&.
5658         (General_options::add_to_library_path_with_sysroot): Change arg to
5659         const std::string&.
5660         * configure, Makefile.in, config.in: Rebuild.
5661
5662 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5663
5664         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
5665         we are working around the ARM1176 Erratum.
5666         * options.h (General_options::fix_arm1176): Add option.
5667         * testsuite/Makefile.am: Add testcases, and keep current ones
5668         working.
5669         * testsuite/Makefile.in: Regenerate.
5670         * testsuite/arm_fix_1176.s: New file.
5671         * testsuite/arm_fix_1176.sh: Likewise.
5672
5673 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5674
5675         * arm.cc (Target_arm::Target_arm): Remove initialisation of
5676         may_use_blx_.
5677         (Target_arm::may_use_blx): Remove method.
5678         (Target_arm::set_may_use_blx): Likewise.
5679         (Target_arm::may_use_v4t_interworking): New method.
5680         (Target_arm::may_use_v5t_interworking): Likewise.
5681         (Target_arm::may_use_blx_): Remove member variable.
5682         (Arm_relocate_functions::arm_branch_common): Check for v5T
5683         interworking.
5684         (Arm_relocate_functions::thumb_branch_common): Likewise.
5685         (Reloc_stub::stub_type_for_reloc): Likewise.
5686         (Target_arm::do_finalize_sections): Correct interworking checks.
5687         * testsuite/Makefile.am: Add new tests.
5688         * testsuite/Makefile.in: Regenerate.
5689         * testsuite/arm_farcall_arm_arm.s: New test.
5690         * testsuite/arm_farcall_arm_arm.sh: Likewise.
5691         * testsuite/arm_farcall_arm_thumb.s: Likewise.
5692         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
5693         * testsuite/arm_farcall_thumb_arm.s: Likewise.
5694         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
5695         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
5696         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
5697
5698 2011-10-31  Cary Coutant  <ccoutant@google.com>
5699
5700         PR gold/13023
5701         * expression.cc (Expression::eval_with_dot): Add
5702         is_section_dot_assignment parameter.
5703         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
5704         absolute and assigning to dot within a section.
5705         * script-sections.cc
5706         (Output_section_element_assignment::set_section_addresses): Pass
5707         dot_section to set_if_absolute.
5708         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
5709         as is_section_dot_assignment flag to eval_with_dot.
5710         (Output_section_element_dot_assignment::set_section_addresses):
5711         Likewise.
5712         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
5713         parameter.  Also set value if relative to dot_section; set the
5714         symbol's output_section.
5715         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
5716         parameter.  Adjust all callers.
5717         (Expression::eval_maybe_dot): Likewise.
5718         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
5719         Adjust all callers.
5720         * testsuite/script_test_2.t: Test assignment of an absolute value
5721         to dot within an output section element.
5722
5723 2011-10-31  Cary Coutant  <ccoutant@google.com>
5724
5725         * options.h (class General_options): Add --[no-]gnu-unique options.
5726         * symtab.cc (Symbol_table::sized_write_globals): Convert
5727         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
5728
5729 2011-10-31  Cary Coutant  <ccoutant@google.com>
5730
5731         PR gold/13359
5732         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
5733         unnecessary assertion.
5734         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
5735
5736 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
5737
5738         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5739         gc_mark_symbol.
5740         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5741         gc_mark_symbol.
5742         Change to just keep the section associated with symbol.
5743         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
5744         they are externally visible and --export-dynamic is turned on.
5745         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
5746
5747 2011-10-19  Ian Lance Taylor  <iant@google.com>
5748
5749         PR gold/13163
5750         * script-sections.cc
5751         (Output_section_element_dot_assignment::needs_output_section): New
5752         function.
5753
5754 2011-10-19  Ian Lance Taylor  <iant@google.com>
5755
5756         PR gold/13204
5757         * layout.cc (Layout::segment_precedes): Don't assert failure if a
5758         --section-start option was seen.
5759         * options.h (General_options::any_section_start): New function.
5760
5761 2011-10-18  David S. Miller  <davem@davemloft.net>
5762
5763         PR binutils/13301
5764         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
5765         member to track relocation locations that have moved during TLS
5766         reloc optimizations.
5767         (Target_sparc::Relocate::Relocate): Initialize to NULL.
5768         (Target_sparc::Relocate::relocate): Adjust view down by 4
5769         bytes if it matches reloc_adjust_addr_.
5770         (Target_sparc::Relocate::relocate_tls): Always move the
5771         __tls_get_addr call delay slot instruction forward 4 bytes when
5772         performing relaxation.
5773
5774 2011-10-18  Cary Coutant  <ccoutant@google.com>
5775
5776         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
5777         (Output_file::map_no_anonymous): Check for non-zero
5778         return code from posix_fallocate.
5779
5780 2011-10-17  Cary Coutant  <ccoutant@google.com>
5781
5782         PR gold/13245
5783         * plugin.cc (is_visible_from_outside): Check for symbols
5784         referenced from dynamic objects.
5785         * resolve.cc (Symbol_table::resolve): Don't count references
5786         from dynamic objects as references from real ELF files.
5787         * testsuite/plugin_test_2.sh: Adjust expected result.
5788
5789 2011-10-17  Cary Coutant  <ccoutant@google.com>
5790
5791         * gold.cc: Include timer.h.
5792         (queue_middle_tasks): Stamp time.
5793         (queue_final_tasks): Likewise.
5794         * main.cc (main): Store timer in parameters.  Print timers
5795         for each pass.
5796         * parameters.cc (Parameters::Parameters): Initialize timer_.
5797         (Parameters::set_timer): New function.
5798         (set_parameters_timer): New function.
5799         * parameters.h (Parameters::set_timer): New function.
5800         (Parameters::timer): New function.
5801         (Parameters::timer_): New data member.
5802         (set_parameters_timer): New function.
5803         * timer.cc (Timer::stamp): New function.
5804         (Timer::get_pass_time): New function.
5805         * timer.h (Timer::stamp): New function.
5806         (Timer::get_pass_time): New function.
5807         (Timer::pass_times_): New data member.
5808
5809 2011-10-17  Cary Coutant  <ccoutant@google.com>
5810
5811         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
5812         task for members of lib groups.
5813
5814 2011-10-17  Cary Coutant  <ccoutant@google.com>
5815
5816         PR gold/13288
5817         * fileread.cc (File_read::find_view): Add assert.
5818         (File_read::make_view): Move bounds check (replace with assert)...
5819         (File_read::find_or_make_view): ... to here.
5820
5821 2011-10-12  Cary Coutant  <ccoutant@google.com>
5822
5823         * output.cc (Output_file::open_base_file): Handle case where
5824         ::read returns less than requested size.
5825
5826 2011-10-10  Cary Coutant  <ccoutant@google.com>
5827
5828         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
5829         Initialize defined_count_.
5830         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
5831         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
5832         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
5833         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
5834         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
5835         * incremental.h (Sized_relobj_incr::defined_count_): New data
5836         member.
5837         (Sized_incr_dynobj::defined_count_): New data member.
5838         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
5839         Return zeroes instead of internal error.
5840
5841 2011-10-10  Cary Coutant  <ccoutant@google.com>
5842
5843         PR gold/13249
5844         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
5845         (Output_reloc::symbol_value): Return PLT offset if flag is set.
5846         * output.h (class Output_reloc): Add use_plt_offset flag.
5847         (Output_reloc::type_): Adjust size of bit field.
5848         (Output_reloc::use_plt_offset_): New bit field.
5849         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
5850         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
5851         flag.  Adjust all callers.
5852         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
5853         creating RELATIVE relocations.
5854
5855 2011-10-10  Nick Clifton  <nickc@redhat.com>
5856
5857         * po/es.po: Updated Spanish translation.
5858         * po/fi.po: Updated Finnish translation.
5859
5860 2011-10-03   Diego Novillo  <dnovillo@google.com>
5861
5862         * options.cc (parse_uint): Fix dereference of RETVAL.
5863
5864 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
5865
5866         * layout.h (section_order_map_): New member.
5867         (get_section_order_map): New member function.
5868         * output.cc (Output_section::add_input_section): Check for patterns
5869         only when --section-ordering-file is specified.
5870         * gold.cc (queue_middle_tasks): Delay updating order of sections till
5871         output_sections have been formed.
5872         * layout.cc (Layout_Layout): Initialize section_order_map_.
5873         * plugin.cc (update_section_order): Store order in order_map. Do not
5874         update the order.
5875         * testsuite/Makefile.am: Add test case for plugin_final_layout.
5876         * testsuite/Makefile.in: Regenerate.
5877         * testsuite/plugin_section_order.c: New file.
5878         * testsuite/plugin_final_layout.cc: New file.
5879         * testsuite/plugin_final_layout.sh: New file.
5880
5881 2011-09-29  Cary Coutant  <ccoutant@google.com>
5882
5883         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5884         Check for NULL.
5885         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
5886         symbols during incremental update.
5887         (Symbol_table::add_from_dynobj): Likewise.
5888
5889 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5890             Ian Lance Taylor  <iant@google.com>
5891
5892         * symtab.cc (Symbol_table::define_special_symbol): Always
5893         canonicalize version string.
5894
5895 2011-09-26  Cary Coutant  <ccoutant@google.com>
5896
5897         * gold.cc (queue_initial_tasks): Move option checks ...
5898         * options.cc (General_options::finalize): ... to here. Disable
5899         some options; make others fatal.
5900
5901 2011-09-26  Cary Coutant  <ccoutant@google.com>
5902
5903         gcc PR lto/47247
5904         * plugin.cc (get_symbols_v2): New function.
5905         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
5906         (is_referenced_from_outside): New function.
5907         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
5908         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
5909         (get_symbols): Pass version parameter.
5910         (get_symbols_v2): New function.
5911         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
5912         parameter.
5913         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
5914         (onload): Add LDPT_GET_SYMBOLS_V2.
5915         (all_symbols_read_hook): Use get_symbols_v2; check for
5916         LDPR_PREVAILING_DEF_IRONLY_EXP.
5917         * testsuite/plugin_test_3.sh: Update expected results.
5918
5919 2011-09-23  Simon Baldwin  <simonb@google.com>
5920
5921         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5922         configuration options.
5923         * configure: Regenerate.
5924         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
5925         * Makefile.in: Regenerate.
5926         * testsuite/Makefile.in: Regenerate.
5927
5928 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
5929
5930         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
5931
5932 2011-09-19  Cary Coutant  <ccoutant@google.com>
5933
5934         * incremental.cc (can_incremental_update): Fix typo in comment.
5935         * incremental.h (can_incremental_update): Likewise.
5936
5937 2011-09-18  Cary Coutant  <ccoutant@google.com>
5938
5939         * incremental.cc (can_incremental_update): New function.
5940         * incremental.h (can_incremental_update): New function.
5941         * layout.cc (Layout::init_fixed_output_section): Call it.
5942         (Layout::make_output_section): Don't allow patch space in .eh_frame.
5943         * object.cc (Sized_relobj_file::do_layout): Call
5944         can_incremental_update.
5945
5946 2011-09-13  Cary Coutant  <ccoutant@google.com>
5947
5948         * configure.ac: Check for glibc support for gnu_indirect_function
5949         support with static linking, setting automake conditional
5950         IFUNC_STATIC.
5951         * Makefile.in: Regenerate.
5952         * configure: Regenerate.
5953
5954         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
5955         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
5956         for IFUNC_STATIC.
5957         * testsuite/Makefile.in: Regenerate.
5958
5959 2011-09-13  Cary Coutant  <ccoutant@google.com>
5960
5961         * incremental.cc (Sized_relobj_incr::do_layout): Call
5962         report_comdat_group for kept comdat sections.
5963         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
5964         * testsuite/Makefile.in: Regenerate.
5965         * testsuite/incr_comdat_test_1.cc: New source file.
5966         * testsuite/incr_comdat_test_2_v1.cc: New source file.
5967         * testsuite/incr_comdat_test_2_v2.cc: New source file.
5968         * testsuite/incr_comdat_test_2_v3.cc: New source file.
5969
5970 2011-09-13  Ian Lance Taylor  <iant@google.com>
5971
5972         * object.cc (Sized_relobj_file::do_layout): Remove unused local
5973         variable external_symbols_offset.
5974
5975 2011-09-12  Ian Lance Taylor  <iant@google.com>
5976
5977         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
5978         triggered if object has no symbols.
5979
5980 2011-09-09  David S. Miller  <davem@davemloft.net>
5981
5982         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
5983         (Output_fill_debug_line::do_write): Likewise.
5984
5985 2011-08-29  Cary Coutant  <ccoutant@google.com>
5986
5987         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
5988         casts to match formatting specs.
5989         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
5990
5991 2011-08-26  Cary Coutant  <ccoutant@google.com>
5992
5993         * layout.cc (Free_list::allocate): Provide guarantee of minimum
5994         remaining hole size when allocating.
5995         (Layout::make_output_section): Set fill methods for debug sections.
5996         * layout.h (Free_list::Free_list_node): Move from private to
5997         public.
5998         (Free_list::set_min_hole_size): New function.
5999         (Free_list::begin, Free_list::end): New functions.
6000         (Free_list::min_hole_): New data member.
6001         * output.cc: Include dwarf.h.
6002         (Output_fill_debug_info::do_minimum_hole_size): New function.
6003         (Output_fill_debug_info::do_write): New function.
6004         (Output_fill_debug_line::do_minimum_hole_size): New function.
6005         (Output_fill_debug_line::do_write): New function.
6006         (Output_section::Output_section): Initialize new data member.
6007         (Output_section::set_final_data_size): Ensure patch space is larger
6008         than minimum hole size.
6009         (Output_section::do_write): Fill holes in debug sections.
6010         * output.h (Output_fill): New class.
6011         (Output_fill_debug_info): New class.
6012         (Output_fill_debug_line): New class.
6013         (Output_section::set_free_space_fill): New function.
6014         (Output_section::free_space_fill_): New data member.
6015         * testsuite/Makefile.am (incremental_test_3): Add
6016         --incremental-patch option.
6017         (incremental_test_4): Likewise.
6018         (incremental_test_5): Likewise.
6019         (incremental_test_6): Likewise.
6020         (incremental_copy_test): Likewise.
6021         (incremental_common_test_1): Likewise.
6022         * testsuite/Makefile.in: Regenerate.
6023
6024 2011-08-26  Nick Clifton  <nickc@redhat.com>
6025
6026         * po/es.po: Updated Spanish translation.
6027
6028 2011-08-01  Cary Coutant  <ccoutant@google.com>
6029
6030         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
6031         * gold/testsuite/Makefile.in: Regenerate.
6032         * gold/testsuite/justsyms_exec.c: New source file.
6033         * gold/testsuite/justsyms_lib.c: New source file.
6034
6035 2011-08-01  Cary Coutant  <ccoutant@google.com>
6036
6037         * layout.cc (Layout::set_segment_offsets): Don't realign text
6038         segment if -Ttext was specified.
6039         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
6040         file type.
6041         * object.h (Sized_relobj_file::e_type): New function.
6042         (Sized_relobj_file::e_type_): New data member.
6043         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
6044         base address for ET_EXEC files.
6045         * target.cc (Target::do_make_elf_object_implementation): Allow
6046         ET_EXEC files with --just-symbols option.
6047
6048 2011-07-28  Cary Coutant  <ccoutant@google.com>
6049
6050         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
6051         Add thread_number parameter.
6052         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
6053         * workqueue-threads.cc
6054         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
6055         current thread if its thread number is greater than desired thread
6056         count.
6057         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
6058         Add thread_number parameter.
6059         (Workqueue::should_cancel_thread): Likewise.
6060         (Workqueue::find_runnable_or_wait): Pass thread_number to
6061         should_cancel_thread.
6062         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
6063         parameter.
6064
6065 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
6066
6067         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
6068         only after checking if it cannot be forced local.
6069         * symtab.h (is_externally_visible): Check if the symbol is not forced
6070         local.
6071
6072 2011-07-15  Ian Lance Taylor  <iant@google.com>
6073
6074         * options.h (class General_options): Add --print-output-format.
6075         Move -EL next to -EB, for  better --help output.
6076         * target-select.cc: Include <cstdio>, "options.h", and
6077         "parameters.h".
6078         (Target_selector::do_target_bfd_name): New function.
6079         (print_output_format): New function.
6080         * target-select.h (class Target_selector): Update declarations.
6081         (Target_selector::target_bfd_name): New function.
6082         (print_output_format): Declare.
6083         * main.cc: Include "target-select.h".
6084         (main): Handle --print-output-format.
6085         * gold.cc: Include "target-select.h".
6086         (queue_initial_tasks): Handle --print-output-format when there are
6087         no input files.
6088         * parameters.cc (parameters_force_valid_target): Give a better
6089         error message if -EB/-EL does not match target.
6090         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
6091         function.
6092
6093 2011-07-15  Ian Lance Taylor  <iant@google.com>
6094
6095         * i386.cc (class Output_data_plt_i386): Add layout_ field.
6096         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
6097         (Output_data_plt_i386::do_write): Write address of .dynamic
6098         section to first entry in .got.plt section.
6099         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
6100         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
6101         Initialize layout_.
6102         (Output_data_plt_x86_64::do_write): Write address of .dynamic
6103         section to first entry in .got.plt section.
6104         * layout.h (Layout::dynamic_section): New function.
6105
6106 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
6107
6108         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
6109         to claim_file call.
6110         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
6111         input_section_position_, and input_section_glob_.
6112         (read_layout_from_file): Call function section_ordering_specified.
6113         * layout.h (is_section_ordering_specified): New function.
6114         (section_ordering_specified): New function.
6115         (section_ordering_specified_): New boolean member.
6116         * main.cc(main): Call load_plugins after layout object is defined.
6117         * output.cc (Output_section::add_input_section): Use
6118         function section_ordering_specified to check if section ordering is
6119         needed.
6120         * output.cc (Output_section::add_relaxed_input_section): Use
6121         function section_ordering_specified to check if section ordering is
6122         needed.
6123         (Output_section::update_section_layout): New function.
6124         (Output_section::sort_attached_input_sections): Check if input section
6125         must be reordered.
6126         * output.h (Output_section::update_section_layout): New function.
6127         * plugin.cc (get_section_count): New function.
6128         (get_section_type): New function.
6129         (get_section_name): New function.
6130         (get_section_contents): New function.
6131         (update_section_order): New function.
6132         (allow_section_ordering): New function.
6133         (Plugin::load): Add the new interfaces to the transfer vector.
6134         (Plugin_manager::load_plugins): New parameter.
6135         (Plugin_manager::all_symbols_read): New parameter.
6136         (Plugin_manager::claim_file): New parameter. Save the elf object for
6137         unclaimed objects.
6138         (Plugin_manager::get_elf_object): New function.
6139         (Plugin_manager::get_view): Change to directly use the bool to check
6140         if get_view is called from claim_file_hook.
6141         * plugin.h (input_objects): New function
6142         (Plugin__manager::load_plugins): New parameter.
6143         (Plugin_manager::claim_file): New parameter.
6144         (Plugin_manager::get_elf_object): New function.
6145         (Plugin_manager::in_claim_file_handler): New function.
6146         (Plugin_manager::in_claim_file_handler_): New member.
6147         (layout): New function.
6148         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
6149         handler with an extra parameter. Make the elf object before calling
6150         claim_file handler.
6151         * testsuite/plugin_test.c (get_section_count): New function pointer.
6152         (get_section_type): New function pointer.
6153         (get_section_name): New function pointer.
6154         (get_section_contents): New function pointer.
6155         (update_section_order): New function pointer.
6156         (allow_section_ordering): New function pointer.
6157         (onload): Check if the new interfaces exist.
6158
6159 2011-07-13  Ian Lance Taylor  <iant@google.com>
6160
6161         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
6162         relro section.
6163         * x86_64.cc (Target_x86_64::got_section): Likewise.
6164         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
6165         (relro_now_test_SOURCES): New variable.
6166         (relro_now_test_DEPENDENCIES): New variable.
6167         (relro_now_test_LDFLAGS): New variable.
6168         (relro_now_test_LDADD): New variable.
6169         (relro_now_test.so): New target.
6170         * testsuite/Makefile.in: Rebuild.
6171
6172 2011-07-12  Ian Lance Taylor  <iant@google.com>
6173
6174         PR gold/12980
6175         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
6176         GLOB_DAT relocation rather than a RELATIVE relocation for a
6177         protected symbol when creating a shared library.
6178         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6179         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
6180         * testsuite/protected_main_1.cc (main): Test that protected
6181         function has same address.
6182
6183 2011-07-11  Ian Lance Taylor  <iant@google.com>
6184
6185         PR gold/12979
6186         * options.h (class General_options): Add -Bgroup.
6187         * options.cc (General_options::finalize): If -Bgroup is set,
6188         default to --unresolved-symbols=report-all.
6189         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
6190         * target-reloc.h (issue_undefined_symbol_error): Handle
6191         --unresolved-symbols=report-all.
6192
6193 2011-07-08  Ian Lance Taylor  <iant@google.com>
6194
6195         PR gold/11985
6196         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
6197         if linker script discards key sections.
6198         (Layout::create_dynamic_symtab): Likewise.
6199         (Layout::assign_local_dynsym_offsets): Likewise.
6200         (Layout::sized_create_version_sections): Likewise.
6201         (Layout::create_interp): Likewise.
6202         (Layout::finish_dynamic_section): Likewise.
6203         (Layout::set_dynamic_symbol_size): Likewise.
6204
6205 2011-07-08  Ian Lance Taylor  <iant@google.com>
6206
6207         PR gold/12386
6208         * options.h (class General_options): Add --unresolved-symbols.
6209         * target-reloc.h (issue_undefined_symbol_error): Check
6210         --unresolved-symbols.  Add comments.
6211
6212 2011-07-08  Ian Lance Taylor  <iant@google.com>
6213
6214         * testsuite/odr_violation2.cc (Ordering::operator()): Make
6215         expression more complex.
6216
6217 2011-07-08  Ian Lance Taylor  <iant@google.com>
6218
6219         PR gold/11317
6220         * target-reloc.h (issue_undefined_symbol_error): New inline
6221         function, broken out of relocate_section.
6222         (relocate_section): Call issue_undefined_symbol_error.
6223         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
6224         there is no TLS segment if we are about to issue an undefined
6225         symbol error.
6226         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
6227
6228 2011-07-08  Ian Lance Taylor  <iant@google.com>
6229
6230         PR gold/12279
6231         * resolve.cc (Symbol_table::should_override): Add fromtype
6232         parameter.  Change all callers.  Give error when linking together
6233         TLS and non-TLS symbol.
6234         (Symbol_table::should_override_with_special): Add fromtype
6235         parameter.  Change all callers.
6236         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
6237         there is no TLS segment if we have reported some errors.
6238         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
6239
6240 2011-07-08  Ian Lance Taylor  <iant@google.com>
6241
6242         PR gold/12372
6243         * target.h (Target::plt_address_for_global): New function.
6244         (Target::plt_address_for_local): New function.
6245         (Target::plt_section_for_global): Remove.
6246         (Target::plt_section_for_local): Remove.
6247         (Target::do_plt_address_for_global): New virtual function.
6248         (Target::do_plt_address_for_local): New virtual function.
6249         (Target::do_plt_section_for_global): Remove.
6250         (Target::do_plt_section_for_local): Remove.
6251         (Target::register_global_plt_entry): Add Symbol_table and Layout
6252         parameters.
6253         * output.cc (Output_data_got::Got_entry::write): Use
6254         plt_address_for_global and plt_address_for_local.
6255         * layout.cc (Layout::add_target_dynamic_tags): Use size and
6256         address of output section.
6257         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
6258         got_irelative_, and irelative_count_ fields.  Update
6259         declarations.
6260         (Output_data_plt_i386::has_irelative_section): New function.
6261         (Output_data_plt_i386::entry_count): Add irelative_count_.
6262         (Output_data_plt_i386::set_final_data_size): Likewise.
6263         (class Target_i386): Add got_irelative_ and rel_irelative_
6264         fields.  Update declarations.
6265         (Target_i386::Target_i386): Initialize new fields.
6266         (Target_i386::do_plt_address_for_global): New function replacing
6267         do_plt_section_for_global.
6268         (Target_i386::do_plt_address_for_local): New function replacing
6269         do_plt_section_for_local.
6270         (Target_i386::got_section): Create got_irelative_.
6271         (Target_i386::rel_irelative_section): New function.
6272         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
6273         fields.  Don't define __rel_iplt_{start,end}.
6274         (Output_data_plt_i386::add_entry): Add symtab and layout
6275         parameters.  Change all callers.  Use different PLT and GOT for
6276         IFUNC symbols.
6277         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
6278         layout parameters.  Change all callers.  Use different PLT and
6279         GOT.
6280         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
6281         (Output_data_plt_i386::rel_irelative): New function.
6282         (Output_data_plt_i386::address_for_global): New function.
6283         (Output_data_plt_i386::address_for_local): New function.
6284         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
6285         IRELATIVE GOT when changing IFUNC GOT entries.
6286         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
6287         reloc.
6288         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
6289         if we didn't create an IRELATIVE GOT.
6290         (Target_i386::Relocate::relocate): Use plt_address_for_global and
6291         plt_address_for_local.
6292         (Target_i386::do_dynsym_value): Use plt_address_for_global.
6293         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
6294         got_irelative_, and irelative_count_ fields.  Update
6295         declarations.
6296         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
6297         Initialize new fields.  Remove symtab parameter.  Change all
6298         callers.
6299         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
6300         irelative_count_.
6301         (Output_data_plt_x86_64::has_irelative_section): New function.
6302         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
6303         (class Target_x86_64): Add got_irelative_ and rel_irelative_
6304         fields.  Update declarations.
6305         (Target_x86_64::Target_x86_64): Initialize new fields.
6306         (Target_x86_64::do_plt_address_for_global): New function replacing
6307         do_plt_section_for_global.
6308         (Target_x86_64::do_plt_address_for_local): New function replacing
6309         do_plt_section_for_local.
6310         (Target_x86_64::got_section): Create got_irelative_.
6311         (Target_x86_64::rela_irelative_section): New function.
6312         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
6313         all callers.  Don't create __rel_iplt_{start,end}.
6314         (Output_data_plt_x86_64::add_entry): Add symtab and layout
6315         parameters.  Change all callers.  Use different PLT and GOT for
6316         IFUNC symbols.
6317         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
6318         layout parameters.  Change all callers.  Use different PLT and
6319         GOT.
6320         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
6321         parameters.  Change all callers.  Use different PLT and GOT for
6322         IFUNC symbols.
6323         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
6324         (Output_data_plt_x86_64::rela_irelative): New function.
6325         (Output_data_plt_x86_64::address_for_global): New function.
6326         (Output_data_plt_x86_64::address_for_local): New function.
6327         (Output_data_plt_x86_64::set_final_data_size): Likewise.
6328         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
6329         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
6330         (Target_x86_64::register_global_plt_entry): Add symtab and layout
6331         parameters.
6332         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
6333         reloc.
6334         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
6335         symbols if we didn't create an IRELATIVE GOT.
6336         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
6337         plt_address_for_local.
6338         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
6339         * testsuite/ifuncvar1.c: New test file.
6340         * testsuite/ifuncvar2.c: New test file.
6341         * testsuite/ifuncvar3.c: New test file.
6342         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
6343         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
6344         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
6345         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
6346         * testsuite/Makefile.in: Rebuild.
6347
6348 2011-07-07  Cary Coutant  <ccoutant@google.com>
6349
6350         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
6351         (two_file_test_1_ndebug.o): Likewise.
6352         (two_file_test_1b_ndebug.o): Likewise.
6353         (two_file_test_2_ndebug.o): Likewise.
6354         (two_file_test_main_ndebug.o): Likewise.
6355         (incremental_test_2): Link with no-debug versions.
6356
6357 2011-07-06  Cary Coutant  <ccoutant@google.com>
6358
6359         * gold/incremental.cc
6360         (Output_section_incremental_inputs::write_info_blocks): Check for
6361         hidden and internal symbols.
6362
6363 2011-07-06  Cary Coutant  <ccoutant@google.com>
6364
6365         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
6366         Check disposition for startup file.
6367         (Incremental_inputs::report_command_line): Ignore
6368         --incremental-startup-unchanged option.
6369         * options.cc (General_options::parse_incremental_startup_unchanged):
6370         New function.
6371         (General_options::General_options): Initialize new data member.
6372         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
6373         (General_options): Add --incremental-startup-unchanged option.
6374         (General_options::incremental_startup_disposition): New function.
6375         (General_options::incremental_startup_disposition_): New data member.
6376
6377 2011-07-06  Cary Coutant  <ccoutant@google.com>
6378
6379         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
6380         input file index to Script_info ctor.
6381         (Sized_incremental_binary::do_file_has_changed): Find the
6382         command-line argument for files named in scripts.
6383         * incremental.h (Script_info::Script_info): New ctor
6384         with input file index.
6385         (Script_info::input_file_index): New function.
6386         (Script_info::input_file_index_): New data member.
6387         (Incremental_binary::get_library): Add const.
6388         (Incremental_binary::get_script_info): Add const.
6389         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
6390         * testsuite/Makefile.am (incremental_test_5): New test case.
6391         (incremental_test_6): New test case.
6392         * testsuite/Makefile.in: Regenerate.
6393
6394 2011-07-06  Cary Coutant  <ccoutant@google.com>
6395
6396         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
6397         debug output when command lines differ.
6398
6399 2011-07-06  Cary Coutant  <ccoutant@google.com>
6400
6401         * incremental.cc (Incremental_inputs::report_command_line): Ignore
6402         --incremental-patch option.
6403         * layout.cc (Free_list::allocate): Extend allocation beyond original
6404         end if enabled.
6405         (Layout::make_output_section): Mark sections that should get
6406         patch space.
6407         * options.cc (parse_percent): New function.
6408         * options.h (parse_percent): New function.
6409         (DEFINE_percent): New macro.
6410         (General_options): Add --incremental-patch option.
6411         * output.cc (Output_section::Output_section): Initialize new data
6412         members.
6413         (Output_section::add_input_section): Print section name when out
6414         of patch space.
6415         (Output_section::add_output_section_data): Likewise.
6416         (Output_section::set_final_data_size): Add patch space when
6417         doing --incremental-full.
6418         (Output_section::do_reset_address_and_file_offset): Remove patch
6419         space.
6420         (Output_segment::set_section_list_addresses): Print debug output
6421         only if --incremental-update.
6422         * output.h (Output_section::set_is_patch_space_allowed): New function.
6423         (Output_section::is_patch_space_allowed_): New data member.
6424         (Output_section::patch_space_): New data member.
6425         * parameters.cc (Parameters::incremental_full): New function.
6426         * parameters.h (Parameters::incremental_full): New function
6427         * testsuite/Makefile.am (incremental_test_2): Add test for
6428         --incremental-patch option.
6429         * testsuite/Makefile.in: Regenerate.
6430         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
6431         (t18): Remove function body.
6432
6433 2011-07-05  Doug Kwan  <dougkwan@google.com>
6434
6435         PR gold/12771
6436         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
6437         Arm_Address type for relocation result.
6438         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
6439         overflow check.
6440         (Arm_relocate_functions::abs32): Use unaligned access.
6441         (Arm_relocate_functions::rel32): Ditto.
6442         (Arm_relocate_functions::prel31): Ditto.
6443         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
6444         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
6445         static data relocations.
6446         * testsuite/Makefile.in: Regnerate.
6447         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
6448
6449 2011-07-05  Ian Lance Taylor  <iant@google.com>
6450
6451         PR gold/12392
6452         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
6453         symbols if necessary.
6454         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6455
6456 2011-07-05  Ian Lance Taylor  <iant@google.com>
6457
6458         PR gold/12952
6459         * resolve.cc (Symbol::override_base_with_special): Simply override
6460         version with special symbol version, ignoring previous version.
6461
6462 2011-07-05  Ian Lance Taylor  <iant@google.com>
6463
6464         * object.cc (Sized_relobj_file::include_section_group): Add
6465         information to comment about signature location.
6466
6467 2011-07-02  Ian Lance Taylor  <iant@google.com>
6468
6469         PR gold/12957
6470         * options.h (class General_options): Add -f and -F.
6471         * options.cc (General_options::finalize): Fatal error if -f/-F
6472         are used without -shared.
6473         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
6474
6475 2011-07-02  Ian Lance Taylor  <iant@google.com>
6476
6477         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
6478
6479 2011-07-01  Ian Lance Taylor  <iant@google.com>
6480
6481         PR gold/12525
6482         PR gold/12952
6483         * resolve.cc (Symbol::override_base_with_special): Don't override
6484         the version if the overriding symbol has a different name.
6485         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
6486         all callers.  If we give an error about an undefined version,
6487         define the base version if necessary.
6488         * dynobj.h (class Versions): Update declaration.
6489         * testsuite/weak_alias_test_5.cc: New file.
6490         * testsuite/weak_alias_test.script: New file.
6491         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
6492         and versioned_alias have the right value, and call t2.
6493         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
6494         weak_alias_test_5.so.
6495         (weak_alias_test_LDADD): Likewise.
6496         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
6497         * testsuite/Makefile.in: Rebuild.
6498
6499 2011-07-01  Ian Lance Taylor  <iant@google.com>
6500
6501         PR gold/12525
6502         * options.h (class General_options): Support -z notext.
6503         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
6504         -Wl,-z,notext.
6505         (two_file_shared_nonpic.so): Likewise.
6506         (two_file_shared_mixed.so): Likewise.
6507         (two_file_shared_mixed_1.so): Likewise.
6508         (weak_undef_lib_nonpic.so): Likewise.
6509         (alt/weak_undef_lib_nonpic.so): Likewise.
6510         (tls_test_shared_nonpic.so): Likewise.
6511         * testsuite/Makefile.in: Rebuild.
6512
6513 2011-07-01  Ian Lance Taylor  <iant@google.com>
6514
6515         PR gold/12525
6516         * configure.ac: Test whether static linking works, setting
6517         the automake conditional HAVE_STATIC.
6518         * testsuite/Makefile.am: Disable tests using -static if
6519         HAVE_STATIC is not true.
6520         * configure, testsuite/Makefile.in: Rebuild.
6521
6522 2011-07-01  Ian Lance Taylor  <iant@google.com>
6523
6524         PR gold/12525
6525         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
6526         Assert if we see DW_EH_PE_indirect.
6527         * target.h (Target::ehframe_datarel_base): New function.
6528         (Target::do_ehframe_datarel_base): New target function.
6529         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
6530         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
6531         function.
6532
6533 2011-07-01  Ian Lance Taylor  <iant@google.com>
6534
6535         PR gold/12571
6536         * options.h (class General_options): Add
6537         --ld-generated-unwind-info.
6538         * ehframe.cc (Fde::write): Add address parameter.  Change all
6539         callers.  If associated with PLT, fill in address and size.
6540         (Cie::set_output_offset): Only add merge mapping if there is an
6541         object.
6542         (Cie::write): Add address parameter.  Change all callers.
6543         (Eh_frame::add_ehframe_for_plt): New function.
6544         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
6545         input_offset_ fields into union u_, with new plt field.
6546         (Fde::Fde): Adjust for new union field.
6547         (Fde::Fde) [Output_data version]: New constructor.
6548         (Fde::add_mapping): Only add merge mapping if there is an object.
6549         (class Cie): Update declarations.
6550         (class Eh_frame): Declare add_ehframe_for_plt.
6551         * layout.cc (Layout::layout_eh_frame): Break out code into
6552         make_eh_frame_section, and call it.
6553         (Layout::make_eh_frame_section): New function.
6554         (Layout::add_eh_frame_for_plt): New function.
6555         * layout.h (class Layout): Update declarations.
6556         * merge.cc (Merge_map::add_mapping): Add assertion.
6557         * i386.cc: Include "dwarf.h".
6558         (class Output_data_plt_i386): Make first_plt_entry,
6559         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
6560         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6561         and plt_eh_frame_fde.
6562         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
6563         boundary.  Call add_eh_frame_for_plt if appropriate.
6564         * x86_64.cc: Include "dwarf.h".
6565         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
6566         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
6567         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6568         and plt_eh_frame_fde.
6569         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
6570         appropriate.
6571
6572 2011-06-29  Ian Lance Taylor  <iant@google.com>
6573
6574         PR gold/12629
6575         * object.cc (Sized_relobj_file::layout_section): Change shdr
6576         parameter to be const.
6577         (Sized_relobj_file::layout_eh_frame_section): New function, broken
6578         out of do_layout.
6579         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
6580         appropriate.  Call layout_eh_frame_section.
6581         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
6582         sections.
6583         * object.h (class Sized_relobj_file): Update declarations.
6584
6585 2011-06-29  Ian Lance Taylor  <iant@google.com>
6586
6587         PR gold/12652
6588         * script.cc (Token::integer_value): Accept trailing M/m/K/k
6589         modifier.
6590         (Lex::gather_token): Accept trailing M/m/K/k for integers.
6591
6592 2011-06-29  Ian Lance Taylor  <iant@google.com>
6593
6594         PR gold/12675
6595         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
6596         SHT_X86_64_UNWIND.
6597         * layout.cc (Layout::layout_eh_frame): Likewise.
6598
6599 2011-06-29  Ian Lance Taylor  <iant@google.com>
6600
6601         PR gold/12695
6602         * layout.cc (Layout::symtab_section_shndx): New function.
6603         * layout.h (class Layout): Declare symtab_section_shndx.
6604         * output.cc (Output_section::write_header): Call it.
6605
6606 2011-06-29  Ian Lance Taylor  <iant@google.com>
6607
6608         PR gold/12818
6609         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
6610         symbols which are not used in a relocation.
6611
6612 2011-06-28  Ian Lance Taylor  <iant@google.com>
6613
6614         PR gold/12898
6615         * layout.cc (Layout::segment_precedes): Don't crash if a linker
6616         script create indistinguishable segments.
6617         (Layout::set_segment_offsets): Use stable_sort when sorting
6618         segments.  Pass this to Compare_segments constructor.
6619         * layout.h (class Layout): Make segment_precedes non-static.
6620         (class Compare_segments): Change from struct to class.  Add
6621         layout_ field.  Add constructor.
6622         * script-sections.cc
6623         (Script_sections::attach_sections_using_phdrs_clause): Rename
6624         local orphan to is_orphan.  Don't report failure to put empty
6625         section in segment.  On attachment failure, report name of
6626         section, and attach to first PT_LOAD segment.
6627
6628 2011-06-28  Ian Lance Taylor  <iant@google.com>
6629
6630         PR gold/12934
6631         * target-select.cc (Target_selector::Target_selector): Add
6632         emulation parameter.  Change all callers.
6633         (select_target_by_bfd_name): Rename from select_target_by_name.
6634         Change all callers.
6635         (select_target_by_emulation): New function.
6636         (supported_emulation_names): New function.
6637         * target-select.h (class Target_selector): Add emulation_ field.
6638         Update declarations.
6639         (Target_selector::recognize_by_bfd_name): Rename from
6640         recognize_by_name.  Change all callers.
6641         (Target_selector::supported_bfd_names): Rename from
6642         supported_names.  Change all callers.
6643         (Target_selector::recognize_by_emulation): New function.
6644         (Target_selector::supported_emulations): New function.
6645         (Target_selector::emulation): New function.
6646         (Target_selector::do_recognize_by_bfd_name): Rename from
6647         do_recognize_by_name.  Change all callers.
6648         (Target_selector::do_supported_bfd_names): Rename from
6649         do_supported_names.  Change all callers.
6650         (Target_selector::do_recognize_by_emulation): New function.
6651         (Target_selector::do_supported_emulations): New function.
6652         (select_target_by_bfd_name): Change name in declaration.
6653         (select_target_by_emulation): Declare.
6654         (supported_emulation_names): Declare.
6655         * parameters.cc (parameters_force_valid_target): Try to find
6656         target based on emulation from -m option.
6657         * options.h (class General_options): Change doc string for -m.
6658         * options.cc (help): Print emulations.
6659         (General_options::parse_V): Likewise.
6660         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
6661         Add emulation parameter.  Change all callers.
6662
6663 2011-06-28  Ian Lance Taylor  <iant@google.com>
6664
6665         * target.h (class Target): Add osabi_ field.
6666         (Target::osabi): New function.
6667         (Target::set_osabi): New function.
6668         (Target::Target): Initialize osabi_.
6669         (Target::do_adjust_elf_header): Make pure virtual.
6670         (Sized_target::do_adjust_elf_header): Declare.
6671         * target.cc (Sized_target::do_adjust_elf_header): New function.
6672         (class Sized_target): Instantiate all versions.
6673         * freebsd.h (class Target_freebsd): Remove.
6674         (Target_selector_freebsd::do_recognize): Call set_osabi on
6675         Target.
6676         (Target_selector_freebsd::do_recognize_by_name): Likewise.
6677         (Target_selector_freebsd::set_osabi): Remove.
6678         * i386.cc (class Target_i386): Inherit from Sized_target rather
6679         than Target_freebsd.
6680         * x86_64.cc (class Target_x86_64): Likewise.
6681
6682 2011-06-28  Ian Lance Taylor  <iant@google.com>
6683
6684         * target.h (Target::can_check_for_function_pointers): Rewrite.
6685         Make non-virtual.
6686         (Target::can_icf_inline_merge_sections): Likewise.
6687         (Target::section_may_have_icf_unsafe_poineters): Likewise.
6688         (Target::Target_info): Add can_icf_inline_merge_sections field.
6689         (Target::do_can_check_for_function_pointers): New virtual
6690         function.
6691         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
6692         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
6693         from can_check_for_function_pointers, move in file.
6694         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
6695         section_may_have_icf_unsafe_poineters, move in file.
6696         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
6697         * i386.cc (Target_i386::do_can_check_for_function_pointers):
6698         Rename from can_check_for_function_pointers, move in file.
6699         (Target_i386::can_icf_inline_merge_sections): Remove.
6700         (Target_i386::i386_info): Initialize
6701         can_icf_inline_merge_sections.
6702         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6703         Initialize can_icf_inline_merge_sections.
6704         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
6705         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
6706         Rename from can_check_for_function_pointers, move in file.
6707         (Target_x86_64::can_icf_inline_merge_sections): Remove.
6708         (Target_x86_64::x86_64_info): Initialize
6709         can_icf_inline_merge_sections.
6710         * testsuite/testfile.cc (Target_test::test_target_info):
6711         Likewise.
6712         * icf.cc (get_section_contents): Correct formatting.
6713
6714 2011-06-27  Ian Lance Taylor  <iant@google.com>
6715
6716         * symtab.cc (Symbol::versioned_name): New function.
6717         (Symbol_table::add_to_final_symtab): Use versioned_name when
6718         appropriate.
6719         (Symbol_table::sized_write_symbol): Likewise.
6720         * symtab.h (class Symbol): Declare versioned_name.
6721         * stringpool.h (class Stringpool_template): Add variant of add
6722         which takes a std::basic_string.
6723         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
6724         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
6725         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
6726         (ver_test_12.o): New target.
6727         * testsuite/Makefile.in: Rebuild.
6728
6729 2011-06-27  Doug Kwan  <dougkwan@google.com>
6730
6731         * arm.cc (Arm_relocate_functions::thm_jump8,
6732         Arm_relocate_functions::thm_jump11): Use a wider signed
6733         type to compute offset.
6734         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
6735         arm_thm_jump8.
6736         * testsuite/Makefile.in: Regenerate.
6737         * testsuite/arm_branch_in_range.sh: Check test results of
6738         arm_thm_jump11 and arm_thm_jump8.
6739         * testsuite/arm_thm_jump11.s: New test source file.
6740         * testsuite/arm_thm_jump11.t: New linker script.
6741         * testsuite/arm_thm_jump8.s: New test source file.
6742         * testsuite/arm_thm_jump8.t: New linker script.
6743
6744 2011-06-24  Ian Lance Taylor  <iant@google.com>
6745
6746         * layout.cc: Include "object.h".
6747         (ctors_sections_in_init_array): New static variable.
6748         (Layout::is_ctors_in_init_array): New function.
6749         (Layout::layout): Add entry to ctors_sections_in_init_array if
6750         appropriate.
6751         * layout.h (class Layout): Declare is_ctors_in_init_array.
6752         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
6753         is_ctors_reverse_view is set.
6754         (Sized_relobj_file::write_sections): Add layout parameter.  Change
6755         all callers.  Set is_ctors_reverse_view field of View_size.
6756         (Sized_relobj_file::reverse_words): New function.
6757         * object.h (Sized_relobj_file::View_size): Add
6758         is_ctors_reverse_view field.
6759         (class Sized_relobj_file): Update declarations.
6760         * testsuite/initpri3.c: New test.
6761         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
6762         initpri3b.
6763         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
6764         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
6765         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
6766         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
6767         * testsuite/Makefile.in: Rebuild.
6768
6769 2011-06-24  Cary Coutant  <ccoutant@google.com>
6770
6771         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
6772         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
6773         (debug_msg_cdebug.err): New targets.
6774         * testsuite/Makefile.in: Regenerate.
6775         * testsuite/debug_msg.sh: Check output of link with compressed debug.
6776         Fix checks for link with shared library.
6777
6778 2011-06-24  Doug Kwan  <dougkwan@google.com>
6779
6780         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
6781         skip empty text sections.
6782         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
6783
6784 2011-06-22  Ian Lance Taylor  <iant@google.com>
6785
6786         PR gold/12910
6787         * options.h (class General_options): Add --ctors-in-init-array.
6788         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
6789         friends as SHT_PROGBITS for merging sections.
6790         (Layout::layout): Remove special handling of .init_array and
6791         friends.  Don't sort if doing relocatable link.  Sort for .ctors
6792         and .dtors if ctors_in_init_array.
6793         (Layout::make_output_section): Force correct section types for
6794         .init_array and friends.  Don't sort if doing relocatable link,
6795         Don't sort .ctors and .dtors if ctors_in_init_array.
6796         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
6797         (Layout::output_section_name): Add relobj parameter.  Change all
6798         callers.  Handle .ctors. and .dtors. in code rather than table.
6799         Handle .ctors and .dtors if ctors_in_init_array.
6800         (Layout::match_file_name): New function, moved from output.cc.
6801         * layout.h (class Layout): Update declarations.
6802         * output.cc: Include "layout.h".
6803         (Input_section_sort_entry::get_priority): New function.
6804         (Input_section_sort_entry::match_file_name): Just call
6805         Layout::match_file_name.
6806         (Output_section::Input_section_sort_init_fini_compare::operator()):
6807         Handle .ctors and .dtors.  Sort by explicit priority rather than
6808         by name.
6809         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
6810         * testsuite/initpri2.c: New test.
6811         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
6812         (check_PROGRAMS): Add initpri2.
6813         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
6814         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
6815         * configure, testsuite/Makefile.in: Rebuild.
6816
6817 2011-06-19  Ian Lance Taylor  <iant@google.com>
6818
6819         PR gold/12880
6820         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
6821         .interp section to a PT_INTERP segment even if we have seen a
6822         --dynamic-linker option.  Don't do it if we have seen a PHDRS
6823         clause in a linker script.
6824         (Layout::finalize): Don't create a .interp section if we've
6825         already create a PT_INTERP segment.
6826         (Layout::create_interp): Always call choose_output_section (revert
6827         patch of 2011-06-17).  Don't create PT_INTERP segment.
6828         * script-sections.cc
6829         (Script_sections::create_note_and_tls_segments): Add a .interp
6830         section to a PT_INTERP segment even if we have seen a
6831         --dynamic-linker option.
6832
6833 2011-06-18  Ian Lance Taylor  <iant@google.com>
6834
6835         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
6836         merely because a non-PT_LOAD segment has a dynamic reloc.
6837
6838 2011-06-18  Ian Lance Taylor  <iant@google.com>
6839
6840         * layout.cc (Layout::finish_dynamic_section): Don't create
6841         DT_FLAGS entry if not needed.
6842
6843 2011-06-18  Ian Lance Taylor  <iant@google.com>
6844
6845         PR gold/12745
6846         * layout.cc (Layout::layout_eh_frame): Correct handling of
6847         writable .eh_frame section.
6848
6849 2011-06-17  Ian Lance Taylor  <iant@google.com>
6850
6851         PR gold/12893
6852         * resolve.cc (Symbol_table::resolve): Don't give an error if a
6853         symbol is redefined with the exact same object and value.
6854
6855 2011-06-17  Ian Lance Taylor  <iant@google.com>
6856
6857         PR gold/12880
6858         * layout.h (class Layout): Add interp_segment_ field.
6859         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
6860         (Layout::attach_allocated_section_to_segment): If making shared
6861         library, put .interp section in PT_INTERP segment.
6862         (Layout::finalize): Also call create_interp if -dynamic-linker
6863         option was used.
6864         (Layout::create_interp): Assert that there is no PT_INTERP
6865         segment.  If not using a SECTIONS clause, use make_output_section.
6866         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
6867         * script-sections.cc
6868         (Script_sections::create_note_and_tls_segments): If making shared
6869         library, put .interp section in PT_INTERP segment.
6870
6871 2011-06-17  Ian Lance Taylor  <iant@google.com>
6872
6873         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
6874         when making a shared library.
6875
6876 2011-06-17  Ian Lance Taylor  <iant@google.com>
6877
6878         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
6879         parameter.  Change all callers.  Don't issue warning about PC32
6880         against locally defined symbol.
6881
6882 2011-06-16  Ian Lance Taylor  <iant@google.com>
6883
6884         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
6885         occurs in same object.
6886
6887 2011-06-14  Alan Modra  <amodra@gmail.com>
6888
6889         * po/POTFILES.in: Regenerate.
6890
6891 2011-06-09  Ian Lance Taylor  <iant@google.com>
6892
6893         * script-sections.cc
6894         (Orphan_output_section::set_section_addresses): For a relocatable
6895         link set address to 0.
6896
6897 2011-06-09  Cary Coutant  <ccoutant@google.com>
6898
6899         PR gold/12804
6900         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
6901         used with --compress-debug-sections.
6902         * gold/object.cc (Sized_relobj_file::do_layout): Report
6903         uncompressed size of compressed input sections.
6904
6905 2011-06-08  Cary Coutant  <ccoutant@google.com>
6906
6907         PR gold/12804
6908         * testsuite/two_file_test_2_v1.cc: Change initialization of
6909         v2 to keep it in .data.
6910
6911 2011-06-07  Cary Coutant  <ccoutant@google.com>
6912
6913         * common.cc (Symbol_table::do_allocate_commons_list): Call
6914         gold_fallback.
6915         * errors.cc (Errors::fatal): Adjust call to gold_exit.
6916         (Errors::fallback): New function.
6917         (gold_fallback): New function.
6918         * errors.h (Errors::fallback): New function.
6919         * gold.cc (gold_exit): Change status parameter to enum; adjust
6920         all callers.
6921         (queue_initial_tasks): Call gold_fallback.
6922         * gold.h: Include cstdlib.
6923         (Exit_status): New enum type.
6924         (gold_exit): Change status parameter to enum.
6925         (gold_fallback): New function.
6926         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
6927         (Layout::create_symtab_sections): Likewise.
6928         (Layout::create_shdrs): Likewise.
6929         * main.cc (main): Adjust call to gold_exit.
6930         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
6931         (Output_data_got::add_got_entry_pair): Likewise.
6932         (Output_section::add_input_section): Likewise.
6933         (Output_section::add_output_section_data): Likewise.
6934         (Output_segment::set_section_list_addresses): Likewise.
6935         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
6936
6937 2011-06-07  Cary Coutant  <ccoutant@google.com>
6938
6939         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
6940         for incremental links.
6941         * output.cc (Output_segment::set_section_list_addresses): Remove
6942         FIXME and test for TLS or BSS.
6943
6944 2011-06-07  Cary Coutant  <ccoutant@google.com>
6945
6946         * testsuite/Makefile.am: Add incremental_copy_test,
6947         incremental_common_test_1.
6948         * testsuite/Makefile.in: Regenerate.
6949         * testsuite/common_test_1_v1.c: New source file.
6950         * testsuite/common_test_1_v2.c: New source file.
6951         * testsuite/copy_test_v1.cc: New source file.
6952
6953 2011-06-07  Cary Coutant  <ccoutant@google.com>
6954
6955         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
6956         update, allocate common from bss section's free list.
6957         * incremental-dump.cc (dump_incremental_inputs): Print flag for
6958         linker-defined symbols.
6959         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
6960         Skip GOT and PLT entries that are no longer referenced.
6961         (Output_section_incremental_inputs::write_info_blocks): Mark
6962         linker-defined symbols.
6963         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
6964         * output.cc (Output_section::allocate): New function.
6965         * output.h (Output_section::allocate): New function.
6966         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
6967         linker-defined symbols.
6968         (Symbol::override_base_with_special): Copy is_predefined_ flag.
6969         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
6970         (Symbol::init_base_output_data): Likewise.
6971         (Symbol::init_base_output_segment): Likewise.
6972         (Symbol::init_base_constant): Likewise.
6973         (Sized_symbol::init_output_data): Likewise.
6974         (Sized_symbol::init_output_segment): Likewise.
6975         (Sized_symbol::init_constant): Likewise.
6976         (Symbol_table::do_define_in_output_data): Likewise.
6977         (Symbol_table::do_define_in_output_segment): Likewise.
6978         (Symbol_table::do_define_as_constant): Likewise.
6979         * symtab.h (Symbol::is_predefined): New function.
6980         (Symbol::init_base_output_data): Add is_predefined parameter.
6981         (Symbol::init_base_output_segment): Likewise.
6982         (Symbol::init_base_constant): Likewise.
6983         (Symbol::is_predefined_): New data member.
6984         (Sized_symbol::init_output_data): Add is_predefined parameter.
6985         (Sized_symbol::init_output_segment): Likewise.
6986         (Sized_symbol::init_constant): Likewise.
6987         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
6988
6989 2011-06-07  Cary Coutant  <ccoutant@google.com>
6990
6991         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
6992         instead of emit_copy_reloc.
6993         (Copy_relocs::emit_copy_reloc): Refactor.
6994         (Copy_relocs::make_copy_reloc): New function.
6995         (Copy_relocs::add_copy_reloc): Remove.
6996         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
6997         section.
6998         (Copy_relocs::make_copy_reloc): New function.
6999         (Copy_relocs::add_copy_reloc): Remove.
7000         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
7001         unchanged input files.
7002         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
7003         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
7004         Reserve BSS space for COPY relocations.
7005         (Sized_incremental_binary::do_emit_copy_relocs): New function.
7006         (Output_section_incremental_inputs::write_info_blocks): Record
7007         whether a symbol is copied from a shared object.
7008         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
7009         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
7010         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
7011         (Incremental_input_entry_reader::get_output_symbol_index): Add
7012         is_copy parameter.
7013         (Incremental_binary::emit_copy_relocs): New function.
7014         (Incremental_binary::do_emit_copy_relocs): New function.
7015         (Sized_incremental_binary::Sized_incremental_binary): Initialize
7016         new data member.
7017         (Sized_incremental_binary::add_copy_reloc): New function.
7018         (Sized_incremental_binary::do_emit_copy_relocs): New function.
7019         (Sized_incremental_binary::Copy_reloc): New struct.
7020         (Sized_incremental_binary::Copy_relocs): New typedef.
7021         (Sized_incremental_binary::copy_relocs_): New data member.
7022         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
7023         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
7024         * target.h (Sized_target::emit_copy_reloc): New function.
7025         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
7026
7027 2011-06-02  Cary Coutant  <ccoutant@google.com>
7028
7029         PR gold/12163
7030         * gold/archive.cc (Archive::Archive): Initialize new data member.
7031         (Archive::include_all_members): Return if archive has already been
7032         included.
7033         * gold/archive.h (Archive::include_all_members_): New data member.
7034
7035 2011-06-02  Nick Clifton  <nickc@redhat.com>
7036
7037         * dynobj.h: Fix spelling mistake in comment.
7038         * output.cc: Likewise.
7039
7040 2011-05-31  Doug Kwan  <dougkwan@google.com>
7041             Asier Llano
7042
7043         PR gold/12826
7044         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
7045         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
7046         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
7047         redundant arm_exidx_test.so.
7048         * testsuite/Makefile.in: Regenerate.
7049         (check_SCRIPTS): Add pr12826.sh
7050         (check_DATA): Add pr12826.stdout
7051         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
7052         * testsuite/pr12826.sh: New file.
7053         * testsuite/pr12826_1.s: Ditto.
7054         * testsuite/pr12826_1.s: Ditto.
7055
7056 2011-05-30  Ian Lance Taylor  <iant@google.com>
7057
7058         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
7059         sections.
7060
7061 2011-05-29  Ian Lance Taylor  <iant@google.com>
7062
7063         PR gold/12804
7064         * testsuite/Makefile.am: Use different file name for two_file_test
7065         temporary file for each incremental test.
7066         * testsuite/Makefile.in: Rebuild.
7067
7068 2011-05-29  Ian Lance Taylor  <iant@google.com>
7069
7070         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
7071         binary input file is empty.
7072
7073 2011-05-27  Ian Lance Taylor  <iant@google.com>
7074
7075         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
7076         (ver_test_9.so): Likewise.
7077         * testsuite/Makefile.in: Rebuild.
7078
7079 2011-05-26 Cary Coutant  <ccoutant@google.com>
7080
7081         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
7082         * incremental.cc (Incremental_inputs::report_input_section): Fix
7083         comment, indentation.
7084         (Incremental_inputs::report_comdat_group): New function.
7085         (Output_section_incremental_inputs::set_final_data_size): Adjust size
7086         of data for incremental input file entry.
7087         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
7088         group count, COMDAT group signatures.
7089         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
7090         an unchanged input file.
7091         * incremental.h (Incremental_object_entry::Incremental_object_entry):
7092         Initialize new data member.
7093         (Incremental_object_entry::add_comdat_group): New function.
7094         (Incremental_object_entry::get_comdat_group_count): New function.
7095         (Incremental_object_entry::get_comdat_signature_key): New function.
7096         (Incremental_object_entry::groups_): New data member.
7097         (Incremental_inputs::report_comdat_group): New function.
7098         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
7099         data for incremental input file entry.
7100         (Incremental_input_entry_reader::get_comdat_group_count): New function.
7101         (Incremental_input_entry_reader::get_input_section): Adjust size of
7102         data for incremental input file entry.
7103         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
7104         (Incremental_input_entry_reader::get_comdat_group_signature): New
7105         function.
7106         * object.cc (Sized_relobj::include_section_group): Report kept
7107         COMDAT groups for incremental links.
7108
7109 2011-05-24  David Meyer  <pdox@google.com>
7110
7111         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
7112         with name parameter.  Add found_name parameter.
7113         * fileread.cc (Input_file::find_file): Adjust code accordingly.
7114         * dirsearch.h (class Dirsearch): Update declaration.
7115
7116 2011-05-24  Ian Lance Taylor  <iant@google.com>
7117
7118         * archive.cc (Library_base::should_include_member): Pull in object
7119         from archive if it defines the entry symbol.
7120         * parameters.cc (Parameters::entry): New function.
7121         * parameters.h (class Parameters): Declare entry.
7122         * output.h (class Output_file_header): Remove entry_ field.
7123         * output.cc (Output_file_header::Output_file_header): Remove entry
7124         parameter.  Change all callers.
7125         (Output_file_header::entry): Use parameters->entry.
7126         * gold.cc (queue_middle_tasks): Likewise.
7127         * plugin.cc (Plugin_hook::run): Likewise.
7128
7129 2011-05-24 Cary Coutant  <ccoutant@google.com>
7130
7131         * gold.cc (queue_initial_tasks): Pass incremental base filename
7132         to Output_file::open_base_file; don't print error message.
7133         * incremental-dump.cc (main): Adjust call to
7134         Output_file::open_for_modification.
7135         * incremental-dump.cc (main): Likewise.
7136         * incremental.cc (Incremental_inputs::report_command_line):
7137         Ignore --incremental-base option when comparing command lines.
7138         Ignore parameter when given as separate argument.
7139         * options.h (class General_options): Add --incremental-base.
7140         * output.cc (Output_file::Output_file):
7141         (Output_file::open_base_file): Add base_name and writable parameters;
7142         read base file into new file; print error message here.
7143         (Output_file::map_no_anonymous): Add writable parameter; adjust all
7144         callers.
7145         * output.h (Output_file::open_for_modification): Rename to...
7146         (Output_file::open_base_file): ...this; add base_name and
7147         writable parameters; adjust all callers.
7148         (Output_file::map_no_anonymous): Add writable parameter; adjust all
7149         callers.
7150         * testsuite/Makefile.am (incremental_test_4): Test
7151         --incremental-base.
7152         * testsuite/Makefile.in: Regenerate.
7153
7154 2011-05-24 Cary Coutant  <ccoutant@google.com>
7155
7156         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
7157         incremental_test_4.
7158         * testsuite/Makefile.in: Regenerate.
7159         * testsuite/two_file_test_1_v1.cc: New test source file.
7160         * testsuite/two_file_test_1b_v1.cc: New test source file.
7161         * testsuite/two_file_test_2_v1.cc: New test source file.
7162
7163 2011-05-24 Cary Coutant  <ccoutant@google.com>
7164
7165         * dynobj.h (Dynobj::do_dynobj): New function.
7166         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
7167         flag and soname for shared objects.
7168         * incremental.cc (Incremental_inputs::report_object): Make
7169         either Incremental_object_entry or Incremental_dynobj_entry; add
7170         soname to string table.
7171         (Incremental_inputs::report_input_section): Add assertion.
7172         (Output_section_incremental_inputs::set_final_data_size): Adjust
7173         type of input file entry for shared libraries; adjust size of
7174         shared library info entry.
7175         (Output_section_incremental_inputs::write_input_files): Write
7176         as_needed flag for shared libraries.
7177         (Output_section_incremental_inputs::write_info_blocks): Adjust type
7178         of input file entry for shared libraries; write soname.
7179         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
7180         soname from incremental info.
7181         * incremental.h (enum Incremental_input_flags): Add
7182         INCREMENTAL_INPUT_AS_NEEDED.
7183         (Incremental_input_entry::Incremental_input_entry): Initialize new
7184         data member.
7185         (Incremental_input_entry::set_as_needed): New function.
7186         (Incremental_input_entry::as_needed): New function.
7187         (Incremental_input_entry::do_dynobj_entry): New function.
7188         (Incremental_input_entry::as_needed_): New data member.
7189         (Incremental_object_entry::Incremental_object_entry): Don't check
7190         for shared library.
7191         (Incremental_object_entry::do_type): Likewise.
7192         (class Incremental_dynobj_entry): New class.
7193         (Incremental_input_entry_reader::as_needed): New function.
7194         (Incremental_input_entry_reader::get_soname): New function.
7195         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
7196         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
7197         size of shared library info entry.
7198         * layout.cc (Layout::finish_dynamic_section): Don't test for
7199         incremental link when adding DT_NEEDED entries.
7200         * object.h (Object::Object): Initialize new data member.
7201         (Object::dynobj): New function.
7202         (Object::set_as_needed): New function.
7203         (Object::as_needed): New function.
7204         (Object::do_dynobj): New function.
7205         (Object::as_needed_): New data member.
7206
7207 2011-05-24 Cary Coutant  <ccoutant@google.com>
7208
7209         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
7210         info; adjust display of GOT entries.
7211         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7212         vector of input objects; remove file_status_.
7213         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
7214         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
7215         got_plt reader; call target hooks to reserve GOT entries.
7216         (Output_section_incremental_inputs::set_final_data_size): Adjust size
7217         of input file info header and GOT info entry.
7218         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
7219         relocation info.
7220         (Got_plt_view_info::got_descriptor): Remove.
7221         (Got_plt_view_info::sym_index): New data member.
7222         (Got_plt_view_info::input_index): New data member.
7223         (Local_got_offset_visitor::visit): Write input file index.
7224         (Global_got_offset_visitor::visit): Write 0 for input file index.
7225         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
7226         with sym_index and input_index.
7227         (Output_section_incremental_inputs::write_got_plt): Adjust size of
7228         incremental info GOT entry; replace got_descriptor with input_index.
7229         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
7230         map from input file index to object.
7231         (Sized_relobj_incr::do_layout): Replace direct data member reference
7232         with accessor function.
7233         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
7234         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
7235         Adjust size of input file info header.
7236         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
7237         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
7238         (Incremental_input_entry_reader::get_input_section): Adjust size of
7239         input file info header.
7240         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
7241         of incremental info GOT entry.
7242         (Incremental_got_plt_reader::get_got_desc): Remove.
7243         (Incremental_got_plt_reader::get_got_symndx): New function.
7244         (Incremental_got_plt_reader::get_got_input_index): New function.
7245         (Sized_incremental_binary::Sized_incremental_binary): Remove
7246         file_status_; add input_objects_.
7247         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
7248         (Sized_incremental_binary::set_file_is_unchanged): Remove.
7249         (Sized_incremental_binary::file_is_unchanged): Remove.
7250         (Sized_incremental_binary::set_input_object): New function.
7251         (Sized_incremental_binary::input_object): New function.
7252         (Sized_incremental_binary::file_status_): Remove.
7253         (Sized_incremental_binary::input_objects_): New data member.
7254         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
7255         references.
7256         (Sized_relobj_incr::invalid_address): Move to base class.
7257         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
7258         class.
7259         (Sized_relobj_incr::do_output_section_offset): Likewise.
7260         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
7261         (Sized_relobj_incr::section_offsets_): Likewise.
7262         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
7263         function.
7264         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
7265         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
7266         with accessor function.
7267         (Sized_relobj_file::do_layout): Likewise.
7268         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
7269         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
7270         (Sized_relobj_file::compute_final_local_value): Replace refs to
7271         section_offsets_ with accessor function.
7272         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
7273         * object.h (Relobj::Relobj): Initialize new data members.
7274         (Relobj::add_dyn_reloc): New function.
7275         (Relobj::first_dyn_reloc): New function.
7276         (Relobj::dyn_reloc_count): New function.
7277         (Relobj::first_dyn_reloc_): New data member.
7278         (Relobj::dyn_reloc_count_): New data member.
7279         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
7280         references.
7281         (Sized_relobj::Address): New typedef.
7282         (Sized_relobj::invalid_address): Move here from child class.
7283         (Sized_relobj::Sized_relobj): Initialize new data members.
7284         (Sized_relobj::sized_relobj): New function.
7285         (Sized_relobj::is_output_section_offset_invalid): Move here from
7286         child class.
7287         (Sized_relobj::get_output_section_offset): Likewise.
7288         (Sized_relobj::local_has_got_offset): Likewise.
7289         (Sized_relobj::local_got_offset): Likewise.
7290         (Sized_relobj::set_local_got_offset): Likewise.
7291         (Sized_relobj::do_for_all_local_got_entries): Likewise.
7292         (Sized_relobj::clear_got_offsets): New function.
7293         (Sized_relobj::section_offsets): Move here from child class.
7294         (Sized_relobj::do_output_section_offset): Likewise.
7295         (Sized_relobj::do_set_section_offset): Likewise.
7296         (Sized_relobj::Local_got_offsets): Likewise.
7297         (Sized_relobj::local_got_offsets_): Likewise.
7298         (Sized_relobj::section_offsets_): Likewise.
7299         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
7300         references.
7301         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
7302         class.
7303         (Sized_relobj_file::sized_relobj): New function
7304         (Sized_relobj_file::local_has_got_offset): Move to base class.
7305         (Sized_relobj_file::local_got_offset): Likewise.
7306         (Sized_relobj_file::set_local_got_offset): Likewise.
7307         (Sized_relobj_file::get_output_section_offset): Likewise.
7308         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
7309         (Sized_relobj_file::do_output_section_offset): Likewise.
7310         (Sized_relobj_file::do_set_section_offset): Likewise.
7311         (Sized_relobj_file::Local_got_offsets): Likewise.
7312         (Sized_relobj_file::local_got_offsets_): Likewise.
7313         (Sized_relobj_file::section_offsets_): Likewise.
7314         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
7315         (all constructors).
7316         (set_needs_dynsym_index): Convert relobj to derived class pointer.
7317         (Output_reloc::get_symbol_index): Likewise.
7318         (Output_reloc::local_section_offset): Likewise.
7319         (Output_reloc::get_address): Likewise.
7320         (Output_reloc::symbol_value): Likewise.
7321         (Output_data_got::reserve_slot): Move to class definition.
7322         (Output_data_got::reserve_local): New function.
7323         (Output_data_got::reserve_slot_for_global): Remove.
7324         (Output_data_got::reserve_global): New function.
7325         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
7326         (all constructors, two instantiations).
7327         (Output_reloc::get_relobj): New function (two instantiations).
7328         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
7329         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
7330         (Output_data_reloc::add_global): Adjust type of relobj.
7331         (Output_data_reloc::add_global_relative): Likewise.
7332         (Output_data_reloc::add_symbolless_global_addend): Likewise.
7333         (Output_data_reloc::add_local): Likewise.
7334         (Output_data_reloc::add_local_relative): Likewise.
7335         (Output_data_reloc::add_symbolless_local_addend): Likewise.
7336         (Output_data_reloc::add_local_section): Likewise.
7337         (Output_data_reloc::add_output_section): Likewise.
7338         (Output_data_reloc::add_absolute): Likewise.
7339         (Output_data_reloc::add_target_specific): Likewise.
7340         (Output_data_got::reserve_slot): Move definition here.
7341         (Output_data_got::reserve_local): New function.
7342         (Output_data_got::reserve_global): New function.
7343         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
7344         section_offsets_ with accessor function.
7345         (Sized_relobj_file::write_sections): Likewise.
7346         (Sized_relobj_file::do_relocate_sections): Likewise.
7347         * target.h (Sized_target::reserve_local_got_entry): New function.
7348         (Sized_target::reserve_global_got_entry): New function.
7349         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
7350         (Target_x86_64::reserve_global_got_entry): New function.
7351         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
7352
7353 2011-05-23 Cary Coutant  <ccoutant@google.com>
7354
7355         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
7356         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
7357         bit when checking got_type.
7358         * incremental.cc (Sized_incremental_binary::setup_readers):
7359         Store symbol table and string table locations; initialize bit vector
7360         of file status flags.
7361         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
7362         unchanged files.
7363         (Sized_incremental_binary::do_process_got_plt): New function.
7364         (Sized_incremental_binary::get_symtab_view): Use stored locations.
7365         (Output_section_incremental_inputs::set_final_data_size): Record
7366         file index for each input file.
7367         (Output_section_incremental_inputs::write_got_plt): Store file index
7368         instead of input entry offset for each GOT entry.
7369         * incremental.h
7370         (Incremental_input_entry::Incremental_input_entry): Initialize new
7371         data member.
7372         (Incremental_input_entry::set_offset): Store file index.
7373         (Incremental_input_entry::get_file_index): New function.
7374         (Incremental_input_entry::file_index_): New data member.
7375         (Incremental_binary::process_got_plt): New function.
7376         (Incremental_binary::do_process_got_plt): New function.
7377         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7378         data members.
7379         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
7380         (Sized_incremental_binary::set_file_is_unchanged): New function.
7381         (Sized_incremental_binary::file_is_unchanged): New function.
7382         (Sized_incremental_binary::do_process_got_plt): New function.
7383         (Sized_incremental_binary::file_status_): New data member.
7384         (Sized_incremental_binary::main_symtab_loc_): New data member.
7385         (Sized_incremental_binary::main_strtab_loc_): New data member.
7386         * output.cc (Output_data_got::Got_entry::write): Add case
7387         RESERVED_CODE.
7388         (Output_data_got::add_global): Call add_got_entry.
7389         (Output_data_got::add_global_plt): Likewise.
7390         (Output_data_got::add_global_with_rel): Likewise.
7391         (Output_data_got::add_global_with_rela): Likewise.
7392         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
7393         (Output_data_got::add_global_pair_with_rela): Likewise.
7394         (Output_data_got::add_local): Call add_got_entry.
7395         (Output_data_got::add_local_plt): Likewise.
7396         (Output_data_got::add_local_with_rel): Likewise.
7397         (Output_data_got::add_local_with_rela): Likewise.
7398         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
7399         (Output_data_got::add_local_pair_with_rela): Likewise.
7400         (Output_data_got::reserve_slot): New function.
7401         (Output_data_got::reserve_slot_for_global): New function.
7402         (Output_data_got::add_got_entry): New function.
7403         (Output_data_got::add_got_entry_pair): New function.
7404         (Output_section::add_output_section_data): Edit FIXME.
7405         * output.h
7406         (Output_section_data_build::Output_section_data_build): New
7407         constructor with size parameter.
7408         (Output_data_space::Output_data_space): Likewise.
7409         (Output_data_got::Output_data_got): Initialize new data member; new
7410         constructor with size parameter.
7411         (Output_data_got::add_constant): Call add_got_entry.
7412         (Output_data_got::reserve_slot): New function.
7413         (Output_data_got::reserve_slot_for_global): New function.
7414         (class Output_data_got::Got_entry): Add RESERVED_CODE.
7415         (Output_data_got::add_got_entry): New function.
7416         (Output_data_got::add_got_entry_pair): New function.
7417         (Output_data_got::free_list_): New data member.
7418         * target.h (Sized_target::init_got_plt_for_update): New function.
7419         (Sized_target::register_global_plt_entry): New function.
7420         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
7421         Initialize new data member; call init; add constructor with PLT count.
7422         (Output_data_plt_x86_64::init): New function.
7423         (Output_data_plt_x86_64::add_relocation): New function.
7424         (Output_data_plt_x86_64::reserve_slot): New function.
7425         (Output_data_plt_x86_64::free_list_): New data member.
7426         (Target_x86_64::init_got_plt_for_update): New function.
7427         (Target_x86_64::register_global_plt_entry): New function.
7428         (Output_data_plt_x86_64::add_entry): Allocate from free list for
7429         incremental updates.
7430         (Output_data_plt_x86_64::add_relocation): New function.
7431         * testsuite/object_unittest.cc (Object_test): Set default options.
7432
7433 2011-05-16  Ian Lance Taylor  <iant@google.com>
7434
7435         * options.h (class General_options): Make -i a synonym for -r.
7436
7437 2011-05-16  Ian Lance Taylor  <iant@google.com>
7438
7439         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
7440
7441 2011-05-10 Cary Coutant  <ccoutant@google.com>
7442
7443         * object.cc (Sized_relobj::do_count_local_symbols): Check for
7444         strip_all (-s).
7445
7446 2011-05-06  Ian Lance Taylor  <iant@google.com>
7447
7448         * layout.cc (Layout::layout): If the output section flags change,
7449         update the ordering.
7450
7451 2011-04-25 Cary Coutant  <ccoutant@google.com>
7452
7453         * incremental-dump.cc (dump_incremental_inputs): Print local
7454         symbol info for each input file.
7455         * incremental.cc
7456         (Output_section_incremental_inputs::set_final_data_size): Add local
7457         symbol info to input file entries in incremental info.
7458         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7459         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
7460         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
7461         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
7462         implementation.
7463         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
7464         (Sized_incr_relobj::do_relocate): Write the local symbols.
7465         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
7466         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
7467         Adjust size of input file header.
7468         (Incremental_inputs_reader::get_local_symbol_offset): New function.
7469         (Incremental_inputs_reader::get_local_symbol_count): New function.
7470         (Incremental_inputs_reader::get_input_section): Adjust size of input
7471         file header.
7472         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
7473         (Sized_incr_relobj::This): New typedef.
7474         (Sized_incr_relobj::sym_size): New const data member.
7475         (Sized_incr_relobj::Local_symbol): New struct.
7476         (Sized_incr_relobj::do_output_local_symbol_count): New function.
7477         (Sized_incr_relobj::do_local_symbol_offset): New function.
7478         (Sized_incr_relobj::local_symbol_count_): New data member.
7479         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
7480         (Sized_incr_relobj::local_symbol_index_): New data member.
7481         (Sized_incr_relobj::local_symbol_offset_): New data member.
7482         (Sized_incr_relobj::local_dynsym_offset_): New data member.
7483         (Sized_incr_relobj::local_symbols_): New data member.
7484         * object.h (Relobj::output_local_symbol_count): New function.
7485         (Relobj::local_symbol_offset): New function.
7486         (Relobj::do_output_local_symbol_count): New function.
7487         (Relobj::do_local_symbol_offset): New function.
7488         (Sized_relobj::do_output_local_symbol_count): New function.
7489         (Sized_relobj::do_local_symbol_offset): New function.
7490
7491 2011-04-22  Vladimir Simonov  <sv@sw.ru>
7492
7493         * descriptors.cc (set_close_on_exec): New function.
7494         (Descriptors::open): Use set_close_on_exec.
7495         * output.cc (S_ISLNK): Define if not defined.
7496
7497 2011-04-22 Cary Coutant  <ccoutant@google.com>
7498
7499         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7500         global symbol map.
7501         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7502         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
7503         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
7504         relocations.
7505         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
7506         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
7507         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
7508         * incremental.h
7509         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
7510         function.
7511         (Incremental_binary::apply_incremental_relocs): New function.
7512         (Incremental_binary::do_apply_incremental_relocs): New function.
7513         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7514         data member.
7515         (Sized_incremental_binary::add_global_symbol): New function.
7516         (Sized_incremental_binary::global_symbol): New function.
7517         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7518         (Sized_incremental_binary::symbol_map_): New data member.
7519         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
7520         * target.h (Sized_target::apply_relocation): New function.
7521         * target-reloc.h (apply_relocation): New function.
7522         * x86_64.cc (Target_x86_64::apply_relocation): New function.
7523
7524 2011-04-22  Doug Kwan  <dougkwan@google.com>
7525
7526         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
7527         flag of a SHT_ARM_EXIDX section.
7528         * testsuite/Makefile.am (arm_exidx_test): New test rules.
7529         * testsuite/Makefile.in: Regenerate.
7530         * testsuite/arm_exidx_test.s: New file.
7531         * testsuite/arm_exidx_test.sh: Same.
7532
7533 2011-04-20 Cary Coutant  <ccoutant@google.com>
7534
7535         PR gold/12689
7536         * archive.h (Incremental_archive_entry::Archive_member):
7537         Initialize arg_serial_ (second constructor).
7538
7539 2011-04-17  Ian Lance Taylor  <iant@google.com>
7540
7541         * object.cc (Relocate_info::location): Simplify location string.
7542         * errors.cc (Errors::error_at_location): Don't print program
7543         name.
7544         (Errors::warning_at_location): Likewise.
7545         (Errors::undefined_symbol): Likewise.
7546         * testsuite/debug_msg.sh: Update accordingly.
7547
7548 2011-04-14 Cary Coutant  <ccoutant@google.com>
7549
7550         * gold/layout.cc (Layout::symtab_section_offset): New function.
7551         * gold/layout.h (Layout::symtab_section_offset): New function.
7552         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
7553
7554 2011-04-12  Ian Lance Taylor  <iant@google.com>
7555
7556         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
7557         with MREMAP_MAYMOVE.
7558         * output.h (class Output_file): Add map_is_allocated_ field.
7559         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
7560         not available, provide stubs.  If mremap is not available, #define
7561         it to gold_mremap.
7562         (MREMAP_MAYMOVE): Define if not defined.
7563         (Output_file::Output_file): Initialize map_is_allocated_.
7564         (Output_file::resize): Check map_is_allocated_.
7565         (Output_file::map_anonymous): If mmap fails, use malloc.
7566         (Output_file::unmap): Don't do anything for an anonymous map.
7567         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
7568         is not available, provide stubs.
7569         (File_read::View::~View): Use free rather than delete[].
7570         (File_read::make_view): Use malloc rather than new[].  If mmap
7571         fails, use malloc.
7572         (File_read::find_or_make_view): Use malloc rather than new[].
7573         * gold.h: Remove HAVE_REMAP code.
7574         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
7575         exists.  Rename mremap to gold_mremap.  If mmap is not available
7576         don't do anything.
7577         * configure, config.in: Rebuild.
7578
7579 2011-04-11  Ian Lance Taylor  <iant@google.com>
7580
7581         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
7582         initialize local variable v.
7583
7584 2011-04-11  Cary Coutant  <ccoutant@google.com>
7585
7586         * archive.cc (Archive::include_member): Adjust call to
7587         report_object.
7588         (Add_archive_symbols::run): Track argument serial numbers.
7589         (Lib_group::include_member): Likewise.
7590         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
7591         * archive.h (Incremental_archive_entry::Archive_member):
7592         Initialize arg_serial_.
7593         (Archive_member::arg_serial_): New data member.
7594         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
7595         (Sized_dynobj::do_add_symbols): Track symbols when doing an
7596         incremental link.
7597         (Sized_dynobj::do_for_all_local_got_entries): New function.
7598         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
7599         function.
7600         * fileread.cc (get_mtime): New function.
7601         * fileread.h (get_mtime): New function.
7602         * gold.cc (queue_initial_tasks): Check for incremental update.
7603         (process_incremental_input): New function.
7604         (queue_middle_tasks): Don't force valid target for incremental
7605         update.
7606         * incremental-dump.cc (find_input_containing_global): Adjust
7607         size of symbol info entry.
7608         (dump_incremental_inputs): Dump argument serial number and
7609         in_system_directory flag; bias shndx by 1; print symbol names
7610         when dumping per-file symbol lists; use new symbol info readers.
7611         * incremental.cc
7612         (Output_section_incremental_inputs:update_data_size): New function.
7613         (Sized_incremental_binary::setup_readers): Setup input readers
7614         for each input file; build maps for files added from libraries
7615         and scripts.
7616         (Sized_incremental_binary::check_input_args): New function.
7617         (Sized_incremental_binary::do_check_inputs): Build map of argument
7618         serial numbers to input arguments.
7619         (Sized_incremental_binary::do_file_has_changed): Rename
7620         do_file_is_unchanged to this; compare file modification times.
7621         (Sized_incremental_binary::do_init_layout): New function.
7622         (Sized_incremental_binary::do_reserve_layout): New function.
7623         (Sized_incremental_binary::do_get_input_reader): Remove.
7624         (Sized_incremental_binary::get_symtab_view): New function.
7625         (Incremental_checker::can_incrementally_link_output_file): Remove.
7626         (Incremental_inputs::report_command_line): Exclude --debug options.
7627         (Incremental_inputs::report_archive_begin): Add parameter; track
7628         argument serial numbers; don't put input file entry for archive
7629         before archive members.
7630         (Incremental_inputs::report_archive_end): Put input file entry
7631         for archive after archive members.
7632         (Incremental_inputs::report_object): Add parameter; track argument
7633         serial numbers and in_system_directory flag.
7634         (Incremental_inputs::report_script): Add parameter; track argument
7635         serial numbers.
7636         (Output_section_incremental_inputs::set_final_data_size): Adjust
7637         size of symbol info entry; check for forwarding symbols.
7638         (Output_section_incremental_inputs::write_input_files): Write
7639         in_system_directory flag and argument serial number.
7640         (Output_section_incremental_inputs::write_info_blocks): Map section
7641         indices between incremental info and original input file; store
7642         input section index for each symbol.
7643         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
7644         change operator() to visit().
7645         (class Global_got_offset_visitor): Likewise.
7646         (class Global_symbol_visitor_got_plt):
7647         (Output_section_incremental_inputs::write_got_plt): Use new visitor
7648         classes.
7649         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
7650         (Sized_incr_relobj::do_read_symbols): New function.
7651         (Sized_incr_relobj::do_layout): New function.
7652         (Sized_incr_relobj::do_layout_deferred_sections): New function.
7653         (Sized_incr_relobj::do_add_symbols): New function.
7654         (Sized_incr_relobj::do_should_include_member): New function.
7655         (Sized_incr_relobj::do_for_all_global_symbols): New function.
7656         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
7657         (Sized_incr_relobj::do_section_size): New function.
7658         (Sized_incr_relobj::do_section_name): New function.
7659         (Sized_incr_relobj::do_section_contents): New function.
7660         (Sized_incr_relobj::do_section_flags): New function.
7661         (Sized_incr_relobj::do_section_entsize): New function.
7662         (Sized_incr_relobj::do_section_address): New function.
7663         (Sized_incr_relobj::do_section_type): New function.
7664         (Sized_incr_relobj::do_section_link): New function.
7665         (Sized_incr_relobj::do_section_info): New function.
7666         (Sized_incr_relobj::do_section_addralign): New function.
7667         (Sized_incr_relobj::do_initialize_xindex): New function.
7668         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
7669         (Sized_incr_relobj::do_read_relocs): New function.
7670         (Sized_incr_relobj::do_gc_process_relocs): New function.
7671         (Sized_incr_relobj::do_scan_relocs): New function.
7672         (Sized_incr_relobj::do_count_local_symbols): New function.
7673         (Sized_incr_relobj::do_finalize_local_symbols): New function.
7674         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
7675         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
7676         (Sized_incr_relobj::do_relocate): New function.
7677         (Sized_incr_relobj::do_set_section_offset): New function.
7678         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
7679         (Sized_incr_dynobj::do_read_symbols): New function.
7680         (Sized_incr_dynobj::do_layout): New function.
7681         (Sized_incr_dynobj::do_add_symbols): New function.
7682         (Sized_incr_dynobj::do_should_include_member): New function.
7683         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
7684         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
7685         (Sized_incr_dynobj::do_section_size): New function.
7686         (Sized_incr_dynobj::do_section_name): New function.
7687         (Sized_incr_dynobj::do_section_contents): New function.
7688         (Sized_incr_dynobj::do_section_flags): New function.
7689         (Sized_incr_dynobj::do_section_entsize): New function.
7690         (Sized_incr_dynobj::do_section_address): New function.
7691         (Sized_incr_dynobj::do_section_type): New function.
7692         (Sized_incr_dynobj::do_section_link): New function.
7693         (Sized_incr_dynobj::do_section_info): New function.
7694         (Sized_incr_dynobj::do_section_addralign): New function.
7695         (Sized_incr_dynobj::do_initialize_xindex): New function.
7696         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
7697         (make_sized_incremental_object): New function.
7698         (Incremental_library::copy_unused_symbols): New function.
7699         (Incremental_library::do_for_all_unused_symbols): New function.
7700         * incremental.h (enum Incremental_input_flags): New type.
7701         (class Incremental_checker): Remove.
7702         (Incremental_input_entry::Incremental_input_entry): Add argument
7703         serial number.
7704         (Incremental_input_entry::arg_serial): New function.
7705         (Incremental_input_entry::set_is_in_system_directory): New function.
7706         (Incremental_input_entry::is_in_system_directory): New function.
7707         (Incremental_input_entry::arg_serial_): New data member.
7708         (Incremental_input_entry::is_in_system_directory_): New data member.
7709         (class Script_info): Move here from script.h.
7710         (Script_info::Script_info): Add filename parameter.
7711         (Script_info::filename): New function.
7712         (Script_info::filename_): New data member.
7713         (Incremental_script_entry::Incremental_script_entry): Add argument
7714         serial number.
7715         (Incremental_object_entry::Incremental_object_entry): Likewise.
7716         (Incremental_object_entry::add_input_section): Build list of input
7717         sections with map to original shndx.
7718         (Incremental_object_entry::get_input_section_index): New function.
7719         (Incremental_object_entry::shndx_): New data member.
7720         (Incremental_object_entry::name_key_): Rename; adjust all refs.
7721         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
7722         (Incremental_archive_entry::Incremental_archive_entry): Add argument
7723         serial number.
7724         (Incremental_inputs::report_archive_begin): Likewise.
7725         (Incremental_inputs::report_object): Likewise.
7726         (Incremental_inputs::report_script): Likewise.
7727         (class Incremental_global_symbol_reader): New class.
7728         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
7729         and store flags and input file type.
7730         (Incremental_input_entry_reader::arg_serial): New function.
7731         (Incremental_input_entry_reader::type): Extract type from flags.
7732         (Incremental_input_entry_reader::is_in_system_directory): New function.
7733         (Incremental_input_entry_reader::get_input_section_count): Call
7734         accessor function for type.
7735         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
7736         function for type; adjust size of global symbol entry.
7737         (Incremental_input_entry_reader::get_global_symbol_count): Call
7738         accessor function for type.
7739         (Incremental_input_entry_reader::get_object_count): Likewise.
7740         (Incremental_input_entry_reader::get_object_offset): Likewise.
7741         (Incremental_input_entry_reader::get_member_count): Likewise.
7742         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
7743         (Incremental_input_entry_reader::get_member_offset): Likewise.
7744         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
7745         (Incremental_input_entry_reader::Global_symbol_info): Remove.
7746         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
7747         (Incremental_input_entry_reader::get_global_symbol_reader): New
7748         function.
7749         (Incremental_input_entry_reader::get_output_symbol_index): New
7750         function.
7751         (Incremental_input_entry_reader::type_): Remove.
7752         (Incremental_input_entry_reader::flags_): New data member.
7753         (Incremental_inputs_reader::input_file_offset): New function.
7754         (Incremental_inputs_reader::input_file_index): New function.
7755         (Incremental_inputs_reader::input_file): Call input_file_offset.
7756         (Incremental_inputs_reader::input_file_at_offset): New function.
7757         (Incremental_relocs_reader::get_r_type): Reformat.
7758         (Incremental_relocs_reader::get_r_shndx): Reformat.
7759         (Incremental_relocs_reader::get_r_offset): Reformat.
7760         (Incremental_relocs_reader::data): New function.
7761         (Incremental_binary::Incremental_binary): Initialize new data members.
7762         (Incremental_binary::check_inputs): Add cmdline parameter.
7763         (Incremental_binary::file_is_unchanged): Remove.
7764         (Input_reader::arg_serial): New function.
7765         (Input_reader::get_unused_symbol_count): New function.
7766         (Input_reader::get_unused_symbol): New function.
7767         (Input_reader::do_arg_serial): New function.
7768         (Input_reader::do_get_unused_symbol_count): New function.
7769         (Input_reader::do_get_unused_symbol): New function.
7770         (Incremental_binary::input_file_count): New function.
7771         (Incremental_binary::get_input_reader): Change signature to use
7772         index instead of filename.
7773         (Incremental_binary::file_has_changed): New function.
7774         (Incremental_binary::get_input_argument): New function.
7775         (Incremental_binary::get_library): New function.
7776         (Incremental_binary::get_script_info): New function.
7777         (Incremental_binary::init_layout): New function.
7778         (Incremental_binary::reserve_layout): New function.
7779         (Incremental_binary::output_file): New function.
7780         (Incremental_binary::do_check_inputs): New function.
7781         (Incremental_binary::do_file_is_unchanged): Remove.
7782         (Incremental_binary::do_file_has_changed): New function.
7783         (Incremental_binary::do_init_layout): New function.
7784         (Incremental_binary::do_reserve_layout): New function.
7785         (Incremental_binary::do_input_file_count): New function.
7786         (Incremental_binary::do_get_input_reader): Change signature.
7787         (Incremental_binary::input_args_map_): New data member.
7788         (Incremental_binary::library_map_): New data member.
7789         (Incremental_binary::script_map_): New data member.
7790         (Sized_incremental_binary::Sized_incremental_binary): Initialize
7791         new data members.
7792         (Sized_incremental_binary::output_section): New function.
7793         (Sized_incremental_binary::inputs_reader): Add const.
7794         (Sized_incremental_binary::symtab_reader): Add const.
7795         (Sized_incremental_binary::relocs_reader): Add const.
7796         (Sized_incremental_binary::got_plt_reader): Add const.
7797         (Sized_incremental_binary::get_symtab_view): New function.
7798         (Sized_incremental_binary::Inputs_reader): New typedef.
7799         (Sized_incremental_binary::Input_entry_reader): New typedef.
7800         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
7801         (Sized_incremental_binary::do_file_is_unchanged): Remove.
7802         (Sized_incremental_binary::do_file_has_changed): New function.
7803         (Sized_incremental_binary::do_init_layout): New function.
7804         (Sized_incremental_binary::do_reserve_layout): New function.
7805         (Sized_input_reader::Inputs_reader): Remove.
7806         (Sized_input_reader::Input_entry_reader): Remove.
7807         (Sized_input_reader::do_arg_serial): New function.
7808         (Sized_input_reader::do_get_unused_symbol_count): New function.
7809         (Sized_input_reader::do_get_unused_symbol): New function.
7810         (Sized_incremental_binary::do_input_file_count): New function.
7811         (Sized_incremental_binary::do_get_input_reader): Change signature;
7812         use index instead of filename.
7813         (Sized_incremental_binary::section_map_): New data member.
7814         (Sized_incremental_binary::input_entry_readers_): New data member.
7815         (class Sized_incr_relobj): New class.
7816         (class Sized_incr_dynobj): New class.
7817         (make_sized_incremental_object): New function.
7818         (class Incremental_library): New class.
7819         * layout.cc (Free_list::num_lists): New static data member.
7820         (Free_list::num_nodes): New static data member.
7821         (Free_list::num_removes): New static data member.
7822         (Free_list::num_remove_visits): New static data member.
7823         (Free_list::num_allocates): New static data member.
7824         (Free_list::num_allocate_visits): New static data member.
7825         (Free_list::init): New function.
7826         (Free_list::remove): New function.
7827         (Free_list::allocate): New function.
7828         (Free_list::dump): New function.
7829         (Free_list::print_stats): New function.
7830         (Layout_task_runner::run): Resize output file for incremental updates.
7831         (Layout::Layout): Initialize new data members.
7832         (Layout::set_incremental_base): New function.
7833         (Layout::init_fixed_output_section): New function.
7834         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
7835         incremental updates.
7836         (Layout::create_gold_note): Do not create gold note section for
7837         incremental updates.
7838         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
7839         for incremental updates.
7840         (Layout::set_section_offsets): For incremental updates, allocate space
7841         from free list.
7842         (Layout::create_symtab_sections): Layout with offsets relative to
7843         start of section; for incremental updates, allocate space from free
7844         list.
7845         (Layout::create_shdrs): For incremental updates, allocate space from
7846         free list.
7847         (Layout::finish_dynamic_section): For incremental updates, do not
7848         check --as-needed (fixed in subsequent patch).
7849         * layout.h (class Free_list): New class.
7850         (Layout::set_incremental_base): New function.
7851         (Layout::incremental_base): New function.
7852         (Layout::init_fixed_output_section): New function.
7853         (Layout::allocate): New function.
7854         (Layout::incremental_base_): New data member.
7855         (Layout::free_list_): New data member.
7856         * main.cc (main): Print Free_list statistics.
7857         * object.cc (Relobj::finalize_incremental_relocs): Add
7858         clear_counts parameter; clear counts only when clear_counts is set.
7859         (Sized_relobj::Sized_relobj): Initialize new base class.
7860         (Sized_relobj::do_layout): Don't report special sections.
7861         (Sized_relobj::do_for_all_local_got_entries): New function.
7862         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
7863         symtab_off to all symbol table offsets.
7864         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
7865         * object.h (class Got_offset_list): Move to top of file.
7866         (Object::Object): Allow case where input_file == NULL.
7867         (Object::~Object): Likewise.
7868         (Object::input_file): Assert that input_file != NULL.
7869         (Object::lock): Allow case where input_file == NULL.
7870         (Object::unlock): Likewise.
7871         (Object::is_locked): Likewise.
7872         (Object::token): Likewise.
7873         (Object::release): Likewise.
7874         (Object::is_incremental): New function.
7875         (Object::get_mtime): New function.
7876         (Object::for_all_local_got_entries): New function.
7877         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
7878         (Object::set_is_in_system_directory): New function.
7879         (Object::is_in_system_directory): New function.
7880         (Object::do_is_incremental): New function.
7881         (Object::do_get_mtime): New function.
7882         (Object::do_for_all_local_got_entries): New function.
7883         (Object::is_in_system_directory_): New data member.
7884         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
7885         (class Sized_relobj_base): New class.
7886         (class Sized_relobj): Derive from Sized_relobj_base.
7887         (class Sized_relobj::Symbols): Redeclare from base class.
7888         (class Sized_relobj::local_got_offset_list): Remove.
7889         (class Sized_relobj::Output_sections): Redeclare from base class.
7890         (class Sized_relobj::do_for_all_local_got_entries): New function.
7891         (class Sized_relobj::write_local_symbols): Add offset parameter.
7892         (class Sized_relobj::local_symbol_offset_): Update comment.
7893         (class Sized_relobj::local_dynsym_offset_): Update comment.
7894         * options.cc (Input_arguments::add_file): Remove const.
7895         * options.h (Input_file_argument::Input_file_argument):
7896         Initialize arg_serial_ (all constructors).
7897         (Input_file_argument::set_arg_serial): New function.
7898         (Input_file_argument::arg_serial): New function.
7899         (Input_file_argument::arg_serial_): New data member.
7900         (Input_arguments::Input_arguments): Initialize file_count_.
7901         (Input_arguments::add_file): Remove const.
7902         (Input_arguments::number_of_input_files): New function.
7903         (Input_arguments::file_count_): New data member.
7904         (Command_line::number_of_input_files): Call
7905         Input_arguments::number_of_input_files.
7906         * output.cc (Output_segment_headers::Output_segment_headers):
7907         Set current size.
7908         (Output_section::Input_section::current_data_size): New function.
7909         (Output_section::Output_section): Initialize new data members.
7910         (Output_section::add_input_section): Don't do merge sections for
7911         an incremental link; allocate space from free list for an
7912         incremental update.
7913         (Output_section::add_output_section_data): Allocate space from
7914         free list for an incremental update.
7915         (Output_section::update_data_size): New function.
7916         (Output_section::set_fixed_layout): New function.
7917         (Output_section::reserve): New function.
7918         (Output_segment::set_section_addresses): Remove const.
7919         (Output_segment::set_section_list_addresses): Remove const; allocate
7920         space from free list for an incremental update.
7921         (Output_segment::set_offset): Adjust size of RELRO segment for an
7922         incremental update.
7923         * output.h (Output_data::current_data_size): Move here from
7924         child classes.
7925         (Output_data::pre_finalize_data_size): New function.
7926         (Output_data::update_data_size): New function.
7927         (Output_section_headers::update_data_size): new function.
7928         (Output_section_data_build::current_data_size): Move to Output_data.
7929         (Output_data_strtab::update_data_size): New function.
7930         (Output_section::current_data_size): Move to Output_data.
7931         (Output_section::set_fixed_layout): New function.
7932         (Output_section::has_fixed_layout): New function.
7933         (Output_section::reserve): New function.
7934         (Output_section::update_data_size): New function.
7935         (Output_section::has_fixed_layout_): New data member.
7936         (Output_section::free_list_): New data member.
7937         (Output_segment::set_section_addresses): Remove const.
7938         (Output_segment::set_section_list_addresses): Remove const.
7939         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
7940         New function.
7941         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
7942         New function.
7943         * readsyms.cc (Read_symbols::do_read_symbols): Add library
7944         parameter when calling Add_symbols constructor; store argument
7945         serial number for members of a lib group.
7946         (Add_symbols::locks): Allow case where token == NULL.
7947         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
7948         (Read_member::~Read_member): New function.
7949         (Read_member::is_runnable): New function.
7950         (Read_member::locks): New function.
7951         (Read_member::run): New function.
7952         (Check_script::~Check_script): New function.
7953         (Check_script::is_runnable): New function.
7954         (Check_script::locks): New function.
7955         (Check_script::run): New function.
7956         (Check_library::~Check_library): New function.
7957         (Check_library::is_runnable): New function.
7958         (Check_library::locks): New function.
7959         (Check_library::run): New function.
7960         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
7961         (Add_symbols::library_): New data member.
7962         (class Read_member): New class.
7963         (class Check_script): New class.
7964         (class Check_library): New class.
7965         * reloc.cc (Read_relocs::is_runnable): Allow case where
7966         token == NULL.
7967         (Read_relocs::locks): Likewise.
7968         (Scan_relocs::locks): Likewise.
7969         (Relocate_task::locks): Likewise.
7970         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
7971         to clear counters.
7972         (Sized_relobj::incremental_relocs_scan): Fix comment.
7973         (Sized_relobj::do_relocate): Pass output file offset to
7974         write_local_symbols.
7975         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
7976         from class declaration.
7977         * script.cc (read_input_script): Allocate Script_info; pass
7978         argument serial number to report_script.
7979         * script.h (class Script_info): Move to incremental.h.
7980         * symtab.cc (Symbol_table::add_from_incrobj): New function.
7981         * symtab.h (Symbol_table::add_from_incrobj): New function.
7982         (Symbol_table::set_file_offset): New function.
7983
7984 2011-04-05  Cary Coutant  <ccoutant@google.com>
7985
7986         * incremental-dump.cc (dump_incremental_inputs): Change signature
7987         to take a Sized_incremental_binary; change caller.  Use readers
7988         in Sized_incremental_binary.
7989         * incremental.cc
7990         (Sized_incremental_binary::find_incremental_inputs_sections):
7991         Rename do_find_incremental_inputs_sections to this.
7992         (Sized_incremental_binary::setup_readers): New function.
7993         (Sized_incremental_binary::do_check_inputs): Check
7994         has_incremental_info_ flag; move setup code to setup_readers;
7995         use input readers.
7996         (Sized_incremental_binary::do_file_is_unchanged): New function.
7997         (Sized_incremental_binary::do_get_input_reader): New function.
7998         * incremental.h (class Incremental_binary): Move to end of file.
7999         (Incremental_binary::file_is_unchanged): New function.
8000         (Incremental_binary::do_file_is_unchanged): New function.
8001         (Incremental_binary::Input_reader): New class.
8002         (Incremental_binary::get_input_reader): New function.
8003         (class Sized_incremental_binary): Move to end of file.
8004         (Sized_incremental_binary::Sized_incremental_binary): Setup the
8005         input section reader classes.
8006         (Sized_incremental_binary::has_incremental_info): New function.
8007         (Sized_incremental_binary::inputs_reader): New function.
8008         (Sized_incremental_binary::symtab_reader): New function.
8009         (Sized_incremental_binary::relocs_reader): New function.
8010         (Sized_incremental_binary::got_plt_reader): New function.
8011         (Sized_incremental_binary::do_file_is_unchanged): New function.
8012         (Sized_incremental_binary::Sized_input_reader): New class.
8013         (Sized_incremental_binary::get_input_reader): New function.
8014         (Sized_incremental_binary::find_incremental_inputs_sections):
8015         Rename do_find_incremental_inputs_sections to this.
8016         (Sized_incremental_binary::setup_readers): New function.
8017         (Sized_incremental_binary::has_incremental_info_): New data member.
8018         (Sized_incremental_binary::inputs_reader_): New data member.
8019         (Sized_incremental_binary::symtab_reader_): New data member.
8020         (Sized_incremental_binary::relocs_reader_): New data member.
8021         (Sized_incremental_binary::got_plt_reader_): New data member.
8022         (Sized_incremental_binary::current_input_file_): New data member.
8023
8024 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
8025
8026         PR gold/12640
8027         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
8028         violation.
8029
8030 2011-03-30  Cary Coutant  <ccoutant@google.com>
8031
8032         * archive.cc (Archive::include_member): Adjust call to report_object.
8033         (Add_archive_symbols::run): Add script_info to call to
8034         report_archive_begin.
8035         (Lib_group::include_member): Adjust call to report_object.
8036         (Add_lib_group_symbols::run): Adjust call to report_object.
8037         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
8038         blocks.  Add object count for script input files.
8039         * incremental.cc (Incremental_inputs::report_archive_begin): Add
8040         script_info parameter; change all callers.
8041         (Incremental_inputs::report_object): Add script_info parameter;
8042         change all callers.
8043         (Incremental_inputs::report_script): Store backpointer to
8044         incremental info entry.
8045         (Output_section_incremental_inputs::set_final_data_size): Record
8046         additional information for scripts.
8047         (Output_section_incremental_inputs::write_info_blocks): Likewise.
8048         * incremental.h (Incremental_script_entry::add_object): New function.
8049         (Incremental_script_entry::get_object_count): New function.
8050         (Incremental_script_entry::get_object): New function.
8051         (Incremental_script_entry::objects_): New data member; adjust
8052         constructor.
8053         (Incremental_inputs::report_archive_begin): Add script_info parameter.
8054         (Incremental_inputs::report_object): Add script_info parameter.
8055         (Incremental_inputs_reader::get_object_count): New function.
8056         (Incremental_inputs_reader::get_object_offset): New function.
8057         * options.cc (Input_arguments::add_file): Return reference to
8058         new input argument.
8059         * options.h (Input_argument::set_script_info): New function.
8060         (Input_argument::script_info): New function.
8061         (Input_argument::script_info_): New data member; adjust all
8062         constructors.
8063         (Input_file_group::add_file): Return reference to new input argument.
8064         (Input_file_lib::add_file): Likewise.
8065         (Input_arguments::add_file): Likewise.
8066         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
8067         * script.cc (Parser_closure::Parser_closure): Add script_info
8068         parameter; adjust all callers.
8069         (Parser_closure::script_info): New function.
8070         (Parser_closure::script_info_): New data member.
8071         (read_input_script): Report scripts earlier to incremental info.
8072         (script_add_file): Set script_info in Input_argument.
8073         (script_add_library): Likewise.
8074         * script.h (Script_options::Script_info): Rewrite class.
8075
8076 2011-03-29  Cary Coutant  <ccoutant@google.com>
8077
8078         * archive.cc (Library_base::should_include_member): Move
8079         method here from class Archive.
8080         (Archive::Archive): Initialize base class.
8081         (Archive::should_include_member): Move to base class.
8082         (Archive::do_for_all_unused_symbols): New function.
8083         (Add_archive_symbols::run): Remove redundant access to
8084         incremental_inputs.
8085         (Lib_group::Lib_group): Initialize base class.
8086         (Lib_group::do_filename): New function.
8087         (Lib_group::include_member): Pass pointer to Lib_group to
8088         report_object.
8089         (Lib_group::do_for_all_unused_symbols): New function.
8090         (Add_lib_group_symbols::run): Report archive information for
8091         incremental links.
8092         * archive.h (class Library_base): New base class.
8093         (class Archive): Derive from Library_base.
8094         (Archive::filename): Move to base class.
8095         (Archive::set_incremental_info): Likewise.
8096         (Archive::incremental_info): Likewise.
8097         (Archive::Should_include): Likewise.
8098         (Archive::should_include_member): Likewise.
8099         (Archive::Armap_entry): Remove.
8100         (Archive::Unused_symbol_iterator): Remove.
8101         (Archive::unused_symbols_begin): Remove.
8102         (Archive::unused_symbols_end): Remove.
8103         (Archive::do_filename): New function.
8104         (Archive::do_get_mtime): New function.
8105         (Archive::do_for_all_unused_symbols): New function.
8106         (Archive::task_): Move to base class.
8107         (Archive::incremental_info_): Likewise.
8108         (class Lib_group): Derive from Library_base.
8109         (Lib_group::do_filename): New function.
8110         (Lib_group::do_get_mtime): New function.
8111         (Lib_group::do_for_all_unused_symbols): New function.
8112         (Lib_group::task_): Move to base class.
8113         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
8114         function.
8115         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
8116         function.
8117         * incremental.cc (Incremental_inputs::report_archive_begin):
8118         Use Library_base; call library's get_mtime; add incremental inputs
8119         entry before members.
8120         (class Unused_symbol_visitor): New class.
8121         (Incremental_inputs::report_archive_end): Use Library_base; use
8122         visitor class to record unused symbols; don't add incremental inputs
8123         entry after members.
8124         (Incremental_inputs::report_object): Use Library_base.
8125         * incremental.h
8126         (Incremental_archive_entry::Incremental_archive_entry): Remove
8127         unused Archive parameter.
8128         (Incremental_inputs::report_archive_begin): Use Library_base.
8129         (Incremental_inputs::report_archive_end): Likewise.
8130         (Incremental_inputs::report_object): Likewise.
8131         * object.cc (Sized_relobj::do_for_all_global_symbols): New
8132         function.
8133         * object.h (Object::for_all_global_symbols): New function.
8134         (Object::do_for_all_global_symbols): New function.
8135         (Sized_relobj::do_for_all_global_symbols): New function.
8136         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
8137         function.
8138         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
8139         function.
8140
8141 2011-03-27  Ian Lance Taylor  <iant@google.com>
8142
8143         * archive.cc (Archive::interpret_header): Return -1 if something
8144         goes wrong.  Change callers accordingly.
8145
8146 2011-03-25  Cary Coutant  <ccoutant@google.com>
8147
8148         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
8149         * testsuite/Makefile.in: Regenerate.
8150
8151 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
8152
8153         * plugin.cc (get_view): New.
8154         (Plugin::load): Pass get_view to the plugin.
8155         (Plugin_manager::get_view): New.
8156
8157 2011-03-21  Ian Lance Taylor  <iant@google.com>
8158
8159         * testsuite/final_layout.sh: Rewrite to not use dc.
8160         * testsuite/relro_test.sh: Fail if dc is not present.
8161
8162 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
8163
8164         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
8165         Change == to -eq.
8166         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
8167         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
8168         Change == to -eq.
8169         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
8170         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
8171
8172 2011-03-14  Ian Lance Taylor  <iant@google.com>
8173
8174         * script-sections.cc (Sort_output_sections::script_compare):
8175         Rename from is_before, change return type.
8176         (Sort_output_sections::operator()): Adjust accordingly.
8177
8178 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
8179
8180         PR gold/12572
8181         * testsuite/odr_violation2.cc: Add comment to make all error line
8182         numbers double digits.
8183         * testsuite/debug_msg.sh: Adjust expected errors.
8184
8185 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
8186
8187         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
8188         but mark earlier ones as non-canonical
8189         (offset_to_iterator): Update search target and example
8190         (do_addr2line): Return extra lines in a vector*
8191         (format_file_lineno): Extract from do_addr2line
8192         (one_addr2line): Add vector* out-param
8193         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
8194         when a lineno entry appeared last for its instruction
8195         (Dwarf_line_info): Add vector* out-param
8196         * object.cc (Relocate_info): Pass NULL for the vector* out-param
8197         * symtab.cc (Odr_violation_compare): Include the lineno in the
8198         comparison again.
8199         (linenos_from_loc): New. Combine the canonical line for an
8200         address with its other lines.
8201         (True_if_intersect): New. Helper functor to make
8202         std::set_intersection a query.
8203         (detect_odr_violations): Compare sets of lines instead of just
8204         one line for each function. This became less deterministic, but
8205         has fewer false positives.
8206         * symtab.h: Declarations.
8207         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
8208         mix an optimized and non-optimized object in the same binary
8209         (odr_violation2.so): Same.
8210         * testsuite/Makefile.in: Regenerate from Makefile.am.
8211         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
8212         * testsuite/debug_msg.sh: Update line numbers and add
8213         assertions.
8214         * testsuite/odr_violation1.cc: Use OdrDerived, in a
8215         non-optimized context.
8216         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
8217         isn't inlined, and use OdrDerived in an optimized context.
8218         * testsuite/odr_header1.h: Defines OdrDerived, where
8219         optimization will change the
8220         first-instruction-in-the-destructor's file and line number.
8221         * testsuite/odr_header2.h: Defines OdrBase.
8222
8223 2011-03-09  Ian Lance Taylor  <iant@google.com>
8224
8225         * fileread.cc (File_read::clear_views): Don't delete the whole
8226         file view.
8227
8228 2011-03-08  Ian Lance Taylor  <iant@google.com>
8229
8230         PR gold/12525
8231         * fileread.cc: #include <climits>.
8232         (GOLD_IOV_MAX): Define.
8233         (File_read::read_multiple): Limit number of entries by iov_max.
8234         * fileread.h (class File_read): Always set max_readv_entries to
8235         128.
8236
8237 2011-03-07  Ian Lance Taylor  <iant@google.com>
8238
8239         PR gold/12525
8240         * options.h (class General_options): Add -dy and -dn.
8241
8242 2011-03-02  Cary Coutant  <ccoutant@google.com>
8243
8244         * testsuite/script_test_9.t: Add TLS segment.
8245
8246 2011-03-02  Simon Baldwin  <simonb@google.com>
8247
8248         * configure.ac: Add check for gnu_indirect_function support in
8249         the toolchain building binutils.
8250         * configure: Rebuild.
8251
8252 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
8253
8254         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
8255         plugin only symbols.
8256         (Symbol_table::sized_finalize_symbol) Mark symbol only present
8257         in plugin files as not needed in the symbol table.
8258
8259 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
8260
8261         * output.cc (Output_section::add_input_section): Delay fill
8262         generation for section ordering.
8263
8264 2011-02-09  Ian Lance Taylor  <iant@google.com>
8265
8266         PR gold/12316
8267         * object.h (class Sized_relobj): Remove clear_local_symbols.
8268         * reloc.cc (Sized_relobj::do_relocate): Don't call
8269         clear_local_symbols.
8270
8271 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
8272
8273         * plugin.cc (is_visible_from_outside): Return true for symbols
8274         in the -u option.
8275
8276 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
8277
8278         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
8279         filename.
8280
8281 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
8282
8283         * icf.h (is_section_foldable_candidate): Change type of parameter
8284         to std::string.
8285         * icf.cc (Icf::find_identical_sections): Change type of local variable
8286         section_name to be std::string.
8287         (is_function_ctor_or_dtor): Change type of parameter to std::string.
8288
8289 2011-01-25  Ian Lance Taylor  <iant@google.com>
8290
8291         * script.cc (script_add_extern): Rewrite to use
8292         add_symbol_reference.
8293
8294 2011-01-25  Doug Kwan  <dougkwan@google.com>
8295
8296         * icf.cc (get_section_contents): Always lock section's object.
8297
8298 2011-01-24  Ian Lance Taylor  <iant@google.com>
8299
8300         * options.h (class General_options): Accept
8301         --no-detect-odr-violations.
8302
8303 2011-01-24  Ian Lance Taylor  <iant@google.com>
8304
8305         * version.cc (version_string): Bump to 1.11.
8306
8307 2011-01-24  Ian Lance Taylor  <iant@google.com>
8308
8309         * plugin.cc (class Plugin_rescan): Define new class.
8310         (Plugin_manager::claim_file): Set any_claimed_.
8311         (Plugin_manager::save_archive): New function.
8312         (Plugin_manager::save_input_group): New function.
8313         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
8314         necessary.
8315         (Plugin_manager::new_undefined_symbol): New function.
8316         (Plugin_manager::rescan): New function.
8317         (Plugin_manager::rescannable_defines): New function.
8318         (Plugin_manager::add_input_file): Set any_added_.
8319         * plugin.h (class Plugin_manager): define new fields rescannable_,
8320         undefined_symbols_, any_claimed_, and any_added_.  Declare
8321         Plugin_rescan as friend.  Declare new functions.
8322         (Plugin_manager::Rescannable): Define type.
8323         (Plugin_manager::Rescannable_list): Define type.
8324         (Plugin_manager::Undefined_symbol_list): Define type.
8325         (Plugin_manager::Plugin_manager): Initialize new fields.
8326         * archive.cc (Archive::defines_symbol): New function.
8327         (Add_archive_symbols::run): Pass archive to plugins if any.
8328         * archive.h (class Archive): Declare defines_symbol.
8329         * readsyms.cc (Input_group::~Input_group): New function.
8330         (Finish_group::run): Pass input_group to plugins if any.
8331         * readsyms.h (class Input_group): Declare destructor.
8332         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
8333         any.
8334
8335 2011-01-10  Ian Lance Taylor  <iant@google.com>
8336
8337         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
8338         section as relro.
8339         (Layout::set_segment_offsets): Reset increase_relro before calling
8340         set_section_addresses a second time.
8341
8342 2011-01-04  Cary Coutant  <ccoutant@google.com>
8343
8344         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
8345         sections before NOBITS sections.
8346
8347 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
8348
8349         * version.cc (print_version): Update copyright to 2011.
8350
8351 2010-12-23  Cary Coutant  <ccoutant@google.com>
8352
8353         * output.h (Output_data_reloc::add_output_section): Pass OD instead
8354         of OS to this->add.  Add OD parameter to second form of the function.
8355
8356 2010-12-20  Ian Lance Taylor  <iant@google.com>
8357
8358         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
8359         second of two consecutive entries with same offset.
8360
8361 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8362
8363         * testsuite/Makefile.am (ifuncmain2static_LDADD)
8364         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
8365         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
8366         to avoid unneeded links against $(LDADD).
8367         * testsuite/Makefile.in: Regenerate.
8368
8369 2010-12-15  Ian Lance Taylor  <iant@google.com>
8370
8371         PR gold/12324
8372         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
8373         for R_X86_64_32 and R_X86_64_PC32.
8374         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
8375         ver_matching_def_pic.o.
8376         (ver_matching_def_pic.o): New target.
8377
8378 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8379
8380         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
8381         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
8382         Move definition before File_read::View member definitions.
8383         (File_read::View::~View): Initialize and hold lock before
8384         updating current_mapped_bytes.
8385
8386 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8387
8388         * dwarf_reader.cc: Remove outdated comment.
8389         * gold-threads.cc: Fix typo in error message.
8390         * archive.cc: Fix typos in comments.
8391         * archive.h: Likewise.
8392         * arm-reloc-property.cc: Likewise.
8393         * arm-reloc-property.h: Likewise.
8394         * arm-reloc.def: Likewise.
8395         * arm.cc: Likewise.
8396         * attributes.h: Likewise.
8397         * cref.cc: Likewise.
8398         * ehframe.cc: Likewise.
8399         * fileread.h: Likewise.
8400         * gold.h: Likewise.
8401         * i386.cc: Likewise.
8402         * icf.cc: Likewise.
8403         * incremental.h: Likewise.
8404         * int_encoding.cc: Likewise.
8405         * layout.h: Likewise.
8406         * main.cc: Likewise.
8407         * merge.h: Likewise.
8408         * object.cc: Likewise.
8409         * object.h: Likewise.
8410         * options.cc: Likewise.
8411         * readsyms.cc: Likewise.
8412         * reduced_debug_output.cc: Likewise.
8413         * reloc.cc: Likewise.
8414         * script-sections.cc: Likewise.
8415         * sparc.cc: Likewise.
8416         * symtab.h: Likewise.
8417         * target-reloc.h: Likewise.
8418         * target.cc: Likewise.
8419         * target.h: Likewise.
8420         * timer.cc: Likewise.
8421         * timer.h: Likewise.
8422         * x86_64.cc: Likewise.
8423
8424 2010-12-09  Cary Coutant  <ccoutant@google.com>
8425
8426         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
8427         stack.
8428         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
8429         parameter; change all callers.
8430         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
8431         * options.h (warn_execstack): New option.
8432
8433 2010-12-07  Doug Kwan  <dougkwan@google.com>
8434
8435         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
8436         like function call relocations.
8437
8438 2010-12-07  Ian Lance Taylor  <iant@google.com>
8439
8440         * archive.cc (Archive::get_elf_object_for_member): Permit
8441         punconfigured to be NULL.
8442         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
8443         (Archive::include_member): Pass NULL to get_elf_object_for_member
8444         if we searched for the archive and this is the first included
8445         object.
8446
8447 2010-12-01  Ian Lance Taylor  <iant@google.com>
8448
8449         * dwarf_reader.h (class Sized_dwarf_line_info): Add
8450         track_relocs_type_ field.
8451         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8452         Set track_relocs_type_.
8453         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
8454         contents when using RELA relocs.
8455         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
8456         reloc_map_.
8457         * reloc.cc (Track_relocs::next_addend): New function.
8458         * reloc.h (class Track_relocs): Declare next_addend.
8459
8460 2010-12-01  Ian Lance Taylor  <iant@google.com>
8461
8462         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
8463         virtual destructor.
8464
8465 2010-12-01  Ian Lance Taylor  <iant@google.com>
8466
8467         * README: Update compilers known to work and fail.
8468
8469 2010-11-23  Matthias Klose  <doko@ubuntu.com>
8470
8471         * configure.in: For --enable-gold, handle value `default' instead of
8472         `both*'.  Always install ld as ld.bfd, install as ld if gold is
8473         not the default.
8474         * configure: Regenerate.
8475
8476 2010-11-18  Doug Kwan  <dougkwan@google.com>
8477
8478         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
8479         and right_alignment to be zero.  Store result alignment only if it is
8480         greater than existing alignment.
8481
8482 2010-11-16  Cary Coutant  <ccoutant@google.com>
8483
8484         PR gold/12220
8485         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8486         Check for ".zdebug_line".
8487
8488 2010-11-16  Doug Kwan  <dougkwan@google.com>
8489             Cary Coutant  <ccoutant@google.com>
8490
8491         * output.h (Output_segment::set_section_addresses): Pass increase_relro
8492         by reference; adjust all callers.
8493         * output.cc (Output_segment::set_section_addresses): Adjust references
8494         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
8495         list is empty.
8496         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
8497         end at page boundary.
8498
8499 2010-11-16  Cary Coutant  <ccoutant@google.com>
8500
8501         PR gold/12220
8502         * layout.cc (Layout::choose_output_section): Transform names of
8503         compressed sections even when using a script with a SECTIONS clause.
8504         (Layout::output_section_name): Remove code to transform
8505         compressed debug section names.
8506         * output.cc (Output_section::add_input_section): Use uncompressed
8507         section size when tracking input sections.
8508
8509 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
8510
8511         * symtab.h (Symbol::NON_PIC_REF): Remove.
8512         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
8513         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
8514         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
8515         (Symbol::use_plt_offset): Take a flags argument and pass it
8516         directly to needs_dynamic_reloc.  Restrict check for undefined
8517         weak symbols to function calls.
8518         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
8519         (Target_arm::Scan::global): Use it.
8520         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
8521         (Target_arm::Relocate::relocate): Likewise.
8522         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
8523         parameter with an r_type parameter.  Use get_reference_flags
8524         to get the flags.
8525         (Target_arm::Relocate::relocate): Update accordingly.
8526         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
8527         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
8528         (Target_i386::Scan::global): Likewise.
8529         (Target_i386::Relocate::relocate): Likewise.
8530         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
8531         parameter with an r_type parameter.  Use get_reference_flags
8532         to get the flags.
8533         (Target_i386::Relocate::relocate): Update accordingly.
8534         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
8535         (Target_powerpc::Scan::global): Use it.
8536         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
8537         (Target_powerpc::Relocate::relocate): Likewise.
8538         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
8539         (Target_sparc::Scan::global): Use it.
8540         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
8541         (Target_sparc::Relocate::relocate): Likewise.
8542         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
8543         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
8544         (Target_x86_64::Scan::global): Likewise.
8545         (Target_x86_64::Relocate::relocate): Likewise.
8546
8547 2010-11-08  Doug Kwan  <dougkwan@google.com>
8548             Cary Coutant  <ccoutant@google.com>
8549
8550         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
8551         (Arm_exidx_merge_section::section_contents_): New data member.
8552         (Arm_input_section::Arm_input_section): Initialize original_contents_.
8553         (Arm_input_section::~Arm_input_section): De-allocate memory.
8554         (Arm_input_section::original_contents_): New data member.
8555         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
8556         in parameters instead of calling Object::section_contents without
8557         locking.
8558         (Arm_output_section::group_section): New parameter TASK.  Pass it
8559         to callees that need locking objects.
8560         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
8561         to lock EXIDX input sections.  Fix a formatting issue.  Call
8562         Arm_exidx_merged_section::build_contents to create merged section
8563         contents.
8564         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
8565         to lock object of stub table owner.
8566         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
8567         TEXT_SIZE to initialize data member TEXT_SIZE_.
8568         (Arm_exidx_input_section::addralign): Fix typo in comment.
8569         (Arm_exidx_input_section::text_size): New method.
8570         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
8571         that require locking objects.  Lock objects before scanning for stubs
8572         and updating local symbols.
8573         (Arm_input_section<big_endian>::init): Copy contents of original
8574         input section.
8575         (Arm_input_section<big_endian>::do_write): Use saved contents of
8576         original input section instead of calling Object::section_contents
8577         without locking.
8578         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
8579         size without calling Object::section_size().
8580         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
8581         for size.  Allocate a buffer for merged EXIDX entries.
8582         (Arm_exidx_merged_section::build_contents): New method.
8583         (Arm_exidx_merged_section::do_write): Move merge section contents
8584         building code to Arm_exidx_merged_section::build_contetns.  Write
8585         out contetns in buffer instead of building it on the fly.
8586         (Arm_relobj::make_exidx_input_section): Also pass text section size
8587         to Arm_exidx_input_section constructor.
8588         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
8589         (Arm_dynobj::do_read_symbols): Fix memory leak.
8590         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
8591         * target.h: (class Task): Add forward declaration.
8592         (Target::relax): Add new parameter TASK and pass it to
8593         Target::do_relax().
8594         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
8595
8596 2010-11-05  Cary Coutant  <ccoutant@google.com>
8597
8598         PR gold/10708
8599         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
8600         object when reading from the file.
8601         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
8602         second layout pass.
8603         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
8604         when reading section contents.
8605         (get_section_contents): Likewise.
8606         (icf::find_identical_sections): Likewise.
8607         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
8608         object when reading from the file.
8609         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
8610         the object when doing deferred section layout.
8611
8612 2010-11-03  Nick Clifton  <nickc@redhat.com>
8613
8614         PR gold/12001
8615         * script.h (class Symbol_assignment: name): New member.  Returns
8616         the name of the symbol.
8617         * scrfipt.cc (Script_options::is_pending_assignment): New member.
8618         Returns true if the given symbol name is on the list of
8619         assignments wating to be processed.
8620         * archive.cc (should_incldue_member): If the symbol is undefined,
8621         check to see if it is on the list of symbols pending assignment.
8622
8623 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
8624
8625         * script-sections.cc (Script_sections::find_memory_region): Check
8626         for a NULL output section pointer.
8627
8628 2010-10-29  Doug Kwan  <dougkwan@google.com>
8629
8630         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
8631         Output_section::add_relaxed_input_section.
8632         * output.cc (Output_section::add_relaxed_input_section): Add new
8633         arguments LAYOUT and NAME.  Set section order index.
8634         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8635         Copy section order index.
8636         * output.h (Output_section::add_relaxed_input_section): Add new
8637         arguments LAYOUT and NAME.
8638
8639 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8640
8641         * testsuite/Makefile.am: Move gcctestdir/ld rule to
8642         NATIVE_OR_CROSS_LINKER.
8643         * testsuite/Makefile.in: Regenerate.
8644
8645 2010-10-20  Doug Kwan  <dougkwan@google.com>
8646
8647         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
8648         without SHF_LINK_ORDER flags.
8649         * layout.cc (Layout::choose_output_section): Do not filter
8650         SHF_LINK_ORDER flag in a relocatable link.
8651
8652 2010-10-17  Cary Coutant  <ccoutant@google.com>
8653
8654         * output.h (Output_segment::set_section_addresses): Change function
8655         signature.  Update all callers.
8656         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
8657         sections.
8658         (Output_segment::set_section_addresses): Align after last TLS
8659         section.  Add padding before last relro section instead of after.
8660
8661 2010-10-17  Doug Kwan  <dougkwan@google.com>
8662
8663         * gold/arm.cc (Target_arm::got_section): Use correct order and set
8664         GOT output section to be writable.
8665
8666 2010-10-14  Cary Coutant  <ccoutant@google.com>
8667
8668         * debug.h (DEBUG_INCREMENTAL): New flag.
8669         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
8670         * gold.cc (queue_initial_tasks): Check parameters for incremental link
8671         mode.
8672         * incremental.cc (report_command_line): Ignore all forms of
8673         --incremental.
8674         * layout.cc (Layout::Layout): Check parameters for incremental link
8675         mode.
8676         * options.cc (General_options::parse_incremental): New function.
8677         (General_options::parse_no_incremental): New function.
8678         (General_options::parse_incremental_full): New function.
8679         (General_options::parse_incremental_update): New function.
8680         (General_options::incremental_mode_): New data member.
8681         (General_options::finalize): Check incremental_mode_.
8682         * options.h (General_options): Update help text for --incremental.
8683         Add --no-incremental, --incremental-full, --incremental-update.
8684         (General_options::Incremental_mode): New enum type.
8685         (General_options::incremental_mode): New function.
8686         (General_options::incremental_mode_): New data member.
8687         * parameters.cc (Parameters::incremental_mode_): New data member.
8688         (Parameters::set_options): Set incremental_mode_.
8689         (Parameters::set_incremental_full): New function.
8690         (Parameters::incremental): New function.
8691         (Parameters::incremental_update): New function.
8692         (set_parameters_incremental_full): New function.
8693         * parameters.h (Parameters::set_incremental_full): New function.
8694         (Parameters::incremental): New function.
8695         (Parameters::incremental_update): New function.
8696         (Parameters::incremental_mode_): New data member.
8697         (set_parameters_incremental_full): New function.
8698         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
8699         incremental link mode.
8700         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
8701         (Sized_relobj::do_relocate_sections): Likewise.
8702         * testsuite/Makefile.am (incremental_test): Use --incremental-full
8703         option.
8704         * testsuite/Makefile.in: Regenerate.
8705         * testsuite/incremental_test.sh: Filter all forms of --incremental.
8706
8707 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8708
8709         * script-sections.h (class Script_sections): Make
8710         Sections_elements typedef public.
8711         * script-sections.cc (class Sort_output_sections): Add elements_
8712         field.  Add constructor which sets it; change all callers.
8713         (Sort_output_sections::is_before): New function.
8714         (Sort_output_sections::operator()): Call is_before.
8715         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
8716         conditional.
8717         * testsuite/script_test_10.sh: New test. Test script section
8718         order.
8719         * testsuite/script_test_10.t: Likewise.
8720         * testsuite/script_test_10.s: Likewise.
8721         * testsuite/Makefile.am: Wrap the cross linker tests and the
8722         common tests into NATIVE_OR_CROSS_LINKER.
8723         (check_SCRIPTS): Add script_test_10.sh.
8724         (check_DATA): Add script_test_10.stdout.
8725         (script_test_10.o, script_test_10): New targets.
8726         (script_test_10.stdout): New target.
8727         * configure, testsuite/Makefile.in: Regenerate.
8728
8729 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8730
8731         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
8732         error for the deprecated relocations.
8733         (Target_arm::Scan::global): Likewise.
8734         (Target_arm::Relocate::relocate): Likewise.
8735
8736 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
8737
8738         * fileread.cc (Input_file::find_file): Initialize *found_name
8739         and *namep when using the fallback search for case 4.
8740
8741 2010-10-11  Cary Coutant  <ccoutant@google.com>
8742
8743         * options.h (class General_options): Redefine -z lazy as an alias for
8744         the negation of -z now.
8745
8746 2010-10-11  Ian Lance Taylor  <iant@google.com>
8747
8748         * resolve.cc (symbol_to_bits): Report the value of the unsupported
8749         binding.
8750
8751 2010-10-06  Nick Clifton  <nickc@redhat.com>
8752
8753         * script-sections.cc(class Memory_region): Remove
8754         current_lma_offset_ field.  Rename current_vma_offset_ to
8755         current_offset_.  Add last_section_ field.
8756         (Memory_region::get_current_vma_address): Rename to
8757         get_current_address.
8758         (Memory_region::get_current_lma_address): Delete.
8759         (Memory_region::increment_vma_offset): Rename to
8760         increment_offset.
8761         (Memory_region::increment_lma_offset): Delete.
8762         (Memory_region::attributes_compatible): New method.  Returns
8763         true if the provided section is compatible with the region.
8764         (Memory_region::get_last_section): New method.  Returns the last
8765         section to use the region.
8766         (Memory_region::set_last_section): New method.  Stores the last
8767         section to use the region.
8768         (Script_sections::block_in_region): New method.  Returns true if
8769         a block of memory is contained within a region.
8770         (Script_sections::find_memory_region): New method.  Locates a
8771         memory region to be used to set a VMA or LMA address.
8772         (Output_section_definition::set_section_addresses): Add code to
8773         check for addresses set by memory regions.
8774         (Output_segment::set_section_addresses): Remove memory region
8775         walking code.
8776         (Script_sections::create_segment): Add a warning if a header
8777         segment is created outside of any region.
8778         * script-sections.h (class Script_sections): Add prototypes for
8779         find_memory_region and block_in_region methods.
8780         * testsuite/memory_test.s: Use .long instead of .word.
8781         * testsuite/memory_test.t: Add some more output sections.
8782         * testsuite/memory_test.sh: Update expected output.
8783
8784 2010-10-02  Doug Kwan  <dougkwan@google.com>
8785
8786         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
8787         defintion to symtab.h
8788         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
8789         declaration to defintion.
8790
8791 2010-10-01  Nick Clifton  <nickc@redhat.com>
8792
8793         * expression.cc (eval): Replace dummy argument with NULL.
8794         (eval_maybe_dot): Check for a NULL result section pointer.
8795         (Symbol_expression::value): Likewise.
8796         (Dot_expression::value): Likewise.
8797         (BINARY_EXPRESSION): Likewise.
8798         (Max_expression::value): Likewise.
8799         (Min_expression::value): Likewise.
8800         (Absolute_expression::value): Likewise.
8801         (Addr_expression::value_from_output_section): Likewise.
8802         (Loaddddr_expression::value_from_output_section): Likewise.
8803         (Segment_start_expression::value): Likewise.
8804         * script-sections.cc
8805         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
8806         argument with NULL.
8807         (Sections_elememt_dot_assignment::set_section_addresses):
8808         Likewise.
8809         (Output_data_expression::do_write_to_buffer): Likewise.
8810         (Output_section_definition::finalize_symbols): Likewise.
8811         (Output_section_definition::set_section_addresses): Likewise.
8812
8813 2010-09-30  Doug Kwan  <dougkwan@google.com>
8814
8815         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
8816
8817 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
8818
8819         * target.h (Target::can_icf_inline_merge_sections): New virtual
8820         function.
8821         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
8822         virtual function.
8823         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
8824         virtual function.
8825         * icf.cc (get_section_contents): Inline merge sections only when
8826         target allows it.
8827
8828 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8829
8830         * configure: Regenerate.
8831
8832 2010-09-17  Ian Lance Taylor  <iant@google.com>
8833
8834         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
8835         * testsuite/Makefile.am (memory_test.o): New target.
8836         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
8837         memory_test.t.
8838         * testsuite/Makefile.in: Rebuild.
8839
8840 2010-09-17  Doug Kwan  <dougkwan@google.com>
8841
8842         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
8843         defintion if relocation uses GOT entries of the symbol.
8844         * testsuite/icf_safe_test.sh: Fix test.
8845         * testsuite/icf_safe_so_test.sh: Fix test.
8846
8847 2010-09-16  Cary Coutant  <ccoutant@google.com>
8848
8849         * script_sections.cc (class Memory_region): Remove "NULL" from
8850         vector initializations.
8851
8852 2010-09-15  Cary Coutant  <ccoutant@google.com>
8853
8854         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
8855         Resolve forwarding symbols.
8856
8857 2010-09-15  Doug Kwan  <dougkwan@google.com>
8858
8859         * gold/testsuite/script_test_3.t: Add ARM special sections.
8860         * gold/testsuite/script_test_4.t: Same.
8861         * gold/testsuite/script_test_5.t: Same.
8862         * gold/testsuite/script_test_6.t: Same.
8863         * gold/testsuite/script_test_7.t: Same.
8864         * gold/testsuite/script_test_7.t: Same.
8865         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
8866
8867 2010-09-14  Cary Coutant  <ccoutant@google.com>
8868
8869         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
8870         (Target_x86_64::Relocate::relocate_tls): Replace check for
8871         saw_tls_block_reloc_ with test for executable section.
8872
8873 2010-09-12  Cary Coutant  <ccoutant@google.com>
8874
8875         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
8876         position-independent executables to shared libraries need dynamic
8877         relocations.
8878         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
8879         position-independent executables.
8880         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
8881         * testsuite/Makefile.in: Regenerate.
8882
8883 2010-09-10  Nick Clifton  <nickc@redhat.com>
8884
8885         PR gold/11997
8886         * testsuite/memory_test.t: Discard any sections that are not
8887         needed.
8888
8889 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
8890
8891         PR gold/11996
8892         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8893         "This::" to work around a bug in gcc 4.2.
8894
8895         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
8896
8897 2010-09-09  Rafael Espindola  <espindola@google.com>
8898
8899         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
8900         sections with different PF_X flags in the same segment.
8901         (Layout::find_first_load_seg): Search all segments to find the first
8902         one.
8903         * options.h (rosegment): New.
8904
8905 2010-09-08  Rafael Espindola  <espindola@google.com>
8906
8907         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
8908
8909 2010-09-08  Doug Kwan  <dougkwan@google.com>
8910
8911         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
8912         (Arm_relobj::do_relocate_sections): Add new parameter for output
8913         file to match the parent.
8914         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
8915         of local symbols instead of input values.  Update code to track
8916         changes in gold::relocate_section.
8917         * object.cc (Sized_relobj::compute_final_local_value): New methods.
8918         (Sized_relobj::compute_final_local_value_internal): New methods.
8919         (Sized_relobj::do_finalize_local_symbols): Move code from loop
8920         body into private version of Sized_relobj::compute_final_local_value.
8921         Call the inline method.
8922         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
8923         merged symbol value if there is one.
8924         (Symbol_value::has_output_value): New method defintiion.
8925         (Sized_relobj::Compute_final_local_value_status): New enum type.
8926         (Sized_relobj::compute_final_local_value): New methods.
8927         (Sized_relobj::compute_final_local_value_internal): New methods.
8928         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
8929         and arm_cortex_a8.sh.
8930         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
8931         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
8932         New tests.
8933         * Makefile.in: Regenerate.
8934         * testsuite/arm_bl_out_of_range.s: Update test.
8935         * testsuite/thumb_bl_out_of_range.s: Ditto.
8936         * testsuite/thumb_blx_out_of_range.s: Ditto.
8937         * testsuite/arm_branch_out_of_range.sh: New file.
8938         * testsuite/arm_cortex_a8.sh: Ditto.
8939         * testsuite/arm_cortex_a8_b.s: Ditto.
8940         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
8941         * testsuite/arm_cortex_a8_b_local.s: Ditto.
8942         * testsuite/arm_cortex_a8_bl.s: Ditto.
8943         * testsuite/arm_cortex_a8_blx.s: Ditto.
8944         * testsuite/arm_cortex_a8_local.s: Ditto.
8945         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
8946         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
8947
8948 2010-09-08  Rafael Espindola  <espindola@google.com>
8949
8950         * Makefile.am (memory_test.stdout): Run readelf with -W.
8951         * Makefile.in: Regenerate.
8952         * testsuite/memory_test.sh: Make the regexps accept both 32 and
8953         64 bit output.
8954
8955 2010-09-08  Rafael Espindola  <espindola@google.com>
8956
8957         * script-sections.cc (Script_sections::add_memory_region): Convert
8958         field precision to int.
8959         * script.cc (script_set_section_region, script_set_section_region):
8960         Convert field precision to int.
8961
8962 2010-09-08  Rafael Espindola  <espindola@google.com>
8963
8964         * arm.cc (do_finalize_sections): Create the __exidx_start and
8965         __exdix_end symbols even when the section is missing.
8966
8967 2010-09-08  Nick Clifton  <nickc@redhat.com>
8968
8969         * README: Remove claim that MEMORY is not supported.
8970         * expression.cc (script_exp_function_origin)
8971         (script_exp_function_length): Move from here to ...
8972         * script.cc: ... here.
8973         (script_set_section_region, script_add_memory)
8974         (script_parse_memory_attr, script_include_directive): New
8975         functions.
8976         * script-sections.cc
8977         (class Memory_region): New class.
8978         (class Output_section_definition): Add set_memory_region,
8979         set_section_vma, set_section_lma and get_section_name methods.
8980         (class Script_Sections): Add add_memory_region,
8981         find_memory_region, find_memory_region_origin,
8982         find_memory_region_length and set_memory_region methods.
8983         Have set_section_addresses method walk the list of set memory
8984         regions.
8985         Extend the print methos to display memory regions.
8986         * script-sections.h: Add prototypes for new methods.
8987         Add enum for MEMORY region attributes.
8988         * yyscript.y: Add support for parsing MEMORY regions.
8989         * script-c.h: Add prototypes for new functions.
8990         * testsuite/Makefile.am: Add test of MEMORY region functionality.
8991         * testsuite/Makefile.in: Regenerate.
8992         * testsuite/memory_test.sh: New script.
8993         * testsuite/memory_test.s: New assembler source file.
8994         * testsuite/memory_test.t: New linker script.
8995
8996 2010-08-27  Doug Kwan  <dougkwan@google.com>
8997
8998         * gold/resolve.cc (Symbol_table::should_override): Let a weak
8999         reference override an existing dynamic weak reference.
9000         * testsuite/Makefile.am: Add new test dyn_weak_ref.
9001         * testsuite/Makefile.in: Regenerate.
9002         * testsuite/dyn_weak_ref.sh: New file.
9003         * testsuite/dyn_weak_ref_1.c: Ditto.
9004         * testsuite/dyn_weak_ref_2.c: Ditto.
9005
9006 2010-08-27  Ian Lance Taylor  <iant@google.com>
9007
9008         * incremental.h (class Incremental_input_entry): Add virtual
9009         destructor.
9010
9011 2010-08-27  Ian Lance Taylor  <iant@google.com>
9012
9013         * testsuite/start_lib_test_3.c: Mark t3 as used.
9014
9015 2010-08-27  Nick Clifton  <nickc@redhat.com>
9016
9017         * options.cc (version_script): Fix small typo in previous
9018         whitespace tidyup.
9019
9020 2010-08-25  Nick Clifton  <nickc@redhat.com>
9021
9022         * archive.cc: Formatting fixes: Remove whitespace between
9023         typename and following asterisk.  Remove whitespace between
9024         function name and opening parenthesis.
9025         * archive.h: Likewise.
9026         * arm.cc: Likewise.
9027         * attributes.cc: Likewise.
9028         * attributes.h: Likewise.
9029         * common.cc: Likewise.
9030         * copy-relocs.cc: Likewise.
9031         * dirsearch.h: Likewise.
9032         * dynobj.cc: Likewise.
9033         * ehframe.cc: Likewise.
9034         * ehframe.h: Likewise.
9035         * expression.cc: Likewise.
9036         * fileread.cc: Likewise.
9037         * fileread.h: Likewise.
9038         * gc.h: Likewise.
9039         * gold-threads.cc: Likewise.
9040         * gold.cc: Likewise.
9041         * i386.cc: Likewise.
9042         * icf.h: Likewise.
9043         * incremental-dump.cc: Likewise.
9044         * incremental.cc: Likewise.
9045         * layout.cc: Likewise.
9046         * layout.h: Likewise.
9047         * main.cc: Likewise.
9048         * merge.cc: Likewise.
9049         * merge.h: Likewise.
9050         * object.cc: Likewise.
9051         * object.h: Likewise.
9052         * options.cc: Likewise.
9053         * options.h: Likewise.
9054         * output.cc: Likewise.
9055         * output.h: Likewise.
9056         * plugin.cc: Likewise.
9057         * plugin.h: Likewise.
9058         * powerpc.cc: Likewise.
9059         * reloc.cc: Likewise.
9060         * script-c.h: Likewise.
9061         * script-sections.cc: Likewise.
9062         * script.cc: Likewise.
9063         * stringpool.cc: Likewise.
9064         * symtab.cc: Likewise.
9065         * symtab.h: Likewise.
9066         * target.cc: Likewise.
9067         * timer.cc: Likewise.
9068         * timer.h: Likewise.
9069         * version.cc: Likewise.
9070         * x86_64.cc: Likewise.
9071
9072 2010-08-24  Nick Clifton  <nickc@redhat.com>
9073
9074         PR 11899
9075         * layout.cc (segment_precedes): Sort segments by their physical
9076         addresses, if they have been set.
9077
9078 2010-08-23  Cary Coutant  <ccoutant@google.com>
9079
9080         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
9081         symbols data.
9082         (Lib_group::include_member): Unlock object after deleting its
9083         symbols data.
9084         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
9085         the bug fixed here.
9086
9087 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
9088             Cary Coutant  <ccoutant@google.com>
9089
9090         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
9091         constructor, and set_blocker.
9092         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
9093         readsyms_blocker_.
9094         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
9095         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
9096         * testsuite/Makefile.am (start_lib_test): New test case.
9097         * testsuite/Makefile.in: Regenerate.
9098         * testsuite/start_lib_test_main.c: New file.
9099         * testsuite/start_lib_test_1.c: New file.
9100         * testsuite/start_lib_test_2.c: New file.
9101         * testsuite/start_lib_test_3.c: New file.
9102
9103 2010-08-19  Ian Lance Taylor  <iant@google.com>
9104
9105         * Makefile.in: Rebuild with automake 1.11.1.
9106         * aclocal.m4: Likewise.
9107         * testsuite/Makefile.in: Likewise.
9108
9109 2010-08-19  Ian Lance Taylor  <iant@google.com>
9110
9111         PR 10893
9112         * i386.cc (class Output_data_plt_i386): Update declarations.
9113         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
9114         local_ifuncs_ fields.
9115         (Target_i386::do_plt_section_for_global): New function.
9116         (Target_i386::do_plt_section_for_local): New function.
9117         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
9118         parameter; change all callers.  Initialize global_ifuncs_ and
9119         local_ifuncs_.  If doing a static link define __rel_iplt_start and
9120         __rel_iplt_end.
9121         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
9122         (Output_data_plt_i386::add_local_ifunc_entry): New function.
9123         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
9124         symbols.
9125         (Target_i386::make_plt_section): New function, broken out of
9126         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
9127         (Target_i386::make_plt_entry): Call make_plt_section.
9128         (Target_i386::make_local_ifunc_plt_entry): New function.
9129         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
9130         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
9131         R_386_IRELATIVE to switch.
9132         (Target_i386::Scan::global): Likewise.
9133         (Target_i386::Relocate::relocate): Likewise.
9134         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
9135         switch.
9136         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
9137         (Target_x86_64::do_plt_section_for_global): New function.
9138         (Target_x86_64::do_plt_section_for_local): New function.
9139         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
9140         parameter; change all callers.  If doing a static link define
9141         __rela_iplt_start and __rela_iplt_end.
9142         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
9143         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
9144         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
9145         to point to .plt.
9146         (Target_x86_64::make_local_ifunc_plt_entry): New function.
9147         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
9148         switch.
9149         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
9150         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
9151         R_X86_64_IRELATIVE to switch.
9152         (Target_x86_64::Scan::global): Likewise.
9153         (Target_x86_64::Relocate::relocate): Likewise.
9154         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
9155         switch.
9156         * target.h (class Target): Add plt_section_for_global and
9157         plt_section_for_local functions.  Add do_plt_section_for_global
9158         and do_plt_section_for_local virtual functions.
9159         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
9160         clarifying comments.
9161         (Symbol::use_plt_offset): Handle IFUNC symbol.
9162         * object.cc (Sized_relobj::Sized_relobj): Initialize
9163         local_plt_offsets_.
9164         (Sized_relobj::local_has_plt_offset): New function.
9165         (Sized_relobj::local_plt_offset): New function.
9166         (Sized_relobj::set_local_plt_offset): New function.
9167         (Sized_relobj::do_count): Handle IFUNC symbol.
9168         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
9169         a bit away from input_shndx_ field.  Add set_is_func_symbol and
9170         is_ifunc_symbol functions.
9171         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
9172         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
9173         local_plt_offsets_ field.
9174         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
9175         * output.h (class Output_section_data): Add non-const
9176         output_section function.
9177         (class Output_data_got): Update declarations.
9178         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
9179         Add use_plt_offset parameter to global and local constructors.
9180         Change all callers.  Change local_sym_index_ field to 31 bits.
9181         Change GSYM_CODE and CONSTANT_CODE accordingly.
9182         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
9183         doing a static link don't set sh_link field.
9184         (Output_data_got::Got_entry::write): Use PLT offset if
9185         appropriate.
9186         (Output_data_got::add_global_plt): New function.
9187         (Output_data_got::add_local_plt): New function.
9188         * target-reloc.h (relocate_section): Handle IFUNC symbol.
9189         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
9190         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
9191         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
9192         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
9193         IFUNC conditional.
9194         * testsuite/ifunc-sel.h: New file.
9195         * testsuite/ifuncmain1.c: New file.
9196         * testsuite/ifuncmain1vis.c: New file.
9197         * testsuite/ifuncmod1.c: New file.
9198         * testsuite/ifuncdep2.c: New file.
9199         * testsuite/ifuncmain2.c: New file.
9200         * testsuite/ifuncmain3.c: New file.
9201         * testsuite/ifuncmod3.c: New file.
9202         * testsuite/ifuncmain4.c: New file.
9203         * testsuite/ifuncmain5.c: New file.
9204         * testsuite/ifuncmod5.c: New file.
9205         * testsuite/ifuncmain6pie.c: New file.
9206         * testsuite/ifuncmod6.c: New file.
9207         * testsuite/ifuncmain7.c: New file.
9208         * configure, testsuite/Makefile.in: Rebuild.
9209
9210 2010-08-18  Ian Lance Taylor  <iant@google.com>
9211
9212         * incremental.cc
9213         (Output_section_incremental_inputs::write_input_files): Add cast
9214         to avoid signed/unsigned comparison warning.
9215         (Output_section_incremental_inputs::write_info_blocks): Likewise.
9216
9217 2010-08-12  Cary Coutant  <ccoutant@google.com>
9218
9219         * common.cc (Sort_commons::operator()): Remove unnecessary code.
9220
9221 2010-08-13  Ian Lance Taylor  <iant@google.com>
9222
9223         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
9224
9225 2010-08-12  Cary Coutant  <ccoutant@google.com>
9226             Doug Kwan  <dougkwan@google.com>
9227
9228         * resolve.cc (Symbol_table::should_override): When a weak dynamic
9229         defintion overrides non-weak undef, remember that the original undef
9230         is not weak.
9231         * symtab.cc (Symbol_table::sized_write_global): For undef without
9232         an original weak binding, set binding to global in output.
9233         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
9234         * testsuite/Makefile.in: Regenerate.
9235         * testsuite/strong_ref_weak_def.sh: New file.
9236         * testsuite/strong_ref_weak_def_1.c: Ditto.
9237         * testsuite/strong_ref_weak_def_2.c: Ditto.
9238
9239 2010-08-12  Cary Coutant  <ccoutant@google.com>
9240
9241         * testsuite/incremental_test.sh: Rewrite.
9242         * testsuite/incremental_test_1.c: Rewrite.
9243         * testsuite/incremental_test_2.c: Rewrite.
9244
9245 2010-08-12  Cary Coutant  <ccoutant@google.com>
9246
9247         * arm.cc (Target_arm::got_size): Add const.
9248         (Target_arm::got_entry_count): New function.
9249         (Target_arm::plt_entry_count): New function.
9250         (Target_arm::first_plt_entry_offset): New function.
9251         (Target_arm::plt_entry_size): New function.
9252         (Output_data_plt_arm::entry_count): New function.
9253         (Output_data_plt_arm::first_plt_entry_offset): New function.
9254         (Output_data_plt_arm::get_plt_entry_size): New function.
9255         * i386.cc (Target_i386::got_size): Add const.
9256         (Target_i386::got_entry_count): New function.
9257         (Target_i386::plt_entry_count): New function.
9258         (Target_i386::first_plt_entry_offset): New function.
9259         (Target_i386::plt_entry_size): New function.
9260         (Output_data_plt_i386::entry_count): New function.
9261         (Output_data_plt_i386::first_plt_entry_offset): New function.
9262         (Output_data_plt_i386::get_plt_entry_size): New function.
9263         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
9264         find_incremental_inputs_sections.  Dump incremental_got_plt section.
9265         * incremental.cc: Include target.h.
9266         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
9267         parameter.  Adjust all callers.  Find incremental_got_plt section.
9268         (Incremental_inputs::create_data_sections): Create incremental_got_plt
9269         section.
9270         (Output_section_incremental_inputs::set_final_data_size): Calculate
9271         size of incremental_got_plt section.
9272         (Output_section_incremental_inputs::do_write): Write the
9273         incremental_got_plt section.
9274         (Got_plt_view_info): New struct.
9275         (Local_got_offset_visitor): New class.
9276         (Global_got_offset_visitor): New class.
9277         (Global_symbol_visitor_got_plt): New class.
9278         (Output_section_incremental_inputs::write_got_plt): New function.
9279         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
9280         Add parameter.  Adjust all callers.
9281         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9282         (Incremental_inputs::got_plt_section): New function.
9283         (Incremental_inputs::got_plt_section_): New data member.
9284         (Incremental_got_plt_reader): New class.
9285         * layout.cc (Layout::create_incremental_info_sections): Add the
9286         incremental_got_plt section.
9287         * object.h (Got_offset_list::get_list): New function.
9288         (Got offset_list::for_all_got_offsets): New function.
9289         (Sized_relobj::local_got_offset_list): New function.
9290         * powerpc.cc (Target_powerpc::got_size): Add const.
9291         (Target_powerpc::got_entry_count): New function.
9292         (Target_powerpc::plt_entry_count): New function.
9293         (Target_powerpc::first_plt_entry_offset): New function.
9294         (Target_powerpc::plt_entry_size): New function.
9295         (Output_data_plt_powerpc::entry_count): New function.
9296         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
9297         (Output_data_plt_powerpc::get_plt_entry_size): New function.
9298         * sparc.cc (Target_sparc::got_size): Add const.
9299         (Target_sparc::got_entry_count): New function.
9300         (Target_sparc::plt_entry_count): New function.
9301         (Target_sparc::first_plt_entry_offset): New function.
9302         (Target_sparc::plt_entry_size): New function.
9303         (Output_data_plt_sparc::entry_count): New function.
9304         (Output_data_plt_sparc::first_plt_entry_offset): New function.
9305         (Output_data_plt_sparc::get_plt_entry_size): New function.
9306         * symtab.h (Symbol::got_offset_list): New function.
9307         (Symbol_table::for_all_symbols): New function.
9308         * target.h (Sized_target::got_entry_count): New function.
9309         (Sized_target::plt_entry_count): New function.
9310         (Sized_target::plt_entry_size): New function.
9311         * x86_64.cc (Target_x86_64::got_size): Add const.
9312         (Target_x86_64::got_entry_count): New function.
9313         (Target_x86_64::plt_entry_count): New function.
9314         (Target_x86_64::first_plt_entry_offset): New function.
9315         (Target_x86_64::plt_entry_size): New function.
9316         (Output_data_plt_x86_64::entry_count): New function.
9317         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
9318         (Output_data_plt_x86_64::get_plt_entry_size): New function.
9319
9320 2010-08-12  Cary Coutant  <ccoutant@google.com>
9321
9322         * archive.cc: Include incremental.h.
9323         (Archive::Archive): Initialize incremental_info_.
9324         (Archive::include_member): Record archive members in incremental info.
9325         (Add_archive_symbols::run): Record begin and end of an archive in
9326         incremental info.
9327         (Lib_group::include_member): Record objects in incremental info.
9328         * archive.h (Incremental_archive_entry): Forward declaration.
9329         (Archive::set_incremental_info): New member function.
9330         (Archive::incremental_info): New member function.
9331         (Archive::Unused_symbol_iterator): New class.
9332         (Archive::unused_symbols_begin): New member function.
9333         (Archive::unused_symbols_end): New member function.
9334         (Archive::incremental_info_): New data member.
9335         * incremental-dump.cc (find_input_containing_global): New function.
9336         (dump_incremental_inputs): Dump new incremental info sections.
9337         * incremental.cc: Include symtab.h.
9338         (Output_section_incremental_inputs): New class.
9339         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
9340         new incremental info sections.
9341         (Sized_incremental_binary::do_check_inputs): Likewise.
9342         (Incremental_inputs::report_archive): Remove.
9343         (Incremental_inputs::report_archive_begin): New function.
9344         (Incremental_inputs::report_archive_end): New function.
9345         (Incremental_inputs::report_object): New function.
9346         (Incremental_inputs::finalize_inputs): Remove.
9347         (Incremental_inputs::report_input_section): New function.
9348         (Incremental_inputs::report_script): Rewrite.
9349         (Incremental_inputs::finalize): Do nothing but finalize string table.
9350         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9351         (Incremental_inputs::sized_create_inputs_section_data): Remove.
9352         (Incremental_inputs::create_data_sections): New function.
9353         (Incremental_inputs::relocs_entsize): New function.
9354         (Output_section_incremental_inputs::set_final_data_size): New function.
9355         (Output_section_incremental_inputs::do_write): New function.
9356         (Output_section_incremental_inputs::write_header): New function.
9357         (Output_section_incremental_inputs::write_input_files): New function.
9358         (Output_section_incremental_inputs::write_info_blocks): New function.
9359         (Output_section_incremental_inputs::write_symtab): New function.
9360         * incremental.h (Incremental_script_entry): Forward declaration.
9361         (Incremental_object_entry): Forward declaration.
9362         (Incremental_archive_entry): Forward declaration.
9363         (Incremental_inputs): Forward declaration.
9364         (Incremental_inputs_header_data): Remove.
9365         (Incremental_inputs_header): Remove.
9366         (Incremental_inputs_header_write): Remove.
9367         (Incremental_inputs_entry_data): Remove.
9368         (Incremental_inputs_entry): Remove.
9369         (Incremental_inputs_entry_write): Remove.
9370         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
9371         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
9372         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9373         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
9374         Likewise.
9375         (Incremental_input_entry): New class.
9376         (Incremental_script_entry): New class.
9377         (Incremental_object_entry): New class.
9378         (Incremental_archive_entry): New class.
9379         (Incremental_inputs::Incremental_inputs): Initialize new data members.
9380         (Incremental_inputs::report_inputs): Remove.
9381         (Incremental_inputs::report_archive): Remove.
9382         (Incremental_inputs::report_archive_begin): New function.
9383         (Incremental_inputs::report_archive_end): New function.
9384         (Incremental_inputs::report_object): Change prototype.
9385         (Incremental_inputs::report_input_section): New function.
9386         (Incremental_inputs::report_script): Change prototype.
9387         (Incremental_inputs::get_reloc_count): New function.
9388         (Incremental_inputs::set_reloc_count): New function.
9389         (Incremental_inputs::create_data_sections): New function.
9390         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9391         (Incremental_inputs::inputs_section): New function.
9392         (Incremental_inputs::symtab_section): New function.
9393         (Incremental_inputs::relocs_section): New function.
9394         (Incremental_inputs::get_stringpool): Add const.
9395         (Incremental_inputs::command_line): Add const.
9396         (Incremental_inputs::inputs): Remove.
9397         (Incremental_inputs::command_line_key): New function.
9398         (Incremental_inputs::input_file_count): New function.
9399         (Incremental_inputs::input_files): New function.
9400         (Incremental_inputs::relocs_entsize): New function.
9401         (Incremental_inputs::sized_create_inputs_section_data): Remove.
9402         (Incremental_inputs::finalize_inputs): Remove.
9403         (Incremental_inputs::Input_info): Remove.
9404         (Incremental_inputs::lock_): Remove.
9405         (Incremental_inputs::inputs_): Change type.
9406         (Incremental_inputs::inputs_map_): Remove.
9407         (Incremental_inputs::current_object_entry_): New data member.
9408         (Incremental_inputs::inputs_section_): New data member.
9409         (Incremental_inputs::symtab_section_): New data member.
9410         (Incremental_inputs::relocs_section_): New data member.
9411         (Incremental_inputs::reloc_count_): New data member.
9412         (Incremental_inputs_reader): New class.
9413         (Incremental_symtab_reader): New class.
9414         (Incremental_relocs_reader): New class.
9415         * layout.cc (Layout::finalize): Move finalization of incremental info
9416         and creation of incremental info sections to follow finalization of
9417         symbol table.  Set offsets for postprocessing sections.
9418         (Layout::create_incremental_info_sections): Call
9419         Incremental_inputs::create_data_sections.  Add incremental symtab
9420         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
9421         sections to layout after input sections.
9422         * layout.h (struct Timespec): Forward declaration.
9423         (Layout::incremental_inputs): Add const.
9424         (Layout::create_incremental_info_sections): Add parameter.
9425         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
9426         * object.cc: Include incremental.h.
9427         (Relobj::finalize_incremental_relocs): New function.
9428         (Sized_relobj::do_layout): Record input sections in incremental info.
9429         * object.h (Object::output_section): New function.
9430         (Object::output_section_offset): Moved from Relobj.
9431         (Object::get_incremental_reloc_base): New function.
9432         (Object::get_incremental_reloc_count): New function.
9433         (Object::do_output_section): New function.
9434         (Object::do_output_section_offset): Moved from Relobj.
9435         (Object::do_get_incremental_reloc_base): New function.
9436         (Object::do_get_incremental_reloc_count): New function.
9437         (Object::Object): Initialize new data members.
9438         (Relobj::output_section): Renamed do_output_section and moved to
9439         protected.
9440         (Relobj::output_section_offset): Moved to Object.
9441         (Relobj::do_get_incremental_reloc_base): New function.
9442         (Relobj::do_get_incremental_reloc_count): New function.
9443         (Relobj::allocate_incremental_reloc_counts): New function.
9444         (Relobj::count_incremental_reloc): New function.
9445         (Relobj::finalize_incremental_relocs): New function.
9446         (Relobj::next_incremental_reloc_index): New function.
9447         (Relobj::reloc_counts_): New data member.
9448         (Relobj::reloc_bases_): New data member.
9449         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
9450         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
9451         (Sized_relobj::incremental_relocs_scan): New function.
9452         (Sized_relobj::incremental_relocs_scan_reltype): New function.
9453         (Sized_relobj::incremental_relocs_write): New function.
9454         (Sized_relobj::incremental_relocs_write_reltype): New function.
9455         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
9456         incremental link.
9457         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
9458         archives and object files elsewhere.
9459         (Add_symbols::run): Report object files here.
9460         (Finish_group::run): Report end of archive at end of group.
9461         * reloc.cc: Include layout.h, incremental.h.
9462         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
9463         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
9464         (Sized_relobj::incremental_relocs_scan): New function.
9465         (Sized_relobj::incremental_relocs_scan_reltype): New function.
9466         (Sized_relobj::do_relocate_sections): Write incremental relocations.
9467         (Sized_relobj::incremental_relocs_write): New function.
9468         (Sized_relobj::incremental_relocs_write_reltype): New function.
9469         * script.cc (read_input_script): Rewrite test for incremental link.
9470         Change call to Incremental_inputs::report_script.
9471         * symtab.h (Symbol_table::first_global_index): New function.
9472         (Symbol_table::output_count): New function.
9473
9474 2010-08-12  Doug Kwan  <dougkwan@google.com>
9475
9476         * arm.cc (Target_arm::merge_object_attributes): Check command line
9477         options --no-wchar-size-warning and --no-enum-size-warning.
9478         * options.h (General_options): Add ld-compatible options
9479         --no-enum-size-warning and --no-wchar-size-warning.
9480
9481 2010-08-04  Ian Lance Taylor  <iant@google.com>
9482
9483         * x86_64.cc (Target_x86_64::Scan::local): Use
9484         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
9485         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
9486         (Target_x86_64::Scan::global): Likewise.
9487         (Target_x86_64::Relocate::relocate): Likewise.
9488         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
9489         Likewise.
9490
9491 2010-08-03  Cary Coutant  <ccoutant@google.com>
9492
9493         * merge.cc (Output_merge_string::do_add_input_section): Count strings
9494         to reserve space in merged_strings vector. Keep total input size
9495         for stats.
9496         (Output_merge_string::do_print_merge_stats): Print total input size.
9497         * merge.h (Output_merge_string): Add input_size_ field.
9498         * stringpool.cc (Stringpool_template::string_length): Move
9499         implementations out of Stringpool_template class and place in
9500         stringpool.h.
9501         * stringpool.h (string_length): Move out of Stringpool_template.
9502
9503 2010-08-03  Ian Lance Taylor  <iant@google.com>
9504
9505         PR 11712
9506         * layout.cc (relaxation_loop_body): If address of load segment is
9507         set, adjust address to include headers if possible.
9508
9509 2010-08-03  Ian Lance Taylor  <iant@google.com>
9510
9511         * version.cc (version_string): Bump to 1.10.
9512
9513 2010-08-03  Ian Lance Taylor  <iant@google.com>
9514
9515         PR 11805
9516         * layout.h (enum Output_section_order): Define.
9517         (class Layout): Update declarations.
9518         * layout.cc (Layout::get_output_section): Add order parameter.
9519         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
9520         is_first_non_relro parameters.  Change all callers.
9521         (Layout::choose_output_section): Likewise.
9522         (Layout::add_output_section_data): Likewise.
9523         (Layout::make_output_section): Likewise.  Set order.
9524         (Layout::default_section_order): New function.
9525         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
9526         * output.cc (Output_section::Output_section): Initialize order_.
9527         Don't initialize deleted fields.
9528         (Output_segment::Output_segment): Don't initialize deleted
9529         fields.
9530         (Output_segment::add_output_section_to_load): New function
9531         replacing add_output_section.  Change all callers to call this or
9532         add_output_section_to_nonload.
9533         (Output_segment::add_output_section_to_nonload): New function.
9534         (Output_segment::remove_output_section): Rewrite.
9535         (Output_segment::add_initial_output_data): Likewise.
9536         (Output_segment::has_any_data_sections): Likewise.
9537         (Output_segment::is_first_section_relro): Likewise.
9538         (Output_segment::maximum_alignment): Likewise.
9539         (Output_segment::has_dynamic_reloc): New function replacing
9540         dynamic_reloc_count.  Change all callers.
9541         (Output_segment::has_dynamic_reloc_list): New function replacing
9542         dynamic_reloc_count_list.  Change all callers.
9543         (Output_segment::set_section_addresses): Rewrite.
9544         (Output_segment::set_offset): Rewrite.
9545         (Output_segment::find_first_and_last_list): Remove.
9546         (Output_segment::set_tls_offsets): Rewrite.
9547         (Output_segment::first_section_load_address): Likewise.
9548         (Output_segment::output_section_count): Likewise.
9549         (Output_segment::section_with_lowest_load_address): Likewise.
9550         (Output_segment::write_section_headers): Likewise.
9551         (Output_segment::print_sections_to_map): Likewise.
9552         * output.h (class Output_data): Remove dynamic_reloc_count_
9553         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
9554         (Output_data::add_dynamic_reloc): Rewrite.
9555         (Output_data::has_dynamic_reloc): New function.
9556         (Output_data::dynamic_reloc_count): Remove.
9557         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
9558         is_last_relro_, is_first_non_relro_, is_interp_,
9559         is_dynamic_linker_section_ fields.  Add order and set_order
9560         functions.  Remove is_relro_local, set_is_relro_local,
9561         is_last_relro, set_is_last_relro, is_first_non_relro,
9562         set_is_first_non_relro functions, is_interp, set_is_interp,
9563         is_dynamic_linker_section, and set_is_dynamic_linker_section
9564         functions.
9565         (class Output_segment): Change Output_data_list from std::list to
9566         std:;vector.  Add output_lists_ field.  Remove output_data_ and
9567         output_bss_ fields.  Update declarations.
9568
9569 2010-08-02  Ian Lance Taylor  <iant@google.com>
9570
9571         * arm.cc (Target_arm::gc_process_relocs): Use typename.
9572         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
9573         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
9574
9575 2010-08-02  Ian Lance Taylor  <iant@google.com>
9576
9577         PR 11855
9578         * script.cc (Script_options::Script_options): Initialize
9579         symbol_definitions_ and symbol_references_.
9580         (Script_options::add_symbol_assignment): Update
9581         symbol_definitions_ and symbol_references_.
9582         (Script_options::add_symbol_reference): New function.
9583         (script_symbol): New function.
9584         * script.h (class Script_options): Add symbol_definitions_ and
9585         symbol_references_ fields.
9586         (Script_options::referenced_const_iterator): New type.
9587         (Script_options::referenced_begin): New function.
9588         (Script_options::referenced_end): New function.
9589         (Script_options::is_referenced): New function.
9590         (Script_options::any_unreferenced): New function.
9591         * script-c.h (script_symbol): Declare.
9592         * yyscript.y (exp): Call script_symbol.
9593         * symtab.cc: Include "script.h".
9594         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
9595         Change all callers.  Check symbols referenced by scripts.
9596         (Symbol_table::add_undefined_symbols_from_command_line): Add
9597         layout parameter.  Change all callers.
9598         (Symbol_table::do_add_undefined_symbols_from_command_line):
9599         Likewise.  Break out loop body.  Check symbols referenced by
9600         scripts.
9601         (Symbol_table::add_undefined_symbol_from_command_line): New
9602         function broken out of
9603         do_add_undefined_symbols_from_command_line.
9604         * symtab.h (class Symbol_table): Update declarations.
9605         * archive.cc: Include "layout.h".
9606         (Archive::should_include_member): Add layout parameter.  Change
9607         all callers.  Check for symbol mentioned in expression.
9608         * archive.h (class Archive): Update declaration.
9609         * object.cc (Sized_relobj::do_should_include_member): Add layout
9610         parameter.
9611         * object.h (Object::should_include_member): Add layout parameter.
9612         Change all callers.
9613         (Object::do_should_include_member): Add layout parameter.
9614         (class Sized_relobj): Update declaration.
9615         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
9616         parameter.
9617         * dynobj.h (class Sized_dynobj): Update declaration.
9618         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
9619         layout parameter.
9620         * plugin.h (class Sized_pluginobj): Update declaration.
9621
9622 2010-08-02  Ian Lance Taylor  <iant@google.com>
9623
9624         PR 11866
9625         * output.cc (Output_segment::set_offset): Search for the first and
9626         last sections rather than assuming that the list is in order.
9627         (Output_segment::find_first_and_last_list): New function.
9628         * output.h (class Output_segment): Update declarations.
9629         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
9630         (relro_strip_test_SOURCES): New variable.
9631         (relro_strip_test_DEPENDENCIES): New variable.
9632         (relro_strip_test_LDFLAGS): New variable.
9633         (relro_strip_test_LDADD): New variable.
9634         (relro_strip_test.so): New target.
9635
9636 2010-08-02  Ian Lance Taylor  <iant@google.com>
9637
9638         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
9639         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
9640         (Target_i386::got_tlsdesc_section): New function.
9641         (Target_i386::got_section): Create space for GOT entries for
9642         TLSDESC relocations.
9643         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
9644         R_386_TLS_GOTDESC.
9645         (Target_i386::Scan::global): Likewise.
9646         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
9647         using TLSDESC GOT.
9648         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
9649         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
9650         (Target_x86_64::got_tlsdesc_section): New function.
9651         (Target_x86_64::got_section): Create space for GOT entries for
9652         TLSDESC relocations.
9653         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
9654         R_386_TLS_GOTDESC.
9655         (Target_x86_64::Scan::global): Likewise.
9656         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
9657         using TLSDESC GOT.
9658
9659 2010-08-02  Ian Lance Taylor  <iant@google.com>
9660
9661         * testsuite/final_layout.sh: Use dc to convert from hex to
9662         decimal.
9663
9664 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
9665
9666         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
9667         paramter to the call to gold::gc_process_relocs.
9668         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
9669         paramter to the call to gold::gc_process_relocs.
9670         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
9671         parameter to the call to gold::gc_process_relocs.
9672         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
9673         template parameter to the call to gold::gc_process_relocs.
9674         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
9675         paramter to the call to gold::gc_process_relocs.
9676         * gc.h (get_embedded_addend_size): New function.
9677         (gc_process_relocs): Save the size of the reloc for use by ICF.
9678         * icf.cc (get_section_contents): Get the addend from the text section
9679         for SHT_REL relocation sections.
9680         * icf.h (Icf::Reloc_addend_size_info): New typedef.
9681         (Icf::Reloc_info): Add new member reloc_addend_size_info.
9682         * int_encoding.h (read_from_pointer): New overloaded function.
9683         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
9684         * testsuite/icf_sht_rel_addend_test.sh: New file.
9685         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
9686         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
9687
9688 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9689
9690         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
9691         * Makefile.in: Regenerate.
9692         * testsuite/Makefile.in: Regenerate.
9693
9694 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
9695
9696         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
9697         * gold/testsuite/debug_msg.cc: Likewise.
9698         * gold/testsuite/odr_violation1.cc
9699         * gold/testsuite/odr_violation2.cc
9700
9701 2010-07-21  Cary Coutant  <ccoutant@google.com>
9702
9703         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
9704         string, and length fields.
9705         (Output_merge_string::Merged_strings_list): New type.
9706         (Output_merge_string::Merged_strings_lists): New typedef.
9707         (Output_merge_string): Replace merged_strings_ with
9708         merged_strings_lists_.
9709         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
9710         Merged_strings_list per input object and section.  Don't store pointer
9711         to the string.  Don't store length with each merged string entry.
9712         (Output_merge_string::finalize_merged_data): Loop over list of merged
9713         strings lists.  Recompute length of each merged string.
9714
9715 2010-07-15  Cary Coutant  <ccoutant@google.com>
9716
9717         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
9718         here.
9719
9720 2010-07-14  Ian Lance Taylor  <iant@google.com>
9721
9722         * descriptors.cc (Descriptors::open): Report correct name in error
9723         message.
9724
9725 2010-07-13  Doug Kwan  <dougkwan@google.com>
9726
9727         * arm.cc (Arm_input_section::Arm_input_section): For a
9728         SHT_ARM_EXIDX section, always keeps the input sections.
9729         (Arm_input_section::set_exidx_section_link): New method.
9730         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
9731         has_errors_ to false.
9732         (Arm_exidx_input_section::has_errors,
9733         Arm_exidx_input_section::set_has_errors): New methods.
9734         (Arm_exidx_input_section::has_errors_): New data member.
9735         (Arm_relobj::get_exidx_shndx_list): New method.
9736         (Arm_output_section::append_text_sections_to_list): Do not skip
9737         section without SHF_EXECINSTR.
9738         (Arm_output_section::fix_exidx_coverage): Skip input sections with
9739         errors.
9740         (Arm_relobj::make_exidx_input_section): Add new parameter for text
9741         section header.  Make error messages more verbose.  Check for
9742         a non-executable section linked to an EXIDX section.
9743         (Arm_relobj::do_read_symbols): Remove error checking, which has been
9744         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
9745         check that there is no deferred EXIDX section if we exit early.
9746         Instead of not making an EXIDX section in case of an error, make one
9747         and set the has_errors flag of it.
9748         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
9749         in a relocatable link.
9750         (Target_arm::do_relax): Look for the EXIDX output section instead of
9751         assuming that it is called .ARM.exidx.
9752         (Target_arm::fix_exidx_coverage): Add a new parameter for input
9753         section list.  Do not check for SHF_EXECINSTR section flags but
9754         skip any input section with errors.
9755         * output.cc (Output_section::Output_section): Initialize
9756         always_keeps_input_sections_ to false.
9757         (Output_section::add_input_section): Check for
9758         always_keeps_input_sections_.
9759         *  output.h (Output_section::always_keeps_input_sections,
9760         Output_section::set_always_keeps_input_sections): New methods.
9761         (Output_section::always_keeps_input_sections): New data member.
9762
9763 2010-07-13  Rafael Espindola  <espindola@google.com>
9764
9765         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
9766         * fileread.h (Input_file): Add try_extra_search_path and find_file.
9767
9768 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
9769             Ian Lance Taylor  <iant@google.com>
9770
9771         * output.h (Output_section_lookup_maps::add_merge_section):
9772         Correct check of whether value was inserted.
9773         (Output_section_lookup_maps::add_merge_input_section): Likewise.
9774         (Output_section_lookup_maps::add_relaxed_input_section):
9775         Likewise.
9776         * arm.cc (Target_arm::got_section): Remove used local os.
9777         * i386.cc (Target_i386::got_section): Likewise.
9778         * x86_64.cc (Target_x86_64::got_section): Likewise.
9779         * sparc.cc (Target_sparc::got_section): Likewise.
9780         (Target_sparc::relocate): Remove unused local have_got_offset.
9781         * powerpc.cc (Target_powerpc::relocate): Likewise.
9782
9783 2010-07-13  Ian Lance Taylor  <iant@google.com>
9784
9785         * compressed_output.cc (zlib_decompress): Fix signature in
9786         !HAVE_ZLIB_H case.
9787
9788         * archive.cc (Archive::include_member): Unlock an external member
9789         of a thin archive.  Don't bother to delete an object we know is
9790         NULL.
9791
9792 2010-07-12  Cary Coutant  <ccoutant@google.com>
9793
9794         * compressed_output.cc (zlib_decompress): New function.
9795         (get_uncompressed_size): New function.
9796         (decompress_input_section): New function.
9797         * compressed_output.h (get_uncompressed_size): New function.
9798         (decompress_input_section): New function.
9799         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
9800         Handle compressed debug sections.
9801         * layout.cc (is_compressed_debug_section): New function.
9802         (Layout::output_section_name): Map compressed section names to
9803         canonical names.
9804         * layout.h (is_compressed_debug_section): New function.
9805         (is_debug_info_section): Recognize compressed debug sections.
9806         * merge.cc: Include compressed_output.h.
9807         (Output_merge_data::do_add_input_section): Handle compressed
9808         debug sections.
9809         (Output_merge_string::do_add_input_section): Handle compressed
9810         debug sections.
9811         * object.cc: Include compressed_output.h.
9812         (Sized_relobj::Sized_relobj): Initialize new data members.
9813         (build_compressed_section_map): New function.
9814         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
9815         * object.h (Object::section_is_compressed): New method.
9816         (Object::do_section_is_compressed): New method.
9817         (Sized_relobj::Compressed_section_map): New type.
9818         (Sized_relobj::do_section_is_compressed): New method.
9819         (Sized_relobj::compressed_sections_): New data member.
9820         * output.cc (Output_section::add_input_section): Handle compressed
9821         debug sections.
9822         * reloc.cc: Include compressed_output.h.
9823         (Sized_relobj::write_sections): Handle compressed debug sections.
9824
9825 2010-07-08  Cary Coutant  <ccoutant@google.com>
9826
9827         * resolve.cc (Symbol_table::resolve): Remember whether undef was
9828         weak when resolving to a dynamic def.
9829         (Symbol_table::should_override): Add adjust_dyndef flag; set it
9830         for weak undef/dynamic def cases. Adjust callers.
9831         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
9832         undef_binding_weak_.
9833         (Symbol_table::sized_write_globals): Adjust symbol binding.
9834         (Symbol_table::sized_write_symbol): Add binding parameter.
9835         * symtab.h (Symbol::set_undef_binding): New method.
9836         (Symbol::is_undef_binding_weak): New method.
9837         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
9838         (Symbol_table::should_override): Add new parameter.
9839         (Symbol_table::sized_write_symbol): Add new parameter.
9840
9841         * testsuite/weak_undef_file1.cc: Add new test case.
9842         * testsuite/weak_undef_file2.cc: Fix header comment.
9843         * testsuite/weak_undef_test.cc: Add new test case.
9844
9845 2010-06-29  Doug Kwan  <dougkwan@google.com>
9846
9847         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
9848         Initialize USE_SYMBOL_.
9849         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
9850         definition.
9851         (Arm_reloc_property::uses_symbol_): New data member declaration.
9852         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
9853         uses symbol value and symbol is undefined but not weakly undefined.
9854
9855 2010-06-28  Rafael Espindola  <espindola@google.com>
9856
9857         * plugin.cc (Plugin::load): Use dlerror.
9858
9859 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
9860
9861         * symtab.cc (detect_odr_violations): When reporting an ODR
9862         violation, report an object where the symbol is defined.
9863
9864 2010-06-25  Doug Kwan  <dougkwan@google.com>
9865
9866         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
9867         (Target_arm::section_may_have_icf_unsafe_pointers): New method
9868         definition.
9869         (Target_arm::Scan::local_reloc_may_be_function_pointer,
9870         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
9871         target hook to detect function points.
9872         (Target_arm::Scan::possible_function_pointer_reloc): New method.
9873         * icf.h (Icf::check_section_for_function_pointers): Change type of
9874         parameter SECTION_NAME to const reference to std::string.  Use
9875         target hook to determine if section may have unsafe pointers.
9876         * target.h (Target::section_may_have_icf_unsafe_pointers): New
9877         method definition.
9878
9879 2010-06-21  Rafael Espindola  <espindola@google.com>
9880
9881         * fileread.cc (Input_file::find_fie): New
9882         (Input_file::open): Use Input_file::find_fie.
9883         * fileread.h (Input_file::find_fie): New
9884         * plugin.cc (set_extra_library_path): New.
9885         (Plugin::load): Add set_extra_library_path to the transfer vector.
9886         (Plugin_manager::set_extra_library_path): New.
9887         (Plugin_manager::add_input_file): Use the extra search path if set.
9888         (set_extra_library_path(): New.
9889         * plugin.h (Plugin_manager): Add set_extra_library_path and
9890         extra_search_path_.
9891
9892 2010-06-19  Cary Coutant  <ccoutant@google.com>
9893
9894         * layout.cc (gdb_sections): Add .debug_types.
9895         (lines_only_debug_sections): Likewise.
9896
9897 2010-06-18  Rafael Espindola  <espindola@google.com>
9898
9899         * plugin.cc (add_input_file,add_input_library)
9900         (Plugin_manager::add_input_file): Make filename arguments const.
9901         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
9902         const.
9903
9904 2010-06-16  Doug Kwan  <dougkwan@google.com>
9905
9906         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
9907         .ARM.attributes section if we have not merged any input
9908         attributes sections.
9909
9910 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9911
9912         * arm.cc: Allow combining objects with no EABI version
9913         information.
9914
9915 2010-06-15  Rafael Espindola  <espindola@google.com>
9916
9917         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
9918
9919 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9920
9921         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
9922         (struct iovec): Correct !HAVE_READV definition.
9923
9924 2010-06-10  Cary Coutant  <ccoutant@google.com>
9925
9926         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
9927         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
9928         reloc sections.
9929         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
9930
9931         PR 11683
9932         * symtab.h (Symbol::is_placeholder): New member function.
9933         * target-reloc.h (relocate_section): Check for placeholder symbols.
9934
9935         * testsuite/Makefile.am (plugin_test_8): New test.
9936         (plugin_test_9): New test.
9937         * testsuite/Makefile.in: Regenerate.
9938
9939 2010-06-09  Nick Clifton  <nickc@redhat.com>
9940
9941         * yyscript.y (input_list_element): Allow strings prefixed with
9942         the '-' character.  Treat these as libraries.
9943         * script.cc (script_add_library): New function.  Adds a library
9944         specified by "-l<name>" found in an input script.
9945         * script-c.h: Add prototype for script_add_library.
9946
9947 2010-06-07  Doug Kwan  <dougkwan@google.com>
9948
9949         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
9950         Restrict stub-group size to be within long conditional branch
9951         range when working around cortex-A8 erratum.
9952
9953 2010-06-07  Damien Diederen  <dd@crosstwine.com>
9954
9955         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
9956         #ifdef typo.
9957
9958 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
9959
9960         PR gold/11658
9961         * output.cc
9962         (Output_section::Input_section_sort_entry::compare_section_ordering):
9963         Change to return non-zero correctly.
9964         (Output_section::Input_section_sort_section_order_index_compare
9965         ::operator()): Change to fix ambiguity in comparisons.
9966
9967 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
9968
9969         * gold.h (is_wildcard_string): New function.
9970         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
9971         (Layout::layout_eh_frame): Ditto.
9972         (Layout::find_section_order_index): New method.
9973         (Layout::read_layout_from_file): New method.
9974         * layout.h (Layout::find_section_order_index): New method.
9975         (Layout::read_layout_from_file): New method.
9976         (Layout::input_section_position_): New private member.
9977         (Layout::input_section_glob_): New private member.
9978         * main.cc (main): Call read_layout_from_file here.
9979         * options.h (--section-ordering-file): New option.
9980         * output.cc (Output_section::input_section_order_specified_): New
9981         member.
9982         (Output_section::Output_section): Initialize new member.
9983         (Output_section::add_input_section): Add new parameter.
9984         Keep input sections when --section-ordering-file is used.
9985         (Output_section::set_final_data_size): Sort input sections when
9986         section ordering file is specified.
9987         (Output_section::Input_section_sort_entry): Add new parameter.
9988         Check sorting type.
9989         (Output_section::Input_section_sort_entry::compare_section_ordering):
9990         New method.
9991         (Output_section::Input_section_sort_compare::operator()): Change to
9992         consider section_order_index.
9993         (Output_section::Input_section_sort_init_fini_compare::operator()):
9994         Change to consider section_order_index.
9995         (Output_section::Input_section_sort_section_order_index_compare
9996         ::operator()): New method.
9997         (Output_section::sort_attached_input_sections): Change to sort
9998         according to section order when specified.
9999         (Output_section::add_input_section<32, true>): Add new parameter.
10000         (Output_section::add_input_section<64, true>): Add new parameter.
10001         (Output_section::add_input_section<32, false>): Add new parameter.
10002         (Output_section::add_input_section<64, false>): Add new parameter.
10003         * output.h (Output_section::add_input_section): Add new parameter.
10004         (Output_section::input_section_order_specified): New
10005         method.
10006         (Output_section::set_input_section_order_specified): New method.
10007         (Input_section::Input_section): Initialize section_order_index_.
10008         (Input_section::section_order_index): New method.
10009         (Input_section::set_section_order_index): New method.
10010         (Input_section::section_order_index_): New member.
10011         (Input_section::Input_section_sort_section_order_index_compare): New
10012         struct.
10013         (Output_section::input_section_order_specified_): New member.
10014         * script-sections.cc (is_wildcard_string): Delete and move modified
10015         method to gold.h.
10016         (Output_section_element_input::Output_section_element_input): Modify
10017         call to is_wildcard_string.
10018         (Output_section_element_input::Input_section_pattern
10019         ::Input_section_pattern): Ditto.
10020         (Output_section_element_input::Output_section_element_input): Ditto.
10021         * testsuite/Makefile.am (final_layout): New test case.
10022         * testsuite/Makefile.in: Regenerate.
10023         * testsuite/final_layout.cc: New file.
10024         * testsuite/final_layout.sh: New file.
10025
10026 2010-06-01  Rafael Espindola  <espindola@google.com>
10027
10028         * plugin.cc (Plugin::load): Pass the output name to the plugin.
10029
10030 2010-06-01  Rafael Espindola  <espindola@google.com>
10031
10032         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
10033         visibility of symbols.
10034
10035 2010-05-27  Doug Kwan  <dougkwan@google.com>
10036
10037         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
10038         from start of output section instead of address for a local symbol
10039         in a merged or relaxed section when doing a relocatable link.
10040
10041 2010-05-26  Rafael Espindola  <espindola@google.com>
10042
10043         PR 11604
10044         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
10045         adding sections the garbage collector removed.
10046         * gold/testsuite/Makefile.am: Add test.
10047         * gold/testsuite/Makefile.in: Regenerate.
10048         * gold/testsuite/plugin_test_7.sh: New.
10049         * gold/testsuite/plugin_test_7_1.c: New.
10050         * gold/testsuite/plugin_test_7_2.c: New.
10051
10052 2010-05-26  Rafael Espindola  <espindola@google.com>
10053
10054         * script-sections.cc (Output_section_definition::set_section_addresses):
10055         Check for --section-start.
10056
10057 2010-05-26  Doug Kwan  <dougkwan@google.com>
10058
10059         * arm.cc (Arm_scan_relocatable_relocs): New class.
10060         (Target_arm::relocate_special_relocatable): New method.
10061         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
10062         (Arm_relocate_functions::thumb_branch_common): Same.
10063         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
10064         instead of Default_scan_relocatable_relocs.
10065         * target-reloc.h (relocate_for_relocatable): Let target handle
10066         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
10067         * target.h (Sized_target::relocate_special_relocatable): New method.
10068
10069 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10070
10071         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
10072
10073 2010-05-23  Doug Kwan  <dougkwan@google.com>
10074
10075         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
10076         instead of a cast.
10077         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
10078         with a direct branch, not a conditional branch, to a stub.
10079         * merge.cc (Output_merge_base::record_input_section): New method
10080         defintion.
10081         (Output_merge_data::do_add_input_section): Record input section if
10082         keeps-input-sections flag is set.
10083         (Output_merge_string::do_add_input_section): Ditto.
10084         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
10085         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
10086         INPUT_SECTIONS_.
10087         (Output_merge_base::keeps_input_sections,
10088         Output_merge_base::set_keeps_input_sections,
10089         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
10090         method definitions.
10091         (Output_merge_base::Input_sections): New type declaration.
10092         (Output_merge_base::input_sections_begin,
10093         Output_merge_base::input_sections_end,
10094         Output_merge_base::do_set_keeps_input_sections): New method definitions.
10095         (Output_merge_base::bool keeps_input_sections_,
10096         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
10097         Output_merge_base::input_sections_): New data members.
10098         (Output_merge_data::do_set_keeps_input_sections): New method
10099         defintion.
10100         (Output_merge_string::do_set_keeps_input_sections): Ditto.
10101         * output.cc (Output_section::Input_section::relobj): Move method
10102         defintion from class declaration to here and handle merge sections.
10103         (Output_section::Input_section::shndx): Ditto.
10104         (Output_section::Output_section): Remove initializations of removed
10105         data members and initialize new data member LOOKUP_MAPS_.
10106         (Output_section::add_input_section): Set keeps-input-sections flag
10107         for a newly created merge output section as appropriate.  Adjust code
10108         to use Output_section_lookup_maps class.
10109         (Output_section::add_relaxed_input_section): Adjst code for lookup
10110         maps code refactoring.
10111         (Output_section::add_merge_input_section): Add a new parameter
10112         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
10113         class.  If adding input section to a newly created merge output
10114         section fails, remove the new merge section.
10115         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
10116         Adjust code for use of the Output_section_lookup_maps class.
10117         (Output_section::find_merge_section): Ditto.
10118         (Output_section::build_lookup_maps): New method defintion.
10119         (Output_section::find_relaxed_input_section): Adjust code to use
10120         Output_section_lookup_maps class.
10121         (Output_section::get_input_sections): Export merge sections.  Adjust
10122         code to use Output_section_lookup_maps class.
10123         (Output_section:::add_script_input_section): Adjust code to use
10124         Output_section_lookup_maps class.  Update lookup maps for merge
10125         sections also.
10126         (Output_section::discard_states): Use Output_section_lookup_maps.
10127         (Output_section::restore_states): Same.
10128         * output.h (Merge_section_properties): Move class defintion out of
10129         Output_section.
10130         (Output_section_lookup_maps): New class.
10131         (Output_section::Input_section::is_merge_section): New method
10132         defintion.
10133         (Output_section::Input_section::relobj): Move defintion out of class
10134         defintion.  Declare method only.
10135         (Output_section::Input_section::shndx): Ditto.
10136         (Output_section::Input_section::output_merge_base): New method defintion.
10137         (Output_section::Input_section::u2_.pomb): New union field.
10138         (Output_section::Merge_section_by_properties_map,
10139         Output_section::Output_section_data_by_input_section_map,
10140         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
10141         Remove types.
10142         (Output_section::add_merge_input_section): Add new parameter
10143         KEEPS_INPUT_SECTIONS.
10144         (Output_section::build_lookup_maps): New method declaration.
10145         (Output_section::merge_section_map_,
10146         Output_section::merge_section_by_properties_map_,
10147         Output_section::relaxed_input_section_map_,
10148         Output_section::is_relaxed_input_section_map_valid_): Remove data
10149         members.
10150         (Output_section::lookup_maps_): New data member.
10151
10152 2010-05-21  Doug Kwan  <dougkwan@google.com>
10153
10154         PR gold/11619
10155         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
10156         avoid a compilation error.
10157
10158 2010-05-19  Rafael Espindola  <espindola@google.com>
10159
10160         * script-sections.cc (Output_section_definition::allocate_to_segment):
10161         Update the phdrs_list even when the output section is NULL.
10162         * testsuite/Makefile.am: Add test.
10163         * testsuite/Makefile.in: Regenerate.
10164         * testsuite/script_test_9.cc: New.
10165         * testsuite/script_test_9.sh: New.
10166         * testsuite/script_test_9.t: New.
10167
10168 2010-05-19  Doug Kwan  <dougkwan@google.com>
10169
10170         * arm.cc (Arm_input_section::original_size): New method.
10171         (Arm_input_section::do_addralign): Add a cast.
10172         (Arm_input_section::do_output_offset): Remove static cast.
10173         (Arm_input_section::original_addralign,
10174          Arm_input_section::original_size_): Change type to uint32_t.
10175         (Arm_input_section::init): Add safe casts for section alignment
10176         and size.
10177         (Arm_input_section::set_final_data_size): Do not set address and
10178         offset of stub table.
10179         (Arm_output_section::fix_exidx_coverage): Change use of of
10180         Output_section::Simple_input_section to that of
10181         Output_section::Input_section.
10182         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
10183         except for the first pass.
10184         * output.cc (Output_section::get_input_sections): Change type of
10185         input_sections to std::list<Input_section>.
10186         (Output_section::add_script_input_section): Rename from
10187         Output_section::add_simple_input_section.  Change type of SIS
10188         parameter from Simple_input_section to Input_section.
10189         * output.h (Output_section::Simple_input_section): Remove class.
10190         (Output_section::Input_section): Change class visibility to public.
10191         (Output_section::Input_section::addralign): Use stored alignments
10192         for special input sections if set.
10193         (Output_section::Input_section::set_addralign): New method.
10194         (Output_section::get_input_sections): Change parameter type from
10195         list of Simple_input_section to list of Input_section.
10196         (Output_section::add_script_input_section): Rename from
10197         Output_section::add_simple_input_section. Change first parameter's
10198         type from Simple_input_section to Input_section and remove the
10199         second and third parameters.
10200         * script-sections.cc (Input_section::Input_section_list): Change
10201         type to list of Output_section::Input_section/
10202         (Input_section_info::Input_section_info): Change parameter type of
10203         INPUT_SECTION to Output_section::Input_section.
10204         (Input_section_info::input_section): Change return type.
10205         (Input_section_info::input_section_): Change type to
10206         Output_section::Input_section.
10207         (Output_section_element_input::set_section_addresses): Adjust code
10208         to use Output_section::Input_section instead of
10209         Output_section::Simple_input_section.  Adjust code for renaming
10210         of Output_section::add_simple_input_section.
10211         (Orphan_output_section::set_section_addresses): Ditto.
10212
10213 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10214
10215         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
10216         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
10217
10218 2010-05-18  Rafael Espindola  <espindola@google.com>
10219
10220         * options.cc (General_options::finalize): Handle -nostdlib.
10221         * options.h (nostdlib): New option.
10222         * script.cc (script_add_search_dir): Handle -nostdlib.
10223
10224 2010-05-12  Doug Kwan  <dougkwan@google.com>
10225
10226         * arm.cc (Target_arm::do_finalize_sections): Create an empty
10227         attributes section only if there no attributes section after merging.
10228         (Target_arm::merge_object_attributes): Move value of
10229         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
10230         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
10231         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
10232         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
10233         and arm_attr_merge_7.stdout.
10234         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
10235         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
10236         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
10237         arm_attr_merge_7b.o): New rules.
10238         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
10239         arm_attr_merge_7
10240         * testsuite/Makefile.in: Regenerate.
10241         * testsuite/arm_attr_merge.sh: New file.
10242         * testsuite/arm_attr_merge_[67][ab].s: Same.
10243
10244 2010-05-05  Nick Clifton  <nickc@redhat.com>
10245
10246         * po/es.po: Updated Spanish translation.
10247
10248 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
10249
10250         * Makefile.am (install-exec-local): Properly install gold as
10251         default cross linker.
10252         * Makefile.in: Regenerated.
10253
10254 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
10255             Nick Clifton  <nickc@redhat.com>
10256
10257         * configure.ac (install_as_default): Define and set to false
10258         unless --enable-gold or --enable-gold=both/gold has been
10259         specified.
10260         * configure: Regenerate.
10261
10262         * Makefile.am (install-exec-local): Install the executable as
10263         'ld.gold'.  If install_as_default is true then also install it as
10264         'ld'.
10265         * Makefile.in: Regenerated.
10266
10267 2010-04-24  Ian Lance Taylor  <iant@google.com>
10268
10269         * layout.cc (Layout::layout_reloc): In relocatable link don't
10270         combine reloc sections for grouped sections.
10271
10272 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
10273
10274         * gc.h (gc_process_relocs): Pass information on relocs pointing to
10275         sections that are not ordinary to icf.
10276         * icf.cc (get_section_contents): Handle relocation pointing to section
10277         with no object or shndx information.
10278         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
10279         * testsuite/Makefile.in: Regenerate.
10280         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
10281         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
10282
10283 2010-04-22  Ian Lance Taylor  <iant@google.com>
10284
10285         * expression.cc (Expression::Expression_eval_info): Add
10286         result_alignment_pointer field.
10287         (Expression::eval_with_dot): Add result_alignment_pointer
10288         parameter.  Change all callers.
10289         (Expression::eval_maybe_dot): Likewise.
10290         (class Binary_expression): Add alignment_pointer parameter to
10291         left_value and right_value.  Change all callers.
10292         (BINARY_EXPRESSION): Set result alignment.
10293         (class Trinary_expression): Add alignment_pointer parameter to
10294         arg2_value and arg3_value.  Change all callers.
10295         (Trinary_cond::value): Set result alignment.
10296         (Max_expression::value, Min_expression::value): Likewise.
10297         (Align_expression::value): Likewise.
10298         * script-sections.cc (class Sections_element): Add dot_alignment
10299         parameter to set_section_addresses virtual function.  Update
10300         instantiations.
10301         (class Output_section_element): Likewise.
10302         (Script_sections::create_segments): Add dot_alignment parameter.
10303         Change all callers.
10304         (Script_sections::create_segments_from_phdrs_clause): Likewise.
10305         (Script_sections::set_phdrs_clause_addresses): Likewise.
10306         * script-sections.h: Update declarations.
10307         * script.h: Update declarations.
10308         * output.h (Output_segment::set_minimum_p_align): Don't decrease
10309         min_p_align.
10310         * testsuite/script_test_3.t: Set large alignment.
10311         * testsuite/script_test_3.sh: Make sure that at least one LOAD
10312         segment has expected alignment.
10313
10314 2010-04-22  Nick Clifton  <nickc@redhat.com>
10315
10316         * po/gold.pot: Updated by the Translation project.
10317         * po/vi.po: Updated Vietnamese translation.
10318
10319 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
10320
10321         * testsuite/Makefile.am (check_PROGRAMS): Add
10322         icf_virtual_function_folding_test.
10323         * testsuite/Makefile.in: Regenerated.
10324
10325 2010-04-15  Andrew Haley  <aph@redhat.com>
10326
10327         * options.h (merge_exidx_entries): New option.
10328         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
10329         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
10330         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
10331         (Target_arm::merge_exidx_entries): New function.
10332         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
10333         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
10334         to Arm_exidx_fixup constructor.
10335         Add new arg, merge_exidx_entries.
10336         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
10337         Arm_output_section::fix_exidx_coverage.
10338
10339 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
10340
10341         * icf.cc (get_section_contents): Check for preemptible functions.
10342         Ignore addend when appropriate.
10343         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
10344         section folded.
10345         (add_from_relobj): Check for section folded.
10346         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
10347         * symtab.h (should_add_dynsym_entry): Add new parameter.
10348         * target-reloc.h (scan_relocs): Check for section folded.
10349         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
10350         Check reloc types for function pointers in shared objects.
10351         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
10352         case.
10353         (icf_preemptible_functions_test): New test case.
10354         (icf_string_merge_test): New test case.
10355         * testsuite.Makefile.in: Regenerate.
10356         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
10357         bar_glob.  Refactor code.
10358         * testsuite/icf_preemptible_functions_test.cc: New file.
10359         * testsuite/icf_preemptible_functions_test.sh: New file.
10360         * testsuite/icf_string_merge_test.cc: New file.
10361         * testsuite/icf_string_merge_test.sh: New file.
10362         * testsuite/icf_virtual_function_folding_test.cc: New file.
10363         * testsuite/icf_virtual_function_folding_test.sh: New file.
10364
10365 2010-04-14  Doug Kwan  <dougkwan@google.com>
10366
10367         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
10368         for local symbol recounting if we remove a section due to ICF.
10369         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
10370         there are no regular objects in input.
10371
10372 2010-04-13  Doug Kwan  <dougkwan@google.com>
10373
10374         * arm.cc (Arm_input_section::set_final_data_size): Compute
10375         accurate final data size instead of using current data size.
10376
10377 2010-04-09  Doug Kwan  <dougkwan@google.com>
10378
10379         * layout.cc (Layout::choose_output_section): Handle script section
10380         types.
10381         (Layout::make_output_section_for_script): Add section type parameter.
10382         Handle script section types.
10383         * layout.h (Layout::make_output_section_for_script): Add section
10384         type parameter.
10385         * output.cc (Output_section::Output_section): Initialize data member
10386         is_noload_.
10387         (Output_section::do_reset_address_and_file_offset): Do not set address
10388         to 0 if section is a NOLOAD section.
10389         * output.h (Output_section::is_noload): New method.
10390         (Output_section::set_is_noload): Ditto.
10391         (Output_section::is_noload_): New data member.
10392         * script-c.h (Script_section_type): New enum type.
10393         (struct Parser_output_section_header): Add new file section_type.
10394         * script-sections.cc (Sections_element::output_section_name): Add
10395         parameter for returning script section type.
10396         (Output_section_definition::output_section_name): Ditto.
10397         (Output_section_definition::section_type)P; New method.
10398         (Output_section_definiton::script_section_type_name): Ditto.
10399         (Output_section_definition::script_section_type_): New data member.
10400         (Output_section_definition::Output_section_definition): Initialize
10401         data member Output_section_definition::script_section_type_.
10402         (Output_section_definition::create_sections): Pass script section type
10403         to Layout::make_output_section_for_script.
10404         (Output_section_definition::output_section_name): Return script
10405         section type to caller.
10406         (Output_section_definition::set_section_address): Do not advance
10407         dot value and load address if section type is NOLOAD.  Set address
10408         of NOLOAD sections regardless of section flags.
10409         (Output_section_definition::print): Print section type if it is
10410         not SCRIPT_SECTION_TYPE_NONE.
10411         (Output_section_definition::section_type): New method.
10412         (Output_section_definition::script_section_type_name): Ditto.
10413         (Script_sections::output_section_name): Add new parameter
10414         PSECTION_TYPE for returning script section type.  Pass it to
10415         section elements.  Handle discard sections.
10416         (Sort_output_sections::operator()): Handle NOLOAD sections.
10417         * script-sections.h (Script_sections::Section_type): New enum type.
10418         (Script_sections::output_section_name): Add a new parameter for
10419         returning script section type.
10420         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
10421         INFO and NOLOAD.
10422         * yyscript.y (union): Add new field SECTION_TYPE.
10423         (COPY, DSECT, INFO, NOLOAD): New tokens.
10424         (opt_address_and_section_type): Change type to output_section_header.
10425         (section_type): New non-terminal
10426         (section_header): Handle section type.
10427         (opt_address_and_section_type): Return section type value.
10428
10429 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
10430
10431         * testsuite/plugin_common_test_1.c (foo): Add prototype.
10432         * testsuite/plugin_common_test_2.c (foo): Likewise.
10433
10434 2010-04-08  Doug Kwan  <dougkwan@google.com>
10435
10436         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
10437         Output_merge_data.
10438         * output.cc (Output_section::add_merge_input_section): Simplify
10439         code and return status of Output_merge_base::add_input_section.
10440         Update merge section map only if Output_merge_base::add_input_section
10441         returns true.
10442
10443 2010-04-07  Doug Kwan  <dougkwan@google.com>
10444
10445         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
10446         if section is marked as containing instructions but has no mapping
10447         symbols.
10448         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
10449         correct section index.
10450         (Arm_relobj::find_linked_text_section): Ditto.
10451
10452 2010-04-07  Cary Coutant  <ccoutant@google.com>
10453
10454         * archive.cc (include_member): Destroy Read_symbols_data object before
10455         releasing file.
10456         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
10457         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
10458         (Read_symbols_data::~Read_symbols_data) New destructor.
10459         (Section_relocs::Section_relocs) New constructor.
10460         (Section_relocs::~Section_relocs) New destructor.
10461         (Read_relocs_data::Read_relocs_data) New constructor.
10462         (Read_relocs_data::~Read_relocs_data) New destructor.
10463         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
10464         pointers to NULL after deleting.
10465
10466 2010-04-07  Doug Kwan  <dougkwan@google.com>
10467
10468         * arm.cc: Replace "endianity" with "endianness" in comments.
10469         (Arm_exidx_cantunwind): Ditto.
10470         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
10471         (Arm_relobj::merge_flags_and_attributes): New method.
10472         (Arm_relobj::merge_flags_and_attributes_): New data member.
10473         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
10474         (Arm_relobj::scan_sections_for_stubs): Ditto.
10475         (Arm_relobj::do_read_symbols): Check to see if we really want to
10476         merge processor-specific flags and attributes.  Exit early if
10477         an object is empty except for section names and the undefined symbol.
10478         (Target_arm::do_finalize_sections): Move check for ELF format to
10479         Arm_relobj::do_read_symbols.  Merge processor specific flags and
10480         attributes from a regular object only when we have determined that
10481         it is aapropriate.  Do not create an .ARM.attributes section in
10482         output if there is no regular input object.
10483         (Target_arm::merge_processor_specific_flags): Check
10484         --warn-mismatch before printing any error.
10485         (Target_arm::merge_object_attributes): Ditto.
10486         * gold.cc (queue_middle_tasks): Handle the case in which there is
10487         no regular object in input.
10488         * options.cc (General_options::parse_EB): New method.
10489         (General_options::parse_EL): Same.
10490         (General_options::General_options): Initialize endianness_.
10491         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
10492         New options.
10493         (General_options::Endianness): New enum.
10494         (General_options::endianness): New method.
10495         (General_options::endianness_): New data member.
10496         * parameters.cc (Parameters::set_options): Check target endianness.
10497         (Parameters::set_target_once): Ditto.
10498         (Parameters::check_target_endianness): New method.
10499         (parameters_force_valid_target): If either -EL or -EB is specified,
10500         use it to define endianness of default target.
10501         * parameters.h (Parameters::check_target_endianness): New method
10502         declaration.
10503         * target.h (class Target): Change "endianity" to "endianness"
10504         in comments.
10505
10506 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10507
10508         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
10509         * configure: Regenerate.
10510         * Makefile.in: Regenerate.
10511         * testsuite/Makefile.in: Regenerate.
10512
10513 2010-04-06  Cary Coutant  <ccoutant@google.com>
10514
10515         gcc PR lto/42757
10516         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
10517         prevailing definitions of common symbols.
10518         * testsuite/plugin_test_6.sh: New test case.
10519         * testsuite/plugin_common_test_1.c: New test case.
10520         * testsuite/plugin_common_test_2.c: New test case.
10521         * testsuite/Makefile.am (plugin_test_6): New test case.
10522         * testsuite/Makefile.in: Regenerate.
10523
10524 2010-04-06  Nick Clifton  <nickc@redhat.com>
10525
10526         * po/vi.po: New Vietnamese translation.
10527
10528 2010-03-30  Doug Kwan  <dougkwan@google.com>
10529
10530         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
10531
10532 2010-03-25  Doug Kwan  <dougkwan@google.com>
10533
10534         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
10535         to avoid a conversion warning on a 32-bit host.
10536
10537 2010-03-24  Ian Lance Taylor  <iant@google.com>
10538
10539         * testsuite/script_test_3.t: Add a TLS segment.
10540         * testsuite/Makefile.am (check_PROGRAMS): Add
10541         tls_phdrs_script_test.
10542         (tls_phdrs_script_test_SOURCES): Define.
10543         (tls_phdrs_script_test_DEPENDENCIES): Define.
10544         (tls_phdrs_script_test_LDFLAGS): Define.
10545         (tls_phdrs_script_test_LDADD): Define.
10546         * testsuite/Makefile.in: Rebuild.
10547
10548 2010-03-23  Cary Coutant  <ccoutant@google.com>
10549
10550         * fileread.cc (find_or_make_view): Fix comment.
10551
10552 2010-03-23  Ian Lance Taylor  <iant@google.com>
10553
10554         * script-sections.cc (class Orphan_section_placement): Define
10555         PLACE_TLS and PLACE_TLS_BSS.
10556         (Orphan_section_placement::Orphan_section_placement): Initialize
10557         new places.
10558         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
10559         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
10560         (tls_script_test_SOURCES): Define.
10561         (tls_script_test_DEPENDENCIES): Define.
10562         (tls_script_test_LDFLAGS): Define.
10563         (tls_script_test_LDADD): Define.
10564         * testsuite/Makefile.in: Rebuild.
10565
10566 2010-03-22  Doug Kwan  <dougkwan@google.com>
10567
10568         * arm.cc (Arm_relocate_functions::abs8,
10569         Arm_relocate_functions::abs16): Use correct check for overflow
10570         specified in the ARM ELF specs.
10571         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
10572         target of a BLX instruction specially.
10573         (Reloc_stub::stub_type_for_reloc): Ditto.
10574         (Relocate::relocate): Use symbolic names instead of numeric relocation
10575         codes to report error.
10576         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
10577         workaround.
10578         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
10579         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
10580         thumb2_blx_out_of_range.stdout
10581         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
10582         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
10583         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
10584         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
10585         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
10586         thumb2_blx_in_range, thumb2_blx_in_range.o,
10587         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
10588         thumb2_blx_out_of_range.o): New rules.
10589         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
10590         thumb2_blx_in_range and thumb2_blx_out_of_range.
10591         * testsuite/Makefile.in: Regenerate.
10592         * arm_branch_in_range.sh: Add tests for THUMB BLX.
10593         * testsuite/thumb_blx_in_range.s: New file.
10594         * testsuite/thumb_blx_out_of_range.s: New file.
10595
10596 2010-03-22  Rafael Espindola  <espindola@google.com>
10597
10598         * archive.cc (Should_include): Move to archive.h.
10599         (should_include_member): Make it a member of Archive.
10600         (Lib_group): New.
10601         (Add_lib_group_symbols): New.
10602         * archive.h: Include options.h.
10603         (Archive_member): Moved from Archive.
10604         (Should_include): Moved from archive.cc.
10605         (Lib_group): New.
10606         (Add_lib_group_symbols): New.
10607         * dynobj.cc (do_should_include_member): New.
10608         * dynobj.h (do_should_include_member): New.
10609         * gold.cc (queue_initial_tasks): Update call to queue.
10610         * main.cc (main): Print lib group stats.
10611         * object.cc (do_should_include_member): New.
10612         * object.h: Include archive.h.
10613         (Object::should_include_member): New.
10614         (Object::do_should_include_member): New.
10615         (Sized_relobj::do_should_include_member): New.
10616         * options.cc (General_options::parse_start_lib): New.
10617         (General_options::parse_end_lib): New.
10618         (Input_arguments::add_file): Handle lib groups.
10619         (Input_arguments::start_group): Check we are not in a lib.
10620         (Input_arguments::start_lib): New.
10621         (Input_arguments::end_lib): New.
10622         * options.h (General_options): Add start_lib and end_lib.
10623         (Input_argument::lib_): New.
10624         (Input_argument::lib): New.
10625         (Input_argument::is_lib): New.
10626         (Input_file_lib): New.
10627         (Input_arguments::in_lib_): New.
10628         (Input_arguments::in_lib): New.
10629         (Input_arguments::start_lib): New.
10630         (Input_arguments::end_lib_): New.
10631         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
10632         in unused members as preempted.
10633         (Sized_pluginobj::do_should_include_member): New.
10634         * plugin.h (Sized_pluginobj::do_should_include_member): New.
10635         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
10636         return the blocker.
10637         (Read_symbols::do_whole_lib_group): New.
10638         (Read_symbols::do_lib_group): New.
10639         (Read_symbols::do_read_symbols): Handle lib groups.
10640         (Read_symbols::get_name): Handle lib groups.
10641         * readsyms.h (Read_symbols): Add an archive member pointer.
10642         (Read_symbols::do_whole_lib_group): New.
10643         (Read_symbols::do_lib_group): New.
10644         (Read_symbols::member_): New.
10645         * script.cc (read_input_script): Update call to queue_soon.
10646
10647 2010-03-19  Doug Kwan  <dougkwan@google.com>
10648
10649         * arm.cc (Stub_table::Stub_table): Initialize new data members
10650         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10651         (Stub_table::add_reloc_stub): Assign stub offset and update
10652         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10653         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
10654         New data members.
10655         (Stub_table::update_data_size_and_addralign): Use
10656         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
10657         instead of going over all reloc stubs.
10658         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
10659         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10660         Stringpool_template::offset_ to size of Stringpool_char.
10661         (Stringpool_template::new_key_offset): Remove code to initialize
10662         Stringpool_template::offset_.
10663         * stringpool.h (Stringpool_template::set_no_zero_null): Set
10664         Stringpool_template::offset_ to zero.
10665
10666 2010-03-15  Doug Kwan  <dougkwan@google.com>
10667
10668         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10669         offset_.
10670         (Stringpool_template::new_key_offset): New method.
10671         (Stringpool_template::add_string): Assign offsets when adding new
10672         strings.
10673         (Stringpool_template::set_string_offsets): Do not set string offsets
10674         when not optimizing.
10675         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
10676         member size_.
10677         (Chunked_vector::clear): Clear size_.
10678         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
10679         (Chunked_vector::size): Return size_.
10680         (Chunked_vector::push_back): Use size_ to find insert position.
10681         (Chunked_vector::size_): New data member.
10682         (Stringpool_template::set_no_zero_null): Assert string set is empty.
10683         (Stringpool_template::new_key_offset): New method declaration.
10684         (Stringpool_template::offset_): New data member.
10685
10686 2010-03-15   Rafael Espindola  <espindola@google.com>
10687
10688         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
10689         Add_symbols' constructor.
10690         * readsyms.h (Add_symbols): Remove the input_group member.
10691
10692 2010-03-10  Ian Lance Taylor  <iant@google.com>
10693
10694         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
10695         target to ask whether a reference to a symbol requires a stack
10696         split.
10697         * target.h (Target::is_call_to_non_split): New function.
10698         (Target::do_is_call_to_non_split): Declare virtual function.
10699         * target.cc: Include "symtab.h".
10700         (Target::do_is_call_to_non_split): New function.
10701         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
10702
10703 2010-03-10  Cary Coutant  <ccoutant@google.com>
10704
10705         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
10706         (File_read::open[1]): Remove initial mapping of whole_file_view_.
10707         (File_read::open[2]): Add whole_file_view_ to list of views.
10708         (File_read::make_view): Remove test of whole_file_view_.
10709         (File_read::find_or_make_view): Create whole_file_view_ if
10710         necessary.
10711         (File_read::clear_views): Replace bool parameter with enum;
10712         adjust all callers.  Don't delete views with permanent data;
10713         do delete cached views and views from archives if
10714         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
10715         if clearing the corresponding view.
10716         * fileread.h (File_read::Clear_views_mode): New enum.
10717         (File_read::View::is_permanent_view): New method.
10718         (File_read::clear_views): Replace bool parameter
10719         with enum; adjust all callers.
10720         * options.h (General_options): Change keep_files_mapped option;
10721         add map_whole_files.
10722         * readsyms.cc (Add_symbols::run): Delete sd_ object before
10723         releasing the file.
10724         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
10725         the file.
10726
10727 2010-03-10  David S. Miller  <davem@davemloft.net>
10728
10729         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
10730
10731 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
10732
10733         * icf.cc (get_section_contents): Add '@' marker after processing the
10734         merge reloc.
10735
10736 2010-03-08  Doug Kwan  <dougkwan@google.com>
10737
10738         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
10739         due to a conversion warning.
10740         (Arm_relobj::update_output_local_symbol_count): Check for local
10741         symbol with unset output index.
10742
10743 2010-03-05  Ian Lance Taylor  <iant@google.com>
10744
10745         * options.h (class General_options): Add --spare-dynamic-tags.
10746         * output.cc (Output_data_dynamic::set_final_data_size): Implement
10747         --spare-dynamic-tags.
10748
10749 2010-03-05  Ian Lance Taylor  <iant@google.com>
10750
10751         * incremental.cc: Include "libiberty.h".
10752
10753 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
10754
10755         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
10756         function, is_info_ member.
10757         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
10758         (Versions::Versions): Update caller.
10759         (Versions::define_base_version): Likewise.
10760         (Versions::add_def): Likewise.
10761
10762 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
10763
10764         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
10765         (Scan::possible_function_pointer_reloc): New function.
10766         (Scan::local_reloc_may_be_function_pointer): Change to call
10767         possible_function_pointer_reloc.
10768         (Scan::global_reloc_may_be_function_pointer): Ditto.
10769         * icf.h (Icf::check_section_for_function_pointers): Change to reject
10770         relocations in ".data.rel.ro._ZTV" section.
10771         * testsuite/icf_safe_so_test.sh: Change to pass i386.
10772         * testsuite/icf_safe_so_test.cc: Ditto.
10773         * testsuite/icf_safe_test.cc: Ditto.
10774         * testsuite/icf_safe_test.sh: Ditto.
10775
10776 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10777             Ian Lance Taylor  <iant@google.com>
10778
10779         * target-reloc.h (relocate_section): Check the symbol table index
10780         for -1U before setting the local symbol index.
10781         (scan_relocatable_relocs): If copying the relocation, record that
10782         the local symbol is required.
10783         * object.h (Symbol_value::is_output_symtab_index_set): New
10784         function.
10785         (Symbol_value::may_be_discarded_from_output_symtab): New
10786         function.
10787         (Symbol_value::has_output_symtab_entry): New function.
10788         (Symbol_value::needs_output_symtab_entry): Remove.
10789         (Symbol_value::output_symtab_index): Make sure the symbol index is
10790         set.
10791         (Symbol_value::set_output_symtab_index): Make sure the symbol
10792         index is not set.  Make sure the new index is valid.
10793         (Symbol_value::set_must_have_output_symtab_entry): New function.
10794         (Symbol_value::has_output_dynsym_entry): New function.
10795         (Symbol_value::set_output_dynsym_index): Make sure the new index
10796         is valid.
10797         (Sized_relobj::set_must_have_output_symtab_entry): New function.
10798         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
10799         local symbol if permitted.
10800         (Sized_relobj::do_finalize_local_symbols): Call
10801         is_output_symtab_index_set rather than needs_output_symtab_entry.
10802         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
10803         rather than needs_output_symtab_entry.  Call
10804         has_output_dynsym_entry rather than needs_output_dynsym_entry.
10805         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
10806         is_output_symtab_index_set rather than needs_output_symtab_entry.
10807         * testsuite/discard_locals_relocatable_test.c: New file.
10808         * testsuite/discard_locals_test.sh: Test -r.
10809         * testsuite/Makefile.am (check_DATA): Add
10810         discard_locals_relocatable_test1.syms,
10811         discard_local_relocatable_test2.syms.
10812         (MOSTLYCLEANFILES): Likewise.  Also add
10813         discard_locals_relocatable_test1.lout and
10814         discard_locals_relocatable_test2.out.
10815         (discard_locals_relocatable_test1.syms): New target.
10816         (discard_locals_relocatable_test.o): New target.
10817         (discard_locals_relocatable_test1.out): New target.
10818         (discard_locals_relocatable_test2.syms): New target.
10819         (discard_locals_relocatable_test2.out): New target.
10820         (various): Add missing ../ld-new dependencies.
10821         * testsuite/Makefile.in: Rebuild.
10822
10823 2010-03-03  Nick Clifton  <nickc@redhat.com>
10824
10825         * po/fi.po: New Finnish translation.
10826
10827 2010-03-01  Doug Kwan  <dougkwan@google.com>
10828
10829         * layout.cc (Layout::Layout): Force section types of .init_array*,
10830         .preinit_array* and .fini_array* sections.
10831         * output.cc (Output_section::Input_section_sort_entry::has_priority):
10832         Fix check of return value of std::string::find.().
10833         (Output_section::Input_section_sort_compare::operator()): Remove
10834         comment about .init_array.
10835         (Output_section::Input_section_sort_init_fini_compare::operator()):
10836         New method.
10837         (Output_section::sort_attached_input_sections): Handle .init_array
10838         and .fini_array specially.
10839         * output.h (Output_section::Inut_section_sort_compare): Update
10840         comment.
10841         (Output_section::Input_section_sort_init_fini_compare): New struct.
10842
10843 2010-02-26  Doug Kwan  <dougkwan@google.com>
10844
10845         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
10846         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
10847         * testsuite/debug_msg.sh: Avoid matching source line number for
10848         use of global variable undef_int.
10849
10850 2010-02-26  Doug Kwan  <dougkwan@google.com>
10851
10852         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
10853         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
10854         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
10855         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
10856         * options.cc (General_options::General_options): Initialize member
10857         fix_v4bx_.
10858         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
10859         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
10860         and rm_no_fix_v4bx.stdout
10861         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
10862         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
10863         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
10864         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
10865         and arm_no_fix_v4bx.
10866         * Makefile.in: Regenerate.
10867         * testsuite/arm_fix_v4bx.s: New file.
10868         * testsuite/arm_fix_v4bx.sh: Ditto.
10869
10870 2010-02-24  Doug Kwan  <dougkwan@google.com>
10871
10872         * arm.cc (Target_arm::got_section): Make the .got section the first
10873         non RELRO section in the data segment.
10874         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
10875         suffixes of section names.
10876
10877 2010-02-24  Doug Kwan  <dougkwan@google.com>
10878
10879         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
10880         flags and attributes merging if an input file is a binary file.
10881         * fileread.cc (Input_file::open): Record format of original file.
10882         * fileread.h (Input_file::Format): New enum type.
10883         (Input_file::Input_file): Initialize data member format_.
10884         (Input_file::format): New method definition.
10885         (Input_file::format_):: New data member.
10886
10887 2010-02-24  Doug Kwan  <dougkwan@google.com>
10888
10889         * arm.cc (Arm_output_data_got): New class.
10890         (ARM_TCB_SIZE): New constant
10891         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
10892         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10893         If user uses a script with a SECTIONS clause, issue only a warning
10894         for a misplaced EXIDX input section.  Otherwise, issue an error.
10895         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
10896         garbage collection.
10897         (Target_arm::got_mode_index_entry): Handle static linking.
10898         (Target_arm::Scan::local): Ditto.
10899         (Target_arm::Scan::global): Ditto.
10900         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
10901         all incorrectly implemented relocations.
10902         (Target_arm::fix_exidx_coverage): Pass layout to
10903         Arm_output_section::fix_exidx_coverage.
10904         * layout.cc (Layout::section_name_mapping): Remove trailing dots
10905         from ".ARM.exidx." and ".ARM.extab.".
10906
10907 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10908
10909         * arm.cc (Target_arm::do_finalize_sections): Create attribute
10910         section if it does not already exist.
10911         * attributes.cc (Attributes_section_data::Attributes_section_data):
10912         Don't crash if size is zero.
10913
10914 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10915             Ian Lance Taylor  <iant@google.com>
10916
10917         * gold.cc (queue_middle_tasks): If no input files were opened,
10918         exit.
10919         * workqueue.h (Task_function::Task_function): Assert that there is
10920         a blocker.
10921
10922 2010-02-22  Doug Kwan  <dougkwan@google.com>
10923
10924         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
10925         * icf.cc (get_section_contents): Cast snprintf arguments to long long
10926         types to avoid warnings due to different uint64_t implementations
10927         on different hosts.
10928
10929 2010-02-21  Doug Kwan  <dougkwan@google.com>
10930
10931         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
10932         handling of the maximum backward branch offset.
10933         (Arm_relocate_functions::thumb_branch_common): Ditto.
10934         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
10935         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
10936         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
10937         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
10938         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
10939         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
10940         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
10941         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
10942         thumb_bl_out_of_range thumb_bl_out_of_range.o,
10943         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
10944         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
10945         thumb2_bl_out_of_range.o): New rules.
10946         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
10947         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
10948         thumb2_bl_out_of_range
10949         * testsuite/Makefile.in: Regenerate.
10950         * testsuite/arm_bl_in_range.s: New file.
10951         * testsuite/arm_bl_out_of_range.s: Ditto.
10952         * testsuite/arm_branch_in_range.sh: Ditto.
10953         * testsuite/arm_branch_range.t: Ditto.
10954         * testsuite/thumb2_branch_range.t: Ditto.
10955         * testsuite/thumb_bl_in_range.s: Ditto.
10956         * testsuite/thumb_bl_out_of_range.s: Ditto.
10957         * testsuite/thumb_branch_range.t: Ditto.
10958
10959 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
10960
10961         * gc.h (gc_process_relocs): Change vectors to point to the new list.
10962         Add reloc offset information.
10963         * icf.cc (get_section_contents): Change iterators to point to the new
10964         vectors. Add reloc offset information to the contents.
10965         * icf.h (Icf::Sections_reachable_info): New typedef.
10966         (Icf::Sections_reachable_list): New typedef.
10967         (Icf::Offset_info): New typedef.
10968         (Icf::Reloc_info): New struct typedef.
10969         (Icf::Reloc_info_list): New typedef.
10970         (Icf::symbol_reloc_list): Delete method.
10971         (Icf::addend_reloc_list): Delete method.
10972         (Icf::section_reloc_list): Delete method.
10973         (Icf::reloc_info_list): New method.
10974         (Icf::reloc_info_list_): New member.
10975
10976 2010-02-19  Doug Kwan  <dougkwan@google.com>
10977
10978         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
10979         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
10980         * arm.cc (Arm_relocation_functions): New forward declaration.
10981         (Target_arm::Target_arm): Initialize new data members
10982         got_mod_index_offset_ and tls_base_symbol_defined_.
10983         (Target_arm::Relocate::relocate_tls): New method.
10984         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
10985          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
10986         New methods.
10987         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
10988         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
10989         (Target_arm::got_mod_index_offset_,
10990         Target_arm::tls_base_symbol_defined_): New data members.
10991         (Target_arm::Scan::local, Target::Scan::global,
10992         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
10993         relocations.
10994
10995 2010-02-18  Doug Kwan  <dougkwan@google.com>
10996
10997         * arm.cc (Arm_relobj::find_linked_text_section): New method.
10998         (Arm_relobj::make_exidx_input_section): Pass section index of linked
10999         text section as a parameter becuase some broken tools may not set
11000         the link in section header.
11001         (Target_arm::has_got_section): New method.
11002         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
11003         without any mapping symbol as data only.  Remove warning.
11004         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
11005         link in its section header, try to discover the link by inspecting the
11006         REL31 relocation at the beginning of the section.
11007         (Target_arm::Scan::check_non_pic): Report name of offending relocation
11008         in error message.
11009         (Target_arm::Scan::global): Treat any reference to the symbol
11010         _GLOBAL_OFFSET_TABLE_ as a GOT access.
11011
11012 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
11013
11014         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
11015         (Scan::global_reloc_may_be_function_pointer): New function.
11016         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
11017         (Scan::global_reloc_may_be_function_pointer): New function.
11018         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
11019         (Scan::global_reloc_may_be_function_pointer): New function.
11020         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
11021         (Scan::global_reloc_may_be_function_pointer): New function.
11022         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
11023         (Scan::global_reloc_may_be_function_pointer): New function.
11024         (Scan::possible_function_pointer_reloc): New function.
11025         (Target_x86_64::can_check_for_function_pointers): New function.
11026         * gc.h (gc_process_relocs): Scan relocation types to determine if
11027         function pointers were taken for targets that support it.
11028         * icf.cc (Icf::find_identical_sections): Include functions for
11029         folding in safe ICF whose pointer is not taken.
11030         * icf.h (Secn_fptr_taken_set): New typedef.
11031         (fptr_section_id_): New member.
11032         (section_has_function_pointers): New function.
11033         (set_section_has_function_pointers): New function.
11034         (check_section_for_function_pointers): New function.
11035         * options.h: Fix comment for safe ICF option.
11036         * target.h (can_check_for_function_pointers): New function.
11037         * testsuite/Makefile.am: Add icf_safe_so_test test case.
11038         Modify icf_safe_test for X86-64.
11039         * testsuite/Makefile.in: Regenerate.
11040         * testsuite/icf_safe_so_test.cc: New file.
11041         * testsuite/icf_safe_so_test.sh: New file.
11042         * testsuite/icf_safe_test.cc (kept_func_3): New function.
11043         (main): Change to take pointer to function kept_func_3.
11044         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
11045         folding is done correctly for X86-64.
11046
11047 2010-02-12  David S. Miller  <davem@davemloft.net>
11048
11049         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
11050         is_symbolless parameter.
11051         (Output_reloc<SHT_REL>::is_symbolless): New.
11052         (Output_reloc<SHT_REL>::is_symbolless_): New.
11053         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
11054         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
11055         (Output_reloc<SHT_RELA>::is_symbolless): New.
11056         (Output_data_reloc::add_global): Handle is_symbolless.
11057         (Output_data_reloc::add_global_relative): Likewise.
11058         (Output_data_reloc::add_local): Likewise.
11059         (Output_data_reloc::add_local_relative): Likewise.
11060         (Output_data_reloc::add_symbolless_global_addend): New.
11061         (Output_data_reloc::add_symbolless_local_addend): New.
11062         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
11063         is_symbolless.
11064         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
11065         instead of ->is_relative_
11066         (Output_reloc::write): Likewise.
11067         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
11068         (Output_reloc::write_rel): Simplify.
11069
11070         * sparc.cc (Target_sparc::Scan::local): Use
11071         ->add_symbolless_local_addend as needed.
11072         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
11073         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
11074         based upon relocation offset.
11075
11076 2010-02-11  Doug Kwan  <dougkwan@google.com>
11077
11078         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
11079         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
11080         beginning of function.
11081         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
11082         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
11083         parameter is_32bit in calls to should_apply_static_reloc.
11084         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
11085         (check_DATA): Add arm_abs_global.stdout.
11086         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
11087         arm_abs_global.stdout): New rules.
11088         (MOSTLLYCLEANFILES): Add arm_abs_global
11089         * Makefile.in: Regenerate.
11090         * testsuite/arm_abs_global.s: New file.
11091         * testsuite/arm_abs_global.sh: Ditto.
11092         * testsuite/arm_abs_lib.s: Ditto.
11093
11094 2010-02-11  Ian Lance Taylor  <iant@google.com>
11095
11096         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
11097         Read_relocs task.
11098         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
11099         Allocate_commons_task first.
11100         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
11101         task, rather than symtab_lock_.
11102         (Gc_process_relocs::~Gc_process_relocs): New function.
11103         (Gc_process_relocs::is_runnable): Check this_blocker_.
11104         (Gc_process_relocs::locks): Use next_blocker_ rather than
11105         blocker_.
11106         (Scan_relocs::~Scan_relocs): New function.
11107         (Scan_relocs::is_runnable): Check this_blocker_ rather than
11108         symtab_lock_.
11109         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
11110         next_blocker_.
11111         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
11112         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
11113         constructor accordingly.
11114         (class Gc_process_relocs): Likewise.
11115         (class Scan_relocs): Likewise.
11116         * common.h (class Allocate_commons_task): Remove symtab_lock_
11117         field, and corresponding constructor parameter.
11118         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
11119         symtab_lock_.
11120         (Allocate_commons_task::locks): Likewise.
11121
11122 2010-02-11  Ian Lance Taylor  <iant@google.com>
11123
11124         * gold-threads.h (class Once): Define.
11125         (class Initialize_lock): Rewrite as child of Once.
11126         * gold-threads.cc (class Once_initialize): Define.
11127         (once_pointer_control): New static variable.
11128         (once_pointer, once_arg): New static variables.
11129         (c_run_once): New static function.
11130         (Once::Once, Once::run_once, Once::internal_run): New functions.
11131         (class Initialize_lock_once): Remove.
11132         (initialize_lock_control): Remove.
11133         (initialize_lock_pointer): Remove.
11134         (initialize_lock_once): Remove.
11135         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
11136         (Initialize_lock::initialize): Rewrite.
11137         (Initialize_lock::do_run_once): New function.
11138         * archive.cc (Archive::interpret_header): Only clear name if it is
11139         not already empty.
11140         * fileread.cc: Include "gold-threads.h"
11141         (file_counts_lock): New static variable.
11142         (file_counts_initialize_lock): Likewise.
11143         (File_read::release): Only increment counts when using --stats.
11144         Use a lock around the increment.
11145         * parameters.cc (class Set_parameters_target_once): Define.
11146         (set_parameters_target_once): New static variable.
11147         (Parameters::Parameters): Move here from parameters.h.
11148         (Parameters::set_target): Rewrite.
11149         (Parameters::set_target_once): New function.
11150         (Parameters::clear_target): Move here and rewrite.
11151         * parameters.h (class Parameters): Update declarations.  Add
11152         set_parameters_target_once_ field.
11153         (Parameters::Parameters): Move to parameters.cc.
11154         (Parameters::clear_target): Likewise.
11155         * readsyms.cc (Read_symbols::do_group): Create a Start_group
11156         task.
11157         (Start_group::~Start_group): New function.
11158         (Start_group::is_runnable): New function.
11159         (Start_group::locks, Start_group::run): New functions.
11160         (Finish_group::run): Change saw_undefined to size_t.
11161         * readsyms.h (class Start_group): Define.
11162         (class Finish_group): Change saw_undefined_ field to size_t.
11163         (Finish_group::Finish_group): Remove saw_undefined and
11164         this_blocker parameters.  Change all callers.
11165         (Finish_group::set_saw_undefined): New function.
11166         (Finish_group::set_blocker): New function.
11167         * symtab.h (class Symbol_table): Change saw_undefined to return
11168         size_t.  Change saw_undefined_ field to size_t.
11169         * target-select.cc (Set_target_once::do_run_once): New function.
11170         (Target_selector::Target_selector): Initialize set_target_once_
11171         field.  Don't initialize lock_ and initialize_lock_ fields.
11172         (Target_selector::instantiate_target): Rewrite.
11173         (Target_selector::set_target): New function.
11174         * target-select.h (class Set_target_once): Define.
11175         (class Target_selector): Update declarations.  Make
11176         Set_target_once a friend.  Remove lock_ and initialize_lock_
11177         fields.  Add set_target_once_ field.
11178
11179 2010-02-10  Ian Lance Taylor  <iant@google.com>
11180
11181         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
11182         queueing any tasks.
11183         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
11184         (queue_middle_tasks): Add all blockers before queueing any tasks.
11185         (queue_final_tasks): Likewise.
11186         * token.h (Task_token::add_blockers): New function.
11187         * object.h (Input_objects::number_of_relobjs): New function.
11188
11189 2010-02-10  Ian Lance Taylor  <iant@google.com>
11190
11191         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
11192         shared, not if not position independent.
11193         * x86_64.cc (Relocate::relocate_tls): Likewise.
11194         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
11195         (tls_pie_pic_test): New target.
11196         * testsuite/Makefile.in: Rebuild.
11197
11198         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
11199         (tls_test_main_pie.o, tls_test_pie.o): New targets.
11200         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
11201         * testsuite/Makefile.in: Rebuild.
11202
11203 2010-02-09  David S. Miller  <davem@davemloft.net>
11204
11205         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
11206         R_SPARC_RELATIVE using ->add_local_relative().
11207         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
11208
11209         * output.h (Output_data_dynamic::add_section_size): New method
11210         that takes two Output_data objects.
11211         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
11212         entry param.  Handle it in initializers.
11213         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
11214         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
11215         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
11216         arg.
11217         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
11218         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
11219         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
11220         for dynrel_includes_plt.
11221         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11222         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11223         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
11224         before .rela.plt
11225         (Target_sparc::do_finalize_sections): Update to pass true for
11226         dynrel_includes_plt.
11227         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
11228         output before .rela.plt
11229         (Target_powerpc::do_finalize_sections): Update to pass true for
11230         dynrel_includes_plt when 32-bit.
11231
11232 2010-02-08  Doug Kwan  <dougkwan@google.com>
11233
11234         * arm.cc (Arm_relobj::simple_input_section_output_address): New
11235         method.
11236         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
11237         Arm_relobj::scan_section_for_cortex_a8_stubs,
11238         Arm_relobj::do_relocation_section): Instead of calling
11239         Output_section::output_address, use faster
11240         Arm_relobj::simple_input_section_output_address.
11241
11242 2010-02-08  David S. Miller  <davem@davemloft.net>
11243
11244         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
11245         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
11246         relocation helper function.
11247
11248         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
11249         just like R_SPARC_GOT{10,13,22}.
11250         (Target_sparc::Scan::local): Likewise.
11251         (Target_sparc::Relocate:relocate): Likewise.
11252
11253 2010-02-06  Ian Lance Taylor  <iant@google.com>
11254
11255         * configure.ac: Rewrite targetobjs duplicate removal code to use
11256         only shell constructs.
11257         * configure: Rebuild.
11258
11259 2010-02-05  Doug Kwan  <dougkwan@google.com>
11260
11261         PR 11247
11262         * arm.cc (Arm_relobj::section_is_scannable): New method.
11263         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
11264         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
11265
11266 2010-02-04  Doug Kwan  <dougkwan@google.com>
11267
11268         PR 11247
11269         * arm-reloc-property.cc (cstdio): Include.
11270         * configure.ac (targetobjs): Remove duplicates.
11271         * configure: Regenerate.
11272         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
11273         big and little endian version for a given address size.
11274
11275 2010-02-03  Doug Kwan  <dougkwan@google.com>
11276
11277         * arm-reloc-property.cc
11278         (Arm_reloc_property_table::reloc_name_in_error_message): New method
11279         definition.
11280         * arm-reloc-property.h
11281         (Arm_reloc_property_table::get_implemented_static_reloc_property):
11282         New method definition.
11283         (Arm_reloc_property_table::reloc_name_in_error_message): New method
11284         declaration.
11285         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
11286         overflow to N.
11287         (GOT_PREL): Change implemented to Y.
11288         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
11289         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
11290         (Arm_relocate_functions::movw_abs_nc): Remove method.
11291         (Arm_relocate_functions::movt_abs): Ditto.
11292         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
11293         (Arm_relocate_functions::thm_movt_abs): Ditto.
11294         (Arm_relocate_functions::movw_rel_nc): Ditto.
11295         (Arm_relocate_functions::movw_rel): Ditto.
11296         (Arm_relocate_functions::movt_rel): Ditto.
11297         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
11298         (Arm_relocate_functions:thm_movw_rel): Ditto.
11299         (Arm_relocate_functions:thm_movt_rel): Ditto.
11300         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
11301         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
11302         New method definitions.
11303         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
11304         (Arm_relocation_functions::arm_grp_ldr): Ditto.
11305         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
11306         (Arm_relocation_functions::arm_grp_ldc): Ditto.
11307         (Target_arm::Relocate::relocate): Check for non-static or
11308         unimplemented relocation code and exit early.  Change calls to
11309         Target_arm::reloc_uses_thumb_bit and
11310         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
11311         instead.  Refactor code to handle similar relocations to increase
11312         code sharing.  Remove check for unsupported relocation code in switch
11313         statement.
11314         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
11315         relocation property table to find out size.  Change error message to
11316         print out the name of a relocation code instead of the numeric value.
11317         (Target_arm::scan_reloc_for_stub): Use relocation property table
11318         instead of calling Target_arm::reloc_uses_thumb_bit().
11319
11320 2010-02-02  Doug Kwan  <dougkwan@google.com>
11321
11322         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
11323         types of relaxed input section.
11324
11325 2010-02-02  Doug Kwan  <dougkwan@google.com>
11326
11327         * Makefile.am (HFILES): Add arm-reloc-property.h.
11328         (DEFFILES): New.
11329         (TARGETSOURCES): Add arm-reloc-property.cc
11330         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
11331         (libgold_a_SOURCES): $(DEFFILES)
11332         * Makefile.in: Regenerate.
11333         * arm-reloc-property.cc: New file.
11334         * arm-reloc-property.h: New file.
11335         * arm-reloc.def: New file.
11336         * arm.cc: Update comments.
11337         (arm-reloc-property.h): New included header.
11338         (arm_reloc_property_table): New global variable.
11339         (Target_arm::do_select_as_default_target): New method definition.
11340         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
11341         arm-reloc-property to targ_extra_obj.
11342         * parameters.cc (set_parameters_target): Call
11343         Target::select_as_default_target().
11344         * target.h (Target::select_as_default_target): New method definition.
11345         (Target::do_select_as_default_target): Same.
11346
11347 2010-02-01  Doug Kwan  <dougkwan@google.com>
11348
11349         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
11350         first_output_text_section_.
11351         (Arm_exidx_fixup::first_output_text_section): New method definition.
11352         (Arm_exidx_fixup::first_output_text_section_): New data member.
11353         (Arm_exidx_fixup::process_exidx_section): Record the first text
11354         output section seen.
11355         (Arm_output_section::fix_exidx_coverage): Set correct linked section
11356         and entsize in output section header.
11357
11358 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11359
11360         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
11361         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
11362         (Arm_relocate_functions::thm_alu11): New Method.
11363         (Arm_relocate_functions::thm_pc8): New Method.
11364         (Arm_relocate_functions::thm_pc12): New Method.
11365         (Target_arm::Scan::local): Handle the relocations.
11366         (Target_arm::Scan::global): Likewise.
11367         (Target_arm::Relocate::relocate): Likewise.
11368         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11369
11370 2010-01-29  Doug Kwan  <dougkwan@google.com>
11371
11372         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
11373         of relocation types as ld.
11374
11375 2010-01-29  Doug Kwan  <dougkwan@google.com>
11376
11377         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
11378         to public.
11379         (Arm_relocate_functions::thumb_branch_common): Ditto.
11380         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
11381         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
11382         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
11383         Arm_relocate_functions::jump24): Remove.
11384         (Target_arm::Relocate::relocate): Adjust code to call
11385         Arm_relocation_functions::arm_branch_common and
11386         Arm_relocation_functions::thumb_branch_common instead of their removed
11387         wrappers.  Merge switch-cases together to reduce source code size.
11388
11389 2010-01-29  Doug Kwan  <dougkwan@google.com>
11390
11391         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
11392         output_local_symbol_count_needs_update_.
11393         (Arm_relobj::output_local_symbol_count_needs_update,
11394          Arm_relobj::set_output_local_symbol_count_needs_update,
11395          Arm_relobj::update_output_local_symbol_count): New methods.
11396         (Arm_relobj::output_local_symbol_count_needs_update_): New data
11397         member.
11398         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
11399         of pointed function as in a R_ARM_PREL31 relocation.
11400         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
11401         for output local symbol count updating.
11402         (Target_arm::do_relax): Update output local symbol counts in objects
11403         if necessary.
11404         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
11405
11406 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11407
11408         * arm.cc: Added support for the ARM relocations:
11409         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
11410         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
11411         (Arm_relocate_functions::movw_rel_nc): Renamed (was
11412         movw_prel_nc).
11413         (Arm_relocate_functions::movw_rel): New method.
11414         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
11415         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
11416         thm_movw_prel_nc).
11417         (Arm_relocate_functions::thm_movw_rel): New method.
11418         (Arm_relocate_functions::thm_movt_rel): Renamed (was
11419         thm_movt_prel).
11420         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
11421         relocations.
11422         (Target_arm::Scan::global): Likewise.
11423         (Target_arm::Relocate::relocate): Likewise.
11424         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11425         Likewise.
11426
11427 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11428
11429         * arm.cc: Added support for ARM group relocations.
11430         (Target_arm::reloc_needs_sym_origin): New method.
11431         (Arm_relocate_functions::calc_grp_kn): New method.
11432         (Arm_relocate_functions::calc_grp_residual): New method.
11433         (Arm_relocate_functions::calc_grp_gn): New method.
11434         (Arm_relocate_functions::arm_grp_alu): New Method.
11435         (Arm_relocate_functions::arm_grp_ldr): New Method.
11436         (Arm_relocate_functions::arm_grp_ldrs): New Method.
11437         (Arm_relocate_functions::arm_grp_ldc): New Method.
11438         (Target_arm::Scan::local): Handle the ARM group relocations.
11439         (Target_arm::Scan::global): Likewise.
11440         (Target_arm::Relocate::relocate): Likewise.
11441         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11442         Likewise.
11443
11444 2010-01-26  Doug Kwan  <dougkwan@google.com>
11445
11446         * arm.cc (set): Include.
11447         (class Arm_exidx_fixup): Change type of last_input_section_ to const
11448         pointer type.
11449         (Arm_output_section::Text_section_list): New type.
11450         (Arm_output_section::append_text_sections_to_list): New method.
11451         (Arm_output_section::fix_exidx_coverage): Ditto.
11452         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
11453         (Arm_relobj::convert_input_section_to_relaxed_section): Use
11454         Relobj::set_section_offset() instead of
11455         Sized_relobj::invalidate_section_offset().
11456         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
11457         parameter for section headers. Ignore relocation sections for
11458         unallocated sections and EXIDX sections.
11459         (Target_arm::fix_exidx_coverage): New method.
11460         (Target_arm::output_section_address_less_than): New type.
11461         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
11462         linked text section instead of the EXIDX section.
11463         (Arm_output_section::create_stub_group): Add an assertion to check
11464         that this is not an EXIDX output section.
11465         (Arm_output_section::append_text_sections_to_list): New method.
11466         (Arm_output_section::fix_exidx_coverage): Ditto.
11467         (Arm_relobj::scan_sections_for_stubs): Adjust call to
11468         Arm_relobj::section_needs_reloc_stub_scanning.
11469         (Target_arm::do_relax): Fix EXIDX output section coverage in the
11470         first pass.
11471         (Target_arm::fix_exidx_coverage): New method.
11472         * object.h (Relobj::set_output_section): New method.
11473         (Sized_relobj::invalidate_section_offset): Remove method.
11474         (Sized_relobj::do_invalidate_section_offset): Remove method.
11475         (Sized_relobj::do_set_section_offset): Handle offset value -1.
11476
11477 2010-01-25  Doug Kwan  <dougkwan@google.com>
11478
11479         * arm.cc (Arm_exidx_merged_section::do_output_offset):
11480         Fix warning due to signed and unsigned comparison on a 32-bit host.
11481
11482 2010-01-22  Doug Kwan  <dougkwan@google.com>
11483
11484         * arm.cc (Target_arm::do_relax): Record an output section for section
11485         offset adjustment it contains any stub table that has changed.
11486         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
11487         offsets in an output section if necessary.
11488         * output.cc (Output_section::Output_section): Initialize
11489         section_offsets_need_adjustments_.
11490         (Output_section::add_input_section_for_script): Renamed to
11491         Output_section::add_simple_input_section.
11492         (Output_section::save_states): Add a comment.
11493         (Output_section::discard_states): New method defintion.
11494         (Output_section::adjust_section_offsets): Same.
11495         * output.h (Output_section::add_input_section_for_script): Renamed to
11496         Output_section::add_simple_input_section.
11497         (Output_section::discard_states): New method declaration.
11498         (Output_section::adjust_section_offsets): Same.
11499         (Output_section::section_offsets_need_adjustment,
11500         Output_section::set_section_offsets_need_adjustment): New method
11501         definitions.
11502         (Output_section::section_offsets_need_adjustment_): New data member.
11503         * script-sections.cc
11504         (Output_section_element_input::set_section_address): Adjust code for
11505         renaming of Output_section::add_input_section_for_script.
11506         (Orphan_output_section::set_section_address): Same.
11507
11508 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11509
11510         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
11511         Fix_v4bx enum values .
11512         * gold/options.h (General_options): New option definitions.
11513         (General_options::fix_v4bx): New method.
11514         (General_options::Fix_v4bx): New enum.
11515         * gold/options.cc (General_options::parse_fix_v4bx): New method.
11516         (General_options::parse_fix_v4bx_interworking): New method.
11517
11518 2010-01-22  Doug Kwan  <dougkwan@google.com>
11519
11520         * arm.cc (Arm_exidx_fixup): New class.
11521
11522 2010-01-21  Doug Kwan  <dougkwan@google.com>
11523
11524         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
11525         classes.
11526         (Arm_exidx_section_offset_map): New type.
11527
11528 2010-01-21  Doug Kwan  <dougkwan@google.com>
11529
11530         * arm.cc (Arm_exidx_input_section): New class.
11531         (Arm_relobj::exidx_input_section_by_link,
11532         Arm_relobj::exidx_input_section_by_shndx,
11533         Arm_relobj::make_exidx_input_section): New methods.
11534         (read_arm_attributes_section): Remove.
11535         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
11536         information about them.
11537         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
11538         to here.
11539
11540 2010-01-20  Doug Kwan  <dougkwan@google.com>
11541
11542         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
11543         Input_section_specifier to Section_id.
11544         (Target_arm::new_arm_input_section: Adjust code for change of key
11545         type.
11546         (Target_arm::find_arm_input_section): Ditto.
11547         * gc.h (object.h): Include for Section_id nand Section_id_hash.
11548         (Section_id): Remove.
11549         (Garbage_collection::Section_id_hash): Remove.
11550         * icf.h (object.h): Include for Section_id nand Section_id_hash.
11551         (Section_id): Remove.
11552         (Icf::Section_id_hash): Remove.
11553         * object.h (Section_id, Const_section_id, Section_id_hash,
11554         Const_section_id_hash): New type definitions.
11555         * output.cc (Output_section::add_relaxed_input_section): Change to
11556         use Const_section_id instead of Input_section_specifier as key type.
11557         (Output_section::add_merge_input_section): Ditto.
11558         (Output_section::build_relaxation_map): Change to use Section_id
11559         instead of Input_section_specifier as key type.
11560         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11561         Ditto.
11562         (Output_section::convert_input_sections_to_relaxed_sections): Change
11563         to use Const_section_id instead of Input_section_specifier as key type.
11564         (Output_section::find_merge_section): Ditto.
11565         (Output_section::find_relaxed_input_section): Ditto.
11566         * output.h (Input_section_specifier): Remove class.
11567         (Output_section::Output_section_data_by_input_section_map): Change
11568         key type to Const_section_id.
11569         (Output_section::Output_relaxed_input_section_by_input_section_map):
11570         Ditto.
11571         (Output_section::Relaxation_map): Change key type to Section_id.
11572
11573 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11574
11575         * gold/arm.cc: Added support for R_ARM_V4BX relocation
11576         (class Arm_v4bx_stub): New class.
11577         (DEF_STUBS): Updated definition to support v4_veneer_bx.
11578         (Stub_factory::make_arm_v4bx_stub): New method.
11579         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
11580         (Stub_table::empty): Handle v4bx stubs.
11581         (Stub_table::add_arm_v4bx_stub): New method.
11582         (Stub_table::find_arm_v4bx_stub): New method.
11583         (Arm_relocate_functions::v4bx): New method.
11584         (Target_arm::fix_v4bx): New method.
11585         (Target_arm::Target_arm): Handle R_ARM_V4BX.
11586         (Stub_table::relocate_stubs): Likewise.
11587         (Stub_table::do_write): Likewise.
11588         (Stub_table::update_data_size_and_addralign): Likewise.
11589         (Stub_table::finalize_stubs):  Likewise.
11590         (Target_arm::Scan::local): Likewise.
11591         (Target_arm::Scan::global): Likewise.
11592         (Target_arm::do_finalize_sections): Likewise.
11593         (Target_arm::Relocate::relocate): Likewise.
11594         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11595         Likewise.
11596         (Target_arm::scan_reloc_for_stub): Likewise.
11597         (Target_arm::scan_reloc_section_for_stubs): Likewise.
11598
11599 2010-01-19  Ian Lance Taylor  <iant@google.com>
11600
11601         * output.cc (Output_section_headers::do_sized_write): Write large
11602         segment count to sh_info field.
11603         (Output_file_header::do_sized_write): For large segment count,
11604         write PN_XNUM to e_phnum field.
11605
11606 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11607
11608         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
11609         (Arm_relocate_functions::thm_jump8): New function.
11610         (Arm_relocate_functions::thm_jump11): New function.
11611         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
11612         R_ARM_THM_JUMP11.
11613         (Target_arm::Scan::global): Likewise.
11614         (Target_arm::Relocate::relocate): Likewise.
11615         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11616         Likewise.
11617
11618 2010-01-14  Doug Kwan  <dougkwan@google.com>
11619
11620         * arm.cc (map, utility): Include headers.
11621         (Target_arm::apply_cortex_a8_workaround): New method.
11622         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
11623         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
11624         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
11625         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
11626         the --[no-]fix-cortex-a8 command line options.
11627         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
11628         (Target_arm::relocate_stub): Use addend in instruction template.
11629         * options.h (DEFINE_bool): Set the user-set flag.
11630         (General_options): Add --[no-]-fix-cortex options.
11631         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
11632         : Update fast look-up map after conversion.
11633
11634 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
11635
11636         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
11637         in the first pass of do_layout.
11638
11639 2010-01-13  Doug Kwan  <dougkwan@google.com>
11640
11641         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11642         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
11643         apparent compiler problem of not folding static constant integral
11644         data members of elfcpp::Elf_sizes<32>.
11645
11646 2010-01-13  Doug Kwan  <dougkwan@google.com>
11647
11648         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11649         Arm_relobj::section_needs_cortex_a8_stub_scanning,
11650         Arm_relobj::scan_section_for_cortex_a8_erratum,
11651         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
11652         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
11653         sections to scan for relocation stubs into a new method
11654         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
11655         relocation and Cortex-A8 stub scanning.
11656         (Target_arm::do_relax): Force stubs to be after stubbed sections
11657         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
11658         the beginning of a new relaxation pass.  Update a comment.
11659         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
11660
11661 2010-01-12  Ian Lance Taylor  <iant@google.com>
11662
11663         * target-reloc.h (visibility_error): New inline function.
11664         (relocate_section): Call visibility_error.
11665         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
11666         (MOSTLYCLEANFILES): Likewise.
11667         (protected_4_pic.o, protected_3.err): New targets.
11668         * testsuite/protected_4.cc: New file.
11669
11670 2010-01-12  Doug Kwan  <dougkwan@google.com>
11671
11672         * arm.cc (Cortex_a8_reloc): New class.
11673         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
11674         and cortex_a8_relocs_info_.
11675         (Target_arm::fix_cortex_a8): New method definition.
11676         (Target_arm::Cortex_a8_relocs_info): New type.
11677         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
11678         New data member declarations.
11679         (Target_arm::scan_reloc_for_stub): Record information about
11680         relocations for THUMB branches that might be exempted from the
11681         Cortex-A8 workaround.
11682         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
11683         at the beginning of a relaxation pass.
11684
11685 2010-01-12  Doug Kwan  <dougkwan@google.com>
11686
11687         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
11688         (Arm_relobj::Mapping_symbol_position,
11689          Arm_reloj::Mapping_symbol_position_less,
11690          Arm_relobj::Mapping_symbols_info): New types.
11691         (Target_arm::is_mapping_symbol_name): New method definition.
11692         (Arm_relobj::do_count_local_symbols): Save information about mapping
11693         symbols.
11694
11695 2010-01-11  Doug Kwan  <dougkwan@google.com>
11696
11697         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
11698         Arm_relocate_functions::thumb32_branch_upper,
11699         Arm_relocate_functions::thumb32_branch_lower,
11700         Arm_relocate_functions::thumb32_cond_branch_offset,
11701         Arm_relocate_functions::thumb32_cond_branch_upper,
11702         Arm_relocate_functions::thumb32_cond_branch_lower,
11703         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
11704         branch offset encoding.
11705         (Arm_relocate_functions::thumb_branch_common): Use new branch
11706         offset encoding methods to avoid code duplication.
11707         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
11708         (Stub_addend_reader::operator()): Use new branch encoding method
11709         to avoid code duplication.
11710
11711 2010-01-11  Doug Kwan  <dougkwan@google.com>
11712
11713         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
11714         (Target_arm::do_finalize_sections): Define special EXIDX section
11715         symbols only if referenced.
11716         * gc.h (Garbage_collection::add_reference): New method.
11717         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
11718         code duplication.
11719
11720 2010-01-11  Ian Lance Taylor  <iant@google.com>
11721
11722         * script.cc (Version_script_info::build_expression_list_lookup):
11723         Change complaing about duplicate wildcard match from error to
11724         warning.
11725
11726         * script.cc (class Lazy_demangler): Recreate--revert part of patch
11727         of 2009-12-30.
11728         (Version_script_info::Version_script_info): Initialize globs_,
11729         default_version_, default_is_global_, and exact_.  Don't
11730         initialize globals_ or locals_.
11731         (Version_script_info::build_lookup_tables): Build local symbols
11732         first.
11733         (Version_script_info::unquote): New function.
11734         (Version_script_info::add_exact_match): New function.
11735         (Version_script_info::build_expression_list_lookup): Remove lookup
11736         parameter.  Add is_global parameter.  Change all callers.  Handle
11737         wildcard pattern specially.  Unquote pattern.  Call
11738         add_exact_match.
11739         (Version_script_info::get_name_to_match): New function.
11740         (Version_script_info::get_symbol_version): New function.
11741         (Version_script_info::get_symbol_version_helper): Remove.
11742         (Version_script_info::check_unmatched_names): Call unquote.
11743         * script.h (class Version_script_info): Change get_symbol_version
11744         to be non-inline and add is_global parameter; change all callers.
11745         Rewrite symbol_is_local.  Update declarations.  Define struct
11746         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
11747         Remove globals_ and locals_ members.  Add exact_, globs_,
11748         default_version_, is_global_.
11749         (Version_script_info::Glob): Remove pattern, add expression and
11750         is_global.  Update constructor.  Change all callers.
11751         * dynobj.cc (Versions::finalize): Mark the version symbol as the
11752         default version.
11753         (Versions::symbol_section_contents): If a symbol is undefined, or
11754         defined in a dynamic object, set the version index to
11755         VER_NDX_LOCAL.
11756         * symtab.cc (Symbol_table::add_from_relobj): Don't call
11757         symbol_is_local.
11758         (Symbol_table::add_from_pluginobj): Likewise.
11759         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
11760
11761 2010-01-11  Doug Kwan  <dougkwan@google.com>
11762
11763         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
11764         (incremental_dump_LDADD): Add linking option for libintl.
11765         * Makefile.in: Regenerate.
11766
11767 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
11768
11769         PR gold/11144
11770         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
11771         instead of -Ds.
11772         * testsuite/Makefile.in: Regenerated.
11773
11774 2010-01-10  Doug Kwan  <dougkwan@google.com>
11775
11776         * options.h (DEFINE_var): Use parentheses around argument varname__
11777         in macro body to avoid any unintended subsequent substitutions.
11778
11779 2010-01-10  Ian Lance Taylor  <iant@google.com>
11780
11781         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
11782         candidates before doing symbol resolution.
11783
11784         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
11785         ODR candidates if only one is weak.
11786
11787 2010-01-08  Ian Lance Taylor  <iant@google.com>
11788
11789         * script.cc (Version_script_info::build_expression_list_lookup):
11790         Don't warn about ambiguous version, just record the ambiguity.
11791         (Version_script_info::get_symbol_version_helper): Give error if
11792         version is ambiguous.
11793
11794 2010-01-08  Doug Kwan  <dougkwan@google.com>
11795
11796         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
11797         prev_data_size_ and prev_addralign_.  Remove initializer for
11798         deleted data member has_been_changed_.
11799         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
11800         to determine if the table is empty.
11801         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
11802         Remove.
11803         (Stub_table::add_reloc_stub): Define method in class definition
11804         instead of just declaring it there.
11805         (Stub_table::add_cortex_a8_stub): New method definition.
11806         (Stub_table::update_data_size_and_addralign): Ditto.
11807         (Stub_table::finalize_stubs): Ditto.
11808         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
11809         (Stub_table::do_addralign_): Return address alignment in the
11810         (Stub_table::do_reset_address_and_file_offset): Define method in
11811         class definition instead of declaring it there.  Set current data
11812         size to be the data size of the previous pass.
11813         (Stub_table::set_final_data_size): Use current data size as the
11814         final data size.
11815         (Stub_table::relocate_stub): Change parameter type of stub from
11816         Reloc_stub pointer to Stub pointer.
11817         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
11818         (Stub_table::Cortex_a8_stub_list): New typedef.
11819         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
11820          Stub_table::prev_addralign_): New data member.
11821         (Arm_relobj::Arm_relobj): Initialize data member
11822         section_has_cortex_a8_workaround_.
11823         (Arm_relobj::section_has_cortex_a8_workaround,
11824          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
11825          definitions.
11826         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
11827         declarations.
11828         (Target_arm::relocate_stub): Change parameter type of stub from
11829         Reloc_stub pointer to Stub pointer.
11830         (Insn_template::size, Insn_template::alignment): Handle
11831         THUMB16_SPECIAL_TYPE.
11832         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
11833          Stub_table::update_data_size_and_addralign,
11834          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
11835         definitions.
11836         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
11837         (Stub_table::do_write): Ditto.
11838         (Target_arm::do_relax): Adjust code for changes in Stub_table.
11839
11840 2010-01-08  Ian Lance Taylor  <iant@google.com>
11841
11842         PR 11108
11843         * symtab.h (class Symbol): Remove fields is_target_special_ and
11844         has_plt_offset_.  Add field is_defined_in_discarded_section_.
11845         (Symbol::is_defined_in_discarded_section): New function.
11846         (Symbol::set_is_defined_in_discarded_section): New function.
11847         (Symbol::has_plt_offset): Rewrite.
11848         (Symbol::set_plt_offset): Verify that new offset is not -1U.
11849         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
11850         Don't initialize is_target_special_ or has_plt_offset_.
11851         Initialize is_defined_in_discarded_section_.
11852         (Symbol_table::add_from_relobj): If appropriate, set
11853         is_defined_in_discarded_section.
11854         * resolve.cc (Symbol::override_base_with_special): Don't test
11855         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
11856         * target-reloc.h (relocate_section): Do special handling for
11857         symbols defined in discarded sections for global symbols as well
11858         as local symbols.
11859
11860 2010-01-08  Ian Lance Taylor  <iant@google.com>
11861
11862         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
11863         the SHT_SYMTAB case.
11864
11865 2010-01-08  Ian Lance Taylor  <iant@google.com>
11866
11867         * object.cc (Sized_relobj::do_layout): Don't get confused if
11868         layout_eh_frame returns NULL.
11869
11870 2010-01-08  Ian Lance Taylor  <iant@google.com>
11871
11872         PR 11084
11873         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
11874         dynamic symbol table, use the normal symbol table.
11875         (Sized_dynobj::do_read_symbols): Remove assertion about type of
11876         symbol table.
11877
11878 2010-01-08  Ian Lance Taylor  <iant@google.com>
11879
11880         PR 11072
11881         * layout.cc (Layout::include_section): Remove .gnu_debuglink
11882         sections.
11883
11884 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
11885
11886         * version.cc (print_version): Change to "Copyright 2010".
11887
11888 2010-01-08  Ian Lance Taylor  <iant@google.com>
11889
11890         PR 10287
11891         PR 11063
11892         * i386.cc (class Target_i386): Change return type of plt_section
11893         to be non-const.
11894         (class Output_data_plt_i386): Add tls_desc_rel_ field.
11895         (Output_data_plt_i386::Output_data_plt_i386): Initialize
11896         tls_desc_rel_ field.
11897         (Output_data_plt_i386::rel_tls_desc): New function.
11898         (Target_i386::rel_tls_desc_section): New function.
11899         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
11900         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
11901         R_386_TLS_DESC reloc in rel_tls_desc_section.
11902         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
11903         Define struct Tlsdesc_info.
11904         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
11905         (Target_x86_64::do_reloc_symbol_index): New function.
11906         (Target_x86_64::add_tlsdesc_info): New function.
11907         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
11908         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
11909         tlsdesc_rel_ field.
11910         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
11911         all callers.
11912         (Output_data_plt_x86_64::rela_tlsdesc): New function.
11913         (Target_x86_64::rela_tlsdesc_section): New function.
11914         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
11915         handling.
11916         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
11917         (Target_x86_64::do_reloc_addend): New function.
11918         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
11919         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
11920         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
11921         (Output_reloc::type): New function.
11922         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
11923         (Output_reloc::is_target_specific): New function.
11924         (Output_reloc::target_arg): New function.
11925         (class Output_reloc) [SHT_RELA]: Add four new constructors for
11926         absolute relocs and target specific relocs.
11927         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
11928         add_target_specific.
11929         (class Output_data_reloc) [SHT_RELA]: Likewise.
11930         * output.cc (Output_reloc::Output_reloc): Add four new versions
11931         for absolute relocs and target specific relocs.
11932         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
11933         (Output_reloc::get_symbol_index): Likewise.
11934         (Output_reloc::local_section_offset): Check that local_sym_index_
11935         is not TARGET_CODE or 0.
11936         (Output_reloc::symbol_value): Likewise.
11937         (Output_reloc::write) [SHT_RELA]: Call target for target specific
11938         reloc.
11939         * target.h (class Target): Add reloc_symbol_index and reloc_addend
11940         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
11941         functions.
11942         * layout.cc (add_target_dynamic_tags): Use output section for
11943         DT_PLTRELSZ and DT_JMPREL.
11944
11945 2010-01-07  Ian Lance Taylor  <iant@google.com>
11946
11947         PR 11061
11948         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
11949         function.
11950         (class Output_data_reloc_generic): Define.
11951         (class Output_data_reloc_base): Change base class to
11952         Output_data_reloc_generic.  Change add() method to call
11953         bump_relative_reloc_count for a relative reloc.  Remove
11954         sort_relocs_ field.
11955         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
11956         to sort_relocs().
11957         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
11958         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
11959         appropriate.
11960         * layout.h (class Layout): Update declaration.
11961
11962 2010-01-07  Ian Lance Taylor  <iant@google.com>
11963
11964         * output.h (class Output_data): Add const version of
11965         output_section and do_output_section.
11966         (class Output_section_data): Add const version of
11967         do_output_section.
11968         (class Output_section): Likewise.
11969         * layout.cc (Layout::add_target_dynamic_tags): New function.
11970         * layout.h (class Layout): Update declarations.
11971         * arm.cc (Target_arm::do_finalize_sections): Use
11972         add_target_dynamic_tags.
11973         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11974         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11975         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11976         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11977
11978 2010-01-07  Ian Lance Taylor  <iant@google.com>
11979
11980         PR 11042
11981         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
11982         object as needed.
11983
11984 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
11985             Ian Lance Taylor  <iant@google.com>
11986
11987         PR 11019
11988         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
11989         Xindex::read_symtab_xindex.
11990
11991 2010-01-07  Doug Kwan  <dougkwan@google.com>
11992
11993         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
11994         (Insn_template::thumb16_bcond_insn): New method declaration.
11995         (Insn_template): Fix spelling.
11996         (Stub::thumb16_special): New method declaration.
11997         (Stub::do_write): Define virtual method which was previously pure
11998         virtual.
11999         (Stub::do_thumb16_special): New method declaration.
12000         (Stub::do_fixed_endian_write): New template member.
12001         (Reloc_stub::do_write): Remove.
12002         (Reloc_stub::do_fixed_endian_write): Remove.
12003         (Cortex_a8_stub): New class definition.
12004         (Stub_factory::make_cortex_a8_stub): New method definition.
12005         (Stub_factory::Stub_factory): Add missing static storage class
12006         qualifier for elf32_arm_stub_a8_veneer_blx.
12007
12008 2010-01-07  Ian Lance Taylor  <iant@google.com>
12009
12010         PR 10980
12011         * options.h (class General_options): Add --warn-unresolved-symbols
12012         and --error-unresolved-symbols.
12013         * errors.cc (Errors::undefined_symbol): Implement
12014         --warn-unresolved-symbols.
12015
12016         * options.h (class General_options): Add -z text and -z textoff.
12017         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
12018
12019 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
12020
12021         * gc.h (Garbage_collection::Cident_section_map): New typedef.
12022         (Garbage_collection::cident_sections): New function.
12023         (Garbage_collection::add_cident_section): New function.
12024         (Garbage_collection::cident_sections_): New member.
12025         (gc_process_relocs): Add references to sections whose names are C
12026         identifiers.
12027         * gold.h (cident_section_start_prefix): New constant.
12028         (cident_section_stop_prefix): New constant.
12029         (is_cident): New function.
12030         * layout.cc (Layout::define_section_symbols): Replace string constants
12031         with the newly defined constants.
12032         * object.cc (Sized_relobj::do_layout): Track sections whose names are
12033         C identifiers.
12034         * testsuite/Makefile.am: Add gc_orphan_section_test.
12035         * testsuite/Makefile.in: Regenerate.
12036         * testsuite/gc_orphan_section_test.cc: New file.
12037         * testsuite/gc_orphan_section_test.sh: New file.
12038
12039 2010-01-06  Ian Lance Taylor  <iant@google.com>
12040
12041         PR 10980
12042         * options.h (class General_options): Add --warn-shared-textrel.
12043         * layout.cc (Layout::finish_dynamic_section): Implement
12044         --warn-shared-textrel.
12045
12046         PR 10980
12047         * options.h (class General_options): Add --warn-multiple-gp.
12048
12049 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12050
12051         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
12052         $(THREADSLIB) and $(LIBDL).
12053         * Makefile.in: Rebuild.
12054
12055 2010-01-06  Ian Lance Taylor  <iant@google.com>
12056
12057         PR 10980
12058         * options.cc (General_options::parse_section_start): New function.
12059         (General_options::section_start): New function.
12060         (General_options::General_options): Initialize all members.
12061         * options.h: Include <map>
12062         (class General_options): Add --section-start.  Add section_starts_
12063         member.
12064         * layout.cc (Layout::attach_allocated_section_to_segment): If
12065         --section-start was used, set the address of the segment.  Remove
12066         local sort_sections.
12067         (Layout::relaxation_loop_body): If the address of the load segment
12068         has been set by --section-start, don't use it.
12069         * output.h (Output_segment::update_flags_for_output_section): New
12070         function.
12071         * output.cc (Output_segment::add_output_section): Call
12072         update_flags_for_output_section.
12073
12074 2010-01-05  Ian Lance Taylor  <iant@google.com>
12075
12076         PR 10980
12077         * options.h (class General_options): Add --undefined-version.
12078         * script.cc (struct Version_expression): Add was_matched_by_symbol
12079         field.
12080         (Version_script_info::matched_symbol): New function.
12081         (Version_script_info::get_symbol_version_helper): Call
12082         matched_symbol.
12083         (Version_script_info::check_unmatched_names): New function.
12084         * script.h (class Version_script_info): Update declarations.
12085         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
12086
12087         * options.h (class General_options): Use DEFINE_bool_alias for
12088         allow_multiple_definition.
12089         * resolve.cc (Symbol_table::should_override): Don't test
12090         allow_multiple_definition.
12091
12092         PR 10980
12093         * options.h (class General_options): Add --cref.
12094         * main.cc (main): Print cref table if --cref.  Don't close mapfile
12095         until after printing cref table.
12096         * cref.cc: Include "symtab.h".
12097         (class Cref_inputs): Define Cref_table_compare and Cref_table.
12098         (Cref_table_compare::operator()): New function.
12099         (Cref_inputs::gather_cref): New function.
12100         (filecol): New static const.
12101         (Cref_inputs::print_cref): New function.
12102         (Cref::print_cref): New function.
12103         * cref.h: Include <cstdio>.
12104         (class Cref): Update declarations.
12105         * mapfile.h (Mapfile::file): New function.
12106         * object.h (class Object): Define Symbols.  Declare virtual
12107         do_get_global_symbols.
12108         (Object::get_global_symbols): New function.
12109         * object.cc (Input_objects::add_object): Pass object to cref_ if
12110         --cref.
12111         (Input_objects::archive_start): Likewise.
12112         (Input_objects::archive_stop): Likewise.
12113         (Input_objects::print_cref): New function.
12114         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
12115         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
12116         --cref.
12117         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
12118         function.
12119         * plugin.h (class Sized_pluginobj): Update declarations.
12120
12121 2010-01-05  Ian Lance Taylor  <iant@google.com>
12122
12123         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
12124         to is_default_version.  Rename insdef to insdefault.
12125         (Symbol_table::add_from_relobj): Rename def to is_default_version
12126         and local to is_forced_local.
12127         (Symbol_table::add_from_pluginobj): Likewise.
12128         (Symbol_table::add_from_dynobj): Likewise.
12129         (Symbol_table::define_special_symbol): Rename insdef to
12130         insdefault.
12131
12132 2010-01-04  Ian Lance Taylor  <iant@google.com>
12133
12134         PR 10980
12135         * options.h (class General_options): Add
12136         --allow-multiple-definition and -z muldefs.
12137         * resolve.cc (Symbol_table::should_override): Don't warn about a
12138         multiple symbol definition if --allow-multiple-definition or -z
12139         muldefs.
12140
12141         PR 10980
12142         * options.h (class General_options): Add --add-needed and
12143         --copy-dt-needed-entries.  Tweak --as-needed help entry.
12144         * object.cc (Input_objects::check_dynamic_dependencies): Give an
12145         error if --copy-dt-needed-entries aka --add-needed is used and
12146         would cause a change in behaviour.
12147
12148         PR 10980
12149         * options.h (class General_options): Add -G as a short version of
12150         --shared.  Add no-op options -assert, -g, and -i.
12151
12152 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
12153
12154         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
12155         check for .text or .gnu.linkonce.t sections.
12156         * icf.cc (Icf::find_identical_sections): Ditto.
12157         Change the detection for mangled function name within the section
12158         name.
12159         * icf.h (is_section_foldable_candidate): New function.
12160
12161 2009-12-30  Ian Lance Taylor  <iant@google.com>
12162
12163         PR 10980
12164         * options.h (class General_options): Permit two dashes with
12165         --retain-symbols-file.
12166
12167 2009-12-30  Ian Lance Taylor  <iant@google.com>
12168
12169         PR 10979
12170         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
12171         don't put the file header and segment headers in the text
12172         segment.
12173
12174         PR 10979
12175         * common.cc (Sort_commons::operator()): Stabilize sort when both
12176         entries are NULL.
12177         (Symbol_table::do_allocate_commons_list): When allocating common
12178         symbols, skip a symbol which is no longer common.
12179         * symtab.h (Symbol::is_common): Test whether the symbol comes from
12180         an object before checking its type.
12181         * testsuite/common_test_2.c: New file.
12182         * testsuite/common_test_3.c: New file.
12183         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
12184         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
12185         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
12186         (common_test_2_pic.o, common_test_2.so): New targets.
12187         (common_test_3_pic.o, common_test_3.so): New targets.
12188         * testsuite/Makefile.in: Rebuild.
12189
12190         PR 10979
12191         * script.cc (read_input_script): If we see a new SECTIONS clause,
12192         and we have added an input section, give an error.
12193         * layout.h (class Layout): Add have_added_input_section function.
12194         Add have_added_input_section_ field.
12195         * layout.cc (Layout::Layout): Initialize
12196         have_added_input_section_.
12197         (Layout::layout): Set have_added_input_section_.
12198         (Layout::layout_eh_frame): Likewise.
12199
12200 2009-12-30  Ian Lance Taylor  <iant@google.com>
12201
12202         PR 10931
12203         * options.h (class General_options): Add --sort-common option.
12204         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
12205         * common.cc (Sort_common): Add sort_order parameter to
12206         constructor.  Add sort_order_ field.
12207         (Sort_commons::operator): Check sort_order_.
12208         (Symbol_table::allocate_commons): Determine the sort order.
12209         (Symbol_table::do_allocate_commons): Add sort_order parameter.
12210         Change all callers.
12211         (Symbol_table::do_allocate_commons_list): Likewise.
12212
12213 2009-12-30  Ian Lance Taylor  <iant@google.com>
12214
12215         PR 10916
12216         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
12217         symbols from this object, don't change the visibility of an
12218         undefined symbol.
12219         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
12220
12221 2009-12-30  Ian Lance Taylor  <iant@google.com>
12222
12223         PR 10861
12224         * script.h (class Version_script_info): Define Language enum.
12225         Update declarations.  Define Glob, Exact, and Lookup types.  Add
12226         new fields globals_, locals_, and is_finalized_.
12227         * script.cc: Various formatting fixes.
12228         (class Parser_closure): Change language_stack_ from a vector of
12229         std::string to one of Version_script_info::Language.  Adjust all
12230         uses accordingly.
12231         (class Lazy_demangler): Remove.
12232         (struct Version_expression): Change language from std::string to
12233         Version_script_info::Language.
12234         (Version_script_info::Version_script_info): New function.
12235         (Version_script_info::~Version_script_info): Don't call clear.
12236         (Version_script_info::finalize): New function.
12237         (Version_script_info::build_lookup_tables): New function.
12238         (Version_script_info::build_expression_list_lookup): New
12239         function.
12240         (Version_script_info::get_symbol_version_helper): Rewrite to use
12241         lookup tables.
12242         (Version_script_info::print_expression_list): Adjust to use
12243         Version_script_info::Language.
12244         (script_push_lex_into_version_mode): Check that the version script
12245         has not been finalized.
12246         (version_script_push_lang): Change language string to
12247         Version_script_info::Language.
12248         * options.cc (Command_line::version_script): New function.
12249         * options.h (class General_options): Add finalize_dynamic_list
12250         function.  Change version_script from declaration to definition.
12251         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
12252         * testsuite/version_script.map: Remove duplicate def of foo.
12253         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
12254         version_script.map.
12255         * testsuite/Makefile.in: Rebuild.
12256
12257 2009-12-30  Ian Lance Taylor  <iant@google.com>
12258
12259         PR 10843
12260         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
12261         if the input symbol index is 0, make the output symbol index 0.
12262
12263 2009-12-30  Ian Lance Taylor  <iant@google.com>
12264
12265         PR 10670
12266         * options.h (class General_options): Add -x/--discard-all.
12267         * object.cc (Sized_relobj::do_count_local_symbols): Handle
12268         --discard-all.  If the local symbol needs a dynamic entry, check
12269         that before handling --discard-locals.
12270
12271 2009-12-30  Ian Lance Taylor  <iant@google.com>
12272
12273         PR 10450
12274         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
12275         flags to PF_R.
12276         (Output_segment::add_output_section): Don't change the flags if
12277         the type is PT_TLS.
12278
12279         PR 10450
12280         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
12281         GNU hash table if they need a dynamic value.  Otherwise, don't add
12282         them if they are defined in a dynamic object or are forced local.
12283
12284 2009-12-29  Ian Lance Taylor  <iant@google.com>
12285
12286         PR 10450
12287         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
12288         .gnu.hash table for a 32-bit target.
12289
12290         PR 10450
12291         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
12292         regular and a dynamic object only needs a dynamic symbol table
12293         entry if it is externally visible.
12294
12295         PR 10450
12296         * i386.cc (class Target_i386): Initialize global_offset_table_ in
12297         constructor.  Add global_offset_table_ field.
12298         (Target_i386::got_section): Set global_offset_table_.
12299         (Target_i386::do_finalize_sections): Set global_offset_table_
12300         size.
12301         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
12302         in constructor.  Add global_offset_table_ field.
12303         (Target_x86_64::got_section): Set global_offset_table_.
12304         (Target_x86_64::do_finalize_sections): Set global_offset_table_
12305         size.
12306
12307         * layout.cc (Layout::Layout): Initialize increase_relro_.
12308         (Layout::get_output_section): Add is_relro, is_last_relro, and
12309         is_first_non_relro parameters.  Change all callers.
12310         (Layout::choose_output_section): Likewise.
12311         (Layout::add_output_section_data): Likewise.
12312         (Layout::make_output_section): Likewise.
12313         (Layout::set_segment_offsets): Clear increase_relro when using a
12314         linker script.
12315         * layout.h (class Layout): Add increase_relro method.  Add
12316         increase_relro_ field.  Update declarations.
12317         * output.cc (Output_section::Output_section): Initialize
12318         is_last_relro_ and is_first_non_relro_.
12319         (Output_segment::add_output_section): Group relro sections is
12320         do_sort is true.  Handle is_last_relro and is_first_non_relro.
12321         (Output_segment::maximum_alignment): Remove relro handling.
12322         (Output_segment::set_section_addresses): Add increase_relro
12323         parameter.  Change all callers.  Add initial alignment to align
12324         relro sections on separate page.  Remove old relro handling.
12325         (Output_segment::set_section_list_addresses): Remove in_relro
12326         parameter.  Change all callers.
12327         (Output_segment::set_offset): Add increase parameter.  Change all
12328         callers.  Remove old relro handling.
12329         * output.h (class Output_section): Add new methods: is_last_relro,
12330         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
12331         Add is_last_relro_ and is_first_non_relro_ fields.
12332         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
12333         Create separate .got.plt section.  Call increase_relro.
12334         * x86_64.cc (Target_x86_64::got_section): Likewise.
12335         * testsuite/relro_script_test.t: Add .got.plt.
12336
12337         PR 10450
12338         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
12339         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
12340         (Layout::finalize): Call set_dynamic_symbol_size.
12341         (Layout::set_dynamic_symbol_size): New function.
12342         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
12343         set_dynamic_symbol_size.
12344
12345         PR 10450
12346         * output.h (class Output_section): Add is_entsize_zero_ field.
12347         * output.cc (Output_section::Output_section): Initialize
12348         is_entsize_zero_.
12349         (Output_section::set_entsize): If two different entsizes are
12350         requested, force it to zero.
12351         (Output_section::add_input_section): Set flags for .debug_str
12352         before updating section flags.  Set entsize.
12353         (Output_section::update_flags_for_input_section): Set SHF_MERGE
12354         and SHF_STRING if all input sections have those flags.
12355
12356 2009-12-29   Rafael Espindola  <espindola@google.com>
12357
12358         * main.cc (main): Fix the sys time reporting.
12359         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
12360         reporting.
12361
12362 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
12363
12364         * options.cc (General_options::parse_version): Allow -v to exit
12365         without an error if there is nothing to link.
12366
12367 2009-12-29  Ian Lance Taylor  <iant@google.com>
12368
12369         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
12370         using a version of gcc before 4.1.
12371         * configure: Rebuild.
12372
12373 2009-12-28  Chris Demetriou  <cgd@google.com>
12374
12375         * attributes.cc (Output_attributes_section_data::do_write): Use
12376         std::vector::front rather than std::vector::data.
12377
12378 2009-12-28  Ian Lance Taylor  <iant@google.com>
12379
12380         * symtab.h (class Symbol_table): Add enum Defined.
12381         * resolve.cc (Symbol_table::should_override): Add defined
12382         parameter.  Change all callers.  Test whether object is NULL
12383         before calling a method on it.
12384         (Symbol_table::report_resolve_problem): Add defined parameter.
12385         Change all callers.
12386         (Symbol_table::should_override_with_special): Likewise.
12387         * symtab.cc (Symbol_table::define_in_output_data): Add defined
12388         parameter.  Change all callers.
12389         (Symbol_table::do_define_in_output_data): Likewise.
12390         (Symbol_table::define_in_output_segment): Likewise.
12391         (Symbol_table::do_define_in_output_segment): Likewise.
12392         (Symbol_table::define_as_constant): Likewise.
12393         (Symbol_table::do_define_as_constant): Likewise.
12394         * script.h (class Symbol_assignment): Add is_defsym parameter to
12395         constructor; change all callers.
12396         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
12397         parameter.  Change all callers.  Add is_defsym_ field.
12398         (class Parser_closure): Add parsing_defsym parameter to
12399         constructor; change all callers.  Add parsing_defsym accessor
12400         function.  Add parsing_defsym_ field.
12401
12402 2009-12-28  Ian Lance Taylor  <iant@google.com>
12403
12404         * gold.cc (queue_middle_tasks): Fix formatting.
12405         * object.cc (Relobj::is_section_name_included): Likewise.
12406
12407 2009-12-23  Ian Lance Taylor  <iant@google.com>
12408
12409         * i386.cc (Target_i386::do_calls_non_split): Recognize
12410         -fsplit-stack prologue for a function with a static chain.
12411         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
12412         -fsplit-stack prologue when using %r11.
12413
12414 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
12415
12416         * options.cc (General_options::parse_version): Make -v continue and do
12417         the link like GNU ld does.
12418
12419 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
12420
12421         * Makefile.am (CCFILES): Add timer.cc.
12422         (HFILES): Add timer.h.
12423         * configure.ac: Check for sysconf and times.
12424         * main.cc: include timer.h.
12425         (main): Use Timer instead of get_run_time.
12426         * timer.cc: New.
12427         * timer.h: New.
12428         * workqueue.cc: include timer.h.
12429         (Workqueue::find_and_run_task):
12430         Report user, sys and wall time.
12431         * Makefile.in: Regenerate.
12432         * config.in: Regenerate.
12433         * configure: Regenerate.
12434
12435 2009-12-16  Doug Kwan  <dougkwan@google.com>
12436
12437         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
12438         sections.
12439         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
12440         relaxed input sections.
12441         * output.cc (Output_section::find_relaxed_input_section): Change
12442         return type to Output_relaxed_input_section pointer.  Adjust code
12443         for new type of relaxed_input_section_map_.
12444         * output.h (Output_section::find_relaxed_input_section): Change
12445         return type to Output_relaxed_input_section pointer.
12446         (Output_section::Output_relaxed_input_section_by_input_section_map):
12447         New type.
12448         (Output_section::relaxed_input_section_map_): Change type to
12449         Output_section::Output_relaxed_input_section_by_input_section_map.
12450         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
12451         input section.
12452
12453 2009-12-15  Ian Lance Taylor  <iant@google.com>
12454
12455         * layout.cc (Layout::create_shstrtab): Only write out after input
12456         sections if we are compressing debug sections.
12457
12458 2009-12-15  Ian Lance Taylor  <iant@google.com>
12459
12460         * archive.cc (Archive::add_symbols): Only look up a symbol without
12461         a version if there is, in fact, a version.
12462
12463 2009-12-14  Ian Lance Taylor  <iant@google.com>
12464
12465         Revert -Wshadow changes, all changes from:
12466         2009-12-11  Doug Kwan  <dougkwan@google.com>
12467         2009-12-11  Nick Clifton  <nickc@redhat.com>
12468         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
12469
12470 2009-12-11  Doug Kwan  <dougkwan@google.com>
12471
12472         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
12473         due to -Wshadow.
12474         * attributes.cc (Object_attribute::size): Ditto.
12475         (Attributes_section_data::size): Ditto.
12476         (Attributes_section_data::Attributes_section_data): Ditto.
12477         (Output_attributes_section_data::do_write): Ditto.
12478         * attributes.h (Object_attribute::set_type): Ditto.
12479         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
12480
12481 2009-12-11  Nick Clifton  <nickc@redhat.com>
12482
12483         * archive.cc: Fix shadowed variable warnings.
12484         * arm.cc: Likewise.
12485         * compressed_output.cc: Likewise.
12486         * compressed_output.h: Likewise.
12487         * configure: Likewise.
12488         * dwarf_reader.cc: Likewise.
12489         * dynobj.cc: Likewise.
12490         * dynobj.h: Likewise.
12491         * ehframe.cc: Likewise.
12492         * ehframe.h: Likewise.
12493         * errors.cc: Likewise.
12494         * expression.cc: Likewise.
12495         * fileread.cc: Likewise.
12496         * fileread.h: Likewise.
12497         * freebsd.h: Likewise.
12498         * i386.cc: Likewise.
12499         * icf.cc: Likewise.
12500         * incremental.h: Likewise.
12501         * layout.cc: Likewise.
12502         * layout.h: Likewise.
12503         * mapfile.cc: Likewise.
12504         * merge.cc: Likewise.
12505         * merge.h: Likewise.
12506         * object.cc: Likewise.
12507         * object.h: Likewise.
12508         * options.h: Likewise.
12509         * output.cc: Likewise.
12510         * output.h: Likewise.
12511         * parameters.cc: Likewise.
12512         * plugin.cc: Likewise.
12513         * powerpc.cc: Likewise.
12514         * reduced_debug_output.cc: Likewise.
12515         * reduced_debug_output.h: Likewise.
12516         * reloc.cc: Likewise.
12517         * reloc.h: Likewise.
12518         * resolve.cc: Likewise.
12519         * script-sections.cc: Likewise.
12520         * script.cc: Likewise.
12521         * script.h: Likewise.
12522         * sparc.cc: Likewise.
12523         * symtab.cc: Likewise.
12524         * symtab.h: Likewise.
12525         * target-select.cc: Likewise.
12526         * target-select.h: Likewise.
12527         * token.h: Likewise.
12528         * workqueue.cc: Likewise.
12529         * workqueue.h: Likewise.
12530         * x86_64.cc: Likewise.
12531
12532 2009-12-10  Doug Kwan  <dougkwan@google.com>
12533
12534         * arm.cc (attributes.h): New include.
12535         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
12536         (Arm_relobj::~Arm_relobj): Delete object pointed by
12537         attributes_section_data_.
12538         (Arm_relobj::attributes_section_data): New method definition.
12539         (Arm_relobj::attributes_section_data_): New data member declaration.
12540         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
12541         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
12542         attributes_section_data_.
12543         (Arm_dynobj::attributes_section_data): New method definition.
12544         (Arm_dynobj::attributes_section_data_): New data member declaration.
12545         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
12546         initialization value of may_use_blx_ to false.
12547         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
12548         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
12549         object attributes to compute results instead of hard-coding.
12550         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
12551         Target_arm::get_secondary_compatible_arch,
12552         Target_arm::set_secondary_compatible_arch
12553         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12554         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
12555         New method declarations.
12556         (Target_arm::get_aeabi_object_attribute): New method definition.
12557         (Target_arm::attributes_section_data_): New data member declaration.
12558         (read_arm_attributes_section): New template definition.
12559         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
12560         (Arm_dynobj::do_read_symbols): Ditto.
12561         (Target_arm::do_finalize_sections): Merge attributes sections from
12562         input.  Check for BLX use after attributes section merging.
12563         Fix __exidx_start and __exidx_end visibility.  Create an
12564         .ARM.attributes section if necessary.
12565         (Target_arm::get_secondary_compatible_arch,
12566         Target_arm::set_secondary_compatible_arch,
12567         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12568         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
12569         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
12570         New method definitions.
12571
12572 2009-12-09  Ian Lance Taylor  <iant@google.com>
12573
12574         * plugin.cc (Plugin::load): Don't cast from void* to a function
12575         pointer.
12576
12577 2009-12-09  Ian Lance Taylor  <iant@google.com>
12578
12579         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
12580         information fields.
12581
12582 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
12583
12584         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
12585         Replace two_file_shared_1.so with two_file_shared_2.so.
12586         * testsuite/Makefile.in: Regenerated.
12587
12588 2009-12-08  Doug Kwan  <dougkwan@google.com>
12589
12590         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
12591         (HFILES): Add attributes.h and int_encoding.h.
12592         * Makefile.in: Regenerate.
12593         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
12594         function definitions to int_encoding.cc
12595         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
12596         prototypes to int_encoding.h
12597         * reduced_debug_output.cc (int_encoding.h): New include.
12598         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
12599         function definitions to int_encoding.cc
12600         (insert_into_vector, read_from_pointer): Move template definitions to
12601         int_encoding.h
12602         * attributes.cc: New file.
12603         * attributes.h: New file.
12604         * int_encoding.cc: New file.
12605         * int_encoding.h: New file.
12606
12607 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
12608
12609         PR gold/11055
12610         * incremental-dump.cc (dump_incremental_inputs): New.
12611         (main): Use dump_incremental_inputs.
12612
12613 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
12614
12615         PR gold/10893
12616         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
12617         checking elfcpp::STT_FUNC.
12618         (Target_i386::Relocate::relocate): Likewise.
12619         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
12620
12621         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
12622         symbols from shared libraries into normal FUNC symbols.
12623
12624         * symtab.h (Symbol): Add is_func and use it.
12625
12626 2009-12-05  Doug Kwan  <dougkwan@google.com>
12627
12628         * arm.cc (Target_arm::arm_info): Initialize new fields
12629         attributes_section and attributes_vendor.
12630         * i386.cc (Target_i386::i386_info): Same.
12631         * object.cc (Sized_relobj::do_layout): Skip attribute section.
12632         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
12633         fields attributes_section and attributes_vendor.
12634         * sparc.cc (Target_sparc::sparc_info): Same.
12635         * target.h (Target::attributes_section, Target::attributes_vendor,
12636         Target::is_attributes_section, Target::attribute_arg_type,
12637         Target::attributes_order): New method definitions.
12638         (Target::Target_info::attributes_section,
12639         Target::Target_info::attributes_vendor): New fields.
12640         (Target::do_attribute_arg_type, Target::do_attributes_order): New
12641         virtual method definitions.
12642         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
12643         attributes_section and attributes_vendor.
12644         * testsuite/testfile.cc (Target_test::test_target_info): Same.
12645
12646 2009-12-05  Doug Kwan  <dougkwan@google.com>
12647
12648         * arm.cc: Update comments about interworking and stub generation.
12649         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
12650         considered as non-PIC.
12651         (Arm_relocate_functions::base_abs): Fix formatting.
12652         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
12653         of function to use GOT entry address instead of offset.
12654         (Target_arm::Scan::global): Issue an error if a symbol would need a
12655         PLT does not get one because it is untyped.  Remove code to create
12656         dynamic symbols for relative branches.
12657         (Target_arm::Relocate::relocate: Use 0 instead of false since function
12658         takes unsigned integer instead of boolean.
12659
12660 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
12661
12662         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
12663         (two_file_test_LDADD): Likewise.
12664         (common_test_1_LDADD): Likewise.
12665         (exception_test_LDADD) Likewise.
12666         (weak_test_LDADD): Likewise.
12667         (many_sections_test_LDADD): Likewise.
12668         (initpri1_LDADD): Likewise.
12669         (script_test_1_LDADD): Likewise.
12670         (script_test_2_LDADD): Likewise.
12671         (justsyms_LDADD): Likewise.
12672         (binary_test_LDADD): Likewise.
12673         (large_LDADD): Likewise.
12674         * testsuite/Makefile.in: Regenerated.
12675
12676 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
12677
12678         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
12679         (Symbol_table::override_with_special): Likewise.
12680         (Symbol_table::add_from_object): Likewise.
12681
12682 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12683
12684         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12685         Don't set the data_offset twice.
12686
12687 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12688
12689         * testsuite/Makefile.in: Regenerate.
12690
12691 2009-12-03  Doug Kwan  <dougkwan@google.com>
12692
12693         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
12694         (Target_arm::do_finalize_sections): Add parameter for symbol table
12695         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
12696         * i386.cc (Target_i386::do_finalize_sections): Add an additional
12697         parameter for symbol table pointer.
12698         * layout.cc (Layout::finalize): Call Target::finalize_sections with
12699         an additional parameter for a pointer to symbol table.
12700         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
12701         parameter for a symbol table pointer.
12702         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
12703         * target.h (Target::finalize_sections, Target::do_finalize_sections):
12704         Ditto.
12705         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
12706         parameter for a symbol table pointer.
12707
12708 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
12709
12710         * incremental.cc (Incremental_inputs_header)
12711         (Incremental_inputs_header_write, Incremental_inputs_entry)
12712         (Incremental_inputs_entry_write): Move ...
12713         * incremental.h (Incremental_inputs_header)
12714         (Incremental_inputs_header_write, Incremental_inputs_entry)
12715         (Incremental_inputs_entry_write): here.
12716
12717 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12718
12719         * incremental.cc (make_sized_incremental_binary): Set the target.
12720         Error if it is incompatible.
12721         * output.h (Output_file): Add filename method.
12722
12723 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12724
12725         * incremental.cc (Incremental_inputs_entry): Remove unused argument
12726         from the get_* methods.
12727
12728 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12729
12730         * incremental-dump.cc (main): Check that the offeset of a script is 0.
12731         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12732         Write 0 for the data_offset of scripts.
12733
12734 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12735
12736         * testsuite/Makefile.am: Add the incremental_test.sh test.
12737         * testsuite/incremental_test.sh: New.
12738         * testsuite/incremental_test_1.c: New.
12739         * testsuite/incremental_test_2.c: New.
12740
12741 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
12742
12743         * incremental-dump.cc (main): Fix typos.
12744
12745 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
12746
12747         PR gold/11025
12748         * incremental-dump.cc (main): Use llu to print 64 bit values.
12749
12750 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
12751             H.J. Lu  <hongjiu.lu@intel.com>
12752
12753         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
12754         $(LIBDL).
12755         (incremental_dump_LDADD): Likewise.
12756         * Makefile.in: Regenerated.
12757
12758 2009-11-25  Doug Kwan  <dougkwan@google.com>
12759
12760         Revert:
12761
12762         2009-11-25  Doug Kwan  <dougkwan@google.com>
12763
12764                 * arm.cc (Target_arm::Target_arm): Move method definition
12765                 outside of class definition.  Add code to handle
12766                 --target1-rel, --target1-abs and --target2= options.
12767                 (Target_arm::get_reloc_reloc_type): Change method to be
12768                 non-static and const.
12769                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
12770                 New data member declaration.
12771                 (Target_arm::Scan::local, Target_arm::Scan::global,
12772                 Target_arm::Relocate::relocate,
12773                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12774                 Adjust call to Target_arm::get_real_reloc_type.
12775                 (Target_arm::get_real_reloc_type): Use command line options
12776                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12777                 * options.h (--target1-rel, --target1-abs, --target2): New
12778                 ARM-only options.
12779
12780 2009-11-25  Doug Kwan  <dougkwan@google.com>
12781
12782         * arm.cc (Target_arm::Target_arm): Move method definition outside of
12783         class definition.  Add code to handle --target1-rel, --target1-abs
12784         and --target2= options.
12785         (Target_arm::get_reloc_reloc_type): Change method to be non-static
12786         and const.
12787         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
12788         member declaration.
12789         (Target_arm::Scan::local, Target_arm::Scan::global,
12790         Target_arm::Relocate::relocate,
12791         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
12792         call to Target_arm::get_real_reloc_type.
12793         (Target_arm::get_real_reloc_type): Use command line options to
12794         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12795         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
12796         options.
12797
12798 2009-11-25  Doug Kwan  <dougkwan@google.com>
12799
12800         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
12801         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
12802         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
12803         formatting.
12804         (Arm_relocate_functions::thm_call): Replace body with a call to
12805         Arm_relocate_functions::thumb_branch_common.
12806         (Arm_relocate_functions::thm_jump24,
12807         Arm_relocate_functions::thm_xpc22): New method definitions.
12808         (Arm_relocate_functions::thumb_branch_common): New method definition.
12809         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
12810         operator.
12811         (Target_arm::Relocate::relocate): Adjust call to thm_call.
12812         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
12813
12814 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12815
12816         * Makefile.am: Build incremental-dump
12817         * Makefile.in: Regenerate.
12818         * incremental-dump.cc: New.
12819         * incremental.cc (Incremental_inputs_header_data,
12820         Incremental_inputs_entry_data): Move to incremental.h
12821         * incremental.h: (Incremental_inputs_header_data,
12822         Incremental_inputs_entry_data): Move from incremental.cc
12823
12824 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12825
12826         * incremental.cc (Incremental_inputs_header,
12827         Incremental_inputs_header_write, Incremental_inputs_entry,
12828         Incremental_inputs_entry_write): Add a typedef with the data type.
12829
12830 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12831
12832         * incremental.cc (Incremental_inputs_header,
12833         Incremental_inputs_header_write, Incremental_inputs_entry,
12834         Incremental_inputs_entry_write): Update comment about which
12835         type has the filed descriptions.
12836
12837 2009-11-15  Doug Kwan  <dougkwan@google.com>
12838
12839         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
12840         (Arm_relocate_functions::arm_branch_common): Change method defintion
12841         in class definition to a method declaration and update list of formal
12842         parameters.
12843         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
12844         Arm_relocation_functions::jump24): Adjust call to
12845         Arm_relocate_functions::arm_branch_common.  Update list of formal
12846         parameters.
12847         (Arm_relocate_functions::xpc25): New method definition.
12848         (Arm_relocate_functions::arm_branch_common): Move method defintion
12849         out from class definition.  Use stubs for mode-switching and extending
12850         branch ranges.
12851         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
12852         specially.  Change code to enable use of stubs in ARM branches.
12853
12854 2009-11-10  Doug Kwan  <dougkwan@google.com>
12855
12856         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
12857         in method declaration.
12858         (Target_arm::relocate_stub): New method declaration.
12859         (Target_arm::default_target): Change to return a pointer instead of
12860         a const reference.
12861         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
12862         Target_arm::default_target.
12863         (Arm_Relobj::do_relocate_sections): Remove options paramater in
12864         method definition.
12865         (Target_arm::relocate_section): Adjust view.
12866         (Target_arm::relocate_stub): New method definition.
12867
12868 2009-11-10  Doug Kwan  <dougkwan@google.com>
12869
12870         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
12871         a format warning.
12872         * incremental.cc (open_incremental_binary): Initialized local
12873         variables to avoid warnings.
12874         * object.cc (make_elf_object): Ditto.
12875         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
12876         a format warning.
12877
12878 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
12879
12880         PR gold/10930
12881         * testsuite/plugin_test.c: Include "config.h".
12882
12883 2009-11-09  Doug Kwan  <dougkwan@google.com>
12884
12885         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
12886         (arm_symbol_value): Remove.
12887         (Arm_relocate_functions::arm_branch_common,
12888         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
12889         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
12890         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
12891         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
12892         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12893         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12894         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12895         Arm_relocate_functions::thm_mobw_abs_nc,
12896         Arm_relocate_functions::thm_mov_abs,
12897         Arm_relocate_functions::movw_prel_nc,
12898         Arm_relocate_functions::thm_movt_abs,
12899         Arm_relocate_functions::movt_prel,
12900         Arm_relocate_functions::thm_movw_prel_nc,
12901         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
12902         (Target_arm::Relocate::relocate): Only decompose address into two
12903         parts if relocation type uses the thumb-bit and pass the actual
12904         bit instead of a flag indicating that the thumb-bit is used.  Adjust
12905         calls to methods in Arm_relocate_functions for this change.
12906
12907 2009-11-08  Ian Lance Taylor  <iant@google.com>
12908
12909         PR 10925
12910         * reloc.cc: Instantiate
12911         Sized_relobj::initialize_input_to_output_maps and
12912         Sized_relobj:free_input_to_output_maps.
12913
12914 2009-11-06  Ian Lance Taylor  <iant@google.com>
12915
12916         PR 10876
12917         * defstd.cc (in_segment): Set only_if_ref true for "end".
12918
12919 2009-11-06  Doug Kwan  <dougkwan@google.com>
12920
12921         * arm.cc (class Reloc_stub): Correct a comment.
12922         (Target_arm::Target_arm): Initialize arm_input_section_map_.
12923         (Target_arm::scan_section_for_stubs): New method declaration.
12924         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
12925         Change methods from private to protected.
12926         (Target_arm::do_may_relax): New method definition.
12927         (Target_arm::do_relax, Target_arm::group_sections,
12928         Target_arm::scan_reloc_for_stub,
12929         Target_arm::scan_reloc_section_for_stubs): New method declarations.
12930         (Target_arm::arm_input_section_map_): New data member declaration.
12931         (Target_arm::scan_reloc_for_stub,
12932         Target_arm::scan_reloc_section_for_stubs,
12933         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
12934         Target_arm::do_relax): New method definitions.
12935
12936 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
12937
12938         * configure.ac: Check for (struct stat)::st_mtim
12939         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
12940         * config.in: Regenerate.
12941         * configure: Regenerate.
12942
12943 2009-11-05  Ian Lance Taylor  <iant@google.com>
12944
12945         PR 10910
12946         * output.cc (Output_segment::add_output_section): Add missing
12947         return statement.
12948
12949 2009-11-04  Ian Lance Taylor  <iant@google.com>
12950
12951         PR 10880
12952         * object.h (class Object): Add is_needed and set_is_needed
12953         methods.  Add is_needed_ field.  Make bool fields into bitfields.
12954         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
12955         defined in a dynamic object and referenced by a regular object,
12956         set is_needed for the dynamic object.
12957         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
12958         if the file is marked with as_needed and it is not needed.
12959
12960 2009-11-04  Ian Lance Taylor  <iant@google.com>
12961
12962         PR 10887
12963         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
12964         tags if data is discarded by linker script.
12965         * i386.cc (Target_i386::do_finalize_sections): Likewise.
12966         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12967         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12968         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12969
12970 2009-11-04  Ian Lance Taylor  <iant@google.com>
12971
12972         * layout.cc (Layout::get_output_section): Add is_interp and
12973         is_dynamic_linker_section parameters.  Change all callers.
12974         (Layout::choose_output_section): Likewise.
12975         (Layout::make_output_section): Likewise.
12976         (Layout::add_output_section_data): Add is_dynamic_linker_section
12977         parameter.  Change all callers.
12978         * layout.h (class Layout): Update declarations.
12979         * output.h (class Output_section): Add is_interp, set_is_interp,
12980         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
12981         Add is_interp_, is_dynamic_linker_section_ fields.  Change
12982         generate_code_fills_at_write_ to a bitfield.
12983         * output.cc (Output_section::Output_sections): Initialize new
12984         fields.
12985         (Output_segment::add_output_section): Add do_sort parameter.
12986         Change all callers.
12987
12988 2009-11-03  Ian Lance Taylor  <iant@google.com>
12989
12990         PR 10860
12991         * options.h (class General_options): Add --warn-common.
12992         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
12993         merging two common symbols.
12994         (Symbol_table::should_override): Handle --warn-common when merging
12995         a common symbol with a defined symbol.  Use report_resolve_problem
12996         for multiple definitions.
12997         (Symbol_table::report_resolve_problem): New function.
12998         * symtab.h (class Symbol_table): Declare report_resolve_problem.
12999
13000 2009-11-03  Doug Kwan  <dougkwan@google.com>
13001
13002         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
13003         stub_factory_.
13004         (Target_arm::stub_factory): New method definition.
13005         (Target_arm::new_arm_input_section,
13006         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
13007         Target_arm::reloc_uses_thumb_bit): New method declarations.
13008         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
13009         New type definitions.
13010         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
13011         member declarations.
13012         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
13013         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
13014         New method definitions.
13015
13016 2009-11-03  Ian Lance Taylor  <iant@google.com>
13017
13018         * options.h (class General_options): Add --warn_constructors.
13019
13020 2009-11-03  Ian Lance Taylor  <iant@google.com>
13021
13022         PR 10893
13023         * defstd.cc (in_section): Add entries for __rel_iplt_start,
13024         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
13025
13026 2009-11-03  Ian Lance Taylor  <iant@google.com>
13027
13028         PR 10895
13029         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
13030         --msgid-bugs-address.
13031         (install-pdf): New target.
13032         (install-data_yes): Look up one directory to find mkinstalldirs.
13033
13034 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
13035
13036         * po/Make-in (.po.gmo): Don't generate .gmo files in source
13037         tree.
13038
13039 2009-10-30  Doug Kwan  <dougkwan@google.com>
13040
13041         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
13042
13043 2009-10-30  Doug Kwan  <dougkwan@google.com>
13044
13045         * arm.cc (Stub_addend_reader): New struct template definition
13046         and partial specializations.
13047         (Stub_addend_reader::operator()): New method definition for a
13048         partially specialized template.
13049
13050 2009-10-30  Doug Kwan  <dougkwan@google.com>
13051
13052         * arm.cc (Arm_relobj::processor_specific_flags): New method
13053         definition.
13054         (Arm_relobj::do_read_symbols): New method declaration.
13055         (Arm_relobj::processor_specific_flags_): New data member declaration.
13056         (Arm_dynobj): New class definition.
13057         (Target_arm::do_finalize_sections): Add input_objects parameter.
13058         (Target_arm::do_adjust_elf_header): New method declaration.
13059         (Target_arm::are_eabi_versions_compatible,
13060         (Target_arm::merge_processor_specific_flags): New method declaration.
13061         (Target_arm::do_make_elf_object): New overloaded method definitions
13062         and declaration.
13063         (Arm_relobj::do_read_symbols): New method definition.
13064         (Arm_dynobj::do_read_symbols): Ditto.
13065         (Target_arm::do_finalize_sections): Add input_objects parameters.
13066         Merge processor-specific flags from all input objects.
13067         (Target_arm::are_eabi_versions_compatible,
13068         Target_arm::merge_processor_specific_flags,
13069         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
13070         New method definitions.
13071         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
13072         Input_objects pointer type parameter.
13073         * layout.cc (Layout::finalize): Pass input objects to target's.
13074         finalize_sections function.
13075         * output.cc (Output_file_header::do_sized_write): Set ELF file
13076         header's processor-specific flags.
13077         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
13078         Input_objects pointer type parameter.
13079         * sparc.cc (Target_sparc::do_finalize_sections): Same.
13080         * target.h (Input_objects): New forward class declaration.
13081         (Target::processor_specific_flags,
13082         Target::are_processor_specific_flags_sect): New method definitions.
13083         (Target::finalize_sections): Add input_objects parameter.
13084         (Target::Target): Initialize processor_specific_flags_ and
13085         are_processor_specific_flags_set_.
13086         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
13087         parameter.
13088         (Target::set_processor_specific_flags): New method definition.
13089         (Target::processor_specific_flags_,
13090         Target::are_processor_specific_flags_set_): New data member
13091         declarations.
13092         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
13093         Input_objects pointer type parameter.
13094
13095 2009-10-30  Doug Kwan  <dougkwan@google.com>
13096
13097         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
13098
13099 2009-10-28  Ian Lance Taylor  <iant@google.com>
13100
13101         * object.h (class Relobj): Drop options parameter from
13102         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
13103         do_scan_relocs, do_relocate.  Change all callers.
13104         (class Sized_relobj): Drop options parameters from
13105         do_gc_process_relocs, do_scan_relocs, do_relocate,
13106         do_relocate_sections, relocate_sections, emit_relocs_scan,
13107         emit_relocs_scan_reltype.  Change all callers.
13108         (struct Relocate_info): Remove options field and all references to
13109         it.
13110         * reloc.h (class Read_relocs): Remove options constructor
13111         parameter and options_ field.  Change all callers.
13112         (class Gc_process_relocs, class Scan_relocs): Likewise.
13113         (class Relocate_task): Likewise.
13114         * target-reloc.h (scan_relocs): Remove options parameter.  Change
13115         all callers.
13116         (scan_relocatable_relocs): Likewise.
13117         * target.h (class Sized_target): Remove options parameter from
13118         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
13119         all callers.
13120         * gc.h (gc_process_relocs): Remove options parameter.  Change all
13121         callers.
13122         * arm.cc: Update functions to remove options parameters.
13123         * i386.cc: Likewise.
13124         * powerpc.cc: Likewise.
13125         * sparc.cc: Likewise.
13126         * x86_64.cc: Likewise.
13127         * testsuite/testfile.cc: Likewise.
13128
13129 2009-10-28  Doug Kwan  <dougkwan@google.com>
13130
13131         * arm.cc (Arm_relobj): New class definition.
13132         (Arm_relobj::scan_sections_for_stubs,
13133         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
13134         New method definitions.
13135
13136 2009-10-28  Cary Coutant  <ccoutant@google.com>
13137
13138         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
13139         (Plugin::cleanup_done_): New member.
13140         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
13141         (Plugin_manager::cleanup_done_): Remove.
13142         (Plugin_manager::add_input_file): Edit error message.
13143         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
13144         (Plugin_manager::cleanup): Remove use of cleanup_done_.
13145
13146 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
13147
13148         * fileread.cc: (File_read::View::~View): Use the new
13149         data_ownership_ filed.
13150         (File_read::~File_read): Dispose the new whole_file_view_.
13151         (File_read::open): Mmap the whole file if needed.
13152         (File_read::open): Use whole_file_view_ instead of contents_.
13153         (File_read::find_view): Use whole_file_view_ if applicable.
13154         (File_read::do_read): Use whole_file_view_ instead of contents_.
13155         (File_read::make_view): Use whole_file_view_ instead of contents_,
13156         update File_read::View::View call.
13157         (File_read::find_or_make_view): Update File_read::View::View
13158         call.
13159         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
13160         remove contents_
13161         (File_read::View::Data_ownership): New enum.
13162         (File_read::View::View): Replace bool mapped_ with Data_ownership
13163         argument.
13164         (File_read::View::mapped_): Remove (replaced by data_ownership_).
13165         (File_read::View::data_ownership_): New field.
13166         (File_read::contents_): Remove (replaced by whole_file_view_).
13167         (File_read::whole_file_view_): New field.
13168         * options.h (class General_options): Add --keep-files-mapped.
13169
13170 2009-10-27  Cary Coutant  <ccoutant@google.com>
13171
13172         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
13173         * testsuite/Makefile.am (plugin_test_5): New test case.
13174         * testsuite/Makefile.in: Regenerate.
13175
13176 2009-10-25  Doug Kwan  <dougkwan@google.com>
13177
13178         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
13179         from private to protected to allow access by child class.
13180         (Sized_relobj::do_relocate_sections): New method declaration.
13181         (Sized_relobj::relocate_sections): Virtualize.
13182         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
13183         Sized_relobj::relocate_sections.  Instantiate template explicitly
13184         for different target sizes and endianity.
13185
13186 2009-10-24  Doug Kwan  <dougkwan@google.com>
13187
13188         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
13189         (Arm_input_section::as_arm_input_section): New method.
13190         (Arm_output_section): New class definition.
13191         (Arm_output_section::create_stub_group,
13192         Arm_output_section::group_sections): New method definitions.
13193
13194 2009-10-22  Doug Kwan  <dougkwan@google.com>
13195
13196         * arm.cc (Arm_input_section): New class definition.
13197         (Arm_input_section::init, Arm_input_section:do_write,
13198         Arm_input_section::set_final_data_size,
13199         Arm_input_section::do_reset_address_and_file_offset): New method
13200         definitions.
13201
13202 2009-10-21  Doug Kwan  <dougkwan@google.com>
13203
13204         * arm.cc (Stub_table, Arm_input_section): New forward class
13205         declarations.
13206         (Stub_table): New class defintion.
13207         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
13208         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
13209         New method definition.
13210
13211 2009-10-21  Doug Kwan  <dougkwan@google.com>
13212
13213         * arm.cc: Update copyright comments.
13214         (Target_arm): New forward class template declaration.
13215         (Arm_address): New type.
13216         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
13217         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
13218         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
13219         constants.
13220         (Insn_template): Same.
13221         (DEF_STUBS): New macro.
13222         (Stub_type): New enum type.
13223         (Stub_template): New class definition.
13224         (Stub): Same.
13225         (Reloc_stub): Same.
13226         (Stub_factory): Same.
13227         (Target_arm::Target_arm): Initialize may_use_blx_ and
13228         should_force_pic_veneer_.
13229         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
13230         Target_arm::should_force_pic_veneer,
13231         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
13232         Target_arm::using_thumb_only, Target_arm:;default_target): New
13233         method defintions.
13234         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
13235         New data member declarations.
13236         (Insn_template::size, Insn_template::alignment): New method defintions.
13237         (Stub_template::Stub_template): New method definition.
13238         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
13239         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
13240         (Stub_factory::Stub_factory): New method definition.
13241         * gold.h (string_hash): New template.
13242         * output.h (Input_section_specifier::hash_value): Use
13243         gold::string_hash.
13244         (Input_section_specifier::string_hash): Remove.
13245         * stringpool.cc (Stringpool_template::string_hash): Use
13246         gold::string_hash.
13247
13248 2009-10-20  Doug Kwan  <dougkwan@google.com>
13249
13250         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
13251         symbols of relaxed input sections.
13252         * output.h (Output_section::find_relaxed_input_section): Make
13253         method public.
13254
13255 2009-10-16  Doug Kwan  <dougkwan@google.com>
13256
13257         * dynobj.cc (Versions::Versions): Initialize version_script_.
13258         Only insert base version symbol definition for a shared object
13259         if version script defines any version versions.
13260         (Versions::define_base_version): New method definition.
13261         (Versions::add_def): Check that base version is not needed.
13262         (Versions::add_need): Define base version lazily.
13263         * dynobj.h (Versions::define_base_version): New method declaration.
13264         (Versions::needs_base_version_): New data member declaration.
13265         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
13266         (check_DATA): Add no_version_test.stdout.
13267         (libno_version_test.so, no_version_test.o no_version_test.stdout):
13268         New make rules.
13269         * testsuite/Makefile.in: Regenerate.
13270         * testsuite/no_version_test.c: New file.
13271         * testsuite/no_version_test.sh: Ditto.
13272
13273 2009-10-16  Doug Kwan  <dougkwan@google.com>
13274
13275         * expression.cc (class Segment_start_expression): New class definition.
13276         (Segment_start_expression::value): New method definition.
13277         (script_exp_function_segment_start): Return a new
13278         Segment_start_expression.
13279         * gold/script-c.h (script_saw_segment_start_expression): New function
13280         prototype.
13281         * script-sections.cc (Script_sections::Script_sections): Initialize
13282         SAW_SEGMENT_START_EXPRESSION_ to false.
13283         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
13284         and -Tbbs options to specify section addresses if given in
13285         command line and no SEGMENT_START expression is seen in a script.
13286         * script-sections.h (Script_sections::saw_segment_start_expression,
13287         Script_sections::set_saw_segment_start_expression): New method
13288         definition.
13289         (Script_sections::saw_segment_start_expression_): New data member
13290         declaration.
13291         * script.cc (script_saw_segment_start_expression): New function.
13292         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
13293         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
13294         script_test_7.sh and script_test_8.sh.
13295         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
13296         script_test_8.stdout.
13297         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
13298         (script_test_6, script_test_6.stdout, script_test_7,
13299         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
13300         * Makefile.in: Regenerate.
13301         * testsuite/script_test_6.sh: New file.
13302         * testsuite/script_test_6.t: Same.
13303         * testsuite/script_test_7.sh: Same.
13304         * testsuite/script_test_7.t: Same.
13305         * testsuite/script_test_8.sh: Same.
13306
13307 2009-10-16  Doug Kwan  <dougkwan@google.com>
13308
13309         * output.cc (Output_segment::set_section_list_address): Cast
13310         expressions to unsigned long long type to avoid format warnings.
13311
13312 2009-10-15  Ian Lance Taylor  <iant@google.com>
13313
13314         * script.cc (Script_options::add_symbol_assignment): Always add a
13315         dot assignment to script_sections_.
13316         * script-sections.cc (Script_sections::add_dot_assignment):
13317         Initialize if necessary.
13318
13319         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
13320         program headers with no load segment if there is a linker script.
13321
13322         * layout.cc (Layout::set_segment_offsets): Align the file offset
13323         to the segment aligment for -N or -n with no load segment.
13324         * output.cc (Output_segment::add_output_section): Don't crash if
13325         the first section is a TLS section.
13326         (Output_segment::set_section_list_addresses): Print an error
13327         message if the address moves backward in a linker script.
13328         * script-sections.cc
13329         (Output_section_element_input::set_section_addresses): Don't
13330         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
13331         (Orphan_output_section::set_section_addresses): Likewise.
13332
13333 2009-10-15  Doug Kwan  <dougkwan@google.com>
13334
13335         * layout.cc (Layout::finish_dynamic_section): Generate tags
13336         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
13337         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
13338         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
13339
13340 2009-10-14  Ian Lance Taylor  <iant@google.com>
13341
13342         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
13343         fields.
13344         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
13345         data_shdr fields of relinfo.
13346         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
13347         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
13348         R_386_TLS_LDO_32, adjust based on section flags.
13349         (Target_i386::Relocate::fix_up_ldo): Remove.
13350
13351 2009-10-13  Ian Lance Taylor  <iant@google.com>
13352
13353         Add support for -pie.
13354         * options.h (class General_options): Add -pie and
13355         --pic-executable.
13356         (General_options::output_is_position_independent): Test -pie.
13357         (General_options::output_is_executable): Return true if not shared
13358         and not relocatable.
13359         (General_options::output_is_pie): Remove.
13360         * options.cc (General_options::finalize): Reject incompatible uses
13361         of -pie.
13362         * gold.cc (queue_middle_tasks): A -pie link is not static.
13363         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
13364         * symtab.cc (Symbol::final_value_is_known): Return false if
13365         output_is_position_independent.
13366         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
13367         output_is_position_independent.
13368         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
13369         output_is_position_independent.
13370         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
13371         output_is_position_independent.
13372         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
13373         two_file_pie_test.
13374         (basic_pie_test.o, basic_pie_test): New targets.
13375         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
13376         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
13377         (two_file_pie_test): New target.
13378         * testsuite/Makefile.in: Rebuild.
13379         * README: Remove note saying that -pie is not supported.
13380
13381 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
13382
13383         * options.h (class General_options): Add -init and -fini.
13384         * layout.cc (Layout::finish_dynamic_section): Emit
13385         given init and fini functions.
13386
13387 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
13388
13389         * gc.h (gc_process_relocs): Check if icf is enabled using new
13390         function.
13391         * gold.cc (queue_initial_tasks): Likewise.
13392         (queue_middle_tasks): Likewise.
13393         * object.cc (do_layout): Likewise.
13394         * symtab.cc (is_section_folded): Likewise.
13395         * main.cc (main): Likewise.
13396         * reloc.cc (Read_relocs::run): Likewise.
13397         (Sized_relobj::do_scan_relocs): Likewise.
13398         * icf.cc (is_function_ctor_or_dtor): New function.
13399         (Icf::find_identical_sections): Check if function is ctor or dtor when
13400         safe icf is chosen.
13401         * options.h (General_options::icf): Change option to be an enum.
13402         (Icf_status): New enum.
13403         (icf_enabled): New method.
13404         (icf_safe_folding): New method.
13405         (set_icf_status): New method.
13406         (icf_status_): New variable.
13407         * (options.cc) (General_options::finalize): Set icf_status_.
13408         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
13409         icf_test and icf_keep_unique_test to use the --icf enum flag.
13410         * testsuite/icf_safe_test.sh: New file.
13411         * testsuite/icf_safe_test.cc: New file.
13412
13413 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
13414
13415         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
13416         includes to gc.h and icf.h.
13417         * arm.cc: Include gc.h.
13418         * gold.cc: Likewise.
13419         * i386.cc: Likewise.
13420         * powerpc.cc: Likewise.
13421         * sparc.cc: Likewise.
13422         * x86_64.cc: Likewise.
13423         * gc.h: Include icf.h.
13424
13425 2009-10-11  Ian Lance Taylor  <iant@google.com>
13426
13427         * plugin.cc: Include "gold.h" before other header files.
13428
13429 2009-10-10  Chris Demetriou  <cgd@google.com>
13430
13431         * options.h (Input_file_argument::Input_file_type): New enum.
13432         (Input_file_argument::is_lib_): Replace with...
13433         (Input_file_argument::type_): New member.
13434         (Input_file_argument::Input_file_argument): Take Input_file_type
13435         'type' rather than boolean 'is_lib' as second argument.
13436         (Input_file_argument::is_lib): Use type_.
13437         (Input_file_argument::is_searched_file): New function.
13438         (Input_file_argument::may_need_search): Handle is_searched_file.
13439         * options.cc (General_options::parse_library): Support -l:filename.
13440         (General_options::parse_just_symbols): Update for Input_file_argument
13441         changes.
13442         (Command_line::process): Likewise.
13443         * archive.cc (Archive::get_file_and_offset): Likewise.
13444         * plugin.cc (Plugin_manager::release_input_file): Likewise.
13445         * script.cc (read_script_file, script_add_file): Likewise.
13446         * fileread.cc (Input_file::Input_file): Likewise.
13447         (Input_file::will_search_for): Handle is_searched_file.
13448         (Input_file::open): Likewise.
13449         * readsyms.cc (Read_symbols::get_name): Likewise.
13450         * testsuite/Makefile.am (searched_file_test): New test.
13451         * testsuite/Makefile.in: Regenerate.
13452         * testsuite/searched_file_test.cc: New file.
13453         * testsuite/searched_file_test_lib.cc: New file.
13454
13455 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13456             Ian Lance Taylor  <iant@google.com>
13457
13458         * descriptor.cc: Include <cstdio> and "binary-io.h".
13459         (Descriptors::open): Open the files in binary mode always.
13460         * script.cc (Lex::get_token): Treat \r as whitespace.
13461
13462 2009-10-09  Ian Lance Taylor  <iant@google.com>
13463
13464         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
13465
13466 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13467             Ian Lance Taylor  <iant@google.com>
13468
13469         * configure.ac: Check for readv function also.
13470         * fileread.cc (readv): Define if not HAVE_READV.
13471         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
13472         does not exist.
13473         * config.in: Regenerate.
13474         * configure: Regenerate.
13475
13476 2009-10-09  Doug Kwan  <dougkwan@google.com>
13477
13478         * layout.cc (Layout::make_output_section): Call target hook to make
13479         ordinary output section.
13480         (Layout::finalize): Adjust parameter list of call the
13481         Target::may_relax().
13482         * layout.h (class Layout::section_list): New method.
13483         * merge.h (Output_merge_base::entsize): Change visibility to public.
13484         (Output_merge_base::is_string, Output_merge_base::do_is_string):
13485         New methods.
13486         (Output_merge_string::do_is_string): New method.
13487         * object.cc (Sized_relobj::do_setup): renamed from
13488         Sized_relobj::set_up.
13489         * object.h (Sized_relobj::adjust_shndx,
13490         Sized_relobj::initializ_input_to_output_maps,
13491         Sized_relobj::free_input_to_output_maps): Change visibilities to
13492         protected.
13493         (Sized_relobj::setup): Virtualize.
13494         (Sized_relobj::do_setup): New method declaration.
13495         (Sized_relobj::invalidate_section_offset,
13496         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
13497         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
13498         * options.cc (parse_int): New function.
13499         * options.h (parse_int): New declaration.
13500         (DEFINE_int): New macro.
13501         (stub_group_size): New option.
13502         * output.cc (Output_section::Output_section): Initialize memebers
13503         merge_section_map_, merge_section_by_properties_map_,
13504         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
13505         (Output_section::add_input_section): Handled deferred code-fill
13506         generation and remove an old comment.
13507         (Output_section::add_relaxed_input_section): New method definition.
13508         (Output_section::add_merge_input_section): Use merge section by
13509         properties map to speed to search.  Update merge section maps
13510         as appropriate.
13511         (Output_section::build_relaxation_map): New method definition.
13512         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
13513         Same.
13514         (Output_section::relax_input_section): Renamed to
13515         Output_section::convert_input_sections_to_relaxed_sections and change
13516         interface to take a vector of pointers to relaxed sections.
13517         (Output_section::find_merge_section,
13518         Output_section::find_relaxed_input_section): New method definitions.
13519         (Output_section::is_input_address_mapped,
13520         Output_section::output_offset, Output_section::output_address):
13521         Use output section data maps to speed up searching.
13522         (Output_section::find_starting_output_address): Add comments.
13523         (Output_section::do_write,
13524         Output_section::write_to_postprocessing_buffer): Do code-fill
13525         generation as appropriate.
13526         (Output_section::get_input_sections): Invalidate relaxed input section
13527         map.
13528         (Output_section::restore_states): Adjust type of checkpoint .
13529         Invalidate relaxed input section map.
13530         * output.h (Output_merge_base): New class declaration.
13531         (Input_section_specifier): New class defintion.
13532         (class Output_relaxed_input_section) Change base class to
13533         Output_section_data_build.
13534         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
13535         base class initializer.
13536         (Output_section::add_relaxed_input_section): New method declaration.
13537         (Output_section::Input_section): Change visibility to protected.
13538         (Output_section::Input_section::relobj,
13539         Output_section::Input_section::shndx): Handle relaxed input sections.
13540         Output_section::input_sections) Change visibility to protected.  Also
13541         define overload to return a non-const pointer.
13542         (Output_section::Merge_section_properties): New class defintion.
13543         (Output_section::Merge_section_by_properties_map,
13544         Output_section::Output_section_data_by_input_section_map,
13545         Output_section::Relaxation_map): New types.
13546         (Output_section::relax_input_section): Rename method to
13547         Output_section::convert_input_sections_to_relaxed_sections and change
13548         interface to take a vector of relaxed section pointers.
13549         (Output_section::find_merge_section,
13550         Output_section::find_relaxed_input_section,
13551         Output_section::build_relaxation_map,
13552         Output_section::convert_input_sections_in_list_to_relaxed_sections):
13553         New method declarations.
13554         (Output_section::merge_section_map_
13555         Output_section::merge_section_by_properties_map_,
13556         Output_section::relaxed_input_section_map_,
13557         Output_section::is_relaxed_input_section_map_valid_,
13558         Output_section::generate_code_fills_at_write_): New data members.
13559         * script-sections.cc
13560         (Output_section_element_input::set_section_addresses): Call
13561         current_data_size and addralign methods of relaxed input sections.
13562         (Orphan_output_section::set_section_addresses): Call current_data_size
13563         and addralign methods of relaxed input sections.
13564         * symtab.cc (Symbol_table::compute_final_value): Extract template
13565         from the body of Symbol_table::sized_finalize_symbol.
13566         (Symbol_table::sized_finalized_symbol): Call
13567         Symbol_table::compute_final_value.
13568         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
13569         (Symbol_table::compute_final_value): New templated method declaration.
13570         * target.cc (Target::do_make_output_section): New method defintion.
13571         * target.h (Target::make_output_section): New method declaration.
13572         (Target::relax): Add more parameters for input objects, symbol table
13573         and layout.  Adjust call to do_relax.
13574         (Target::do_make_output_section): New method declaration.
13575         (Target::do_relax): Add parameters for input objects, symbol table
13576         and layout.
13577
13578 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13579
13580         * pread.c: Include stdio.h.
13581
13582 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13583
13584         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
13585         defined.
13586
13587 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13588
13589         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
13590         Change read_shndx type to unsigned int.
13591         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13592         int.
13593         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13594         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
13595         Change read_shndx type to unsigned int.
13596         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13597         int.
13598         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13599         * layout.cc (Layout::create_symtab_sections): Cast the result of
13600         local_symcount * symsize to off_t in the gold_assert.
13601
13602 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13603
13604         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
13605         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
13606         R_ARM_BASE_ABS.
13607         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
13608         (Arm_relocate_functions::thm_abs5): New function.
13609         (Arm_relocate_functions::abs12): New function.
13610         (Arm_relocate_functions::abs16): New function.
13611         (Arm_relocate_functions::base_abs): New function.
13612         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
13613         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
13614         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
13615         R_ARM_BASE_ABS.
13616         (Scan::global): Likewise.
13617         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
13618         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
13619         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
13620         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
13621         R_ARM_BASE_ABS.
13622
13623 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13624
13625         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
13626         (Arm_relocate_functions::movt_prel): New function.
13627         (Arm_relocate_functions::thm_movw_prel_nc): New function.
13628         (Arm_relocate_functions::thm_movt_prel): New function.
13629         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
13630         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
13631         (Scan::global, Relocate::relocate): Likewise.
13632         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13633
13634 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13635
13636         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
13637         Incremental_checker.
13638         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
13639         unsigned int.
13640         (class Incremental_inputs_header): New class.
13641         (Incremental_inputs_header_writer): Edit comment.
13642         (Incremental_inputs_entry): New class.
13643         (Incremental_inputs_entry_writer): Edit comment.
13644         (Sized_incremental_binary::do_find_incremental_inputs_section):
13645         Add *strtab_shndx parameter, fill it.
13646         (Sized_incremental_binary::do_check_inputs): New method.
13647         (Incremental_checker::can_incrementally_link_output_file): Use
13648         Sized_incremental_binary::check_inputs.
13649         (Incremental_inputs::report_command_line): Save command line in
13650         command_line_.
13651         * incremental.h:
13652         (Incremental_binary::find_incremental_inputs_section): New
13653         method.
13654         (Incremental_binary::do_find_incremental_inputs_section): Add
13655         strtab_shndx parameter.
13656         (Incremental_binary::do_check_inputs): New pure virtual method.
13657         (Sized_incremental_binary::do_check_inputs): Declare.
13658         (Incremental_checker::Incremental_checker): Add incremental_inputs
13659         parameter, use it to initialize incremental_inputs_.
13660         (Incremental_checker::incremental_inputs_): New field.
13661         (Incremental_checker::command_line): New method.
13662         (Incremental_checker::inputs): New method.
13663         (Incremental_checker::command_line_): New field.
13664
13665 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13666
13667         * incremental.cc: Include <cstdarg> and "target-select.h".
13668         (vexplain_no_incremental): New function.
13669         (explain_no_incremental): New function.
13670         (Incremental_binary::error): New method.
13671         (Sized_incremental_binary::do_find_incremental_inputs_section): New
13672         method.
13673         (make_sized_incremental_binary): New function.
13674         (open_incremental_binary): New function.
13675         (can_incrementally_link_file): Add checks if output is ELF and has
13676         inputs section.
13677         * incremental.h: Include "elfcpp_file.h" and "output.h".
13678         (Incremental_binary): New class.
13679         (Sized_incremental_binary): New class.
13680         (open_incremental_binary): Declare.
13681         * object.cc (is_elf_object): Use
13682         elfcpp::Elf_recognizer::is_elf_file.
13683         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
13684         * output.h (Output_file::filesize): New method.
13685
13686 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13687
13688         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
13689         New function.
13690         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
13691         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
13692         function.
13693         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
13694         function.
13695         (Arm_relocate_functions::movw_abs_nc): New function.
13696         (Arm_relocate_functions::movt_abs): New function.
13697         (Arm_relocate_functions::thm_movw_abs_nc): New function.
13698         (Arm_relocate_functions::thm_movt_abs): New function.
13699         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
13700         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
13701         (Scan::global): Likewise.
13702         (Relocate::relocate): Likewise.
13703         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13704
13705 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13706
13707         * arm.cc (Arm_relocate_functions::got_prel) New function.
13708         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
13709         (Relocate::relocate): Likewise.
13710         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13711
13712 2009-10-06  Ian Lance Taylor  <iant@google.com>
13713
13714         * options.h (class General_options): Define
13715         split_stack_adjust_size parameter.
13716         * object.h (class Object): Add uses_split_stack_ and
13717         has_no_split_stack_ fields.  Add uses_split_stack and
13718         has_no_split_stack accessor functions.  Declare
13719         handle_split_stack_section.
13720         (class Reloc_symbol_changes): Define.
13721         (class Sized_relobj): Define Function_offsets.  Declare
13722         split_stack_adjust, split_stack_adjust_reltype, and
13723         find_functions.
13724         * object.cc (Object::handle_split_stack_section): New function.
13725         (Sized_relobj::do_layout): Call handle_split_stack_section.
13726         * dynobj.cc (Sized_dynobj::do_layout): Call
13727         handle_split_stack_section.
13728         * reloc.cc (Sized_relobj::relocate_sections): Call
13729         split_stack_adjust for executable sections in split_stack
13730         objects.  Pass reloc_map to relocate_section.
13731         (Sized_relobj::split_stack_adjust): New function.
13732         (Sized_relobj::split_stack_adjust_reltype): New function.
13733         (Sized_relobj::find_functions): New function.
13734         * target-reloc.h: Include "object.h".
13735         (relocate_section): Add reloc_symbol_changes parameter.  Change
13736         all callers.
13737         * target.h (class Target): Add calls_non_split method.  Declare
13738         do_calls_non_split virtual method.  Declare match_view and
13739         set_view_to_nop.
13740         * target.cc: Include "elfcpp.h".
13741         (Target::do_calls_non_split): New function.
13742         (Target::match_view): New function.
13743         (Target::set_view_to_nop): New function.
13744         * gold.cc (queue_middle_tasks): Give an error if mixing
13745         split-stack and non-split-stack objects with -r.
13746         * i386.cc (Target_i386::relocate_section): Add
13747         reloc_symbol_changes parameter.
13748         (Target_i386::do_calls_non_split): New function.
13749         * x86_64.cc (Target_x86_64::relocate_section): Add
13750         reloc_symbol_changes parameter.
13751         (Target_x86_64::do_calls_non_split): New function.
13752         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
13753         parameter.
13754         * powerpc.cc (Target_powerpc::relocate_section): Add
13755         reloc_symbol_changes parameter.
13756         * sparc.cc (Target_sparc::relocate_section): Add
13757         reloc_symbol_changes parameter.
13758         * configure.ac: Call AM_CONDITIONAL for the default target.
13759         * configure: Rebuild.
13760         * testsuite/Makefile.am (TEST_AS): New variable.
13761         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
13762         (check_DATA): Add split_i386 and split_x86_64 files.
13763         (SPLIT_DEFSYMS): Define.
13764         (split_i386_[1234n].o): New targets.
13765         (split_i386_[124]): New targets.
13766         (split_i386_[1234r].stdout): New targets.
13767         (split_x86_64_[1234n].o): New targets.
13768         (split_x86_64_[124]): New targets.
13769         (split_x86_64_[1234r].stdout): New targets.
13770         (MOSTLYCLEANFILES): Add new executables.
13771         * testsuite/split_i386.sh: New file.
13772         * testsuite/split_x86_64.sh: New file.
13773         * testsuite/split_i386_1.s: New file.
13774         * testsuite/split_i386_2.s: New file.
13775         * testsuite/split_i386_3.s: New file.
13776         * testsuite/split_i386_4.s: New file.
13777         * testsuite/split_i386_n.s: New file.
13778         * testsuite/split_x86_64_1.s: New file.
13779         * testsuite/split_x86_64_2.s: New file.
13780         * testsuite/split_x86_64_3.s: New file.
13781         * testsuite/split_x86_64_4.s: New file.
13782         * testsuite/split_x86_64_n.s: New file.
13783         * testsuite/testfile.cc (Target_test): Update relocation_section
13784         function.
13785         * testsuite/Makefile.in: Rebuild.
13786
13787 2009-10-06  Ian Lance Taylor  <iant@google.com>
13788
13789         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
13790         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
13791         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
13792         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
13793         the address on ldo_addrs_.
13794         (Target_i386::Relocate::fix_up_ldo): New function.
13795
13796 2009-10-06   Rafael Espindola  <espindola@google.com>
13797
13798         * plugin.cc (add_input_library): New.
13799         (Plugin::load): Add add_input_library to tv.
13800         (Plugin_manager::add_input_file): Add the is_lib argument.
13801         (add_input_file): Update call to Plugin_manager::add_input_file.
13802         (add_input_library): New.
13803         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
13804
13805 2009-09-30  Doug Kwan  <dougkwan@google.com>
13806
13807         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
13808         symbol and call Symbol::may_need_copy_reloc to determine if
13809         a copy reloc is needed.
13810         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
13811         nocopyreloc is given in command line.
13812         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
13813         given in command line.
13814         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
13815         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
13816         of the removed Target_i386::may_need_copy_reloc.
13817         * options.h (copyreloc): New option with default value false.
13818         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13819         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
13820         instead of the removed Target_powerpc::may_need_copy_reloc.
13821         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13822         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
13823         instead of the removed Target_sparc::may_need_copy_reloc.
13824         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
13825         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
13826         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
13827         instead of the removed Target_x86_64::may_need_copy_reloc.
13828
13829 2009-09-30  Ian Lance Taylor  <iant@google.com>
13830
13831         * object.h (class Object): Remove target_ field, and target,
13832         sized_target, and set_target methods.
13833         (Object::sized_target): Remove.
13834         (class Sized_relobj): Update declarations.  Remove sized_target.
13835         * object.cc (Sized_relobj::setup): Remove target parameter.
13836         Change all callers.
13837         (Input_objects::add_object): Don't do anything with the target.
13838         (make_elf_sized_object): Add punconfigured parameter.  Change all
13839         callers.  Set or test parameter target.
13840         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
13841         Change all callers.
13842         * parameters.cc (Parameters::set_target): Change parameter type to
13843         be non-const.
13844         (Parameters::default_target): Remove.
13845         (set_parameters_target): Change parameter type to be non-const.
13846         (parameters_force_valid_target): New function.
13847         (parameters_clear_target): New function.
13848         * parameters.h (class Parameters): Update declarations.  Remove
13849         default_target method.  Add sized_target and clear_target
13850         methods.  Change target_ to be non-const.
13851         (set_parameters_target): Update declaration.
13852         (parameters_force_valid_target): Declare.
13853         (parameters_clear_target): Declare.
13854         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
13855         as NULL if we aren't searching.
13856         (Add_symbols::run): Don't check for compatible target.
13857         * fileread.cc (Input_file::open_binary): Call
13858         parameters_force_valid_target.
13859         * gold.cc (queue_middle_tasks): Likewise.
13860         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
13861         set_target on object.
13862         * dynobj.h (class Sized_dynobj): Update declarations.
13863         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
13864         make_elf_object returns NULL.
13865         (Archive::include_member): Don't check whether object target is
13866         compatible.
13867         * output.cc (Output_section::add_input_section): Get target from
13868         parameters.
13869         (Output_section::relax_input_section): Likewise.
13870         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
13871         parameters.
13872         (Sized_relobj::do_scan_relocs): Likewise.
13873         (Sized_relobj::relocate_sections): Likewise.
13874         * resolve.cc (Symbol_table::resolve): Likewise.
13875         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
13876         parameter.  Change all callers.
13877         (Symbol_table::add_from_object): Get target from parameters.
13878         (Symbol_table::add_from_relobj): Don't check object target.
13879         (Symbol_table::add_from_dynobj): Likewise.
13880         (Symbol_table::define_special_symbol): Get target from
13881         parameters.
13882         * symtab.h (class Symbol_table): Update declaration.
13883         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
13884         parameter.  Change all callers.  Clear parameter target.
13885         (Binary_test): Test target here.
13886         * testsuite/object_unittest.cc (gold_testsuite): Remove
13887         target_test_pointer parameter.  Change all callers.
13888         (Object_test): Test target here.
13889
13890 2009-09-26  Ian Lance Taylor  <iant@google.com>
13891
13892         * testsuite/initpri1.c: Don't try to use constructor priorities if
13893         compiling with gcc before 4.3.
13894
13895 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
13896
13897         * testsuite/retain_symbols_file_test.sh (check_present): Change
13898         output file name to retain_symbols_file_test.stdout.
13899         (check_absent): Likewise.
13900
13901 2009-09-18  Craig Silverstein  <csilvers@google.com>
13902
13903         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
13904         * options.cc: Include <cerrno> and <fstream>.
13905         (General_options::finalize): Parse -retain-symbols-file tag.
13906         * options.h: New flag.
13907         (General_options): New method should_retain_symbol, new
13908         variable symbols_to_retain.
13909         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
13910         should_retain_symbol map.
13911         * testsuite/Makefile.am (retain_symbols_file_test): New test.
13912         * testsuite/Makefile.in: Regenerate.
13913         * testsuite/retain_symbols_file_test.sh: New file.
13914
13915 2009-09-18  Nick Clifton  <nickc@redhat.com>
13916
13917         * po/es.po: Updated Spanish translation.
13918
13919 2009-09-17  Doug Kwan  <dougkwan@google.com>
13920
13921         * debug.h (DEBUG_RELAXATION): New constant.
13922         (DEBUG_ALL): Add DEBUG_RELAXATION.
13923         (debug_string_to_enum): Add relaxation debug option.
13924         * layout.cc
13925         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
13926         Layout::Relaxation_debug_check::read_sections,
13927         Layout::Relaxation_debug_check::read_sections): New method definitions.
13928         (Layout::Layout): Initialize data members
13929         record_output_section_data_from_scrips_,
13930         script_output_section_data_list_ and relaxation_debug_check_.
13931         (Layout::save_segments, Layout::restore_segments,
13932         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13933         Layout::relaxation_loop_body): New method definitions.
13934         (Layout::finalize): Support relaxation.  Move section layout code to
13935         Layout::relaxation_loop_body.
13936         (Layout::set_asection_address_from_script): Move code for orphan
13937         section placement out.
13938         (Layout::place_orphan_sections_in_script): New method definition.
13939         * layout.h (Output_segment_headers, Output_file_header):
13940         New forward class declarations.
13941         (Layout::~Layout): Define.
13942         (Layout::new_output_section_data_from_script): New method definition.
13943         (Layout::place_orphan_sections_in_script): New method declaration.
13944         (Layout::Segment_states): New type declaration.
13945         (Layout::save_segments, Layout::restore_segments,
13946         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13947         Layout::relaxation_loop_body): New method declarations.
13948         (Layout::Output_section_data_list): New type declaration.
13949         (Layout::Relaxation_debug_check): New class definition.
13950         (Layout::record_output_section_data_from_script_,
13951         Layout::script_output_section_data_list_, Layout::segment_states_,
13952         Layout::relaxation_debug_check_): New data members.
13953         * output.cc: (Output_section_headers::do_size): New method definition.
13954         (Output_section_headers::Output_section_headers): Move size
13955         computation to Output_section_headers::do_size.
13956         (Output_segment_headers::do_size): New method definition.
13957         (Output_file_header::Output_file_header): Move size computation to
13958         Output_file_header::do_size and call it.
13959         (Output_file_header::do_size): New method definition.
13960         (Output_data_group::Output_data_group): Adjust call to
13961         Output_section_data.
13962         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
13963         (Output_symtab_xindex::do_write): Add array bound check.
13964         (Output_section::Input_section::print_to_mapfile): Handle
13965         RELAXED_INPUT_SECTION_CODE.
13966         (Output_section::Output_section): Initialize data member checkpoint_.
13967         (Output_section::~Output_section): Delete checkpoint object pointed
13968         by checkpoint_.
13969         (Output_section::add_input_section): Always add an Input_section if
13970         relaxing.
13971         (Output_section::add_merge_input_section): Add assert.
13972         (Output_section::relax_input_section): New method definition.
13973         (Output_section::set_final_data_size): Set load address to zero for
13974         an unallocated section.
13975         (Output_section::do_address_and_file_offset_have_reset_values):
13976         New method definition.
13977         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
13978         Handle relaxed input section.
13979         (Output_section::sort_attached_input_sections): Checkpoint input
13980         section list lazily.
13981         (Output_section::get_input_sections): Change type of input_sections to
13982         list of Simple_input_section pointers.  Checkpoint input section list
13983         lazily.  Also handle relaxed input sections.
13984         (Output_section::add_input_section_for_script): Take a reference to
13985         a Simple_input_section object instead of Relobj pointer and section
13986         index as parameter.  Handle relaxed input sections.
13987         (Output_section::save_states, Output_section::restore_states): New
13988         method definitions.
13989         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
13990         (Output_data::is_data_size_fixed): New method definition.
13991         (Output_data::reset_addresss_and_file_offset): Do not reset data size
13992         if it is fixed.
13993         (Output_data::address_and_file_offset_have_reset_values): New method
13994         definition.
13995         (Output_data::do_address_and_file_offset_have_reset_values): New method
13996         definition.
13997         (Output_data::set_data_size): Check that data size is not fixed.
13998         (Output_data::fix_data_size): New method definition.
13999         (Output_data::is_data_size_fixed_): New data member.
14000         (Output_section_headers::set_final_data_size): New method definition.
14001         (Output_section_headers::do_size): New method declaration.
14002         (Output_segment_headers::set_final_data_size): New method definition.
14003         (Output_segment_headers::do_size): New method declaration.
14004         (Output_file_header::set_final_data_size)::New method definition.
14005         (Output_file_header::do_size)::New method declaration.
14006         (Output_section_data::Output_section_data): Add new parameter
14007         is_data_size_fixed and use it to fix data size.
14008         (Output_data_const::Output_data_const): Adjust call to base class
14009         constructor and fix data size.
14010         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
14011         base class constructor and fix data size.
14012         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
14013         base class constructor and fix data size.
14014         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
14015         class constructor and fix data size.
14016         (Output_data_group::set_final_data_size): New method definition.
14017         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
14018         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
14019         class constructor and fix data size.
14020         (Output_relaxed_input_section): New class definition.
14021         (Output_section::Simple_input_section): New class definition.
14022         (Output_section::get_input_sections): Adjust parameter list.
14023         (Output_section::add_input_section_for_script): Same.
14024         (Output_section::save_states, Output_section::restore_states,
14025         Output_section::do_address_and_file_offset_have_reset_values,
14026         (Output_section::Input_section::Input_section): Handle
14027         RELAXED_INPUT_SECTION_CODE.  Add new overload for
14028         Output_relaxed_input_section.
14029         (Output_section::Input_section::is_input_section,
14030         Output_section::Input_section::set_output_section): Handle relaxed
14031         input section.
14032         (Output_section::Input_section::is_relaxed_input_section,
14033         Output_section::Input_section::output_section_data,
14034         Output_section::Input_section::relaxed_input_section): New method
14035         definitions.
14036         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
14037         value.
14038         (Output_section::Input_section::u1_): Update comments.
14039         (Output_section::Input_section::u2_): Add new union member poris.
14040         (Output_section::Checkpoint_output_section): New classs definition.
14041         (Output_section::relax_input_section): New method declaration.
14042         (Output_section::checkpoint_): New data member.
14043         (Output_segment): Update comments.
14044         (Output_segment::Output_segment): Un-privatize copy constructor.
14045         (Output_segment::operator=): Un-privatize.
14046         * script-sections.cc (Output_section_element::Input_section_list):
14047         Change element type to Output_section::Simple_input_section.
14048         (Output_section_element_dot_assignment::set_section_addresses):
14049         Register output section data for relaxation clean up.
14050         (Output_data_exression::Output_data_expression): Adjust call to base
14051         constructor to fix data size.
14052         (Output_section_element_data::set_section_addresses): Register
14053         Output_data_expression object for relaxation clean up.
14054         (struct Input_section_info): Replace Relobj pointer and section index
14055         pair with Output_section::Simple_input_section and Convert struct to a
14056         class.
14057         (Input_section_sorter::operator()): Adjust access to
14058         Input_section_info data member to use accessors.
14059         (Output_section_element_input::set_section_addresses): Use layout
14060         parameter.  Adjust code to use Output_section::Simple_input_section
14061         and Input_secction_info classes.  Register filler for relaxation
14062         clean up.
14063         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
14064         and section index pair with Output_section::Simple_input_section
14065         class.  Adjust code accordingly.
14066         (Phdrs_element::release_segment): New method definition.
14067         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
14068         segment list.
14069         (Script_sections::release_segments): New method definition.
14070         * gold/script-sections.h (Script_sections::release_segments): New
14071         method declaration.
14072         * gold/target.h (Target::may_relax, Target::relax,
14073         Target::do_may_relax, Target::do_relax): New method definitions.
14074
14075 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
14076
14077         * arm.cc (has_signed_unsigned_overflow): New function.
14078         (Arm_relocate_functions::abs8): New function.
14079         (Target_arm::Scan::local): Handle R_ARM_ABS8.
14080         (Target_arm::Scan::global): Likewise.
14081         (Target_arm::relocate::relocate): Likewise.
14082         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
14083         Likewise.
14084
14085 2009-09-16  Cary Coutant  <ccoutant@google.com>
14086
14087         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
14088         * testsuite/Makefile.in: Regenerate.
14089
14090 2009-09-11  Nick Clifton  <nickc@redhat.com>
14091
14092         * po/gold.pot: Updated by the Translation project.
14093
14094 2009-09-08  Cary Coutant  <ccoutant@google.com>
14095
14096         * output.cc (Output_file::open): Add execute permission to empty file.
14097         * testsuite/Makefile.am (permission_test): New test.
14098         * testsuite/Makefile.in: Regenerate.
14099
14100 2009-09-02  Ian Lance Taylor  <iant@google.com>
14101
14102         * output.cc (Output_file::resize): Call map_no_anonymous rather
14103         than map.
14104
14105 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
14106
14107         * gold.cc: Include "incremental.h".
14108         (queue_initial_tasks): Call Incremental_checker methods.
14109         * incremental.cc: Include "output.h".
14110         (Incremental_checker::can_incrementally_link_output_file): New
14111         method.
14112         * incremental.h (Incremental_checker): New class.
14113
14114         * output.cc (Output_file::open_for_modification): New method.
14115         (Output_file::map_anonymous): Changed return type to bool.  Record
14116         map in base_ field.
14117         (Output_file::map_no_anonymous): New method, broken out of map.
14118         (Output_file::map): Use map_no_anonymous and map_anonymous.
14119         * output.h (class Output_file): Update declarations.
14120
14121 2009-08-24  Cary Coutant  <ccoutant@google.com>
14122
14123         * options.h (Command_line::Pre_options): New class.
14124         (Command_line::pre_options): New member.
14125         * options.cc (gold::options::ready_to_register): New variable.
14126         (One_option::register_option): Do nothing if not registering options.
14127         Assert if same short option registered twice.
14128         (General_options::General_options): Turn off option registration when
14129         done constructing.
14130         (Command_line::Pre_options::Pre_options): New constructor.
14131
14132 2009-08-24  Cary Coutant  <ccoutant@google.com>
14133
14134         * options.h (General_options::no_keep_memory): Remove incorrect
14135         short option.
14136
14137 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
14138
14139         * Makefile.am (am__skiplex, am__skipyacc): New.
14140         * Makefile.in: Regenerate.
14141
14142 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
14143
14144         * Makefile.am (AM_CPPFLAGS): Renamed from ...
14145         (INCLUDES): ... this.
14146         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
14147         (AM_CPPFLAGS): Renamed from ...
14148         (INCLUDE): ... this.
14149         * Makefile.in, testsuite/Makefile.in: Regenerate.
14150
14151         * Makefile.in: Regenerate.
14152         * aclocal.m4: Likewise.
14153         * config.in: Likewise.
14154         * configure: Likewise.
14155         * testsuite/Makefile.in: Likewise.
14156
14157         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
14158         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
14159         * Makefile.in: Regenerate.
14160         * testsuite/Makefile.in: Regenerate.
14161
14162 2009-08-19  Cary Coutant  <ccoutant@google.com>
14163
14164         * resolve.cc (Symbol_table::resolve): Don't complain about defined
14165         symbols in shared libraries overridden by hidden or internal symbols
14166         in the main program.
14167
14168 2009-08-19  Chris Demetriou  <cgd@google.com>
14169
14170         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
14171         checking source file names in error messages.
14172
14173 2009-08-18  Doug Kwan  <dougkwan@google.com>
14174
14175         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
14176         an elcpp::Ehdr as parameter.  Adjust call to set_target.
14177         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
14178         an elfcpp::Ehdr as parameter.
14179         * object.cc (Object::set_target): Remove the version that looks up
14180         a target and sets it.
14181         (Sized_relobj::setup): Take a Target object instead of
14182         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
14183         (make_elf_sized_object): Find target and ask target to
14184         make an ELF object.
14185         * object.h: (Object::set_target): Remove the version that looks up
14186         a target and sets it.
14187         (Sized_relobj::setup): Take a Target object instead of
14188         an elfcpp:Ehdr as parameter.
14189         * target.cc: Include dynobj.h.
14190         (Target::do_make_elf_object_implementation): New.
14191         (Target::do_make_elf_object): New.
14192         * target.h (Target::make_elf_object): New template declaration.
14193         (Target::do_make_elf_object): New method declarations.
14194         (Target::do_make_elf_object_implementation): New template declaration.
14195
14196 2009-08-14  Ian Lance Taylor  <iant@google.com>
14197
14198         * gold.h (FUNCTION_NAME): Define.
14199         (gold_unreachable): Use FUNCTION_NAME.
14200
14201 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
14202
14203         * icf.cc (Icf::find_identical_sections): Issue a warning when a
14204         symbol in the --keep-unique list is not found.
14205
14206 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
14207
14208         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
14209         been maked as --keep-unique.
14210         (Icf::unfold_section): New function.
14211         * icf.h (Icf::unfold_section): New function.
14212         * options.h (General_options::keep_unique): New option.
14213         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
14214         * testsuite/Makefile.in: Regenerate.
14215         * testsuite/icf_keep_unique_test.sh: New file.
14216         * testsuite/icf_keep_unique_test.cc: New file.
14217
14218 2009-08-12  Cary Coutant  <ccoutant@google.com>
14219
14220         PR 10471
14221         * resolve.cc (Symbol_table::resolve): Check for references from
14222         dynamic objects to hidden and internal symbols.
14223         * testsuite/Makefile.am (hidden_test.sh): New test.
14224         * testsuite/Makefile.in: Regenerate.
14225         * testsuite/hidden_test.sh: New script.
14226         * testsuite/hidden_test_1.c: New test source.
14227         * testsuite/hidden_test_main.c: New test source.
14228
14229 2009-08-11  Doug Kwan  <dougkwan@google.com>
14230
14231         * arm.cc: Update comments.
14232         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
14233         segment to locate the .ARM.exidx section if present.
14234
14235 2009-08-09  Doug Kwan  <dougkwan@google.com>
14236
14237         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
14238         patch.
14239
14240 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
14241         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
14242         compiler warnings.
14243
14244 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
14245
14246         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
14247         valid tls_segment only for non-debug-section relocations.
14248         * testsuite/Makefile.am: Add gc_tls_test.
14249         * testsuite/Makefile.in: Regenerate.
14250         * testsuite/gc_tls_test.cc: New file.
14251         * testsuite/gc_tls_test.sh: New file.
14252
14253 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
14254
14255         * icf.cc: New file.
14256         * icf.h: New file.
14257         * Makefile.am (CCFILES): Add icf.cc.
14258         (HFILES): Add icf.h
14259         * Makefile.in: Regenerate.
14260         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
14261         * gc.h (gc_process_relocs): Populate lists used by icf to contain
14262         section, symbol and addend information for the relocs.
14263         * gold.cc (queue_middle_tasks): Call identical code folding.
14264         * gold.h: Add defines for multimap.
14265         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
14266         to the call of finalize_local_symbols.
14267         * main.cc (main): Create object of class Icf.
14268         * object.cc (Sized_relobj::do_layout): Allow this function to be
14269         called twice during icf.
14270         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
14271         to sections marked as identical by icf.
14272         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
14273         when available.
14274         (Sized_relobj::do_section_entsize): New function.
14275         * object.h (Object::section_entsize): New function.
14276         (Object::do_section_entsize): New pure virtual function.
14277         (Relobj::finalize_local_symbols): Add new parameter.
14278         (Relobj::do_section_entsize): New function.
14279         * options.h (General_options::icf): New option.
14280         (General_options::icf_iterations): New option.
14281         (General_options::print_icf_sections): New option.
14282         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
14283         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
14284         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
14285         icf.
14286         * symtab.cc (Symbol_table::is_section_folded): New function.
14287         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
14288         to sections marked as identical by icf.
14289         * symtab.h (Symbol_table::set_icf): New function.
14290         (Symbol_table::icf): New function.
14291         (Symbol_table::is_section_folded): New function.
14292         (Symbol_table::icf_): New data member.
14293         * target-reloc.h (relocate_section): Ignore sections folded by icf.
14294         * testsuite/Makefile.am: Add commands to build icf_test.
14295         * testsuite/Makefile.in: Regenerate.
14296         * testsuite/icf_test.sh: New file.
14297         * testsuite/icf_test.cc: New file.
14298
14299 2009-07-24  Chris Demetriou  <cgd@google.com>
14300
14301         * layout.cc (is_compressible_debug_section): Fix incorrect
14302         comment about compressed section names.
14303
14304 2009-07-20  Ian Lance Taylor  <ian@airs.com>
14305
14306         PR 10419
14307         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
14308
14309 2009-07-16  Ian Lance Taylor  <iant@google.com>
14310
14311         PR 10400
14312         * layout.h: #include <map>.
14313         (class Kept_section): Change from struct to class.  Add accessors
14314         and setters.  Add section size to Comdat_group mapping.  Change
14315         Comdat_group to std::map.  Add is_comdat_ field.  Add
14316         linkonce_size field in union.
14317         (class Layout): Update declaration of find_or_add_kept_section.
14318         Don't declare find_kept_object.
14319         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
14320         parameter.  Add object, shndx, is_comdat, and is_group_name
14321         parameters.  Change all callers.  Adjust for new Kept_section.
14322         (Layout::find_kept_object): Remove.
14323         * object.cc (Sized_relobj::include_section_group): Update use of
14324         Kept_section.  Rename secnum to shndx.  Only record
14325         Kept_comdat_section if sections are the same size.
14326         (Sized_relobj::include_linkonce_section): Update use of
14327         Kept_section.  Only record Kept_comdat_section if sections are the
14328         same size.  Set size of linkonce section.
14329         (Sized_relobj::map_to_kept_section): Update call to
14330         get_kept_comdat_section.
14331         * object.h (class Sized_relobj): Rename fields in
14332         Kept_comdat_section to drop trailing underscores; change object
14333         field to Relobj*.  Change Kept_comdat_section_table to store
14334         struct rather than pointer.
14335         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
14336         Add kept_object and kept_shndx parameters.  Change all callers.
14337         (Sized_relobj::get_kept_comdat_section): Change return type to
14338         bool.  Add kept_object and kept_shndx parameters.  Change all
14339         callers.
14340         * plugin.cc (Pluginobj::include_comdat_group): Update call to
14341         Layout::find_or_add_kept_section.
14342
14343 2009-07-09  Ian Lance Taylor  <iant@google.com>
14344
14345         * merge.cc (Object_merge_map::initialize_input_to_output_map):
14346         Reserve space in the hash table.
14347
14348 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
14349
14350         * fileread.cc (File_read::get_mtime): New method.
14351         * fileread.h (Timespec): New structure.
14352         (File_read::get_mtime): New method.
14353         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
14354         Renamed from timestamp_nsec.
14355         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
14356         Elf_Xword.
14357         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
14358         timestamp_nsec.
14359         (Incremental_inputs::report_archive): Save mtime; style fix.
14360         (Incremental_inputs::report_obejct): Save mtime; style fix.
14361         (Incremental_inputs::report_script): Save mtime; style fix.
14362         (Incremental_inputs::finalize_inputs): Style fix.
14363         (Incremental_inputs::finalize): Style fix.
14364         (Incremental_inputs::create_input_section_data): Store inputs
14365         mtime.
14366         * incremental.h (Incremental_inputs::report_script): Add mtime
14367         argument.
14368         (Incremental_inputs::Input_info::Input_info): Intialize only one
14369         union member.
14370         (Incremental_inputs::Input_info::archive): Move to nameless
14371         union.
14372         (Incremental_inputs::Input_info::obejct): Move to nameless union.
14373         (Incremental_inputs::Input_info::script): Move to nameless union.
14374         (Incremental_inputs::mtime): New field.
14375         * script.cc (read_input_script): Pass file mtime to
14376         Incremental_input.
14377         * script.h (Script_info::inputs): Style fix.
14378
14379 2009-07-01  Ian Lance Taylor  <ian@airs.com>
14380
14381         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
14382         instead of 32.
14383
14384 2009-06-24  Ian Lance Taylor  <iant@google.com>
14385
14386         PR 10156
14387         * layout.cc (Layout::choose_output_section): If we find an
14388         existing section, update the flags.
14389         (Layout::create_notes): New function, broken out of
14390         Layout::finalize.
14391         (Layout::finalize): Don't create note sections.
14392         (Layout::create_note): Don't crash if linker script discards
14393         section.
14394         (Layout::create_gold_note): Likewise.
14395         (Layout::create_build_id): Likewise.  Don't set
14396         after_input_sections on the section.
14397         (Layout::create_executable_stack_info): Remove target parameter.
14398         Change caller.
14399         * layout.h (class Layout): Declare create_notes.  Update
14400         declaration of create_executable_stack_info.
14401         * gold.cc (queue_middle_tasks): Call create_notes.
14402         * output.cc (Output_section::update_flags_for_input_section): Move
14403         here from output.h.  If SHF_ALLOC flag is newly set, mark address
14404         invalid.
14405         * output.h (Output_data::mark_address_invalid): New function.
14406         (class Output_section): Only declare, not define,
14407         update_flags_for_input_section.  Remove set_flags.
14408
14409 2009-06-24  Ian Lance Taylor  <iant@google.com>
14410
14411         * script-sections.cc (Output_section_definition::
14412         set_section_addresses): Rename shadowing local load_address to
14413         laddr.
14414
14415 2009-06-24  Ian Lance Taylor  <iant@google.com>
14416
14417         PR 10244
14418         * reloc.cc (relocate_sections): Skip empty relocation sections.
14419
14420 2009-06-23  Ian Lance Taylor  <iant@google.com>
14421
14422         PR 10156
14423         * layout.cc (Layout::create_note): Use choose_output_section
14424         rather than make_output_section.
14425
14426 2009-06-23  Ian Lance Taylor  <iant@google.com>
14427
14428         PR 10237
14429         * options.cc (General_options::parse_V): Set printed_version_.
14430         (General_options::General_options): Initialize printed_version_.
14431         * options.h (class General_options): Add printed_version_ field.
14432         * gold.cc (queue_initial_tasks): If there are no input files,
14433         don't give a fatal error if we printed the version information.
14434         (queue_middle_tasks): If using -r with a shared object, give a
14435         fatal error rather than an ordinary error.
14436
14437 2009-06-23  Ian Lance Taylor  <iant@google.com>
14438
14439         PR 10219
14440         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
14441         (Layout::make_output_section): Set have_stabstr_section_ if we see
14442         a .stab*str section.
14443         (Layout::finalize): Call link_stabs_sections.
14444         (Layout::link_stabs_sections): New file.
14445         * layout.h (class Layout): Add have_stabstr_section_ field.
14446         Declare link_stabs_sections.
14447
14448 2009-06-23  Doug Kwan  <dougkwan@google.com>
14449
14450         * Makefile.am (libgold_a_LIBADD): New.
14451         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
14452         * Makefile.in: Regenerate.
14453         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
14454         * configure: Regenerate.
14455         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
14456         * fileread.cc: Include sys/state.h
14457         * gold.h: Declare memmem and strndup if found missing.
14458         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
14459
14460 2009-06-23  Ian Lance Taylor  <iant@google.com>
14461
14462         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
14463         * configure: Rebuild.
14464
14465 2009-06-23  Ian Lance Taylor  <iant@google.com>
14466
14467         PR 10147
14468         * object.cc (Object::section_contents): Don't try to get a view if
14469         the section has length zero.
14470         (Object::handle_gnu_warning_section): If the section is empty, use
14471         the name of the section as the warning.
14472
14473 2009-06-23  Ian Lance Taylor  <iant@google.com>
14474
14475         PR 10133
14476         * stringpool.h (class Stringpool_template): Add optimize_ field.
14477         (Stringpool_template::set_optimize): New function.
14478         * stringpool.cc (Stringpool_template::Stringpool_template):
14479         Initialize optimize_ field.
14480         (Stringpool_template::set_string_offsets): Test local optimize
14481         fild rather than parameter.
14482         * layout.cc (Layout::Layout): Call set_optimize on the section
14483         name stringpool.
14484
14485 2009-06-22  Ian Lance Taylor  <iant@google.com>
14486
14487         PR 10030
14488         * yyscript.y: Parse TARGET.
14489         * script.cc (script_set_target): New function.
14490         * script-c.h (script_set_target): Declare.
14491         * options.cc (General_options::string_to_object_format): Rename
14492         from string_to_object_format in anonymous namespace.  Change
14493         callers.
14494         * options.h (class General_options): Declare
14495         string_to_object_format.
14496
14497 2009-06-22  Ian Lance Taylor  <iant@google.com>
14498
14499         * script-sections.cc (Script_sections::create_segments): Don't put
14500         program headers in a PT_LOAD segment if -n or -N.
14501
14502 2009-06-22  Ian Lance Taylor  <iant@google.com>
14503
14504         PR 10141
14505         * options.h (class General_options): Add -z lazy and -z now.  Sort
14506         -z options into alphabetical order.
14507         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
14508
14509 2009-06-21  Ian Lance Taylor  <iant@google.com>
14510
14511         * layout.cc (Layout::make_output_section): Call
14512         Target::new_output_section.
14513         (Layout::attach_allocated_section_to_segment): Put large section
14514         sections in a separate load segment with the large segment flag
14515         set.
14516         (Layout::segment_precedes): Sort large data segments after other
14517         load segments.
14518         (align_file_offset): New static function.
14519         (Layout::set_segment_offsets): Use align_file_offset.
14520         * output.h (class Output_section): Add is_small_section_ and
14521         is_large_section_ fields.
14522         (Output_section::is_small_section): New function.
14523         (Output_section::set_is_small_section):  New function.
14524         (Output_section::is_large_section): New function.
14525         (Output_section::set_is_large_section): New function.
14526         (Output_section::is_large_data_section): New function.
14527         (class Output_segment): Add is_large_data_segment_ field.
14528         (Output_segment::is_large_data_segment): New function.
14529         (Output_segment::set_is_large_data_segment): New function.
14530         * output.cc (Output_section::Output_section): Initialize new
14531         fields.
14532         (Output_segment::Output_segment): Likewise.
14533         (Output_segment::add_output_section): Add assertion that large
14534         data sections always go in large data segments.  Force small data
14535         sections to the end of the list of data sections.  Force small BSS
14536         sections to the start of the list of BSS sections.  For large BSS
14537         sections to the end of the list of BSS sections.
14538         * symtab.h (class Symbol): Declare is_common_shndx.
14539         (Symbol::is_defined): Check Symbol::is_common_shndx.
14540         (Symbol::is_common): Likewise.
14541         (class Symbol_table): Define enum Commons_section_type.  Update
14542         declarations.  Add small_commons_ and large_commons_ fields.
14543         * symtab.cc (Symbol::is_common_shndx): New function.
14544         (Symbol_table::Symbol_table): Initialize new fields.
14545         (Symbol_table::add_from_object): Put small and large common
14546         symbols in the right list.
14547         (Symbol_table::sized_finalized_symbol): Check
14548         Symbol::is_common_shndx.
14549         (Symbol_table::sized_write_globals): Likewise.
14550         * common.cc (Symbol_table::do_allocate_commons): Allocate new
14551         common symbol lists.  Don't call do_allocate_commons_list if the
14552         list is empty.
14553         (Symbol_table::do_allocate_commons_list): Remove is_tls
14554         parameter.  Add comons_section_type parameter.  Change all
14555         callers.  Handle small and large common symbols.
14556         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
14557         Symbol::is_common_shndx.
14558         * resolve.cc (symbol_to_bits): Likewise.
14559         * target.h (Target::small_common_shndx): New function.
14560         (Target::small_common_section_flags): New function.
14561         (Target::large_common_shndx): New function.
14562         (Target::large_common_section_flags): New function.
14563         (Target::new_output_section): New function.
14564         (Target::Target_info): Add small_common_shndx, large_common_shndx,
14565         small_common_section_flags, and large_common_section_flags
14566         fields.
14567         (Target::do_new_output_section): New virtual function.
14568         * arm.cc (Target_arm::arm_info): Initialize new fields.
14569         * i386.cc (Target_i386::i386_info): Likewise.
14570         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
14571         Likewise.
14572         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
14573         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14574         (Target_x86_64::do_new_output_section): New function.
14575         * configure.ac: Define conditional MCMODEL_MEDIUM.
14576         * testsuite/Makefile.am (check_PROGRAMS): Add large.
14577         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
14578         (large_LDFLAGS): Define.
14579         * testsuite/large.c: New file.
14580         * testsuite/testfile.cc (Target_test::test_target_info):
14581         Initialize new fields.
14582         * configure, testsuite/Makefile.in: Rebuild.
14583
14584 2009-06-05  Doug Kwan  <dougkwan@google.com>
14585
14586         * Makefile.am (CCFILES): Add target.cc.
14587         * Makefile.in: Regenerate.
14588         * i386.cc (class Target_i386): Define new virtual method to
14589         override do_is_local_label_name in parent.
14590         * object.cc (Sized_relobj::do_count_local_symbols): Discard
14591         local symbols if --discard-locals or -X is given.
14592         * options.h (class General_options): Declare new options
14593         '--discard-locals' and '-X' for discarding locals.
14594         * target.h (class Target): Define new methods is_local_label_name.
14595         Declare new virtual method do_is_local_label_name.
14596         * target.cc: New file.
14597         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
14598         (check_SCRIPTS): Add discard_locals_test.sh.
14599         (check_DATA): Add discard_local_tests.syms.
14600         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
14601         (discard_local_tests.syms, discard_locals_test.o): New make rules.
14602         * testsuite/Makefile.in: Regenerate.
14603         * testsuite/discard_locals_test.c: New file.
14604         * testsuite/discard_locals_test.sh: Same.
14605
14606 2009-06-05  Doug Kwan  <dougkwan@google.com>
14607
14608         * object.cc (Sized_relobj::Sized_relobj): Initialize
14609         discarded_eh_frame_shndx_ to -1U.
14610         (Sized_relobj::do_layout): Record index of a discard .eh_frame
14611         section.
14612         (Sized_relobj::do_count_local_symbols): Skip local symbols in
14613         a discarded .eh_frame section.
14614         (Sized_relobj::do_finalize_local_symbols): Ditto.
14615         * object.h (class Sized_relobj): Declare new member
14616         discarded_eh_frame_shndx_.
14617         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
14618         (local_labels_test.o, local_labels_test): New rules.
14619         * testsuite/Makefile.in: Regenerate.
14620
14621 2009-06-04  Doug Kwan  <dougkwan@google.com>
14622
14623         * layout.cc (Layout::section_name_mapping): Add mapping for
14624         special ARM sections.
14625
14626 2009-06-03  Doug Kwan  <dougkwan@google.com>
14627
14628         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
14629         (utils::has_overflow): Same.
14630
14631 2009-06-03  Ian Lance Taylor  <iant@google.com>
14632
14633         * layout.cc (Layout::section_name_mapping): New array, replacing
14634         Layout::linkonce_mapping.
14635         (Layout::section_name_mapping_count): New variable, replacing
14636         Layout::linkonce_mapping_count.
14637         (Layout::linkonce_output_name): Remove.
14638         (Layout::output_section_name): Rewrite.
14639         * layout.h (class Layout): Rename Linkonce_mapping to
14640         Section_name_mapping, linkonce_mapping to section_name_mapping,
14641         linkonce_mapping_count to section_name_mapping_count.  Don't
14642         declare linkonce_output_name.
14643
14644 2009-06-03  Doug Kwan  <dougkwan@google.com>
14645
14646         * gold/arm.cc (namespace utils): New.
14647         (Target_arm::reloc_is_non_pic): Define new method.
14648         (class Arm_relocate_functions): New.
14649         (Target_arm::Relocate::relocate): Handle relocation types used by
14650         Android.
14651
14652 2009-06-03  Ian Lance Taylor  <iant@google.com>
14653
14654         * arm.cc (Target_arm::scan::global): Use || instead of |.
14655
14656 2009-06-02  Doug Kwan  <dougkwan@google.com>
14657
14658         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
14659         issued_non_pic_error_.
14660         (class Target_arm::Scan): Declare new method check_non_pic.
14661         Define new method symbol_needs_plt_entry.
14662         Declare new data member issued_non_pic_error_.
14663         (class Target_arm::Relocate): Declare new method
14664         should_apply_static_reloc.
14665         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
14666         (Target_arm::Scan::check_non_pic): Define new method.
14667         (Target_arm::Scan::local): Handle a small subset of reloc types used
14668         by Android.
14669         (Target_arm::Scan::local): Same.
14670         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
14671
14672 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
14673
14674         * incremental.cc (Incremental_inputs::report_command_line): Filter
14675         out --incremental-* options.
14676
14677 2009-05-29  Doug Kwan  <dougkwan@google.com>
14678
14679         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
14680         template class.
14681         (class Target_arm): Update comment.
14682         (Target_arm::Target_arm): Initialize new data members GOT_,
14683         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
14684         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
14685         and Target_arm::rel_dyn_section.
14686         Declare new_enum Target_arm::Got_type.
14687         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
14688         and DYNBSS_.
14689         Update commments for member do_dynsym_value.
14690         (Target_arm::got_size, Target_arm::plt_section,
14691         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
14692         new methods inside class defintion.
14693         (Target_arm::got_section): Define new method.
14694         (Target_arm::rel_dyn_section): Same.
14695         (Output_data_plt_arm): New template class.
14696         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
14697         (Output_data_plt_arm:do_adjust_output_section): Define new method.
14698         (Output_data_plt_arm::add_entry): Same.
14699         (Output_data_plt_arm::first_plt_entry): Define new
14700         static data member for PLT instruction template.
14701         (Output_data_plt_arm::plt_entry): Same.
14702         (Output_data_plt_arm::do_write): Define new method.
14703         (Target_arm::make_plt_entry): Same.
14704         (Target_arm::do_finalize_sections): Same.
14705         (Target_arm::do_dynsym_value): Same.
14706
14707 2009-05-28  Doug Kwan  <dougkwan@google.com>
14708
14709         * Makefile.am (TARGETSOURCES): Add arm.cc.
14710         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
14711         * Makefile.in: Regenerate.
14712         * arm.cc: New file.
14713         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
14714
14715 2009-05-26  Doug Kwan  <dougkwan@google.com>
14716
14717         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
14718         (General_options::check_excluded_libs): Strip off directories in
14719         archive name before matching like GNU ld does.
14720         * testsuite/Makefile.am (MOSTLYCLEANFILES,
14721         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
14722         (exclude_libs_test_LDFLAGS): Add linker option
14723         -Wl,--exclude-libs,libexclude_libs_test_3
14724         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
14725         an explicit archive without using -l.
14726         (alt/libexclude_libs_test_3.a): New make rule.
14727         * testsuite/Makefile.in: Regenerate.
14728         * testsuite/exclude_libs_test.c : Declare lib3_default().
14729         (main): Call it.
14730         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
14731         * exclude_libs_test_3.c: New file.
14732
14733 2009-05-26  Nick Clifton  <nickc@redhat.com>
14734
14735         * po/id.po: New Indonesian translation.
14736         * po/gold.pot: Updated template file.
14737
14738 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
14739
14740         * testsuite/Makefile.am: Add -ffunction-sections to compile
14741         gc_comdat_test files.  Add -Wl,--gc-sections to build
14742         gc_comdat_test.
14743         * testsuite/Makefile.in: Regenerate.
14744         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
14745
14746 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
14747
14748         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
14749         kept comdat section was garbage collected.
14750         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
14751         * testsuite/Makefile.in: Regenerate.
14752         * testsuite/gc_comdat_test.sh: New file.
14753         * testsuite/gc_comdat_test_1.cc: New file.
14754         * testsuite/gc_comdat_test_2.cc: New file.
14755
14756 2009-05-19  Doug Kwan  <dougkwan@google.com>
14757
14758         * archive.cc (Archive::Archive): Move constructor from archive.h
14759         to here.  Initialize no_export_.
14760         (Archive::get_elf_object_for_member): Set no_export flag of object.
14761         * archive.h (Archive::Archive): Move constructor body to
14762         archive.cc.
14763         (Archive::no_export): New method.
14764         (Archive::no_export_): New field.
14765         * object.h (Object::Object): Initialize no_export_ to false.
14766         (Object::no_export, Object::set_no_export): New methods.
14767         (Object::no_export_): New field.
14768         * options.cc (General_options::parse_exclude_libs): New method.
14769         (General_options::check_excluded_libs) Same.
14770         * options.h (exclude_libs): New option.
14771         (General_options::check_excluded_libs): New method declaration.
14772         (General_options::excluded_libs_): New field.
14773         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
14774         default or protected visibility if an object has no-export flag set.
14775         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
14776         (check_SCRIPTS): Add exclude_libs_test.sh.
14777         (check_DATA): Add exclude_libs_test.syms.
14778         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
14779         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
14780         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
14781         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
14782         (exclude_libs_test.syms, libexclude_libs_test_1.a,
14783         libexclude_libs_test_2.a): New rules.
14784         * testsuite/Makefile.in: Regenerate.
14785         * testsuite/exclude_libs_test.c: New file.
14786         * testsuite/exclude_libs_test.sh: Ditto.
14787         * testsuite/exclude_libs_test_1.c: Ditto.
14788         * testsuite/exclude_libs_test_2.c: Ditto.
14789
14790 2009-05-15  Ian Lance Taylor  <iant@google.com>
14791
14792         * configure.ac: Check for declarations for cases where libiberty.h
14793         checks HAVE_DECL_xxx.
14794         * configure, config.in: Rebuild.
14795
14796 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
14797
14798         * gold.h (Incremental_argument_list): Remove (invalid) forward
14799         declaration.
14800         * incremental.cc (Incremental_inputs::report_achive): New method.
14801         (Incremental_inputs::report_object): New method.
14802         (Incremental_inputs::report_script): New method.
14803         (Incremental_inputs::finalize_inputs): New method.
14804         (Incremental_inputs::finalize): Call finalize_inputs().
14805         (Incremental_inputs::sized_create_incremental_inputs_section_data):
14806         Create inputs entries.
14807         * incremental.h (Incremental_input_type): New enum.
14808         (Incremental_inputs::Incremental_input): Initialize new fields.
14809         (Incremental_inputs::report_inputs): New method.
14810         (Incremental_inputs::report_achive): New method.
14811         (Incremental_inputs::report_object): New method.
14812         (Incremental_inputs::report_script): New method.
14813         (Incremental_inputs::finalize_inputs): New method.
14814         (Incremental_inputs::Input_info): New struct.
14815         (Incremental_inputs::Input_info_map): New typedef.
14816         (Incremental_inputs::lock_): New field.
14817         (Incremental_inputs::Inputs_): New field.
14818         (Incremental_inputs::Inputs_map): New field.
14819         * main.cc (main): Call Incremental_input::report_inputs.
14820         * options.h (Input_argument_list): Typedef moved from
14821         Input_arguments.
14822         (Input_file_group::Files): Remove, use ::Input_argument_list.
14823         (Input_file_group::Input_argument_list): Remove, use
14824         ::Input_argument_list.
14825         * plugin.cc (Plugin_manager::add_input_file): Add error in
14826         incremental build.
14827         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
14828         functions.
14829         * script.cc (read_input_script): Call
14830         Incremental_input::report_script.
14831         * script.h (Script_info): New class.
14832
14833 2009-04-27  Ian Lance Taylor  <iant@google.com>
14834
14835         * x86_64.cc (do_adjust_output_section): Set entsize to
14836         plt_entry_size.
14837
14838 2009-04-23  Elliott Hughes  <enh@google.com>
14839
14840         * output.cc (Output_file::close): After short writes, continue
14841         writing from the correct offset in the buffer being written.
14842
14843 2009-04-23  Chris Demetriou  <cgd@google.com>
14844
14845         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
14846         * configure: Regenerate.
14847         * config.in: Regenerate.
14848         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
14849         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
14850
14851 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
14852
14853         * incremental.cc (Incremental_inputs_header_data): Renamed from
14854         Incremental_input_header_data.
14855         (Incremental_inputs_header_data::data_size): New field.
14856         (Incremental_inputs_header_data::put_input_file_count): Renamed
14857         from input_file_count.
14858         (Incremental_inputs_header_data::put_command_line_offset): Renamed
14859         from command_line_offset.
14860         (Incremental_inputs_header_data::put_reserved): Renamed from
14861         put_reserved.
14862         (Incremental_inputs_entry_data): Renamed from
14863         Incremental_input_entry_data.
14864         (Incremental_inputs_entry_data::data_size): New field.
14865         (Incremental_inputs::report_command_line): New method.
14866         (Incremental_inputs::finalize): New method.
14867         (Incremental_inputs::create_incremental_inputs_data): New method.
14868         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
14869         * incremental.h: New file.
14870         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
14871         (Layout::finalize): Create incremental inputs section in
14872         incremental builds.
14873         (Layout::create_incremental_info_sections): New method.
14874         * layout.h (Layout::incremental_inputs): New method.
14875         (Layout::create_incremental_info_sections): New method.
14876         (Layout::incremental_inputs_): New field.
14877         * main.cc (main): Notify Incremental_input of the command line.
14878
14879 2009-04-01  Ian Lance Taylor  <iant@google.com>
14880             Mikolaj Zalewski  <mikolajz@google.com>
14881
14882         * gold.h (reserve_unordered_map): Define, three versions, one for
14883         each version of Unordered_map.
14884         * layout.cc (Layout::Layout): Remove options parameter.  Add
14885         number_of_input_files parameter.  Don't initialize options_.
14886         Initialize number_of_input_files_ and resized_signatures_.  Move
14887         sections_are_attached_.
14888         (Layout::layout_group): Reserve space for group_signatures_.
14889         (Layout::find_or_add_kept_section): Change name parameter to be a
14890         reference.  Resize signatures_ map when it gets large enough.
14891         (Layout::layout_eh_frame): Use parameters->options() instead of
14892         this->options_.
14893         (Layout::make_output_section): Likewise.
14894         (Layout::attach_allocated_section_to_segment): Likewise.
14895         (Layout::finalize, Layout::create_executable_stack): Likewise.
14896         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
14897         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
14898         * layout.h (class Layout): Update declarations.  Remove options_
14899         field.  Add number_of_input_files_ and resized_signatures_
14900         fields.  Move sections_are_attached_ field.
14901         * main.cc (main): Pass number of input files to Layout
14902         constructor.  Don't pass options.
14903
14904 2009-03-30  Ian Lance Taylor  <iant@google.com>
14905
14906         * ffsll.c (ffsll): Correct implementation.
14907
14908 2009-03-27  Ian Lance Taylor  <iant@google.com>
14909
14910         * ffsll.c: New file.
14911         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
14912         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
14913         * ftruncate.c (ftruncate): Declare before definition.
14914         * mremap.c (mremap): Likewise.
14915         * pread.c (pread): Likewise.
14916         * configure, Makefile.in, config.in: Rebuild.
14917
14918         * mremap.c: New file.
14919         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
14920         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
14921         (mremap): Declare if HAVE_MREMAP is not defined.
14922         * configure, Makefile.in, config.in: Rebuild.
14923
14924 2009-03-27  Cary Coutant  <ccoutant@google.com>
14925
14926         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
14927         position independent.
14928         * sparc.cc (Target_sparc::check_non_pic): Likewise.
14929         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
14930
14931 2009-03-24  Cary Coutant  <ccoutant@google.com>
14932
14933         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
14934         an executable.
14935         (needs_dynamic_reloc): Likewise.
14936
14937 2009-03-24  Ian Lance Taylor  <iant@google.com>
14938
14939         * yyscript.y (file_cmd): Recognize EXTERN.
14940         (extern_name_list, extern_name_list_body): New nonterminals.
14941         * script.cc (script_add_extern): Define.
14942         * script-c.h (script_add_extern): Declare.
14943
14944 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
14945
14946         * object.cc (is_elf_object): Define.
14947         * object.h (is_elf_object): Declare.
14948         * archive.cc (Archive::get_elf_object_for_member): Call
14949         is_elf_object.
14950         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
14951
14952 2009-03-24  Elliott Hughes  <enh@google.com>
14953
14954         * output.cc (Output_file::map_anonymous): Define.
14955         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
14956         try an anonymous one.  Report the size if the mmap fails.
14957         * output.h (class Output_file): Declare map_anonymous.
14958
14959 2009-03-24  Ian Lance Taylor  <iant@google.com>
14960
14961         * target-select.cc (instantiate_target): Don't acquire the lock if
14962         the instantiated_target_ field has already been set.
14963
14964 2009-03-23  Ian Lance Taylor  <iant@google.com>
14965
14966         * gold-threads.h (class Initialize_lock): Define.
14967         * gold-threads.cc (class Initialize_lock_once): Define.
14968         (initialize_lock_control): New static variable.
14969         (initialize_lock_pointer): New static variable.
14970         (initialize_lock_once): New static function.
14971         (Initialize_lock::Initialize_lock): Define.
14972         (Initialize_lock::initialize): Define.
14973         * target-select.h: Include "gold-threads.h".
14974         (class Target_selector): Add lock_ and initialize_lock_ fields.
14975         Don't define instantiate_target, just declare it.
14976         * target-select.cc (Target_selector::Target_selector): Initialize
14977         new fields.
14978         (Target_selector::instantiate_target): Define.
14979         * descriptors.h: Include "gold-threads.h".
14980         (class Descriptors): Add initialize_lock_ field.
14981         * descriptors.cc (Descriptors::Descriptors): Initialize new
14982         field.
14983         (Descriptors::open): Use initialize_lock_ field
14984         * errors.h (class Errors): Add initialize_lock_ field.
14985         * errors.cc (Errors::Errors): Initialize new field.
14986         (Errors::initialize_lock): Use initialize_lock_ field.
14987         * powerpc.cc (class Target_selector_powerpc): Remove
14988         instantiated_target_ field.  In do_recognize call
14989         instantiate_target rather than do_instantiate_target.  In
14990         do_instantiate_target just allocate a new target.
14991         * sparc.cc (class Target_selector_sparc): Likewise.
14992
14993         * freebsd.h: New file.
14994         * i386.cc: Include "freebsd.h".
14995         (Target_i386): Derive from Target_freebsd rather than
14996         Sized_target.
14997         (Target_selector_i386): Derive from Target_selector_freebsd rather
14998         than Target_selector.
14999         * x86_64.cc: Include "freebsd.h".
15000         (Target_x86_64): Derive from Target_freebsd rather than
15001         Sized_target.
15002         (Target_selector_x86_64): Derive from Target_selector_freebsd
15003         rather than Target_selector.
15004         * target.h (class Target): Add adjust_elf_header and
15005         do_adjust_elf_header.
15006         * output.cc (Output_file_header:: do_sized_write): Call target
15007         adjust_elf_header routine.
15008         * configure.tgt: Set targ_osabi.
15009         * configure.ac: Define GOLD_DEFAULT_OSABI.
15010         * parameters.cc (Parameters::default_target): Pass
15011         GOLD_DEFAULT_OSABI to select_target.
15012         * target-select.h (class Target_selector): Make instantiate_target
15013         protected rather than private.
15014         * Makefile.am (HFILES): Add freebsd.h.
15015         * configure, Makefile.in, config.in: Rebuild.
15016
15017         * merge.cc (do_add_input_section): Correct pend value.  Change
15018         message about last entry not being null terminated from error to
15019         warning.
15020
15021 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
15022
15023         * incremental.cc: New file.
15024         * Makefile.am (CCFILES): Add incremental.cc.
15025         * Makefile.in: Rebuild.
15026
15027 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
15028
15029         * layout.cc (Layout::output_section_name): Preserve names
15030         of '.note.' sections.
15031
15032 2009-03-19  Ian Lance Taylor  <iant@google.com>
15033
15034         * descriptors.cc (Descriptors::open): Check that the options are
15035         valid before using them.
15036
15037 2009-03-18  Ian Lance Taylor  <iant@google.com>
15038
15039         * script-sections.h: Include <list>.
15040         (class Script_sections): Change Sections_elements from std::vector
15041         to std::list.  Typedef public Elements_iterator.  Add
15042         orphan_section_placement_, data_segment_align_start_, and
15043         saw_data_segment_align_ fields.  Remove data_segment_align_index_
15044         field.
15045         * script-sections.cc (class Orphan_section_placement): New class.
15046         (class Sections_element): Add virtual functions is_relro and
15047         orphan_section_init.  Remove virtual function place_orphan_here.
15048         (class Output_section_definition): Add is_relro and
15049         orphan_section_init.  Remove place_orphan_here.
15050         (class Orphan_output_section): Likewise.
15051         (Script_sections::Script_sections): Update for field changes.
15052         (Script_sections::data_segment_align): Set saw_data_segment_align_
15053         and data_segment_align_start_, not data_segment_align_index.
15054         (Script_sections::data_segment_relro_end): Check
15055         saw_data_segment_align_.  Use data_segment_align_start_ rather
15056         than data_segment_align_index_.
15057         (Script_sections::place_orphan): Rewrite to use
15058         Orphan_section_placement.
15059
15060 2009-03-17  Ian Lance Taylor  <iant@google.com>
15061
15062         * archive.cc (Archive::add_symbols): Check for a version attached
15063         to the symbol name in the archive map.
15064         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
15065         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
15066         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
15067         (ver_test_11.a): New target.
15068         * testsuite/Makefile.in: Rebuild.
15069
15070         * configure.ac: Check for chsize and posix_fallocate.  Replace
15071         ftruncate.
15072         * ftruncate.c: New file, from gnulib.
15073         * output.cc (posix_fallocate): Define dummy version if not
15074         HAVE_POSIX_FALLOCATE.
15075         (Output_file::map): Call posix_fallocate rather than lseek and
15076         write.
15077         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
15078         * configure, Makefile.in, config.in: Rebuild.
15079
15080 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
15081
15082         * layout.h (Layout::create_note): Add section_name parameter.
15083         * layout.cc (Layout::create_note): Likewise.
15084         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
15085
15086 2009-03-17  Ian Lance Taylor  <iant@google.com>
15087
15088         * descriptors.cc: Include "options.h".
15089         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
15090         (Descriptors::open): Always use O_CLOEXEC when opening a new
15091         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
15092         then set FD_CLOEXEC.
15093
15094         * sparc.cc (class Target_sparc): Add has_got_section.
15095         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
15096         make sure we have a GOT section.
15097
15098         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
15099         (Target_sparc::Scan::local): Likewise.
15100         (Target_sparc::Scan::global): Likewise.
15101         (Target_sparc::Relocate::relocate): Likewise.
15102         (Target_sparc::Relocate::relocate_tls): Likewise.
15103
15104         * symtab.cc (Symbol_table::define_default_version): New function,
15105         broken out of add_from_object.
15106         (Symbol_table::add_from_object): Call define_default_version.
15107         (Symbol_table::define_special_symbol): Add resolve_oldsym
15108         parameter.  Change all callers.  If the version for a symbol comes
15109         from a version script, resolve it with the symbol with the same
15110         name with no version.  Also add the symbol without a version if
15111         appropriate.
15112         (do_define_in_output_data): If resolving with oldsym, don't delete
15113         sym.
15114         (do_define_in_output_segment): Likewise.
15115         (do_define_as_constant): Likewise.
15116         * symtab.h (class Symbol_table): Update declarations.
15117
15118 2009-03-13  Ian Lance Taylor  <iant@google.com>
15119
15120         * readsyms.cc (Read_symbols::incompatible_warning): New function.
15121         (Read_symbols::requeue): New function.
15122         (Read_symbols::do_read_symbols): If make_elf_object fails because
15123         the target type is not configured, and the file was searched for,
15124         issue a warning and retry with the next directory.
15125         (Add_symbols::run): If the file has an incompatible format, and
15126         it was searched for, requeue the Read_symbols task.  On error,
15127         release the object.
15128         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
15129         dirindex parameter to constructor.  Change all callers.  Declare
15130         incompatible_warning and requeue.
15131         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
15132         input_argument_ and input_group_ fields.  Add them to
15133         constructor.  Change all callers.
15134         (class Read_script): Add dirindex_ field.  Add it to constructor.
15135         Change all callers.
15136         * archive.cc (Archive::setup): Remove input_objects parameter.
15137         Change all callers.
15138         (Archive::get_file_and_offset): Likewise.
15139         (Archive::read_all_symbols): Likewise.
15140         (Archive::read_symbols): Likewise.
15141         (Archive::get_elf_object_for_member): Remove input_objects
15142         parameter.  Add punconfigured parameter.  Change all callers.
15143         (Archive::add_symbols): Change return type to bool.  Check return
15144         value of include_member.
15145         (Archive::include_all_members): Likewise.
15146         (Archive::include_member): Change return type to bool.  Return
15147         false if first included object has incompatible target.  Set
15148         included_member_ field.
15149         (Add_archive_symbols::run): If add_symbols returns false, requeue
15150         Read_symbols task.
15151         * archive.h (class Archive): Add included_member_ field.
15152         Initialize it in constructor.  Add input_file and searched_for
15153         methods.  Update declarations.
15154         (class Add_archive_symbols): Add dirpath_, dirindex_, and
15155         input_argument_ fields.  Add them to constructor.  Change all
15156         callers.
15157         * script.cc: Include "target-select.h".
15158         (class Parser_closure): Add skip_on_incompatible_target_ and
15159         found_incompatible_target_ fields.  Add
15160         skip_on_incompatible_target parameter to constructor.  Change all
15161         callers.  Add methods skip_on_incompatible_target,
15162         clear_skip_on_incompatible_target, found_incompatible_target, and
15163         set_found_incompatible_target.
15164         (read_input_script): Add dirindex parameter.  Change all callers.
15165         If parser finds an incompatible target, requeue Read_symbols
15166         task.
15167         (script_set_symbol): Clear skip_on_incompatible_target in
15168         closure.
15169         (script_add_assertion, script_parse_option): Likewise.
15170         (script_start_sections, script_add_phdr): Likewise.
15171         (script_check_output_format): New function.
15172         * script.h (read_input_script): Update declaration.
15173         * script-c.h (script_check_output_format): Declare.
15174         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
15175         (ignore_cmd): Remove OUTPUT_FORMAT.
15176         * fileread.cc (Input_file::Input_file): Add explicit this.
15177         (Input_file::will_search_for): New function.
15178         (Input_file::open): Add pindex parameter.  Change all callers.
15179         * fileread.h (class Input_file): Add input_file_argument method.
15180         Declare will_search_for.  Update declarations.
15181         * object.cc (make_elf_object): Add punconfigured parameter.
15182         Change all callers.
15183         * object.h (class Object): Make input_file public.  Add
15184         searched_for method.
15185         (make_elf_object): Update declaration.
15186         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
15187         restart search.
15188         * dirsearch.h (class Dirsearch): Update declaration.
15189         * options.h (class General_options): Add --warn-search-mismatch.
15190         * parameters.cc (Parameters::is_compatible_target): New function.
15191         * parameters.h (class Parameters): Declare is_compatible_target.
15192         * workqueue.cc (Workqueue::add_blocker): New function.
15193         * workqueue.h (class Workqueue): Declare add_blocker.
15194
15195         * fileread.cc (Input_file::open): Remove options parameter.
15196         Change all callers.
15197         (Input_file::open_binary): Likewise.
15198         * script.cc (read_input_script): Likewise.
15199         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
15200         options parameter from constructor.  Change all callers.
15201         (class Read_script): Likewise.
15202         * fileread.h (class Input_file): Update declarations.
15203         * script.h (read_input_script): Update declaration.
15204
15205 2009-03-10  Nick Clifton  <nickc@redhat.com>
15206
15207         * po/es.po: New Spanish translation.
15208
15209 2009-03-06  Cary Coutant  <ccoutant@google.com>
15210
15211         * options.cc (parse_short_option): Keep dash_z from registering itself.
15212
15213 2009-03-03  Ian Lance Taylor  <iant@google.com>
15214
15215         PR 9918
15216         * target-reloc.h (relocate_section): Pass output_section to
15217         relocate.
15218         * i386.cc (Target_i386::should_apply_static_reloc): Add
15219         output_section parameter.  Change all callers.
15220         (Target_i386::Relocate::relocate): Add output_section parameter.
15221         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15222         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
15223         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
15224         * testsuite/two_file_shared.sh: New script.
15225         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
15226         (check_DATA): Add two_file_shared.dbg.
15227         (two_file_shared.dbg): New target.
15228         * testsuite/Makefile.in: Rebuild.
15229
15230 2009-03-01  Ian Lance Taylor  <iant@google.com>
15231
15232         * configure.ac: Check for byteswap.h.
15233         * configure: Rebuild.
15234         * config.in: Rebuild.
15235
15236 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
15237
15238         * layout.cc (Layout::find_or_add_kept_section): New function.
15239         (Layout::add_comdat): Removed.
15240         * layout.h (struct Kept_section): Move out of class Layout.
15241         Remove trailing underscores from field names.  Add group_sections
15242         field.  Rename group_ field to is_group.  Change all uses.
15243         (class Layout): Declare find_or_add_kept_section, not add_comdat.
15244         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
15245         comdat_groups_ field.
15246         (Sized_relobj::include_section_group): Use
15247         find_or_add_kept_section and Kept_section::group_sections.
15248         (Sized_relobj::include_linkonce_section): Likewise.
15249         * object.cc (class Sized_relobj): Don't define Comdat_group or
15250         Comdat_group_table.  Remove find_comdat_group and
15251         add_comdat_group.  Remove comdat_groups_ field.
15252         * plugin.cc (include_comdat_group): Use
15253         Layout::find_or_add_kept_section.
15254
15255 2009-02-28  Ian Lance Taylor  <iant@google.com>
15256
15257         * README: --gc-sections and map files are now supported.  Document
15258         some build requirements.
15259
15260         PR 6992
15261         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
15262         relocatable link set the value of the section symbol to zero.
15263         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
15264         relocatable link don't include the section address in the local
15265         symbol value.
15266
15267 2009-02-27  Ian Lance Taylor  <iant@google.com>
15268
15269         PR 6811
15270         * options.h (class Search_directory): Add is_system_directory.
15271         (class General_options): Declare is_in_system_directory.
15272         * options.cc (get_relative_sysroot): Make static.
15273         (get_default_sysroot): Make static.
15274         (General_optoins::is_in_system_directory): New function.
15275         * fileread.cc (Input_file::is_in_system_directory): New function.
15276         * fileread.h (class Input_file): Declare is_in_system_directory.
15277         * object.h (class Object): Add is_in_system_directory.
15278         (class Input_objects): Remove system_library_directory_ field.
15279         * object.cc (Input_objects::add_object): Don't set
15280         system_library_directory_.
15281         (input_objects::found_in_system_library_directory): Remove.
15282         * symtab.cc (Symbol_table::write_globals): Remove input_objects
15283         parameter.  Change all callers.
15284         (Symbol_table::sized_write_globals): Likewise.
15285         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
15286         Call Object::is_in_system_directory.
15287         * symtab.h (class Symbol_table): Update declarations.
15288
15289         PR 5990
15290         * descriptors.h (Open_descriptor): Add is_on_stack field.
15291         * descriptors.cc (Descriptors::open): If the descriptor is on the
15292         top of the stack, remove it.  Initialize is_on_stack field.
15293         (Descriptors::release): Only add pod to stack if it is not on the
15294         stack already.
15295         (Descriptors::close_some_descriptor): Clear stack_next and
15296         is_on_stack fields.
15297
15298         PR 7091
15299         * output.cc (Output_section::find_starting_output_address): Rename
15300         from starting_output_address; add PADDR parameter; change return
15301         type.
15302         * output.h (class Output_section): Declare
15303         find_starting_output_address instead of starting_output_address.
15304         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
15305         section symbol for which we can't find a merge section.
15306
15307         PR 9836
15308         * symtab.cc (Symbol_table::add_from_object): If the visibility is
15309         hidden or internal, force the symbol to be local.
15310         * resolve.cc (Symbol::override_visibility): Define.
15311         (Symbol::override_base): Use override_visibility.
15312         (Symbol_table::resolve): Likewise.
15313         (Symbol::override_base_with_special): Likewise.
15314         (Symbol_table::override_with_special): If the visibility is hidden
15315         or internal, force the symbol to be local.
15316         * symtab.h (class Symbol): Add set_visibility and
15317         override_visibility.
15318         * testsuite/ver_test_1.sh: New file.
15319         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
15320         (check_DATA): Add ver_test_1.syms.
15321         (ver_test_1.syms): New target.
15322         * testsuite/Makefile.in: Rebuild.
15323
15324 2009-02-25  Cary Coutant  <ccoutant@google.com>
15325
15326         * layout.cc (Layout::choose_output_section): Don't rename sections
15327         when using a linker script that has a SECTIONS clause.
15328         * Makefile.in: Regenerate.
15329
15330         * testsuite/Makefile.am (script_test_5.sh): New test case.
15331         * testsuite/Makefile.in: Regenerate.
15332         * testsuite/script_test_5.cc: New file.
15333         * testsuite/script_test_5.sh: New file.
15334         * testsuite/script_test_5.t: New file.
15335
15336 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
15337
15338         * archive.cc (Archive::include_member): Update calls to add_symbols.
15339         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
15340         the Layout argument.
15341         * dynobj.h (do_add_symbols): Add the Layout argument.
15342         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
15343         Layout argument.
15344         * object.h (Object::add_symbols): Add the Layout argument.
15345         (Object::do_add_symbols): Add the Layout argument.
15346         (Sized_relobj::do_add_symbols): Add the Layout argument.
15347         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
15348         Unify the two versions.
15349         (Add_plugin_symbols): Remove.
15350         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
15351         (Sized_pluginobj::do_add_symbols): Unify the two versions.
15352         (Add_plugin_symbols): Remove.
15353         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
15354         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
15355         (Add_symbols::run): Make it work with Pulginobj.
15356
15357 2009-02-06  Ian Lance Taylor  <iant@google.com>
15358
15359         * object.cc (Sized_relobj::do_layout): Make info message start
15360         with lower case letter.
15361
15362 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
15363
15364         * binary.cc: Fix file comment.
15365
15366         * options.h (enum Incremental_disposition): Define.
15367         (class General_options): Add new options: --incremental,
15368         --incremental_changed, --incremental_unchanged,
15369         --incremental_unknown.  Add incremental_disposition_ and
15370         implicit_incremental_ fields.
15371         (General_options::incremental_disposition): New function.
15372         (class Position_dependent_options): Add incremental_disposition
15373         option.
15374         (Position_dependent_options::copy_from_options): Set incremental
15375         dispositions.
15376         * options.cc (General_options::parse_incremental_changed): New
15377         function.
15378         (General_options::parse_incremental_unchanged): New function.
15379         (General_options::parse_incremental_unknown): New function.
15380         (General_options::General_options): Initialize new fields
15381         incremental_disposition_ and implicit_incremental_.
15382         (General_options::finalize): Check for uasge of --incremental-*
15383         without --incremental.
15384
15385 2009-02-06  Chris Demetriou  <cgd@google.com>
15386
15387         * gold.h (gold_undefined_symbol): Change to take only a Symbol
15388         pointer and to report location as the file name associated with
15389         the symbol.
15390         (gold_undefined_symbol_at_location): New function to replace the
15391         old gold_undefined_symbol functionality.
15392         * target-reloc.h (relocate_section): Update to use
15393         gold_undefined_symbol_at_location.
15394         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15395         Call gold_undefined_symbol function rather than gold_error.
15396         * errors.h (Errors::undefined_symbol): Take location as a
15397         string, rather than calculating it from a relocation.
15398         * errors.cc (Errors::fatal): Print "fatal error:" before the
15399         formatted message.
15400         (Errors::error, Errors::error_at_location): Print "error: "
15401         before the formatted message.
15402         (Errors::undefined_symbol): Take location as a string, rather
15403         than calculating it from a relocation.
15404         (gold_undefined_symbol_at_location): New function akin to
15405         old gold_undefined_symbol, calculates location from relocation.
15406         (gold_undefined_symbol): Change to take only a Symbol pointer
15407         and to report location as the file name associated with the symbol.
15408         * testsuite/debug_msg.sh: Update for changed error messages.
15409         * testsuite/undef_symbol.sh: Likewise.
15410
15411 2009-02-04  Duncan Sands  <baldrick@free.fr>
15412
15413         PR 9812
15414         * reduced_debug_output.h
15415         (Output_reduced_debug_abbrev_section::failed): Use format for
15416         gold_warning.
15417         (Output_reduced_debug_info_section::faild): Likewise.
15418
15419 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
15420
15421         * script.cc (Lazy_demangler): New class.
15422         (Version_script_info::get_symbol_version_helper): Demangle a
15423         symbol only once.
15424
15425 2009-01-29  Cary Coutant  <ccoutant@google.com>
15426
15427         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
15428         to __tls_get_addr.
15429         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15430
15431 2009-01-28  Ian Lance Taylor  <iant@google.com>
15432
15433         * version.cc (version_string): Bump to 1.9.
15434
15435         * gold.h: Include <cstring> and <stdint.h>.
15436         * version.cc: Include <cstdio>.
15437         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
15438         warning.
15439         * reduced_debug_output.cc (insert_into_vector): Rename from
15440         Insert_into_vector; change all callers.  Use Swap_unaligned to
15441         avoid aliasing issue; remove union since it is unnecessary.
15442
15443 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
15444
15445         * Makefile.am (CCFILES): Add gc.cc.
15446         (HFILES): Add gc.h.
15447         * Makefile.in: Regenerate.
15448         * gold.cc (Gc_runner): New class.
15449         (queue_initial_tasks): Call garbage collection related tasks
15450         when corresponding options are invoked.
15451         (queue_middle_gc_tasks): New function.
15452         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
15453         processed early before laying out sections during garbage collection.
15454         * gold.h (queue_middle_gc_tasks): New function.
15455         (is_prefix_of): Move from "layout.cc".
15456         * i386.cc (Target_i386::gc_process_relocs): New function.
15457         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
15458         * main.cc (main): Create object of class "Garbage_collection".
15459         * object.cc (Relobj::copy_symbols_data): New function.
15460         (Relobj::is_section_name_included): New function.
15461         (Sized_relobj::do_layout): Allow this function to be called twice
15462         during garbage collection and defer layout of section during the
15463         first call.
15464         * object.h (Relobj::get_symbols_data): New function.
15465         (Relobj::is_section_name_included): New function.
15466         (Relobj::copy_symbols_data): New function.
15467         (Relobj::set_symbols_data): New function.
15468         (Relobj::get_relocs_data): New function.
15469         (Relobj::set_relocs_data): New function.
15470         (Relobj::is_output_section_offset_invalid): New pure virtual function.
15471         (Relobj::gc_process_relocs): New function.
15472         (Relobj::do_gc_process_relocs): New pure virtual function.
15473         (Relobj::sd_): New data member.
15474         (Sized_relobj::is_output_section_offset_invalid): New function.
15475         (Sized_relobj::do_gc_process_relocs): New function.
15476         * options.h (General_options::gc_sections): Modify to not be a no-op.
15477         (General_options::print_gc_sections): New option.
15478         * plugin.cc (Plugin_finish::run): Remove function call to
15479         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
15480         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
15481         * reloc.cc (Read_relocs::run): Add task to process relocs and
15482         determine unreferenced sections when doing garbage collection.
15483         (Gc_process_relocs): New class.
15484         (Sized_relobj::do_gc_process_relocs): New function.
15485         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
15486         sections that are garbage collected.
15487         * reloc.h (Gc_process_relocs): New class.
15488         * sparc.cc (Target_sparc::gc_process_relocs): New function.
15489         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
15490         symbols whose corresponding sections are garbage collected.
15491         (Symbol_table::Symbol_table): Add new parameter for the garbage
15492         collection object.
15493         (Symbol_table::gc_mark_undef_symbols): New function.
15494         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15495         (Symbol_table::gc_mark_dyn_syms): New function.
15496         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
15497         as garbage.
15498         (Symbol_table::add_from_object): Likewise.
15499         (Symbol_table::add_from_relobj): When building shared objects, do not
15500         treat externally visible symbols as garbage.
15501         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
15502         table information for static and relocatable links.
15503         * symtab.h (Symbol_table::set_gc): New function.
15504         (Symbol_table::gc): New function.
15505         (Symbol_table::gc_mark_undef_symbols): New function.
15506         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15507         (Symbol_table::gc_mark_dyn_syms): New function.
15508         (Symbol_table::gc_): New data member.
15509         * target.h (Sized_target::gc_process_relocs): New pure virtual
15510         function.
15511         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
15512         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
15513
15514 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
15515
15516         * options.h (General_options::gc_sections): Define as a no-op for now.
15517         (General_options::no_keep_memory): Ditto.
15518         (General_options::Bshareable): Define.
15519         * options.cc (General_options::finalize): Honor -Bshareable.
15520
15521 2009-01-20  Andreas Schwab  <schwab@suse.de>
15522
15523         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
15524         read the value in the contents, since we don't use it.  Use the
15525         template endianness when writing.
15526         (Relocate::relocate): Use it for R_PPC_REL16_HA.
15527
15528 2009-01-19  Andreas Schwab  <schwab@suse.de>
15529
15530         * configure.tgt (powerpc64-*): Fix targ_obj.
15531
15532 2009-01-15  Ian Lance Taylor  <iant@google.com>
15533
15534         * object.cc (Sized_relobj::write_local_symbols): Don't write out
15535         local symbols when stripping all symbols.
15536
15537 2009-01-14  Cary Coutant  <ccoutant@google.com>
15538
15539         * output.cc (Output_reloc): Add explicit instantiations.
15540
15541 2009-01-14  Cary Coutant  <ccoutant@google.com>
15542
15543         * archive.cc (Archive::get_elf_object_for_member): Remove call
15544         to File_read::claim_for_plugin.
15545         * descriptors.cc (Descriptors::open): Remove reference to
15546         is_claimed.
15547         (Descriptors::claim_for_plugin): Remove.
15548         * descriptors.h (Descriptors::claim_for_plugin): Remove.
15549         (Descriptors::is_claimed): Remove.
15550         (claim_descriptor_for_plugin): Remove.
15551         * fileread.cc (File_read::claim_for_plugin): Remove.
15552         * fileread.h (File_read::claim_for_plugin): Remove.
15553         (File_read::descriptor): Reopen descriptor if necessary.
15554         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
15555         (Plugin_manager::all_symbols_read): Add task parameter. Change
15556         all callers.
15557         (Plugin_manager::get_input_file): New function.
15558         (Plugin_manager::release_input_file): New function.
15559         (Pluginobj::Pluginobj): Add filesize parameter and initialize
15560         corresponding data member.
15561         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
15562         and pass to base constructor. Change all callers.
15563         (get_input_file, release_input_file): New functions.
15564         (make_sized_plugin_object): Add filesize parameter. Change all callers.
15565         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
15566         (Plugin_manager::all_symbols_read): Add task parameter.
15567         (Plugin_manager::get_input_file): New function.
15568         (Plugin_manager::release_input_file): New function.
15569         (Plugin_manager::task_): New data member.
15570         (Pluginobj::Pluginobj): Add filesize parameter.
15571         (Pluginobj::filename): New function.
15572         (Pluginobj::descriptor): New function.
15573         (Pluginobj::filesize): New function.
15574         (Pluginobj::filesize_): New data member.
15575         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
15576         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
15577         File_read::claim_for_plugin; use Object::unlock to unlock the file.
15578
15579         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
15580         with archive libraries.
15581         * testsuite/Makefile.in: Regenerate.
15582         * testsuite/plugin_test.c (struct sym_info): New type.
15583         (get_input_file, release_input_file): New static variables.
15584         (onload): Capture new transfer vector entries.
15585         (claim_file_hook): Stop reading at end of file according to filesize.
15586         Factor out parsing of readelf output into separate function.
15587         (all_symbols_read_hook): Exercise get_input_file and release_input_file
15588         APIs and get the source file name from the symbol table.  Convert
15589         source file name to corresponding object file name.  Print info
15590         message when adding new input files.
15591         (parse_readelf_line): New function.
15592         * testsuite/plugin_test_1.sh: Add checks for new info messages.
15593         * testsuite/plugin_test_2.sh: Likewise.
15594         * testsuite/plugin_test_3.sh: Likewise.
15595         * testsuite/plugin_test_4.sh: New test case.
15596
15597 2009-01-07  Ian Lance Taylor  <iant@google.com>
15598
15599         * version.cc (version_string): Bump to 1.8.
15600
15601 2008-12-23  Cary Coutant  <ccoutant@google.com>
15602
15603         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
15604         * plugin.cc (Plugin_manager::finish): Rename as
15605         layout_deferred_objects.  Move cleanup to separate function.
15606         (Plugin_manager::cleanup): New function.
15607         (Plugin_finish::run): Call layout_deferred_objects and cleanup
15608         separately.
15609         * plugin.h (Plugin_manager::finish): Rename as
15610         layout_deferred_objects.
15611         (Plugin_manager::cleanup): New function.
15612         (Plugin_manager::cleanup_done): New field.
15613
15614 2008-12-23  Cary Coutant  <ccoutant@google.com>
15615
15616         * plugin.cc (is_visible_from_outside): New function.
15617         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
15618         so we don't return "IR only" status for exported symbols or -r links.
15619
15620         * testsuite/Makefile.am (plugin_test_3): New test case.
15621         * testsuite/Makefile.in: Regenerate.
15622         * testsuite/plugin_test_3.sh: New file.
15623
15624 2008-12-22  Cary Coutant  <ccoutant@google.com>
15625
15626         * object.cc (Sized_relobj::layout_section): New function.
15627         (Sized_relobj::do_layout): Defer layout of input sections until after
15628         plugin has provided replacement files.
15629         (Sized_relobj::do_layout_deferred_sections): New function.
15630         * object.h (Relobj::set_section_offset): Remove virtual keyword.
15631         (Relobj::layout_deferred_sections): New function.
15632         (Relobj::do_layout_deferred_sections): New function.
15633         (Sized_relobj::do_layout_deferred_sections): New function.
15634         (Sized_relobj::layout_section): New function.
15635         (Sized_relobj::Deferred_layout): New structure.
15636         (Sized_relobj::deferred_layout_): New field.
15637         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
15638         Change all callers.  Layout deferred sections.
15639         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
15640         references.
15641         (Plugin_hook::run): Move code from do_plugin_hook inline.
15642         (Plugin_hook::do_plugin_hook): Remove.
15643         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
15644         (Plugin_manager::finish): Renamed, was cleanup.
15645         (Plugin_manager::should_defer_layout): New function.
15646         (Plugin_manager::add_deferred_layout_object): New function.
15647         (Plugin_manager::Deferred_layout_list): New type.
15648         (Plugin_manager::deferred_layout_objects_): New field.
15649         (Plugin_hook::do_plugin_hook): Remove.
15650
15651 2008-12-17  Ian Lance Taylor  <iant@google.com>
15652
15653         * options.h (class General_options): Add --no case for
15654         --export-dynamic.
15655
15656 2008-12-16  Cary Coutant  <ccoutant@google.com>
15657
15658         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
15659         vector.
15660         (Plugin_manager::claim_file): Create plugin object even if
15661         plugin did not call the add_symbols callback.
15662         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
15663         asking for more symbols than were added.
15664         * testsuite/Makefile.am (plugin_test_1): Add test case with
15665         no global symbols.
15666         (empty.syms): New target.
15667         * testsuite/Makefile.in: Regenerate.
15668         * testsuite/plugin_test.c (claim_file_hook): Add new debug
15669         message. Don't call add_symbols if no globals.
15670         (all_symbols_read_hook): Don't provide replacement for empty
15671         claimed file.
15672
15673 2008-12-12  Ian Lance Taylor  <iant@google.com>
15674
15675         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
15676         r_type == 0 for a local symbol with r_sym == 0.
15677         (scan_relocatable_relocs): Pass r_sym to
15678         local_non_section_strategy.
15679         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
15680         r_sym parameter.
15681
15682         * configure.ac: Update test for TLS descriptors: they are
15683         supported as of glibc 2.9.
15684         * configure: Rebuild.
15685
15686 2008-12-11  Ian Lance Taylor  <iant@google.com>
15687
15688         PR 7091
15689         * target-reloc.h (Default_scan_relocatable_relocs): For each
15690         function, map r_type == 0 to RELOC_DISCARD.
15691
15692 2008-12-10  Cary Coutant  <ccoutant@google.com>
15693
15694         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
15695         object to override a kept COMDAT group from a plugin object.
15696
15697 2008-12-09  Ian Lance Taylor  <iant@google.com>
15698
15699         PR 7088
15700         * yyscript.y (file_cmd): Handle INPUT.
15701
15702         * testsuite/initpri1.c: Change all declarations to be full
15703         prototypes by adding void, to avoid compiler warnings.
15704
15705 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
15706
15707         * options.cc (General_options::parse_plugin_opt): New.
15708         (General_options::add_plugin): The argument now is just the filename.
15709         (General_options::add_plugin_option): New.
15710         * options.h (plugin_opt): New.
15711         (add_plugin): Change argument name.
15712         (add_plugin_option): New.
15713         * plugin.cc (Plugin::load): Don't parse the plugin option.
15714         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
15715         (Plugin::add_option): New.
15716         (Plugin::args_): Change type.
15717         (Plugin::filename_): New.
15718         (Plugin_manager::add_plugin_option): New.
15719         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
15720         * testsuite/Makefile.in: Regenerate.
15721
15722 2008-12-05  Cary Coutant  <ccoutant@google.com>
15723
15724         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
15725         Handle --strip-lto-sections option.
15726         * options.h (strip_lto_sections): New option.
15727
15728 2008-12-01  Cary Coutant  <ccoutant@google.com>
15729
15730         * plugin.cc (ld_plugin_message): Change format parameter to const.
15731         Fix mismatch between new[] and delete.
15732
15733 2008-11-14  Cary Coutant  <ccoutant@google.com>
15734
15735         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
15736         instead of -1U.
15737
15738 2008-11-05  Craig Silverstein  <csilvers@google.com>
15739
15740         * options.cc (General_options::parse_dynamic_list): New function.
15741         * options.h (General_options): New flags dynamic_list,
15742         dynamic_list_data, dynamic_list_cpp_new, and
15743         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
15744         (General_options::in_dynamic_list): New function.
15745         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
15746         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
15747         (Lex::can_continue_name): Likewise.
15748         (yylex): Likewise.
15749         (read_script_file): New parameter script_options.
15750         (read_dynamic_list): New function.
15751         (Script_options::define_dynamic_list): New function.
15752         (dynamic_list_keyword_parsecodes): New variable.
15753         (dynamic_list_keywords): New variable.
15754         * script.h (Script_options::define_dynamic_list): New function
15755         prototype.
15756         (read_dynamic_list): New function prototype.
15757         * symtab.cc (strprefix): New macro.
15758         (Symbol::should_add_dynsym_entry): Support dynamic_list,
15759         dynamic_list_data, dynamic_list_cpp_new, and
15760         dynamic_list_cpp_typeinfo.
15761         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
15762         (dynamic_list_expr): New rule.
15763         (dynamic_list_nodes): Likewise.
15764         (dynamic_list_node): Likewise.
15765         * testsuite/Makefile.am (dynamic_list): New test.
15766         * testsuite/Makefile.in: Regenerated.
15767         * testsuite/dynamic_list.t: New file.
15768         * testsuite/dynamic_list.sh: New file.
15769
15770 2008-11-05  Craig Silverstein  <csilvers@google.com>
15771
15772         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
15773         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
15774         (t11_last): Likewise.
15775         * testsuite/ver_test_6.c (main): Likewise.
15776
15777 2008-10-07  Cary Coutant  <ccoutant@google.com>
15778
15779         * options.c (General_options::finalize): Add check for -static and
15780         -shared.
15781         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
15782         is not empty.
15783
15784 2008-10-02  Cary Coutant  <ccoutant@google.com>
15785
15786         * plugin.cc (make_sized_plugin_object): Fix conditional
15787         compilation to work when not all targets are enabled.
15788
15789 2008-09-29  Cary Coutant  <ccoutant@google.com>
15790
15791         * archive.cc (Archive::get_file_and_offset): Use filename instead
15792         of name to get library path.
15793         (Archive::include_member): Unlock external member of a thin archive.
15794
15795         * testsuite/Makefile.am (TEST_AR): New variable.
15796         (thin_archive_test_1): New test.
15797         (thin_archive_test_2): New test.
15798         * testsuite/Makefile.in: Regenerate.
15799         * testsuite/thin_archive_main.cc: New file.
15800         * testsuite/thin_archive_test_1.cc: New file.
15801         * testsuite/thin_archive_test_2.cc: New file.
15802         * testsuite/thin_archive_test_3.cc: New file.
15803         * testsuite/thin_archive_test_4.cc: New file.
15804
15805 2008-09-29  Cary Coutant  <ccoutant@google.com>
15806
15807         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
15808         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
15809         instead of -1U.
15810         (Sized_relobj::do_finalize_local_symbols): Likewise.
15811         (Sized_relobj::map_to_kept_section): Likewise.
15812         * object.h (Sized_relobj::invalid_address): New constant.
15813         (Sized_relobj::do_output_section_offset): Check for invalid_address
15814         and return -1ULL.
15815         * output.cc (Output_reloc::local_section_offset): Use constant
15816         invalid_address instead of -1U.
15817         (Output_reloc::get_address): Likewise.
15818         (Output_section::output_address): Change -1U to -1ULL.
15819         * output.h (Output_reloc::invalid_address): New constant.
15820         * reloc.cc (Sized_relobj::write_sections): Use constant
15821         invalid_address instead of -1U.
15822         (Sized_relobj::relocate_sections): Likewise.
15823         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
15824         values for merge sections.
15825         * target-reloc.h (relocate_for_relocatable): Use constant
15826         invalid_address instead of -1U.
15827
15828 2008-09-19  Cary Coutant  <ccoutant@google.com>
15829
15830         Add plugin functionality for link-time optimization (LTO).
15831         * configure.ac (plugins): Add --enable-plugins option.
15832         * configure: Regenerate.
15833         * config.in: Regenerate.
15834         * Makefile.am (LIBDL): New variable.
15835         (CCFILES): Add plugin.cc.
15836         (HFILES): Add plugin.h.
15837         (ldadd_var): Add LIBDL.
15838         * Makefile.in: Regenerate.
15839
15840         * archive.cc: Include "plugin.h".
15841         (Archive::setup): Don't preread archive symbols when using a plugin.
15842         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
15843         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
15844         files.
15845         (Archive::include_member): Add symbols from plugin objects.
15846         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
15847         * descriptors.cc (Descriptors::open): Check for file descriptors
15848         abandoned by plugins.
15849         (Descriptors::claim_for_plugin): New function.
15850         * descriptors.h (Descriptors::claim_for_plugin): New function.
15851         (Open_descriptor::is_claimed): New field.
15852         (claim_descriptor_for_plugin): New function.
15853         * fileread.cc (File_read::claim_for_plugin): New function.
15854         * fileread.h (File_read::claim_for_plugin): New function.
15855         (File_read::descriptor): New function.
15856         * gold.cc: Include "plugin.h".
15857         (queue_initial_tasks): Add task to call plugin hooks for generating
15858         new object files.
15859         * main.cc: Include "plugin.h".
15860         (main): Load plugin libraries.
15861         * object.h (Pluginobj): Declare.
15862         (Object::pluginobj): New function.
15863         (Object::do_pluginobj): New function.
15864         (Object::set_target): New function.
15865         * options.cc: Include "plugin.h".
15866         (General_options::parse_plugin): New function.
15867         (General_options::General_options): Initialize plugins_ field.
15868         (General_options::add_plugin): New function.
15869         * options.h (Plugin_manager): Declare.
15870         (General_options): Add --plugin option.
15871         (General_options::has_plugins): New function.
15872         (General_options::plugins): New function.
15873         (General_options::add_plugin): New function.
15874         (General_options::plugins_): New field.
15875         * plugin.cc: New file.
15876         * plugin.h: New file.
15877         * readsyms.cc: Include "plugin.h".
15878         (Read_symbols::do_read_symbols): Check for archive before checking
15879         for ELF file.  Call plugin hooks to claim files.
15880         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
15881         from a real object file; force override when processing replacement
15882         files.
15883         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
15884         (Symbol::init_base_object): Likewise.
15885         (Symbol::init_base_output_data): Likewise.
15886         (Symbol::init_base_output_segment): Likewise.
15887         (Symbol::init_base_constant): Likewise.
15888         (Symbol::init_base_undefined): Likewise.
15889         (Symbol::output_section): Assert that object is not a plugin.
15890         (Symbol_table::add_from_pluginobj): New function.
15891         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15892         undefined.
15893         (Symbol_table::sized_write_globals): Likewise.
15894         (Symbol_table::add_from_pluginobj): Instantiate template.
15895         * symtab.h (Sized_pluginobj): Declare.
15896         (Symbol::in_real_elf): New function.
15897         (Symbol::set_in_real_elf): New function.
15898         (Symbol::in_real_elf_): New field.
15899         (Symbol_table::add_from_pluginobj): New function.
15900
15901         * testsuite/Makefile.am (AM_CFLAGS): New variable.
15902         (LIBDL): New variable.
15903         (LDADD): Add LIBDL.
15904         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
15905         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
15906         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
15907         (MOSTLYCLEANFILES): Likewise.
15908         * testsuite/Makefile.in: Regenerate.
15909         * testsuite/plugin_test.c: New file.
15910         * testsuite/plugin_test_1.sh: New file.
15911         * testsuite/plugin_test_2.sh: New file.
15912
15913 2008-09-16  Ian Lance Taylor  <iant@google.com>
15914
15915         * target-reloc.h (relocate_section): Check whether a symbol is
15916         defined by the ABI before reporting an undefined symbol error.
15917         * target.h (Target::is_defined_by_abi): Make parameter const.
15918         (Target::do_is_defined_by_abi): Likewise.
15919         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
15920         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
15921         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
15922         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
15923         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
15924         * testsuite/Makefile.in: Rebuild.
15925
15926         * fileread.cc (make_view): Add casts to avoid warning.
15927
15928 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15929
15930         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
15931         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15932
15933 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15934
15935         * options.h (General_options::output_is_executable): New.
15936         (General_options::output_is_pie): New.
15937         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
15938         for shared libraries.
15939         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15940
15941 2008-09-11  Chris Demetriou  <cgd@google.com>
15942
15943         * options.h (origin): New -z option.
15944         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
15945         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
15946         in DT_FLAGS_1.
15947
15948 2008-09-05  Cary Coutant  <ccoutant@google.com>
15949
15950         * fileread.cc (File_read::make_view): Add check for attempt to map
15951         beyond end of file.
15952
15953 2008-09-05  Cary Coutant  <ccoutant@google.com>
15954
15955         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
15956         explicit instantiations.
15957
15958 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
15959
15960         PR gold/6858
15961         * options.cc (General_options::finalize): Allow undefined symbols
15962         in shlibs if linking -shared.
15963
15964         PR gold/6859
15965         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
15966         symbols as not needing a dynsym entry.
15967
15968 2008-08-20  Craig Silverstein  <csilvers@google.com>
15969
15970         * fileread.cc (File_read::open): Do not lock the file unless it
15971         was successfully opened.
15972
15973 2008-08-14  Cary Coutant  <ccoutant@google.com>
15974
15975         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
15976         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
15977         * testsuite/tls_test.cc (struct int128): 128-bit struct
15978         for testing TLS relocs with non-zero addend.
15979         (v12): New TLS variable.
15980         (t12): New test.
15981         (t_last): Add check for v12.
15982         * testsuite/tls_test.h (t12): New function.
15983         * testsuite/tls_test_main.cc (thread_routine): Call new test.
15984
15985 2008-08-13  Ian Lance Taylor  <iant@google.com>
15986
15987         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
15988         set tls_segment_ or relro_segment_.
15989         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
15990         when appropriate.
15991         * output.h (Output_section::clear_is_relro): New function.
15992         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
15993         sections specially even when output_data_ is empty.
15994         (Output_segment::maximum_alignment): When first section is relro,
15995         only force alignment for PT_LOAD segments.
15996         * script.cc (script_data_segment_align): New function.
15997         (script_data_segment_relro_end): New function.
15998         * script-c.h (script_data_segment_align): Declare.
15999         (script_data_segment_relro_end): Declare.
16000         * script-sections.h (class Script_sections): Declare
16001         data_segment_align and data_segment_relro_end.  Add fields
16002         segment_align_index_ and saw_relro_end_.
16003         * script-sections.cc (class Sections_element): Add set_is_relro
16004         virtual function.  Add new bool* parameter to place_orphan_here.
16005         Add get_output_section virtual function.
16006         (class Output_section_definition): Add set_is_relro.  Add new
16007         bool* parameter to place_orphan_here.  Add get_output_section.
16008         Add is_relro_ field.
16009         (Output_section_definition::Output_section_definition): Initialize
16010         evaluated_address_, evaluated_load_address, evaluated_addralign_,
16011         and is_relro_ fields.
16012         (Output_section_definition::place_orphan_here): Add is_relro
16013         parameter.
16014         (Output_section_definition::set_section_addresses): Set relro for
16015         output section.
16016         (Output_section_definition::alternate_constraint): Likewise.
16017         (class Orphan_output_section): Add new bool* parameter to
16018         place_orphan_here.  Add get_output_section.
16019         (Orphan_output_section::place_orphan_here): Add is_relro
16020         parameter.
16021         (Script_sections::Script_sections): Initialize
16022         data_segment_align_index_ and saw_relro_end_.
16023         (Script_sections::data_segment_align): New function.
16024         (Script_sections::data_segment_relro_end): New function.
16025         (Script_sections::place_orphan): Set or clear is_relro.
16026         (Script_sections::set_section_addresses): Force alignment of first
16027         TLS section.
16028         * yyscript.y (exp): Call script_data_segment_align and
16029         script_data_segment_relro_end.
16030         * testsuite/relro_script_test.t: New file.
16031         * testsuite/relro_test.cc (using_script): Declare.
16032         (t1, t2): Test using_script.
16033         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
16034         (relro_script_test_SOURCES): Define.
16035         (relro_script_test_DEPENDENCIES): Define.
16036         (relro_script_test_LDFLAGS): Define.
16037         (relro_script_test_LDADD): Define.
16038         (relro_script_test.so): New target.
16039         * testsuite/Makefile.in: Rebuild.
16040
16041 2008-08-06  Cary Coutant <ccoutant@google.com>
16042
16043         * archive.cc (Archive::total_archives, Archive::total_members)
16044         (Archive::total_members_loaded): New variables.
16045         (Archive::setup): Add parameter.  Add option to preread
16046         archive symbols.
16047         (Archive::read_armap): Add counter.
16048         (Archive::get_file_and_offset): New function.
16049         (Archive::get_elf_object_for_member): New function.
16050         (Archive::read_all_symbols): New function.
16051         (Archive::read_symbols): New function.
16052         (Archive::add_symbols): Add counters.
16053         (Archive::include_all_members): Use armap to find members if it's
16054         already built.
16055         (Archive::include_member): Skip reading symbols if already read.
16056         Factored code into Archive::get_file_and_offset and
16057         Archive::get_elf_object_for_member.  Changed call to
16058         Mapfile::report_include_archive_member.
16059         (Archive::print_stats): New function.
16060         * archive.h: Declare Object and Read_symbols_data classes.
16061         (Archive::Archive): Add initializers for new members.
16062         (Archive::setup): Add parameter.
16063         (Archive::print_stats): New function.
16064         (Archive::total_archives, Archive::total_members)
16065         (Archive::total_members_loaded): New variables.
16066         (Archive::get_file_and_offset): New function.
16067         (Archive::get_elf_object_for_member): New function.
16068         (Archive::read_all_symbols): New function.
16069         (Archive::read_symbols): New function.
16070         (Archive::Archive_member): New class.
16071         (Archive::members_): New member.
16072         (Archive::num_members_): New member.
16073         * main.cc: Include archive.h.
16074         (main): Call Archive::print_stats.
16075         * mapfile.cc (Mapfile::report_include_archive_member): Delete
16076         archive parameter; member_name is now the fully-decorated name.
16077         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
16078         * options.h: (General_options): Add --preread-archive-symbols option.
16079         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
16080         Archive::setup.
16081
16082 2008-08-04  Ian Lance Taylor  <iant@google.com>
16083
16084         * symtab.h (Symbol::use_plt_offset): New function.
16085         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
16086         * powerpc.cc (Relocate::relocate): Likewise.
16087         * sparc.cc (Relocate::relocate): Likewise.
16088         * x86_64.cc (Relocate::relocate): Likewise.
16089         * testsuite/weak_plt.sh: New test.
16090         * testsuite/weak_plt_main.cc: New test.
16091         * testsuite/weak_plt_shared.cc: New test.
16092         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
16093         (check_PROGRAMS): Add weak_plt.
16094         (check_DATA): Add weak_plt_shared.so.
16095         (weak_plt_main_pic.o, weak_plt): New targets.
16096         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
16097         * testsuite/Makefile.in: Rebuild.
16098
16099         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
16100         gcctestdir/ld.
16101         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
16102         * testsuite/Makefile.in: Rebuild.
16103
16104 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
16105
16106         * Makefile.am (POTFILES.in): Set LC_ALL=C.
16107         * Makefile.in: Regenerate.
16108         * po/POTFILES.in: Regenerate.
16109
16110 2008-07-29  Ian Lance Taylor  <iant@google.com>
16111
16112         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
16113         symbols before other symbols.
16114         * testsuite/script_test_2.cc (test_addr): Declare.
16115         (test_addr_alias): Declare.
16116         (main): Check that test_addr and test_addr_alias have the right
16117         values.
16118         * testsuite/script_test_2.t: Define test_addr_alias and
16119         test_addr.
16120
16121 2008-07-24  Ian Lance Taylor  <iant@google.com>
16122
16123         PR 5990
16124         * descriptors.cc: New file.
16125         * descriptors.h: New file.
16126         * gold-threads.h (class Hold_optional_lock): New class.
16127         * fileread.cc: Include "descriptors.h".
16128         (File_read::~File_read): Release descriptor rather than closing
16129         it.
16130         (File_read::open) [file]: Call open_descriptor rather than open.
16131         Set is_descriptor_opened_.
16132         (File_read::open) [memory]: Assert that descriptor is not open.
16133         (File_read::reopen_descriptor): New function.
16134         (File_read::release): Release descriptor.
16135         (File_read::do_read): Make non-const.  Reopen descriptor.
16136         (File_read::read): Make non-const.
16137         (File_read::make_view): Reopen descriptor.
16138         (File_read::do_readv): Likewise.
16139         * fileread.h (class File_read): Add is_descriptor_opened_ field.
16140         Update declarations.
16141         * layout.cc: Include "descriptors.h".
16142         (Layout::create_build_id): Use open_descriptor rather than open.
16143         * output.cc: Include "descriptors.h".
16144         (Output_file::open): Use open_descriptor rather than open.
16145         * archive.cc (Archive::const_iterator): Change Archive to be
16146         non-const.
16147         (Archive::begin, Archive::end): Make non-const.
16148         (Archive::count_members): Likewise.
16149         * archive.h (class Archive): Update declarations.
16150         * object.h (Object::read): Make non-const.
16151         * Makefile.am (CCFILES): Add descriptors.cc.
16152         (HFILES): Add descriptors.h.
16153         * Makefile.in: Rebuild.
16154
16155         PR 6716
16156         * gold.h: Always include <clocale>.  Add Solaris workarounds
16157         following code in binutils/sysdep.h.
16158
16159         PR 6048
16160         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
16161         this->eh_frame_hdr_ is NULL before using it.
16162
16163         * dynobj.cc (Versions::Versions): Update comment.
16164
16165         * dynobj.cc (Versions::Versions): If there is an soname, use it as
16166         the base version name.
16167
16168         * stringpool.cc (Stringpool_template::add_with_length): Set key to
16169         array size plus one.
16170         (Stringpool_template::set_string_offsets): Subtract one from key
16171         before using it as an array index.
16172         (Stringpool_template::get_offset_with_length): Likewise.
16173         (Stringpool_template::write_to_buffer): Likewise.
16174         * stringpool.h (Stringpool_template::get_offset_from_key):
16175         Likewise.
16176
16177 2008-07-23  Ian Lance Taylor  <iant@google.com>
16178
16179         PR 6658
16180         * object.h (Merged_symbol_value::value): Do our best to handle a
16181         negative addend.
16182
16183         PR 6647
16184         * script.cc (Version_script_info::get_versions): Don't add empty
16185         version tag to return value.
16186         (Version_script_info::get_symbol_version_helper): Change return
16187         type to bool.  Add pversion parameter.  Change all callers.
16188         (script_register_vers_node): Don't require a non-NULL tag.
16189         * script.h (class Version_script_info): Update declarations.
16190         (Version_script_info::get_symbol_version): Change return type to
16191         bool.  Add version parameter.  Change all callers.
16192         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
16193         handling.  Handle an empty version from a version script.
16194         (Symbol_table::define_special_symbol): Likewise.
16195         * testsuite/ver_test_10.script: New file.
16196         * testsuite/ver_test_10.sh: New file.
16197         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
16198         (check_DATA): Add ver_test_10.syms.
16199         (ver_test_10.syms, ver_test_10.so): New target.
16200         * testsuite/Makefile.in: Rebuild.
16201
16202 2008-07-23  Simon Baldwin  <simonb@google.com>
16203
16204         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
16205         to zero for undefined symbols from dynamic libraries.
16206
16207 2008-07-23  Ian Lance Taylor  <iant@google.com>
16208
16209         * symtab.cc (Symbol_table::resolve): Remove version parameter.
16210         Change all callers.
16211         * symtab.h (class Symbol_table): Update declaration.
16212         * testsuite/ver_test_9.cc: New file.
16213         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
16214         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
16215         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
16216         (ver_test_9.so, ver_test_9.o): New targets.
16217         * testsuite/Makefile.in: Rebuild.
16218
16219 2008-07-22  Ian Lance Taylor  <iant@google.com>
16220
16221         * options.h (class General_options): Define --check-sections.
16222         * layout.cc (Layout::set_segment_offsets): Handle
16223         --check-sections.
16224
16225         * options.h (class General_options): Define -n/--nmagic and
16226         -N/--omagic.
16227         * options.cc (General_options::finalize): For -n/--nmagic or
16228         -N/--omagic, set -static.
16229         * layout.cc (Layout::attach_allocated_section_to_segment): If
16230         -N/--omagic, don't put read-only and read-write sections in
16231         different segments.
16232         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
16233         finding a read-only segment.
16234         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
16235         don't set the minimum segment alignment to the common page size,
16236         and don't set the file offset to the address modulo the page size.
16237         * script-sections.cc (Script_sections::create_segments): If
16238         -n/--omagic, don't put read-only and read-write sections in
16239         different segments.
16240
16241         * cref.cc: New file.
16242         * cref.h: New file.
16243         * options.h (class General_options): Add --print-symbol-counts.
16244         * main.cc (main): Issue defined symbol report if requested.
16245         * archive.cc (Archive::interpret_header): Make into a const member
16246         function.
16247         (Archive::add_symbols): Call Input_objects::archive_start and
16248         archive_stop.
16249         (Archive::const_iterator): Define new class.
16250         (Archive::begin, Archive::end): New functions.
16251         (Archive::include_all_members): Rewrite to use iterator.
16252         (Archive::count_members): New function.
16253         * archive.h (class Archive): Update declarations.
16254         (Archive::filename): New function.
16255         * object.cc: Include "cref.h".
16256         (Sized_relobj::Sized_relobj): Initialize defined_count_.
16257         (Sized_relobj::do_get_global_symbol_counts): New function.
16258         (Input_objects::add_object): Add object to cross-referencer.
16259         (Input_objects::archive_start): New function.
16260         (Input_objects::archive_stop): New function.
16261         (Input_objects::print_symbol_counts): New function.
16262         * object.h: Declare Cref and Archive.
16263         (Object::get_global_symbol_counts): New function.
16264         (Object::do_get_global_symbol_counts): New pure virtual function.
16265         (class Sized_relobj): Add defined_count_ field.  Update
16266         declarations.
16267         (class Input_objects): Add cref_ field.  Update constructor.
16268         Update declarations.
16269         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
16270         defined_count_.
16271         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
16272         symbol counts.
16273         (Sized_dynobj::do_get_global_symbol_counts): New function.
16274         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
16275         defined_count_.  Update declarations.  Define Symbols typedef.
16276         * symtab.cc (Symbol_table::add_from_relobj): Add defined
16277         parameter.  Change all callers.
16278         (Symbol_table::add_from_dynobj): Add sympointers and defined
16279         parameters.  Change all callers.
16280         * symtab.h (class Symbol_table): Update declarations.
16281         * Makefile.am (CCFILES): Add cref.cc.
16282         (HFILES): Add cref.h.
16283         * Makefile.in: Rebuild.
16284
16285 2008-07-22  Simon Baldwin  <simonb@google.com>
16286
16287         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
16288         to zero when writing undefined symbols.
16289
16290 2008-07-22  Ian Lance Taylor  <iant@google.com>
16291
16292         * output.cc (Output_section::add_input_section): Don't try to
16293         merge empty merge sections.
16294
16295 2008-07-21  Craig Silverstein  <csilvers@google.com>
16296
16297         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
16298         Include symbol version in error message.
16299
16300 2008-07-20  Chris Demetriou  <cgd@google.com>
16301
16302         * configure.ac (gold_cv_c_random_seed): New configured variable.
16303         (RANDOM_SEED_CFLAGS): New substituted variable.
16304         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
16305         * configure: Rebuild.
16306         * Makefile.in: Likewise.
16307         * testsuite/Makefile.in: Likewise.
16308
16309 2008-07-18  Ian Lance Taylor  <iant@google.com>
16310
16311         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
16312         where we see NAME/NULL and NAME/VERSION  as separate symbols.
16313         * testsuite/ver_test_main.cc (main): Call t4.
16314         (t4, t4_2a): Define.
16315         * testsuite/ver_test_2.cc (t4_2): Define.
16316         * testsuite/ver_test_2.script: Put t4_2a in VER2.
16317         * testsuite/ver_test_4.cc (t4_2a): Define.
16318         * testsuite/ver_test_4.script: Put t4_2a in VER2.
16319         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
16320
16321 2008-07-17  Ian Lance Taylor  <iant@google.com>
16322
16323         * dynobj.cc (Versions::add_def): If we give an error about a
16324         missing version, go ahead and create the version anyhow.
16325
16326 2008-07-10  Ian Lance Taylor  <iant@google.com>
16327
16328         Handle output sections with more than 0x7fffffff bytes.
16329         * object.h (class Relobj): Change map_to_output_ to
16330         output_sections_, and just keep a section pointer.  Change all
16331         uses.  Move comdat group support to Sized_relobj.
16332         (Relobj::is_section_specially_mapped): Remove.
16333         (Relobj::output_section): Remove poff parameter.  Change all
16334         callers.
16335         (Relobj::output_section_offset): New function.
16336         (Relobj::set_section_offset): Rewrite.
16337         (Relobj::map_to_output): Remove.
16338         (Relobj::output_sections): New function.
16339         (Relobj::do_output_section_offset): New pure virtual function.
16340         (Relobj::do_set_section_offset): Likewise.
16341         (class Sized_relobj): Add section_offsets_ field.  Add comdat
16342         group support from Relobj.  Update declarations.
16343         (Sized_relobj::get_output_section_offset): New function.
16344         (Sized_relobj::do_output_section_offset): New function.
16345         (Sized_relobj::do_set_section_offset): New function.
16346         * object.cc (Relobj::output_section_address): Remove.
16347         (Sized_relobj::Sized_relobj): Initialize new fields.
16348         (Sized_relobj::include_section_group): Cast find_kept_object to
16349         Sized_relobj.
16350         (Sized_relobj::include_linkonce_section): Likewise.
16351         (Sized_relobj::do_layout): Use separate arrays for output section
16352         and output offset.
16353         (Sized_relobj::do_count_local_symbols): Change map_to_output to
16354         output_sections.
16355         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
16356         output_sections and section_offsets.
16357         (Sized_relobj::write_local_symbols): Likewise.
16358         (map_to_kept_section): Compute output address directly.
16359         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
16360         output_sections and section_offsets.
16361         (Sized_relobj::write_sections): Likewise.
16362         (Sized_relobj::relocate_sections): Likewise.
16363         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
16364         * output.h (class Output_reloc): Update declarations.  Change
16365         u2_.relobj to Sized_relobj*.
16366         (class Output_data_reloc): Change add functions to use
16367         Sized_relobj*.
16368         * output.cc (Output_reloc::Output_reloc): Change relobj to
16369         Sized_relobj*.
16370         (Output_reloc::local_section_offset): Change return type to
16371         Elf_Addr.  Use get_output_section_offset.
16372         (Output_reloc::get_address): Likewise.
16373         (Output_section::is_input_address_mapped): Don't call
16374         is_section_specially_mapped.
16375         (Output_section::output_offset): Likewise.
16376         (Output_section::output_address): Likewise.
16377         (Output_section::starting_output_address): Likewise.
16378         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
16379         parameter to Sized_relobj*.
16380         (Copy_relocs::need_copy_reloc): Likewise.
16381         (Copy_relocs::save): Likewise.
16382         * copy-relocs.h (class Copy_relocs): Update declarations.
16383         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
16384         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
16385         * target-reloc.h (relocate_for_relocatable): Change
16386         offset_in_output_section type to Elf_Addr.  Change code that uses
16387         it as well.
16388         * layout.cc (Layout::layout): Always set *off.
16389         * mapfile.cc (Mapfile::print_input_section): Use
16390         output_section_offset.
16391         * i386.cc (Target_i386::copy_reloc): Change object parameter to
16392         Sized_relobj*.
16393         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
16394         * sparc.cc (Target_sparc::copy_reloc): Likewise.
16395         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
16396
16397 2008-07-03  Ian Lance Taylor  <iant@google.com>
16398
16399         * layout.cc (Layout::include_section): Do not discard unrecognized
16400         SHT_STRTAB sections.
16401
16402 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
16403
16404         * script.cc (Lex::can_continue_name): Make '?' allowable in
16405         version-script names.
16406         * testsuite/version_script.map: Change glob pattern to use '?'
16407
16408 2008-06-30  Manish Singh  <yosh@gimp.org>
16409
16410         PR 6585
16411         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
16412         Correct typo.
16413
16414 2008-06-30  Ian Lance Taylor  <iant@google.com>
16415
16416         PR 6660
16417         PR 6682
16418         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
16419         versions]: Don't try to read the value in the contents, since we
16420         don't use it.  Use the template endianness when writing.
16421
16422 2008-06-25  Cary Coutant  <ccoutant@google.com>
16423
16424         * fileread.cc (File_read::make_view): Assert on zero-length view.
16425         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
16426         symbol table when there are no symbols to read.
16427
16428 2008-06-23  Craig Silverstein  <csilvers@google.com>
16429
16430         * version.cc (version_string): Bump to 1.7
16431
16432 2008-06-18  Craig Silverstein  <csilvers@google.com>
16433
16434         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
16435         constant 0xFFFF to type Valtype.
16436         (Powerpc_relocate_functions::rel16_ha): Likewise.
16437
16438 2008-06-17  Ian Lance Taylor  <iant@google.com>
16439
16440         * output.h (Output_section::Input_section): Initialize p2align_ to
16441         zero for Output_section_data constructors.
16442         (Output_section::Input_section::addralign): If not an input
16443         section, return the alignment of the Output_section_data.
16444         * testsuite/copy_test.cc: New file.
16445         * testsuite/copy_test_1.cc: New file.
16446         * testsuite/copy_test_2.cc: New file.
16447         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
16448         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
16449         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
16450         (copy_test_1_pic.o, copy_test_1.so): New targets.
16451         (copy_test_2_pic.o, copy_test_2.so): New targets.
16452         * testsuite/Makefile.in: Rebuild.
16453
16454         * script-sections.cc (Script_sections::place_orphan): Initialize
16455         local variable exact.
16456
16457 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
16458
16459         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
16460
16461 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
16462             David S. Miller  <davem@davemloft.net>
16463
16464         * powerpc.cc: New file.
16465         * Makefile.am (TARGETSOURCES): Add powerpc.cc
16466         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
16467         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
16468         * Makefile.in: Rebuild.
16469
16470 2008-06-09  Ian Lance Taylor  <iant@google.com>
16471
16472         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
16473         <exception>.
16474         (throwing, orig_terminate): New static variables.
16475         (terminate_handler): New static function.
16476         (t2): Set terminate handler.
16477
16478 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
16479
16480         PR 6584
16481         * binary.cc (Binary_to_elf::sized_convert): Fix .data
16482         alignment.
16483
16484 2008-05-30  Cary Coutant  <ccoutant@google.com>
16485
16486         * archive.cc (Archive::include_all_members) Correct to step
16487         over symbol table and extended name table in thin archives.
16488
16489 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
16490
16491         PR 6407
16492         * target-reloc.h (relocate_for_relocatable): Fix new_offset
16493         calculation.
16494
16495 2008-05-28  Caleb Howe  <cshowe@google.com>
16496
16497         * reduced_debug_output.cc: New file.
16498         * reduced_debug_output.h: New file.
16499         * options.h (class General_options): Add --strip-debug-non-line.
16500         * options.cc (General_options::finalize): Add strip_debug_non_line
16501         to the strip heirarchy.
16502         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
16503         fields.
16504         * layout.cc: Include "reduced_debug_output.h".
16505         (Layout::Layout): Initialize new fields.
16506         (line_only_debug_sections): New static array.
16507         (is_lines_only_debug_sections): New static inline function.
16508         (Layout::include_section): Handle --strip-debug-non-line.
16509         (Layout::make_output_section): If --strip-debug-non-line, build
16510         new output sections for .debug_abbrev and .debug_info.
16511         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
16512         gold.  Warn about possible overflow.
16513         (read_signed_LEB_128): Likewise.
16514         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
16515         (read_signed_LEB_128): Declare.
16516         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
16517         (HFILES): Add reduced_debug_output.h.
16518         * Makefile.in: Rebuild.
16519
16520 2008-05-21  Ian Lance Taylor  <iant@google.com>
16521
16522         * mapfile.cc: New file.
16523         * mapfile.h: New file.
16524         * options.h (class General_options): Add -M/--print-map and -Map.
16525         * options.cc (General_options::finalize): Make -M equivalent to
16526         -Map -.
16527         * main.cc: Include <cstdio> and "mapfile.h".
16528         (main): Open mapfile if requested.
16529         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
16530         constructor.  Change caller.
16531         (queue_initial_tasks): Add mapfile parameter.  Change caller.
16532         (queue_middle_tasks): Likewise.
16533         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
16534         declarations.
16535         * archive.cc: Include "mapfile.h".
16536         (Archive::add_symbols): Add mapfile parameter.  Change all
16537         callers.  Pass mapfile, symbol, and reason to include_member.
16538         (Archive::include_all_members): Add mapfile parameter.  Change all
16539         callers.
16540         (Archive::include_member): Add mapfile, sym, and why parameters.
16541         Change all callers.  Report inclusion to map file.
16542         * archive.h: Include "fileread.h".
16543         (class Archive): Update declarations.
16544         (Archive::file): New const method.
16545         (class Add_archive_symbols): Add mapfile_ field.  Update
16546         constructor.  Change all callers.
16547         * readsyms.h (class Read_symbols): Likewise.
16548         (class Finish_group): Likewise.
16549         (class Read_script): Likewise.
16550         * common.cc: Include "mapfile.h".
16551         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
16552         all callers.
16553         (Symbol_table::do_allocate_commons): Likewise.
16554         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
16555         symbol allocation to mapfile.
16556         * common.h (class Allocate_commons_task): Add mapfile_ field.
16557         Update constructor.  Change all callers.
16558         * symtab.h (class Symbol_table): Update declarations.
16559         * layout.cc: Include "mapfile.h".
16560         (Layout_task_runner::run): Print information to mapfile.
16561         (Layout::create_gold_note): Change Output_data_fixed_space to
16562         Output_data_zero_fill.
16563         (Layout::create_build_id): Likewise.
16564         (Layout::print_to_mapfile): New function.
16565         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
16566         constructor.  Change caller.
16567         (class Layout): Declare print_to_mapfile.
16568         * output.cc (Output_section::Input_section::print_to_mapfile): New
16569         function.
16570         (Output_section::add_input_section): If producing a map, always
16571         add to input_sections_ list.
16572         (Output_section::do_print_to_mapfile): New function.
16573         (Output_segment::print_sections_to_mapfile): New function.
16574         (Output_segment::print_section_list_to_mapfile): New function.
16575         * output.h: Include "mapfile.h".
16576         (Output_data::print_to_mapfile): New function.
16577         (Output_data::do_print_to_mapfile): New virtual function.
16578         (Output_segment_headers::do_print_to_mapfile): New function.
16579         (Output_file_header::do_print_to_mapfile): New function.
16580         (Output_data_const::do_print_to_mapfile): New function.
16581         (class Output_data_const_buffer): Add map_name_ field.  Update
16582         constructor.  Change all callers.  Add do_print_to_mapfile
16583         function.
16584         (class Output_data_fixed_space): Likewise.
16585         (class Output_data_space): Likewise.
16586         (class Output_data_zero_fill): New class.
16587         (Output_data_strtab::do_print_to_mapfile): New function.
16588         (Output_data_reloc_base::do_print_to_mapfile): New function.
16589         (Output_relocatable_relocs::do_print_to_mapfile): New function.
16590         (Output_data_group::do_print_to_mapfile): New function.
16591         (Output_data_got::do_print_to_mapfile): New function.
16592         (Output_data_dynamic::do_print_to_mapfile): New function.
16593         (Output_symtab_xindex::do_print_to_mapfile): New function.
16594         (class Output_section): Declare do_print_to_mapflie.  Declare
16595         print_to_mapfile in Input_section.
16596         (class Output_segment): Declare new functions.
16597         * object.h (Sized_relobj::symbol_count): New function.
16598         * script-sections.cc
16599         (Output_section_element_dot_assignment::set_section_addresses):
16600         Change Output_data_fixed_space to Output_data_zero_fill.
16601         (Output_data_expression::do_print_to_mapfile): New function.
16602         * script.cc (read_input_script): Add mapfile parameter.  Change
16603         all callers.
16604         * script.h (read_input_script): Update declaration.
16605         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
16606         (Eh_frame::do_print_to_mapfile): New function.
16607         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
16608         (Output_merge_string::do_print_to_mapfile): New function.
16609         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
16610         function.
16611         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
16612         function.
16613         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
16614         function.
16615         * Makefile.am (CCFILES): Add mapfile.cc.
16616         (HFILES): Add mapfile.h.
16617         * Makefile.in: Rebuild.
16618
16619 2008-05-19  Ian Lance Taylor  <iant@google.com>
16620
16621         * options.h (class General_options): Add -z relro.
16622         * layout.cc (Layout::Layout): Initialize relro_segment_.
16623         (Layout::add_output_section_data): Return the output section.
16624         (Layout::make_output_section): Rcognize relro sections and mark
16625         them appropriately.
16626         (Layout::attach_allocated_section_to_segment): Put relro sections
16627         in a PT_GNU_RELRO segment.
16628         (Layout::create_initial_dynamic_sections): Mark the .dynamic
16629         section as relro.
16630         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
16631         PT_TLS segments.
16632         (Layout::linkonce_mapping): Map d.rel.ro.local to
16633         .data.rel.ro.local.
16634         (Layout::output_section_name): Us .data.rel.ro.local for any
16635         section which begins with that.
16636         * layout.h (class Layout): Update add_output_section_data
16637         declaration.  Add relro_segment_ field.
16638         * output.cc (Output_section::Output_section): Initialize is_relro_
16639         and is_relro_local_ fields.
16640         (Output_segment::add_output_section): Group relro sections.
16641         (Output_segment::is_first_section_relro): New function.
16642         (Output_segment::maximum_alignment): If there is a relro section,
16643         align the segment to the common page size.
16644         (Output_segment::set_section_addresses): Track whether we are
16645         looking at relro sections.  If the last section is a relro
16646         section, align to the common page size.
16647         (Output_segment::set_section_list_addresses): Add in_relro
16648         parameter.  Change all callers.  Align to the page size when
16649         moving from relro to non-relro section.
16650         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
16651         segment.
16652         * output.h (class Output_section): Add is_relro_ and
16653         is_relro_local_ fields.
16654         (Output_section::is_relro): New function.
16655         (Output_section::set_is_relro): New function.
16656         (Output_section::is_relro_local): New function.
16657         (Output_section::set_is_relro_local): New function.
16658         (class Output_segment): Update declarations.
16659         * i386.cc (Target_i386::got_section): Mark .got section as relro.
16660         * sparc.cc (Target_sparc::got_section): Likewise.
16661         * x86_64.cc (Target_x86_64::got_section): Likewise.
16662         * testsuite/relro_test_main.cc: New file.
16663         * testsuite/relro_test.cc: New file.
16664         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
16665         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
16666         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
16667         (relro_test.so, relro_test_pic.o): New targets.
16668         * testsuite/Makefile.in: Rebuild.
16669
16670 2008-05-16  Ian Lance Taylor  <iant@google.com>
16671
16672         * output.cc (Output_segment::add_output_section): Remove front
16673         parameter.
16674         * output.h (class Output_segment): Remove
16675         add_initial_output_section and overloaded add_output_section.
16676         Update declaration of remaining add_output_section.
16677         * layout.cc (Layout::create_interp): Call add_output_section
16678         rather than add_initial_output_section.
16679         (Layout::finish_dynamic_section): Likewise.
16680
16681         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
16682         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
16683         know the dynamic type.
16684         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
16685         field.  Initialize it in constructor.
16686         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
16687         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
16688         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
16689         reloc.
16690
16691         * output.cc (Output_reloc::get_address): Change return type to
16692         Elf_Addr.
16693         * output.h (class Output_reloc): Update get_address declaration.
16694         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
16695         for section addresses.
16696
16697 2008-05-09  Ian Lance Taylor  <iant@google.com>
16698
16699         PR 6493
16700         * gold.cc (gold_nomem): Use return value of write.
16701
16702 2008-05-08  Ian Lance Taylor  <iant@google.com>
16703
16704         * symtab.c (Symbol::init_base_output_data): Add version
16705         parameter.  Change all callers.
16706         (Symbol::init_base_output_segment): Likewise.
16707         (Symbol::init_base_constant): Likewise.
16708         (Symbol::init_base_undefined): Likewise.
16709         (Sized_symbol::init_output_data): Likewise.
16710         (Sized_symbol::init_output_segment): Likewise.
16711         (Sized_symbol::init_constant): Likewise.
16712         (Sized_symbol::init_undefined): Likewise.
16713         (Symbol_table::do_define_in_output_data): If the new symbol has a
16714         version, mark it as the default.
16715         (Symbol_table::do_define_in_output_segment): Likewise.
16716         (Symbol_table::do_define_as_constant): Likewise.
16717         * symtab.h (class Symbol): Update declarations.
16718         (class Sized_symbol): Likewise.
16719         * resolve.cc (Symbol::override_version): New function.
16720         (Symbol::override_base): Call override_version.
16721         (Symbol::override_base_with_special): Likewise.
16722         * testsuite/ver_script_8.script: New file.
16723         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
16724         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
16725         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
16726         (ver_test_8_1.so, ver_test_8_2.so): New targets.
16727
16728 2008-05-06  Ian Lance Taylor  <iant@google.com>
16729
16730         PR 6049
16731         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
16732         functions.
16733         (class General_options): Remove existing --undefined, and add
16734         --no-undefined instead.  Add new --undefined as synonym for -u.
16735         * archive.cc (Archive::add_symbols): Check whether symbol was
16736         named with -u.
16737         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
16738         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
16739         all uses.  Add IS_UNDEFINED.  Update declarations to split
16740         different versions of init_base.  Declare init_base_undefined.
16741         (Symbol::is_defined): Handle IS_UNDEFINED.
16742         (Symbol::is_undefined): Likewise.
16743         (Symbol::is_weak_undefined): Call is_undefined.
16744         (Symbol::is_absolute): Handle IS_CONSTANT.
16745         (class Sized_symbol): Update declarations to split different
16746         versions of init.  Declare init_undefined.
16747         (class Symbol_table): Declare new functions.
16748         * symtab.cc (Symbol::init_base_object): Rename from init_base.
16749         Change all callers.
16750         (Symbol::init_base_output_data): Likewise.
16751         (Symbol::init_base_output_segment): Likewise.
16752         (Symbol::init_base_constant): Likewise.
16753         (Symbol::init_base_undefined): New function.
16754         (Sized_symbol::init_object): Rename from init.  Change all
16755         callers.
16756         (Sized_symbol::init_output_data): Likewise.
16757         (Sized_symbol::init_output_segment): Likewise.
16758         (Sized_symbol::init_constant): Likewise.
16759         (Sized_symbol::init_undefined): New function.
16760         (Symbol_table::add_undefined_symbols_from_command_line): New
16761         function.
16762         (Symbol_table::do_add_undefined_symbols_from_command_line): New
16763         function.
16764         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
16765         (Symbol::output_section): Likewise.
16766         (Symbol::set_output_section): Likewise.
16767         (Symbol_table::sized_finalize_symbol): Likewise.
16768         (Symbol_table::sized_write_globals): Likewise.
16769         * resolve.cc (Symbol_table::should_override): Likewise.
16770         (Symbol::override_base_with_special): Likewise.
16771
16772         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
16773         symbol, change it to have default visibility.
16774         * testsuite/protected_1.cc: New file.
16775         * testsuite/protected_2.cc: New file.
16776         * testsuite/protected_3.cc: New file.
16777         * testsuite/protected_main_1.cc: New file.
16778         * testsuite/protected_main_2.cc: New file.
16779         * testsuite/protected_main_3.cc: New file.
16780         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
16781         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
16782         (protected_1_LDFLAGS, protected_1_LDADD): Define.
16783         (protected_1.so): New target.
16784         (protected_1_pic.o, protected_2_pic.o): New targets.
16785         (protected_3_pic.o): New target.
16786         (check_PROGRAMS): Add protected_2.
16787         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
16788         (protected_2_LDFLAGS, protected_2_LDADD): Define.
16789         * testsuite/Makefile.in: Rebuild.
16790
16791         * options.h (DEFINE_var): Add set_user_set_##varname__.
16792         (DEFINE_bool_alias): New macro.
16793         (class General_options): Define -Bstatic using DEFINE_bool_alias
16794         rather than DEFINE_special.  Add --undefined as an alias for -z
16795         defs.
16796         * options.cc (General_options::parse_Bstatic): Remove.
16797
16798         * options.h (class General_options): Add --fatal-warnings.
16799         * main.cc (main): Implement --fatal-warnings.
16800         * errors.h (Errors::warning_count): New function.
16801
16802         * options.h (class General_options): Add -Bsymbolic-functions.
16803         * symtab.h (Symbol::is_preemptible): Check for
16804         -Bsymbolic-functions.
16805
16806 2008-05-05  Ian Lance Taylor  <iant@google.com>
16807
16808         * options.h (DEFINE_bool): For DASH_Z, create the negative option
16809         as noVARNAME rather than no-VARNAME.
16810         (class General_options): Add option -z combreloc.
16811         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
16812         get_address.
16813         (Output_reloc::sort_before) [SHT_REL]: New function.
16814         (Output_reloc::sort_before) [SHT_RELA]: New function.
16815         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
16816         Sort_relocs_comparison.
16817         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
16818         parameter.  Change all callers.
16819         (Output_data_reloc::Output_data_reloc) [both versions]: Add
16820         sort_relocs parameter.  Change all callers.
16821         * output.cc (Output_reloc::get_address): New function, broken out
16822         of write_rel.
16823         (Output_reloc::write_rel): Call it.
16824         (Output_reloc::compare): New function.
16825         (Output_data_reloc_base::do_write): Optionally sort relocs.
16826
16827         * configure.ac: If targ_extra_obj is set, link it in.
16828         * configure.tgt: Initialize all variables.
16829         (x86_64*): Set targ_extra_obj and targ_extra_size.
16830         * configure: Rebuild.
16831
16832         * object.cc (Sized_relobj::include_section_group): Adjust section
16833         indexes read from group data.  Build vector to pass to
16834         layout_group.
16835         * layout.cc (Layout::layout_group): Add flags and shndxes
16836         parameters.  Remove contents parameter.  Change caller.  Update
16837         explicit instantiations.
16838         * layout.h (class Layout): Update layout_group declaration.
16839         * output.cc (Output_data_group::Output_data_group): Add flags and
16840         input_shndxes parameters.  Remove contents parameter.  Change
16841         caller.
16842         (Output_data_group::do_write): Change input_sections_ to
16843         input_shndxes_.
16844         * output.h (class Output_data_group): Update constructor
16845         declaration.  Rename input_sections_ to input_shndxes_.
16846         * testsuite/many_sections_test.cc: Add template.
16847
16848 2008-04-30  Cary Coutant  <ccoutant@google.com>
16849
16850         * target-reloc.h (relocate_section): Fix dead-pointer bug.
16851
16852         * layout.cc (Layout::include_section): Refactored check for debug
16853         info section.
16854         (Layout::add_comdat): Add new parameters.  Change type
16855         of signature parameter.  Add object and shndx to signatures table.
16856         (Layout::find_kept_object): New function.
16857         * layout.h: Include <cstring>.
16858         (Layout::is_debug_info_section): New function.
16859         (Layout::add_comdat): Add new parameters.
16860         (Layout::find_kept_object): New function.
16861         (Layout::Kept_section): New struct.
16862         (Layout::Signatures): Change type of map range.
16863         * object.cc (Relobj::output_section_address): New function.
16864         (Sized_relobj::include_section_group): Add new parameters.  Change
16865         calls to Layout::add_comdat.  Change to build table of kept comdat
16866         groups and table mapping discarded sections to kept sections.
16867         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
16868         (Sized_relobj::do_layout): Change calls to include_section_group and
16869         include_linkonce_section.
16870         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
16871         value to zero when section is discarded.
16872         (Sized_relobj::map_to_kept_section): New function.
16873         * object.h (Relobj::output_section_address): New function.
16874         (Relobj::Comdat_group): New type.
16875         (Relobj::find_comdat_group): New function.
16876         (Relobj::Comdat_group_table): New type.
16877         (Relobj::Kept_comdat_section): New type.
16878         (Relobj::Kept_comdat_section_table): New type.
16879         (Relobj::add_comdat_group): New function.
16880         (Relobj::set_kept_comdat_section): New function.
16881         (Relobj::get_kept_comdat_section): New function.
16882         (Relobj::comdat_groups_): New field.
16883         (Relobj::kept_comdat_sections_): New field.
16884         (Symbol_value::input_value): Update comment.
16885         (Sized_relobj::map_to_kept_section) New function.
16886         (Sized_relobj::include_linkonce_section): Add new parameter.
16887         * target-reloc.h (Comdat_behavior): New type.
16888         (get_comdat_behavior): New function.
16889         (relocate_section): Add code to map a discarded section to the
16890         corresponding kept section when applying a relocation.
16891
16892 2008-04-30  Craig Silverstein  <csilvers@google.com>
16893
16894         * dwarf_reader.cc (next_generation_count): New static var.
16895         (Addr2line_cache_entry): New struct.
16896         (addr2line_cache): New static var.
16897         (Dwarf_line_info::one_addr2line): Added caching.
16898         (Dwarf_line_info::clear_addr2line_cache): New function.
16899         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
16900         cache-size parameter.
16901         (Dwarf_line_info::one_addr2line_cache): New function.
16902         * symtab.cc (Symbol_table::detect_odr_violations): Pass
16903         new cache-size argument to one_addr2line(), and clear cache.
16904
16905 2008-04-28  Cary Coutant  <ccoutant@google.com>
16906
16907         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
16908         R_386_PC8 relocations.
16909
16910 2008-04-23  Ian Lance Taylor  <iant@google.com>
16911
16912         * object.cc (Sized_relobj::include_section_group): Check for
16913         invalid section group.
16914
16915         * object.cc (make_elf_object): Correct test for 64-bit ELF file
16916         header size.
16917
16918         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
16919         than read for file header.
16920         * archive.cc (Archive::include_member): Likewise.
16921
16922 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
16923
16924         * aclocal.m4: Regenerate.
16925         * configure: Regenerate.
16926
16927 2008-04-19  Ian Lance Taylor  <iant@google.com>
16928
16929         * version.cc (version_string): Bump to 1.6.
16930
16931         * testsuite/Makefile.am (many_sections_r_test): New target.
16932         (many_sections_r_test_SOURCES): Remove.
16933         (many_sections_r_test_DEPENDENCIES): Remove.
16934         (many_sections_r_test_LDFLAGS): Remove.
16935         (many_sections_r_test_LDADD): Remove.
16936
16937         * object.cc (Sized_relobj::do_add_symbols): Always pass
16938         local_symbol_count_ to add_from_relobj.
16939
16940         * testsuite/Makefile.am (many_sections_check.h): Only check one in
16941         every thousand variables.
16942         * testsuite/Makefile.in: Rebuild.
16943
16944         * object.cc (Xindex::initialize_symtab_xindex): New function.
16945         (Xindex::read_symtab_xindex): New function.
16946         (Xindex::sym_xindex_to_shndx): New function.
16947         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
16948         available.
16949         (Sized_relobj::do_initialize_xindex): New function.
16950         (Sized_relobj::do_read_symbols): Adjust section links.
16951         (Sized_relobj::symbol_section_and_value): Add is_ordinary
16952         parameter.  Change all callers.
16953         (Sized_relobj::include_section_group): Adjust section links and
16954         symbol section indexes.
16955         (Sized_relobj::do_layout): Adjust section links.
16956         (Sized_relobj::do_count_local_symbols): Adjust section links and
16957         symbol section indexes.
16958         (Sized_relobj::do_finalize_local_symbols): Distinguish between
16959         ordinary and special symbols.
16960         (Sized_relobj::write_local_symbols): Add symtab_xindex and
16961         dynsym_xindex parameters.  Change all callers.  Adjust section
16962         links.  Use SHN_XINDEX when needed.
16963         (Sized_relobj::get_symbol_location_info): Adjust section links.
16964         Don't get fooled by special symbols.
16965         * object.h (class Xindex): Define.
16966         (class Object): Add xindex_ parameter.  Declare virtual functoin
16967         do_initialize_xindex.
16968         (Object::adjust_sym_shndx): New function.
16969         (Object::set_xindex): New protected function.
16970         (class Symbol_value): Add is_ordinary_shndx_ field.
16971         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
16972         (Symbol_value::value): Assert ordinary section.
16973         (Symbol_value::initialize_input_to_output_map): Likewise.
16974         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
16975         Change all callers.
16976         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
16977         all callers.
16978         (class Sized_relobj): Update declarations.
16979         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
16980         parameter.  Change all callers.
16981         (Sized_relobj::adjust_shndx): New function.
16982         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
16983         field.
16984         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
16985         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
16986         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
16987         (Sized_dynobj::read_dynsym_section): Adjust section links.
16988         (Sized_dynobj::read_dynamic): Likewise.
16989         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
16990         section links.
16991         (Sized_dynobj::do_initialize_xindex): New function.
16992         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
16993         do_initialize_xindex.
16994         (Sized_dynobj::adjust_shndx): New function.
16995         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
16996         dynsym_xindex_ fields.
16997         (Layout::finalize): Add a call to set_section_indexes before
16998         creating the symtab sections.
16999         (Layout::set_section_indexes): Don't do anything if the section
17000         already has a section index.
17001         (Layout::create_symtab_sections): Add shnum parameter.  Change
17002         caller.  Create .symtab_shndx section if needed.
17003         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
17004         caller.
17005         (Layout::allocated_output_section_count): New function.
17006         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
17007         needed.
17008         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
17009         fields.  Update declarations.
17010         (Layout::symtab_xindex): New function.
17011         (Layout::dynsym_xindex): New function.
17012         (class Write_symbols_task): Add layout_ field.
17013         (Write_symbols_task::Write_symbols_task): Add layout parameter.
17014         Change caller.
17015         * output.cc (Output_section_headers::Output_section_headers): Add
17016         shstrtab_section parameter.  Change all callers.
17017         (Output_section_headers::do_sized_write): Store overflow values
17018         for section count and section string table section index in
17019         section header zero.
17020         (Output_file_header::do_sized_write): Check for overflow of
17021         section count and section string table section index.
17022         (Output_symtab_xindex::do_write): New function.
17023         (Output_symtab_xindex::endian_do_write): New function.
17024         * output.h (class Output_section_headers): Add shstrtab_section_.
17025         Update declarations.
17026         (class Output_symtab_xindex): Define.
17027         (Output_section::has_out_shndx): New function.
17028         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
17029         field.
17030         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
17031         Change all callers.
17032         (Sized_symbol::init): Likewise.
17033         (Symbol::output_section): Check for ordinary symbol.
17034         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
17035         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
17036         callers.
17037         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
17038         Change all callers.  Simplify handling of symbols from sections
17039         not included in the link.
17040         (Symbol_table::add_from_dynobj): Handle ordinary symbol
17041         distinction.
17042         (Weak_alias_sorter::operator()): Assert that symbols are
17043         ordinary.
17044         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
17045         distinction.
17046         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
17047         parameters.  Change all callers.
17048         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
17049         symbol distinction.  Use SHN_XINDEX when needed.
17050         (Symbol_table::write_section_symbol): Add symtab_xindex
17051         parameter.  Change all callers.
17052         (Symbol_table::sized_write_section_symbol): Likewise.  Use
17053         SHN_XINDEX when needed.
17054         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
17055         declarations.
17056         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
17057         (Symbol::is_defined): Check is_ordinary.
17058         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
17059         (Symbol::is_absolute, Symbol::is_common): Likewise.
17060         (class Sized_symbol): Update declarations.
17061         (class Symbol_table): Update declarations.
17062         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
17063         parameters.  Change all callers.
17064         (Sized_symbol::override): Likewise.
17065         (Symbol_table::override): Likewise.
17066         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
17067         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
17068         is_ordinary, and orig_st_shndx parameters.  Change all callers.
17069         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
17070         to be in an ordinary section.
17071         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
17072         object and is_ordinary parameters.  Change all callers.
17073         (Sized_dwarf_line_info::read_relocs): Add object parameter.
17074         Change all callers.  Don't add undefined or non-ordinary symbols
17075         to reloc_map_.
17076         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
17077         Change all callers.
17078         * dwarf_reader.h (class Sized_dwarf_line_info): Update
17079         declarations.
17080         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
17081         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
17082         (Sized_relobj::relocate_sections): Likewise.
17083         * target-reloc.h (scan_relocs): Adjust section symbol index.
17084         (scan_relocatable_relocs): Likewise.
17085         * i386.cc (Scan::local): Check for ordinary symbols.
17086         * sparc.cc (Scan::local): Likewise.
17087         * x86_64.cc (Scan::local): Likewise.
17088         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
17089         to symbol_section_and_value.
17090         * testsuite/many_sections_test.cc: New file.
17091         * testsuite/Makefile.am (BUILT_SOURCES): Define.
17092         (check_PROGRAMS): Add many_sections_test.
17093         (many_sections_test_SOURCES): Define.
17094         (many_sections_test_DEPENDENCIES): Define.
17095         (many_sections_test_LDFLAGS): Define.
17096         (BUILT_SOURCES): Add many_sections_define.h.
17097         (many_sections_define.h): New target.
17098         (BUILT_SOURCES): Add many_sections_check.h.
17099         (many_sections_check.h): New target.
17100         (check_PROGRAMS): Add many_sections_r_test.
17101         (many_sections_r_test_SOURCES): Define.
17102         (many_sections_r_test_DEPENDENCIES): Define.
17103         (many_sections_r_test_LDFLAGS): Define.
17104         (many_sections_r_test_LDADD): Define.
17105         (many_sections_r_test.o): New target.
17106         * testsuite/Makefile.in: Rebuild.
17107
17108 2008-04-17  Cary Coutant  <ccoutant@google.com>
17109
17110         * errors.cc (Errors::info): New function.
17111         (gold_info): New function.
17112         * errors.h (Errors::info): New function.
17113         * gold.h (gold_info): New function.
17114         * object.cc (Input_objects::add_object): Print trace output.
17115         * options.cc (options::parse_set): New function.
17116         (General_options::parse_wrap): Deleted.
17117         (General_options::General_options): Deleted initializer.
17118         * options.h (options::String_set): New typedef.
17119         (options::parse_set): New function.
17120         (DEFINE_set): New macro.
17121         (General_options::wrap): Changed to use DEFINE_set. Changed
17122         callers of any_wrap_symbols and is_wrap_symbol.
17123         (General_options::trace, General_options::trace_symbol):
17124         New options.
17125         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
17126         (General_options::wrap_symbols_): Deleted.
17127         * symtab.cc (Symbol_table::add_from_object): Print trace output.
17128
17129 2008-04-17  David S. Miller  <davem@davemloft.net>
17130
17131         * options.cc (General_options::parse_V): New function.
17132         * options.h: Add entries for -V and -Qy.
17133
17134 2008-04-17  Ian Lance Taylor  <iant@google.com>
17135
17136         * common.cc (Symbol_table::allocate_commons): Remove options
17137         parameter.  Change caller.
17138         (Symbol_table::do_allocate_commons): Remove options parameter.
17139         Change caller.  Just call do_allocate_commons_list twice.
17140         (Symbol_table::do_allocate_commons_list): New function, broken out
17141         of do_allocate_commons.
17142         * common.h (class Allocate_commons_task): Remove options_ field.
17143         Update constructor.
17144         * symtab.cc (Symbol_table::Symbol_table): Initialize
17145         tls_commons_.
17146         (Symbol_table::add_from_object): Put TLS common symbols on
17147         tls_commons_ list.
17148         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
17149         which are IN_OUTPUT_DATA.
17150         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
17151         allocate_commons and do_allocate_commons declarations.  Declare
17152         do_allocate_commons_list.
17153         * gold.cc (queue_middle_tasks): Update creation of
17154         Allocate_commons_task to not pass options.
17155         * testsuite/Makefile.am (INCLUDES): Add -I.. .
17156         (TLS_TEST_C_FLAGS): New variable.
17157         (tls_test_c_pic.o): New target.
17158         (tls_test_shared.so): Link in tls_test_c_pic.o.
17159         (tls_test_c_pic_ie.o): New target.
17160         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
17161         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
17162         (tls_test_c.o): New target.
17163         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
17164         (tls_pic_test_LDADD): Likewise.
17165         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
17166         (tls_shared_gd_to_ie_test_LDADD): Likewise.
17167         (tls_test_c_gnu2.o): New target.
17168         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
17169         tls_test_c_gnu2.o.
17170         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
17171         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
17172         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
17173         * testsuite/tls_test.cc: Include "config.h".
17174         (t_last): Call t11_last.
17175         * testsuite/tls_test.h (t11, t11_last): Declare.
17176         * testsuite/tls_test_c.c: New file.
17177         * testsuite/tls_test_main.cc (thread_routine): Call t11.
17178         * configure.ac: Check for OpenMP support.
17179         * configure, config.in, Makefile.in: Rebuild.
17180         * testsuite/Makefile.in: Rebuild.
17181
17182 2008-04-16  Cary Coutant  <ccoutant@google.com>
17183
17184         * i386.cc (Target_i386::define_tls_base_symbol): New function.
17185         (Target_i386::tls_base_symbol_defined_): New field.
17186         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
17187         (Target_i386::Scan::global): Likewise.
17188         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
17189         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
17190         (Target_x86_64::tls_base_symbol_defined_): New field.
17191         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
17192         (Target_x86_64::Scan::global): Likewise.
17193
17194 2008-04-16  Cary Coutant  <ccoutant@google.com>
17195
17196         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
17197         (Symbol::needs_plt_entry): Allow weak undefined symbols.
17198         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
17199         building shared libraries.
17200         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
17201         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
17202         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
17203         * testsuite/Makefile.in: Rebuild.
17204         * testsuite/weak_undef.h: New file.
17205         * testsuite/weak_undef_file1.cc: Add extra test cases.
17206         * testsuite/weak_undef_file2.cc: Likewise.
17207         * testsuite/weak_undef_test.cc: Likewise.
17208
17209 2008-04-16  David S. Miller  <davem@davemloft.net>
17210
17211         * sparc.cc (Target_sparc::Scan): Change from struct to class.
17212         Add issued_non_pic_error_ field.  Declare check_non_pic.
17213         (Target_sparc::Scan::check_non_pic): New function.
17214         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
17215         (Target_sparc::Scan::global): Likewise.
17216
17217         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
17218         * configure: Rebuild.
17219
17220         * options.h (DEFINE_enable): New macro.
17221         (new_dtags): New enable option.
17222         (initfirst, interpose, loadfltr, nodefaultlib,
17223         nodelete, nodlopen, nodump): New -z options.
17224         * layout.cc (Layout:finish_dynamic_section): If new
17225         dtags enabled, emit DT_RUNPATH.  Also, emit a
17226         DT_FLAGS_1 containing any specified -z flags.
17227
17228 2008-04-16  Ian Lance Taylor  <iant@google.com>
17229
17230         * copy-relocs.cc: New file.
17231         * copy-relocs.h: New file.
17232         * reloc.cc: Remove Copy_relocs code.
17233         * reloc.h: Likewise.
17234         * reloc-types.h (struct Reloc_types) [both versions]: Add
17235         get_reloc_addend_noerror.
17236         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
17237         variants of add_global which take an addend which must be zero.
17238         * i386.cc: Include "copy-relocs.h".
17239         (class Target_i386): Change type of copy_relocs_ to variable,
17240         update initializer.
17241         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
17242         Change all callers.
17243         (Target_i386::do_finalize_sections): Change handling of
17244         copy_relocs_.
17245         * sparc.cc: Include "copy-relocs.h".
17246         (class Target_sparc): Change type of copy_relocs_ to variable,
17247         update initializer.
17248         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
17249         Change all callers.
17250         (Target_sparc::do_finalize_sections): Change handling of
17251         copy_relocs_.
17252         * x86_64.cc: Include "copy-relocs.h".
17253         (class Target_x86_64): Change type of copy_relocs_ to variable,
17254         update initializer.
17255         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
17256         class.  Change all callers.
17257         (Target_x86_64::do_finalize_sections): Change handling of
17258         copy_relocs_.
17259         * Makefile.am (CCFILES): Add copy-relocs.cc.
17260         (HFILES): Add copy-relocs.h.
17261
17262         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
17263
17264         * testsuite/script_test_4.sh: Permit leading zeroes.
17265
17266 2008-04-15  Ian Lance Taylor  <iant@google.com>
17267
17268         * script-sections.cc (Script_sections::create_segments): Use
17269         header_size_adjustment even when there is enough room for the
17270         headers.
17271         * testsuite/script_test_4.sh: New file.
17272         * testsuite/script_test_4.t: New file.
17273         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
17274         (check_DATA): Add script_test_4.stdout.
17275         (MOSTLYCLEANFILES): Likewise.
17276         (script_test_4): New target.
17277         (script_test_4.stdout): New target.
17278         * testsuite/Makefile.in: Rebuild.
17279
17280         * sparc.cc: Add definitions for Output_data_plt_sparc class
17281         constants.
17282
17283 2008-04-14  David S. Miller  <davem@davemloft.net>
17284
17285         * sparc.cc: New file.
17286         * Makefile.am (TARGETSOURCES): Add sparc.cc
17287         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
17288         * configure.tgt: Document targ_extra_size and
17289         targ_extra_big_endian.  Add entries for sparc-* and
17290         sparc64-*.
17291         * configure.ac: Handle targ_extra_size and
17292         targ_extra_big_endian.
17293         * Makefile.in: Rebuild.
17294         * configure: Likewise.
17295         * po/POTFILES.in: Likewise.
17296         * po/gold.pot: Likewise.
17297
17298 2008-04-14  Ian Lance Taylor  <iant@google.com>
17299
17300         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
17301         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
17302         in the name/type/flags to section mapping.  Don't call
17303         allocate_output_section.
17304         (Layout::choose_output_section): Change parameter from adjust_name
17305         to is_input_section.  Don't permit input sections after sections
17306         are attached to segments.  Don't call allocate_output_section.
17307         (Layout::layout_eh_frame): Call update_flags_for_input_section,
17308         not write_enable_output_section.
17309         (Layout::make_output_section): Don't push to
17310         unattached_section_list_ nor call attach_to_segment.  Call
17311         attach_section_to_segment if sections are attached.
17312         (Layout::attach_sections_to_segments): New function.
17313         (Layout::attach_section_to_segment): New function.
17314         (Layout::attach_allocated_section_to_segment): Rename from
17315         attach_to_segment.  Remove flags parameter.
17316         (Layout::allocate_output_section): Remove function.
17317         (Layout::write_enable_output_section): Remove function.
17318         * layout.h (class Layout): Update for above changes.  Add new
17319         field sections_are_attached_.
17320         * output.h (Output_section::update_flags_for_input_section): New
17321         function.
17322         * output.cc (Output_section::add_input_section): Call
17323         update_flags_for_input_section.
17324         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
17325
17326 2008-04-11  Cary Coutant  <ccoutant@google.com>
17327
17328         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
17329         thought unnecessary.
17330         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
17331
17332 2008-04-11  Ian Lance Taylor  <iant@google.com>
17333
17334         * output.h (class Output_section_data): Remove inline definition
17335         of set_addralign.
17336         * output.cc (Output_section_data::set_addralign): New function.
17337
17338 2008-04-11  Cary Coutant  <ccoutant@google.com>
17339
17340         Add support for TLS descriptors for i386 and x86_64.
17341         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
17342         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
17343         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
17344         GOT_TYPE_TLS_DESC.
17345         (Target_i386::got_mod_index_entry): Remove unnecessary code.
17346         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
17347         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
17348         relocations.
17349         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
17350         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
17351         Fix problem with initial-exec relocations.
17352         (Target_i386::Relocate::relocate_tls): Likewise.
17353         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
17354         relaxation.
17355         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
17356         support for section-plus-offset dynamic table entries.
17357         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
17358         (Output_data_dynamic::Dynamic_entry): Add support for
17359         section-plus-offset dynamic table entries.
17360         (Output_data_dynamic::Classification): Likewise.
17361         (Output_data_dynamic::classification_): Renamed offset_.
17362         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
17363         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
17364         (Target_x86_64::make_plt_section): New function.
17365         (Target_x86_64::reserve_tlsdesc_entries): New function.
17366         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
17367         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
17368         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
17369         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
17370         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
17371         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
17372         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
17373         add extra PLT entry for TLS descriptors.
17374         (Output_data_plt_x86_64::got_): New field.
17375         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
17376         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
17377         fields.
17378         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
17379         descriptors.
17380         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
17381         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
17382         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
17383         R_386_TLS_DESC_CALL relocations.
17384         (Target_x86_64::Scan::global): Likewise.
17385         (Target_x86_64::do_finalize_sections): Add dynamic table entries
17386         for TLS descriptors.
17387         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
17388         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
17389         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
17390         GD-to-IE relaxation.
17391         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
17392         and TLS_DESCRIPTORS.
17393         * Makefile.in: Rebuild.
17394         * configure: Rebuild.
17395         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
17396         (tls_test_shared2.so): New target.
17397         (tls_shared_gd_to_ie_test_SOURCES): New variable.
17398         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
17399         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
17400         (tls_shared_gd_to_ie_test_LDADD): New variable.
17401         (tls_shared_gnu2_gd_to_ie_test): New target.
17402         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
17403         New targets.
17404         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
17405         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
17406         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
17407         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
17408         (tls_shared_gnu2_test): New target.
17409         (tls_test_gnu2_shared.so): New target.
17410         (tls_shared_gnu2_test_SOURCES): New variable.
17411         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
17412         (tls_shared_gnu2_test_LDFLAGS): New variable.
17413         (tls_shared_gnu2_test_LDADD): New variable.
17414         * testsuite/Makefile.in: Rebuild.
17415         * testsuite/Makefile.
17416
17417 2008-04-11  Ian Lance Taylor  <iant@google.com>
17418
17419         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
17420         justsyms.t.
17421         * testsuite/Makefile.in: Rebuild.
17422
17423         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
17424         long.
17425         * testsuite/script_test_2.cc (main): Adjust test.
17426
17427 2008-04-11  David S. Miller  <davem@davemloft.net>
17428             Ian Lance Taylor  <iant@google.com>
17429
17430         * options.h (General_options): Add entries for '-Y' and
17431         '-relax'.
17432         * options.cc (General_options:finalize): If -Y was used, add those
17433         entries to the library path instead of the default "/lib" and
17434         "/usr/lib".
17435
17436 2008-04-11  David S. Miller  <davem@davemloft.net>
17437
17438         * testsuite/justsyms.t: Start at 0x100.
17439         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
17440         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
17441         long.
17442         * testsuite/script_test_2.cc: Adjust string and section length
17443         checks.
17444
17445 2008-04-09  Ian Lance Taylor  <iant@google.com>
17446
17447         PR gold/5996
17448         * script-sections.cc (Sections_element::allocate_to_segment): Add
17449         orphan parameter.
17450         (Output_section_definition::allocate_to_segment): Likewise.
17451         (Orphan_output_section::allocate_to_segment): Likewise.
17452         (Script_sections::attach_sections_using_phdrs_clause): Don't
17453         propagate non-PT_LOAD segments to orphan sections.
17454         * testsuite/Makefile.am (script_test_3.stdout): Generate using
17455         readelf rather than objdump.
17456         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
17457         .interp section and PT_INTERP segment are the same size.
17458         * testsuite/Makefile.in: Rebuild.
17459
17460         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
17461         aliases for symbols defined in the same object.
17462         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
17463         (weak_alias_test_SOURCES): New variable.
17464         (weak_alias_test_DEPENDENCIES): New variable.
17465         (weak_alias_test_LDFLAGS): New variable.
17466         (weak_alias_test_LDADD): New variable.
17467         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
17468         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
17469         (weak_alias_test_3.o): New target.
17470         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
17471         * testsuite/weak_alias_test_main.cc: New file.
17472         * testsuite/weak_alias_test_1.cc: New file.
17473         * testsuite/weak_alias_test_2.cc: New file.
17474         * testsuite/weak_alias_test_3.cc: New file.
17475
17476 2008-04-08  Ian Lance Taylor  <iant@google.com>
17477
17478         * options.h (class General_options): Add --noinhibit-exec option.
17479         * main.cc (main): Check --noinhibit-exec.
17480
17481         * options.h (class General_options): Define --wrap as a special
17482         option.  Add wrap_symbols_ field.
17483         (General_options::any_wrap_symbols): New function.
17484         (General_options::is_wrap_symbol): New function.
17485         * options.cc (General_options::parse_wrap): New function.
17486         (General_options::General_options): Initialize wrap_symbols_.
17487         * symtab.cc (Symbol_table::wrap_symbol): New function.
17488         (Symbol_table::add_from_object): Handle --wrap.
17489         * symtab.h (class Symbol_table): Declare wrap_symbol.
17490         * target.h (Target::wrap_char): New function.
17491         (Target::Target_info): Add wrap_char field.
17492         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
17493         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
17494         * testsuite/testfile.cc (Target_test::test_target_info):
17495         Likewise.
17496
17497         * errors.cc (Errors::undefined_symbol): Mention symbol version if
17498         there is one.
17499
17500         * layout.h (class Layout): Add added_eh_frame_data_ field.
17501         * layout.cc (Layout::Layout): Initialize new field.
17502         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
17503         output section until we find a section we merged successfully.
17504         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
17505         that the size be non-zero.
17506
17507         * merge.cc (Object_merge_map::get_output_offset): Remove inline
17508         qualifier.
17509
17510 2008-04-08  Craig Silverstein  <csilvers@google.com>
17511
17512         * configure.ac: Export new conditional variable HAVE_ZLIB.
17513         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
17514         on HAVE_ZLIB.
17515         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
17516         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17517
17518 2008-04-07  Ian Lance Taylor  <iant@google.com>
17519
17520         * version.cc (version_string): Set to "1.5".
17521
17522         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
17523         Add issued_non_pic_error_ field.  Declare check_non_pic.
17524         (Target_x86_64::Scan::check_non_pic): New function.
17525         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
17526         (Target_x86_64::Scan::global): Likewise.
17527
17528         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
17529         addend parameter.  Change caller.  Handle merge sections.
17530         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
17531         Address to Addend.  Don't add in the result of
17532         local_section_offset, pass down the addend and use the returned
17533         value.
17534         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
17535         Update declarations of local_section_offset and symbol_value.
17536         * testsuite/two_file_test_1.cc (t18): New function.
17537         * testsuite/two_file_test_2.cc (f18): New function.
17538         * testsuite/two_file_test_main.cc (main): Call t18.
17539         * testsuite/two_file_test.h (t18, f18): Declare.
17540
17541         * configure.ac: Don't test for objdump, c++filt, or readelf.
17542         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
17543         conditionals.
17544         (TEST_READELF): New variable.
17545         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
17546         (check_PROGRAMS): Add two_file_strip_test.
17547         (two_file_strip_test): New target.
17548         (check_PROGRAMS): Add two_file_same_shared_strip_test.
17549         (two_file_same_shared_strip_test_SOURCES): New variable.
17550         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
17551         (two_file_same_shared_strip_test_LDFLAGS): New variable.
17552         (two_file_same_shared_strip_test_LDADD): New variable.
17553         (two_file_shared_strip.so): New target.
17554         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
17555         (ver_test_5.syms, ver_test_7.syms): Likewise.
17556         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
17557         (strip_test_3.stdout): Use TEST_OBJDUMP.
17558         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17559
17560 2008-04-04  Cary Coutant  <ccoutant@google.com>
17561
17562         * symtab.h (Symbol::is_weak_undefined): New function.
17563         (Symbol::is_strong_undefined): New function.
17564         (Symbol::is_absolute): New function.
17565         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
17566         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
17567         absolute symbols.
17568         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
17569         (weak_undef_test): New target.
17570         * testsuite/Makefile.in: Rebuild.
17571         * testsuite/weak_undef_file1.cc: New file.
17572         * testsuite/weak_undef_file2.cc: New file.
17573         * testsuite/weak_undef_test.cc: New file.
17574
17575 2008-04-03  Craig Silverstein  <csilvers@google.com>
17576
17577         * compressed_output.h (class Output_compressed_section): Use
17578         unsigned buffer.
17579         * compressed_output.cc (zlib_compress): Use unsigned buffers,
17580         add zlib header.
17581         (zlib_compressed_suffix): Removed.
17582         (Output_compressed_section::set_final_data_size): Use unsigned
17583         buffers.
17584         * testsuite/Makefile.am (flagstest_compress_debug_sections):
17585         Fix linker invocation.
17586         (flagstest_o_specialfile_and_compress_debug_sections):
17587         Likewise.
17588         * testsuite/Makefile.in: Regenerated.
17589
17590 2008-04-02  David S. Miller  <davem@davemloft.net>
17591
17592         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
17593         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
17594
17595 2008-04-02  Craig Silverstein  <csilvers@google.com>
17596
17597         * TODO: New file.
17598
17599 2008-04-02  Ian Lance Taylor  <iant@google.com>
17600
17601         * fileread.cc (File_read::find_view): Add byteshift and vshifted
17602         parameters.  Update for new key type to views_.  Change all
17603         callers.
17604         (File_read::read): Adjust for byteshift in returned view.
17605         (File_read::add_view): New function, broken out of
17606         find_and_make_view.
17607         (File_read::make_view): New function, broken out of
17608         find_and_make_view.
17609         (File_read::find_or_make_view): Add offset and aligned
17610         parameters.  Rewrite accordingly.  Change all callers.
17611         (File_read::get_view): Add offset and aligned parameters.  Adjust
17612         for byteshift in return value.
17613         (File_read::get_lasting_view): Likewise.
17614         * fileread.h (class File_read): Update declarations.
17615         (class File_read::View): Add byteshift_ field.  Add byteshift to
17616         constructor.  Add byteshift method.
17617         * archive.h (Archive::clear_uncached_views): New function.
17618         (Archive::get_view): Add aligned parameter.  Change all callers.
17619         * object.h (Object::get_view): Add aligned parameter.  Change all
17620         callers.
17621         (Object::get_lasting_view): Likewise.
17622
17623         * fileread.cc (File_read::release): Don't call clear_views if
17624         there are multiple objects.
17625         * fileread.h (File_read::clear_uncached_views): New function.
17626         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
17627         on the archive.
17628
17629 2008-03-31  Cary Coutant  <ccoutant@google.com>
17630
17631         Add thin archive support.
17632         * archive.cc (Archive::armagt): New const.
17633         (Archive::setup): Remove task parameter and calls to unlock.
17634         (Archive::unlock_nested_archives): New function.
17635         (Archive::read_header): Add nested_off parameter. Change
17636         all callers.
17637         (Archive::interpret_header): Likewise.
17638         (Archive::include_all_members): Change to handle thin
17639         archives.
17640         (Archive::include_member): Likewise.
17641         * archive.h (Archive::Archive): Add new parameters and
17642         initializers.
17643         (Archive::armagt): New const.
17644         (Archive::setup): Remove task parameter.
17645         (Archive::unlock_nested_archives): New function.
17646         (Archive::read_header): Add nested_off parameter.
17647         (Archive::interpret_header): Likewise.
17648         (Archive::Nested_archive_table): New typedef.
17649         (Archive::is_thin_archive_): New field.
17650         (Archive::nested_archives_): New field.
17651         (Archive::options_): New field.
17652         (Archive::dirpath_): New field.
17653         (Archive::task_): New field.
17654         * readsyms.cc (Read_symbols::do_read_symbols): Add check
17655         for thin archives.  Pass additional parameters to
17656         Archive::Archive.  Unlock the archive file after calling
17657         Archive::setup.
17658
17659 2008-03-29  Ian Lance Taylor  <iant@google.com>
17660
17661         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
17662         version symbol to be local.
17663         * testsuite/ver_test_4.sh: New file.
17664         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
17665         (check_DATA): Add ver_test_4.syms.
17666         (ver_test_4.syms): New target.
17667         * testsuite/Makefile.in: Rebuild.
17668
17669         * output.cc
17670         (Output_section::Input_section_sort_entry::has_priority): New
17671         function.
17672         (Output_section::Input_section_sort_entry::match_file_name): New
17673         function.
17674         (Output_section::Input_section_sort_entry::match_section_name):
17675         Remove.
17676         (Output_section::Input_section_sort_entry::match_section_name_prefix):
17677         Remove.
17678         (Output_section::Input_section_sort_entry::match_section_file):
17679         Remove.
17680         (Output_section::Input_section_sort_compare::operator()): Rewrite
17681         using new Input_section_sort_entry functions.  Sort crtbegin and
17682         crtend first.  Sort sections with no priority before sections with
17683         a priority.
17684         * testsuite/initpri1.c (d3): Check j != 4.
17685         (cd5): New constructor/destructor function.
17686         (main): Check j != 2.
17687
17688         * symtab.cc (Symbol_table::add_from_object): If we don't use the
17689         new symbol when resolving, don't call set_is_default.
17690         * testsuite/ver_test_7.cc: New file.
17691         * testsuite/ver_test_7.sh: New file.
17692         * testsuite/Makefile.am (ver_test_7.so): New target.
17693         (ver_test_7.o): New target.
17694         (check_SCRIPTS): Add ver_test_7.sh.
17695         (check_DATA): Add ver_test_7.syms.
17696         (ver_test_7.syms): New target.
17697
17698 2008-03-28  Ian Lance Taylor  <iant@google.com>
17699
17700         * layout.cc (Layout::layout): If we see an input section with a
17701         name that needs sorting, set the must_sort flag for the output
17702         section.
17703         (Layout::make_output_section): If the name of the output section
17704         indicates that it might require sorting, set the may_sort flag.
17705         * output.h (Output_section::may_sort_attached_input_sections): New
17706         function.
17707         (Output_section::set_may_sort_attached_input_sections): New
17708         function.
17709         (Output_section::must_sort_attached_input_sections): New
17710         function.
17711         (Output_section::set_must_sort_attached_input_sections): New
17712         function.
17713         (class Output_section): Declare Input_section_sort_entry.  Define
17714         Input_section_sort_compare.  Declare
17715         sort_attached_input_sections.  Add new fields:
17716         may_sort_attached_input_sections_,
17717         must_sort_attached_input_sections_,
17718         attached_input_sections_are_sorted_.
17719         * output.cc (Output_section::Output_section): Initialize new
17720         fields.
17721         (Output_section::add_input_section): Add an entry to
17722         input_sections_ if may_sort or must_sort are true.
17723         (Output_section::set_final_data_size): Call
17724         sort_attached_input_sections if necessary.
17725         (Output_section::Input_section_sort_entry): Define new class.
17726         (Output_section::Input_section_sort_compare::operator()): New
17727         function.
17728         (Output_section::sort_attached_input_sections): New function.
17729         * configure.ac: Check whether the compiler supports constructor
17730         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
17731         * testsuite/initpri1.c: New file.
17732         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
17733         CONSTRUCTOR_PRIORITY.
17734         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
17735         (initpri1_LDFLAGS): New variable.
17736         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17737
17738 2008-03-27  Ian Lance Taylor  <iant@google.com>
17739
17740         * common.cc (Sort_commons::operator): Correct sorting algorithm.
17741         * testsuite/common_test_1.c: New file.
17742         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
17743         (common_test_1_SOURCES): New variable.
17744         (common_test_1_DEPENDENCIES): New variable.
17745         (common_test_1_LDFLAGS): New variable.
17746
17747         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
17748         and commons_ correctly when NAME/VERSION does not override
17749         NAME/NULL.
17750         * testsuite/ver_test_6.c: New file.
17751         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
17752         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
17753         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
17754
17755 2008-03-26  Ian Lance Taylor  <iant@google.com>
17756
17757         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
17758         of an undefined symbol from a version script.
17759         * testsuite/Makefile.am (ver_test_5.so): New target.
17760         (ver_test_5.o): New target.
17761         (check_SCRIPTS): Add ver_test_5.sh.
17762         (check_DATA): Add ver_test_5.syms.
17763         (ver_test_5.syms): New target.
17764         * testsuite/ver_test_5.cc: New file.
17765         * testsuite/ver_test_5.script: New file.
17766         * testsuite/ver_test_5.sh: New file.
17767         * Makefile.in, testsuite/Makefile.in: Rebuild.
17768
17769         PR gold/5986
17770         Fix problems building gold with gcc 4.3.0.
17771         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
17772         (gold_error_at_location, gold_warning_at_location): Use it.
17773         * configure.ac: Check whether we can compile and use a template
17774         function with a printf attribute.
17775         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
17776         when jumping over bytes.
17777         * object.cc: Instantiate Object::read_section_data.
17778         * debug.h: Include <cstring>
17779         * dwarf_reader.cc: Include <algorithm>
17780         * main.cc: Include <cstring>.
17781         * options.cc: Include <cstring>.
17782         * output.cc: Include <cstring>.
17783         * script.cc: Include <cstring>.
17784         * script.h: Include <string>.
17785         * symtab.cc: Include <cstring> and <algorithm>.
17786         * target-select.cc: Include <cstring>.
17787         * version.cc: Include <string>.
17788         * testsuite/testmain.cc: Include <cstdlib>.
17789         * configure, config.in: Rebuild.
17790
17791 2008-03-25  Ian Lance Taylor  <iant@google.com>
17792
17793         * options.cc: Include "../bfd/bfdver.h".
17794         (options::help): Print bug reporting address.
17795
17796         * version.cc (print_version): Adjust output for current value of
17797         BFD_VERSION_STRING.
17798
17799         * NEWS: New file.
17800
17801         * options.cc (options::help): Print list of supported targets.
17802         * target-select.h: Include <vector>.
17803         (class Target_selector): Make machine_, size_, and is_big_endian_
17804         fields const.  Add bfd_name_ and instantiated_target_ fields.
17805         (Target_selector::Target_selector): Add bfd_name parameter.
17806         (Target_selector::recognize): Make non-virtual, call
17807         do_recognize.
17808         (Target_selector::recognize_by_name): Make non-virtual, call
17809         do_recognize_by_name.
17810         (Target_selector::supported_names): New function.
17811         (Target_selector::bfd_name): New function.
17812         (Target_selector::do_instantiate_target): New pure virtual
17813         function.
17814         (Target_selector::do_recognize): New virtual function.
17815         (Target_selector::do_recognize_by_name): New virtual function.
17816         (Target_selector::instantiate_target): New private function.
17817         (supported_target_names): Declare.
17818         * target-select.cc (Target_selector::Target_selector): Update for
17819         new parameter and fields.
17820         (select_target_by_name): Check that the name matches before
17821         calling recognize_by_name.
17822         (supported_target_names): New function.
17823         * i386.cc (class Target_selector_i386): Update Target_selector
17824         constructor call.  Remove recognize and recognize_by_name.  Add
17825         do_instantiate_target.
17826         * x86_64.cc (class Target_selector_x86_64): Likewise.
17827         * testsuite/testfile.cc (class Target_selector_test): Update for
17828         changes to Target_selector.
17829
17830         * README: Rewrite, with some notes on unsupported features.
17831
17832 2008-03-24  Cary Coutant  <ccoutant@google.com>
17833
17834         * i386.cc (Target_i386::Got_type): New enum declaration.
17835         (Target_i386::Scan::local): Updated callers of Output_data_got
17836         member functions.
17837         (Target_i386::Scan::global): Likewise.
17838         (Target_i386::Relocate::relocate): Likewise.
17839         (Target_i386::Relocate::relocate_tls): Likewise.
17840         * object.h (Got_offset_list): New class.
17841         (Sized_relobj::local_has_got_offset): Added got_type parameter.
17842         (Sized_relobj::local_got_offset): Likewise.
17843         (Sized_relobj::set_local_got_offset): Likewise.
17844         (Sized_relobj::local_has_tls_got_offset): Removed.
17845         (Sized_relobj::local_tls_got_offset): Removed.
17846         (Sized_relobj::set_local_tls_got_offset): Removed.
17847         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
17848         * output.cc (Output_data_got::add_global): Added got_type parameter.
17849         (Output_data_got::add_global_with_rel): Likewise.
17850         (Output_data_got::add_global_with_rela): Likewise.
17851         (Output_data_got::add_global_pair_with_rel): New function.
17852         (Output_data_got::add_global_pair_with_rela): New function.
17853         (Output_data_got::add_local): Added got_type parameter.
17854         (Output_data_got::add_local_with_rel): Likewise.
17855         (Output_data_got::add_local_with_rela): Likewise.
17856         (Output_data_got::add_local_pair_with_rel): New function.
17857         (Output_data_got::add_local_pair_with_rela): New function.
17858         (Output_data_got::add_global_tls): Removed.
17859         (Output_data_got::add_global_tls_with_rel): Removed.
17860         (Output_data_got::add_global_tls_with_rela): Removed.
17861         (Output_data_got::add_local_tls): Removed.
17862         (Output_data_got::add_local_tls_with_rel): Removed.
17863         (Output_data_got::add_local_tls_with_rela): Removed.
17864         * output.h (Output_data_got::add_global): Added got_type parameter.
17865         (Output_data_got::add_global_with_rel): Likewise.
17866         (Output_data_got::add_global_with_rela): Likewise.
17867         (Output_data_got::add_global_pair_with_rel): New function.
17868         (Output_data_got::add_global_pair_with_rela): New function.
17869         (Output_data_got::add_local): Added got_type parameter.
17870         (Output_data_got::add_local_with_rel): Likewise.
17871         (Output_data_got::add_local_with_rela): Likewise.
17872         (Output_data_got::add_local_pair_with_rel): New function.
17873         (Output_data_got::add_local_pair_with_rela): New function.
17874         (Output_data_got::add_global_tls): Removed.
17875         (Output_data_got::add_global_tls_with_rel): Removed.
17876         (Output_data_got::add_global_tls_with_rela): Removed.
17877         (Output_data_got::add_local_tls): Removed.
17878         (Output_data_got::add_local_tls_with_rel): Removed.
17879         (Output_data_got::add_local_tls_with_rela): Removed.
17880         * resolve.cc (Symbol::override_base_with_special): Removed
17881         reference to has_got_offset_ field.
17882         * symtab.cc (Symbol::init_fields): Replaced initialization
17883         of got_offset_ with got_offsets_.  Removed initialization
17884         of has_got_offset_
17885         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
17886         (Symbol::got_offset): Likewise.
17887         (Symbol::set_got_offset): Likewise.
17888         (Symbol::has_tls_got_offset): Removed.
17889         (Symbol::tls_got_offset): Removed.
17890         (Symbol::set_tls_got_offset): Removed.
17891         (Symbol::got_offset_): Removed.
17892         (Symbol::tls_mod_got_offset_): Removed.
17893         (Symbol::tls_pair_got_offset_): Removed.
17894         (Symbol::got_offsets_): New field.
17895         (Symbol::has_got_offset): Removed.
17896         (Symbol::has_tls_mod_got_offset): Removed.
17897         (Symbol::has_tls_pair_got_offset): Removed.
17898         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
17899         (Target_x86_64::Scan::local): Updated callers of Output_data_got
17900         member functions.
17901         (Target_x86_64::Scan::global): Likewise.
17902         (Target_x86_64::Relocate::relocate): Likewise.
17903         (Target_x86_64::Relocate::relocate_tls): Likewise.
17904
17905 2008-03-25  Ben Elliston  <bje@au.ibm.com>
17906
17907         * yyscript.y: Fix spelling error in comment.
17908
17909 2008-03-24  Ian Lance Taylor  <iant@google.com>
17910
17911         * options.h (class General_options): Define build_id option.
17912         * layout.h (class Layout): Declare write_build_id, create_note,
17913         create_build_id.  Add build_id_note_ member.
17914         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
17915         "libiberty.h", "md5.h", "sha1.h".
17916         (Layout::Layout): Initialize eh_frame_data_,
17917         eh_frame_hdr_section_, and build_id_note_.
17918         (Layout::finalize): Call create_build_id.
17919         (Layout::create_note): New function, broken out of
17920         Layout::create_gold_note.
17921         (Layout::create_gold_note): Call create_note.
17922         (Layout::create_build_id): New function.
17923         (Layout::write_build_id): New function.
17924         (Close_task_runner::run): Call write_build_id.
17925
17926         * x86_64.cc: Correct license to GPLv3.
17927
17928 2008-03-23  Ian Lance Taylor  <iant@google.com>
17929
17930         * options.cc: Include "demangle.h".
17931         (parse_optional_string): New function.
17932         (parse_long_option): Handle takes_optional_argument.
17933         (parse_short_option): Update dash_z initializer.  Handle
17934         takes_optional_argument.
17935         (General_options::General_options): Initialize do_demangle_.
17936         (General_options::finalize): Set do_demangle_.  Handle demangling
17937         style.
17938         * options.h (parse_optional_string): Declare.
17939         (struct One_option): Add optional_arg field.  Update constructor.
17940         Update call constructor calls.  Add takes_optional_argument
17941         function.
17942         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
17943         (DEFINE_optional_string): Define.
17944         (General_options::demangle): Change from DEFINE_bool to
17945         DEFINE_optional_string.
17946         (General_options::no_demangle): New function.
17947         (General_options::do_demangle): New function.
17948         (General_options::set_do_demangle): New function.
17949         (General_options::execstack_status_): Move definition to end of
17950         class definition.
17951         (General_options::static_): Likewise.
17952         (General_options::do_demangle_): New field.
17953         * object.cc (big_endian>::get_symbol_location_info): Call
17954         Options::do_demangle, not Options::demangle.
17955         * symtab.cc (demangle): Likewise.
17956
17957 2008-03-22  Ian Lance Taylor  <iant@google.com>
17958
17959         * gold.h: Include <cstddef> and <sys/types.h>
17960         * options.h: Include <cstring>.
17961
17962 2008-03-21  Ian Lance Taylor  <iant@google.com>
17963
17964         * Added source code to GNU binutils.
17965 \f
17966 Copyright (C) 2008-2015 Free Software Foundation, Inc.
17967
17968 Copying and distribution of this file, with or without modification,
17969 are permitted in any medium without royalty provided the copyright
17970 notice and this notice are preserved.
17971
17972 Local Variables:
17973 mode: change-log
17974 left-margin: 8
17975 fill-column: 74
17976 version-control: never
17977 End: