a08b4252e7daa4a15401288fcc0fa33755213f81
[external/binutils.git] / gold / ChangeLog
1 2015-11-09  Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
2
3         * layout.h (Layout::is_debug_info_section): Recognize .pdr debug
4         sections.
5
6 2015-11-09  Cary Coutant  <ccoutant@gmail.com>
7             Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
8
9         * copy-relocs.h (Copy_relocs::copy_reloc): Replace reloc parameter
10         with type, offset, addend.
11         (Copy_relocs::save): Likewise.
12         * copy-relocs.cc (Copy_relocs::copy_reloc): Likewise.
13         (Copy_relocs::save): Likewise.
14         * aarch64.cc (Target_aarch64::copy_reloc): Pass r_type, r_offset,
15         and r_addend to Copy_relocs::copy_reloc.
16         * arm.cc (Target_arm::copy_reloc): Likewise.
17         * i386.cc (Target_i386::copy_reloc): Likewise.
18         * mips.cc (Target_mips::copy_reloc): Likewise.
19         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
20         * s390.cc (Target_s390::copy_reloc): Likewise.
21         * sparc.cc (Target_sparc::copy_reloc): Likewise.
22         * tilegx.cc (Target_tilegx::copy_reloc): Likewise.
23         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
24
25 2015-11-05  Cary Coutant  <ccoutant@gmail.com>
26
27         PR gold/19119
28         PR gold/19172
29         PR gold/19197
30         Revert commit 6457197210144f50a696097c0d308d81d46d5510:
31         2015-10-16  H.J. Lu  <hongjiu.lu@intel.com>
32                 * options.h (General_options): Remove "obsolete" from -m.
33                 * parameters.cc (set_parameters_target): Check if input target
34                 is compatible with output emulation set by "-m emulation".
35
36 2015-11-05  Cary Coutant  <ccoutant@gmail.com>
37
38         PR gold/19163
39         * aarch64.cc (Target_aarch64::Relocate::relocate): Don't apply
40         certain relocations if --no-apply-dynamic-relocs is set.
41         * options.h (--apply-dynamic-relocs): New aarch64-specific option.
42
43 2015-11-03  Alan Modra  <amodra@gmail.com>
44
45         * po/POTFILES.in: Regenerate.
46
47 2015-10-30  Nick Clifton  <nickc@redhat.com>
48
49         * po/zh_CN.po: New (simplified) Chinese translation.
50
51 2015-10-29  H.J. Lu  <hongjiu.lu@intel.com>
52
53         PR gold/19184
54         * incremental.cc (Got_plt_view_info): Add got_entry_size.
55         (Local_got_offset_visitor::visit): Replace got_entry_size_
56         with info_.got_entry_size.
57         (Local_got_offset_visitor::got_entry_size_): Removed.
58         (Global_got_offset_visitor::visit): Replace got_entry_size_
59         with info_.got_entry_size.
60         (Global_got_offset_visitor::got_entry_size_): Removed.
61         (Output_section_incremental_inputs::write_got_plt): Initialize
62         view_info.got_entry_size.
63         * target.h (Sized_target::got_entry_size): New virtual function.
64         * x86_64.cc (Target_x86_64::got_entry_size): New function.
65
66 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
67
68         * testsuite/binary_test.cc: Add __attribute__((aligned(1))).
69         * testsuite/script_test_12a.c: Likewise.
70         * testsuite/script_test_1a.cc: Likewise.
71         * testsuite/script_test_2.cc: Likewise.
72
73 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
74
75         * testsuite/debug_msg.sh: Accept more fuzz in line numbers.
76
77 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
78
79         PR gold/18959
80         * stringpool.cc (Stringpool_template::new_key_offset): Align all
81         strings, even zero-length.
82         (Stringpool_template::set_string_offsets): Likewise.
83
84 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
85
86         * s390.cc: New file.
87         * Makefile.am (TARGETSOURCES): Add s390.cc.
88         (ALL_TARGETOBJS): Add s390.o.
89         * Makefile.in: Regenerate.
90         * configure.ac: Add s390 support.
91         * configure: Regenerate.
92         * configure.tgt: Add s390-*-* and s390x-*-*.
93         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Add s390
94         support.
95
96 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
97
98         * archive.cc (Archive::sym64name): New const.
99         (Archive::setup): Add support for SYM64 armap.
100         (Archive::read_armap): Likewise.
101         (Archive::interpret_header): Likewise.
102         (Archive::const_iterator::read_next_header): Likewise.
103         * archive.h (Archive::sym64name): New const.
104         (Archive::read_armap): Add mapsize template parameter.
105
106 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
107
108         * dynobj.cc (Dynobj::create_elf_hash_table): Create hash table with
109         target-specific entry size.
110         (Dynobj::sized_create_elf_hash_table): Add size template parameter.
111         * dynobj.h (Dynobj::sized_create_elf_hash_table): Likewise.
112         * layout.cc (Layout::create_dynamic_symtab): Set entsize to
113         hash_entry_size.
114         * target.h (Target::hash_entry_size): New method.
115         (Target::Target_info::hash_entry_size): New data member.
116
117         * aarch64.cc (Target_aarch64::aarch64_info): Add hash_entry_size.
118         * arm.cc (Target_arm::arm_info): Likewise.
119         (Target_arm_nacl::arm_nacl_info): Likewise.
120         * i386.cc (Target_i386::i386_info): Likewise.
121         (Target_i386_nacl::i386_nacl_info): Likewise.
122         (Target_iamcu::iamcu_info): Likewise.
123         * mips.cc (Target_mips::mips_info): Likewise.
124         (Target_mips_nacl::mips_nacl_info): Likewise.
125         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
126         * sparc.cc (Target_sparc::sparc_info): Likewise.
127         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
128         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
129         (Target_x86_64_nacl::x86_64_nacl_info): Likewise.
130         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
131
132 2015-10-28  H.J. Lu  <hongjiu.lu@intel.com>
133
134         PR gold/19177
135         * i386.cc (Target_i386::Relocate::relocate): Check R_386_GOT32
136         and R_386_GOT32X relocations without base register.
137
138 2015-10.27  Han Shen  <shenhan@google.com>
139
140         PR gold/19042 - unsupported reloc 311/312.
141
142         * aarch64.cc (Target_aarch64::Scan::local): Add support for
143         reloc 311/312.
144
145 2015-10-22  H.J. Lu  <hongjiu.lu@intel.com>
146
147         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
148         Treat R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX the same
149         as R_X86_64_GOTPCREL.
150         (Target_x86_64<size>::Scan::local): Likewise.
151         (Target_x86_64<size>::Scan::possible_function_pointer_reloc):
152         Likewise.
153         (Target_x86_64<size>::Scan::global): Likewise.
154         (Target_x86_64<size>::Relocate::relocate): Likewise.
155         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
156         Likewise.
157
158 2015-10-22  H.J. Lu  <hongjiu.lu@intel.com>
159
160         * i386.cc (Target_i386::Scan::get_reference_flags(): Treat
161         R_386_GOT32X the same as R_386_GOT32.
162         (Target_i386::Scan::local): Likewise.
163         (Target_i386::Scan::possible_function_pointer_reloc): Likewise.
164         (Target_i386::Scan::global): Likewise.
165         (Target_i386::Relocate::relocate): Likewise.
166         (Target_i386::Relocatable_size_for_reloc::get_size_for_reloc):
167         Likewise.
168
169 2015-10-20  H.J. Lu  <hongjiu.lu@intel.com>
170
171         * testsuite/Makefile.am (x86_64_mov_to_lea11): Replace
172         x86_64_mov_to_lea1.o with x86_64_mov_to_lea2.o.
173         (x86_64_mov_to_lea12): Replace x86_64_mov_to_lea2.o with
174         x86_64_mov_to_lea1.o.
175         * testsuite/Makefile.in: Regenerated.
176
177 2015-10-16  H.J. Lu  <hongjiu.lu@intel.com>
178
179         PR gold/19119
180         * options.h (General_options): Remove "obsolete" from -m.
181         * parameters.cc (set_parameters_target): Check if input target
182         is compatible with output emulation set by "-m emulation".
183
184 2015-10-13  H.J. Lu  <hongjiu.lu@intel.com>
185
186         PR gold/19118
187         * i386.cc (Target_iamcu): New class.
188         (Target_selector_iamcu): Likewise.
189         (Target_iamcu::iamcu_info): New variable.
190         (target_selector_iamcu): Likewise.
191
192 2015-10-07  Andreas Schwab  <schwab@suse.de>
193
194         * aarch64.cc (aarch64_info): Set abi_pagesize to 64K.
195
196 2015-10-06  Cary Coutant  <ccoutant@gmail.com>
197
198         PR gold/18855
199         * sparc.cc (Sparc_relocate_functions::gdop_hix22): Remove addend
200         parameter.
201         (Sparc_relocate_functions::gdop_lox10): Likewise.
202         (Target_sparc::Relocate::relocate): Use addend when computing
203         symbol value for R_SPARC_GOTDATA_OP*.
204
205 2015-09-07  Cary Coutant  <ccoutant@gmail.com>
206
207         PR gold/18930
208         PR gold/18886
209         * resolve.cc (Symbol::override_base): Don't convert IFUNC symbols here.
210         * symtab.cc (Symbol_table::add_from_dynobj): Convert them here instead.
211
212 2015-09-02  H.J. Lu  <hongjiu.lu@intel.com>
213
214         PR gold/18886
215         * resolve.cc (Symbol::override_base): Turn IFUNC symbols from
216         shared libraries into normal FUNC symbols.
217         * symtab.cc (Symbol_table::sized_write_symbol): Assert IFUNC
218         symbols aren't from shared libraries.
219
220 2015-09-02  Alan Modra  <amodra@gmail.com>
221
222         PR 18878
223         * powerpc.cc (Target_powerpc): Add savres_section_ and accessor.
224         (Target_powerpc::Branch_info::make_stub): Determine whether long
225         branch stub is for save/restore function.
226         (Branch_stub_ent): Add save_res_, and extra parm to constructor.
227         (Stub_table): Add need_save_res_.
228         (Stub_table:clear_stubs): Clear need_save_res_.
229         (Stub_table:set_address_and_size): Add save/restore section size.
230         (Stub_table::add_long_branch_entry): Add save_res param.  Set
231         need_save_res_, but don't add space for save/restore stubs.
232         (Stub_table::find_long_branch_entry): Return offset to local copy
233         of save/restore func.
234         (Stub_table::do_write): Don't output save/restore stubs.  Instead
235         copy the save/restore functions.
236         (Output_data_save_res:contents): New accessor.
237         (Target_powerpc::define_save_restore_funcs): Set savres_section_.
238
239 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
240
241         PR gold/18847
242         * script-sections.cc (Memory_region::set_address): New method.
243         (Script_sections::find_memory_region): Add explicit_only parameter.
244         (Output_section_definition::set_section_addresses): Handle case where
245         script specifies both address and vma region.
246         * script-sections.h (Script_sections::find_memory_region): Add
247         explicit_only parameter.
248
249 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
250
251         PR gold/18859
252         * object.cc (Input_objects::add_object): Store objects in a map,
253         indexed by soname; update as-needed flag when necessary.
254         * object.h (Object::clear_as_needed): New method.
255         (Input_objects::so_names_): Change from set to map.
256
257 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
258
259         PR gold/14746
260         * expression.cc (Expression::Expression_eval_info): Add
261         is_valid_pointer field.
262         (Expression::eval_maybe_dot): Add is_valid_pointer parameter.
263         Adjust all callers.
264         (Addr_expression::value_from_output_section): Check whether address
265         is valid.
266         * script.cc (Symbol_assignment::set_if_absolute): Defer assignment
267         if evaluation failed due to address that is not yet valid.
268         * script.h: (Expression::eval_maybe_dot): Add is_valid_pointer
269         parameter.
270
271 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
272
273         PR gold/18866
274         PR gold/18703
275         * symtab.cc (Symbol_table): Reorder conditions to avoid internal error.
276
277 2015-08-20  Alan Modra  <amodra@gmail.com>
278
279         PR gold/18846
280         * target-reloc.h (relocate_relocs <RELOC_ADJUST_FOR_SECTION_RELA>):
281         Subtract os->address() from addend.
282         * powerpc.cc (relocate_relocs): Likewise.
283
284 2015-08-12  Simon Dardis  <simon.dardis@imgtec.com>
285
286         * mips.cc (plt0_entry_o32, plt0_entry_n32, plt0_entry_n64,
287         lazy_stub_normal_1, lazy_stub_normal_1_n64,
288         lazy_stub_normal_2, lazy_stub_normal_2_n64, lazy_stub_big,
289         lazy_stub_big_n64, lazy_stub_micromips32_normal_1_n64,
290         lazy_stub_micromips32_normal_2_n64, lazy_stub_micromips32_big,
291         lazy_stub_micromips32_big_n64): Update to use 'or' for move instead
292         of 'addu/daddu'.
293
294 2015-07-27  H.J. Lu  <hongjiu.lu@intel.com>
295
296         * configure: Regenerated.
297
298 2015-07-26  Doug Kwan  <dougkwan@google.com>
299
300         * testsuite/arm_unaligned_reloc.{s,sh}: Make test less sensitive to
301           disassembler output format.
302
303 2015-07-23  Ian Coolidge  <icoolidge@google.com>
304         Plumb --pic-veneer option for gold.
305
306         * arm.cc (Reloc_stub::stub_type_for_reloc): Plumb to stub
307         generation.
308         * options.h (General_options): Add --pic-veneer option.
309
310 2015-07-22  H.J. Lu  <hongjiu.lu@intel.com>
311
312         PR gold/18663
313         * testsuite/Makefile.am (script_test_1_SOURCES): Set to
314         script_test_1a.cc script_test_1b.cc.
315         (script_test_11_r.o): Replace script_test_11.o with
316         script_test_11a.o script_test_11b.o.
317         (script_test_11.o): Removed.
318         (script_test_11a.o): New.
319         (script_test_11b.o): Likewise.
320         * testsuite/Makefile.in: Regenerated.
321         * testsuite/script_test_1.h: New file.
322         * testsuite/script_test_1b.cc: Likewise.
323         * testsuite/script_test_11.h: Likewise.
324         * testsuite/script_test_11b.c: Likewise.
325         * testsuite/script_test_1.cc: Renamed to ...
326         * testsuite/script_test_1a.cc: This.
327         Include "script_test_1.h".
328         (main): Call check_int and check_ptr.
329         * testsuite/script_test_11.c: Renamed to ...
330         * testsuite/script_test_11a.c: This.
331         Include "script_test_11.h".
332         (main): Call ptr_equal.
333
334 2015-07-22  H.J. Lu  <hongjiu.lu@intel.com>
335
336         PR gold/18628
337         * testsuite/ifuncdep2.c (global): Change protected to hidden.
338         * testsuite/ifuncmod1.c (global): Likewise.
339         * testsuite/ifuncmod5.c (global): Likewise.
340
341 2015-07-22  Alan Modra  <amodra@gmail.com>
342
343         * aarch64.cc (try_fix_erratum_843419_optimized): Warning fix.
344
345 2015-07-21  Cary Coutant  <ccoutant@gmail.com>
346
347         PR gold/18548
348         * symtab.cc (Symbol_table::do_define_in_output_data): Check for
349         forced local symbol even when oldsym != NULL.
350         (Symbol_table::do_define_in_output_segment): Likewise.
351         (Symbol_table::do_define_as_constant): Likewise.
352
353 2015-07-21  Cary Coutant  <ccoutant@gmail.com>
354
355         PR gold/18698
356         * archive.cc (Library_base::should_include_member): Don't use entry
357         point for relocatable links, or if target is not yet valid.
358         * parameters.cc (Parameters::entry): Check target_valid().
359
360 2015-07-20  Han Shen  <shenhan@google.com>
361
362         Optimize erratum 843419 fix.
363
364         * aarch64.cc (AArch64_insn_utilities::is_adr): New method.
365         (AArch64_insn_utilities::aarch64_adr_encode_imm): New method.
366         (AArch64_insn_utilities::aarch64_adrp_decode_imm): New method.
367         (E843419_stub): New sub-class of Erratum_stub.
368         (AArch64_relobj::try_fix_erratum_843419_optimized): New method.
369         (AArch64_relobj::section_needs_reloc_stub_scanning): Try optimized fix.
370         (AArch64_relobj::create_erratum_stub): Add 1 argument.
371         (Target_aarch64::scan_erratum_843419_span): Pass in adrp insn offset.
372
373 2015-07-20  Han Shen  <shenhan@google.com>
374
375         Fix arm elf header flags wrt hardfp bit.
376
377         * arm.cc (Target_arm::do_adjust_elf_header): Set flags into view.
378
379 2015-07-20  H.J. Lu  <hongjiu.lu@intel.com>
380
381         PR gold/18689
382         * layout.cc (Layout::layout): Clear the SHF_COMPRESSED flag bit
383         from input group section for relocatable link.
384         * testsuite/Makefile.am (check_SCRIPTS): Add pr18689.sh.
385         (check_DATA): Add pr18689.stdout.
386         (MOSTLYCLEANFILES): Add pr18689a.o pr18689b.o.
387         (pr18689.stdout): New rule.
388         (pr18689a.o): Likewise.
389         (pr18689b.o): Likewise.
390         (pr18689.o): Likewise.
391         * testsuite/pr18689.c: New file.
392         * testsuite/pr18689.sh: Likewise.
393         * testsuite/Makefile.in: Regenerated.
394
395 2015-07-20  Yiran Wang  <yiran@google.com>
396         Cary Coutant  <ccoutant@gmail.com>
397
398         PR gold/15574
399         * resolve.cc (Symbol_table): Remove warning about references
400         from shared objects to hidden symbols.
401         * testsuite/Makefile.am (hidden_test): Add hidden_test.syms.
402         * testsuite/Makefile.in: Regenerate.
403         * testsuite/hidden_test.sh: Check dynamic symbol table; update
404         expected error messages.
405
406 2015-07-14  H.J. Lu  <hongjiu.lu@intel.com>
407
408         * compressed_output.cc (Output_compressed_section::set_final_data_size):
409         Make --compress-debug-sections=zlib the same as
410         --compress-debug-sections=zlib-gabi.
411         * testsuite/Makefile.am (flagstest_compress_debug_sections.check):
412         Expect ".debug_.*" with the SHF_COMPRESSED bit, instead of
413         ".zdebug_".
414         * testsuite/Makefile.in: Regenerated.
415
416 2015-07-12  H.J. Lu  <hongjiu.lu@intel.com>
417
418         PR gold/18322
419         * compressed_output.cc (zlib_compress): Add argument for
420         compression header size.  Set header size to compression header
421         size if it isn't 0.  Don't write out the zlib header here.
422         (Output_compressed_section::set_final_data_size): Support
423         zlib-gnu and zlib-gabi compressions.  Pass compression header
424         size to zlib_compress and write out compression header.  Set
425         the SHF_COMPRESSED bit for zlib-gabi compression.  Otherwise
426         clear the SHF_COMPRESSED bit
427         * options.h (compress_debug_sections): Add zlib-gnu and
428         zlib-gabi.
429         * output.h (Output_section::set_flags): New.
430         * testsuite/Makefile.am (check_PROGRAMS): Add
431         flagstest_compress_debug_sections_none,
432         flagstest_compress_debug_sections_gnu and
433         flagstest_compress_debug_sections_gabi.
434         (check_DATA): Add flagstest_compress_debug_sections_none.stdout.
435         flagstest_compress_debug_sections.stdout,
436         flagstest_compress_debug_sections.cmp,
437         flagstest_compress_debug_sections.check,
438         flagstest_compress_debug_sections_gnu.stdout,
439         flagstest_compress_debug_sections_gnu.cmp,
440         flagstest_compress_debug_sections_gnu.check,
441         flagstest_compress_debug_sections_gabi.stdout,
442         flagstest_compress_debug_sections_gabi.cmp and
443         flagstest_compress_debug_sections_gabi.check.
444         (flagstest_compress_debug_sections_none): New.
445         (flagstest_compress_debug_sections_none.stdout): Likewise.
446         (flagstest_compress_debug_sections.stdout): Likewise.
447         (flagstest_compress_debug_sections.check): Likewise.
448         (flagstest_compress_debug_sections.cmp): Likewise.
449         (flagstest_compress_debug_sections_gnu): Likewise.
450         (flagstest_compress_debug_sections_gnu.stdout): Likewise.
451         (flagstest_compress_debug_sections_gnu.check): Likewise.
452         (flagstest_compress_debug_sections_gnu.cmp): Likewise.
453         (flagstest_compress_debug_sections_gabi): Likewise.
454         (flagstest_compress_debug_sections_gabi.stdout): Likewise.
455         (flagstest_compress_debug_sections_gnu.check): Likewise.
456         (flagstest_compress_debug_sections_gnu.cmp): Likewise.
457         * testsuite/Makefile.in: Regenerated.
458
459 2015-07-12  H.J. Lu  <hongjiu.lu@intel.com>
460
461         PR gold/18321
462         * compressed_output.h (decompress_input_section): Add arguments
463         for ELF class, big endian and sh_flags.
464         * compressed_output.cc (decompress_input_section): Likewise.
465         Support the SHF_COMPRESSED section.
466         * dynobj.h (Dynobj): Add elfsize and is_big_endian member
467         functions.
468         * plugin.h (Pluginobj): Likewise.
469         * layout.cc (Layout::get_output_section_flags): Also clear the
470         SHF_COMPRESSED bit.
471         * object.h (Compressed_section_info): Add flag to store sh_flags.
472         (Object): Add pure virtual elfsize and is_big_endian member
473         functions.
474         * object.cc (need_decompressed_section): Don't skip the ".zdebug"
475         prefix here.
476         (build_compressed_section_map): Check SHF_COMPRESSED for
477         uncompressed size.  Store sh_flags in Compressed_section_info.
478         Pass size, big_endian and sh_flags to decompress_input_section.
479         Skip the ".debug"/".zdebug" prefix when passing section name to
480         need_decompressed_section.
481         (Sized_relobj_file<size, big_endian>::do_find_special_section):
482         Don't check ".zdebug_*" sections.
483         (Object::decompressed_section_contents): Pass ELF class, big
484         endian and sh_flags to decompress_input_section.
485         * reloc.cc (Sized_relobj_file<size, big_endian>::write_sections):
486         Likewise.
487         * testsuite/Makefile.am (check_DATA): Add
488         debug_msg_cdebug_gabi.err and gdb_index_test_2_gabi.stdout.
489         (MOSTLYCLEANFILES): Add debug_msg_cdebug_gabi.err and
490         gdb_index_test_2_gabi.stdout.
491         (debug_msg_cdebug_gabi.o): New.
492         (odr_violation1_cdebug_gabi.o): Likewise.
493         (odr_violation2_cdebug_gabi.o): Likewise.
494         (debug_msg_cdebug_gabi.err): Likewise.
495         (check_SCRIPTS): Add gdb_index_test_2_gabi.sh.
496         (gdb_index_test_cdebug_gabi.o): Likewise.
497         (gdb_index_test_2_gabi): Likewise.
498         (gdb_index_test_2_gabi.stdout): Likewise.
499         * testsuite/gdb_index_test_2_gabi.sh: New file.
500         * testsuite/Makefile.in: Regenerated.
501
502 2015-07-09  Han Shen  <shenhan@google.com>
503
504         Use "gold_info" instead of "gold_warning" for erratum fix.
505
506         * aarch64.cc (Target_aarch64::scan_erratum_843419_span): Use
507         'gold_info'.
508         (Target_aarch64::scan_erratum_835769_span): USe 'gold_info'.
509
510 2015-07-09  Han Shen  <shenhan@google.com>
511
512         Drop missing symbol warning for arm/aarch64.
513
514         * aarch64.cc (AArch64_relobj::scan_errata): Drop missing symbol warning.
515         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Drop missing
516         symbol warning.
517
518 2015-07-07  Han Shen  <shenhan@google.com>
519
520         Make gold aarch64 accept long form of mapping symbols.
521
522         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Make legal
523         of mapping symbols.
524
525 2015-06-29  Doug Kwan  <dougkwan@google.com>
526
527         * testsuite/arm_bl_out_of_range.s: Align stub table so that it appears
528           at address expected by test.
529         * testsuite/arm_cortex_a8_b.s: Ditto.
530         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
531         * testsuite/arm_cortex_a8_bl.s: Ditto.
532         * testsuite/arm_cortex_a8_blx.s: Ditto.
533         * testsuite/arm_cortex_a8_local.s: Ditto.
534         * testsuite/arm_fix_v4bx.s: Ditto.
535         * testsuite/arm_unaligned_reloc.s: Ditto.
536         * testsuite/thumb_bl_out_of_range.s: Ditto.
537         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
538         * testsuite/thumb_blx_out_of_range.s: Ditto.
539
540 2015-06-29  Han Shen  <shenhan@google.com>
541
542         Patch for erratum 843419 internal error.
543
544         * aarch64.cc (Erratum_stub::Insn_utilities): New typedef.
545         (Erratum_stub::update_erratum_insn): New method.
546         (Stub_table::relocate_stubs): Modified to place relocated insn.
547         (AArch64_relobj::fix_errata): Modified gold_assert.
548
549 2015-06-12  Han Shen  <shenhan@google.com>
550
551         Fix erratum 835769.
552
553         * aarch64.cc (AArch64_insn_utilities::BYTES_PER_INSN): Move
554         defintion outside class definition.
555         (AArch64_insn_utilities::AARCH64_ZR): New static constant.
556         (AArch64_insn_utilities::aarch64_op31): New member.
557         (AArch64_insn_utilities::aarch64_ra): New member.
558         (AArch64_insn_utilities::aarch64_mac): New member.
559         (AArch64_insn_utilities::aarch64_mlxl): New member.
560         (ST_E_835769): New global enum member.
561         (Stub_table::relocate_stubs): Add 835769 handler.
562         (Stub_template_repertoire::Stub_template_repertoire): Install new
563         stub type.
564         (AArch64_relobj::scan_errata): This func is renamed from
565         scan_erratum_843419.
566         (AArch64_relobj::do_count_local_symbols): Add 835769 handler.
567         (AArch64_relobj::do_relocate_sections): Add 835769 handler.
568         (AArch64_relobj::scan_sections_for_stubs): Add 835769 handler.
569         (Target_aarch64::scan_erratum_835769_span): New method.
570         (Target_aarch64::create_erratum_stub): New method.
571         (Target_aarch64::is_erratum_835769_sequence): New method.
572         (Target_aarch64::scan_erratum_843419_sequence): Move part of the
573         code into create_erratum_stub.
574         * options.h (fix_cortex_a53_835769): New option.
575
576 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
577
578         * aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
579         outside class body.
580         (Reloc_stub::STUB_ADDR_ALIGN): Likewise.
581
582 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
583
584         PR gold/17731
585         * layout.cc (corresponding_uncompressed_section_name): New function.
586         (Layout::choose_output_section): Call it.
587         * layout.h (corresponding_uncompressed_section_name): New function.
588         * script-sections.cc (Input_section_info::set_section_name): Check
589         for compressed debug section (.zdebug style).
590
591 2015-06-11  Jing Yu  <jingyu@google.com>
592
593         * testsuite/Makefile.am: Add -O0 for script_test_12 test.
594         * testsuite/Makefile.in: Regenerate.
595
596 2015-06-11  Davide Italiano  <dccitaliano@gmail.com>
597
598         * gold.h (is_cident): Correct typo.
599
600 2015-06-10  Han Shen  <shenhan@google.com>
601         Patch for erratum-843419 (2 of 2 - fix erratum occurrences).
602
603         Now fixing for 843419 is fully functional.
604
605         The first part of the erratum fix CL is here -
606         https://sourceware.org/ml/binutils/2015-04/msg00229.html
607
608         * aarch64.cc(global enum): New constants representing stub types.
609         (Stub_template): New POD struct.
610         (Stub_template_repertoire): New class.
611         (Stub_base): New class.
612         (Erratum_stub): New class.
613         (Reloc_stub): Refactored to be a subclass of Stub_base.
614         (Reloc_stub::Stub_type): Removed.
615         (Reloc_stub::offset): Moved to Stub_base.
616         (Reloc_stub::set_offset): Moved to Stub_base.
617         (Reloc_stub::destination_address): Moved to Stub_base.
618         (Reloc_stub::set_destination_address): Moved to Stub_base.
619         (Reloc_stub::reset_destination_address): Moved to Stub_base.
620         (Reloc_stub::stub_type): Renamed and moved to Stub_base.
621         (Reloc_stub::stub_size): Renamed and moved to Stub_base.
622         (Reloc_stub::stub_insns): Renamed and moved to Stub_base.
623         (Reloc_stub::write): Moved to Stub_base.
624         (Reloc_stub::invalid_offset): Moved to Stub_base.
625         (Reloc_stub::invalid_address): Moved to Stub_base.
626         (Reloc_stub::stub_type_): Renamed and moved to Stub_base.
627         (Reloc_stub::stub_insns_): Moved to Stub_base.
628         (Reloc_stub::offset_): Moved to Stub_base.
629         (Reloc_stub::destination_address_): Moved to Stub_base.
630         (Stub_table::The_aarch64_relobj): New typedef.
631         (Stub_table::The_erratum_stub): New typedef.
632         (Stub_table::The_erratum_stub_less): New typedef.
633         (Stub_table::The_erratum_stub_set): New typedef.
634         (Stub_table::The_erratum_stub_set_iter): New typedef.
635         (Stub_table::empty): Added emptiness testing for erratum stubs.
636         (Stub_table::add_erratum_stub): New method to add an erratum stub.
637         (Stub_table::find_erratum_stub): New method.
638         (Stub_table::find_erratum_stubs_for_input_section): New method.
639         (Stub_table::erratum_stub_address): New method.
640         (Stub_table::update_date_size_changed_p): Modified to handle erratum stubs.
641         (Stub_table::do_addralign): Modified to handle erratum stubs.
642         (Stub_table::erratum_stubs_): New member.
643         (Stub_table::erratum_stub_size_): New member.
644         (Stub_table::relocate_stubs): Modified to handle erratum stubs.
645         (Stub_table::do_write): Modified to handle erratum stubs.
646         (AArch64_relobj::The_erratum_stub): New typedef.
647         (AArch64_relobj::Erratum_stub_set_iter): New typedef.
648         (AArch64_relobj::fix_errata): New method.
649         (Target_aarch64::The_reloc_stub_type): Removed.
650         (Target_aarch64::The_erratum_stub): New typede.
651         (AArch64_relocate_functions::construct_b): New method.
652
653 2015-06-08  Nick Clifton  <nickc@redhat.com>
654
655         * po/fr.po: New French Translation.
656
657 2015-06-07  Cary Coutant  <ccoutant@gmail.com>
658
659         PR gold/18288
660         * resolve.cc (symbol_to_bits): Remove type parameter; adjust all
661         callers. Don't use STT_COMMON to check for common symbols.
662         (Symbol_table::resolve): Warn if relocatable object has STT_COMMON
663         symbol that's not in a common section.
664         * symtab.h (Symbol::is_common): Don't use STT_COMMON to check for
665         common symbols.
666
667 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
668
669         PR gold/18200
670         * Makefile.am (diststuff): Add target.
671         * Makefile.in: Regenerate.
672
673 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
674
675         PR gold/17498
676         * object.cc (Sized_relobj_file::do_count_local_symbols): Discard
677         temporary locals in merge sections.
678         * options.cc (General_options::parse_discard_all): New method.
679         (General_options::parse_discard_locals): New method.
680         (General_options::parse_discard_none): New method.
681         (General_options::General_options): Initialize discard_locals_.
682         * options.h (--discard-all): Convert to special option.
683         (--discard-locals): Likewise.
684         (--discard-none): New option.
685         (General_options::discard_all): New method.
686         (General_options::discard_locals): New method.
687         (General_options::discard_sec_merge): New method.
688         (General_options::Discard_locals): New enum.
689         (General_options::discard_locals_): New data member.
690
691 2015-06-03  Cary Coutant  <cary@google.com>
692
693         * script-sections.cc (Script_sections::Script_sections): Initialize
694         segments_created_.
695         (Script_sections::create_note_and_tls_segments): Set flag when
696         segments are created.
697         (Script_sections::expected_segment_count): Count PT_INTERP.
698         (Script_sections::attach_sections_using_phdrs_clause): Set flag when
699         segments are created.
700         * script-sections.h (Script_sections::segments_created_): New data
701         member.
702
703 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
704
705         PR gold/15370
706         * script-sections.cc
707         (Output_section_element_input::set_section_addresses): When there
708         are several patterns with no sort spec, put all sections in the same
709         bin.
710         * testsuite/Makefile.am (script_test_12): New testcase.
711         (script_test_12i): New testcase.
712         * testsuite/Makefile.in: Regenerate.
713         * testsuite/script_test_12.t: New test linker script.
714         * testsuite/script_test_12i.t: New test linker script.
715         * testsuite/script_test_12a.c: New test source file.
716         * testsuite/script_test_12b.c: New test source file.
717
718 2015-06-02  Cary Coutant  <ccoutant@gmail.com>
719
720         * nacl.h (Sniff_file): Switch parameters to get_view to get an
721         aligned view.
722
723 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
724
725         PR gold/17819
726         * gold.cc (queue_final_tasks): When --build-id=tree, queue a
727         separate task to schedule the build id computation.
728         * layout.cc (Hash_task::Hash_task): Remove build_id_blocker,
729         add Output_file and offset.
730         (Hash_task::run): Get and release the input views.
731         (Hash_task::is_runnable): Always return NULL (always runnable).
732         (Layout::queue_build_id_tasks): Remove.
733         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
734         parameters; use them instead of class members.
735         (Build_id_task_runner::run): New function.
736         (Close_task_runner::run): Pass array_of_hashes and size_of_hashes
737         to write_build_id.
738         * layout.h (Layout::queue_build_id_tasks): Remove.
739         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
740         parameters.
741         (Layout::array_of_hashes_): Remove.
742         (Layout::size_of_array_of_hashes_): Remove.
743         (Layout::input_view_): Remove.
744         (Build_id_task_runner): New class.
745         (Close_task_runner::Close_task_runner): Add array_of_hashes and
746         size_of_hashes parameters.
747         (Close_task_runner::array_of_hashes_): New data member.
748         (Close_task_runner::size_of_hashes_): New data member.
749         * testsuite/Makefile.am
750         (flagstest_compress_debug_sections_and_build_id_tree): New test.
751         * testsuite/Makefile.in: Regenerate.
752
753 2015-06-01  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
754
755         * merge.cc (get_input_merge_map): Update for data structure change.
756         (get_or_make_input_merge_map): Update for data structure change.
757         * merge.h (Object_merge_map): Use a std::vector<std::pair>> instead of
758         a std::map. Remove first_shnum_, first_map_, second_shnum_, second_map_.
759
760 2015-05-16  Alan Modra  <amodra@gmail.com>
761
762         * reloc.cc (Sized_relobj_file::find_functions): Use function_location.
763         * powerpc.cc (Target_powerpc::do_calls_non_split): New function.
764         (addi_12_1, addis_2_12, addis_12_1, cmpld_7_12_0): New constants.
765         (lis_0): Rename from lis_0_0.
766
767 2015-04-29  Cary Coutant  <cary@google.com>
768             Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
769
770         * gc.h (Garbage_collection::is_section_garbage): Change Object*
771         to Relobj*.
772         (Garbage_collection::add_reference): Likewise.
773         (Garbage_collection::gc_process_relocs): Likewise. Don't push
774         object/shndx pair onto *secvec for dynamic objects. Don't follow
775         relocations pointing to dynamic objects for GC.
776         * icf.cc (Icf::find_identical_sections): Change Object* to Relobj*.
777         (Icf::unfold_section): Likewise.
778         (Icf::is_section_folded): Likewise.
779         (Icf::get_folded_section): Likewise.
780         * icf.h: (Icf::get_folded_section): Likewise.
781         (Icf::unfold_section): Likewise.
782         (Icf::is_section_folded): Likewise.
783         (Icf::section_has_function_pointers): Likewise.
784         (Icf::set_section_has_function_pointers): Likewise.
785         * object.h (Section_id): Likewise.
786         (Const_section_id): Likewise.
787         * output.cc (Output_section::update_section_layout): Likewise.
788         * output.h: (Output_section_lookup_maps::find_relaxed_input_section):
789         Likewise.
790         * plugin.cc (update_section_order): Likewise.
791         (unique_segment_for_sections): Likewise.
792         * powerpc.cc (Powerpc_relobj::add_reference): Likewise.
793         (Target_powerpc::do_gc_add_reference): Likewise.
794         (Target_powerpc::gc_process_relocs): Likewise.
795         (Target_powerpc::do_gc_add_reference): Likewise.
796         * symtab.cc (Symbol_table::is_section_folded): Likewise.
797         (Symbol_table::gc_mark_symbol): Likewise.
798         * symtab.h: (Symbol_table::is_section_folded): Likewise.
799         * target.h: (Sized_target::gc_add_reference): Likewise.
800         (Sized_target::do_gc_add_reference): Likewise.
801
802 2015-04-29  Nick Clifton  <nickc@redhat.com>
803
804         * po/fi.po: Updated Finnish translation.
805
806 2015-04-28  Alan Modra  <amodra@gmail.com>
807
808         * powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather
809         than unsigned int for find_global_entry result temp.  Compare
810         against invalid_address.
811         (Target_powerpc::do_plt_address_for_global): Likewise.
812         (Target_powerpc::Relocate::relocate): Likewise.  Don't assert
813         on plt call stub existence for debug info.  Do assert for plt
814         and global entry stub existence if an alloc section.
815
816 2015-04-28  Alan Modra  <amodra@gmail.com>
817
818         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert
819         on missing global entry stub due to bogus debug info.
820
821 2015-04-27  Han Shen  <shenhan@google.com>
822
823         * options.h (--fix-cortex-a53-843419): Rename option.
824         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Use renamed
825         option.
826         (AArch64_relobj::scan_sections_for_stubs): Use renamed option.
827
828 2015-04-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
829
830         PR gold/18327
831         * output.cc (Output_section::is_input_address_mapped): Assume a missing
832         entry is mapped.
833         * testsuite/Makefile.am: Add the eh_test test.
834         * testsuite/Makefile.in: Regenerate.
835         * testsuite/eh_test_a.cc: New test.
836         * testsuite/eh_test_b.cc: New test.
837
838 2015-04-23  Sriraman Tallam  <tmsriram@google.com>
839
840         * options.h (--weak-unresolved-symbols): New option.
841         * symtab.cc (Symbol_table::sized_write_globals): Change symbol
842         binding to weak with new option.
843         * symtab.h (is_weak_undefined): Check for new option.
844         (is_strong_undefined): Check for new option.
845         * testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
846         * testsuite/Makefile.in: Regenerate.
847         * testsuite/weak_unresolved_symbols_test.cc: New file.
848
849 2015-04-20  Ian Coolidge  <icoolidge@google.com>
850
851         * symtab.cc (Symbol::should_add_dynsym_entry): Return true for
852         GNU_UNIQUE.
853
854 2015-04-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
855
856         * gc.cc (Garbage_collection::do_transitive_closure): Use back and
857         push_back.
858         * gc.h (Garbage_collection): Use a std::vector instead of a std::queue.
859         * object.cc (Sized_relobj_file::do_layout): Use push_back.
860         * powerpc.cc (process_gc_mark): Use push_back.
861         (Target_powerpc::do_gc_mark_symbol): Use push_back.
862         * symtab.cc (Symbol_table::gc_mark_symbol): Use push_back.
863
864 2015-04-16  Han Shen  <shenhan@google.com>
865
866         * aarch64.cc (AArch64_insn_utilities): New utility class.
867         (AArch64_relobj::Mapping_symbol_position): New struct.
868         (AArch64_relobj::Mapping_symbol_info): New typedef.
869         (AArch64_relobj::do_count_local_symbols): New function overriding
870         parent's implementation.
871         (AArch64_relobj::mapping_symbol_info_): New member
872         (AArch64_relobj::scan_erratum_843419): New method.
873         (Target_aarch64::scan_erratum_843419_span): New method.
874         (Target_aarch64::is_erratum_843419_sequence): New method.
875         * options.h (fix_cortex_a53): New option.
876
877 2015-04-09  Cary Coutant  <ccoutant@google.com>
878
879         * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
880         in a PIE link.
881         * testsuite/Makefile.am (tls_pie_test.sh): New test.
882         * testsuite/Makefile.in: Regenerate.
883         * testsuite/tls_pie_test.sh: New.
884
885 2015-04-09  Cary Coutant  <ccoutant@google.com>
886
887         * debug.h (DEBUG_LOCATION): New.
888         (DEBUG_ALL): Include DEBUG_LOCATION.
889         (debug_string_to_enum): Add DEBUG_LOCATION.
890         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
891         output to print correct context.
892         (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
893         up to 4 more locations at the beginning of the function.
894         * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
895         result before sorting list of line numbers.
896         * testsuite/debug_msg.sh: Allow range of line numbers for
897         canonical results on optimized code.
898
899 2015-04-07  HC Yen <hc.yen@mediatek.com>
900
901         Add AArch32 support for gold linker.
902         gold/
903         * arm.cc: Add V8 arch combine table.
904
905 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
906
907         * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
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 call
912         to find by using the return value of insert.
913
914 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
915
916         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
917         constructor call.
918
919 2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>
920
921         PR gold/17641
922         * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
923         (Target_x86_64::Scan::local): Don't create GOT entry, when we
924         can convert mov to lea.
925         (Target_x86_64::Scan::global): Ditto.
926         (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
927         %reg to lea foo(%rip), %reg if possible.
928         * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
929         * testsuite/x86_64_mov_to_lea1.s: New.
930         * testsuite/x86_64_mov_to_lea2.s: Ditto.
931         * testsuite/x86_64_mov_to_lea3.s: Ditto.
932         * testsuite/x86_64_mov_to_lea4.s: Ditto.
933         * testsuite/x86_64_mov_to_lea.sh: Ditto.
934
935 2015-04-02  H.J. Lu  <hongjiu.lu@intel.com>
936
937         * configure: Regenerated.
938
939 2015-04-01  Ilya Tocar  <ilya.tocar@intel.com>
940
941         PR gold/17640
942         * i386.cc (Target_i386::can_convert_mov_to_lea): New.
943         (Target_i386::Scan::local): Don't create GOT entry, when we
944         can convert GOT to GOTOFF.
945         (Target_i386::Scan::global): Ditto.
946         (Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
947         lea foo@GOTOFF(%reg), %reg if possible.
948         * testsuite/Makefile.am (i386_mov_to_lea): New test.
949         * testsuite/i386_mov_to_lea1.s: New.
950         * testsuite/i386_mov_to_lea2.s: Ditto.
951         * testsuite/i386_mov_to_lea3.s: Ditto.
952         * testsuite/i386_mov_to_lea4.s: Ditto.
953         * testsuite/i386_mov_to_lea5.s: Ditto.
954         * testsuite/i386_mov_to_lea.sh: Ditto.
955
956 2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>
957
958         * Makefile.am (ZLIB): New.
959         (ZLIBINC): Likewise.
960         (AM_CFLAGS): Add $(ZLIBINC).
961         (AM_CXXFLAGS): Likewise.
962         (ldadd_varldadd_var): Add $(ZLIB).
963         (incremental_dump_LDADD): Likewise.
964         (dwp_LDADD): Likewise.
965         * compressed_output.cc: Don't check HAVE_ZLIB_H to include
966         <zlib.h>.
967         (zlib_compress): Don't check HAVE_ZLIB_H.
968         (zlib_decompress): Likewise.
969         * options.h (compress_debug_sections): Likewise.
970         * configure.ac (AM_CONDITIONAL): Removed.
971         * testsuite/Makefile.am (ZLIB): New.
972         (LDADD): Add $(ZLIB).
973         Don't check HAVE_ZLIB.
974         * Makefile.in: Regenerated.
975         * config.in: Likewise.
976         * configure: Likewise.
977         * testsuite/Makefile.in: Likewise.
978
979 2015-03-30  Jing Yu  <jingyu@google.com>
980
981         * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
982         TLSLD_ADD_DTPREL_LO12_NC.
983         * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
984         _TLS_MODULE_BASE_ point to the start of tls segment.
985         (Target_aarch64::optimize_tls_reloc): Add cases for
986         R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
987         R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
988         (Target_aarch64::Scan::local): Likewise.
989         (Target_aarch64::Scan::global): Likewise.
990         (Target_aarch64::Relocate::relocate): Likewise.
991         (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
992         subtracting tls segment size from symbol value for TLSLD_*_DTPREL
993         relocations.
994
995 2015-03-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
996
997         * merge.cc (Object_merge_map::add_mapping): call
998         Object_merge_map::Input_merge_map::add_mapping.
999         (Object_merge_map::Input_merge_map::add_mapping): New.
1000         (Output_merge_data::do_add_input_section): Call
1001         get_or_make_input_merge_map before a loop.
1002         (Output_merge_string<Char_type>::finalize_merged_data): Call
1003         get_or_make_input_merge_map before a loop.
1004         * merge.h (Object_merge_map): Make Input_merge_map public.
1005         * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
1006         (Relobj::get_or_create_merge_map): New.
1007         * object.h (Relobj::get_or_create_merge_map): New.
1008
1009 2015-03-24  Alan Modra  <amodra@gmail.com>
1010
1011         PR 18147
1012         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
1013         relocation errors for branches to strong undefined symbols.
1014
1015 2015-03-23  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1016
1017         * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
1018         (Object_merge_map::is_merge_section_for): Remove.
1019         (Object_merge_map::find_merge_section): New.
1020         * merge.h (Object_merge_map::is_merge_section_for): Remove.
1021         (Object_merge_map::find_merge_section): New.
1022         (Object_merge_map::get_input_merge_map): Add a const version.
1023         * object.cc (Relobj::is_merge_section_for): Remove.
1024         (Relobj::find_merge_section): New.
1025         * object.h (Relobj::is_merge_section_for): Remove.
1026         (Relobj::find_merge_section): New.
1027         * output.cc
1028         (Output_section::Input_section::is_merge_section_for): Remove.
1029         (Output_section::add_merge_input_section): Don't call
1030         add_merge_input_section.
1031         (Output_section::find_merge_section): Return const. Use
1032         object->find_merge_section.
1033         (Output_section::build_lookup_maps): Don't build a map for
1034         merge sections.
1035         (Output_section::is_input_address_mapped): Return false if
1036         section is not found.
1037         (Output_section::find_starting_output_address): Use
1038         find_merge_section instead of is_merge_section_for.
1039         (Output_section::add_script_input_section):  Don't build a map for
1040         merge sections.
1041         * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
1042         (Output_section_lookup_maps::find_merge_section): Remove.
1043         (Output_section_lookup_maps::add_merge_input_section) Remove.
1044         (Output_section::find_merge_section): Return const.
1045
1046 2015-03-22  Cary Coutant  <cary@google.com>
1047
1048         PR gold/18106
1049         * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
1050         non-SIB form of lea, with nop after the call.
1051
1052 2015-03-21  Cary Coutant  <cary@google.com>
1053
1054         PR gold/14217
1055         * output.cc (Output_segment::is_first_section_relro): Don't ignore
1056         .tdata section.
1057         (Output_segment::set_section_addresses): Don't align size of relro
1058         segment for .tbss.
1059
1060 2015-03-21  Cary Coutant  <cary@google.com>
1061
1062         PR gold/18010
1063         * stringpool.cc (Stringpool_template): Don't optimize if section
1064         alignment is greater than sizeof(char).
1065
1066 2015-03-21  Cary Coutant  <cary@google.com>
1067
1068         PR gold/18048
1069         * script-c.h (script_include_directive): Add first_token parameter.
1070         * script.cc (script_include_directive): Add first_token parameter, and
1071         pass it to read_script_file.
1072         * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
1073         (PARSING_MEMORY_DEF): New tokens.
1074         (top): Add new productions for INCLUDE files.
1075         (file_cmd): Replace file_or_sections_cmd with copy of its productions.
1076         Pass PARSING_LINKER_SCRIPT to script_include_directive.
1077         (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
1078         (section_cmd): Pass PARSING_SECTION_CMDS.
1079         (file_or_sections_cmd): Remove.
1080         (memory_def): Pass PARSING_MEMORY_DEF.
1081         * testsuite/Makefile.am (memory_test_2): New test.
1082         * testsuite/Makefile.in: Regenerate.
1083         * testsuite/memory_test_inc.t: New script file.
1084         * testsuite/memory_test_inc_1.t.src: New script file.
1085         * testsuite/memory_test_inc_2.t.src: New script file.
1086         * testsuite/memory_test_inc_3.t.src: New script file.
1087
1088 2015-03-21  Cary Coutant  <cary@google.com>
1089
1090         * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
1091         (Sized_relobj_dwo::setup): Build compressed section map.
1092         (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
1093         * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
1094         section map.
1095         * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
1096         compressed_sections_ field.
1097         (build_compressed_section_map): Take Object instead of
1098         Sized_relobj_file parameter; add decompress_if_needed parameter.
1099         (Sized_relobj_file::do_find_special_sections): Store compressed
1100         section map in parent Object.
1101         (Sized_relobj_file::do_decompressed_section_contents): Move
1102         implementation to Object::decompressed_section_contents.
1103         (Sized_relobj_file::do_discard_decompressed_sections): Move
1104         implementation to Object::discard_decompressed_sections.
1105         * object.h (build_compressed_section_map): Declare.
1106         (Object::Object): Add compressed_sections_ field.
1107         (Object::section_is_compressed): Move implementation here.
1108         (Object::decompressed_section_contents): De-virtualize.
1109         (Object::discard_decompressed_sections): De-virtualize.
1110         (Object::do_section_is_compressed): Delete.
1111         (Object::do_decompressed_section_contents): Delete.
1112         (Object::set_compressed_sections): New method.
1113         (Object::compressed_sections): New method.
1114         (Object::compressed_sections_): New data member.
1115         (Compressed_section_info, Compressed_section_map): Move to top of file.
1116         (Sized_relobj_file::do_section_is_compressed): Delete.
1117         (Sized_relobj_file::do_decompressed_section_contents): Delete.
1118         (Sized_relobj_file::do_discard_decompressed_sections): Delete.
1119         (Sized_relobj_file::compressed_sections_): Move to Object class.
1120
1121 2015-03-21  Cary Coutant  <ccoutant@google.com>
1122
1123         PR gold/18152
1124         * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
1125         deferred objects.
1126
1127 2015-03-11  Cary Coutant  <ccoutant@google.com>
1128
1129         * options.cc (General_options::finalize): Don't allow -z relro
1130         with incremental linking.
1131         * testsuite/Makefile.am (incremental_test): Add -z norelro.
1132         (incremental_test_2): Likewise.
1133         (incremental_test_3): Likewise.
1134         (incremental_test_4): Likewise.
1135         (incremental_test_5): Likewise.
1136         (incremental_test_6): Likewise.
1137         (incremental_copy_test): Likewise.
1138         (incremental_common_test_1): Likewise.
1139         (incremental_comdat_test_1): Likewise.
1140         * testsuite/Makefile.in: Regenerate.
1141
1142 2015-03-09  Cary Coutant  <ccoutant@google.com>
1143
1144         PR gold/14675
1145         * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
1146         return enum indicating whether .eh_frame section is empty, optimizable,
1147         unrecognized, or an end marker. Adjust explicit instantiations.
1148         * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
1149         (Eh_frame::add_ehframe_input_section): Change return type.
1150         * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
1151         * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
1152         to the .eh_frame output section until we see the end marker.
1153         (Layout::finalize_eh_frame_section): New.
1154         * layout.h: (Layout::finalize_eh_frame_section): New.
1155
1156 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
1157
1158         * output.cc (Relobj::initialize_input_to_output_map<size>):
1159         Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
1160
1161 2015-03-04  Cary Coutant  <ccoutant@google.com>
1162
1163         * parameters.cc (Parameters::set_target_once): Call
1164         Target::select_as_default_target just once from here...
1165         (set_parameters_target): ...instead of from here.
1166
1167 2015-03-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1168
1169         * ehframe.cc (Cie::set_output_offset): Pass in and use a
1170         Output_section_data instead of a Merge_map.
1171         (Eh_frame::Eh_frame): Don't initialize merge_map_.
1172         (Eh_frame::read_cie): Use add_merge_mapping instead of
1173         Merge_map::add_mapping.
1174         (Eh_frame::read_fde): Ditto.
1175         (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
1176         (Eh_frame::do_output_offset): Use merge_output_offset istead of
1177         merge_map_->get_output_offset.
1178         (Eh_frame::do_is_merge_section_for): Delete.
1179         * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
1180         instead of a Merge_map.
1181         (Cie::set_output_offset): Pass in a Output_section_data instead of a
1182         Merge_map.
1183         (Eh_frame::do_is_merge_section_for): Delete.
1184         (Eh_frame::merge_map_): Delete.
1185         * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
1186         and use a Output_section_data instead of a Merge_map.
1187         (Object_merge_map::add_mapping): Ditto.
1188         (Object_merge_map::get_output_offset): Remove the merge_map argument.
1189         (Object_merge_map::is_merge_section_for): Pass in and use a
1190         Output_section_data instead of a Merge_map.
1191         (Merge_map): Delete.
1192         (Output_merge_base::do_output_offset): Use merge_output_offset instead
1193         of merge_map_.get_output_offset.
1194         (Output_merge_base::do_is_merge_section_for): Delete.
1195         (Output_merge_data::do_add_input_section): Use
1196         object->add_merge_mapping instead of add_mapping.
1197         (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
1198         * merge.h (Merge_map): Delete forward declaration.
1199         (Object_merge_map::add_mapping): Pass in and use a Output_section_data
1200         instead of a Merge_map.
1201         (Object_merge_map::get_output_offset): Remove the merge_map argument.
1202         (Object_merge_map::is_merge_section_for): Pass in and use a
1203         Output_section_data instead of a Merge_map.
1204         (Input_merge_map::Object_merge_map::merge_map): Replace with
1205         output_data.
1206         (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
1207         Output_section_data instead of a Merge_map.
1208         (Merge_map): Delete.
1209         (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
1210         (Output_merge_base::do_is_merge_section_for): Delete.
1211         (Output_merge_base::add_mapping): Delete.
1212         (Output_merge_base::merge_map_): Delete.
1213         * object.cc (Relobj::initialize_input_to_output_map): New.
1214         (Relobj::initialize_input_to_output_map): New.
1215         (Relobj::merge_output_offset): New.
1216         (Relobj::is_merge_section_for): New.
1217         (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
1218         bits.
1219         * object.h (Relobj::merge_map): Delete.
1220         (initialize_input_to_output_map): New.
1221         (set_merge_map): Delete.
1222         (add_merge_mapping): New.
1223         (merge_output_offset): New.
1224         (is_merge_section_for): New.
1225         * output.cc (Output_section::Input_section::is_merge_section_for):
1226         Use object->is_merge_section_for.
1227         * output.h (Output_section_data::is_merge_section_for): Delete.
1228         (Output_section_data::do_is_merge_section_for): Delete.
1229         * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
1230         Use object->initialize_input_to_output_map.
1231         (Merged_symbol_value<size>::value_from_output_section): Use
1232         object->merge_output_offset.
1233
1234 2015-03-02  Peter Collingbourne  <pcc@google.com>
1235             Cary Coutant  <ccoutant@google.com>
1236
1237         * output.cc (Output_section::add_merge_input_section): Do not
1238         attempt to merge sections with an entsize of 0.
1239
1240 2015-03-02  Khem Raj  <raj.khem@gmail.com>
1241
1242         * attributes.h (class Output_attributes_section_data ): Add
1243         do_print_to_mapfile function.
1244
1245 2015-02-24  Alan Modra  <amodra@gmail.com>
1246
1247         PR 18010
1248         * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
1249         complain if value is not a multiple of four.
1250         (Target_powerpc::Relocate::relocate): Correct handling of
1251         R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
1252
1253 2015-02-21  H.J. Lu  <hongjiu.lu@intel.com>
1254
1255         * configure.ac (default_size): Set to 32 for x32.
1256         * configure: Regenerated.
1257
1258 2015-02-18  Alan Modra  <amodra@gmail.com>
1259
1260         PR 17954
1261         * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
1262         visibility.
1263
1264 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1265
1266         * gc.h (Garbage_collection::add_reference): Don't use find.
1267
1268 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1269
1270         * object.cc (write_local_symbols): avoid std::vector copy.
1271
1272 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1273
1274         * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
1275
1276 2015-02-09  Mark Wielaard  <mjw@redhat.com>
1277
1278         * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
1279         DW_LANG_Fortran03 and DW_LANG_Fortran08.
1280
1281 2015-02-16  Cary Coutant  <ccoutant@google.com>
1282
1283         PR gold/13577
1284         PR gold/16992
1285         * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
1286         DF_SYMBOLIC if --dynamic-list option is used.
1287         * options.cc (General_options::finalize): --dynamic-list is not
1288         mutually exclusive with -Bsymbolic.
1289         * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
1290         listed in --dynamic-list.
1291         * testsuite/Makefile.am (dynamic_list_lib2.so): Add
1292         -Bsymbolic-functions.
1293         * testsuite/Makefile.in: Regenerate.
1294
1295 2015-02-16  Cary Coutant  <ccoutant@google.com>
1296
1297         PR gold/17971
1298         * incremental.cc: Remove redundant include of "output.h".
1299
1300 2015-02-12  Jing Yu  <jingyu@google.com>
1301
1302         * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
1303         TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
1304         New relocation.
1305         * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
1306         TLSLE_MOVW_* relocations.
1307         (Target_aarch64::Scan::global): Likewise.
1308         (Target_aarch64::Relocate::relocate): Likewise.
1309         (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
1310         for new TLSLE_MOVW_* relocations.
1311
1312 2015-02-11  Will Newton  <will.newton@linaro.org>
1313
1314         PR gold/13321
1315         * arm.cc (Target_arm::make_plt_section): Create an ARM
1316         state mapping symbol at the start of the PLT.
1317
1318 2015-02-09  H.J. Lu  <hongjiu.lu@intel.com>
1319
1320         * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
1321         Replace two_file_shared_2.so with two_file_shared_1.so.
1322         * testsuite/Makefile.in: Regenerated.
1323
1324 2015-02-09  Alan Modra  <amodra@gmail.com>
1325
1326         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
1327         plugin_test_thin.a and defsym_test.
1328         * testsuite/Makefile.in: Regenerate.
1329
1330 2015-02-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1331
1332         * merge.cc (do_add_input_section): Combine loop epilogue into main loop
1333         body.
1334
1335 2015-02-04  Peter Collingbourne  <pcc@google.com>
1336
1337         * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
1338         forwarding symbols when computing symbol resolution info for plugins.
1339         * plugin.h (Plugin_manager::symtab): New method.
1340         (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
1341
1342 2015-02-03  Cary Coutant  <ccoutant@google.com>
1343             Peter Collingbourne  <pcc@google.com>
1344
1345         PR gold/15660
1346         * archive.cc (Thin_archive_object_unlocker): New class.
1347         (Archive::include_member): Unlock external members of thin archives.
1348         * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
1349         (plugin_test_2): Likewise.
1350         (plugin_test_3): Likewise.
1351         (plugin_test_4): Likewise.
1352         (plugin_test_5): Likewise.
1353         (plugin_test_6): Likewise.
1354         (plugin_test_7): Likewise.
1355         (plugin_test_8): Likewise.
1356         (plugin_test_9): Likewise.
1357         (plugin_test_10): Likewise.
1358         (plugin_test_11): New test case.
1359         * testsuite/Makefile.in: Regenerate.
1360         * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
1361         file to decide whether to claim file.
1362         (all_symbols_read_hook): Likewise.
1363         * testsuite/plugin_test_1.sh: Adjust expected output.
1364         * testsuite/plugin_test_2.sh: Likewise.
1365         * testsuite/plugin_test_3.sh: Likewise.
1366         * testsuite/plugin_test_6.sh: Likewise.
1367         * testsuite/plugin_test_tls.sh: Likewise.
1368         * testsuite/plugin_test_11.sh: New testcase.
1369
1370 2015-02-03  Cary Coutant  <ccoutant@google.com>
1371
1372         * descriptors.cc (Descriptors::open): Set artificially-low limit for
1373         file descriptors when debugging enabled. Add debug output.
1374         (Descriptors::release): Add debug output.
1375         (Descriptors::close_some_descriptor): Likewise.
1376         (Descriptors::close_all): Likewise.
1377         * fileread.cc (File_read::lock): Likewise.
1378         (File_read::unlock): Likewise.
1379
1380 2015-02-02  Cary Coutant  <ccoutant@google.com>
1381
1382         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
1383         executable output file.
1384
1385 2015-01-22  Han Shen  <shenhan@google.com>
1386
1387         * arm.cc (Target_arm::Target_arm): Add initialization for new members.
1388         (Target_arm::do_plt_address_for_global): New method.
1389         (Target_arm::do_plt_address_for_local): New method.
1390         (Target_arm::rel_irelative_section): New method.
1391         (Target_arm::make_data_plt): Add more parameters for plt ctor.
1392         (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
1393         (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
1394         (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
1395         (Target_arm::Scan::check_non_pic): Add ifunc support.
1396         (Target_arm::Scan::local): Add ifunc support.
1397         (Target_arm::Scan::global): Add ifunc support.
1398         (Target_arm::make_plt_section): New method.
1399         (Target_arm::make_plt_entry): Change to call to make_plt_section.
1400         (Target_arm::make_local_ifunc_plt_entry): New method.
1401         (Target_arm::got_irelative_): New member.
1402         (Target_arm::rel_irelative_): New member.
1403         (Target_arm::got_section): Add creation for got_irelative_.
1404         (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
1405         (Target_arm::Relocate::relocate): Properly set local ifunc address.
1406         (Target_arm::do_dynsym_value): Properly set global ifunc address.
1407         (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
1408         (Output_data_plt_arm::IRelative_data): New type.
1409         (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
1410         (Output_data_plt_arm::add_entry): Add more parameters.
1411         (Output_data_plt_arm::add_relocation): New method.
1412         (Output_data_plt_arm::add_local_ifunc_entry): New method.
1413         (Output_data_plt_arm::rel_irelative): New method.
1414         (Output_data_plt_arm::entry_count): Modified.
1415         (Output_data_plt_arm::address_for_global): New method.
1416         (Output_data_plt_arm::address_for_local): New method.
1417 gold/
1418         (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
1419         (Output_data_plt_arm::insert_irelative_data): New method.
1420         (Output_data_plt_arm::irelative_rel_): New member.
1421         (Output_data_plt_arm::got_): New member.
1422         (Output_data_plt_arm::got_irelative_): New member.
1423         (Output_data_plt_arm::irelative_count_): New member.
1424         (Output_data_plt_arm::IRelative_data_vec): New typedef.
1425         (Output_data_plt_arm::irelative_data_vec_): New member.
1426         (Output_data_plt_arm::do_write): Write out irelative entries.
1427         (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
1428         more parameters to ctor.
1429         (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
1430         more parameters to ctor.
1431         * output.h (Output_data_reloc::add_local_relative): New method.
1432         * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
1433
1434 2015-01-29  Alan Modra  <amodra@gmail.com>
1435
1436         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
1437         and GOT_TLSGD to LE optimization.
1438
1439 2015-01-28  Cary Coutant  <ccoutant@google.com>
1440
1441         * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
1442         for undef TLS symbols.
1443         (Target_x86_64::Relocate::relocate_tls): Likewise.
1444         (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
1445
1446 2015-01-25  Cary Coutant  <ccoutant@google.com>
1447
1448         * output.cc (Output_segment::set_section_addresses): Fix calculation
1449         of size of relro segment.
1450
1451 2015-01-22  Alan Modra  <amodra@gmail.com>
1452
1453         * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
1454         condition for need of ifunc plt entry.
1455         (Target_powerpc::Scan::global <got relocs>): Likewise.
1456
1457 2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1458
1459         * mips.cc (reloc_high): Add r_sym.
1460         (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
1461         reloc_high constructor.
1462         (Mips_relocate_functions::relgot16_local): Likewise.
1463         (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
1464         r_type to decide whether LO16 matches HI16.
1465         (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
1466         rello16 and relgot16_local.
1467
1468 2015-01-09  Cary Coutant  <ccoutant@google.com>
1469
1470         * layout.cc (Layout::set_segment_offsets): Don't align start of segment
1471         unless alignment is larger than page size.
1472
1473 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1474             Cary Coutant  <ccoutant@google.com>
1475
1476         PR gold/17729
1477         * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
1478         (DEFAULT_TARGET_X32): Set for x32.
1479         * x86_64.cc (cmp_insn_32): New.
1480         (lea_r10_insn_32): Likewise.
1481         (lea_r11_insn_32): Likewise.
1482         (cmp_insn_64): Likewise.
1483         (lea_r10_insn_64): Likewise.
1484         (lea_r11_insn_64): Likewise.
1485         (Target_x86_64<size>::do_calls_non_split): Handle x32.
1486         * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
1487         (check_DATA): Add split_x32 files.
1488         (split_x32_[1234n].o): New targets.
1489         (split_x32_[124]): New targets.
1490         (split_x32_[1234r].stdout): New targets.
1491         * testsuite/split_x32.sh: New file.
1492         * testsuite/split_x32_1.s: Likewise.
1493         * testsuite/split_x32_2.s: Likewise.
1494         * testsuite/split_x32_3.s: Likewise.
1495         * testsuite/split_x32_4.s: Likewise.
1496         * testsuite/split_x32_n.s: Likewise.
1497         * configure: Regenerated.
1498         * testsuite/Makefile.in: Likewise.
1499
1500 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1501
1502         PR gold/17809
1503         * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
1504         x32.
1505
1506 2015-01-02  Alan Modra  <amodra@gmail.com>
1507
1508         * version.cc (print_version): Just print current year.
1509         * dwp.cc (print_version): Likewise.
1510
1511 2015-01-01  Alan Modra  <amodra@gmail.com>
1512
1513         Update year range in copyright notice of all files.
1514
1515 2014-12-25  Alan Modra  <amodra@gmail.com>
1516
1517         * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
1518         new enums.
1519         (Target_arm::merge_object_attributes, ): Likewise.
1520
1521 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
1522
1523         * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
1524         as hard float only when Tag_ABI_VFP_args is 1, using new enum value
1525         AEABI_VFP_args_vfp to check that.
1526         (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
1527         value and replace hardcoded values by enum values.
1528
1529 2014-12-22  Cary Coutant  <ccoutant@google.com>
1530
1531         * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
1532
1533 2014-12-20  H.J. Lu  <hongjiu.lu@intel.com>
1534
1535         PR gold/14608
1536         * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
1537         to "return i * i * 3;".
1538
1539 2014-12-16  Cary Coutant  <ccoutant@google.com>
1540
1541         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
1542         (Mapfile::print_output_data): Use current_data_size() to avoid
1543         assert for sections requiring postprocessing; if address is not valid,
1544         print 0.
1545         (Mapfile::print_output_section): Use current_data_size(); print note
1546         that addresses and sizes are before compression.
1547
1548 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
1549
1550         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1551         Cast current_group_size to unsigned long when reporting error.
1552
1553 2014-12-10  Jing Yu  <jingyu@google.com>
1554
1555         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
1556         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
1557         Update error message.
1558         (Target_aarch64::do_relax): Use absolute value of option
1559         stub_group_size. Replace local variable with class member
1560         stub_group_size_.
1561
1562 2014-12-04  Alan Modra  <amodra@gmail.com>
1563
1564         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
1565         addend of PLTREL24 reloc when not generating a plt stub.  Make
1566         max_branch_offset an "Address".
1567         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
1568         (Target_powerpc::Relocate::relocate): Likewise.
1569
1570 2014-12-04  Alan Modra  <amodra@gmail.com>
1571
1572         PR 17670
1573         * symtab.cc (Symbol::set_undefined): Remove assertion.
1574         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1575         on symbols defined in discarded sections, instead return false.
1576         Rearrange params, update all callers.
1577         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
1578         branches to syms in discarded sections.
1579         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
1580         undefined and flag as discarded.
1581         (Target_powerpc::Relocate::relocate): Localize variable.
1582
1583 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
1584
1585         PR gold/17675
1586         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
1587         * testsuite/Makefile.in: Regenerated.
1588
1589 2014-12-03  Alan Modra  <amodra@gmail.com>
1590
1591         PR 17566
1592         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
1593         when adding dynamic relocations against section symbols.
1594
1595 2014-12-01  Dimitry Ivanov <dimitry@google.com>
1596
1597         * layout.cc (Layout::finish_dynamic_section): When '-z global'
1598         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
1599         * options.h (General_options): New -z option (global).
1600
1601 2014-12-01  Cary Coutant  <ccoutant@google.com>
1602
1603         PR gold/17578
1604         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
1605         is given.
1606         (Layout::create_executable_stack_info): Warn when -z noexecstack is
1607         given but some inputs require executable stack.
1608
1609 2014-11-26  Cary Coutant  <ccoutant@google.com>
1610
1611         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
1612         .debug_str_offsets; strip .debug_gnu_pubnames and
1613         .debug_gnu_pubtypes.
1614         (lines_only_debug_sections): Strip all four new sections.
1615
1616 2014-11-26  Jing Yu  <jingyu@google.com>
1617
1618         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
1619         register to be x0 when to relax TLSDESC_LD64_LO12.
1620
1621 2014-11-26  Alan Modra  <amodra@gmail.com>
1622
1623         * powerpc.cc (struct Stub_table_owner): New.
1624         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
1625         unsigned int vector.  Update all references.
1626         (powerpc_relobj::set_stub_table): Take an unsigned int param
1627         rather than a Stub_table.  Update callers.
1628         (Powerpc_relobj::clear_stub_table): New function.
1629         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
1630         stub_group_size_ vars.
1631         (Target_powerpc::new_stub_table): Delete.
1632         (max_branch_delta): New function, extracted from..
1633         (Target_powerpc::Relocate::relocate): ..here..
1634         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
1635         status on whether stub created successfully.
1636         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
1637         default sizing to..
1638         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
1639         reduce on relax failure.
1640         (Target_powerpc::group_sections): Add "no_size_errors" param.
1641         Use stub_group_size_.  Set up group info in a temp vector,
1642         before building Stub_table vector.  Account for input sections
1643         possibly already converted to relaxed sections.
1644         (Stub_table::init): Delete.  Merge into..
1645         (Stub_table::Stub_table): ..here.
1646         (Stub_table::can_reach_stub): New function.
1647         (Stub_table::add_plt_call_entry): Add "from" parameter and
1648         return true iff stub could be reached.
1649         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
1650         param too.
1651         (Stub_table::clear_stubs): Add "all" param.
1652
1653 2014-11-26  Alan Modra  <amodra@gmail.com>
1654
1655         * powerpc.cc (Stub_control::set_output_and_owner): New function.
1656         (Target_powerpc::group_sections): Use it.
1657
1658 2014-11-25  Cary Coutant  <ccoutant@google.com>
1659
1660         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
1661         (Binary_to_elf::write_symbol): Add st_size parameter.
1662         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
1663
1664 2014-11-25  Cary Coutant  <ccoutant@google.com>
1665
1666         PR gold/17639
1667         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
1668         (Sized_relobj_file::do_layout): Handle deferred sections properly
1669         during GC pass 1. Don't add reloc sections to deferred list twice.
1670         * object.h (Sized_relobj_file::is_deferred_layout): New function.
1671         (Sized_relobj_file::is_deferred_layout_): New data member.
1672
1673 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
1674
1675         PR gold/17619
1676         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
1677         Check PC-relative offset overflow in PLT entry.
1678
1679 2014-11-21  Alan Modra  <amodra@gmail.com>
1680
1681         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
1682         for undefined weaks.
1683
1684 2014-11-20  Alan Modra  <amodra@gmail.com>
1685
1686         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
1687         from --stub-group-size parameter divided by 1024.
1688         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
1689         template parameter.  Update all uses.
1690         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
1691         has_stub_value.  Set for long branches.  Don't report overflow for
1692         branch to undefined weak symbols.  Print info message on
1693         overflowing branch to stub.
1694
1695 2014-11-20  Alan Modra  <amodra@gmail.com>
1696
1697         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
1698
1699 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
1700
1701         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
1702         entry for R_X86_64_GOTPLT64.
1703         (Target_x86_64<size>::Relocate::relocate): Update comments for
1704         R_X86_64_GOTPLT64.
1705
1706 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
1707
1708         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
1709         * plugin.h: add lock definition
1710
1711 2014-10-29  Han Shen  <shenhan@google.com>
1712             Jing Yu   <jingyu@google.com>
1713
1714         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
1715         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1716         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
1717         Symbol::TLS_REF.
1718         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
1719         method.
1720         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
1721         (Target_aarch64::tls_ld_to_le): New method.
1722         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
1723         for 64bit targets.
1724         (Output_data_plt_aarch64::irelative_rel_): New data member.
1725         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
1726         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
1727         (Output_data_plt_aarch64::add_relocation): New method.
1728         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
1729         offset. Add got_irelative size to got size.
1730         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
1731         type string with the new typename.
1732         (AArch64_relocate_functions::update_adr): Replace parameter x with
1733         immed.
1734         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
1735         (AArch64_relocate_functions::reloc_common): New method.
1736         (AArch64_relocate_funcsions::rela_general): Extract common part out
1737         into reloc_common method.
1738         (AArch64_relocate_functions::rela_general): Likewise.
1739         (AArch64_relocate_functions::pcrela_general): Likewise.
1740         (AArch64_relocate_functions::adr): New method.
1741         (AArch64_relocate_functions::adrp): Calculate immed before calling
1742         update_adr.
1743         (AArch64_relocate_functions::adrp): Likewise.
1744         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
1745         comparing x to 0. Calculate immed from ~x when x < 0.
1746         (Target_aarch64::optimize_tls_reloc): Add new cases for
1747         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1748         TLSLD_MOVW_DTPREL_G0_NC.
1749         (Target_aarch64::possible_function_pointer_reloc): Implement this
1750         method.
1751         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
1752         comment.
1753         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
1754         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1755         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1756         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
1757         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1758         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1759         (Target_aarch64::make_plt_entry): Call add_entry with two more
1760         parameters.
1761         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1762         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
1763         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1764         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1765         (Target_aarch64::Relocate::relocate_tls): Add cases for
1766         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1767         TLSLD_MOVW_DTPREL_G0_NC.
1768         * testsuite/icf_safe_so_test.cc: Correct test comment.
1769         * testsuite/icf_safe_test.sh: Add AArch64 arch.
1770
1771 2014-10-22  Alan Modra  <amodra@gmail.com>
1772
1773         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
1774         thread_starter.
1775
1776 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
1777
1778         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
1779
1780 2014-10-17  Cary Coutant  <ccoutant@google.com>
1781
1782         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1783         Add "typename" keyword.
1784
1785 2014-10-15  Han Shen  <shenhan@google.com>
1786             Jing Yu   <jingyu@google.com>
1787
1788         Patch for gold aarch64 backend to support relaxation.
1789         * aarch64-reloc.def: Change format.
1790         * aarch64.cc (class Reloc_stub): New class.
1791         (class Stub_table): New class.
1792         (class AArch64_relobj): New class.
1793         (class AArch64_input_section): New class.
1794         (class AArch64_output_section): New class.
1795         (Target_aarch64::new_stub_table): New method.
1796         (Target_aarch64::new_aarch64_input_section): New method.
1797         (Target_aarch64::find_aarch64_input_section): New method.
1798         (Target_aarch64::scan_section_for_stubs): New method.
1799         (Target_aarch64::scan_reloc_section_for_stubs): New method.
1800         (Target_aarch64::relocate_stub): New method.
1801         (Target_aarch64::current_target): New method.
1802         (Target_aarch64::do_make_elf_object): New method.
1803         (Target_aarch64::do_may_relax): New method.
1804         (Target_aarch64::do_relax): New method.
1805         (Target_aarch64::group_sections): New method.
1806         (Target_aarch64::scan_reloc_for_stub): New method.
1807         (Target_aarch64::do_make_output_section): New method.
1808         (Target_aarch64::stub_tables_): New data member.
1809         (Target_aarch64::aarch64_input_section_map_): New data member.
1810         (AArch64_relocate_functions::maybe_apply_stub): New method.
1811
1812 2014-09-30  Cary Coutant  <ccoutant@google.com>
1813
1814         PR gold/17432
1815         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
1816
1817 2014-09-30  Kito Cheng  <kito@0xlab.org>
1818
1819         PR gold/13597
1820         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
1821         hash table before sysv-style hash table.
1822
1823 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
1824
1825         * options.h (--pic-executable): Add negative to alias to -no-pie.
1826
1827 2014-09-26  Cary Coutant  <ccoutant@google.com>
1828
1829         PR gold/16773
1830         * object.cc (Sized_relobj_file): Compute value of section symbols
1831         for TLS sections the same as TLS symbols.
1832
1833 2014-09-25  Cary Coutant  <ccoutant@google.com>
1834
1835         PR gold/17432
1836         * resolve.cc (Symbol_table::resolve): Override common placeholder
1837         symbols, but adjust sizes.
1838         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
1839         symbols to common lists.
1840
1841 2014-09-24  Alan Modra  <amodra@gmail.com>
1842
1843         * po/POTFILES.in: Regenerate.
1844
1845 2014-09-23  Taiju Tsuiki  <tzik@google.com>
1846             Cary Coutant  <ccoutant@google.com>
1847
1848         PR gold/14860
1849         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
1850         on input_sections_blocker.
1851         * layout.cc (Write_sections_task::locks): Unblock
1852         input_sections_blocker_.
1853         * layout.h (Write_sections_task::Write_sections_task): Add
1854         input_sections_blocker.
1855         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
1856         to DEPENDENCIES.
1857         * testsuite/Makefile.in: Regenerate.
1858
1859 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1860
1861         * testsuite/Makefile.am (plugin_test_10): New test.
1862         * testsuite/Makefile.in: Regenerate
1863         * testsuite/plugin_common_test_2.c (c1): Align to 8.
1864         * testsuite/plugin_test_10.sh: New file.
1865
1866 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1867
1868         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
1869         * resolve.cc (Symbol_table::resolve): Don't override common symbols
1870         during the replacement phase.
1871
1872 2014-09-17  Han Shen  <shenhan@google.com>
1873             Jing Yu  <jingyu@google.com>
1874
1875         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
1876         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
1877         * aarch64.cc (Target_aarch64): Add data members
1878         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
1879         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
1880         constructor.
1881         (Target_aarch64::do_reloc_symbol_index): New method.
1882         (Target_aarch64::do_reloc_addend): New method.
1883         (Target_aarch64::add_tlsdesc_info): New method.
1884         (Target_aarch64::do_dynsym_value): New method.
1885         (Target_aarch64::do_make_data_plt): Add new parameters: got,
1886         got_irelative. Pass them to Output_data_plt_aarch64_standard.
1887         (Target_aarch64::make_data_plt): Add new parameters: got,
1888         got_irelative. Pass them to do_make_data_plt.
1889         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
1890         (Target_aarch64::Relocate:tls_gd_to_le): New method.
1891         (Target_aarch64::Relocate:tls_ie_to_le): New method.
1892         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
1893         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
1894         (Target_aarch64::got_tlsdesc_section): New method.
1895         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1896         (Target_aarch64::define_tls_base_symbol): New method.
1897         (Target_aarch64::reserve_tlsdesc_entries): New method.
1898         (Target_aarch64::got_mod_index_entry): New method.
1899         (Target_aarch64::rela_tlsdesc_section): New method.
1900         (Target_aarch64::rela_irelative_section): New method.
1901         (Target_aarch64::Tlsdesc_info): New struct.
1902         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
1903         relocations and tlsdesc relocations.
1904         (Target_aarch64::optimize_tls_reloc): Implement method.
1905         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
1906         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
1907         in constructor.
1908         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
1909         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
1910         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
1911         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
1912         (Output_data_plt_aarch64::rela_tlsdesc): New method.
1913         (Output_data_plt_aarch64::rela_irelative): New method.
1914         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
1915         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
1916         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
1917         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
1918         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
1919         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
1920         (Output_data_plt_aarch64_standard): New member variables:
1921         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
1922         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
1923         New parameter: got, got_irelative.
1924         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
1925         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
1926         (Output_data_plt_aarch64::do_write): Replace got_address with
1927         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
1928         (AArch64_relocate_functions::update_movnz): New method.
1929         (AArch64_relocate_functions): Correct format.
1930         (AArch64_relocate_functions::movnz): New method.
1931         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
1932         before the switch. Add new cases to switch.
1933         Check ie_to_le relaxation on tlsie relocations. Add code handling
1934         tlsgd tlsdesc cases.
1935         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
1936         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
1937         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
1938         Call reloc_name_in_error_message to print unsupported reloc.
1939         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
1940         make_data_plt.
1941         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
1942         relocs. Fill in some more dynamic tags.
1943         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
1944         Skip call tls_get_addr when tlsgd is relaxed.
1945         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
1946         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
1947         tlsdesc->ie relaxation.
1948
1949 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1950
1951         * mips.cc (Target_mips_nacl): New class.
1952         (Target_selector_mips_nacl): New class.
1953         (target_selector_mips32): Rename from target_selector_mips32be and use
1954         Target_selector_mips_nacl instead of Target_selector_mips.
1955         (target_selector_mips32el): Rename from target_selector_mips32 and use
1956         Target_selector_mips_nacl instead of Target_selector_mips.
1957         (target_selector_mips64): Rename from target_selector_mips64be and use
1958         Target_selector_mips_nacl instead of Target_selector_mips.
1959         (target_selector_mips64el): Rename from target_selector_mips64 and use
1960         Target_selector_mips_nacl instead of Target_selector_mips.
1961         (Target_mips::mips_info): Add const attribute.
1962
1963 2014-09-02  Cary Coutant  <ccoutant@google.com>
1964
1965         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
1966         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
1967         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
1968         (Sized_incr_dynobj::do_section_name): Likewise.
1969         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
1970         (Sized_incr_dynobj::do_section_name): Likewise.
1971         * object.h (Object::section_name): Likewise.
1972         (Object::do_section_name): Likewise.
1973         (Sized_relobj_file::do_section_name): Likewise.
1974         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
1975         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
1976
1977 2014-09-02  Cary Coutant  <ccoutant@google.com>
1978
1979         PR gold/17005
1980         * ehframe.cc (Fde::write): Add output_offset parameter.
1981         (Cie::write): Likewise.
1982         (Eh_frame::set_final_data_size): Account for offset within output
1983         section.
1984         (Eh_frame::do_sized_write): Likewise.
1985         * ehframe.h (Fde::write): Add output_offset parameter.
1986         (Cie::write): Likewise.
1987         * output.cc (Output_section::Input_section_sort_entry): Remove
1988         section_has_name_; add output_section_name parameter. Use
1989         output section name for non-input sections.
1990         (Output_section::Input_section_sort_entry::section_has_name): Remove.
1991         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
1992         (Output_section::Input_section_sort_compare): Remove logic for
1993         sections without names.
1994         (Output_section::Input_section_sort_init_fini_compare): Likewise.
1995         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
1996         Likewise.
1997         (Output_section::Input_section_sort_section_name_compare): Likewise.
1998
1999 2014-08-29 Han Shen <shenhan@google.com>
2000            Jing Yu <jingyu@google.com>
2001
2002         * aarch64-reloc-property.cc
2003         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
2004         reference reloc property in the table.
2005         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
2006         3 other entries.
2007         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
2008         2 new overloaded methods.
2009         (Output_data_got_aarch64::do_write): Add code to write out
2010         static relocs.
2011         (class Output_data_got_aarch64::Static_reloc): New class to wrap
2012         static relocs.
2013         (Output_data_got_aarch64::static_relocs): New vector to
2014         hold static relocs.
2015         (Target_aarch64::TCB_SIZE): New const static memeber.
2016         (Target_aarch64::tcb_size): New method.
2017         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
2018         (Target_aarch64::Relocate::relocate_tls): New method.
2019         (Target_aarch64::Scan::local): Add code handling new reloc types.
2020         (Target_aarch64::Scan::global): Add code handling new reloc types.
2021
2022 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
2023
2024         * options.h (-no-pie): Add option.
2025
2026 2014-08-08  Jing Yu  <jingyu@google.com>
2027             Han Shen  <shenhan@google.com>
2028
2029         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
2030         (DEFFILES): add aarch64-reloc.def.
2031         (TARGETSOURCES): Add aarch64-reloc-property.cc.
2032         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
2033         * Makefile.in: Regenerate.
2034         * aarch64-reloc-property.cc: New file.
2035         * aarch64-reloc-property.h: New file.
2036         * aarch64-reloc.def: New file.
2037         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
2038         with tab to make the format consistent.
2039         (Output_data_got_aarch64::symbol_table_): New method.
2040         (Target_aarch64::do_plt_address_for_global): New method.
2041         (Target_aarch64::do_plt_address_for_local): New method.
2042         (Target_aarch64::do_select_as_default_target): New method.
2043         (Target_aarch64::do_make_data_plt): New method.
2044         (Target_aarch64::make_data_plt): New method.
2045         (Output_data_plt_aarch64::has_irelative_section): New method.
2046         (Output_data_plt_aarch64::address_for_global): New method.
2047         (Output_data_plt_aarch64::address_for_local): New method.
2048         (Output_data_plt_aarch64::irelative_rel_): New parameter.
2049         (Output_data_plt_aarch64::add_entry): Implement contents.
2050         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
2051         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
2052         the got_pov entry to plt0.
2053         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
2054         Implement contents.
2055         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
2056         (AArch64_howto): New struct.
2057         (aarch64_howto[]): New static const array.
2058         (AArch64_relocate_functions): New class.
2059         (Target_aarch64::Scan::get_reference_flags): Remove method.
2060         (Target_aarch64::Scan::local): Implement to support a few relocations.
2061         (Target_aarch64::Scan::global): Implement to support a few relocations.
2062         (Target_aarch64::make_plt_section): Implement contents.
2063         (Target_aarch64::make_plt_entry): Implement contents.
2064         (Target_aarch64::do_finalize_sections): Implement contents.
2065         (Target_aarch64::Relocate::relocate): Implement a few relocations.
2066         (Target_aarch64::relocate_section): Implement contents.
2067
2068 2014-08-06  Alan Modra  <amodra@gmail.com>
2069
2070         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
2071
2072 2014-08-06  Alan Modra  <amodra@gmail.com>
2073
2074         PR 13227
2075         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
2076
2077 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
2078
2079         * object.cc (Relobj::is_section_name_included): Add
2080         ".rodata.nptl_version" to not garbage collect this section.
2081
2082 2014-07-08  Cary Coutant  <ccoutant@google.com>
2083
2084         * expression.cc (struct Expression::Expression_eval_info): Add
2085         new fields type_pointer, vis_pointer, and nonvis_pointer.
2086         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
2087         nonvis_pointer parameters. Adjust all calls.
2088         (Symbol_expression::value): Update type, visibility, and nonvis bits
2089         in caller.
2090         * script.cc (Symbol_assignment::sized_finalize): Update type,
2091         visibility, and remaining st_other bits for new symbol.
2092         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
2093         vis_pointer, and nonvis_pointer parameters.
2094         * symtab.h (Symbol::set_type): New method.
2095
2096         * testsuite/Makefile.am (defsym_test): New test.
2097         * testsuite/Makefile.in: Regenerate.
2098         * testsuite/defsym_test.c: New file.
2099         * testsuite/defsym_test.sh: New file.
2100
2101 2014-07-08  Cary Coutant  <ccoutant@google.com>
2102
2103         PR gold/15639
2104         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
2105         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
2106         (Sized_dynobj::base_read_symbols): ...new method.
2107         * object.h (Sized_relobj_file::base_read_symbols): New method.
2108         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
2109         (Sized_relobj_file::base_read_symbols): ...new method.
2110         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
2111         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
2112         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
2113
2114 2014-07-04  Alan Modra  <amodra@gmail.com>
2115
2116         * po/POTFILES.in: Regenerate.
2117
2118 2014-07-02  Jing Yu  <jingyu@google.com>
2119
2120         * aarch64.cc: New file
2121         * Makefile.am (TARGETSOURCES): Add aarch64.cc
2122         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
2123         * Makefile.in: Regenerate.
2124         * configure.tgt: Add entries for aarch64*.
2125         * configure.ac:  Likewise.
2126         * configure: Likewise.
2127
2128 2014-06-27  Alan Modra  <amodra@gmail.com>
2129
2130         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
2131
2132 2014-06-24  Cary Coutant  <ccoutant@google.com>
2133
2134         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
2135         sections.
2136         (Dwo_file::sized_read_unit_index): Likewise.
2137
2138 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2139
2140         * mips.cc: New file.
2141         * Makefile.am (TARGETSOURCES): Add mips.cc
2142         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
2143         * configure.tgt: Add entries for mips*.
2144         * configure.ac: Likewise.
2145         * Makefile.in: Regenerate.
2146         * configure: Likewise.
2147
2148 2014-06-09  Cary Coutant  <ccoutant@google.com>
2149
2150         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
2151         unit_length is within section bounds.
2152
2153 2014-06-09  Cary Coutant  <ccoutant@google.com>
2154
2155         PR gold/16980
2156         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
2157         map.
2158
2159 2014-06-07  Alan Modra  <amodra@gmail.com>
2160
2161         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
2162
2163 2014-06-06  Cary Coutant  <ccoutant@google.com>
2164
2165         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
2166         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
2167         (Dwarf_pubnames_table::read_header): Likewise.
2168         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
2169         .debug_gnu_pubtypes.
2170
2171 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
2172
2173         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
2174         * Makefile.in, configure: Regenerate.
2175
2176 2014-06-03  Alan Modra  <amodra@gmail.com>
2177
2178         * powerpc.cc (addis_12_2): Define.
2179         (Stub_table::do_write): Support fusion on ELFv2 stubs.
2180
2181 2014-06-03  Alan Modra  <amodra@gmail.com>
2182
2183         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
2184         st_other output.
2185
2186 2014-06-02  Alan Modra  <amodra@gmail.com>
2187
2188         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
2189         Only ignore relocs on ELFv1.
2190         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
2191
2192 2014-05-30  Cary Coutant  <ccoutant@google.com>
2193
2194         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
2195         * testsuite/Makefile.in: Regenerate.
2196         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
2197
2198 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
2199
2200         PR gold/16945
2201         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
2202         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
2203
2204 2014-05-15  Alan Modra  <amodra@gmail.com>
2205
2206         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
2207         Compare FDE contents with DW_CFA_nop rather than 0.
2208
2209 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
2210
2211         * symtab.h (may_need_copy_reloc): Remove check for position independent
2212         code.
2213         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
2214         position independence before pc absolute may_need_copy_reloc call.
2215         Add check for executable output befor pc relative may_need_copy_reloc
2216         call.
2217         * i386.cc: Ditto.
2218         * arm.cc: Ditto.
2219         * sparc.cc: Ditto.
2220         * tilegx.cc: Ditto.
2221         * powerpc.cc: Add check for no position independence before
2222         may_need_copy_reloc calls.
2223         * testsuite/pie_copyrelocs_test.cc: New file.
2224         * testsuite/pie_copyrelocs_shared_test.cc: New file.
2225         * Makefile.am (pie_copyrelocs_test): New test.
2226         * Makefile.in: Regenerate.
2227
2228 2014-05-08  Martin Liška  <mliska@suse.cz>
2229
2230         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
2231
2232 2014-05-06  Cary Coutant  <ccoutant@google.com>
2233
2234         PR gold/16900
2235         * i386.cc (Output_data_got_plt_i386): New class.
2236         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
2237         parameter. Change all callers.
2238         (Output_data_plt_i386::layout_): Remove.
2239         (Output_data_plt_i386::got_plt_): Change type.
2240         (Target_i386::got_plt_): Change type. Change all references.
2241         (Target_i386::got_section): Create instance of new class.
2242         (Output_data_got_plt_i386::do_write): New function.
2243         * x86_64.cc (Output_data_got_plt_x86_64): New class.
2244         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
2245         parameter. Change all callers.
2246         (Output_data_plt_x86_64::layout_): Remove.
2247         (Output_data_plt_x86_64::got_plt_): Change type.
2248         (Target_x86_64::got_plt_): Change type. Change all references.
2249         (Target_x86_64::got_section): Create instance of new class.
2250         (Output_data_got_plt_x86_64::do_write): New function.
2251         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
2252         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
2253         class.
2254
2255 2014-05-05  Cary Coutant  <ccoutant@google.com>
2256
2257         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
2258         if we have pubnames/pubtypes.
2259
2260 2014-05-02  Cary Coutant  <ccoutant@google.com>
2261
2262         * defstd.cc (in_segment): Define __ehdr_start here...
2263         * layout.cc (Layout::finalize): ...Instead of here.  Set the
2264         output segment when known.
2265         * resolve.cc (Symbol::override_base_with_special): Remember
2266         the original binding.
2267         * symtab.cc (Symbol::set_output_segment): New function.
2268         (Symbol::set_undefined): New function.
2269         * symtab.h (Symbol::is_weak_undefined): Check original undef
2270         binding.
2271         (Symbol::is_strong_undefined): New function.
2272         (Symbol::set_output_segment): New function.
2273         (Symbol::set_undefined): New function.
2274         * target-reloc.h (is_strong_undefined): Remove.
2275         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
2276         Check for hidden undefs.
2277         (relocate_section): Call Symbol::is_strong_undefined.
2278
2279         * testsuite/Makefile.am (ehdr_start_test_1)
2280         (ehdr_start_test_2, ehdr_start_test_3)
2281         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
2282         * testsuite/Makefile.in: Regenerate.
2283         * testsuite/ehdr_start_def.cc: New source file.
2284         * testsuite/ehdr_start_test.cc: New source file.
2285         * testsuite/ehdr_start_test.t: New linker script.
2286         * testsuite/ehdr_start_test_4.sh: New shell script.
2287
2288 2014-04-23  Cary Coutant  <ccoutant@google.com>
2289
2290         PR gold/16870
2291         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
2292
2293 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2294
2295         * layout.cc (Layout::include_section): Allow a target to decide
2296         whether to include a section.
2297         * target.h (Target::should_include_section): New function.
2298         (Target::do_should_include_section): New function.
2299
2300 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2301
2302         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
2303         inline into ...
2304         (Copy_relocs::emit): ... here.
2305         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
2306         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
2307         (Copy_reloc_entry::entries_): Change from private to protected.
2308
2309 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
2310
2311         * icf.cc (get_section_contents): Replace copies of reloc
2312         vectors with const references.
2313
2314 2014-04-02  Cary Coutant  <ccoutant@google.com>
2315
2316         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
2317         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
2318         * configure: Regenerate.
2319         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
2320         -fno-use-linker-plugin.
2321         (LINK1, CXXLINK1): Add it to the link command.
2322         * testsuite/Makefile.in: Regenerate.
2323
2324 2014-03-12  Alan Modra  <amodra@gmail.com>
2325
2326         * Makefile.in: Regenerate.
2327
2328 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2329
2330         * symtab.h (Symbol::set_nonvis): New function.
2331
2332 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2333
2334         * symtab.cc (Sized_symbol<32>::init_output_data):
2335         Instantiate the template.
2336         (Sized_symbol<64>::init_output_data): Likewise.
2337
2338 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2339
2340         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
2341         adjust dynamic symbol value.
2342         * target.h (Target::adjust_dyn_symbol): New function.
2343         (Target::do_adjust_dyn_symbol): New function.
2344
2345 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2346
2347         * output.cc (Output_data_dynamic::Dynamic_entry::write):
2348         Get the value of DYNAMIC_CUSTOM dynamic entry.
2349         * output.h (Output_data_dynamic::add_custom): New function.
2350         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
2351         dynamic entry.
2352         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
2353         * target.h (Target::dynamic_tag_custom_value): New function.
2354         (Target::do_dynamic_tag_custom_value): New function.
2355
2356 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2357
2358         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
2359         dynsym indexes.
2360         * target.h (Target::has_custom_set_dynsym_indexes): New function.
2361         (Target::do_has_custom_set_dynsym_indexes): New function.
2362         (Target::set_dynsym_indexes): New function.
2363         (Target::do_set_dynsym_indexes): New function.
2364
2365 2014-03-07  Alan Modra  <amodra@gmail.com>
2366
2367         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
2368         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
2369         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
2370         (Powerpc_relocate_functions::has_overflow_bitfield,
2371         overflowed): Use the above.
2372         (Target_powerpc::Relocate::relocate): Correct overflow checking
2373         for a number of relocations.  Modify overflow test for 16-bit
2374         fields in instructions to signed/unsigned according to whether
2375         the field takes a signed or unsigned value.
2376
2377 2014-03-05  Alan Modra  <amodra@gmail.com>
2378
2379         Update copyright years.
2380
2381 2014-03-05  Alan Modra  <amodra@gmail.com>
2382
2383         * powerpc.cc (Target_powerpc::Scan::local, global): Support
2384         R_PPC64_ADDR64_LOCAL.
2385         (Target_powerpc::Relocate::relocate): Likewise.
2386
2387 2014-03-03  Alan Modra  <amodra@gmail.com>
2388
2389         * dwp.cc (print_version): Update copyright year to current.
2390
2391 2014-02-10  Alan Modra  <amodra@gmail.com>
2392
2393         * po/gold.pot: Regenerate.
2394
2395 2014-02-06  Cary Coutant  <ccoutant@google.com>
2396
2397         Fix problem where -u is ignored when a weak undef is seen.
2398
2399         * archive.cc (Library_base::should_include_member): Reorder
2400         code to check for -u option if a weak undef has already been seen.
2401         * testsuite/Makefile.am (weak_undef_test_2): New test case.
2402         * testsuite/Makefile.in: Regenerate.
2403         * testsuite/weak_undef_file3.cc: New file.
2404         * testsuite/weak_undef_file4.cc: New file.
2405         * testsuite/weak_undef_test_2.cc: New file.
2406
2407 2014-02-05  Cary Coutant  <ccoutant@google.com>
2408
2409         Fix issues with gold undefined symbol diagnostics.
2410
2411         PR binutils/15435
2412         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
2413         check to here.
2414         * target-reloc.h (is_strong_undefined): New function.
2415         (relocate_section): Move undef vtable symbol check from here.
2416         Check for is_strong_undefined.
2417
2418 2014-02-05  Cary Coutant  <ccoutant@google.com>
2419
2420         Fix problems with the --dynamic-list option.
2421
2422         PR gold/13577
2423         * options.cc (General_options::parse_dynamic_list):
2424         Set have_dynamic_list_.
2425         (General_options::General_options): Initialize have_dynamic_list_.
2426         (General_options::finalize): Turn off -Bsymbolic and
2427         -Bsymbolic-functions if --dynamic-list provided.
2428         * options.h (General_options::have_dynamic_list): New function.
2429         (General_options::have_dynamic_list_): New data member.
2430         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
2431         correctly.
2432
2433         PR gold/16530
2434         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
2435         in --dynamic-list, mark it.
2436
2437         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
2438         (dynamic_list_2): New test case.
2439         * testsuite/Makefile.in: Regenerate.
2440         * testsuite/dynamic_list_2.cc: New file.
2441         * testsuite/dynamic_list_2.t: New file.
2442         * testsuite/dynamic_list_lib1.cc: New file.
2443         * testsuite/dynamic_list_lib2.cc: New file.
2444         * testsuite/gc_dynamic_list_test.c: New file.
2445         * testsuite/gc_dynamic_list_test.sh: New file.
2446         * testsuite/gc_dynamic_list_test.t: New file.
2447
2448 2014-01-28  Cary Coutant  <ccoutant@google.com>
2449
2450         Add .gdb_index version 7 support.
2451
2452         * gold/dwarf_reader.cc: include <utility> (for make_pair).
2453         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
2454         debug sections.
2455         (Dwarf_ranges_table::read_ranges_table): Likewise.
2456         (Dwarf_pubnames_table::read_section): Check for GNU-style
2457         sections, and for compressed debug sections.
2458         (Dwarf_pubnames_table::read_header): Compute end address of table.
2459         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
2460         for end of list by offset, not by offset == 0.
2461         (Dwarf_info_reader::do_read_string_table): Check for compressed
2462         debug sections.
2463         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2464         Initialize new data members.
2465         (Dwarf_pubnames_table::next_name): return flag_byte.
2466         (Dwarf_pubnames_table::end_of_table_): New data member.
2467         (Dwarf_pubnames_table::is_gnu_style_): New data member.
2468         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
2469         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
2470         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
2471         read skeleton type unit DIEs.
2472         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
2473         (Gdb_index::do_write): Write flag_byte.
2474         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
2475         (Gdb_index::Cu_vector): Store flags along with cu indexes.
2476         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
2477         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
2478
2479 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
2480
2481         * version.cc (print_version): Update copyright year to 2014.
2482
2483 2013-12-19  Dimitry Andric  <dimitry@andric.com>
2484
2485         * stringpool.cc (Stringpool_template::reserve): Add
2486         HAVE_UNORDERED_MAP case.
2487         * stringpool.cc (Stringpool_template::print_stats): Likewise.
2488
2489 2013-12-18  Cary Coutant  <ccoutant@google.com>
2490
2491         * configure.ac: Check for <unordered_set> and <unordered_map>.
2492         * config.in: Regenerate.
2493         * configure: Regenerate.
2494         * system.h: Use <unordered_set> and <unordered_map> if available.
2495
2496 2013-12-10  Roland McGrath  <mcgrathr@google.com>
2497
2498         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
2499         with $(INSTALL_PROGRAM_ENV).
2500         * Makefile.in: Regenerate.
2501
2502 2013-11-22  Cary Coutant  <ccoutant@google.com>
2503
2504         * configure.ac: Add check for which library is needed for
2505         dlopen.
2506         * configure: Regenerate.
2507
2508 2013-11-22  Cary Coutant  <ccoutant@google.com>
2509
2510         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
2511         assembler.
2512         * testsuite/Makefile.in: Regenerate.
2513
2514 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
2515
2516         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
2517         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
2518         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
2519         (Target_x86_64<size>::Scan::local): Likewise.
2520         (Target_x86_64<size>::Scan::global): Likewise.
2521         (Target_x86_64<size>::Relocate::relocate): Likewise.
2522         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
2523         Likewise.
2524         (Target_x86_64<size>::Scan::check_non_pic(): Handle
2525         R_X86_64_PC32_BND.
2526
2527         * testsuite/Makefile.am (check_PROGRAMS): Add
2528         exception_x86_64_bnd_test.
2529         (exception_x86_64_bnd_test_SOURCES): New macro.
2530         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
2531         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
2532         (exception_x86_64_bnd_test_LDADD): Likewise.
2533         (exception_x86_64_bnd_1.o): New rule.
2534         (exception_x86_64_bnd_2.o): Likewise.
2535         * testsuite/Makefile.in: Regenerated.
2536
2537 2013-11-15  Alan Modra  <amodra@gmail.com>
2538
2539         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
2540         accessor.
2541         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
2542         Only call ppc64_local_entry_offset for 64-bit.  Restrict
2543         symval_for_branch lookup to ELFv1.
2544         (Stub_table::add_plt_call_entry): Use unsigned int off.
2545         (Output_data_glink::Address, invalid_address): New.
2546         (Output_data_glink::add_eh_frame): Move out of line.  Add
2547         support for ELFv2.
2548         (Output_data_glink::add_global_entry, find_global_entry,
2549         global_entry_address): New functions.
2550         (Output_data_glink::global_entry_stubs_, end_branch_table_,
2551         ge_size): New variables.
2552         (Output_data_glink::set_final_data_size): Add global entry
2553         stub sizing.
2554         (Output_data_glink::do_write): Write global entry stubs.
2555         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
2556         parameter.  Return true for ELFv2.  Adjust callers.
2557         (Target_powerpc::Scan::local, global): Restrict opd lookup to
2558         ELFv1.  Similarly for ifunc and dynamic relocation processing
2559         specific to ELFv1.  Recognize that symbols are defined on
2560         their plt entries for ELFv2.
2561         (Target_powerpc::symval_for_branch): Assert if called for
2562         ELFv2 or ppc32.
2563         (Target_powerpc::Relocate::relocate): Use global entry plt
2564         stub for symbol value if such exists on ELFv2.
2565         (Target_powerpc::Relocate::relocate): Don't call
2566         symval_for_branch when ELFv2.  Do adjust for local entry
2567         offset when ELFv2.
2568         (Target_powerpc::do_dynsym_value): Set symbols to global entry
2569         plt stub for ELFv2.
2570         (Target_powerpc::do_plt_address_for_global): Similarly.
2571
2572 2013-11-14  Cary Coutant  <ccoutant@google.com>
2573
2574         Revert patch -- this did not fix the problem, and there is
2575         no race there.
2576
2577         2013-11-14  Cary Coutant  <ccoutant@google.com>
2578
2579             PR gold/14860
2580             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2581             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2582             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2583             updating fde_offsets_.
2584             (Eh_frame_hdr::lock_): New data member.
2585
2586 2013-11-14  Cary Coutant  <ccoutant@google.com>
2587
2588         * dwp.cc (Dwo_file_entry): New type.
2589         (File_list): Use Dwo_file_entry.
2590         (Dwo_file::verify): New function.
2591         (Dwo_file::verify_dwo_list): New function.
2592         (Dwo_file::sized_verify_dwo_list): New function.
2593         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
2594         list.
2595         (Dwp_options): New enum type.
2596         (dwp_options): Add --verify-only.
2597         (usage): Likewise.
2598         (main): Likewise.
2599         * dwp.h (gold_info): Add declaration.
2600
2601 2013-11-14  Cary Coutant  <ccoutant@google.com>
2602
2603         PR gold/14860
2604         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2605         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2606         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2607         updating fde_offsets_.
2608         (Eh_frame_hdr::lock_): New data member.
2609
2610 2013-11-06  Cary Coutant  <ccoutant@google.com>
2611
2612         PR gold/15758
2613         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
2614         before reloc sections.
2615
2616 2013-11-04  Alan Modra  <amodra@gmail.com>
2617
2618         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
2619         (Symbol::needs_dynamic_reloc): Test new flag.
2620         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
2621         (Target_powerpc::Scan::get_reference_flags): Add target param.
2622         Return FUNC_DESC_ABI for 64-bit ELFv1.
2623         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
2624         call.
2625         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
2626         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
2627
2628 2013-10-31  Cary Coutant  <ccoutant@google.com>
2629
2630         Restore support for dwp v2 DWARF package file format.
2631
2632         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2633         tu_length parameter.  Adjust all callers.
2634         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2635         * dwp.cc: Include dwarf.h.
2636         (Section_bounds): New struct type.
2637         (Unit_set): New struct type.
2638         (Dwo_file::Dwo_file): Initialize new data member.
2639         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2640         Combine and rename to...
2641         (Dwo_file::read_unit_index): ...this.
2642         (Dwo_file::sized_read_compunit_index)
2643         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2644         (Dwo_file::sized_read_unit_index): ...this.
2645         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2646         parameters; add section_id parameter.
2647         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2648         (Dwo_file::add_unit_set): ...this.
2649         (Dwo_file::shndx_map_): Remove.
2650         (Dwo_file::sect_offsets_): New data member.
2651         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2652         (Dwp_output_file::add_section): Rename to...
2653         (Dwp_output_file::add_contribution): ...this.
2654         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2655         (Dwp_output_file::add_tu_set): Likewise.
2656         (Dwp_output_file::Contribution): New type.
2657         (Dwp_output_file::Section::contributions): New data member.
2658         (Dwp_output_file::Cu_or_tu_set): Remove.
2659         (Dwp_output_file::Section::Section): New ctor.
2660         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2661         (Dwp_output_file::Dwp_index::Section_table): New type.
2662         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2663         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2664         parameter.
2665         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2666         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2667         (Dwp_output_file::Dwp_index::section_table): New member function.
2668         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2669         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2670         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2671         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2672         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2673         (Dwp_output_file::Dwp_index::section_table_): New data member.
2674         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2675         (Dwp_output_file::add_output_section): New member function.
2676         (Dwp_output_file::write_new_section): New member function.
2677         (Dwp_output_file::write_contributions): New member function.
2678         (Dwp_output_file::section_id_map_): New data member.
2679         (class Dwo_id_info_reader): Remove.
2680         (class Unit_reader): New class.
2681         (get_dwarf_section_name): New function.
2682         (Dwo_file::read_executable): Adjust initializations of class data.
2683         (Dwo_file::read): Add support for v2 package file format.
2684         (Dwo_file::read_unit_index): Likewise.
2685         (Dwo_file::sized_read_unit_index): Likewise.
2686         (Dwo_file::copy_section): Likewise.
2687         (Dwo_file::add_unit_set): Likewise.
2688         (Dwp_output_file::add_output_section): Likewise.
2689         (Dwp_output_file::add_contribution): Likewise.
2690         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2691         for empty slot.
2692         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2693         file format.
2694         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2695         slot.
2696         (Dwp_output_file::initialize): Remove unused function.
2697         (Dwp_output_file::finalize): Add support for v2 package file format.
2698         (Dwp_output_file::write_index): Likewise.
2699         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2700         function prototype.
2701
2702 2013-10-31  Cary Coutant  <ccoutant@google.com>
2703
2704         * configure.ac: Fix check for -fmerge-constants.
2705         * configure.ac: Regenerate.
2706
2707 2013-10-30  Roland McGrath  <mcgrathr@google.com>
2708
2709         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
2710         Correct 9-byte nop sequence to match what the assembler generates.
2711
2712 2013-10-30  Alan Modra  <amodra@gmail.com>
2713
2714         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
2715         ppc64_local_entry_offset, ppc64_local_entry_offset,
2716         do_read_symbols): New functions.
2717         (Powerpc_relobj::e_flags_, st_other_): New vars.
2718         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
2719         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
2720         (Powerpc_relobj::e_flags_): New var.
2721         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
2722         and adjust for ELFv2.
2723         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
2724         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
2725         (Powerpc_dynobj::do_find_special_sections): Likewise.
2726         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
2727         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
2728         to ELFv2 local entry.
2729         (Target_powerpc::do_relax): No thread safe barriers needed for
2730         ELFv2.
2731         (Output_data_plt_powerpc::initial_plt_entry_size_,
2732         plt_entry_size): Delete.  Replace all uses with
2733         first_plt_entry_offset() and plt_entry_size().
2734         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
2735         reserved_size parm.  Update callers.
2736         (Output_data_plt_powerpc::entry_count): Update.
2737         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
2738         and use Target_powerpc::first_plt_entry_offset().
2739         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
2740         rename to plt_entry_size.
2741         (Output_data_plt_powerpc::add_ifunc_entry,
2742         add_local_ifunc_entry): Adjust reloc for ELFv2.
2743         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
2744         (glink_eh_frame_fde_64v2): New.
2745         (Stub_table::plt_call_size): Support ELFv2 sizing.
2746         (Output_data_glink::add_eh_frame): Use the new FDE.
2747         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
2748         (Stub_table::do_write): Write ELFv2 stubs and glink.
2749         (Target_powerpc::Relocate::relocate): Replaces nop after call
2750         with ld 2,24(1) and adjust local offset destination for ELFv2.
2751
2752 2013-10-30  Alan Modra  <amodra@gmail.com>
2753
2754         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
2755         (Target_powerpc::Scan::global, local): Likewise.
2756         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
2757         on all ppc64 @h and @ha relocs.
2758
2759 2013-10-14  Alan Modra  <amodra@gmail.com>
2760
2761         * output.h (Output_data_got::add_constant): Tidy.
2762         (Output_data_got::add_constant_pair): New function.
2763         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
2764         methods used so as to first call reserve_ent().
2765
2766 2013-10-11  Roland McGrath  <mcgrathr@google.com>
2767
2768         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
2769         add_got_entry and add_got_entry_pair.
2770
2771         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
2772         (HAVE_PUBNAMES): Likewise.
2773         * configure: Regenerate.
2774
2775         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
2776         * testsuite/Makefile.in: Regenerate.
2777
2778         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
2779         Remove const from declaration.
2780         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
2781         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
2782         * output.h (Output_file_header): Remove const from member target_
2783         and corresponding constructor argument.
2784         * output.cc (Output_file_header::Output_file_header): Update prototype.
2785         (Output_file_header::do_sized_write): Use this->target_ in place
2786         of parameters()->target().
2787
2788         * testsuite/undef_symbol.cc (Foo::get_a): New method.
2789
2790         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
2791         * configure: Regenerate.
2792         * Makefile.in: Regenerate.
2793         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
2794         * testsuite/merge_string_literals_2.c: Likewise.
2795         * testsuite/Makefile.am
2796         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
2797         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
2798         literal -fmerge-constants.
2799         * testsuite/Makefile.in: Regenerate.
2800
2801         * i386.cc (Target_i386): Remove unused member dynbss_.
2802         * arm.cc (Target_arm): Likewise.
2803         * powerpc.cc (Target_powerpc): Likewise.
2804         * sparc.cc (Target_sparc): Likewise.
2805         * tilegx.cc (Target_tilegx): Likewise.
2806         * x86_64.cc (Target_x86_64): Likewise.
2807         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
2808         type_signature_, type_offset_.
2809         * plugin.h (Plugin_hook): Remove unused member layout_.
2810         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
2811         mapfile_.
2812         (Read_member): Remove unused members input_objects_, symtab_,
2813         mapfile_, layout_.
2814         (Check_library): Remove unused member symtab_.
2815         * archive.h (Lib_group): Remove unused member lib_.
2816         * archive.cc (Lib_group::Lib_group): Update initializer.
2817         * incremental.h (Incremental_binary): Remove unused member target_.
2818         (Incremental_script_entry): Removed unused member script_.
2819         * layout.h (Write_symbols_task): Remove unused member input_objects_.
2820         * icf.h (Icf): Remove unused member num_tracked_relocs.
2821
2822         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
2823         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
2824         its only use.
2825         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
2826
2827         * archive.h: Use struct rather than class for forward declaration
2828         of Read_symbols_data.
2829
2830 2013-10-07  Cary Coutant  <ccoutant@google.com>
2831
2832         PR gold/16010
2833         * testsuite/Makefile.am (icf_test): Fix dependencies.
2834         (icf_safe_test): Likewise.
2835         (icf_safe_so_test): Likewise.
2836         (large_symbol_alignment): Add empty _LDADD rule.
2837         * testsuite/Makefile.in: Regenerate.
2838
2839 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
2840
2841         PR gold/15927
2842         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
2843         relocation for R_X86_64_32 on x32.
2844
2845 2013-08-27  Roland McGrath  <mcgrathr@google.com>
2846
2847         * output.cc (Output_segment::set_section_addresses): Take new
2848         Target* argument.  If target->isolate_execinstr() and the segment
2849         is executable and starts at a target->abi_pagesize() boundary,
2850         pad its end out to a target->abi_pagesize() boundary with code fill.
2851         * output.h (Output_segment::set_section_addresses): Update decl.
2852         * layout.h (Layout::check_output_data_for_reset_values): Take new
2853         argument RELAX_OUTPUTS.
2854         (Layout): New member relax_output_list_.
2855         (Layout::add_relax_output): New method.
2856         * layout.cc (Layout::Layout): Update constructor.
2857         (Layout::reset_relax_output): New method.
2858         (Layout::clean_up_after_relaxation): Call it.
2859         (Layout::prepare_for_relaxation): Update caller.
2860         (Layout::set_segment_offsets): Update callers of set_section_addresses.
2861         Call reset_relax_output before re-processing segments for
2862         isolate_execinstr case.
2863         (Layout::write_data): Handle relax_output_list_.
2864         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
2865         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
2866
2867 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
2868
2869         PR binutils/15834
2870         * object.h: Fix typos.
2871
2872 2013-08-16  Roland McGrath  <mcgrathr@google.com>
2873
2874         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
2875         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
2876
2877 2013-08-07  Cary Coutant  <ccoutant@google.com>
2878
2879         Revert support for v2 DWP files:
2880
2881         2013-03-01  Cary Coutant  <ccoutant@google.com>
2882
2883             Add dwp support for v2 DWARF package file format.
2884             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2885             tu_length parameter.  Adjust all callers.
2886             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2887             * dwp.cc: Include dwarf.h.
2888             (Section_bounds): New struct type.
2889             (Unit_set): New struct type.
2890             (Dwo_file::Dwo_file): Initialize new data member.
2891             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2892             Combine and rename to...
2893             (Dwo_file::read_unit_index): ...this.
2894             (Dwo_file::sized_read_compunit_index)
2895             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2896             (Dwo_file::sized_read_unit_index): ...this.
2897             (Dwo_file::copy_section): Remove section_name, is_str_offsets
2898             parameters; add section_id parameter.
2899             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2900             (Dwo_file::add_unit_set): ...this.
2901             (Dwo_file::shndx_map_): Remove.
2902             (Dwo_file::sect_offsets_): New data member.
2903             (Dwp_output_file::Dwp_output_file): Initialize new data members.
2904             (Dwp_output_file::add_section): Rename to...
2905             (Dwp_output_file::add_contribution): ...this.
2906             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2907             (Dwp_output_file::add_tu_set): Likewise.
2908             (Dwp_output_file::Contribution): New type.
2909             (Dwp_output_file::Section::contributions): New data member.
2910             (Dwp_output_file::Cu_or_tu_set): Remove.
2911             (Dwp_output_file::Section::Section): New ctor.
2912             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2913             (Dwp_output_file::Dwp_index::Section_table): New type.
2914             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2915             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2916             parameter.
2917             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2918             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2919             (Dwp_output_file::Dwp_index::section_table): New member function.
2920             (Dwp_output_file::Dwp_index::section_table_end): New member function.
2921             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2922             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2923             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2924             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2925             (Dwp_output_file::Dwp_index::section_table_): New data member.
2926             (Dwp_output_file::Dwp_index::section_mask_): New data member.
2927             (Dwp_output_file::add_output_section): New member function.
2928             (Dwp_output_file::write_new_section): New member function.
2929             (Dwp_output_file::write_contributions): New member function.
2930             (Dwp_output_file::section_id_map_): New data member.
2931             (class Dwo_id_info_reader): Remove.
2932             (class Unit_reader): New class.
2933             (get_dwarf_section_name): New function.
2934             (Dwo_file::read_executable): Adjust initializations of class data.
2935             (Dwo_file::read): Add support for v2 package file format.
2936             (Dwo_file::read_unit_index): Likewise.
2937             (Dwo_file::sized_read_unit_index): Likewise.
2938             (Dwo_file::copy_section): Likewise.
2939             (Dwo_file::add_unit_set): Likewise.
2940             (Dwp_output_file::add_output_section): Likewise.
2941             (Dwp_output_file::add_contribution): Likewise.
2942             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2943             for empty slot.
2944             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2945             file format.
2946             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2947             slot.
2948             (Dwp_output_file::initialize): Remove unused function.
2949             (Dwp_output_file::finalize): Add support for v2 package file format.
2950             (Dwp_output_file::write_index): Likewise.
2951             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2952             function prototype.
2953
2954 2013-07-31  Cary Coutant  <ccoutant@google.com>
2955
2956         * object.cc (Sized_relobj::do_output_section_address): New function.
2957         (Sized_relobj): Instantiate explicitly.
2958         * object.h (Object::output_section_address): New function.
2959         (Object::do_output_section_address): New function.
2960         (Sized_relobj::do_output_section_address): New function.
2961         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
2962
2963 2013-07-30  Cary Coutant  <ccoutant@google.com>
2964             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2965
2966         * parameters.cc (Parameters::entry): Return target-specific entry
2967         symbol name.
2968         * target.h (Target::entry_symbol_name): New function.
2969         (Target_info::entry_symbol_name): New data member.
2970
2971         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
2972         * i386.cc (Target_i386::i386_info): Likewise.
2973         (Target_i386_nacl::i386_nacl_info): Likewise.
2974         * sparc.cc (Target_sparc::sparc_info): Likewise.
2975         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
2976         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
2977         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
2978         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2979
2980 2013-07-22  Sterling Augustine  <saugustine@google.com>
2981
2982         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
2983         Convert parameter shndx to local variable. Add parameters symtab
2984         and symtab_size.  Scan over section names.  Find relocation
2985         section corresponding to current section.  Create and initialize
2986         reloc_mapper_ and reloc_type_.
2987         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
2988         unit_length to off_t.  Initialize member unit_length_.  Fill in field
2989         cu_offset_.
2990         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2991         Initialize new fields unit_length_ and cu_offset_.
2992         (Dwarf_pubnames_table::read_section): Update prototype.
2993         (Dwarf_pubnames_table::cu_offset): New member function.
2994         (Dwarf_pubnames_table::subsection_size): Likewise.
2995         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
2996         New fields.
2997         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
2998         member functions public.
2999         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
3000         Update comment.  Rework logic.  Move repeated parts to...
3001         (Gdb_index_info_reader::read_pubtable): ...here. New function.
3002         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
3003         pubtypes_table_, and stmt_list_offset.
3004         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
3005         Gdb_index::find_pubtype_offset,
3006         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
3007         (Gdb_index::pubnames_read): Update prototype and rework logic.
3008         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
3009         Forward declare.
3010         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
3011         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
3012         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
3013         Gdb_index::map_pubtable_to_dies):
3014         Declare functions.
3015         (Gdb_index::pubnames_read): Update declaration.
3016         (Gdb_index::Pubname_offset_map): New type.
3017         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
3018         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
3019         Gdb_index::stmt_list_offset): Declare.
3020         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
3021         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
3022         Gdb_index::pubtypes_offset_): Remove.
3023
3024 2013-07-19  Roland McGrath  <mcgrathr@google.com>
3025
3026         * options.h (General_options): Add -Trodata-segment option.
3027         * parameters.cc (Parameters::check_rodata_segment): New function.
3028         (Parameters::set_target_once): Call it.
3029         * parameters.h (Parameters): Declare it (private member function).
3030         * layout.cc (load_seg_unusable_for_headers): New function, broken
3031         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
3032         then validate rodata segment rather than text segment.
3033         (relaxation_loop_body): Call that.
3034         (is_text_segment): New function.  Don't admit a non-executable
3035         segment if TARGET->isolate_execinstr().
3036         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
3037
3038 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
3039
3040         PR gold/15070
3041         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
3042         * nacl.h (Sniff_file::View::View): Request aligned view.
3043
3044 2013-07-11  Cary Coutant  <ccoutant@google.com>
3045
3046         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
3047         correct BRLT entry size.
3048
3049 2013-07-03  Alan Modra  <amodra@gmail.com>
3050
3051         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
3052         comment.
3053
3054 2013-07-01  Cary Coutant  <ccoutant@google.com>
3055
3056         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
3057         reloc_type_.
3058         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
3059         (Dwarf_ranges_table::lookup_reloc): New function.
3060         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
3061         reloc_type_.
3062         (Dwarf_ranges_table::lookup_reloc): New function.
3063         (Dwarf_ranges_table::reloc_type_): New data member.
3064
3065 2013-06-27  Jing Yu  <jingyu@google.com>
3066
3067         PR gold/15662
3068         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
3069         function.
3070         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
3071         (Target_powerpc::do_relax): Call the above.
3072
3073 2013-06-27  Cary Coutant  <ccoutant@google.com>
3074
3075         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
3076         on garbage collected .opd section.
3077
3078 2013-06-27  Alan Modra  <amodra@gmail.com>
3079
3080         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
3081         is non-zero.
3082         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
3083         (Target_powerpc::do_function_location): Likewise for loc->shndx.
3084
3085 2013-06-14  Cary Coutant  <ccoutant@google.com>
3086
3087         * resolve.cc (Symbol::override_base): Don't override st_type
3088         from plugin placeholder symbols.
3089         (Symbol_table::resolve): Likewise.
3090         (Symbol_table::should_override): Don't complain about TLS mismatch
3091         if the TO symbol is a plugin placeholder.
3092         * testsuite/Makefile.am (plugin_test_tls): New test.
3093         * testsuite/Makefile.in: Regenerate.
3094         * testsuite/plugin_test_tls.sh: New test script.
3095         * testsuite/two_file_test_2_tls.cc: New test source.
3096         * testsuite/two_file_test_tls.cc: New test source.
3097
3098 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3099
3100         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
3101         the maximum segment alignment is larger than the page size.
3102         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
3103         correctly aligns the symbols with large alignemnt.
3104         * testsuite/Makefile.in: Regenerate.
3105         * testsuite/large_symbol_alignment.cc: New file.
3106
3107 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3108             Sriraman Tallam  <tmsriram@google.com>
3109
3110         * options.h (sort_section): New option.
3111         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
3112         Rename from Input_section_sort_section_name_special_ordering_compare.
3113         (Input_section_sort_section_name_compare): New struct.
3114         * output.cc (Output_section::Input_section_sort_section_name_compare::
3115         operator()): New function.
3116         (Output_section::sort_attached_input_sections): Use new sort function
3117         for .text if --sort-section=name is specified.
3118         * layout.cc (Layout::make_output_section):
3119         Add sorting by name when --sort-section=name is specified.
3120         * testsuite/Makefile.am (text_section_grouping): Test option
3121         --sort-section=name.
3122         * testsuite/Makefile.in: Regenerate.
3123         * testsuite/section_sorting_name.cc: New file.
3124         * testsuite/section_sorting_name.sh: New file.
3125
3126 2013-05-21  Cary Coutant  <ccoutant@google.com>
3127
3128         * symtab.h (Symbol::is_cxx_vtable): New function.
3129         * target-reloc.h (relocate_section): Check for vtable symbol.
3130         * testsuite/Makefile.am (missing_key_func.sh): New test case.
3131         * testsuite/Makefile.in: Regenerate.
3132         * testsuite/missing_key_func.cc: New test source.
3133         * testsuite/missing_key_func.sh: New test script.
3134
3135 2013-05-21  Cary Coutant  <ccoutant@google.com>
3136
3137         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
3138         type of enclosing symbol.
3139         (Relocate_info::location): Check symbol type when describing symbol.
3140         * object.h (Symbol_location_info): Remove unused line_number;
3141         add enclosing_symbol_type.
3142         * testsuite/debug_msg.sh: Adjust expected output.
3143
3144 2013-05-13  Cary Coutant  <ccoutant@google.com>
3145
3146         * configure.ac: Export DEFAULT_TARGET.
3147         * configure: Regenerate.
3148         * Makefile.in: Regenerate.
3149         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
3150         * testsuite/Makefile.in: Regenerate.
3151         * testsuite/debug_msg.sh: Delete duplicate tests.
3152         Don't check undef_int error message match for powerpc where the
3153         source file and line number aren't available.
3154
3155 2013-05-10  Roland McGrath  <mcgrathr@google.com>
3156
3157         * options.h (General_options): Add --rosegment-gap option.
3158         * options.cc (finalize): --rosegment-gap implies --rosegment.
3159         * layout.cc (set_segment_offsets): Let user option override
3160         target->rosegment_gap().
3161
3162 2013-05-10  Roland McGrath  <mcgrathr@google.com>
3163
3164         * options.h (General_options): Remove leading space from help
3165         messages for -nostdlib and --rosegment.
3166
3167 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
3168
3169         PR ld/15365
3170         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
3171
3172 2013-05-03  Alan Modra  <amodra@gmail.com>
3173
3174         * merge.cc (Output_merge_string::do_add_input_section): Correct
3175         scan for number of strings.  Rename vars to avoid shadowing.
3176         Include missing terminator in input_size_.
3177
3178 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
3179
3180         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
3181         Restore empty string handling.
3182
3183 2013-05-01  Cary Coutant  <ccoutant@google.com>
3184
3185         * stringpool.cc (Stringpool_template::new_key_offset): Fix
3186         uninitialized warning.
3187
3188 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3189
3190         * output.cc (Output_section::add_merge_input_section): Allow
3191         to merge sections if the alignment is more than character size.
3192         * merge.h (Output_merge_string::Output_merge_string): Remove
3193         assert.
3194         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
3195         only not-null strings. Check the alignment of strings.
3196         * stringpool.h
3197         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
3198         alignment as the argument.
3199         (Stringpool_template<Stringpool_char>::addralign_): New class member.
3200         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
3201         Align non-zero length strings according to the addralign_.
3202         (Stringpool_template<Stringpool_char>::set_string_offsets):
3203         Updating offsets according to the given alignment.
3204         * testsuite/Makefile.am (text_section_grouping): Test if string
3205         literals are getting merged.
3206         * testsuite/Makefile.in: Regenerate.
3207         * testsuite/merge_string_literals_1.c: New file.
3208         * testsuite/merge_string_literals_2.c: Ditto.
3209         * testsuite/merge_string_literals.sh: Ditto.
3210
3211 2013-04-26  Ian Lance Taylor  <iant@google.com>
3212
3213         * target-reloc.h (relocate_section): If the reloc offset is out of
3214         range, pass VIEW as NULL to relocate.relocate.
3215         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
3216         * i386.cc (Target_i386::Relocate::relocate): Likewise.
3217         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
3218         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
3219         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
3220         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3221
3222 2013-04-26  Geoff Pike  <gpike@chromium.org>
3223
3224         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
3225         * layout.cc (Hash_task): New class.
3226         (Layout::queue_build_id_tasks): New function.
3227         (Layout::write_build_id): Handle single-thread portion of build ID
3228         computation.  (In some cases, all of it is single-threaded.)  Replace
3229         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
3230         functionality in fewer lines of code.
3231         * layout.h (Layout::queue_build_id_tasks): New function declaration.
3232         * options.h (General_options): make "--build-id" default to tree
3233         rather than sha1.  Add two new options related to --build-id=tree:
3234         --build-id-chunk-size-for-treehash and
3235         --build-id-min-file-size-for-treehash.
3236         * Makefile.am: add testing of --build-id=tree and related new options
3237         (these tests will be invoked by "make check").
3238         * Makefile.in: Regenerate.
3239
3240 2013-04-25  Alan Modra  <amodra@gmail.com>
3241
3242         * configure.tgt: Add powerpcle and powerpc64le.
3243
3244 2013-04-22  Alan Modra  <amodra@gmail.com>
3245
3246         PR gold/15355
3247         * layout.cc (Layout::segment_precedes): Allow more than one
3248         segment with the same type and flags.
3249
3250 2013-04-15  Cary Coutant  <ccoutant@google.com>
3251
3252         * layout.cc (Layout::set_relocatable_section_offsets): Don't
3253         allocate space in file for BSS sections.
3254
3255 2013-04-15  Cary Coutant  <ccoutant@google.com>
3256
3257         * script-sections.cc (Orphan_output_section): Reset address
3258         to zero after each orphaned section for relocatable links.
3259
3260 2013-04-15  Cary Coutant  <ccoutant@google.com>
3261
3262         * symtab.cc (Symbol_table::sized_write_globals): Subtract
3263         section starting address for relocatable link.
3264         * testsuite/Makefile.am (script_test_11): New test.
3265         * testsuite/Makefile.in: Regenerate.
3266         * testsuite/script_test_11.c: New source file.
3267         * testsuite/script_test_11.t: New linker script.
3268
3269 2013-04-13  Alan Modra  <amodra@gmail.com>
3270
3271         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
3272         owner when sections are not adjacent and exceed group size.
3273         (Target_powerpc::group_sections): Handle corner case.
3274         (Target_powerpc::Branch_info::make_stub): Handle case where
3275         stub table doesn't exist due to branches in non-exec sections.
3276         (Target_powerpc::Relocate::relocate): Likewise.
3277
3278 2013-04-11  Alan Modra  <amodra@gmail.com>
3279
3280         PR gold/15354
3281         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
3282         .branch_lt to match bfd ld.  Adjust comments throughout file.
3283
3284 2013-04-04  Ian Lance Taylor  <iant@google.com>
3285
3286         GCC PR c++/56840
3287         * object.cc (do_layout_deferred_sections): Handle .eh_frame
3288         sections before checking whether they are included in the link.
3289
3290 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
3291
3292         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
3293         object before calling the plugin claim_file handler.  Pass the elf
3294         object of the archive to the plugin. Delete the elf object if the
3295         plugin claims the file.
3296
3297 2013-03-21  Alan Modra  <amodra@gmail.com>
3298
3299         * layout.cc (Layout::set_segment_offsets): Accept writable .text
3300         segment when omagic.
3301
3302 2013-03-21  Alan Modra  <amodra@gmail.com>
3303
3304         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
3305         comparison warning.
3306         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
3307         uninitialized" warning.
3308
3309 2013-03-20  Alan Modra  <amodra@gmail.com>
3310
3311         * symtab.h (Symbol::clear_version): New function.
3312         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
3313         is_needed by weak references.  Clear version for symbols defined
3314         in as-needed objects that are not needed.
3315
3316 2013-03-15  Alan Modra  <amodra@gmail.com>
3317
3318         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
3319         static and public.  Add report_err param.  Return false for data refs.
3320         (Target_powerpc::rela_dyn_section): New overloaded function.
3321         (Target_powerpc::plt_, iplt_): Elucidate.
3322         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
3323         (Output_data_plt_powerpc::do_write): Don't write .iplt.
3324         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
3325         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
3326         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
3327         push_branch and make_plt_entry for ifunc syms when
3328         reloc_needs_plt_for_ifunc.
3329         (Target_powerpc::Relocate::relocate): Don't use plt entry value
3330         for ifunc unless reloc_needs_plt_for_ifunc.
3331
3332 2013-03-15  Alan Modra  <amodra@gmail.com>
3333
3334         * gc.h (gc_process_relocs): Don't look through function descriptors.
3335         * icf.cc (get_section_contents): Do so here instead.
3336
3337 2013-03-13  Alan Modra  <amodra@gmail.com>
3338
3339         * powerpc.cc (is_branch_reloc): Forward declare.
3340         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
3341         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
3342         false for 64-bit, true for 32-bit non-branch relocs.
3343         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
3344         * testsuite/Makefile.am (icf_test): Use linker map file instead of
3345         nm output.
3346         (icf_safe_test): Generate linker map file as well as nm output.
3347         (icf_safe_so_test): Likewise.
3348         * testsuite/Makefile.in: Regenerate.
3349         * testsuite/icf_test.sh: Parse linker map file to determine
3350         section folding.
3351         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
3352         * testsuite/icf_safe_so_test.sh: Likewise.
3353         (X86_32_or_ARM_specific_safe_fold): Merge into..
3354         (arch_specific_safe_fold): ..this.
3355         (X86_64_specific_safe_fold): Delete unused function.
3356
3357 2013-03-12  Alan Modra  <amodra@gmail.com>
3358
3359         * gc.h (gc_process_relocs): Look through function descriptors
3360         to determine shndx, symvalue and addend used by ICF.  Tidy
3361         variable duplication.
3362
3363 2013-03-11  Alan Modra  <amodra@gmail.com>
3364
3365         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
3366         * layout.cc (Layout_task_runner::run): ..to here.
3367         * symtab.h (struct Symbol_location): Extract from..
3368         (class Symbol_table): ..here.
3369         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
3370         * target.h (class Target): Add function_location and
3371         do_function_location functions.
3372         (class Sized_target): Add do_function_location.
3373         * object.h (class Sized_relobj_file): Move find_shdr..
3374         (class Object): ..to here.
3375         * object.cc: Likewise.  Update to suit.  Instantiate.
3376         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
3377         * powerpc.cc (class Powerpc_dynobj): New.
3378         (Target_powerpc::do_function_location): New function.
3379         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
3380         (Powerpc_dynobj::do_read_symbols): New function.
3381         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
3382
3383 2013-03-08  Ian Lance Taylor  <iant@google.com>
3384
3385         * options.cc (General_options::string_to_object_format): Accept
3386         "default".
3387
3388 2013-03-08  Alan Modra  <amodra@gmail.com>
3389
3390         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
3391         pointer to Post_fde.
3392         (struct Post_fde): Move definition to here..
3393         * ehframe.cc (struct Post_fde): ..from here.
3394         (Cie::write): Don't alloc Post_fde.
3395         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
3396
3397 2013-03-07  Alan Modra  <amodra@gmail.com>
3398
3399         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
3400         relocation referencing .LC0.
3401         * testsuite/discard_locals_test.sh: Remove FIXMEs.
3402
3403 2013-03-07  Alan Modra  <amodra@gmail.com>
3404
3405         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
3406         always_inline.  Add assembly for powerpc to avoid GOT.
3407
3408 2013-03-07  Alan Modra  <amodra@gmail.com>
3409
3410         * testsuite/script_test_10.sh: Don't test .bss section
3411         header number.
3412
3413 2013-03-06  Alan Modra  <amodra@gmail.com>
3414
3415         * powerpc.cc (class Powerpc_relobj): Move some member functions.
3416         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
3417         all callers.  Handle folded sections.
3418         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
3419         to Powerpc_relobj.
3420         (Global_symbol_visitor_opd::operator()): Likewise.
3421
3422 2013-03-04  Alan Modra  <amodra@gmail.com>
3423
3424         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
3425         * testsuite/Makefile.in: Regenerate.
3426
3427 2013-03-01  Cary Coutant  <ccoutant@google.com>
3428
3429         Add dwp support for v2 DWARF package file format.
3430         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
3431         tu_length parameter.  Adjust all callers.
3432         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
3433         * dwp.cc: Include dwarf.h.
3434         (Section_bounds): New struct type.
3435         (Unit_set): New struct type.
3436         (Dwo_file::Dwo_file): Initialize new data member.
3437         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
3438         Combine and rename to...
3439         (Dwo_file::read_unit_index): ...this.
3440         (Dwo_file::sized_read_compunit_index)
3441         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
3442         (Dwo_file::sized_read_unit_index): ...this.
3443         (Dwo_file::copy_section): Remove section_name, is_str_offsets
3444         parameters; add section_id parameter.
3445         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
3446         (Dwo_file::add_unit_set): ...this.
3447         (Dwo_file::shndx_map_): Remove.
3448         (Dwo_file::sect_offsets_): New data member.
3449         (Dwp_output_file::Dwp_output_file): Initialize new data members.
3450         (Dwp_output_file::add_section): Rename to...
3451         (Dwp_output_file::add_contribution): ...this.
3452         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
3453         (Dwp_output_file::add_tu_set): Likewise.
3454         (Dwp_output_file::Contribution): New type.
3455         (Dwp_output_file::Section::contributions): New data member.
3456         (Dwp_output_file::Cu_or_tu_set): Remove.
3457         (Dwp_output_file::Section::Section): New ctor.
3458         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
3459         (Dwp_output_file::Dwp_index::Section_table): New type.
3460         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
3461         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
3462         parameter.
3463         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
3464         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
3465         (Dwp_output_file::Dwp_index::section_table): New member function.
3466         (Dwp_output_file::Dwp_index::section_table_end): New member function.
3467         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
3468         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
3469         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
3470         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
3471         (Dwp_output_file::Dwp_index::section_table_): New data member.
3472         (Dwp_output_file::Dwp_index::section_mask_): New data member.
3473         (Dwp_output_file::add_output_section): New member function.
3474         (Dwp_output_file::write_new_section): New member function.
3475         (Dwp_output_file::write_contributions): New member function.
3476         (Dwp_output_file::section_id_map_): New data member.
3477         (class Dwo_id_info_reader): Remove.
3478         (class Unit_reader): New class.
3479         (get_dwarf_section_name): New function.
3480         (Dwo_file::read_executable): Adjust initializations of class data.
3481         (Dwo_file::read): Add support for v2 package file format.
3482         (Dwo_file::read_unit_index): Likewise.
3483         (Dwo_file::sized_read_unit_index): Likewise.
3484         (Dwo_file::copy_section): Likewise.
3485         (Dwo_file::add_unit_set): Likewise.
3486         (Dwp_output_file::add_output_section): Likewise.
3487         (Dwp_output_file::add_contribution): Likewise.
3488         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
3489         for empty slot.
3490         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
3491         file format.
3492         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
3493         slot.
3494         (Dwp_output_file::initialize): Remove unused function.
3495         (Dwp_output_file::finalize): Add support for v2 package file format.
3496         (Dwp_output_file::write_index): Likewise.
3497         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
3498         function prototype.
3499
3500 2013-03-01  Cary Coutant  <ccoutant@google.com>
3501
3502         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
3503         function into class definition in header file.
3504         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
3505         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
3506         New function.
3507         (Dwarf_info_reader::check_buffer): Move here from .cc file.
3508
3509 2013-02-28  Alan Modra  <amodra@gmail.com>
3510
3511         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
3512         * target.cc (Target::do_plt_fde_location): New function.
3513         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
3514         accessor function, and constructor param.
3515         (struct Post_fde, Post_fdes): Declare.
3516         (Cie::write): Add post_fdes param.
3517         * ehframe.cc (Fde::write): Use plt_fde_location.
3518         (struct Post_fde): Define.
3519         (Cie::write): Stash FDEs added post merge mapping.
3520         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
3521         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
3522         (Eh_frame::do_sized_write): Arrange to write post map FDES after
3523         other FDEs.
3524         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
3525         (Target_powerpc::has_glink): New function.
3526         (Target_powerpc::do_relax): Add eh_frame info for stubs.
3527         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
3528         glink_eh_frame_fde_32, default_fde): New data.
3529         (Stub_table::eh_frame_added_): New var.
3530         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
3531         Make const.
3532         (Stub_table::add_eh_frame): New function.
3533         (Output_data_glink::add_eh_frame): New function.
3534         (Target_powerpc::make_glink_section): Call add_eh_frame.
3535
3536 2013-02-15  Ian Lance Taylor  <iant@google.com>
3537
3538         * options.h (DEFINE_uint64_alias): Define.
3539         (class General_options): Add -Ttext-segment as an alias for
3540         -Ttext.
3541
3542 2013-02-15  Alan Modra  <amodra@gmail.com>
3543
3544         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
3545         (Stub_table::do_write): ..here, two places.
3546         (Stub_table::plt_call_size): Use it here too.
3547
3548 2013-02-11  Ian Lance Taylor  <iant@google.com>
3549
3550         * descriptors.cc (Descriptors::close_all): New function.
3551         * descriptors.h (class Descriptors): Declare close_all.
3552         (close_all_descriptors): New inline function.
3553         * plugin.cc: Include "descriptors.h".
3554         (Plugin_manager::cleanup): Call close_all_descriptors.
3555
3556 2013-02-06  Alan Modra  <amodra@gmail.com>
3557
3558         * README: Update coding style link.
3559
3560 2013-01-28  Cary Coutant  <ccoutant@google.com>
3561
3562         * dwp.cc (File_list): New typedef.
3563         (Dwo_name_info_reader): New class.
3564         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
3565         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
3566         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
3567         (Dwo_file::read_executable): New function.
3568         (Dwo_file::read): Move common setup code to ...
3569         (Dwo_file::make_object): ... here.
3570         (dwp_options): Add --exec/-e.
3571         (usage): Likewise.
3572         (main): Likewise.
3573
3574 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
3575
3576         * layout.cc (Layout::layout): Check for option text_reorder.
3577         (Layout::make_output_section): Ditto.
3578         * options.h (text_reorder): New option.
3579         * output.cc (Input_section_sort_compare): Remove special ordering
3580         of section names.
3581         (Output_section::
3582          Input_section_sort_section_name_special_ordering_compare::
3583          operator()): New function.
3584         (Output_section::sort_attached_input_sections): Use new sort function
3585         for .text.
3586         * output.h (Input_section_sort_section_name_special_ordering_compare):
3587         New struct.
3588         * testsuite/Makefile.am (text_section_grouping): Test option
3589         --no-text-reorder
3590         * testsuite/Makefile.in: Regenerate.
3591         * testsuite/text_section_grouping.sh: Check order of functions without
3592         default text reordering.
3593
3594 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3595
3596         * options.h (General_options): Change default to true for new_dtags.
3597
3598 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3599
3600         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
3601         when enable_new_dtags is false.  Only add DT_RUNPATH when
3602         enable_new_dtags is true.
3603
3604 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
3605
3606         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
3607         used in declaration and definition consistent.
3608         (Target_powerpc::symval_for_branch): Ditto.
3609
3610 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3611
3612         * testsuite/plugin_final_layout.cc: Fix comment.
3613
3614 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3615
3616         * layout.cc (Layout::layout): Do not do default sorting for
3617         text sections when section ordering is specified.
3618         (make_output_section): Ditto.
3619         * testsuite/plugin_final_layout.cc: Name the function sections
3620         to catch reordering issues.
3621
3622 2013-01-15  Alan Modra  <amodra@gmail.com>
3623
3624         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
3625         plt-thread-safe.
3626
3627 2013-01-15  Alan Modra  <amodra@gmail.com>
3628
3629         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
3630         * testsuite/Makefile.in: Regenerate.
3631
3632 2013-01-14  Alan Modra  <amodra@gmail.com>
3633
3634         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
3635         * testsuite/Makefile.in: Regenerate.
3636
3637 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
3638
3639         PR bfd/14430
3640         Fix mingw gold build with plugins enabled
3641         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
3642         * configure.ac: Export DLOPEN_LIBS and add headers check.
3643         * plugin.cc: Handle non-dlfcn case.
3644         * Makefile.in: Regenerate.
3645         * config.in: Regenerate.
3646         * configure: Regenerate.
3647         * testsuite/Makefile.in: Regenerate.
3648
3649 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
3650
3651         * output.h (sort_attached_input_sections): Change to be public.
3652         * script-sections.cc
3653         (Output_section_definition::set_section_addresses): Sort
3654         attached input sections according to section order before linker
3655         script assigns section addresses.
3656         (Orphan_output_section::set_section_addresses): Sort
3657         attached input sections according to section order before linker
3658         script assigns section addresses.
3659         * Makefile.am (final_layout.sh): Use a simple linker script to
3660         check if section ordering still works.
3661         * Makefile.in: Regenerate.
3662
3663 2013-01-09  Ben Cheng  <bccheng@google.com>
3664
3665         * arm.cc (Target_arm::attributes_accept_div): New function.
3666         (Target_arm::attributes_forbid_div): New function.
3667         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
3668         attribute using the same new functions as what bfd/elf32_arm.c
3669         does.
3670
3671 2013-01-07  Cary Coutant  <ccoutant@google.com>
3672
3673         PR gold/14993
3674         * output.cc (Output_section::add_input_section): For incremental
3675         updates, don't track input sections that are allocated from patch
3676         space.
3677
3678 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3679             Ian Lance Taylor  <iant@google.com>
3680
3681         PR gold/14897
3682         * configure.ac (--enable-ld): Removed.
3683         (install_as_default): Set to yes only for --enable-gold=default
3684         or --disable-ld.
3685         * configure: Regenerated.
3686
3687 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3688
3689         * options.h (General_options): Add -fuse-ld= for GCC linker
3690         option compatibility.
3691
3692 2013-01-04  Cary Coutant  <ccoutant@google.com>
3693
3694         * configure.ac: Fix typo restoring CXXFLAGS.
3695         * configure: Regenerate.
3696
3697 2013-01-04  Cary Coutant  <ccoutant@google.com>
3698
3699         * testsuite/Makefile.am (CXXLINK_S): New macro.
3700         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
3701         * testsuite/Makefile.in: Regenerate.
3702
3703 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
3704
3705         * version.cc (print_version): Update copyright year to 2013.
3706
3707 2012-12-20  Ian Lance Taylor  <iant@google.com>
3708
3709         * layout.cc (Layout::special_ordering_of_input_section): New
3710         function.
3711         (Layout::layout): If input section requires special ordering, must
3712         sort input sections.
3713         (Layout::make_output_section): May sort .text input sections.
3714         (Layout::is_section_name_prefix_grouped): Remove.
3715         * layout.h (class Layout): Declare
3716         special_ordering_of_input_section.  Don't declare
3717         is_section_name_prefix_grouped.
3718         * output.cc (Output_section::add_input_section): Revert last
3719         change.
3720         (Output_section::Input_section_sort::match_file_name): Don't crash
3721         if called on output section data.
3722         (Output_section::Input_section_sort_compare): Sort based on
3723         special ordering.
3724         (Output_section::Input_section_sort_section_order_index_compare):
3725         Revert last patch.
3726         (Output_section::sort_attached_input_sections): Likewise.
3727
3728 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
3729
3730         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
3731         * layout.h (Layout::is_section_name_prefix_grouped): New function.
3732         * output.cc (Output_section::add_input_section): Check if section
3733         name contains special prefix.  Keep input sections to sort such
3734         sections.
3735         (Output_section::Input_section_sort_section_order_index_compare
3736          ::operator()): Group sections according to prefixes.
3737         (Output_section::sort_attached_input_sections): Add condition to
3738         Input_section_entry constructor call.
3739         * testsuite/Makefile.am (text_section_grouping): New test.
3740         * testsuite/Makefile.in: Regenerate.
3741         * testsuite/text_section_grouping.cc: New file.
3742         * testsuite/text_section_grouping.sh: New file.
3743
3744 2012-12-17  Nick Clifton  <nickc@redhat.com>
3745
3746         * Makefile.am: Add copyright notice.
3747         * NEWS: Likewise.
3748         * README: Likewise.
3749         * configure.ac: Likewise.
3750         * ftruncate.c: Likewise.
3751         * Makefile.in: Regenerate.
3752
3753 2012-12-14  Cary Coutant  <ccoutant@google.com>
3754
3755         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
3756         --no-as-needed flag.
3757         (exception_separate_shared_12_test): Likewise.
3758         (incremental_copy_test): Likewise.
3759         * testsuite/Makefile.in: Regenerate.
3760
3761 2012-12-14  Cary Coutant  <ccoutant@google.com>
3762
3763         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
3764         (Dwp_output_file::Dwp_index::enter_set): Add assert.
3765
3766 2012-12-12  Alan Modra  <amodra@gmail.com>
3767
3768         * powerpc.cc (class Track_tls): New.
3769         (class Relocate, class Scan): Inherit Track_tls.
3770         (Target_powerpc::Scan::local, global): Track tls optimization
3771         and avoid creating plt entry for __tls_get_addr if all uses
3772         are optimized away.
3773         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
3774
3775 2012-12-12  Alan Modra  <amodra@gmail.com>
3776
3777         * options.h (General_options): Add --toc-sort/--no-toc-sort.
3778         Replace no_toc_optimize with toc_optimize.
3779         * output.h (Output_section::input_sections): Provide non-const variant.
3780         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
3781         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
3782         accessors.
3783         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
3784         (class Sort_toc_sections): New.
3785         (Target_powerpc::do_finalize_sections): Sort toc sections.
3786         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
3787
3788 2012-12-10  Roland McGrath  <mcgrathr@google.com>
3789
3790         * testsuite/binary_unittest.cc (read_all): New function.
3791         (Sized_binary_test): Use it instead of ::read.
3792         * fileread.cc (do_read): Don't assume pread always reads the whole
3793         amount in a single call.
3794
3795 2012-12-10  Alan Modra  <amodra@gmail.com>
3796
3797         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
3798         Set EM_PPC64 or EM_PPC here.
3799         (Target_selector_powerpc::do_recognize): Delete.
3800
3801 2012-12-10  Alan Modra  <amodra@gmail.com>
3802
3803         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
3804         stub_table_.
3805         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
3806
3807 2012-12-07  Roland McGrath  <mcgrathr@google.com>
3808
3809         * testsuite/binary_unittest.cc (Sized_binary_test):
3810         Use open_descriptor rather than ::open.
3811
3812 2012-12-07  Alan Modra  <amodra@gmail.com>
3813
3814         * powerpc.cc (Stub_table::do_write): Delete redundant Address
3815         typedef and invalid_address constant.
3816         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
3817         instantiate constants.
3818
3819 2012-12-06  Roland McGrath  <mcgrathr@google.com>
3820
3821         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
3822         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
3823         * aclocal.m4: Regenerate.
3824         * configure: Regenerate.
3825         * Makefile.in: Regenerate.
3826         * testsuite/Makefile.in: Regenerate.
3827
3828 2012-12-07  Alan Modra  <amodra@gmail.com>
3829
3830         * options.h (General_options): Add no_toc_optimize.
3831         * powerpc.cc (ok_lo_toc_insn): New function.
3832         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
3833
3834 2012-12-06  Alan Modra  <amodra@gmail.com>
3835
3836         * options.h (General_options): Add plt_align, plt_static_chain,
3837         plt_thread_safe.  Update stub_group_size help text.
3838         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
3839         for new plt_thread_safe_ var.
3840         (use_plt_offset): Correct comments.
3841         (Target_powerpc::do_relax): Look for thread creation symbols to
3842         determine default plt_thread_safe value.  Clear plt call stubs
3843         as well as branch stubs each iteration.
3844         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
3845         insn constants.
3846         (l, hi, ha, write_insn): Move earlier.
3847         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
3848         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
3849         plt stubs too.
3850         (Stub_table::update_size): Adjust.
3851         (Stub_table::prev_size, set_prev_size): Delete.
3852         (Stub_table::stub_align): Let --plt-align affect result.
3853         (Stub_table::plt_call_size): Calculate sizes for various stubs.
3854         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
3855         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
3856         (Stub_table::do_write): Support more stub variants.
3857
3858 2012-12-04  Alan Modra  <amodra@gmail.com>
3859
3860         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
3861         (Target_powerpc::do_define_standard_symbols): New function.
3862
3863 2012-12-03  Alan Modra  <amodra@gmail.com>
3864
3865         * output.h: Formatting, whitespace.
3866
3867 2012-12-03  Alan Modra  <amodra@gmail.com>
3868
3869         * layout.h (Layout::get_executable_sections): Declare.
3870         * layout.cc (Layout::get_executable_sections): New function.
3871         * arm.cc (Target_arm::group_sections): Use it.
3872         (Arm_output_section::group_sections): Delete now redundant test.
3873         * output.cc (Output_reloc::Output_reloc): Add is_relative.
3874         param to handle relative relocs.
3875         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
3876         (Output_data_reloc::add_absolute): Adjust.
3877         (Output_data_reloc::add_relative): New function.
3878         (Output_data::reset_data_size): New function.
3879         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
3880         (Output_section::set_addralign): New function.
3881         (Output_section::checkpoint_set_addralign): New function.
3882         (Output_section::clear_section_offsets_need_adjustment): New function.
3883         (Output_section::input_sections): Make public.
3884         * powerpc.cc (class Output_data_brlt_powerpc): New.
3885         (class Stub_table, class Stub_control): New.
3886         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
3887         stub_table_, set_stub_table, stub_table): New vectors and accessor
3888         functions.
3889         (Target_powerpc::do_may_relax, do_relax, push_branch,
3890         new_stub_table, stub_tables, brlt_section, group_sections,
3891         add_branch_lookup_table, find_branch_lookup_table,
3892         write_branch_lookup_table, make_brlt_section): New functions.
3893         (Target_powerpc::struct Sort_sections, class Branch_info): New.
3894         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
3895         branch_info_): New vars.
3896         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
3897         make call stubs here.
3898         (Output_data_glink): Remove all call stub handling from this class.
3899         (Target_powerpc::Scan::local, global): Save interesting branch
3900         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
3901         (Target_powerpc::do_finalize_sections): Only make reg save/restore
3902         functions on final link.
3903         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
3904         Handle long branch destinations too.
3905         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
3906         do_plt_address_for_local): Adjust lookup of plt call stubs.
3907
3908 2012-11-30  Alan Modra  <amodra@gmail.com>
3909
3910         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
3911         relocs against protected symbols when building 32-bit shared libs.
3912
3913 2012-11-30  Alan Modra  <amodra@gmail.com>
3914
3915         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
3916         param.  Call got_section() to make .got.  Update all callers
3917         and their callers and so on.
3918
3919 2012-11-30  Alan Modra  <amodra@gmail.com>
3920
3921         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
3922         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
3923         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
3924         value if it already exists.
3925
3926 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
3927
3928         PR gold/14858
3929         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
3930
3931 2012-11-14  Roland McGrath  <mcgrathr@google.com>
3932
3933         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
3934         than bfc instruction for data sandboxing.
3935
3936 2012-11-08  Alan Modra  <amodra@gmail.com>
3937
3938         * po/POTFILES.in: Regenerate.
3939
3940 2012-11-05  Alan Modra  <amodra@gmail.com>
3941
3942         * configure.ac: Apply 2012-09-10 change to config.in here.
3943         * configure: Regenerate.
3944
3945 2012-11-05  Alan Modra  <amodra@gmail.com>
3946
3947         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
3948         (struct Opd_ent): Use "Address" rather than "Offset".
3949         (Output_data_got_powerpc::got_base_offset): Return Valtype.
3950         (Target_powerpc::got_section): Make public.
3951         (Target_powerpc::scan_relocs): Move code setting symbols..
3952         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
3953         Create _SDA_BASE_ only when referenced.
3954
3955 2012-11-02  Roland McGrath  <mcgrathr@google.com>
3956
3957         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
3958         from last change.
3959
3960 2012-11-01  Roland McGrath  <mcgrathr@google.com>
3961
3962         * target.h (Sized_target::relocate_relocs): Use Elf_Off
3963         for offset_in_output_section parameter.
3964         (Sized_target::relocate_special_relocatable): Likewise.
3965         * arm.cc (Target_arm::relocate_relocs): Likewise.
3966         (Target_arm::relocate_special_relocatable): Likewise.
3967         * i386.cc (Target_i386::relocate_relocs): Likewise.
3968         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
3969         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
3970         * target-reloc.h (relocate_relocs): Likewise.
3971         * testsuite/testfile.cc (Target_test): Likewise.
3972         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
3973         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
3974
3975         * system.h: Move inclusion of <clocale> to after <libintl.h> in
3976         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
3977
3978         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
3979         parameter, which is unused in the [!F_SETFD] case.
3980
3981         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
3982         SYMNDX to off_t before comparing it to this->data_size().
3983         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
3984         * incremental.cc (Output_section_incremental_inputs::do_write):
3985         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
3986
3987         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
3988
3989 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
3990
3991         * gold.cc (Target_arm::do_adjust_elf_header): Add the
3992         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
3993         in EABI_VER5.
3994
3995 2012-10-29  Cary Coutant  <ccoutant@google.com>
3996
3997         * dwp.cc (usage): Add file and exit status parameters;
3998         add --help and --version options.
3999         (print_version): New function.
4000         (main): Add --help and --version options.
4001
4002 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4003
4004         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
4005         final_layout_sequence.txt.
4006         * testsuite/Makefile.in: Regenerated.
4007
4008 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4009
4010         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
4011         COMPILE generated by automake.
4012         (LINK1): Likewise.
4013         (CXXCOMPILE1): Likewise.
4014         (CXXLINK1): Likewise.
4015         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
4016         (LINK): Likewise.
4017         (CXXCOMPILE): Likewise.
4018         (CXXLINK): Likewise.
4019         * testsuite/Makefile.in: Regenerated.
4020
4021 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4022
4023         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
4024         on bad fwrite return.
4025
4026 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4027
4028         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
4029         on val.
4030
4031 2012-10-23  Cary Coutant  <ccoutant@google.com>
4032
4033         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
4034         * testsuite/Makefile.in: Regenerate.
4035         * testsuite/dwp_test.h: New source file.
4036         * testsuite/dwp_test_1.cc: New source file.
4037         * testsuite/dwp_test_1.s: New source file.
4038         * testsuite/dwp_test_1.sh: New source file.
4039         * testsuite/dwp_test_1b.cc: New source file.
4040         * testsuite/dwp_test_1b.s: New source file.
4041         * testsuite/dwp_test_2.cc: New source file.
4042         * testsuite/dwp_test_2.s: New source file.
4043         * testsuite/dwp_test_2.sh: New source file.
4044         * testsuite/dwp_test_main.cc: New source file.
4045         * testsuite/dwp_test_main.s: New source file.
4046
4047 2012-10-23  Cary Coutant  <ccoutant@google.com>
4048
4049         * dwp.h: New header file.
4050         * dwp.cc: New source file.
4051         * gold.h: Move shared declarations to system.h.
4052         * system.h: New header file.
4053         * Makefile.am: Add dwp.
4054         * Makefile.in: Regenerate.
4055
4056 2012-10-23  Cary Coutant  <ccoutant@google.com>
4057
4058         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
4059         Dwarf_info_reader::read_from_pointer.
4060         (Dwarf_pubnames_table::read_header): Likewise.
4061         (Dwarf_pubnames_table::next_name): Likewise.
4062         (Dwarf_die::read_attributes): Likewise.
4063         (Dwarf_die::skip_attributes): Likewise.
4064         (Dwarf_info_reader::read_from_pointer): New function template.
4065         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
4066         (Dwarf_pubnames_table): Likewise.
4067         (Dwarf_info_reader::read_from_pointer): New function template.
4068         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
4069         Dwarf_pubnames_table ctor.
4070
4071 2012-10-23  Cary Coutant  <ccoutant@google.com>
4072
4073         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
4074         abbrev_shndx.
4075         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
4076         abbrev_shndx_.
4077         (Dwarf_info_reader::set_abbrev_shndx): New method.
4078         (Dwarf_info_reader::abbrev_shndx_): New data member.
4079
4080 2012-10-23  Cary Coutant  <ccoutant@google.com>
4081
4082         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
4083         from object, not parameters.
4084         (Dwarf_info_reader::parse): Likewise.
4085         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
4086         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
4087         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
4088         methods.
4089
4090 2012-10-23  Cary Coutant  <ccoutant@google.com>
4091
4092         * fileread.cc (Input_file::Input_file): New constructor.
4093         * fileread.h (class Input_file): Add new constructor.
4094
4095 2012-10-18  Alan Modra  <amodra@gmail.com>
4096
4097         PR gold/14727
4098         * object.cc (Relobj::is_section_name_included): Also match
4099         .sdata personality section.
4100
4101 2012-10-18  Alan Modra  <amodra@gmail.com>
4102
4103         * target-reloc.h (class Default_comdat_behavior): New, package up..
4104         (get_comdat_behaviour): ..this.
4105         (relocate_section): Add Relocate_comdat_behavior template arg,
4106         adjust code to suit.
4107         * arm.cc (Target_arm::relocate_section): Adjust to suit.
4108         (Target_arm::scan_reloc_section): Likewise.
4109         * i386.cc (Target_i386::relocate_section): Likewise.
4110         * sparc.cc (Target_sparc::relocate_section): Likewise.
4111         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
4112         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
4113         * powerpc.cc (class Relocate_comdat_behavior): New.
4114         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
4115         gold::relocate_section with new template arg.
4116
4117 2012-10-18  Alan Modra  <amodra@gmail.com>
4118
4119         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
4120         dynamic relocs for GOT_TPREL got entries, without symbol if
4121         resolving locally.
4122         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
4123         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
4124         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
4125
4126 2012-10-17  Alan Modra  <amodra@gmail.com>
4127
4128         PR gold/14726
4129         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
4130
4131 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
4132
4133         * layout.cc (Layout::include_section): Keep sections marked
4134         SHF_EXCLUDE when doing relocatable links.
4135
4136 2012-10-16  Alan Modra  <amodra@gmail.com>
4137
4138         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
4139         (Target_powerpc::do_finalize_sections): Call it.
4140         (Output_data_save_res): New class and supporting functions.
4141         (Target_powerpc::symval_for_branch): Only look up .opd entry for
4142         normal symbols defined in object files.
4143
4144 2012-10-12  Alan Modra  <amodra@gmail.com>
4145
4146         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
4147         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
4148         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
4149         section if scan_opd_relocs not yet called.
4150         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
4151
4152 2012-10-12  Alan Modra  <amodra@gmail.com>
4153
4154         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
4155         add_local_ifunc_entry): Revert last change.
4156         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
4157
4158 2012-10-05  Alan Modra  <amodra@gmail.com>
4159
4160         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
4161         do_plt_address_for_global): New functions.
4162         (Output_data_got_powerpc::do_write): Don't segfault when linking
4163         statically.
4164         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
4165         add_local_ifunc_entry): Return true on adding entry..
4166         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
4167         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
4168         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
4169         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
4170         set up symbols here.
4171         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
4172         syms here.  Do so even when no .iplt.  Don't segfault when linking
4173         statically.
4174         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
4175         new variants without reloc param.
4176         (Glink_sym_ent::Glink_sym_ent): Likewise.
4177         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
4178         reloc when refs will resolve to plt call stub.
4179         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
4180         R_PPC_PLTREL24 to resolve locally.
4181         (Target_powerpc::Scan::global): Correct ifunc handling.
4182         (Target_powerpc::Relocate::relocate): Correct local sym glink
4183         lookup.  Don't destroy "value" when we have a plt call stub,
4184         and when checking plt call validity.
4185         (Target_powerpc::do_dynsym_value): Simplify.
4186
4187 2012-10-05  Alan Modra  <amodra@gmail.com>
4188
4189         * i386.cc (Output_data_plt_i386::address_for_global,
4190         address_for_local): Add plt offset to returned value.  Adjust uses.
4191         * sparc.cc (Output_data_plt_sparc::address_for_global,
4192         address_for_local): Likewise.
4193         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
4194         address_for_local): Likewise.
4195         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
4196         address_for_local): Likewise.
4197         * target.h (Target::plt_address_for_global, plt_address_for_local):
4198         Update comment.
4199         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
4200         (Output_data_got::Got_entry::write): Nor here.
4201         * output.h: Comment fix.
4202
4203 2012-10-02  Jiong Wang  <jiwang@tilera.com>
4204
4205         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
4206         global_offset_table_ value for larget got.
4207         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
4208
4209 2012-09-29  Alan Modra  <amodra@gmail.com>
4210
4211         * powerpc.cc (Target_powerpc::iplt_): New output section.
4212         (Target_powerpc::iplt_section, make_iplt_section,
4213         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
4214         (Target_powerpc::make_plt_entry): Handle ifunc syms.
4215         Target_powerpc::plt_entry_count): Count iplt entries too.
4216         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
4217         reloc section in constructor.  New params.
4218         (Target_powerpc::make_plt_section): Create reloc section here instead.
4219         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
4220         functions.
4221         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
4222         (Output_data_glink::add_entry, find_entry): New functions to
4223         deal with local syms.
4224         (Glink_sym_ent): Add support for local syms.
4225         (Output_data_glink::do_write): Handle ifunc plt entries.
4226         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4227         (Target_powerpc::Scan::local, global): Handle ifunc syms.
4228         (Target_powerpc::Relocate::relocate): Likewise.
4229         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
4230
4231 2012-09-25  Alan Modra  <amodra@gmail.com>
4232
4233         * object.h (Sized_relobj_file::adjust_local_symbol,
4234         do_adjust_local_symbol): New functions.
4235         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
4236         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
4237         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
4238         and irregular opd entry spacing.
4239         (Powerpc_relobj::do_read_relocs): Add opd size checks.
4240         (Global_symbol_visitor_opd): New functor.
4241         (Target_powerpc::do_finalize_sections): Omit global symbols defined
4242         on deleted opd entries.
4243
4244 2012-09-15  Jiong Wang  <jiwang@tilera.com>
4245
4246         * tilegx.cc: New file.
4247         * Makefile.am (TARGETSOURCES): Add tilegx.cc
4248         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
4249         * configure.tgt: Add entries for tilegx*.
4250         * configure.ac: Likewise.
4251         * Makefile.in: Rebuild.
4252         * configure: Likewise.
4253         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
4254         tilegx.
4255
4256 2012-09-13  Alan Modra  <amodra@gmail.com>
4257
4258         * target-reloc.h (scan_relocs): Call scan.local for relocs
4259         against symbols in discarded sections.  Pass is_discarded
4260         param.
4261         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
4262         Add is_discarded param.
4263         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
4264         is_discarded to flag opd entry as discarded.  Don't emit dyn
4265         relocs on such entries.
4266         (Target_powerpc::Scan::global): Similarly detect and handle
4267         such opd entries.
4268         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
4269         opd_ent_.  Update all uses.
4270         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
4271         (Target_powerpc::relocate_section): Zero out discarded opd
4272         entry relocs.
4273
4274 2012-09-12  Ian Lance Taylor  <iant@google.com>
4275
4276         PR gold/14570
4277         * output.cc: Rename Output_data_got template parameter from size
4278         to got_size for all functions.  Compile all variants of
4279         Output_data_got.
4280         (Output_data_got::Got_entry::write): Correct use of size for
4281         symbol value.  Use local_is_tls rather than casting to
4282         Sized_relobj_file.
4283         * object.h (class Object): Add local_is_tls and do_local_is_tls.
4284         (class Sized_relobj_file): Add do_local_is_tls.
4285         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
4286
4287 2012-09-11  Alan Modra  <amodra@gmail.com>
4288
4289         PR gold/14566
4290         * layout.cc (Layout::set_segment_offsets): When using
4291         common-page-size alignment, ensure we are on a new max-page-size
4292         page.
4293         * output.cc (Output_segment::set_section_addresses): Use
4294         abi_pagesize, not common_pagesize for relro boundary.
4295         (Output_segment::set_offset): Likewise.
4296
4297 2012-09-11  Alan Modra  <amodra@gmail.com>
4298
4299         * output.h (Output_data_got::add_global_tls, add_local_tls,
4300         add_local_tls_pair): New functions.
4301         (Output_data_got::add_local_pair_with_rel): Remove second
4302         reloc param.  Expand comment.
4303         (Output_data_got::Got_entry): Rename use_plt_offset_ to
4304         use_plt_or_tls_offset_, similarly for constructor param.
4305         (Output_data_got::Got_entry::write): Add got_index param.
4306         * output.cc (Output_data_got::add_global_tls, add_local_tls,
4307         add_local_tls_pair): New functions.
4308         (Output_data_got::Got_entry::write): Handle tls symbols
4309         with use_plt_or_tls_offset_ set specially.
4310         (Output_data_got::add_local_pair_with_rel): Only one reloc.
4311         (Output_data_got::do_write): Replace iterator with index, pass
4312         index to entry write function.
4313         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
4314         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
4315         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
4316         call.
4317         * i386.cc (Target_i386::Scan::local): Likewise.
4318         * sparc.cc (Target_sparc::Scan::local): Likewise.
4319         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
4320         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
4321         do_tls_offset_for_global): New functions.
4322         (Target_powerpc::Scan::local): Correct TLS relocations and got
4323         entry values.
4324         (Target_powerpc::Scan::global): Don't emit unnecessary
4325         dynamic relocations on TLS GOT entries.
4326
4327 2012-09-10  Matthias Klose  <doko@ubuntu.com>
4328
4329         * config.in: Disable sanity check for kfreebsd.
4330
4331 2012-09-10  Sterling Augustine  <saugustine@google.com>
4332
4333         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
4334         (Gdb_index::pubtypes_read): New parameter.
4335         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
4336         to calls.
4337         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
4338         pubtypes_object_.
4339
4340 2012-09-09  Alan Modra  <amodra@gmail.com>
4341
4342         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
4343         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
4344         * gc.h (gc_process_relocs): Call target gc_add_reference.
4345         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
4346         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
4347         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
4348         unnecessary cast.
4349         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
4350         to cater for when we don't need code offset.  Update use.
4351         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
4352         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
4353         set_opd_valid): New functions.
4354         (Target_powerpc::do_gc_add_reference): New function.
4355         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
4356         stashed refs.
4357         (Target_powerpc::do_gc_mark_symbol): New function.
4358
4359 2012-09-06  Cary Coutant  <ccoutant@google.com>
4360
4361         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
4362         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
4363         (Dwarf_die::skip_attributes): Likewise.
4364         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
4365         * testsuite/gdb_index_test.cc (inline_func_1): New function.
4366         (main): Call it.
4367         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
4368
4369 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
4370
4371         * testsuite/script_test_3.t: Add .got.plt output section
4372         statement.
4373         * testsuite/script_test_4.t: Likewise.
4374
4375 2012-09-05  Alan Modra  <amodra@gmail.com>
4376
4377         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
4378         update all uses and lose "enum" when using type.
4379
4380 2012-09-05  Alan Modra  <amodra@gmail.com>
4381
4382         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
4383         * configure: Regenerate.
4384         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
4385         (plugin_final_layout.stdout): Likewise.
4386         (memory_test): Set page sizes to 0x1000.
4387         * testsuite/Makefile.in: Regenerate.
4388         * testsuite/discard_locals_test.sh: Add FIXME comment.
4389         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
4390         * testsuite/pr14265.t: Add .got output section statement.
4391         * testsuite/script_test_2.t: Likewise.
4392         * testsuite/script_test_3.t: Likewise.
4393         * testsuite/script_test_4.t: Likewise.
4394         * testsuite/script_test_5.t: Likewise.
4395         * testsuite/script_test_6.t: Likewise.
4396         * testsuite/script_test_7.t: Likewise.
4397         * testsuite/script_test_9.t: Likewise.
4398
4399 2012-09-05  Alan Modra  <amodra@gmail.com>
4400
4401         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
4402         (Powerpc_relocate_functions::Status): New typedef.
4403         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4404         (Target_powerpc::Scan::local): Handle REL64.
4405         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
4406         for REL32 and REL64.
4407         (Target_powerpc::symval_for_branch): New function, extracted from..
4408         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
4409         checks.  Report overflow errors.
4410
4411 2012-09-05  Alan Modra  <amodra@gmail.com>
4412
4413         * object.h (Sized_relobj_file::emit_relocs): Delete.
4414         (Sized_relobj_file::emit_relocs_reltype): Delete.
4415         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
4416         relocate_relocs for --emit-relocs.
4417         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
4418         * output.h: Update comment.
4419         (Output_segment::first_section): New function.
4420         (Output_segment::first_section_load_address): Use first_section.
4421         * output.cc (Output_segment::first_section): New function extracted..
4422         (Output_segment::first_section_load_address): ..from here.  Delete.
4423         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
4424         * target.h (Sized_target::relocate_for_relocatable): Likewise.
4425         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
4426         adjust call to target.h function.
4427         * i386.cc (Target_i386): Likewise.
4428         * sparc.cc (Target_sparc): Likewise.
4429         * x86_64.cc (Target_x86_64): Likewise.
4430         * powerpc.cc (Target_powerpc): Likewise.
4431         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
4432         first tls section has section symbol for optimised local dynamic
4433         output relocs.
4434         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
4435         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
4436         optimised tls code.
4437         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
4438         Rename to relocate_relocs.  Update error message.
4439
4440 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
4441
4442         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
4443         --just-symbols.
4444
4445 2012-08-31  Alan Modra  <amodra@gmail.com>
4446
4447         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
4448         (Powerpc_relobj::toc_base_offset): New stub function.
4449         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
4450         got_mod_index_offset to tlsld_got_offset.  Update all refs.
4451         (Target_powerpc::Relocate::enum skip_tls): New.
4452         (Target_powerpc::call_tls_get_addr_): New var.
4453         (Target_powerpc::is_branch_reloc): Move to file scope.
4454         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
4455         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
4456         New functions.
4457         (Target_powerpc::enum Got_type): Delete old values, add new ones.
4458         (powerpc_info): Correct common_pagesize for ppc64.
4459         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
4460         (Powerpc_relocate_functions): Add overflow check enums and functions.
4461         Add non-shift version of rela, rela_ua.  Delete all rel public
4462         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
4463         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
4464         addr16_ha3, addr14 functions.
4465         (Output_data_got_powerpc::add_constant_pair): New function.
4466         (Output_data_got_powerpc::got_base_offset): Likewise.
4467         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
4468         (instruction constants): Sort, add some more.
4469         (Output_data_glink::do_write): Add and use Address typedef.  Use
4470         object->toc_base_offset() stub for 64-bit.
4471         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
4472         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4473         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
4474         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
4475         Always treat .opd relocs as against locally defined symbol.
4476         Correct condition for RELATIVE relocs.
4477         (Target_powerpc::do_finalize_sections): Test for NULL sections.
4478         (Target_powerpc::Relocate::relocate): Use plt call stub as value
4479         for 32-bit syms with a plt entry.  Correct ppc64 toc base
4480         calculations.  Handle TLS relocs, and more.  Add overflow
4481         checking and adjust for Powerpc_relocate_functions changes.
4482         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
4483         Reinstate --emit-relocs code with FIXME.
4484
4485 2012-08-30  Alan Modra  <amodra@gmail.com>
4486
4487         * layout.cc (Layout::set_segment_offsets): Set p_align to
4488         abi_pagesize, not common_pagesize.
4489         (Layout::relaxation_loop_body): Similarly use abi_pagesize
4490         to determine whether file header can go in segment.
4491
4492 2012-08-30  Alan Modra  <amodra@gmail.com>
4493
4494         * output.h (Output_reloc::Output_reloc <output section>): Add
4495         is_relative param.  Adjust calls.
4496         (Output_reloc::add_output_section_relative): New functions.
4497         * output.cc (Output_reloc::Output_reloc <output section>): Handle
4498         is_relative.
4499         (Output_reloc::symbol_value): Handle SECTION_CODE.
4500
4501 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
4502
4503         * gold.cc (queue_middle_tasks): Call layout again when unique
4504         segments for sections is desired.
4505         * layout.cc (Layout::Layout): Initialize new members.
4506         (Layout::get_output_section_flags): New function.
4507         (Layout::choose_output_section): Call get_output_section_flags.
4508         (Layout::layout): Make output section for mapping to a unique segment.
4509         (Layout::insert_section_segment_map): New function.
4510         (Layout::attach_allocated_section_to_segment): Make unique segment for
4511         output sections marked so.
4512         (Layout::segment_precedes): Check for unique segments when sorting.
4513         * layout.h (Layout::Unique_segment_info): New struct.
4514         (Layout::Section_segment_map): New typedef.
4515         (Layout::insert_section_segment_map): New function.
4516         (Layout::get_output_section_flags): New function.
4517         (Layout::is_unique_segment_for_sections_specified): New function.
4518         (Layout::set_unique_segment_for_sections_specified): New function.
4519         (Layout::unique_segment_for_sections_specified_): New member.
4520         (Layout::section_segment_map_): New member.
4521         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
4522         Rename is_gc_pass_one to is_pass_one.
4523         Rename is_gc_pass_two to is_pass_two.
4524         Rename is_gc_or_icf to is_two_pass.
4525         Check for which pass based on whether symbols data is present.
4526         Make it two pass when unique segments for sections is desired.
4527         * output.cc (Output_section::Output_section): Initialize new
4528         members.
4529         * output.h (Output_section::is_unique_segment): New function.
4530         (Output_section::set_is_unique_segment): New function.
4531         (Output_section::is_unique_segment_): New member.
4532         (Output_section::extra_segment_flags): New function.
4533         (Output_section::set_extra_segment_flags): New function.
4534         (Output_section::extra_segment_flags_): New member.
4535         (Output_section::segment_alignment): New function.
4536         (Output_section::set_segment_alignment): New function.
4537         (Output_section::segment_alignment_): New member.
4538         (Output_segment::Output_segment): Initialize is_unique_segment_.
4539         (Output_segment::is_unique_segment): New function.
4540         (Output_segment::set_is_unique_segment): New function.
4541         (Output_segment::is_unique_segment_): New member.
4542         * plugin.cc (allow_unique_segment_for_sections): New function.
4543         (unique_segment_for_sections): New function.
4544         (Plugin::load): Add new functions to transfer vector.
4545         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
4546         * Makefile.in: Regenerate.
4547         * testsuite/plugin_final_layout.sh: Check if unique segment
4548         functionality works.
4549         * testsuite/plugin_section_order.c (onload): Check if new interfaces
4550         are available.
4551         (allow_unique_segment_for_sections): New global.
4552         (unique_segment_for_sections): New global.
4553         (claim_file_hook): Call allow_unique_segment_for_sections.
4554         (all_symbols_read_hook): Call unique_segment_for_sections.
4555
4556 2012-08-22  Cary Coutant  <ccoutant@google.com>
4557
4558         * layout.cc (Layout::include_section): Don't assert on GROUP
4559         sections with --emit-relocs.
4560
4561 2012-08-21  Cary Coutant  <ccoutant@google.com>
4562
4563         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
4564         if --export-dynamic-symbol names an undef symbol.
4565
4566 2012-08-18  Alan Modra  <amodra@gmail.com>
4567
4568         * powerpc.cc: Formatting and white space.
4569         (Powerpc_relobj): Rename got2_section_ to special_.
4570         Add opd_ent_shndx_ and opd_ent_off_ vectors.
4571         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
4572         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
4573         (Target_powerpc): Add Address typedef and invalid_address.  Use
4574         throughout.
4575         (Target_powerpc::is_branch_reloc): New function.
4576         (Powerpc_relocate_functions): Add Address typedef, use throughout.
4577         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
4578         for dst_mask, value and addend.
4579         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
4580         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
4581         (Output_data_glink::do_write): Correct toc base.  Don't try to use
4582         uint16_t for 24-bit offset.  Use get_output_section_offset and
4583         check return.
4584         (Target_powerpc::Scan::local): Handle more relocs.
4585         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
4586         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
4587         Plug in toc restoring insn after plt calls.  Translate branches
4588         to function descriptor symbols to corresponding entry point.
4589         (Target_powerpc::relocate_for_relocatable): Check return from
4590         get_output_section_offset.
4591         * symtab.h: Comment typo.
4592
4593 2012-08-14  Ian Lance Taylor  <iant@google.com>
4594
4595         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
4596         unsupported_relocal_local to call unsupported_reloc_global.
4597
4598 2012-08-14  Nick Clifton  <nickc@redhat.com>
4599
4600         PR ld/14265
4601         * script-sections.cc (Sections_element::output_section_name): Add
4602         keep return parameter.
4603         (Output_section_element::match_name): Add keep return parameter.
4604         Return the value of the keep_ member.
4605         * script-sections.h (class Output_section): Update
4606         output_section_name prototype.
4607         * layout.cc (Layout::keep_input_section): New public member
4608         function.
4609         (Layout::choose_output_section): Pass keep parameter to
4610         output_section_name.
4611         * layout.h (class Layout): Add keep_input_section.
4612         * object.cc (Sized_relobj_file::do_layout): Check for kept input
4613         sections.
4614         * testsuite/Makefile.am: Add a test.
4615         * testsuite/Makefile.in: Regenerate.
4616         * testsuite/pr14265.c: Source file for the test.
4617         * testsuite/pr14265.t: Linker script for the test.
4618         * testsuite/pr14265.sh: Shell script for the test.
4619
4620 2012-08-14  Alan Modra  <amodra@gmail.com>
4621
4622         * target.h (Target::output_section_name): New function.
4623         (Target::do_output_section_name): New function.
4624         * layout.cc (Layout::choose_output_section): Call the above.
4625         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
4626
4627 2012-08-14  Alan Modra  <amodra@gmail.com>
4628
4629         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
4630         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
4631         for replace_constant call.
4632         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
4633         (Output_data_glink::do_print_to_mapfile): New function.
4634         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
4635         (Target_powerpc::Relocate::relocate): Likewise.
4636
4637 2012-08-14  Alan Modra  <amodra@gmail.com>
4638
4639         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
4640         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
4641         (Output_data_glink::add_entry,find_entry): Remove shndx param.
4642         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
4643         all references to shndx_.  Handle special case for R_PPC_PLTREL24
4644         here.
4645         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
4646         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
4647         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
4648         here.
4649         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
4650         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
4651
4652 2012-08-12  Alan Modra  <amodra@gmail.com>
4653
4654         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
4655         (glink insn constants): Use uint32_t.
4656         (Output_data_glink::add_entry): Use insert, not [] operator.
4657
4658 2012-08-11  Alan Modra  <amodra@gmail.com>
4659
4660         * object.h (Sized_relobj_file::find_shdr): New function.
4661         (Sized_relobj_file::find_special_sections): New function.
4662         * object.cc (Sized_relobj_file::find_shdr): New function.
4663         (Sized_relobj_file::find_eh_frame): Use find_shdr.
4664         (Sized_relobj_file::find_special_sections): New function, split out..
4665         (Sized_relobj_file::do_read_symbols): ..from here.
4666         * output.h (Output_data_got::replace_constant): New function.
4667         (Output_data_got::num_entries): New function.
4668         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
4669         (Output_data_got::got_offset): Protected rather than private.
4670         (Output_data_got::replace_got_entry): New function.
4671         * output.cc (Output_data_got::replace_got_entry): New function.
4672         * powerpc.cc (class Powerpc_relobj): New.
4673         (class Powerpc_relocate_functions): Delete all psymval variants or
4674         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
4675         Implement _ha functions using corresponding _hi function.
4676         (Powerpc_relobj::find_special_sections): New function.
4677         (Target_powerpc::do_make_elf_object): New function.
4678         (class Output_data_got_powerpc): New.
4679         (class Output_data_glink): New.
4680         (class Powerpc_scan_relocatable_reloc): New.
4681         Many more changes througout file.
4682
4683 2012-08-09  Nick Clifton  <nickc@redhat.com>
4684
4685         * po/vi.po: Updated Vietnamese translation.
4686
4687 2012-08-07  Ian Lance Taylor  <iant@google.com>
4688
4689         * layout.cc (Layout::add_target_dynamic_tags): If
4690         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
4691         plt_rel.
4692
4693 2012-07-30  Nick Clifton  <nickc@redhat.com>
4694
4695         * po/gold.pot: Updated template.
4696         * po/es.po: Updated Spanish translation.
4697
4698 2012-07-18  Cary Coutant  <ccoutant@google.com>
4699
4700         PR gold/14344
4701         * configure.ac: Add check for -gpubnames support.
4702         * configure: Regenerate.
4703         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
4704         support; force -gno-pubnames.
4705         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
4706         support.
4707         (gdb_index_test_4): New test.
4708         * testsuite/Makefile.in: Regenerate.
4709         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
4710         * testsuite/gdb_index_test_2.sh: Likewise.
4711         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
4712         * testsuite/gdb_index_test_4.sh: New script.
4713         * testsuite/gdb_index_test_comm.sh: New script with common code;
4714         don't look for space after colon.
4715
4716 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
4717
4718         * gold.cc (queue_middle_tasks): Update function order only after
4719         deferred objects due to plugins are processed.
4720
4721 2012-07-11  Ian Lance Taylor  <iant@google.com>
4722
4723         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
4724         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
4725         (Target_arm::scan_reloc_for_stub): Likewise.
4726         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
4727         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
4728         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
4729         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
4730         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
4731
4732 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
4733             Ian Lance Taylor  <iant@google.com>
4734
4735         PR gold/14309
4736         * configure.ac: Test whether std::tr1::hash<off_t> works.
4737         * gold.h: Add a specialization for std::tr1::hash<off_t> if
4738         needed.
4739         * output.h (class Output_fill): Add virtual destructor.
4740         * configure, config.in: Rebuild.
4741
4742 2012-06-22  Roland McGrath  <mcgrathr@google.com>
4743
4744         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
4745
4746 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
4747
4748         * plugin.cc (Plugin::load): Handle position independent executables.
4749
4750 2012-06-06  Cary Coutant  <ccoutant@google.com>
4751
4752         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
4753         add .debug_macro.
4754         (lines_only_debug_sections): Likewise.
4755         (gdb_fast_lookup_sections): New static array.
4756         (is_gdb_debug_section): Rename formal parameter.
4757         (is_lines_only_debug_section): Likewise.
4758         (is_gdb_fast_lookup_section): New function.
4759         (Layout::include_section): Check for ".zdebug_" prefix; pass
4760         section name suffix to is_gdb_debug_section, et al.; check for
4761         fast-lookup sections when building .gdb_index.
4762         * options.h (--strip-debug-gdb): Update GDB version number.
4763
4764 2012-06-06  Cary Coutant  <ccoutant@google.com>
4765
4766         * configure.ac: Add check for fallocate.
4767         * configure: Regenerate.
4768         * config.in: Regenerate.
4769
4770         * options.h (class General_options): Add --mmap-output-file and
4771         --posix-fallocate options.
4772         * output.cc: (posix_fallocate): Remove; replace with...
4773         (gold_fallocate): New function.
4774         (Output_file::map_no_anonymous): Call gold_fallocate.
4775         (Output_file::map): Check --mmap-output-file option.
4776
4777 2012-06-05  Jing Yu  <jingyu@google.com>
4778
4779         * gold.h (textdomain): Add do {} to empty while(0).
4780         (bindtextdomain): Likewise.
4781
4782 2012-06-04  Cary Coutant  <ccoutant@google.com>
4783
4784         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
4785         has_dynsym_index.
4786
4787 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
4788
4789         * symtab.cc (Symbol_table::define_special_symbol):
4790         Initialize *poldsym to prevent uninitialized variable errors.
4791
4792 2012-05-23  Cary Coutant  <ccoutant@google.com>
4793
4794         * layout.cc (Layout::section_name_mapping): Add rules to handle
4795         exact match on .data.rel.ro.local or .data.rel.ro.
4796         (Layout::output_section_name): Check for exact matches.
4797
4798 2012-05-23  Cary Coutant  <ccoutant@google.com>
4799
4800         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
4801         more carefully.
4802
4803 2012-05-22  Cary Coutant  <ccoutant@google.com>
4804
4805         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
4806         object before exporting symbol.
4807
4808 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
4809
4810         * testsuite/tls_test.cc: Include "config.h" first.
4811         * testsuite/tls_test_c.c: Likewise.
4812
4813 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
4814             Nick Clifton  <nickc@redhat.com>
4815
4816         PR 14072
4817         * configure.in: Add check that sysdep.h has been included before
4818         any system header files.
4819         * configure: Regenerate.
4820         * config.in: Regenerate.
4821
4822 2012-05-14  Cary Coutant  <ccoutant@google.com>
4823
4824         * layout.cc (Layout::make_output_section): Mark .tdata section
4825         as RELRO.
4826         * testsuite/relro_test.cc: Add a TLS variable.
4827
4828 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
4829
4830         PR gold/14091
4831         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
4832         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
4833         R_X86_64_64.
4834
4835 2012-05-08  Cary Coutant  <ccoutant@google.com>
4836
4837         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
4838         (lines_only_debug_sections): Likewise.
4839
4840 2012-05-02  Roland McGrath  <mcgrathr@google.com>
4841
4842         * nacl.cc: New file.
4843         * nacl.h: New file.
4844         * Makefile.am (CCFILES, HFILES): Add them.
4845         * Makefile.in: Regenerate.
4846         * i386.cc (Output_data_plt_i386_nacl): New class.
4847         (Output_data_plt_i386_nacl_exec): New class.
4848         (Output_data_plt_i386_nacl_dyn): New class.
4849         (Target_i386_nacl): New class.
4850         (Target_selector_i386_nacl): New class.
4851         (target_selector_i386): Use it instead of Target_selector_i386.
4852         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
4853         (Target_x86_64_nacl): New class.
4854         (Target_selector_x86_64_nacl): New class.
4855         (target_selector_x86_64, target_selector_x32): Use it instead of
4856         Target_selector_x86_64.
4857         * arm.cc (Output_data_plt_arm_nacl): New class.
4858         (Target_arm_nacl): New class.
4859         (Target_selector_arm_nacl): New class.
4860         (target_selector_arm, target_selector_armbe): Use it instead of
4861         Target_selector_arm.
4862
4863         * target-select.cc (select_target): Take new Input_file* and off_t
4864         arguments, pass them on to recognize method of selector.
4865         * object.cc (make_elf_sized_object): Update caller.
4866         * parameters.cc (parameters_force_valid_target): Likewise.
4867         * incremental.cc (make_sized_incremental_binary): Likewise.
4868         * target-select.h: Update decl.
4869         (Target_selector::recognize): Take new Input_file* argument,
4870         pass it on to do_recognize.
4871         (Target_selector::do_recognize): Take new Input_file* argument.
4872         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
4873         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
4874         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
4875         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
4876
4877         * target.h (Target::Target_info): New members isolate_execinstr
4878         and rosegment_gap.
4879         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
4880         * arm.cc (Target_arm::arm_info): Update initializer.
4881         * i386.cc (Target_i386::i386_info): Likewise.
4882         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
4883         * sparc.cc (Target_sparc::sparc_info): Likewise.
4884         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4885         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
4886         * layout.cc (Layout::attach_allocated_section_to_segment):
4887         Take new const Target* argument.  If target->isolate_execinstr(), act
4888         like --rosegment.
4889         (Layout::find_first_load_seg): Take new const Target* argument;
4890         if target->isolate_execinstr(), reject PF_X segments.
4891         (Layout::relaxation_loop_body): Update caller.
4892         (Layout::set_segment_offsets): If target->isolate_execinstr(),
4893         reset file offset to zero when we hit LOAD_SEG, and then do a second
4894         loop over the segments before LOAD_SEG to reassign offsets after
4895         addresses have been determined.  Handle target->rosegment_gap().
4896         (Layout::attach_section_to_segment): Take new const Target* argument;
4897         pass it to attach_allocated_section_to_segment.
4898         (Layout::make_output_section): Update caller.
4899         (Layout::attach_sections_to_segments): Take new const Target* argument;
4900         pass it to attach_section_to_segment.
4901         * gold.cc (queue_middle_tasks): Update caller.
4902         * layout.h (Layout): Update method decls with new arguments.
4903
4904         * arm.cc (Target_arm::Target_arm): Take optional argument for the
4905         Target_info pointer to use.
4906         (Target_arm::do_make_data_plt): New virtual method.
4907         (Target_arm::make_data_plt): New method that calls it.
4908         (Target_arm::make_plt_entry): Use it.
4909         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
4910         for the section alignment.
4911         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
4912         method.
4913         (Output_data_plt_arm::first_plt_entry_offset): Call it.
4914         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
4915         method.
4916         (Output_data_plt_arm::get_plt_entry_size): Call it.
4917         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
4918         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
4919         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
4920         method.
4921         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
4922         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
4923         method instead of sizeof(plt_entry).
4924         (Output_data_plt_arm::add_entry): Likewise.
4925         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
4926         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
4927         than static method.
4928         (Target_arm::plt_entry_size): Likewise.
4929         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
4930         Move to ...
4931         (Output_data_plt_arm_standard): ... here, new class.
4932         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
4933         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
4934         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
4935
4936         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4937         Take additional argument for the PLT entry size.
4938         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
4939         Use get_plt_entry_size method rather than plt_entry_size variable.
4940         (Output_data_plt_x86_64::reserve_slot): Likewise.
4941         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
4942         (Output_data_plt_x86_64::add_entry): Likewise.
4943         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
4944         (Output_data_plt_x86_64::address_for_global): Likewise.
4945         (Output_data_plt_x86_64::address_for_local): Likewise.
4946         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4947         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
4948         Make method non-static.
4949         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
4950         method.
4951         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
4952         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
4953         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
4954         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
4955         virtual method.
4956         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
4957         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
4958         virtual method.
4959         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
4960         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
4961         virtual method.
4962         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
4963         (Output_data_plt_x86_64::plt_entry_size)
4964         (Output_data_plt_x86_64::first_plt_entry)
4965         (Output_data_plt_x86_64::plt_entry)
4966         (Output_data_plt_x86_64::tlsdesc_plt_entry)
4967         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
4968         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
4969         (Output_data_plt_x86_64_standard): ... here, new class.
4970         (Target_x86_64::Target_x86_64): Take optional argument for the
4971         Target_info pointer to use.
4972         (Target_x86_64::do_make_data_plt): New virtual method.
4973         (Target_x86_64::make_data_plt): New method to call it.
4974         (Target_x86_64::init_got_plt_for_update): Use that.
4975         Call this->plt_->add_eh_frame method here.
4976         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
4977         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
4978         rather than static method.
4979         (Target_x86_64::plt_entry_size): Likewise.
4980         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
4981         rather than plt_entry_size variable.  Move guts of PLT filling to...
4982         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
4983         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
4984         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
4985
4986         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
4987         additional argument for the section alignment.
4988         Don't do add_eh_frame_for_plt here.
4989         (Output_data_plt_i386::first_plt_entry_offset): Make the method
4990         non-static.  Use get_plt_entry_size method rather than plt_entry_size
4991         variable.
4992         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
4993         method.
4994         (Output_data_plt_i386::get_plt_entry_size): Call it.
4995         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
4996         (Output_data_plt_i386::add_eh_frame): New method to call it.
4997         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
4998         method.
4999         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
5000         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
5001         method.
5002         (Output_data_plt_i386::fill_plt_entry): New method to call it.
5003         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
5004         method instead of plt_entry_size.
5005         (Output_data_plt_i386::plt_entry_size)
5006         (Output_data_plt_i386::plt_eh_frame_fde_size)
5007         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
5008         (Output_data_plt_i386_standard): ... here, new class.
5009         (Output_data_plt_i386_exec): New class.
5010         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
5011         (Output_data_plt_i386_exec::first_plt_entry): ... here.
5012         (Output_data_plt_i386::exec_plt_entry): Move to ...
5013         (Output_data_plt_i386_exec::plt_entry): ... here.
5014         (Output_data_plt_i386_dyn): New class.
5015         (Output_data_plt_i386::first_plt_entry): Move to ...
5016         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
5017         (Output_data_plt_i386::dyn_plt_entry): Move to ...
5018         (Output_data_plt_i386_dyn::plt_entry): ... here.
5019         (Target_i386::Target_i386): Take optional argument for the Target_info
5020         pointer to use.
5021         (Target_i386::do_make_data_plt): New virtual method.
5022         (Target_i386::make_data_plt): New method to call it.
5023         (Target_i386::make_plt_section): Use that.
5024         Call this->plt_->add_eh_frame method here.
5025         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
5026         rather than plt_entry_size variable.
5027         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
5028         (Output_data_plt_i386::address_for_local): Likewise.
5029         (Output_data_plt_i386::do_write): Likewise.
5030         Move guts of PLT filling to...
5031         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
5032         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
5033         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
5034         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
5035
5036 2012-05-01  Cary Coutant  <ccoutant@google.com>
5037
5038         * dwarf_reader.cc (Dwarf_die::read_attributes)
5039         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
5040         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
5041         * reduced_debug_output.cc
5042         (Output_reduced_debug_info_section::get_die_end): Remove
5043         DW_FORM_GNU_ref_index.  Add default case.
5044
5045 2012-04-26  Mark Wielaard  <mjw@redhat.com>
5046
5047         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
5048         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
5049         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
5050         DW_AT_high_pc as offset from DW_AT_low_pc.
5051
5052         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
5053         * testsuite/Makefile.in: Regenerate.
5054         * testsuite/gdb_index_test_3.c: New test source file.
5055         * testsuite/gdb_index_test_3.sh: New test source file.
5056
5057 2012-04-25  Ian Lance Taylor  <iant@google.com>
5058
5059         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
5060         pointer.
5061         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
5062         as a class, not a struct.
5063         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
5064         (Target_arm::apply_cortex_a8_workaround): Likewise.
5065         * gc.h: Declare Reloc_types as a struct, not a class.
5066         * object.h: Declare Symbols_data as a struct.
5067         * reloc.h: Declare Read_relocs_data as a struct.
5068         * target.h: Declare Relocate_info as a struct.
5069
5070 2012-04-24  David S. Miller  <davem@davemloft.net>
5071
5072         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
5073         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
5074         and R_SPARC_WPLT30.
5075
5076 2012-04-24  Cary Coutant  <ccoutant@google.com>
5077
5078         * incremental-dump.cc (find_input_containing_global): Replace
5079         magic number with symbolic constant.
5080         (dump_incremental_inputs): Update version number.
5081         * incremental.cc (Output_section_incremental_inputs): Update version
5082         number; import symbolic constants from Incremental_inputs_reader.
5083         (Incremental_inputs::create_data_sections): Align relocations
5084         section correctly for 64-bit targets.
5085         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
5086         constants; add padding.
5087         (Output_section_incremental_inputs::write_header): Add assert for
5088         header_size.
5089         (Output_section_incremental_inputs::write_input_files): Add assert
5090         for input_entry_size.
5091         (Output_section_incremental_inputs::write_info_blocks): Add padding;
5092         add assert for object_info_size, input_section_entry_size,
5093         global_sym_entry_size.
5094         * incremental.h (Incremental_inputs_reader): Add symbolic constants
5095         for data structure sizes; use them.
5096         (Incremental_input_entry_reader): Import symbolic constants from
5097         Incremental_inputs_reader; use them.
5098
5099 2012-04-23  David S. Miller  <davem@davemloft.net>
5100
5101         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
5102         and elf_flags_set_.
5103         (Target_sparc::Target_sparc): Initialize new fields.
5104         (Target_sparc::do_make_elf_object): New function.
5105         (Target_sparc::do_adjust_elf_header): New function.
5106
5107 2012-04-23  Cary Coutant  <ccoutant@google.com>
5108
5109         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
5110         CU range table of gdb index.
5111
5112 2012-04-20  David S. Miller  <davem@davemloft.net>
5113
5114         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
5115         instead of false.
5116
5117 2012-04-16  David S. Miller  <davem@davemloft.net>
5118
5119         * sparc.cc (Target_sparc::got_address): New function.
5120         (Sparc_relocate_functions::gdop_hix22): New function.
5121         (Sparc_relocate_functions::gdop_lox10): New function.
5122         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
5123         relocs.
5124         (Target_sparc::Scan::local): Likewise if the global symbol is not
5125         preemptible and is not IFUNC.
5126         (Target_sparc::Relocate::relocate): Perform GOTDATA code
5127         transformations for local and non-preemptible non-IFUNC global
5128         symbols.
5129
5130         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
5131         writing out 64-bit part of ranges.
5132
5133         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
5134         -fpic and -fpie respectively.
5135         * Makefile.in: Regenerate.
5136
5137         * sparc.cc (class Target_sparc): Add rela_ifunc_.
5138         (Target_sparc::Target_sparc): Initialize new field.
5139         (Target_sparc::do_plt_section_for_global): New function.
5140         (Target_sparc::do_plt_section_for_local): New function.
5141         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
5142         (Target_sparc::make_plt_section): New function, broken out of
5143         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
5144         (Target_sparc::make_plt_entry): Call make_plt_section.
5145         (Target_sparc::make_local_ifunc_plt_entry): New function.
5146         (Target_sparc::rela_ifunc_section): New function.
5147         (Target_sparc::plt_section): Remove const.
5148         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
5149         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
5150         and ifunc_count_ fields.
5151         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
5152         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
5153         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
5154         (Output_data_plt_sparc::rela_ifunc): New function.
5155         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
5156         (Output_data_plt_sparc::has_ifunc_section): New function.
5157         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
5158         (Output_data_plt_sparc::address_for_global): New function.
5159         (Output_data_plt_sparc::address_for_local): New function.
5160         (Output_data_plt_sparc::plt_index_to_offset): New function.
5161         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
5162         and entry_count.
5163         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
5164         entry_count.
5165         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
5166         R_SPARC_JMP_IREL to switch.
5167         (Target_sparc::Scan::check_non_pic): Likewise.
5168         (Target_sparc::Scan::local): Handle IFUNC symbols.
5169         (Target_sparc::Scan::local): Likewise.
5170         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
5171         and plt_address_for_local.
5172         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
5173         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
5174
5175         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
5176         (class Output_data_reloc): Adjust calls to Output_reloc_type.
5177         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
5178         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
5179         global relocs too.
5180         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
5181         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
5182         calls.
5183         * sparc.cc (Target_sparc::Scan::global): Likewise.
5184         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5185
5186 2012-04-16  Cary Coutant  <ccoutant@google.com>
5187
5188         * archive.cc (Library_base::should_include_member): Check for
5189         --export-dynamic-symbol.
5190         * options.h (class General_options): Add --export-dynamic-symbol.
5191         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
5192         --export-dynamic-symbol.
5193         (Symbol_table::gc_mark_undef_symbols): Likewise.
5194         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
5195
5196 2012-04-12  David S. Miller  <davem@davemloft.net>
5197
5198         * sparc.cc (Reloc::wdisp10): New relocation method.
5199         (Reloc::h34): Likewise.
5200         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
5201         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
5202         R_SPARC_WDISP10.
5203         (Target_sparc::Scan::local): Likewise.
5204         (Target_sparc::Scan::global): Likewise.
5205         (Target_sparc::Relocate::relocate): Likewise.
5206
5207 2012-04-09  Cary Coutant  <ccoutant@google.com>
5208
5209         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
5210         low_pc == 0.
5211
5212 2012-04-06  Ian Lance Taylor  <iant@google.com>
5213
5214         * timer.cc: #include <unistd.h>.
5215
5216 2012-04-06  Roland McGrath  <mcgrathr@google.com>
5217
5218         * configure.in (AC_CHECK_HEADERS): Add locale.h.
5219         * config.in: Regenerate.
5220         * configure: Regenerate.
5221
5222 2012-04-05  Nick Clifton  <nickc@redhat.com>
5223
5224         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
5225         (AM_LC_MESSAGES): Add.
5226         * aclocal.m4: Regenerate.
5227         * config.in: Regenerate.
5228         * configure: Regenerate.
5229
5230 2012-03-21  Cary Coutant  <ccoutant@google.com>
5231
5232         * Makefile.am: Add gdb-index.cc, gdb-index.h.
5233         * Makefile.in: Regenerate.
5234         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
5235         (Sized_elf_reloc_mapper::symbol_section): New function.
5236         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
5237         (make_elf_reloc_mapper): New function.
5238         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
5239         (Dwarf_abbrev_table::do_read_abbrevs): New function.
5240         (Dwarf_abbrev_table::do_get_abbrev): New function.
5241         (Dwarf_ranges_table::read_ranges_table): New function.
5242         (Dwarf_ranges_table::read_range_list): New function.
5243         (Dwarf_pubnames_table::read_section): New function.
5244         (Dwarf_pubnames_table::read_header): New function.
5245         (Dwarf_pubnames_table::next_name): New function.
5246         (Dwarf_die::Dwarf_die): New function.
5247         (Dwarf_die::read_attributes): New function.
5248         (Dwarf_die::skip_attributes): New function.
5249         (Dwarf_die::set_name): New function.
5250         (Dwarf_die::set_linkage_name): New function.
5251         (Dwarf_die::attribute): New function.
5252         (Dwarf_die::string_attribute): New function.
5253         (Dwarf_die::int_attribute): New function.
5254         (Dwarf_die::uint_attribute): New function.
5255         (Dwarf_die::ref_attribute): New function.
5256         (Dwarf_die::child_offset): New function.
5257         (Dwarf_die::sibling_offset): New function.
5258         (Dwarf_info_reader::check_buffer): New function.
5259         (Dwarf_info_reader::parse): New function.
5260         (Dwarf_info_reader::do_parse): New function.
5261         (Dwarf_info_reader::do_read_string_table): New function.
5262         (Dwarf_info_reader::lookup_reloc): New function.
5263         (Dwarf_info_reader::get_string): New function.
5264         (Dwarf_info_reader::visit_compilation_unit): New function.
5265         (Dwarf_info_reader::visit_type_unit): New function.
5266         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
5267         Sized_elf_reloc_mapper.
5268         (Sized_dwarf_line_info::symbol_section): Remove function.
5269         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
5270         (Sized_dwarf_line_info::read_line_mappings): Remove object
5271         parameter, adjust callers.
5272         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
5273         * dwarf_reader.h: Include <sys/types.h>.
5274         (class Track_relocs): Remove forward declaration.
5275         (class Elf_reloc_mapper): New class.
5276         (class Sized_elf_reloc_mapper): New class.
5277         (class Dwarf_abbrev_table): New class.
5278         (class Dwarf_range_list): New class.
5279         (class Dwarf_ranges_table): New class.
5280         (class Dwarf_pubnames_table): New class.
5281         (class Dwarf_die): New class.
5282         (class Dwarf_info_reader): New class.
5283         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
5284         (Sized_dwarf_line_info::symbol_section): Remove member function.
5285         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
5286         base class.
5287         * gdb-index.cc: New source file.
5288         * gdb-index.h: New source file.
5289         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
5290         and .debug_types sections, call Layout::add_to_gdb_index.
5291         (Sized_relobj_incr::do_section_name): Implement.
5292         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
5293         return type; Implement.
5294         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
5295         return type.
5296         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
5297         parameter list and return type.
5298         (Sized_incr_dynobj::do_section_contents): Likewise.
5299         * layout.cc: Include gdb-index.h.
5300         (Layout::Layout): Initialize gdb_index_data_.
5301         (Layout::init_fixed_output_section): Check for .gdb_index section.
5302         (Layout::add_to_gdb_index): New function. Instantiate.
5303         * layout.h: Add forward declaration for class Gdb_index.
5304         (Layout::add_to_gdb_index): New member function.
5305         (Layout::gdb_index_data_): New data member.
5306         * main.cc: Include gdb-index.h.
5307         (main): Print statistics for gdb index.
5308         * object.cc (Object::section_contents): Move code into
5309         do_section_contents.
5310         (need_decompressed_section): Check for sections needed when building
5311         gdb index.
5312         (build_compressed_section_map): Likewise.
5313         (Sized_relobj_file::do_read_symbols): Need local symbols when building
5314         gdb index.
5315         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
5316         sections; call Layout::add_to_gdb_index.
5317         (Sized_relobj_file::do_decompressed_section_contents): Call
5318         do_section_contents directly.
5319         * object.h (Object::do_section_contents): Adjust parameter list and
5320         return type.
5321         (Object::do_decompressed_section_contents): Call do_section_contents
5322         directly.
5323         (Sized_relobj_file::do_section_contents): Adjust parameter list and
5324         return type.
5325         * options.h (class General_options): Add --gdb-index option.
5326         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
5327         list and return type.
5328         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
5329         * reloc.h (Track_relocs::checkpoint): New function.
5330         (Track_relocs::reset): New function.
5331
5332         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
5333         New test cases.
5334         * testsuite/Makefile.in: Regenerate.
5335         * testsuite/gdb_index_test.cc: New test source file.
5336         * testsuite/gdb_index_test_1.sh: New test source file.
5337         * testsuite/gdb_index_test_2.sh: New test source file.
5338
5339 2012-03-19  Doug Kwan  <dougkwan@google.com>
5340
5341         * arm.cc (Target_arm::do_define_standard_symbols): New method.
5342         (Target_arm::do_finalize_sections): Remove code which defines
5343         __exidx_start and __exidx_end.  Make symbol table parameter
5344         anonymous as it is not used.
5345         * gold.cc (queue_middle_tasks): Call target hook to define any
5346         target-specific symbols.
5347         * target.h (Target::define_standard_symbols): New method.
5348         (Target::do_define_standard_symbols): Same.
5349         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
5350         * testsuite/Makefile.in: Regenerate.
5351         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
5352         and __exidx_end.
5353         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
5354         relocations are generated for __exidx_start and __exidx_end.
5355
5356 2012-03-16  Doug Kwan  <dougkwan@google.com>
5357
5358         * testsuite/Makefile.am: Disable test initpri3b.
5359         * testsuite/Makefile.in: Regenerate.
5360
5361 2012-03-15  Doug Kwan  <dougkwan@google.com>
5362
5363         * arm.cc (Target_arm::got_section): Make .got section read-only
5364         if -z now is given.
5365
5366 2012-03-15  Ian Lance Taylor  <iant@google.com>
5367
5368         PR gold/13850
5369         * layout.cc (Layout::make_output_section): Correctly mark
5370         SHT_INIT_ARRAY, et. al., as relro.
5371
5372 2012-03-14  Doug Kwan  <dougkwan@google.com>
5373
5374         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
5375         dynamic relocations for protected symbols in shared objects.
5376
5377 2012-03-13  Ian Lance Taylor  <iant@google.com>
5378
5379         * resolve.cc (Symbol_table::resolve): When merging common symbols,
5380         keep the larger alignment.
5381
5382 2012-03-12  Cary Coutant  <ccoutant@google.com>
5383
5384         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
5385         handling of DW_LNE_define_file.
5386
5387 2012-03-12  Cary Coutant  <ccoutant@google.com>
5388
5389         * reduced_debug_output.cc
5390         (Output_reduced_debug_info_section::get_die_end): Add new FORM
5391         codes to switch.
5392
5393 2012-02-29  Cary Coutant  <ccoutant@google.com>
5394
5395         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
5396
5397 2012-02-29  Cary Coutant  <ccoutant@google.com>
5398
5399         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5400         Call Object::decompressed_section_contents.
5401         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
5402         New dtor.
5403         (Sized_dwarf_line_info::buffer_start_): New data member.
5404         * merge.cc (Output_merge_data::do_add_input_section): Call
5405         Object::decompressed_section_contents.
5406         (Output_merge_string::do_add_input_section): Likewise.
5407         * object.cc (need_decompressed_section): New function.
5408         (build_compressed_section_map): Decompress sections needed later.
5409         (Sized_relobj_file::do_decompressed_section_contents): New function.
5410         (Sized_relobj_file::do_discard_decompressed_sections): New function.
5411         * object.h (Object::decompressed_section_contents): New function.
5412         (Object::discard_decompressed_sections): New function.
5413         (Object::do_decompressed_section_contents): New function.
5414         (Object::do_discard_decompressed_sections): New function.
5415         (Compressed_section_info): New type.
5416         (Compressed_section_map): Include decompressed section contents.
5417         (Sized_relobj_file::do_decompressed_section_contents): New function.
5418         (Sized_relobj_file::do_discard_decompressed_sections): New function.
5419
5420 2012-02-16  Cary Coutant  <ccoutant@google.com>
5421
5422         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
5423         * testsuite/Makefile.in: Regenerate.
5424
5425 2012-02-14  Cary Coutant  <ccoutant@google.com>
5426
5427         * options.cc (General_options::finalize): Disallow -pie and -static.
5428
5429 2012-02-03  Doug Kwan  <dougkwan@google.com>
5430
5431         * arm.cc (Arm_relocate_functions::abs8,
5432         Arm_relocate_functions::abs16): Use
5433         Bits::has_signed_unsigned_overflow32.
5434         (Arm_relocate_functions::thm_abs8): Correct range of
5435         overflow check.
5436         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
5437         in assertions.
5438
5439 2012-02-02  Doug Kwan  <dougkwan@google.com>
5440
5441         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
5442         position independent outputs, not just shared objects.
5443
5444 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
5445
5446         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
5447         * configure: Regenerated.
5448
5449 2012-01-27  Ian Lance Taylor  <iant@google.com>
5450
5451         * reloc.h (Bits): New class with static functions, copied from
5452         namespace utils in arm.cc.
5453         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
5454         instead.
5455
5456 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5457
5458         * incremental.cc (write_info_blocks): Correct relocation offset.
5459
5460 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5461
5462         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
5463         (Relocate::tls_gd_to_le): Likewise.
5464
5465 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5466
5467         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
5468
5469 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5470
5471         * configure.ac: Check if -mcmodel=medium works.
5472         * configure: Regenerated.
5473
5474 2012-01-24  Cary Coutant  <ccoutant@google.com>
5475
5476         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
5477         definition and ...
5478         (read_unsigned_LEB_128_x): ... this new function.
5479         (read_signed_LEB_128): Replaced with inline definition and ...
5480         (read_signed_LEB_128_x): ... this new function.
5481         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
5482         (read_unsigned_LEB_128): Add inline definition.
5483         (read_signed_LEB_128_x): New function.
5484         (read_signed_LEB_128): Add inline definition.
5485         * testsuite/Makefile.am (leb128_unittest): New unit test.
5486         * testsuite/Makefile.in: Regenerate.
5487         * testsuite/leb128_unittest.cc: New unit test.
5488
5489 2012-01-23  Ian Lance Taylor  <iant@google.com>
5490
5491         PR gold/13617
5492         * i386.cc (Target_i386::do_code_fill): When using a jmp
5493         instruction, pad with nop instructions.
5494         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5495
5496 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
5497
5498         * x86_64.cc (gc_process_relocs): Add typename on types used in
5499         template.
5500         (scan_relocs): Likewise.
5501         (relocate_section): Likewise.
5502         (apply_relocation): Likewise.
5503
5504 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
5505
5506         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
5507         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
5508         under x32.
5509
5510 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
5511
5512         * x86_64.cc: Initial support for x32.
5513
5514 2012-01-03  Cary Coutant  <ccoutant@google.com>
5515
5516         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
5517         Use abstract base class for GOT.
5518         * gold/output.h (class Output_data_got_base): New abstract base class.
5519         (class Output_data_got): Derive from new base class, adjust ctors.
5520         (Output_data_got::reserve_slot): Make virtual; rename to
5521         do_reserve_slot; Adjust callers.
5522         * gold/target.h (Sized_target::init_got_plt_for_update): Return
5523         pointer to abstract base class.
5524         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
5525
5526 2011-12-18  Ian Lance Taylor  <iant@google.com>
5527
5528         * object.h (Relobj::local_symbol_value): New function.
5529         (Relobj::local_plt_offset): New function.
5530         (Relobj::local_has_got_offset): New function.
5531         (Relobj::local_got_offset): New function.
5532         (Relobj::set_local_got_offset): New function.
5533         (Relobj::do_local_symbol_value): New pure virtual function.
5534         (Relobj::do_local_plt_offset): Likewise.
5535         (Relobj::do_local_has_got_offset): Likewise.
5536         (Relobj::do_local_got_offset): Likewise.
5537         (Relobj::do_set_local_got_offset): Likewise.
5538         (Sized_relobj::do_local_has_got_offset): Rename from
5539         local_has_got_offset.
5540         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
5541         (Sized_relobj::do_set_local_got_offset): Rename from
5542         set_local_got_offset.
5543         (Sized_relobj_file::do_local_plt_offset): Rename from
5544         local_plt_offset.
5545         (Sized_relobj_file::do_local_symbol_value): New function.
5546         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
5547         local_plt_offset.
5548         * output.cc (Output_data_got::Got_entry::write): Change object to
5549         Relobj.  Use local_symbol_value.
5550         (Output_data_got::add_global_with_rel): Change rel_dyn to
5551         Output_data_reloc_generic*.  Use add_global_generic.
5552         (Output_data_got::add_global_with_rela): Remove.  Change all
5553         callers to use add_global_with_rel.
5554         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
5555         Output_data_reloc_generic*.  Use add_global_generic.
5556         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
5557         callers to use add_global_pair_with_rel.
5558         (Output_data_got::add_local): Change object to Relobj*.
5559         (Output_data_got::add_local_plt): Likewise.
5560         (Output_data_got::add_local_with_rel): Change object to Relobj*,
5561         change rel_dyn to Output_data_reloc_generic*.  Use
5562         add_local_generic.
5563         (Output_data_got::add_local_with_rela): Remove.  Change all
5564         callers to use all_local_with_rel.
5565         (Output_data_got::add_local_pair_with_rel): Change object to
5566         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
5567         add_output_section_generic.
5568         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
5569         callers to use add_local_pair_with_rel.
5570         (Output_data_got::reserve_local): Change object to Relobj*.
5571         * output.h: (class Output_data_reloc_generic): Add pure virtual
5572         declarations for add_global_generic, add_local_generic,
5573         add_output_section_generic.
5574         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
5575         functions for Output_data_reloc_generic.  Update declarations for
5576         changes listed in output.cc.
5577         (class Output_data_got): Change template parameter to got_size.
5578         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
5579         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
5580         function.
5581         (Sized_relobj_incr::do_local_plt_offset): New function.
5582         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
5583         add_global_generic.
5584
5585 2011-12-17  Cary Coutant  <ccoutant@google.com>
5586
5587         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
5588         * resolve.cc (Symbol_table::resolve): Likewise.
5589         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
5590         arrays.
5591         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5592
5593 2011-12-16  Ian Lance Taylor  <iant@google.com>
5594
5595         * output.h (Output_data_reloc_generic::add): Only call
5596         add_dynamic_reloc if this is a dynamic reloc section.
5597
5598 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
5599
5600         PR gold/13505
5601         * target-reloc.h (apply_relocation): Replace <64, false> with
5602         <size, big_endian>.
5603
5604 2011-11-25  Nick Clifton  <nickc@redhat.com>
5605
5606         * po/it.po: New Italian translation.
5607
5608 2011-11-17  Sterling Augustine  <saugustine@google.com>
5609
5610         * script.cc (script_include_directive): Implement.
5611         (read_script_file): New local variables name and search_path. Update
5612         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
5613         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
5614         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
5615
5616 2011-11-11  Sterling Augustine  <saugustine@google.com>
5617
5618         * yyscript.y (section_cmd): Add support for INCLUDE directive.
5619         (file_or_sections_cmd): Likewise.
5620
5621 2011-11-11  Doug Kwan  <dougkwan@google.com>
5622
5623         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
5624         if --just-symbols is given.
5625
5626 2011-11-10  Doug Kwan  <dougkwan@google.com>
5627
5628         PR gold/13362
5629         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
5630         when processing data relocs.
5631         * reloc.h (Relocate_functions::rel_unaligned): New method.
5632         (Relocate_functions::pcrel_unaligned): Ditto.
5633         (Relocate_functions::rel32_unaligned): Ditto.
5634         (Relocate_functions::pcrel32_unaligned): Ditto.
5635
5636 2011-11-09  Doug Kwan  <dougkwan@google.com>
5637
5638         PR gold/13362
5639         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
5640         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
5641         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
5642         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5643         (Relocate_functions::rel_unaligned): New.
5644         (Relocate_functions::rel32_unaligned): New.
5645         * target-reloc.h (relocate_for_relocatable): Add code to handle
5646         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5647         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
5648         arm_unaligned_reloc_r): New targets.
5649         * testsuite/Makefile.in: Regenerate.
5650         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
5651         linking.
5652
5653 2011-11-02  Ian Lance Taylor  <iant@google.com>
5654
5655         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
5656         NATIVE_LINKER.
5657         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
5658         * options.cc (General_options::finalize): Use library search path
5659         from configure script if specified.  If not native and no sysroot,
5660         only search TOOLLIBDIR.
5661         * options.h (Search_directory::Search_directory): Change name to
5662         const std::string&.
5663         (General_options::add_to_library_path_with_sysroot): Change arg to
5664         const std::string&.
5665         * configure, Makefile.in, config.in: Rebuild.
5666
5667 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5668
5669         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
5670         we are working around the ARM1176 Erratum.
5671         * options.h (General_options::fix_arm1176): Add option.
5672         * testsuite/Makefile.am: Add testcases, and keep current ones
5673         working.
5674         * testsuite/Makefile.in: Regenerate.
5675         * testsuite/arm_fix_1176.s: New file.
5676         * testsuite/arm_fix_1176.sh: Likewise.
5677
5678 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5679
5680         * arm.cc (Target_arm::Target_arm): Remove initialisation of
5681         may_use_blx_.
5682         (Target_arm::may_use_blx): Remove method.
5683         (Target_arm::set_may_use_blx): Likewise.
5684         (Target_arm::may_use_v4t_interworking): New method.
5685         (Target_arm::may_use_v5t_interworking): Likewise.
5686         (Target_arm::may_use_blx_): Remove member variable.
5687         (Arm_relocate_functions::arm_branch_common): Check for v5T
5688         interworking.
5689         (Arm_relocate_functions::thumb_branch_common): Likewise.
5690         (Reloc_stub::stub_type_for_reloc): Likewise.
5691         (Target_arm::do_finalize_sections): Correct interworking checks.
5692         * testsuite/Makefile.am: Add new tests.
5693         * testsuite/Makefile.in: Regenerate.
5694         * testsuite/arm_farcall_arm_arm.s: New test.
5695         * testsuite/arm_farcall_arm_arm.sh: Likewise.
5696         * testsuite/arm_farcall_arm_thumb.s: Likewise.
5697         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
5698         * testsuite/arm_farcall_thumb_arm.s: Likewise.
5699         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
5700         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
5701         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
5702
5703 2011-10-31  Cary Coutant  <ccoutant@google.com>
5704
5705         PR gold/13023
5706         * expression.cc (Expression::eval_with_dot): Add
5707         is_section_dot_assignment parameter.
5708         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
5709         absolute and assigning to dot within a section.
5710         * script-sections.cc
5711         (Output_section_element_assignment::set_section_addresses): Pass
5712         dot_section to set_if_absolute.
5713         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
5714         as is_section_dot_assignment flag to eval_with_dot.
5715         (Output_section_element_dot_assignment::set_section_addresses):
5716         Likewise.
5717         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
5718         parameter.  Also set value if relative to dot_section; set the
5719         symbol's output_section.
5720         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
5721         parameter.  Adjust all callers.
5722         (Expression::eval_maybe_dot): Likewise.
5723         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
5724         Adjust all callers.
5725         * testsuite/script_test_2.t: Test assignment of an absolute value
5726         to dot within an output section element.
5727
5728 2011-10-31  Cary Coutant  <ccoutant@google.com>
5729
5730         * options.h (class General_options): Add --[no-]gnu-unique options.
5731         * symtab.cc (Symbol_table::sized_write_globals): Convert
5732         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
5733
5734 2011-10-31  Cary Coutant  <ccoutant@google.com>
5735
5736         PR gold/13359
5737         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
5738         unnecessary assertion.
5739         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
5740
5741 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
5742
5743         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5744         gc_mark_symbol.
5745         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5746         gc_mark_symbol.
5747         Change to just keep the section associated with symbol.
5748         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
5749         they are externally visible and --export-dynamic is turned on.
5750         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
5751
5752 2011-10-19  Ian Lance Taylor  <iant@google.com>
5753
5754         PR gold/13163
5755         * script-sections.cc
5756         (Output_section_element_dot_assignment::needs_output_section): New
5757         function.
5758
5759 2011-10-19  Ian Lance Taylor  <iant@google.com>
5760
5761         PR gold/13204
5762         * layout.cc (Layout::segment_precedes): Don't assert failure if a
5763         --section-start option was seen.
5764         * options.h (General_options::any_section_start): New function.
5765
5766 2011-10-18  David S. Miller  <davem@davemloft.net>
5767
5768         PR binutils/13301
5769         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
5770         member to track relocation locations that have moved during TLS
5771         reloc optimizations.
5772         (Target_sparc::Relocate::Relocate): Initialize to NULL.
5773         (Target_sparc::Relocate::relocate): Adjust view down by 4
5774         bytes if it matches reloc_adjust_addr_.
5775         (Target_sparc::Relocate::relocate_tls): Always move the
5776         __tls_get_addr call delay slot instruction forward 4 bytes when
5777         performing relaxation.
5778
5779 2011-10-18  Cary Coutant  <ccoutant@google.com>
5780
5781         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
5782         (Output_file::map_no_anonymous): Check for non-zero
5783         return code from posix_fallocate.
5784
5785 2011-10-17  Cary Coutant  <ccoutant@google.com>
5786
5787         PR gold/13245
5788         * plugin.cc (is_visible_from_outside): Check for symbols
5789         referenced from dynamic objects.
5790         * resolve.cc (Symbol_table::resolve): Don't count references
5791         from dynamic objects as references from real ELF files.
5792         * testsuite/plugin_test_2.sh: Adjust expected result.
5793
5794 2011-10-17  Cary Coutant  <ccoutant@google.com>
5795
5796         * gold.cc: Include timer.h.
5797         (queue_middle_tasks): Stamp time.
5798         (queue_final_tasks): Likewise.
5799         * main.cc (main): Store timer in parameters.  Print timers
5800         for each pass.
5801         * parameters.cc (Parameters::Parameters): Initialize timer_.
5802         (Parameters::set_timer): New function.
5803         (set_parameters_timer): New function.
5804         * parameters.h (Parameters::set_timer): New function.
5805         (Parameters::timer): New function.
5806         (Parameters::timer_): New data member.
5807         (set_parameters_timer): New function.
5808         * timer.cc (Timer::stamp): New function.
5809         (Timer::get_pass_time): New function.
5810         * timer.h (Timer::stamp): New function.
5811         (Timer::get_pass_time): New function.
5812         (Timer::pass_times_): New data member.
5813
5814 2011-10-17  Cary Coutant  <ccoutant@google.com>
5815
5816         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
5817         task for members of lib groups.
5818
5819 2011-10-17  Cary Coutant  <ccoutant@google.com>
5820
5821         PR gold/13288
5822         * fileread.cc (File_read::find_view): Add assert.
5823         (File_read::make_view): Move bounds check (replace with assert)...
5824         (File_read::find_or_make_view): ... to here.
5825
5826 2011-10-12  Cary Coutant  <ccoutant@google.com>
5827
5828         * output.cc (Output_file::open_base_file): Handle case where
5829         ::read returns less than requested size.
5830
5831 2011-10-10  Cary Coutant  <ccoutant@google.com>
5832
5833         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
5834         Initialize defined_count_.
5835         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
5836         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
5837         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
5838         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
5839         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
5840         * incremental.h (Sized_relobj_incr::defined_count_): New data
5841         member.
5842         (Sized_incr_dynobj::defined_count_): New data member.
5843         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
5844         Return zeroes instead of internal error.
5845
5846 2011-10-10  Cary Coutant  <ccoutant@google.com>
5847
5848         PR gold/13249
5849         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
5850         (Output_reloc::symbol_value): Return PLT offset if flag is set.
5851         * output.h (class Output_reloc): Add use_plt_offset flag.
5852         (Output_reloc::type_): Adjust size of bit field.
5853         (Output_reloc::use_plt_offset_): New bit field.
5854         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
5855         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
5856         flag.  Adjust all callers.
5857         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
5858         creating RELATIVE relocations.
5859
5860 2011-10-10  Nick Clifton  <nickc@redhat.com>
5861
5862         * po/es.po: Updated Spanish translation.
5863         * po/fi.po: Updated Finnish translation.
5864
5865 2011-10-03   Diego Novillo  <dnovillo@google.com>
5866
5867         * options.cc (parse_uint): Fix dereference of RETVAL.
5868
5869 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
5870
5871         * layout.h (section_order_map_): New member.
5872         (get_section_order_map): New member function.
5873         * output.cc (Output_section::add_input_section): Check for patterns
5874         only when --section-ordering-file is specified.
5875         * gold.cc (queue_middle_tasks): Delay updating order of sections till
5876         output_sections have been formed.
5877         * layout.cc (Layout_Layout): Initialize section_order_map_.
5878         * plugin.cc (update_section_order): Store order in order_map. Do not
5879         update the order.
5880         * testsuite/Makefile.am: Add test case for plugin_final_layout.
5881         * testsuite/Makefile.in: Regenerate.
5882         * testsuite/plugin_section_order.c: New file.
5883         * testsuite/plugin_final_layout.cc: New file.
5884         * testsuite/plugin_final_layout.sh: New file.
5885
5886 2011-09-29  Cary Coutant  <ccoutant@google.com>
5887
5888         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5889         Check for NULL.
5890         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
5891         symbols during incremental update.
5892         (Symbol_table::add_from_dynobj): Likewise.
5893
5894 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5895             Ian Lance Taylor  <iant@google.com>
5896
5897         * symtab.cc (Symbol_table::define_special_symbol): Always
5898         canonicalize version string.
5899
5900 2011-09-26  Cary Coutant  <ccoutant@google.com>
5901
5902         * gold.cc (queue_initial_tasks): Move option checks ...
5903         * options.cc (General_options::finalize): ... to here. Disable
5904         some options; make others fatal.
5905
5906 2011-09-26  Cary Coutant  <ccoutant@google.com>
5907
5908         gcc PR lto/47247
5909         * plugin.cc (get_symbols_v2): New function.
5910         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
5911         (is_referenced_from_outside): New function.
5912         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
5913         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
5914         (get_symbols): Pass version parameter.
5915         (get_symbols_v2): New function.
5916         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
5917         parameter.
5918         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
5919         (onload): Add LDPT_GET_SYMBOLS_V2.
5920         (all_symbols_read_hook): Use get_symbols_v2; check for
5921         LDPR_PREVAILING_DEF_IRONLY_EXP.
5922         * testsuite/plugin_test_3.sh: Update expected results.
5923
5924 2011-09-23  Simon Baldwin  <simonb@google.com>
5925
5926         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5927         configuration options.
5928         * configure: Regenerate.
5929         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
5930         * Makefile.in: Regenerate.
5931         * testsuite/Makefile.in: Regenerate.
5932
5933 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
5934
5935         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
5936
5937 2011-09-19  Cary Coutant  <ccoutant@google.com>
5938
5939         * incremental.cc (can_incremental_update): Fix typo in comment.
5940         * incremental.h (can_incremental_update): Likewise.
5941
5942 2011-09-18  Cary Coutant  <ccoutant@google.com>
5943
5944         * incremental.cc (can_incremental_update): New function.
5945         * incremental.h (can_incremental_update): New function.
5946         * layout.cc (Layout::init_fixed_output_section): Call it.
5947         (Layout::make_output_section): Don't allow patch space in .eh_frame.
5948         * object.cc (Sized_relobj_file::do_layout): Call
5949         can_incremental_update.
5950
5951 2011-09-13  Cary Coutant  <ccoutant@google.com>
5952
5953         * configure.ac: Check for glibc support for gnu_indirect_function
5954         support with static linking, setting automake conditional
5955         IFUNC_STATIC.
5956         * Makefile.in: Regenerate.
5957         * configure: Regenerate.
5958
5959         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
5960         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
5961         for IFUNC_STATIC.
5962         * testsuite/Makefile.in: Regenerate.
5963
5964 2011-09-13  Cary Coutant  <ccoutant@google.com>
5965
5966         * incremental.cc (Sized_relobj_incr::do_layout): Call
5967         report_comdat_group for kept comdat sections.
5968         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
5969         * testsuite/Makefile.in: Regenerate.
5970         * testsuite/incr_comdat_test_1.cc: New source file.
5971         * testsuite/incr_comdat_test_2_v1.cc: New source file.
5972         * testsuite/incr_comdat_test_2_v2.cc: New source file.
5973         * testsuite/incr_comdat_test_2_v3.cc: New source file.
5974
5975 2011-09-13  Ian Lance Taylor  <iant@google.com>
5976
5977         * object.cc (Sized_relobj_file::do_layout): Remove unused local
5978         variable external_symbols_offset.
5979
5980 2011-09-12  Ian Lance Taylor  <iant@google.com>
5981
5982         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
5983         triggered if object has no symbols.
5984
5985 2011-09-09  David S. Miller  <davem@davemloft.net>
5986
5987         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
5988         (Output_fill_debug_line::do_write): Likewise.
5989
5990 2011-08-29  Cary Coutant  <ccoutant@google.com>
5991
5992         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
5993         casts to match formatting specs.
5994         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
5995
5996 2011-08-26  Cary Coutant  <ccoutant@google.com>
5997
5998         * layout.cc (Free_list::allocate): Provide guarantee of minimum
5999         remaining hole size when allocating.
6000         (Layout::make_output_section): Set fill methods for debug sections.
6001         * layout.h (Free_list::Free_list_node): Move from private to
6002         public.
6003         (Free_list::set_min_hole_size): New function.
6004         (Free_list::begin, Free_list::end): New functions.
6005         (Free_list::min_hole_): New data member.
6006         * output.cc: Include dwarf.h.
6007         (Output_fill_debug_info::do_minimum_hole_size): New function.
6008         (Output_fill_debug_info::do_write): New function.
6009         (Output_fill_debug_line::do_minimum_hole_size): New function.
6010         (Output_fill_debug_line::do_write): New function.
6011         (Output_section::Output_section): Initialize new data member.
6012         (Output_section::set_final_data_size): Ensure patch space is larger
6013         than minimum hole size.
6014         (Output_section::do_write): Fill holes in debug sections.
6015         * output.h (Output_fill): New class.
6016         (Output_fill_debug_info): New class.
6017         (Output_fill_debug_line): New class.
6018         (Output_section::set_free_space_fill): New function.
6019         (Output_section::free_space_fill_): New data member.
6020         * testsuite/Makefile.am (incremental_test_3): Add
6021         --incremental-patch option.
6022         (incremental_test_4): Likewise.
6023         (incremental_test_5): Likewise.
6024         (incremental_test_6): Likewise.
6025         (incremental_copy_test): Likewise.
6026         (incremental_common_test_1): Likewise.
6027         * testsuite/Makefile.in: Regenerate.
6028
6029 2011-08-26  Nick Clifton  <nickc@redhat.com>
6030
6031         * po/es.po: Updated Spanish translation.
6032
6033 2011-08-01  Cary Coutant  <ccoutant@google.com>
6034
6035         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
6036         * gold/testsuite/Makefile.in: Regenerate.
6037         * gold/testsuite/justsyms_exec.c: New source file.
6038         * gold/testsuite/justsyms_lib.c: New source file.
6039
6040 2011-08-01  Cary Coutant  <ccoutant@google.com>
6041
6042         * layout.cc (Layout::set_segment_offsets): Don't realign text
6043         segment if -Ttext was specified.
6044         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
6045         file type.
6046         * object.h (Sized_relobj_file::e_type): New function.
6047         (Sized_relobj_file::e_type_): New data member.
6048         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
6049         base address for ET_EXEC files.
6050         * target.cc (Target::do_make_elf_object_implementation): Allow
6051         ET_EXEC files with --just-symbols option.
6052
6053 2011-07-28  Cary Coutant  <ccoutant@google.com>
6054
6055         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
6056         Add thread_number parameter.
6057         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
6058         * workqueue-threads.cc
6059         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
6060         current thread if its thread number is greater than desired thread
6061         count.
6062         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
6063         Add thread_number parameter.
6064         (Workqueue::should_cancel_thread): Likewise.
6065         (Workqueue::find_runnable_or_wait): Pass thread_number to
6066         should_cancel_thread.
6067         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
6068         parameter.
6069
6070 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
6071
6072         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
6073         only after checking if it cannot be forced local.
6074         * symtab.h (is_externally_visible): Check if the symbol is not forced
6075         local.
6076
6077 2011-07-15  Ian Lance Taylor  <iant@google.com>
6078
6079         * options.h (class General_options): Add --print-output-format.
6080         Move -EL next to -EB, for  better --help output.
6081         * target-select.cc: Include <cstdio>, "options.h", and
6082         "parameters.h".
6083         (Target_selector::do_target_bfd_name): New function.
6084         (print_output_format): New function.
6085         * target-select.h (class Target_selector): Update declarations.
6086         (Target_selector::target_bfd_name): New function.
6087         (print_output_format): Declare.
6088         * main.cc: Include "target-select.h".
6089         (main): Handle --print-output-format.
6090         * gold.cc: Include "target-select.h".
6091         (queue_initial_tasks): Handle --print-output-format when there are
6092         no input files.
6093         * parameters.cc (parameters_force_valid_target): Give a better
6094         error message if -EB/-EL does not match target.
6095         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
6096         function.
6097
6098 2011-07-15  Ian Lance Taylor  <iant@google.com>
6099
6100         * i386.cc (class Output_data_plt_i386): Add layout_ field.
6101         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
6102         (Output_data_plt_i386::do_write): Write address of .dynamic
6103         section to first entry in .got.plt section.
6104         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
6105         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
6106         Initialize layout_.
6107         (Output_data_plt_x86_64::do_write): Write address of .dynamic
6108         section to first entry in .got.plt section.
6109         * layout.h (Layout::dynamic_section): New function.
6110
6111 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
6112
6113         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
6114         to claim_file call.
6115         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
6116         input_section_position_, and input_section_glob_.
6117         (read_layout_from_file): Call function section_ordering_specified.
6118         * layout.h (is_section_ordering_specified): New function.
6119         (section_ordering_specified): New function.
6120         (section_ordering_specified_): New boolean member.
6121         * main.cc(main): Call load_plugins after layout object is defined.
6122         * output.cc (Output_section::add_input_section): Use
6123         function section_ordering_specified to check if section ordering is
6124         needed.
6125         * output.cc (Output_section::add_relaxed_input_section): Use
6126         function section_ordering_specified to check if section ordering is
6127         needed.
6128         (Output_section::update_section_layout): New function.
6129         (Output_section::sort_attached_input_sections): Check if input section
6130         must be reordered.
6131         * output.h (Output_section::update_section_layout): New function.
6132         * plugin.cc (get_section_count): New function.
6133         (get_section_type): New function.
6134         (get_section_name): New function.
6135         (get_section_contents): New function.
6136         (update_section_order): New function.
6137         (allow_section_ordering): New function.
6138         (Plugin::load): Add the new interfaces to the transfer vector.
6139         (Plugin_manager::load_plugins): New parameter.
6140         (Plugin_manager::all_symbols_read): New parameter.
6141         (Plugin_manager::claim_file): New parameter. Save the elf object for
6142         unclaimed objects.
6143         (Plugin_manager::get_elf_object): New function.
6144         (Plugin_manager::get_view): Change to directly use the bool to check
6145         if get_view is called from claim_file_hook.
6146         * plugin.h (input_objects): New function
6147         (Plugin__manager::load_plugins): New parameter.
6148         (Plugin_manager::claim_file): New parameter.
6149         (Plugin_manager::get_elf_object): New function.
6150         (Plugin_manager::in_claim_file_handler): New function.
6151         (Plugin_manager::in_claim_file_handler_): New member.
6152         (layout): New function.
6153         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
6154         handler with an extra parameter. Make the elf object before calling
6155         claim_file handler.
6156         * testsuite/plugin_test.c (get_section_count): New function pointer.
6157         (get_section_type): New function pointer.
6158         (get_section_name): New function pointer.
6159         (get_section_contents): New function pointer.
6160         (update_section_order): New function pointer.
6161         (allow_section_ordering): New function pointer.
6162         (onload): Check if the new interfaces exist.
6163
6164 2011-07-13  Ian Lance Taylor  <iant@google.com>
6165
6166         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
6167         relro section.
6168         * x86_64.cc (Target_x86_64::got_section): Likewise.
6169         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
6170         (relro_now_test_SOURCES): New variable.
6171         (relro_now_test_DEPENDENCIES): New variable.
6172         (relro_now_test_LDFLAGS): New variable.
6173         (relro_now_test_LDADD): New variable.
6174         (relro_now_test.so): New target.
6175         * testsuite/Makefile.in: Rebuild.
6176
6177 2011-07-12  Ian Lance Taylor  <iant@google.com>
6178
6179         PR gold/12980
6180         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
6181         GLOB_DAT relocation rather than a RELATIVE relocation for a
6182         protected symbol when creating a shared library.
6183         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6184         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
6185         * testsuite/protected_main_1.cc (main): Test that protected
6186         function has same address.
6187
6188 2011-07-11  Ian Lance Taylor  <iant@google.com>
6189
6190         PR gold/12979
6191         * options.h (class General_options): Add -Bgroup.
6192         * options.cc (General_options::finalize): If -Bgroup is set,
6193         default to --unresolved-symbols=report-all.
6194         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
6195         * target-reloc.h (issue_undefined_symbol_error): Handle
6196         --unresolved-symbols=report-all.
6197
6198 2011-07-08  Ian Lance Taylor  <iant@google.com>
6199
6200         PR gold/11985
6201         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
6202         if linker script discards key sections.
6203         (Layout::create_dynamic_symtab): Likewise.
6204         (Layout::assign_local_dynsym_offsets): Likewise.
6205         (Layout::sized_create_version_sections): Likewise.
6206         (Layout::create_interp): Likewise.
6207         (Layout::finish_dynamic_section): Likewise.
6208         (Layout::set_dynamic_symbol_size): Likewise.
6209
6210 2011-07-08  Ian Lance Taylor  <iant@google.com>
6211
6212         PR gold/12386
6213         * options.h (class General_options): Add --unresolved-symbols.
6214         * target-reloc.h (issue_undefined_symbol_error): Check
6215         --unresolved-symbols.  Add comments.
6216
6217 2011-07-08  Ian Lance Taylor  <iant@google.com>
6218
6219         * testsuite/odr_violation2.cc (Ordering::operator()): Make
6220         expression more complex.
6221
6222 2011-07-08  Ian Lance Taylor  <iant@google.com>
6223
6224         PR gold/11317
6225         * target-reloc.h (issue_undefined_symbol_error): New inline
6226         function, broken out of relocate_section.
6227         (relocate_section): Call issue_undefined_symbol_error.
6228         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
6229         there is no TLS segment if we are about to issue an undefined
6230         symbol error.
6231         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
6232
6233 2011-07-08  Ian Lance Taylor  <iant@google.com>
6234
6235         PR gold/12279
6236         * resolve.cc (Symbol_table::should_override): Add fromtype
6237         parameter.  Change all callers.  Give error when linking together
6238         TLS and non-TLS symbol.
6239         (Symbol_table::should_override_with_special): Add fromtype
6240         parameter.  Change all callers.
6241         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
6242         there is no TLS segment if we have reported some errors.
6243         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
6244
6245 2011-07-08  Ian Lance Taylor  <iant@google.com>
6246
6247         PR gold/12372
6248         * target.h (Target::plt_address_for_global): New function.
6249         (Target::plt_address_for_local): New function.
6250         (Target::plt_section_for_global): Remove.
6251         (Target::plt_section_for_local): Remove.
6252         (Target::do_plt_address_for_global): New virtual function.
6253         (Target::do_plt_address_for_local): New virtual function.
6254         (Target::do_plt_section_for_global): Remove.
6255         (Target::do_plt_section_for_local): Remove.
6256         (Target::register_global_plt_entry): Add Symbol_table and Layout
6257         parameters.
6258         * output.cc (Output_data_got::Got_entry::write): Use
6259         plt_address_for_global and plt_address_for_local.
6260         * layout.cc (Layout::add_target_dynamic_tags): Use size and
6261         address of output section.
6262         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
6263         got_irelative_, and irelative_count_ fields.  Update
6264         declarations.
6265         (Output_data_plt_i386::has_irelative_section): New function.
6266         (Output_data_plt_i386::entry_count): Add irelative_count_.
6267         (Output_data_plt_i386::set_final_data_size): Likewise.
6268         (class Target_i386): Add got_irelative_ and rel_irelative_
6269         fields.  Update declarations.
6270         (Target_i386::Target_i386): Initialize new fields.
6271         (Target_i386::do_plt_address_for_global): New function replacing
6272         do_plt_section_for_global.
6273         (Target_i386::do_plt_address_for_local): New function replacing
6274         do_plt_section_for_local.
6275         (Target_i386::got_section): Create got_irelative_.
6276         (Target_i386::rel_irelative_section): New function.
6277         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
6278         fields.  Don't define __rel_iplt_{start,end}.
6279         (Output_data_plt_i386::add_entry): Add symtab and layout
6280         parameters.  Change all callers.  Use different PLT and GOT for
6281         IFUNC symbols.
6282         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
6283         layout parameters.  Change all callers.  Use different PLT and
6284         GOT.
6285         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
6286         (Output_data_plt_i386::rel_irelative): New function.
6287         (Output_data_plt_i386::address_for_global): New function.
6288         (Output_data_plt_i386::address_for_local): New function.
6289         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
6290         IRELATIVE GOT when changing IFUNC GOT entries.
6291         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
6292         reloc.
6293         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
6294         if we didn't create an IRELATIVE GOT.
6295         (Target_i386::Relocate::relocate): Use plt_address_for_global and
6296         plt_address_for_local.
6297         (Target_i386::do_dynsym_value): Use plt_address_for_global.
6298         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
6299         got_irelative_, and irelative_count_ fields.  Update
6300         declarations.
6301         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
6302         Initialize new fields.  Remove symtab parameter.  Change all
6303         callers.
6304         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
6305         irelative_count_.
6306         (Output_data_plt_x86_64::has_irelative_section): New function.
6307         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
6308         (class Target_x86_64): Add got_irelative_ and rel_irelative_
6309         fields.  Update declarations.
6310         (Target_x86_64::Target_x86_64): Initialize new fields.
6311         (Target_x86_64::do_plt_address_for_global): New function replacing
6312         do_plt_section_for_global.
6313         (Target_x86_64::do_plt_address_for_local): New function replacing
6314         do_plt_section_for_local.
6315         (Target_x86_64::got_section): Create got_irelative_.
6316         (Target_x86_64::rela_irelative_section): New function.
6317         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
6318         all callers.  Don't create __rel_iplt_{start,end}.
6319         (Output_data_plt_x86_64::add_entry): Add symtab and layout
6320         parameters.  Change all callers.  Use different PLT and GOT for
6321         IFUNC symbols.
6322         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
6323         layout parameters.  Change all callers.  Use different PLT and
6324         GOT.
6325         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
6326         parameters.  Change all callers.  Use different PLT and GOT for
6327         IFUNC symbols.
6328         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
6329         (Output_data_plt_x86_64::rela_irelative): New function.
6330         (Output_data_plt_x86_64::address_for_global): New function.
6331         (Output_data_plt_x86_64::address_for_local): New function.
6332         (Output_data_plt_x86_64::set_final_data_size): Likewise.
6333         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
6334         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
6335         (Target_x86_64::register_global_plt_entry): Add symtab and layout
6336         parameters.
6337         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
6338         reloc.
6339         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
6340         symbols if we didn't create an IRELATIVE GOT.
6341         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
6342         plt_address_for_local.
6343         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
6344         * testsuite/ifuncvar1.c: New test file.
6345         * testsuite/ifuncvar2.c: New test file.
6346         * testsuite/ifuncvar3.c: New test file.
6347         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
6348         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
6349         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
6350         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
6351         * testsuite/Makefile.in: Rebuild.
6352
6353 2011-07-07  Cary Coutant  <ccoutant@google.com>
6354
6355         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
6356         (two_file_test_1_ndebug.o): Likewise.
6357         (two_file_test_1b_ndebug.o): Likewise.
6358         (two_file_test_2_ndebug.o): Likewise.
6359         (two_file_test_main_ndebug.o): Likewise.
6360         (incremental_test_2): Link with no-debug versions.
6361
6362 2011-07-06  Cary Coutant  <ccoutant@google.com>
6363
6364         * gold/incremental.cc
6365         (Output_section_incremental_inputs::write_info_blocks): Check for
6366         hidden and internal symbols.
6367
6368 2011-07-06  Cary Coutant  <ccoutant@google.com>
6369
6370         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
6371         Check disposition for startup file.
6372         (Incremental_inputs::report_command_line): Ignore
6373         --incremental-startup-unchanged option.
6374         * options.cc (General_options::parse_incremental_startup_unchanged):
6375         New function.
6376         (General_options::General_options): Initialize new data member.
6377         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
6378         (General_options): Add --incremental-startup-unchanged option.
6379         (General_options::incremental_startup_disposition): New function.
6380         (General_options::incremental_startup_disposition_): New data member.
6381
6382 2011-07-06  Cary Coutant  <ccoutant@google.com>
6383
6384         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
6385         input file index to Script_info ctor.
6386         (Sized_incremental_binary::do_file_has_changed): Find the
6387         command-line argument for files named in scripts.
6388         * incremental.h (Script_info::Script_info): New ctor
6389         with input file index.
6390         (Script_info::input_file_index): New function.
6391         (Script_info::input_file_index_): New data member.
6392         (Incremental_binary::get_library): Add const.
6393         (Incremental_binary::get_script_info): Add const.
6394         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
6395         * testsuite/Makefile.am (incremental_test_5): New test case.
6396         (incremental_test_6): New test case.
6397         * testsuite/Makefile.in: Regenerate.
6398
6399 2011-07-06  Cary Coutant  <ccoutant@google.com>
6400
6401         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
6402         debug output when command lines differ.
6403
6404 2011-07-06  Cary Coutant  <ccoutant@google.com>
6405
6406         * incremental.cc (Incremental_inputs::report_command_line): Ignore
6407         --incremental-patch option.
6408         * layout.cc (Free_list::allocate): Extend allocation beyond original
6409         end if enabled.
6410         (Layout::make_output_section): Mark sections that should get
6411         patch space.
6412         * options.cc (parse_percent): New function.
6413         * options.h (parse_percent): New function.
6414         (DEFINE_percent): New macro.
6415         (General_options): Add --incremental-patch option.
6416         * output.cc (Output_section::Output_section): Initialize new data
6417         members.
6418         (Output_section::add_input_section): Print section name when out
6419         of patch space.
6420         (Output_section::add_output_section_data): Likewise.
6421         (Output_section::set_final_data_size): Add patch space when
6422         doing --incremental-full.
6423         (Output_section::do_reset_address_and_file_offset): Remove patch
6424         space.
6425         (Output_segment::set_section_list_addresses): Print debug output
6426         only if --incremental-update.
6427         * output.h (Output_section::set_is_patch_space_allowed): New function.
6428         (Output_section::is_patch_space_allowed_): New data member.
6429         (Output_section::patch_space_): New data member.
6430         * parameters.cc (Parameters::incremental_full): New function.
6431         * parameters.h (Parameters::incremental_full): New function
6432         * testsuite/Makefile.am (incremental_test_2): Add test for
6433         --incremental-patch option.
6434         * testsuite/Makefile.in: Regenerate.
6435         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
6436         (t18): Remove function body.
6437
6438 2011-07-05  Doug Kwan  <dougkwan@google.com>
6439
6440         PR gold/12771
6441         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
6442         Arm_Address type for relocation result.
6443         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
6444         overflow check.
6445         (Arm_relocate_functions::abs32): Use unaligned access.
6446         (Arm_relocate_functions::rel32): Ditto.
6447         (Arm_relocate_functions::prel31): Ditto.
6448         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
6449         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
6450         static data relocations.
6451         * testsuite/Makefile.in: Regnerate.
6452         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
6453
6454 2011-07-05  Ian Lance Taylor  <iant@google.com>
6455
6456         PR gold/12392
6457         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
6458         symbols if necessary.
6459         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6460
6461 2011-07-05  Ian Lance Taylor  <iant@google.com>
6462
6463         PR gold/12952
6464         * resolve.cc (Symbol::override_base_with_special): Simply override
6465         version with special symbol version, ignoring previous version.
6466
6467 2011-07-05  Ian Lance Taylor  <iant@google.com>
6468
6469         * object.cc (Sized_relobj_file::include_section_group): Add
6470         information to comment about signature location.
6471
6472 2011-07-02  Ian Lance Taylor  <iant@google.com>
6473
6474         PR gold/12957
6475         * options.h (class General_options): Add -f and -F.
6476         * options.cc (General_options::finalize): Fatal error if -f/-F
6477         are used without -shared.
6478         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
6479
6480 2011-07-02  Ian Lance Taylor  <iant@google.com>
6481
6482         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
6483
6484 2011-07-01  Ian Lance Taylor  <iant@google.com>
6485
6486         PR gold/12525
6487         PR gold/12952
6488         * resolve.cc (Symbol::override_base_with_special): Don't override
6489         the version if the overriding symbol has a different name.
6490         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
6491         all callers.  If we give an error about an undefined version,
6492         define the base version if necessary.
6493         * dynobj.h (class Versions): Update declaration.
6494         * testsuite/weak_alias_test_5.cc: New file.
6495         * testsuite/weak_alias_test.script: New file.
6496         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
6497         and versioned_alias have the right value, and call t2.
6498         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
6499         weak_alias_test_5.so.
6500         (weak_alias_test_LDADD): Likewise.
6501         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
6502         * testsuite/Makefile.in: Rebuild.
6503
6504 2011-07-01  Ian Lance Taylor  <iant@google.com>
6505
6506         PR gold/12525
6507         * options.h (class General_options): Support -z notext.
6508         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
6509         -Wl,-z,notext.
6510         (two_file_shared_nonpic.so): Likewise.
6511         (two_file_shared_mixed.so): Likewise.
6512         (two_file_shared_mixed_1.so): Likewise.
6513         (weak_undef_lib_nonpic.so): Likewise.
6514         (alt/weak_undef_lib_nonpic.so): Likewise.
6515         (tls_test_shared_nonpic.so): Likewise.
6516         * testsuite/Makefile.in: Rebuild.
6517
6518 2011-07-01  Ian Lance Taylor  <iant@google.com>
6519
6520         PR gold/12525
6521         * configure.ac: Test whether static linking works, setting
6522         the automake conditional HAVE_STATIC.
6523         * testsuite/Makefile.am: Disable tests using -static if
6524         HAVE_STATIC is not true.
6525         * configure, testsuite/Makefile.in: Rebuild.
6526
6527 2011-07-01  Ian Lance Taylor  <iant@google.com>
6528
6529         PR gold/12525
6530         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
6531         Assert if we see DW_EH_PE_indirect.
6532         * target.h (Target::ehframe_datarel_base): New function.
6533         (Target::do_ehframe_datarel_base): New target function.
6534         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
6535         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
6536         function.
6537
6538 2011-07-01  Ian Lance Taylor  <iant@google.com>
6539
6540         PR gold/12571
6541         * options.h (class General_options): Add
6542         --ld-generated-unwind-info.
6543         * ehframe.cc (Fde::write): Add address parameter.  Change all
6544         callers.  If associated with PLT, fill in address and size.
6545         (Cie::set_output_offset): Only add merge mapping if there is an
6546         object.
6547         (Cie::write): Add address parameter.  Change all callers.
6548         (Eh_frame::add_ehframe_for_plt): New function.
6549         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
6550         input_offset_ fields into union u_, with new plt field.
6551         (Fde::Fde): Adjust for new union field.
6552         (Fde::Fde) [Output_data version]: New constructor.
6553         (Fde::add_mapping): Only add merge mapping if there is an object.
6554         (class Cie): Update declarations.
6555         (class Eh_frame): Declare add_ehframe_for_plt.
6556         * layout.cc (Layout::layout_eh_frame): Break out code into
6557         make_eh_frame_section, and call it.
6558         (Layout::make_eh_frame_section): New function.
6559         (Layout::add_eh_frame_for_plt): New function.
6560         * layout.h (class Layout): Update declarations.
6561         * merge.cc (Merge_map::add_mapping): Add assertion.
6562         * i386.cc: Include "dwarf.h".
6563         (class Output_data_plt_i386): Make first_plt_entry,
6564         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
6565         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6566         and plt_eh_frame_fde.
6567         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
6568         boundary.  Call add_eh_frame_for_plt if appropriate.
6569         * x86_64.cc: Include "dwarf.h".
6570         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
6571         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
6572         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6573         and plt_eh_frame_fde.
6574         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
6575         appropriate.
6576
6577 2011-06-29  Ian Lance Taylor  <iant@google.com>
6578
6579         PR gold/12629
6580         * object.cc (Sized_relobj_file::layout_section): Change shdr
6581         parameter to be const.
6582         (Sized_relobj_file::layout_eh_frame_section): New function, broken
6583         out of do_layout.
6584         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
6585         appropriate.  Call layout_eh_frame_section.
6586         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
6587         sections.
6588         * object.h (class Sized_relobj_file): Update declarations.
6589
6590 2011-06-29  Ian Lance Taylor  <iant@google.com>
6591
6592         PR gold/12652
6593         * script.cc (Token::integer_value): Accept trailing M/m/K/k
6594         modifier.
6595         (Lex::gather_token): Accept trailing M/m/K/k for integers.
6596
6597 2011-06-29  Ian Lance Taylor  <iant@google.com>
6598
6599         PR gold/12675
6600         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
6601         SHT_X86_64_UNWIND.
6602         * layout.cc (Layout::layout_eh_frame): Likewise.
6603
6604 2011-06-29  Ian Lance Taylor  <iant@google.com>
6605
6606         PR gold/12695
6607         * layout.cc (Layout::symtab_section_shndx): New function.
6608         * layout.h (class Layout): Declare symtab_section_shndx.
6609         * output.cc (Output_section::write_header): Call it.
6610
6611 2011-06-29  Ian Lance Taylor  <iant@google.com>
6612
6613         PR gold/12818
6614         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
6615         symbols which are not used in a relocation.
6616
6617 2011-06-28  Ian Lance Taylor  <iant@google.com>
6618
6619         PR gold/12898
6620         * layout.cc (Layout::segment_precedes): Don't crash if a linker
6621         script create indistinguishable segments.
6622         (Layout::set_segment_offsets): Use stable_sort when sorting
6623         segments.  Pass this to Compare_segments constructor.
6624         * layout.h (class Layout): Make segment_precedes non-static.
6625         (class Compare_segments): Change from struct to class.  Add
6626         layout_ field.  Add constructor.
6627         * script-sections.cc
6628         (Script_sections::attach_sections_using_phdrs_clause): Rename
6629         local orphan to is_orphan.  Don't report failure to put empty
6630         section in segment.  On attachment failure, report name of
6631         section, and attach to first PT_LOAD segment.
6632
6633 2011-06-28  Ian Lance Taylor  <iant@google.com>
6634
6635         PR gold/12934
6636         * target-select.cc (Target_selector::Target_selector): Add
6637         emulation parameter.  Change all callers.
6638         (select_target_by_bfd_name): Rename from select_target_by_name.
6639         Change all callers.
6640         (select_target_by_emulation): New function.
6641         (supported_emulation_names): New function.
6642         * target-select.h (class Target_selector): Add emulation_ field.
6643         Update declarations.
6644         (Target_selector::recognize_by_bfd_name): Rename from
6645         recognize_by_name.  Change all callers.
6646         (Target_selector::supported_bfd_names): Rename from
6647         supported_names.  Change all callers.
6648         (Target_selector::recognize_by_emulation): New function.
6649         (Target_selector::supported_emulations): New function.
6650         (Target_selector::emulation): New function.
6651         (Target_selector::do_recognize_by_bfd_name): Rename from
6652         do_recognize_by_name.  Change all callers.
6653         (Target_selector::do_supported_bfd_names): Rename from
6654         do_supported_names.  Change all callers.
6655         (Target_selector::do_recognize_by_emulation): New function.
6656         (Target_selector::do_supported_emulations): New function.
6657         (select_target_by_bfd_name): Change name in declaration.
6658         (select_target_by_emulation): Declare.
6659         (supported_emulation_names): Declare.
6660         * parameters.cc (parameters_force_valid_target): Try to find
6661         target based on emulation from -m option.
6662         * options.h (class General_options): Change doc string for -m.
6663         * options.cc (help): Print emulations.
6664         (General_options::parse_V): Likewise.
6665         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
6666         Add emulation parameter.  Change all callers.
6667
6668 2011-06-28  Ian Lance Taylor  <iant@google.com>
6669
6670         * target.h (class Target): Add osabi_ field.
6671         (Target::osabi): New function.
6672         (Target::set_osabi): New function.
6673         (Target::Target): Initialize osabi_.
6674         (Target::do_adjust_elf_header): Make pure virtual.
6675         (Sized_target::do_adjust_elf_header): Declare.
6676         * target.cc (Sized_target::do_adjust_elf_header): New function.
6677         (class Sized_target): Instantiate all versions.
6678         * freebsd.h (class Target_freebsd): Remove.
6679         (Target_selector_freebsd::do_recognize): Call set_osabi on
6680         Target.
6681         (Target_selector_freebsd::do_recognize_by_name): Likewise.
6682         (Target_selector_freebsd::set_osabi): Remove.
6683         * i386.cc (class Target_i386): Inherit from Sized_target rather
6684         than Target_freebsd.
6685         * x86_64.cc (class Target_x86_64): Likewise.
6686
6687 2011-06-28  Ian Lance Taylor  <iant@google.com>
6688
6689         * target.h (Target::can_check_for_function_pointers): Rewrite.
6690         Make non-virtual.
6691         (Target::can_icf_inline_merge_sections): Likewise.
6692         (Target::section_may_have_icf_unsafe_poineters): Likewise.
6693         (Target::Target_info): Add can_icf_inline_merge_sections field.
6694         (Target::do_can_check_for_function_pointers): New virtual
6695         function.
6696         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
6697         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
6698         from can_check_for_function_pointers, move in file.
6699         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
6700         section_may_have_icf_unsafe_poineters, move in file.
6701         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
6702         * i386.cc (Target_i386::do_can_check_for_function_pointers):
6703         Rename from can_check_for_function_pointers, move in file.
6704         (Target_i386::can_icf_inline_merge_sections): Remove.
6705         (Target_i386::i386_info): Initialize
6706         can_icf_inline_merge_sections.
6707         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6708         Initialize can_icf_inline_merge_sections.
6709         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
6710         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
6711         Rename from can_check_for_function_pointers, move in file.
6712         (Target_x86_64::can_icf_inline_merge_sections): Remove.
6713         (Target_x86_64::x86_64_info): Initialize
6714         can_icf_inline_merge_sections.
6715         * testsuite/testfile.cc (Target_test::test_target_info):
6716         Likewise.
6717         * icf.cc (get_section_contents): Correct formatting.
6718
6719 2011-06-27  Ian Lance Taylor  <iant@google.com>
6720
6721         * symtab.cc (Symbol::versioned_name): New function.
6722         (Symbol_table::add_to_final_symtab): Use versioned_name when
6723         appropriate.
6724         (Symbol_table::sized_write_symbol): Likewise.
6725         * symtab.h (class Symbol): Declare versioned_name.
6726         * stringpool.h (class Stringpool_template): Add variant of add
6727         which takes a std::basic_string.
6728         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
6729         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
6730         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
6731         (ver_test_12.o): New target.
6732         * testsuite/Makefile.in: Rebuild.
6733
6734 2011-06-27  Doug Kwan  <dougkwan@google.com>
6735
6736         * arm.cc (Arm_relocate_functions::thm_jump8,
6737         Arm_relocate_functions::thm_jump11): Use a wider signed
6738         type to compute offset.
6739         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
6740         arm_thm_jump8.
6741         * testsuite/Makefile.in: Regenerate.
6742         * testsuite/arm_branch_in_range.sh: Check test results of
6743         arm_thm_jump11 and arm_thm_jump8.
6744         * testsuite/arm_thm_jump11.s: New test source file.
6745         * testsuite/arm_thm_jump11.t: New linker script.
6746         * testsuite/arm_thm_jump8.s: New test source file.
6747         * testsuite/arm_thm_jump8.t: New linker script.
6748
6749 2011-06-24  Ian Lance Taylor  <iant@google.com>
6750
6751         * layout.cc: Include "object.h".
6752         (ctors_sections_in_init_array): New static variable.
6753         (Layout::is_ctors_in_init_array): New function.
6754         (Layout::layout): Add entry to ctors_sections_in_init_array if
6755         appropriate.
6756         * layout.h (class Layout): Declare is_ctors_in_init_array.
6757         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
6758         is_ctors_reverse_view is set.
6759         (Sized_relobj_file::write_sections): Add layout parameter.  Change
6760         all callers.  Set is_ctors_reverse_view field of View_size.
6761         (Sized_relobj_file::reverse_words): New function.
6762         * object.h (Sized_relobj_file::View_size): Add
6763         is_ctors_reverse_view field.
6764         (class Sized_relobj_file): Update declarations.
6765         * testsuite/initpri3.c: New test.
6766         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
6767         initpri3b.
6768         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
6769         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
6770         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
6771         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
6772         * testsuite/Makefile.in: Rebuild.
6773
6774 2011-06-24  Cary Coutant  <ccoutant@google.com>
6775
6776         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
6777         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
6778         (debug_msg_cdebug.err): New targets.
6779         * testsuite/Makefile.in: Regenerate.
6780         * testsuite/debug_msg.sh: Check output of link with compressed debug.
6781         Fix checks for link with shared library.
6782
6783 2011-06-24  Doug Kwan  <dougkwan@google.com>
6784
6785         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
6786         skip empty text sections.
6787         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
6788
6789 2011-06-22  Ian Lance Taylor  <iant@google.com>
6790
6791         PR gold/12910
6792         * options.h (class General_options): Add --ctors-in-init-array.
6793         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
6794         friends as SHT_PROGBITS for merging sections.
6795         (Layout::layout): Remove special handling of .init_array and
6796         friends.  Don't sort if doing relocatable link.  Sort for .ctors
6797         and .dtors if ctors_in_init_array.
6798         (Layout::make_output_section): Force correct section types for
6799         .init_array and friends.  Don't sort if doing relocatable link,
6800         Don't sort .ctors and .dtors if ctors_in_init_array.
6801         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
6802         (Layout::output_section_name): Add relobj parameter.  Change all
6803         callers.  Handle .ctors. and .dtors. in code rather than table.
6804         Handle .ctors and .dtors if ctors_in_init_array.
6805         (Layout::match_file_name): New function, moved from output.cc.
6806         * layout.h (class Layout): Update declarations.
6807         * output.cc: Include "layout.h".
6808         (Input_section_sort_entry::get_priority): New function.
6809         (Input_section_sort_entry::match_file_name): Just call
6810         Layout::match_file_name.
6811         (Output_section::Input_section_sort_init_fini_compare::operator()):
6812         Handle .ctors and .dtors.  Sort by explicit priority rather than
6813         by name.
6814         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
6815         * testsuite/initpri2.c: New test.
6816         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
6817         (check_PROGRAMS): Add initpri2.
6818         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
6819         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
6820         * configure, testsuite/Makefile.in: Rebuild.
6821
6822 2011-06-19  Ian Lance Taylor  <iant@google.com>
6823
6824         PR gold/12880
6825         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
6826         .interp section to a PT_INTERP segment even if we have seen a
6827         --dynamic-linker option.  Don't do it if we have seen a PHDRS
6828         clause in a linker script.
6829         (Layout::finalize): Don't create a .interp section if we've
6830         already create a PT_INTERP segment.
6831         (Layout::create_interp): Always call choose_output_section (revert
6832         patch of 2011-06-17).  Don't create PT_INTERP segment.
6833         * script-sections.cc
6834         (Script_sections::create_note_and_tls_segments): Add a .interp
6835         section to a PT_INTERP segment even if we have seen a
6836         --dynamic-linker option.
6837
6838 2011-06-18  Ian Lance Taylor  <iant@google.com>
6839
6840         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
6841         merely because a non-PT_LOAD segment has a dynamic reloc.
6842
6843 2011-06-18  Ian Lance Taylor  <iant@google.com>
6844
6845         * layout.cc (Layout::finish_dynamic_section): Don't create
6846         DT_FLAGS entry if not needed.
6847
6848 2011-06-18  Ian Lance Taylor  <iant@google.com>
6849
6850         PR gold/12745
6851         * layout.cc (Layout::layout_eh_frame): Correct handling of
6852         writable .eh_frame section.
6853
6854 2011-06-17  Ian Lance Taylor  <iant@google.com>
6855
6856         PR gold/12893
6857         * resolve.cc (Symbol_table::resolve): Don't give an error if a
6858         symbol is redefined with the exact same object and value.
6859
6860 2011-06-17  Ian Lance Taylor  <iant@google.com>
6861
6862         PR gold/12880
6863         * layout.h (class Layout): Add interp_segment_ field.
6864         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
6865         (Layout::attach_allocated_section_to_segment): If making shared
6866         library, put .interp section in PT_INTERP segment.
6867         (Layout::finalize): Also call create_interp if -dynamic-linker
6868         option was used.
6869         (Layout::create_interp): Assert that there is no PT_INTERP
6870         segment.  If not using a SECTIONS clause, use make_output_section.
6871         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
6872         * script-sections.cc
6873         (Script_sections::create_note_and_tls_segments): If making shared
6874         library, put .interp section in PT_INTERP segment.
6875
6876 2011-06-17  Ian Lance Taylor  <iant@google.com>
6877
6878         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
6879         when making a shared library.
6880
6881 2011-06-17  Ian Lance Taylor  <iant@google.com>
6882
6883         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
6884         parameter.  Change all callers.  Don't issue warning about PC32
6885         against locally defined symbol.
6886
6887 2011-06-16  Ian Lance Taylor  <iant@google.com>
6888
6889         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
6890         occurs in same object.
6891
6892 2011-06-14  Alan Modra  <amodra@gmail.com>
6893
6894         * po/POTFILES.in: Regenerate.
6895
6896 2011-06-09  Ian Lance Taylor  <iant@google.com>
6897
6898         * script-sections.cc
6899         (Orphan_output_section::set_section_addresses): For a relocatable
6900         link set address to 0.
6901
6902 2011-06-09  Cary Coutant  <ccoutant@google.com>
6903
6904         PR gold/12804
6905         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
6906         used with --compress-debug-sections.
6907         * gold/object.cc (Sized_relobj_file::do_layout): Report
6908         uncompressed size of compressed input sections.
6909
6910 2011-06-08  Cary Coutant  <ccoutant@google.com>
6911
6912         PR gold/12804
6913         * testsuite/two_file_test_2_v1.cc: Change initialization of
6914         v2 to keep it in .data.
6915
6916 2011-06-07  Cary Coutant  <ccoutant@google.com>
6917
6918         * common.cc (Symbol_table::do_allocate_commons_list): Call
6919         gold_fallback.
6920         * errors.cc (Errors::fatal): Adjust call to gold_exit.
6921         (Errors::fallback): New function.
6922         (gold_fallback): New function.
6923         * errors.h (Errors::fallback): New function.
6924         * gold.cc (gold_exit): Change status parameter to enum; adjust
6925         all callers.
6926         (queue_initial_tasks): Call gold_fallback.
6927         * gold.h: Include cstdlib.
6928         (Exit_status): New enum type.
6929         (gold_exit): Change status parameter to enum.
6930         (gold_fallback): New function.
6931         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
6932         (Layout::create_symtab_sections): Likewise.
6933         (Layout::create_shdrs): Likewise.
6934         * main.cc (main): Adjust call to gold_exit.
6935         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
6936         (Output_data_got::add_got_entry_pair): Likewise.
6937         (Output_section::add_input_section): Likewise.
6938         (Output_section::add_output_section_data): Likewise.
6939         (Output_segment::set_section_list_addresses): Likewise.
6940         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
6941
6942 2011-06-07  Cary Coutant  <ccoutant@google.com>
6943
6944         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
6945         for incremental links.
6946         * output.cc (Output_segment::set_section_list_addresses): Remove
6947         FIXME and test for TLS or BSS.
6948
6949 2011-06-07  Cary Coutant  <ccoutant@google.com>
6950
6951         * testsuite/Makefile.am: Add incremental_copy_test,
6952         incremental_common_test_1.
6953         * testsuite/Makefile.in: Regenerate.
6954         * testsuite/common_test_1_v1.c: New source file.
6955         * testsuite/common_test_1_v2.c: New source file.
6956         * testsuite/copy_test_v1.cc: New source file.
6957
6958 2011-06-07  Cary Coutant  <ccoutant@google.com>
6959
6960         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
6961         update, allocate common from bss section's free list.
6962         * incremental-dump.cc (dump_incremental_inputs): Print flag for
6963         linker-defined symbols.
6964         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
6965         Skip GOT and PLT entries that are no longer referenced.
6966         (Output_section_incremental_inputs::write_info_blocks): Mark
6967         linker-defined symbols.
6968         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
6969         * output.cc (Output_section::allocate): New function.
6970         * output.h (Output_section::allocate): New function.
6971         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
6972         linker-defined symbols.
6973         (Symbol::override_base_with_special): Copy is_predefined_ flag.
6974         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
6975         (Symbol::init_base_output_data): Likewise.
6976         (Symbol::init_base_output_segment): Likewise.
6977         (Symbol::init_base_constant): Likewise.
6978         (Sized_symbol::init_output_data): Likewise.
6979         (Sized_symbol::init_output_segment): Likewise.
6980         (Sized_symbol::init_constant): Likewise.
6981         (Symbol_table::do_define_in_output_data): Likewise.
6982         (Symbol_table::do_define_in_output_segment): Likewise.
6983         (Symbol_table::do_define_as_constant): Likewise.
6984         * symtab.h (Symbol::is_predefined): New function.
6985         (Symbol::init_base_output_data): Add is_predefined parameter.
6986         (Symbol::init_base_output_segment): Likewise.
6987         (Symbol::init_base_constant): Likewise.
6988         (Symbol::is_predefined_): New data member.
6989         (Sized_symbol::init_output_data): Add is_predefined parameter.
6990         (Sized_symbol::init_output_segment): Likewise.
6991         (Sized_symbol::init_constant): Likewise.
6992         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
6993
6994 2011-06-07  Cary Coutant  <ccoutant@google.com>
6995
6996         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
6997         instead of emit_copy_reloc.
6998         (Copy_relocs::emit_copy_reloc): Refactor.
6999         (Copy_relocs::make_copy_reloc): New function.
7000         (Copy_relocs::add_copy_reloc): Remove.
7001         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
7002         section.
7003         (Copy_relocs::make_copy_reloc): New function.
7004         (Copy_relocs::add_copy_reloc): Remove.
7005         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
7006         unchanged input files.
7007         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
7008         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
7009         Reserve BSS space for COPY relocations.
7010         (Sized_incremental_binary::do_emit_copy_relocs): New function.
7011         (Output_section_incremental_inputs::write_info_blocks): Record
7012         whether a symbol is copied from a shared object.
7013         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
7014         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
7015         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
7016         (Incremental_input_entry_reader::get_output_symbol_index): Add
7017         is_copy parameter.
7018         (Incremental_binary::emit_copy_relocs): New function.
7019         (Incremental_binary::do_emit_copy_relocs): New function.
7020         (Sized_incremental_binary::Sized_incremental_binary): Initialize
7021         new data member.
7022         (Sized_incremental_binary::add_copy_reloc): New function.
7023         (Sized_incremental_binary::do_emit_copy_relocs): New function.
7024         (Sized_incremental_binary::Copy_reloc): New struct.
7025         (Sized_incremental_binary::Copy_relocs): New typedef.
7026         (Sized_incremental_binary::copy_relocs_): New data member.
7027         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
7028         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
7029         * target.h (Sized_target::emit_copy_reloc): New function.
7030         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
7031
7032 2011-06-02  Cary Coutant  <ccoutant@google.com>
7033
7034         PR gold/12163
7035         * gold/archive.cc (Archive::Archive): Initialize new data member.
7036         (Archive::include_all_members): Return if archive has already been
7037         included.
7038         * gold/archive.h (Archive::include_all_members_): New data member.
7039
7040 2011-06-02  Nick Clifton  <nickc@redhat.com>
7041
7042         * dynobj.h: Fix spelling mistake in comment.
7043         * output.cc: Likewise.
7044
7045 2011-05-31  Doug Kwan  <dougkwan@google.com>
7046             Asier Llano
7047
7048         PR gold/12826
7049         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
7050         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
7051         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
7052         redundant arm_exidx_test.so.
7053         * testsuite/Makefile.in: Regenerate.
7054         (check_SCRIPTS): Add pr12826.sh
7055         (check_DATA): Add pr12826.stdout
7056         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
7057         * testsuite/pr12826.sh: New file.
7058         * testsuite/pr12826_1.s: Ditto.
7059         * testsuite/pr12826_1.s: Ditto.
7060
7061 2011-05-30  Ian Lance Taylor  <iant@google.com>
7062
7063         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
7064         sections.
7065
7066 2011-05-29  Ian Lance Taylor  <iant@google.com>
7067
7068         PR gold/12804
7069         * testsuite/Makefile.am: Use different file name for two_file_test
7070         temporary file for each incremental test.
7071         * testsuite/Makefile.in: Rebuild.
7072
7073 2011-05-29  Ian Lance Taylor  <iant@google.com>
7074
7075         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
7076         binary input file is empty.
7077
7078 2011-05-27  Ian Lance Taylor  <iant@google.com>
7079
7080         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
7081         (ver_test_9.so): Likewise.
7082         * testsuite/Makefile.in: Rebuild.
7083
7084 2011-05-26 Cary Coutant  <ccoutant@google.com>
7085
7086         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
7087         * incremental.cc (Incremental_inputs::report_input_section): Fix
7088         comment, indentation.
7089         (Incremental_inputs::report_comdat_group): New function.
7090         (Output_section_incremental_inputs::set_final_data_size): Adjust size
7091         of data for incremental input file entry.
7092         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
7093         group count, COMDAT group signatures.
7094         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
7095         an unchanged input file.
7096         * incremental.h (Incremental_object_entry::Incremental_object_entry):
7097         Initialize new data member.
7098         (Incremental_object_entry::add_comdat_group): New function.
7099         (Incremental_object_entry::get_comdat_group_count): New function.
7100         (Incremental_object_entry::get_comdat_signature_key): New function.
7101         (Incremental_object_entry::groups_): New data member.
7102         (Incremental_inputs::report_comdat_group): New function.
7103         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
7104         data for incremental input file entry.
7105         (Incremental_input_entry_reader::get_comdat_group_count): New function.
7106         (Incremental_input_entry_reader::get_input_section): Adjust size of
7107         data for incremental input file entry.
7108         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
7109         (Incremental_input_entry_reader::get_comdat_group_signature): New
7110         function.
7111         * object.cc (Sized_relobj::include_section_group): Report kept
7112         COMDAT groups for incremental links.
7113
7114 2011-05-24  David Meyer  <pdox@google.com>
7115
7116         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
7117         with name parameter.  Add found_name parameter.
7118         * fileread.cc (Input_file::find_file): Adjust code accordingly.
7119         * dirsearch.h (class Dirsearch): Update declaration.
7120
7121 2011-05-24  Ian Lance Taylor  <iant@google.com>
7122
7123         * archive.cc (Library_base::should_include_member): Pull in object
7124         from archive if it defines the entry symbol.
7125         * parameters.cc (Parameters::entry): New function.
7126         * parameters.h (class Parameters): Declare entry.
7127         * output.h (class Output_file_header): Remove entry_ field.
7128         * output.cc (Output_file_header::Output_file_header): Remove entry
7129         parameter.  Change all callers.
7130         (Output_file_header::entry): Use parameters->entry.
7131         * gold.cc (queue_middle_tasks): Likewise.
7132         * plugin.cc (Plugin_hook::run): Likewise.
7133
7134 2011-05-24 Cary Coutant  <ccoutant@google.com>
7135
7136         * gold.cc (queue_initial_tasks): Pass incremental base filename
7137         to Output_file::open_base_file; don't print error message.
7138         * incremental-dump.cc (main): Adjust call to
7139         Output_file::open_for_modification.
7140         * incremental-dump.cc (main): Likewise.
7141         * incremental.cc (Incremental_inputs::report_command_line):
7142         Ignore --incremental-base option when comparing command lines.
7143         Ignore parameter when given as separate argument.
7144         * options.h (class General_options): Add --incremental-base.
7145         * output.cc (Output_file::Output_file):
7146         (Output_file::open_base_file): Add base_name and writable parameters;
7147         read base file into new file; print error message here.
7148         (Output_file::map_no_anonymous): Add writable parameter; adjust all
7149         callers.
7150         * output.h (Output_file::open_for_modification): Rename to...
7151         (Output_file::open_base_file): ...this; add base_name and
7152         writable parameters; adjust all callers.
7153         (Output_file::map_no_anonymous): Add writable parameter; adjust all
7154         callers.
7155         * testsuite/Makefile.am (incremental_test_4): Test
7156         --incremental-base.
7157         * testsuite/Makefile.in: Regenerate.
7158
7159 2011-05-24 Cary Coutant  <ccoutant@google.com>
7160
7161         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
7162         incremental_test_4.
7163         * testsuite/Makefile.in: Regenerate.
7164         * testsuite/two_file_test_1_v1.cc: New test source file.
7165         * testsuite/two_file_test_1b_v1.cc: New test source file.
7166         * testsuite/two_file_test_2_v1.cc: New test source file.
7167
7168 2011-05-24 Cary Coutant  <ccoutant@google.com>
7169
7170         * dynobj.h (Dynobj::do_dynobj): New function.
7171         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
7172         flag and soname for shared objects.
7173         * incremental.cc (Incremental_inputs::report_object): Make
7174         either Incremental_object_entry or Incremental_dynobj_entry; add
7175         soname to string table.
7176         (Incremental_inputs::report_input_section): Add assertion.
7177         (Output_section_incremental_inputs::set_final_data_size): Adjust
7178         type of input file entry for shared libraries; adjust size of
7179         shared library info entry.
7180         (Output_section_incremental_inputs::write_input_files): Write
7181         as_needed flag for shared libraries.
7182         (Output_section_incremental_inputs::write_info_blocks): Adjust type
7183         of input file entry for shared libraries; write soname.
7184         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
7185         soname from incremental info.
7186         * incremental.h (enum Incremental_input_flags): Add
7187         INCREMENTAL_INPUT_AS_NEEDED.
7188         (Incremental_input_entry::Incremental_input_entry): Initialize new
7189         data member.
7190         (Incremental_input_entry::set_as_needed): New function.
7191         (Incremental_input_entry::as_needed): New function.
7192         (Incremental_input_entry::do_dynobj_entry): New function.
7193         (Incremental_input_entry::as_needed_): New data member.
7194         (Incremental_object_entry::Incremental_object_entry): Don't check
7195         for shared library.
7196         (Incremental_object_entry::do_type): Likewise.
7197         (class Incremental_dynobj_entry): New class.
7198         (Incremental_input_entry_reader::as_needed): New function.
7199         (Incremental_input_entry_reader::get_soname): New function.
7200         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
7201         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
7202         size of shared library info entry.
7203         * layout.cc (Layout::finish_dynamic_section): Don't test for
7204         incremental link when adding DT_NEEDED entries.
7205         * object.h (Object::Object): Initialize new data member.
7206         (Object::dynobj): New function.
7207         (Object::set_as_needed): New function.
7208         (Object::as_needed): New function.
7209         (Object::do_dynobj): New function.
7210         (Object::as_needed_): New data member.
7211
7212 2011-05-24 Cary Coutant  <ccoutant@google.com>
7213
7214         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
7215         info; adjust display of GOT entries.
7216         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7217         vector of input objects; remove file_status_.
7218         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
7219         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
7220         got_plt reader; call target hooks to reserve GOT entries.
7221         (Output_section_incremental_inputs::set_final_data_size): Adjust size
7222         of input file info header and GOT info entry.
7223         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
7224         relocation info.
7225         (Got_plt_view_info::got_descriptor): Remove.
7226         (Got_plt_view_info::sym_index): New data member.
7227         (Got_plt_view_info::input_index): New data member.
7228         (Local_got_offset_visitor::visit): Write input file index.
7229         (Global_got_offset_visitor::visit): Write 0 for input file index.
7230         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
7231         with sym_index and input_index.
7232         (Output_section_incremental_inputs::write_got_plt): Adjust size of
7233         incremental info GOT entry; replace got_descriptor with input_index.
7234         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
7235         map from input file index to object.
7236         (Sized_relobj_incr::do_layout): Replace direct data member reference
7237         with accessor function.
7238         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
7239         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
7240         Adjust size of input file info header.
7241         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
7242         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
7243         (Incremental_input_entry_reader::get_input_section): Adjust size of
7244         input file info header.
7245         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
7246         of incremental info GOT entry.
7247         (Incremental_got_plt_reader::get_got_desc): Remove.
7248         (Incremental_got_plt_reader::get_got_symndx): New function.
7249         (Incremental_got_plt_reader::get_got_input_index): New function.
7250         (Sized_incremental_binary::Sized_incremental_binary): Remove
7251         file_status_; add input_objects_.
7252         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
7253         (Sized_incremental_binary::set_file_is_unchanged): Remove.
7254         (Sized_incremental_binary::file_is_unchanged): Remove.
7255         (Sized_incremental_binary::set_input_object): New function.
7256         (Sized_incremental_binary::input_object): New function.
7257         (Sized_incremental_binary::file_status_): Remove.
7258         (Sized_incremental_binary::input_objects_): New data member.
7259         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
7260         references.
7261         (Sized_relobj_incr::invalid_address): Move to base class.
7262         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
7263         class.
7264         (Sized_relobj_incr::do_output_section_offset): Likewise.
7265         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
7266         (Sized_relobj_incr::section_offsets_): Likewise.
7267         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
7268         function.
7269         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
7270         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
7271         with accessor function.
7272         (Sized_relobj_file::do_layout): Likewise.
7273         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
7274         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
7275         (Sized_relobj_file::compute_final_local_value): Replace refs to
7276         section_offsets_ with accessor function.
7277         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
7278         * object.h (Relobj::Relobj): Initialize new data members.
7279         (Relobj::add_dyn_reloc): New function.
7280         (Relobj::first_dyn_reloc): New function.
7281         (Relobj::dyn_reloc_count): New function.
7282         (Relobj::first_dyn_reloc_): New data member.
7283         (Relobj::dyn_reloc_count_): New data member.
7284         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
7285         references.
7286         (Sized_relobj::Address): New typedef.
7287         (Sized_relobj::invalid_address): Move here from child class.
7288         (Sized_relobj::Sized_relobj): Initialize new data members.
7289         (Sized_relobj::sized_relobj): New function.
7290         (Sized_relobj::is_output_section_offset_invalid): Move here from
7291         child class.
7292         (Sized_relobj::get_output_section_offset): Likewise.
7293         (Sized_relobj::local_has_got_offset): Likewise.
7294         (Sized_relobj::local_got_offset): Likewise.
7295         (Sized_relobj::set_local_got_offset): Likewise.
7296         (Sized_relobj::do_for_all_local_got_entries): Likewise.
7297         (Sized_relobj::clear_got_offsets): New function.
7298         (Sized_relobj::section_offsets): Move here from child class.
7299         (Sized_relobj::do_output_section_offset): Likewise.
7300         (Sized_relobj::do_set_section_offset): Likewise.
7301         (Sized_relobj::Local_got_offsets): Likewise.
7302         (Sized_relobj::local_got_offsets_): Likewise.
7303         (Sized_relobj::section_offsets_): Likewise.
7304         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
7305         references.
7306         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
7307         class.
7308         (Sized_relobj_file::sized_relobj): New function
7309         (Sized_relobj_file::local_has_got_offset): Move to base class.
7310         (Sized_relobj_file::local_got_offset): Likewise.
7311         (Sized_relobj_file::set_local_got_offset): Likewise.
7312         (Sized_relobj_file::get_output_section_offset): Likewise.
7313         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
7314         (Sized_relobj_file::do_output_section_offset): Likewise.
7315         (Sized_relobj_file::do_set_section_offset): Likewise.
7316         (Sized_relobj_file::Local_got_offsets): Likewise.
7317         (Sized_relobj_file::local_got_offsets_): Likewise.
7318         (Sized_relobj_file::section_offsets_): Likewise.
7319         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
7320         (all constructors).
7321         (set_needs_dynsym_index): Convert relobj to derived class pointer.
7322         (Output_reloc::get_symbol_index): Likewise.
7323         (Output_reloc::local_section_offset): Likewise.
7324         (Output_reloc::get_address): Likewise.
7325         (Output_reloc::symbol_value): Likewise.
7326         (Output_data_got::reserve_slot): Move to class definition.
7327         (Output_data_got::reserve_local): New function.
7328         (Output_data_got::reserve_slot_for_global): Remove.
7329         (Output_data_got::reserve_global): New function.
7330         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
7331         (all constructors, two instantiations).
7332         (Output_reloc::get_relobj): New function (two instantiations).
7333         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
7334         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
7335         (Output_data_reloc::add_global): Adjust type of relobj.
7336         (Output_data_reloc::add_global_relative): Likewise.
7337         (Output_data_reloc::add_symbolless_global_addend): Likewise.
7338         (Output_data_reloc::add_local): Likewise.
7339         (Output_data_reloc::add_local_relative): Likewise.
7340         (Output_data_reloc::add_symbolless_local_addend): Likewise.
7341         (Output_data_reloc::add_local_section): Likewise.
7342         (Output_data_reloc::add_output_section): Likewise.
7343         (Output_data_reloc::add_absolute): Likewise.
7344         (Output_data_reloc::add_target_specific): Likewise.
7345         (Output_data_got::reserve_slot): Move definition here.
7346         (Output_data_got::reserve_local): New function.
7347         (Output_data_got::reserve_global): New function.
7348         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
7349         section_offsets_ with accessor function.
7350         (Sized_relobj_file::write_sections): Likewise.
7351         (Sized_relobj_file::do_relocate_sections): Likewise.
7352         * target.h (Sized_target::reserve_local_got_entry): New function.
7353         (Sized_target::reserve_global_got_entry): New function.
7354         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
7355         (Target_x86_64::reserve_global_got_entry): New function.
7356         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
7357
7358 2011-05-23 Cary Coutant  <ccoutant@google.com>
7359
7360         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
7361         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
7362         bit when checking got_type.
7363         * incremental.cc (Sized_incremental_binary::setup_readers):
7364         Store symbol table and string table locations; initialize bit vector
7365         of file status flags.
7366         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
7367         unchanged files.
7368         (Sized_incremental_binary::do_process_got_plt): New function.
7369         (Sized_incremental_binary::get_symtab_view): Use stored locations.
7370         (Output_section_incremental_inputs::set_final_data_size): Record
7371         file index for each input file.
7372         (Output_section_incremental_inputs::write_got_plt): Store file index
7373         instead of input entry offset for each GOT entry.
7374         * incremental.h
7375         (Incremental_input_entry::Incremental_input_entry): Initialize new
7376         data member.
7377         (Incremental_input_entry::set_offset): Store file index.
7378         (Incremental_input_entry::get_file_index): New function.
7379         (Incremental_input_entry::file_index_): New data member.
7380         (Incremental_binary::process_got_plt): New function.
7381         (Incremental_binary::do_process_got_plt): New function.
7382         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7383         data members.
7384         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
7385         (Sized_incremental_binary::set_file_is_unchanged): New function.
7386         (Sized_incremental_binary::file_is_unchanged): New function.
7387         (Sized_incremental_binary::do_process_got_plt): New function.
7388         (Sized_incremental_binary::file_status_): New data member.
7389         (Sized_incremental_binary::main_symtab_loc_): New data member.
7390         (Sized_incremental_binary::main_strtab_loc_): New data member.
7391         * output.cc (Output_data_got::Got_entry::write): Add case
7392         RESERVED_CODE.
7393         (Output_data_got::add_global): Call add_got_entry.
7394         (Output_data_got::add_global_plt): Likewise.
7395         (Output_data_got::add_global_with_rel): Likewise.
7396         (Output_data_got::add_global_with_rela): Likewise.
7397         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
7398         (Output_data_got::add_global_pair_with_rela): Likewise.
7399         (Output_data_got::add_local): Call add_got_entry.
7400         (Output_data_got::add_local_plt): Likewise.
7401         (Output_data_got::add_local_with_rel): Likewise.
7402         (Output_data_got::add_local_with_rela): Likewise.
7403         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
7404         (Output_data_got::add_local_pair_with_rela): Likewise.
7405         (Output_data_got::reserve_slot): New function.
7406         (Output_data_got::reserve_slot_for_global): New function.
7407         (Output_data_got::add_got_entry): New function.
7408         (Output_data_got::add_got_entry_pair): New function.
7409         (Output_section::add_output_section_data): Edit FIXME.
7410         * output.h
7411         (Output_section_data_build::Output_section_data_build): New
7412         constructor with size parameter.
7413         (Output_data_space::Output_data_space): Likewise.
7414         (Output_data_got::Output_data_got): Initialize new data member; new
7415         constructor with size parameter.
7416         (Output_data_got::add_constant): Call add_got_entry.
7417         (Output_data_got::reserve_slot): New function.
7418         (Output_data_got::reserve_slot_for_global): New function.
7419         (class Output_data_got::Got_entry): Add RESERVED_CODE.
7420         (Output_data_got::add_got_entry): New function.
7421         (Output_data_got::add_got_entry_pair): New function.
7422         (Output_data_got::free_list_): New data member.
7423         * target.h (Sized_target::init_got_plt_for_update): New function.
7424         (Sized_target::register_global_plt_entry): New function.
7425         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
7426         Initialize new data member; call init; add constructor with PLT count.
7427         (Output_data_plt_x86_64::init): New function.
7428         (Output_data_plt_x86_64::add_relocation): New function.
7429         (Output_data_plt_x86_64::reserve_slot): New function.
7430         (Output_data_plt_x86_64::free_list_): New data member.
7431         (Target_x86_64::init_got_plt_for_update): New function.
7432         (Target_x86_64::register_global_plt_entry): New function.
7433         (Output_data_plt_x86_64::add_entry): Allocate from free list for
7434         incremental updates.
7435         (Output_data_plt_x86_64::add_relocation): New function.
7436         * testsuite/object_unittest.cc (Object_test): Set default options.
7437
7438 2011-05-16  Ian Lance Taylor  <iant@google.com>
7439
7440         * options.h (class General_options): Make -i a synonym for -r.
7441
7442 2011-05-16  Ian Lance Taylor  <iant@google.com>
7443
7444         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
7445
7446 2011-05-10 Cary Coutant  <ccoutant@google.com>
7447
7448         * object.cc (Sized_relobj::do_count_local_symbols): Check for
7449         strip_all (-s).
7450
7451 2011-05-06  Ian Lance Taylor  <iant@google.com>
7452
7453         * layout.cc (Layout::layout): If the output section flags change,
7454         update the ordering.
7455
7456 2011-04-25 Cary Coutant  <ccoutant@google.com>
7457
7458         * incremental-dump.cc (dump_incremental_inputs): Print local
7459         symbol info for each input file.
7460         * incremental.cc
7461         (Output_section_incremental_inputs::set_final_data_size): Add local
7462         symbol info to input file entries in incremental info.
7463         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7464         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
7465         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
7466         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
7467         implementation.
7468         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
7469         (Sized_incr_relobj::do_relocate): Write the local symbols.
7470         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
7471         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
7472         Adjust size of input file header.
7473         (Incremental_inputs_reader::get_local_symbol_offset): New function.
7474         (Incremental_inputs_reader::get_local_symbol_count): New function.
7475         (Incremental_inputs_reader::get_input_section): Adjust size of input
7476         file header.
7477         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
7478         (Sized_incr_relobj::This): New typedef.
7479         (Sized_incr_relobj::sym_size): New const data member.
7480         (Sized_incr_relobj::Local_symbol): New struct.
7481         (Sized_incr_relobj::do_output_local_symbol_count): New function.
7482         (Sized_incr_relobj::do_local_symbol_offset): New function.
7483         (Sized_incr_relobj::local_symbol_count_): New data member.
7484         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
7485         (Sized_incr_relobj::local_symbol_index_): New data member.
7486         (Sized_incr_relobj::local_symbol_offset_): New data member.
7487         (Sized_incr_relobj::local_dynsym_offset_): New data member.
7488         (Sized_incr_relobj::local_symbols_): New data member.
7489         * object.h (Relobj::output_local_symbol_count): New function.
7490         (Relobj::local_symbol_offset): New function.
7491         (Relobj::do_output_local_symbol_count): New function.
7492         (Relobj::do_local_symbol_offset): New function.
7493         (Sized_relobj::do_output_local_symbol_count): New function.
7494         (Sized_relobj::do_local_symbol_offset): New function.
7495
7496 2011-04-22  Vladimir Simonov  <sv@sw.ru>
7497
7498         * descriptors.cc (set_close_on_exec): New function.
7499         (Descriptors::open): Use set_close_on_exec.
7500         * output.cc (S_ISLNK): Define if not defined.
7501
7502 2011-04-22 Cary Coutant  <ccoutant@google.com>
7503
7504         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7505         global symbol map.
7506         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7507         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
7508         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
7509         relocations.
7510         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
7511         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
7512         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
7513         * incremental.h
7514         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
7515         function.
7516         (Incremental_binary::apply_incremental_relocs): New function.
7517         (Incremental_binary::do_apply_incremental_relocs): New function.
7518         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7519         data member.
7520         (Sized_incremental_binary::add_global_symbol): New function.
7521         (Sized_incremental_binary::global_symbol): New function.
7522         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7523         (Sized_incremental_binary::symbol_map_): New data member.
7524         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
7525         * target.h (Sized_target::apply_relocation): New function.
7526         * target-reloc.h (apply_relocation): New function.
7527         * x86_64.cc (Target_x86_64::apply_relocation): New function.
7528
7529 2011-04-22  Doug Kwan  <dougkwan@google.com>
7530
7531         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
7532         flag of a SHT_ARM_EXIDX section.
7533         * testsuite/Makefile.am (arm_exidx_test): New test rules.
7534         * testsuite/Makefile.in: Regenerate.
7535         * testsuite/arm_exidx_test.s: New file.
7536         * testsuite/arm_exidx_test.sh: Same.
7537
7538 2011-04-20 Cary Coutant  <ccoutant@google.com>
7539
7540         PR gold/12689
7541         * archive.h (Incremental_archive_entry::Archive_member):
7542         Initialize arg_serial_ (second constructor).
7543
7544 2011-04-17  Ian Lance Taylor  <iant@google.com>
7545
7546         * object.cc (Relocate_info::location): Simplify location string.
7547         * errors.cc (Errors::error_at_location): Don't print program
7548         name.
7549         (Errors::warning_at_location): Likewise.
7550         (Errors::undefined_symbol): Likewise.
7551         * testsuite/debug_msg.sh: Update accordingly.
7552
7553 2011-04-14 Cary Coutant  <ccoutant@google.com>
7554
7555         * gold/layout.cc (Layout::symtab_section_offset): New function.
7556         * gold/layout.h (Layout::symtab_section_offset): New function.
7557         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
7558
7559 2011-04-12  Ian Lance Taylor  <iant@google.com>
7560
7561         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
7562         with MREMAP_MAYMOVE.
7563         * output.h (class Output_file): Add map_is_allocated_ field.
7564         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
7565         not available, provide stubs.  If mremap is not available, #define
7566         it to gold_mremap.
7567         (MREMAP_MAYMOVE): Define if not defined.
7568         (Output_file::Output_file): Initialize map_is_allocated_.
7569         (Output_file::resize): Check map_is_allocated_.
7570         (Output_file::map_anonymous): If mmap fails, use malloc.
7571         (Output_file::unmap): Don't do anything for an anonymous map.
7572         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
7573         is not available, provide stubs.
7574         (File_read::View::~View): Use free rather than delete[].
7575         (File_read::make_view): Use malloc rather than new[].  If mmap
7576         fails, use malloc.
7577         (File_read::find_or_make_view): Use malloc rather than new[].
7578         * gold.h: Remove HAVE_REMAP code.
7579         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
7580         exists.  Rename mremap to gold_mremap.  If mmap is not available
7581         don't do anything.
7582         * configure, config.in: Rebuild.
7583
7584 2011-04-11  Ian Lance Taylor  <iant@google.com>
7585
7586         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
7587         initialize local variable v.
7588
7589 2011-04-11  Cary Coutant  <ccoutant@google.com>
7590
7591         * archive.cc (Archive::include_member): Adjust call to
7592         report_object.
7593         (Add_archive_symbols::run): Track argument serial numbers.
7594         (Lib_group::include_member): Likewise.
7595         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
7596         * archive.h (Incremental_archive_entry::Archive_member):
7597         Initialize arg_serial_.
7598         (Archive_member::arg_serial_): New data member.
7599         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
7600         (Sized_dynobj::do_add_symbols): Track symbols when doing an
7601         incremental link.
7602         (Sized_dynobj::do_for_all_local_got_entries): New function.
7603         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
7604         function.
7605         * fileread.cc (get_mtime): New function.
7606         * fileread.h (get_mtime): New function.
7607         * gold.cc (queue_initial_tasks): Check for incremental update.
7608         (process_incremental_input): New function.
7609         (queue_middle_tasks): Don't force valid target for incremental
7610         update.
7611         * incremental-dump.cc (find_input_containing_global): Adjust
7612         size of symbol info entry.
7613         (dump_incremental_inputs): Dump argument serial number and
7614         in_system_directory flag; bias shndx by 1; print symbol names
7615         when dumping per-file symbol lists; use new symbol info readers.
7616         * incremental.cc
7617         (Output_section_incremental_inputs:update_data_size): New function.
7618         (Sized_incremental_binary::setup_readers): Setup input readers
7619         for each input file; build maps for files added from libraries
7620         and scripts.
7621         (Sized_incremental_binary::check_input_args): New function.
7622         (Sized_incremental_binary::do_check_inputs): Build map of argument
7623         serial numbers to input arguments.
7624         (Sized_incremental_binary::do_file_has_changed): Rename
7625         do_file_is_unchanged to this; compare file modification times.
7626         (Sized_incremental_binary::do_init_layout): New function.
7627         (Sized_incremental_binary::do_reserve_layout): New function.
7628         (Sized_incremental_binary::do_get_input_reader): Remove.
7629         (Sized_incremental_binary::get_symtab_view): New function.
7630         (Incremental_checker::can_incrementally_link_output_file): Remove.
7631         (Incremental_inputs::report_command_line): Exclude --debug options.
7632         (Incremental_inputs::report_archive_begin): Add parameter; track
7633         argument serial numbers; don't put input file entry for archive
7634         before archive members.
7635         (Incremental_inputs::report_archive_end): Put input file entry
7636         for archive after archive members.
7637         (Incremental_inputs::report_object): Add parameter; track argument
7638         serial numbers and in_system_directory flag.
7639         (Incremental_inputs::report_script): Add parameter; track argument
7640         serial numbers.
7641         (Output_section_incremental_inputs::set_final_data_size): Adjust
7642         size of symbol info entry; check for forwarding symbols.
7643         (Output_section_incremental_inputs::write_input_files): Write
7644         in_system_directory flag and argument serial number.
7645         (Output_section_incremental_inputs::write_info_blocks): Map section
7646         indices between incremental info and original input file; store
7647         input section index for each symbol.
7648         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
7649         change operator() to visit().
7650         (class Global_got_offset_visitor): Likewise.
7651         (class Global_symbol_visitor_got_plt):
7652         (Output_section_incremental_inputs::write_got_plt): Use new visitor
7653         classes.
7654         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
7655         (Sized_incr_relobj::do_read_symbols): New function.
7656         (Sized_incr_relobj::do_layout): New function.
7657         (Sized_incr_relobj::do_layout_deferred_sections): New function.
7658         (Sized_incr_relobj::do_add_symbols): New function.
7659         (Sized_incr_relobj::do_should_include_member): New function.
7660         (Sized_incr_relobj::do_for_all_global_symbols): New function.
7661         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
7662         (Sized_incr_relobj::do_section_size): New function.
7663         (Sized_incr_relobj::do_section_name): New function.
7664         (Sized_incr_relobj::do_section_contents): New function.
7665         (Sized_incr_relobj::do_section_flags): New function.
7666         (Sized_incr_relobj::do_section_entsize): New function.
7667         (Sized_incr_relobj::do_section_address): New function.
7668         (Sized_incr_relobj::do_section_type): New function.
7669         (Sized_incr_relobj::do_section_link): New function.
7670         (Sized_incr_relobj::do_section_info): New function.
7671         (Sized_incr_relobj::do_section_addralign): New function.
7672         (Sized_incr_relobj::do_initialize_xindex): New function.
7673         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
7674         (Sized_incr_relobj::do_read_relocs): New function.
7675         (Sized_incr_relobj::do_gc_process_relocs): New function.
7676         (Sized_incr_relobj::do_scan_relocs): New function.
7677         (Sized_incr_relobj::do_count_local_symbols): New function.
7678         (Sized_incr_relobj::do_finalize_local_symbols): New function.
7679         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
7680         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
7681         (Sized_incr_relobj::do_relocate): New function.
7682         (Sized_incr_relobj::do_set_section_offset): New function.
7683         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
7684         (Sized_incr_dynobj::do_read_symbols): New function.
7685         (Sized_incr_dynobj::do_layout): New function.
7686         (Sized_incr_dynobj::do_add_symbols): New function.
7687         (Sized_incr_dynobj::do_should_include_member): New function.
7688         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
7689         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
7690         (Sized_incr_dynobj::do_section_size): New function.
7691         (Sized_incr_dynobj::do_section_name): New function.
7692         (Sized_incr_dynobj::do_section_contents): New function.
7693         (Sized_incr_dynobj::do_section_flags): New function.
7694         (Sized_incr_dynobj::do_section_entsize): New function.
7695         (Sized_incr_dynobj::do_section_address): New function.
7696         (Sized_incr_dynobj::do_section_type): New function.
7697         (Sized_incr_dynobj::do_section_link): New function.
7698         (Sized_incr_dynobj::do_section_info): New function.
7699         (Sized_incr_dynobj::do_section_addralign): New function.
7700         (Sized_incr_dynobj::do_initialize_xindex): New function.
7701         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
7702         (make_sized_incremental_object): New function.
7703         (Incremental_library::copy_unused_symbols): New function.
7704         (Incremental_library::do_for_all_unused_symbols): New function.
7705         * incremental.h (enum Incremental_input_flags): New type.
7706         (class Incremental_checker): Remove.
7707         (Incremental_input_entry::Incremental_input_entry): Add argument
7708         serial number.
7709         (Incremental_input_entry::arg_serial): New function.
7710         (Incremental_input_entry::set_is_in_system_directory): New function.
7711         (Incremental_input_entry::is_in_system_directory): New function.
7712         (Incremental_input_entry::arg_serial_): New data member.
7713         (Incremental_input_entry::is_in_system_directory_): New data member.
7714         (class Script_info): Move here from script.h.
7715         (Script_info::Script_info): Add filename parameter.
7716         (Script_info::filename): New function.
7717         (Script_info::filename_): New data member.
7718         (Incremental_script_entry::Incremental_script_entry): Add argument
7719         serial number.
7720         (Incremental_object_entry::Incremental_object_entry): Likewise.
7721         (Incremental_object_entry::add_input_section): Build list of input
7722         sections with map to original shndx.
7723         (Incremental_object_entry::get_input_section_index): New function.
7724         (Incremental_object_entry::shndx_): New data member.
7725         (Incremental_object_entry::name_key_): Rename; adjust all refs.
7726         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
7727         (Incremental_archive_entry::Incremental_archive_entry): Add argument
7728         serial number.
7729         (Incremental_inputs::report_archive_begin): Likewise.
7730         (Incremental_inputs::report_object): Likewise.
7731         (Incremental_inputs::report_script): Likewise.
7732         (class Incremental_global_symbol_reader): New class.
7733         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
7734         and store flags and input file type.
7735         (Incremental_input_entry_reader::arg_serial): New function.
7736         (Incremental_input_entry_reader::type): Extract type from flags.
7737         (Incremental_input_entry_reader::is_in_system_directory): New function.
7738         (Incremental_input_entry_reader::get_input_section_count): Call
7739         accessor function for type.
7740         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
7741         function for type; adjust size of global symbol entry.
7742         (Incremental_input_entry_reader::get_global_symbol_count): Call
7743         accessor function for type.
7744         (Incremental_input_entry_reader::get_object_count): Likewise.
7745         (Incremental_input_entry_reader::get_object_offset): Likewise.
7746         (Incremental_input_entry_reader::get_member_count): Likewise.
7747         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
7748         (Incremental_input_entry_reader::get_member_offset): Likewise.
7749         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
7750         (Incremental_input_entry_reader::Global_symbol_info): Remove.
7751         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
7752         (Incremental_input_entry_reader::get_global_symbol_reader): New
7753         function.
7754         (Incremental_input_entry_reader::get_output_symbol_index): New
7755         function.
7756         (Incremental_input_entry_reader::type_): Remove.
7757         (Incremental_input_entry_reader::flags_): New data member.
7758         (Incremental_inputs_reader::input_file_offset): New function.
7759         (Incremental_inputs_reader::input_file_index): New function.
7760         (Incremental_inputs_reader::input_file): Call input_file_offset.
7761         (Incremental_inputs_reader::input_file_at_offset): New function.
7762         (Incremental_relocs_reader::get_r_type): Reformat.
7763         (Incremental_relocs_reader::get_r_shndx): Reformat.
7764         (Incremental_relocs_reader::get_r_offset): Reformat.
7765         (Incremental_relocs_reader::data): New function.
7766         (Incremental_binary::Incremental_binary): Initialize new data members.
7767         (Incremental_binary::check_inputs): Add cmdline parameter.
7768         (Incremental_binary::file_is_unchanged): Remove.
7769         (Input_reader::arg_serial): New function.
7770         (Input_reader::get_unused_symbol_count): New function.
7771         (Input_reader::get_unused_symbol): New function.
7772         (Input_reader::do_arg_serial): New function.
7773         (Input_reader::do_get_unused_symbol_count): New function.
7774         (Input_reader::do_get_unused_symbol): New function.
7775         (Incremental_binary::input_file_count): New function.
7776         (Incremental_binary::get_input_reader): Change signature to use
7777         index instead of filename.
7778         (Incremental_binary::file_has_changed): New function.
7779         (Incremental_binary::get_input_argument): New function.
7780         (Incremental_binary::get_library): New function.
7781         (Incremental_binary::get_script_info): New function.
7782         (Incremental_binary::init_layout): New function.
7783         (Incremental_binary::reserve_layout): New function.
7784         (Incremental_binary::output_file): New function.
7785         (Incremental_binary::do_check_inputs): New function.
7786         (Incremental_binary::do_file_is_unchanged): Remove.
7787         (Incremental_binary::do_file_has_changed): New function.
7788         (Incremental_binary::do_init_layout): New function.
7789         (Incremental_binary::do_reserve_layout): New function.
7790         (Incremental_binary::do_input_file_count): New function.
7791         (Incremental_binary::do_get_input_reader): Change signature.
7792         (Incremental_binary::input_args_map_): New data member.
7793         (Incremental_binary::library_map_): New data member.
7794         (Incremental_binary::script_map_): New data member.
7795         (Sized_incremental_binary::Sized_incremental_binary): Initialize
7796         new data members.
7797         (Sized_incremental_binary::output_section): New function.
7798         (Sized_incremental_binary::inputs_reader): Add const.
7799         (Sized_incremental_binary::symtab_reader): Add const.
7800         (Sized_incremental_binary::relocs_reader): Add const.
7801         (Sized_incremental_binary::got_plt_reader): Add const.
7802         (Sized_incremental_binary::get_symtab_view): New function.
7803         (Sized_incremental_binary::Inputs_reader): New typedef.
7804         (Sized_incremental_binary::Input_entry_reader): New typedef.
7805         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
7806         (Sized_incremental_binary::do_file_is_unchanged): Remove.
7807         (Sized_incremental_binary::do_file_has_changed): New function.
7808         (Sized_incremental_binary::do_init_layout): New function.
7809         (Sized_incremental_binary::do_reserve_layout): New function.
7810         (Sized_input_reader::Inputs_reader): Remove.
7811         (Sized_input_reader::Input_entry_reader): Remove.
7812         (Sized_input_reader::do_arg_serial): New function.
7813         (Sized_input_reader::do_get_unused_symbol_count): New function.
7814         (Sized_input_reader::do_get_unused_symbol): New function.
7815         (Sized_incremental_binary::do_input_file_count): New function.
7816         (Sized_incremental_binary::do_get_input_reader): Change signature;
7817         use index instead of filename.
7818         (Sized_incremental_binary::section_map_): New data member.
7819         (Sized_incremental_binary::input_entry_readers_): New data member.
7820         (class Sized_incr_relobj): New class.
7821         (class Sized_incr_dynobj): New class.
7822         (make_sized_incremental_object): New function.
7823         (class Incremental_library): New class.
7824         * layout.cc (Free_list::num_lists): New static data member.
7825         (Free_list::num_nodes): New static data member.
7826         (Free_list::num_removes): New static data member.
7827         (Free_list::num_remove_visits): New static data member.
7828         (Free_list::num_allocates): New static data member.
7829         (Free_list::num_allocate_visits): New static data member.
7830         (Free_list::init): New function.
7831         (Free_list::remove): New function.
7832         (Free_list::allocate): New function.
7833         (Free_list::dump): New function.
7834         (Free_list::print_stats): New function.
7835         (Layout_task_runner::run): Resize output file for incremental updates.
7836         (Layout::Layout): Initialize new data members.
7837         (Layout::set_incremental_base): New function.
7838         (Layout::init_fixed_output_section): New function.
7839         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
7840         incremental updates.
7841         (Layout::create_gold_note): Do not create gold note section for
7842         incremental updates.
7843         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
7844         for incremental updates.
7845         (Layout::set_section_offsets): For incremental updates, allocate space
7846         from free list.
7847         (Layout::create_symtab_sections): Layout with offsets relative to
7848         start of section; for incremental updates, allocate space from free
7849         list.
7850         (Layout::create_shdrs): For incremental updates, allocate space from
7851         free list.
7852         (Layout::finish_dynamic_section): For incremental updates, do not
7853         check --as-needed (fixed in subsequent patch).
7854         * layout.h (class Free_list): New class.
7855         (Layout::set_incremental_base): New function.
7856         (Layout::incremental_base): New function.
7857         (Layout::init_fixed_output_section): New function.
7858         (Layout::allocate): New function.
7859         (Layout::incremental_base_): New data member.
7860         (Layout::free_list_): New data member.
7861         * main.cc (main): Print Free_list statistics.
7862         * object.cc (Relobj::finalize_incremental_relocs): Add
7863         clear_counts parameter; clear counts only when clear_counts is set.
7864         (Sized_relobj::Sized_relobj): Initialize new base class.
7865         (Sized_relobj::do_layout): Don't report special sections.
7866         (Sized_relobj::do_for_all_local_got_entries): New function.
7867         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
7868         symtab_off to all symbol table offsets.
7869         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
7870         * object.h (class Got_offset_list): Move to top of file.
7871         (Object::Object): Allow case where input_file == NULL.
7872         (Object::~Object): Likewise.
7873         (Object::input_file): Assert that input_file != NULL.
7874         (Object::lock): Allow case where input_file == NULL.
7875         (Object::unlock): Likewise.
7876         (Object::is_locked): Likewise.
7877         (Object::token): Likewise.
7878         (Object::release): Likewise.
7879         (Object::is_incremental): New function.
7880         (Object::get_mtime): New function.
7881         (Object::for_all_local_got_entries): New function.
7882         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
7883         (Object::set_is_in_system_directory): New function.
7884         (Object::is_in_system_directory): New function.
7885         (Object::do_is_incremental): New function.
7886         (Object::do_get_mtime): New function.
7887         (Object::do_for_all_local_got_entries): New function.
7888         (Object::is_in_system_directory_): New data member.
7889         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
7890         (class Sized_relobj_base): New class.
7891         (class Sized_relobj): Derive from Sized_relobj_base.
7892         (class Sized_relobj::Symbols): Redeclare from base class.
7893         (class Sized_relobj::local_got_offset_list): Remove.
7894         (class Sized_relobj::Output_sections): Redeclare from base class.
7895         (class Sized_relobj::do_for_all_local_got_entries): New function.
7896         (class Sized_relobj::write_local_symbols): Add offset parameter.
7897         (class Sized_relobj::local_symbol_offset_): Update comment.
7898         (class Sized_relobj::local_dynsym_offset_): Update comment.
7899         * options.cc (Input_arguments::add_file): Remove const.
7900         * options.h (Input_file_argument::Input_file_argument):
7901         Initialize arg_serial_ (all constructors).
7902         (Input_file_argument::set_arg_serial): New function.
7903         (Input_file_argument::arg_serial): New function.
7904         (Input_file_argument::arg_serial_): New data member.
7905         (Input_arguments::Input_arguments): Initialize file_count_.
7906         (Input_arguments::add_file): Remove const.
7907         (Input_arguments::number_of_input_files): New function.
7908         (Input_arguments::file_count_): New data member.
7909         (Command_line::number_of_input_files): Call
7910         Input_arguments::number_of_input_files.
7911         * output.cc (Output_segment_headers::Output_segment_headers):
7912         Set current size.
7913         (Output_section::Input_section::current_data_size): New function.
7914         (Output_section::Output_section): Initialize new data members.
7915         (Output_section::add_input_section): Don't do merge sections for
7916         an incremental link; allocate space from free list for an
7917         incremental update.
7918         (Output_section::add_output_section_data): Allocate space from
7919         free list for an incremental update.
7920         (Output_section::update_data_size): New function.
7921         (Output_section::set_fixed_layout): New function.
7922         (Output_section::reserve): New function.
7923         (Output_segment::set_section_addresses): Remove const.
7924         (Output_segment::set_section_list_addresses): Remove const; allocate
7925         space from free list for an incremental update.
7926         (Output_segment::set_offset): Adjust size of RELRO segment for an
7927         incremental update.
7928         * output.h (Output_data::current_data_size): Move here from
7929         child classes.
7930         (Output_data::pre_finalize_data_size): New function.
7931         (Output_data::update_data_size): New function.
7932         (Output_section_headers::update_data_size): new function.
7933         (Output_section_data_build::current_data_size): Move to Output_data.
7934         (Output_data_strtab::update_data_size): New function.
7935         (Output_section::current_data_size): Move to Output_data.
7936         (Output_section::set_fixed_layout): New function.
7937         (Output_section::has_fixed_layout): New function.
7938         (Output_section::reserve): New function.
7939         (Output_section::update_data_size): New function.
7940         (Output_section::has_fixed_layout_): New data member.
7941         (Output_section::free_list_): New data member.
7942         (Output_segment::set_section_addresses): Remove const.
7943         (Output_segment::set_section_list_addresses): Remove const.
7944         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
7945         New function.
7946         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
7947         New function.
7948         * readsyms.cc (Read_symbols::do_read_symbols): Add library
7949         parameter when calling Add_symbols constructor; store argument
7950         serial number for members of a lib group.
7951         (Add_symbols::locks): Allow case where token == NULL.
7952         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
7953         (Read_member::~Read_member): New function.
7954         (Read_member::is_runnable): New function.
7955         (Read_member::locks): New function.
7956         (Read_member::run): New function.
7957         (Check_script::~Check_script): New function.
7958         (Check_script::is_runnable): New function.
7959         (Check_script::locks): New function.
7960         (Check_script::run): New function.
7961         (Check_library::~Check_library): New function.
7962         (Check_library::is_runnable): New function.
7963         (Check_library::locks): New function.
7964         (Check_library::run): New function.
7965         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
7966         (Add_symbols::library_): New data member.
7967         (class Read_member): New class.
7968         (class Check_script): New class.
7969         (class Check_library): New class.
7970         * reloc.cc (Read_relocs::is_runnable): Allow case where
7971         token == NULL.
7972         (Read_relocs::locks): Likewise.
7973         (Scan_relocs::locks): Likewise.
7974         (Relocate_task::locks): Likewise.
7975         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
7976         to clear counters.
7977         (Sized_relobj::incremental_relocs_scan): Fix comment.
7978         (Sized_relobj::do_relocate): Pass output file offset to
7979         write_local_symbols.
7980         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
7981         from class declaration.
7982         * script.cc (read_input_script): Allocate Script_info; pass
7983         argument serial number to report_script.
7984         * script.h (class Script_info): Move to incremental.h.
7985         * symtab.cc (Symbol_table::add_from_incrobj): New function.
7986         * symtab.h (Symbol_table::add_from_incrobj): New function.
7987         (Symbol_table::set_file_offset): New function.
7988
7989 2011-04-05  Cary Coutant  <ccoutant@google.com>
7990
7991         * incremental-dump.cc (dump_incremental_inputs): Change signature
7992         to take a Sized_incremental_binary; change caller.  Use readers
7993         in Sized_incremental_binary.
7994         * incremental.cc
7995         (Sized_incremental_binary::find_incremental_inputs_sections):
7996         Rename do_find_incremental_inputs_sections to this.
7997         (Sized_incremental_binary::setup_readers): New function.
7998         (Sized_incremental_binary::do_check_inputs): Check
7999         has_incremental_info_ flag; move setup code to setup_readers;
8000         use input readers.
8001         (Sized_incremental_binary::do_file_is_unchanged): New function.
8002         (Sized_incremental_binary::do_get_input_reader): New function.
8003         * incremental.h (class Incremental_binary): Move to end of file.
8004         (Incremental_binary::file_is_unchanged): New function.
8005         (Incremental_binary::do_file_is_unchanged): New function.
8006         (Incremental_binary::Input_reader): New class.
8007         (Incremental_binary::get_input_reader): New function.
8008         (class Sized_incremental_binary): Move to end of file.
8009         (Sized_incremental_binary::Sized_incremental_binary): Setup the
8010         input section reader classes.
8011         (Sized_incremental_binary::has_incremental_info): New function.
8012         (Sized_incremental_binary::inputs_reader): New function.
8013         (Sized_incremental_binary::symtab_reader): New function.
8014         (Sized_incremental_binary::relocs_reader): New function.
8015         (Sized_incremental_binary::got_plt_reader): New function.
8016         (Sized_incremental_binary::do_file_is_unchanged): New function.
8017         (Sized_incremental_binary::Sized_input_reader): New class.
8018         (Sized_incremental_binary::get_input_reader): New function.
8019         (Sized_incremental_binary::find_incremental_inputs_sections):
8020         Rename do_find_incremental_inputs_sections to this.
8021         (Sized_incremental_binary::setup_readers): New function.
8022         (Sized_incremental_binary::has_incremental_info_): New data member.
8023         (Sized_incremental_binary::inputs_reader_): New data member.
8024         (Sized_incremental_binary::symtab_reader_): New data member.
8025         (Sized_incremental_binary::relocs_reader_): New data member.
8026         (Sized_incremental_binary::got_plt_reader_): New data member.
8027         (Sized_incremental_binary::current_input_file_): New data member.
8028
8029 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
8030
8031         PR gold/12640
8032         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
8033         violation.
8034
8035 2011-03-30  Cary Coutant  <ccoutant@google.com>
8036
8037         * archive.cc (Archive::include_member): Adjust call to report_object.
8038         (Add_archive_symbols::run): Add script_info to call to
8039         report_archive_begin.
8040         (Lib_group::include_member): Adjust call to report_object.
8041         (Add_lib_group_symbols::run): Adjust call to report_object.
8042         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
8043         blocks.  Add object count for script input files.
8044         * incremental.cc (Incremental_inputs::report_archive_begin): Add
8045         script_info parameter; change all callers.
8046         (Incremental_inputs::report_object): Add script_info parameter;
8047         change all callers.
8048         (Incremental_inputs::report_script): Store backpointer to
8049         incremental info entry.
8050         (Output_section_incremental_inputs::set_final_data_size): Record
8051         additional information for scripts.
8052         (Output_section_incremental_inputs::write_info_blocks): Likewise.
8053         * incremental.h (Incremental_script_entry::add_object): New function.
8054         (Incremental_script_entry::get_object_count): New function.
8055         (Incremental_script_entry::get_object): New function.
8056         (Incremental_script_entry::objects_): New data member; adjust
8057         constructor.
8058         (Incremental_inputs::report_archive_begin): Add script_info parameter.
8059         (Incremental_inputs::report_object): Add script_info parameter.
8060         (Incremental_inputs_reader::get_object_count): New function.
8061         (Incremental_inputs_reader::get_object_offset): New function.
8062         * options.cc (Input_arguments::add_file): Return reference to
8063         new input argument.
8064         * options.h (Input_argument::set_script_info): New function.
8065         (Input_argument::script_info): New function.
8066         (Input_argument::script_info_): New data member; adjust all
8067         constructors.
8068         (Input_file_group::add_file): Return reference to new input argument.
8069         (Input_file_lib::add_file): Likewise.
8070         (Input_arguments::add_file): Likewise.
8071         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
8072         * script.cc (Parser_closure::Parser_closure): Add script_info
8073         parameter; adjust all callers.
8074         (Parser_closure::script_info): New function.
8075         (Parser_closure::script_info_): New data member.
8076         (read_input_script): Report scripts earlier to incremental info.
8077         (script_add_file): Set script_info in Input_argument.
8078         (script_add_library): Likewise.
8079         * script.h (Script_options::Script_info): Rewrite class.
8080
8081 2011-03-29  Cary Coutant  <ccoutant@google.com>
8082
8083         * archive.cc (Library_base::should_include_member): Move
8084         method here from class Archive.
8085         (Archive::Archive): Initialize base class.
8086         (Archive::should_include_member): Move to base class.
8087         (Archive::do_for_all_unused_symbols): New function.
8088         (Add_archive_symbols::run): Remove redundant access to
8089         incremental_inputs.
8090         (Lib_group::Lib_group): Initialize base class.
8091         (Lib_group::do_filename): New function.
8092         (Lib_group::include_member): Pass pointer to Lib_group to
8093         report_object.
8094         (Lib_group::do_for_all_unused_symbols): New function.
8095         (Add_lib_group_symbols::run): Report archive information for
8096         incremental links.
8097         * archive.h (class Library_base): New base class.
8098         (class Archive): Derive from Library_base.
8099         (Archive::filename): Move to base class.
8100         (Archive::set_incremental_info): Likewise.
8101         (Archive::incremental_info): Likewise.
8102         (Archive::Should_include): Likewise.
8103         (Archive::should_include_member): Likewise.
8104         (Archive::Armap_entry): Remove.
8105         (Archive::Unused_symbol_iterator): Remove.
8106         (Archive::unused_symbols_begin): Remove.
8107         (Archive::unused_symbols_end): Remove.
8108         (Archive::do_filename): New function.
8109         (Archive::do_get_mtime): New function.
8110         (Archive::do_for_all_unused_symbols): New function.
8111         (Archive::task_): Move to base class.
8112         (Archive::incremental_info_): Likewise.
8113         (class Lib_group): Derive from Library_base.
8114         (Lib_group::do_filename): New function.
8115         (Lib_group::do_get_mtime): New function.
8116         (Lib_group::do_for_all_unused_symbols): New function.
8117         (Lib_group::task_): Move to base class.
8118         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
8119         function.
8120         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
8121         function.
8122         * incremental.cc (Incremental_inputs::report_archive_begin):
8123         Use Library_base; call library's get_mtime; add incremental inputs
8124         entry before members.
8125         (class Unused_symbol_visitor): New class.
8126         (Incremental_inputs::report_archive_end): Use Library_base; use
8127         visitor class to record unused symbols; don't add incremental inputs
8128         entry after members.
8129         (Incremental_inputs::report_object): Use Library_base.
8130         * incremental.h
8131         (Incremental_archive_entry::Incremental_archive_entry): Remove
8132         unused Archive parameter.
8133         (Incremental_inputs::report_archive_begin): Use Library_base.
8134         (Incremental_inputs::report_archive_end): Likewise.
8135         (Incremental_inputs::report_object): Likewise.
8136         * object.cc (Sized_relobj::do_for_all_global_symbols): New
8137         function.
8138         * object.h (Object::for_all_global_symbols): New function.
8139         (Object::do_for_all_global_symbols): New function.
8140         (Sized_relobj::do_for_all_global_symbols): New function.
8141         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
8142         function.
8143         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
8144         function.
8145
8146 2011-03-27  Ian Lance Taylor  <iant@google.com>
8147
8148         * archive.cc (Archive::interpret_header): Return -1 if something
8149         goes wrong.  Change callers accordingly.
8150
8151 2011-03-25  Cary Coutant  <ccoutant@google.com>
8152
8153         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
8154         * testsuite/Makefile.in: Regenerate.
8155
8156 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
8157
8158         * plugin.cc (get_view): New.
8159         (Plugin::load): Pass get_view to the plugin.
8160         (Plugin_manager::get_view): New.
8161
8162 2011-03-21  Ian Lance Taylor  <iant@google.com>
8163
8164         * testsuite/final_layout.sh: Rewrite to not use dc.
8165         * testsuite/relro_test.sh: Fail if dc is not present.
8166
8167 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
8168
8169         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
8170         Change == to -eq.
8171         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
8172         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
8173         Change == to -eq.
8174         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
8175         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
8176
8177 2011-03-14  Ian Lance Taylor  <iant@google.com>
8178
8179         * script-sections.cc (Sort_output_sections::script_compare):
8180         Rename from is_before, change return type.
8181         (Sort_output_sections::operator()): Adjust accordingly.
8182
8183 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
8184
8185         PR gold/12572
8186         * testsuite/odr_violation2.cc: Add comment to make all error line
8187         numbers double digits.
8188         * testsuite/debug_msg.sh: Adjust expected errors.
8189
8190 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
8191
8192         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
8193         but mark earlier ones as non-canonical
8194         (offset_to_iterator): Update search target and example
8195         (do_addr2line): Return extra lines in a vector*
8196         (format_file_lineno): Extract from do_addr2line
8197         (one_addr2line): Add vector* out-param
8198         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
8199         when a lineno entry appeared last for its instruction
8200         (Dwarf_line_info): Add vector* out-param
8201         * object.cc (Relocate_info): Pass NULL for the vector* out-param
8202         * symtab.cc (Odr_violation_compare): Include the lineno in the
8203         comparison again.
8204         (linenos_from_loc): New. Combine the canonical line for an
8205         address with its other lines.
8206         (True_if_intersect): New. Helper functor to make
8207         std::set_intersection a query.
8208         (detect_odr_violations): Compare sets of lines instead of just
8209         one line for each function. This became less deterministic, but
8210         has fewer false positives.
8211         * symtab.h: Declarations.
8212         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
8213         mix an optimized and non-optimized object in the same binary
8214         (odr_violation2.so): Same.
8215         * testsuite/Makefile.in: Regenerate from Makefile.am.
8216         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
8217         * testsuite/debug_msg.sh: Update line numbers and add
8218         assertions.
8219         * testsuite/odr_violation1.cc: Use OdrDerived, in a
8220         non-optimized context.
8221         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
8222         isn't inlined, and use OdrDerived in an optimized context.
8223         * testsuite/odr_header1.h: Defines OdrDerived, where
8224         optimization will change the
8225         first-instruction-in-the-destructor's file and line number.
8226         * testsuite/odr_header2.h: Defines OdrBase.
8227
8228 2011-03-09  Ian Lance Taylor  <iant@google.com>
8229
8230         * fileread.cc (File_read::clear_views): Don't delete the whole
8231         file view.
8232
8233 2011-03-08  Ian Lance Taylor  <iant@google.com>
8234
8235         PR gold/12525
8236         * fileread.cc: #include <climits>.
8237         (GOLD_IOV_MAX): Define.
8238         (File_read::read_multiple): Limit number of entries by iov_max.
8239         * fileread.h (class File_read): Always set max_readv_entries to
8240         128.
8241
8242 2011-03-07  Ian Lance Taylor  <iant@google.com>
8243
8244         PR gold/12525
8245         * options.h (class General_options): Add -dy and -dn.
8246
8247 2011-03-02  Cary Coutant  <ccoutant@google.com>
8248
8249         * testsuite/script_test_9.t: Add TLS segment.
8250
8251 2011-03-02  Simon Baldwin  <simonb@google.com>
8252
8253         * configure.ac: Add check for gnu_indirect_function support in
8254         the toolchain building binutils.
8255         * configure: Rebuild.
8256
8257 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
8258
8259         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
8260         plugin only symbols.
8261         (Symbol_table::sized_finalize_symbol) Mark symbol only present
8262         in plugin files as not needed in the symbol table.
8263
8264 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
8265
8266         * output.cc (Output_section::add_input_section): Delay fill
8267         generation for section ordering.
8268
8269 2011-02-09  Ian Lance Taylor  <iant@google.com>
8270
8271         PR gold/12316
8272         * object.h (class Sized_relobj): Remove clear_local_symbols.
8273         * reloc.cc (Sized_relobj::do_relocate): Don't call
8274         clear_local_symbols.
8275
8276 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
8277
8278         * plugin.cc (is_visible_from_outside): Return true for symbols
8279         in the -u option.
8280
8281 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
8282
8283         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
8284         filename.
8285
8286 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
8287
8288         * icf.h (is_section_foldable_candidate): Change type of parameter
8289         to std::string.
8290         * icf.cc (Icf::find_identical_sections): Change type of local variable
8291         section_name to be std::string.
8292         (is_function_ctor_or_dtor): Change type of parameter to std::string.
8293
8294 2011-01-25  Ian Lance Taylor  <iant@google.com>
8295
8296         * script.cc (script_add_extern): Rewrite to use
8297         add_symbol_reference.
8298
8299 2011-01-25  Doug Kwan  <dougkwan@google.com>
8300
8301         * icf.cc (get_section_contents): Always lock section's object.
8302
8303 2011-01-24  Ian Lance Taylor  <iant@google.com>
8304
8305         * options.h (class General_options): Accept
8306         --no-detect-odr-violations.
8307
8308 2011-01-24  Ian Lance Taylor  <iant@google.com>
8309
8310         * version.cc (version_string): Bump to 1.11.
8311
8312 2011-01-24  Ian Lance Taylor  <iant@google.com>
8313
8314         * plugin.cc (class Plugin_rescan): Define new class.
8315         (Plugin_manager::claim_file): Set any_claimed_.
8316         (Plugin_manager::save_archive): New function.
8317         (Plugin_manager::save_input_group): New function.
8318         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
8319         necessary.
8320         (Plugin_manager::new_undefined_symbol): New function.
8321         (Plugin_manager::rescan): New function.
8322         (Plugin_manager::rescannable_defines): New function.
8323         (Plugin_manager::add_input_file): Set any_added_.
8324         * plugin.h (class Plugin_manager): define new fields rescannable_,
8325         undefined_symbols_, any_claimed_, and any_added_.  Declare
8326         Plugin_rescan as friend.  Declare new functions.
8327         (Plugin_manager::Rescannable): Define type.
8328         (Plugin_manager::Rescannable_list): Define type.
8329         (Plugin_manager::Undefined_symbol_list): Define type.
8330         (Plugin_manager::Plugin_manager): Initialize new fields.
8331         * archive.cc (Archive::defines_symbol): New function.
8332         (Add_archive_symbols::run): Pass archive to plugins if any.
8333         * archive.h (class Archive): Declare defines_symbol.
8334         * readsyms.cc (Input_group::~Input_group): New function.
8335         (Finish_group::run): Pass input_group to plugins if any.
8336         * readsyms.h (class Input_group): Declare destructor.
8337         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
8338         any.
8339
8340 2011-01-10  Ian Lance Taylor  <iant@google.com>
8341
8342         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
8343         section as relro.
8344         (Layout::set_segment_offsets): Reset increase_relro before calling
8345         set_section_addresses a second time.
8346
8347 2011-01-04  Cary Coutant  <ccoutant@google.com>
8348
8349         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
8350         sections before NOBITS sections.
8351
8352 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
8353
8354         * version.cc (print_version): Update copyright to 2011.
8355
8356 2010-12-23  Cary Coutant  <ccoutant@google.com>
8357
8358         * output.h (Output_data_reloc::add_output_section): Pass OD instead
8359         of OS to this->add.  Add OD parameter to second form of the function.
8360
8361 2010-12-20  Ian Lance Taylor  <iant@google.com>
8362
8363         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
8364         second of two consecutive entries with same offset.
8365
8366 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8367
8368         * testsuite/Makefile.am (ifuncmain2static_LDADD)
8369         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
8370         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
8371         to avoid unneeded links against $(LDADD).
8372         * testsuite/Makefile.in: Regenerate.
8373
8374 2010-12-15  Ian Lance Taylor  <iant@google.com>
8375
8376         PR gold/12324
8377         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
8378         for R_X86_64_32 and R_X86_64_PC32.
8379         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
8380         ver_matching_def_pic.o.
8381         (ver_matching_def_pic.o): New target.
8382
8383 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8384
8385         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
8386         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
8387         Move definition before File_read::View member definitions.
8388         (File_read::View::~View): Initialize and hold lock before
8389         updating current_mapped_bytes.
8390
8391 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8392
8393         * dwarf_reader.cc: Remove outdated comment.
8394         * gold-threads.cc: Fix typo in error message.
8395         * archive.cc: Fix typos in comments.
8396         * archive.h: Likewise.
8397         * arm-reloc-property.cc: Likewise.
8398         * arm-reloc-property.h: Likewise.
8399         * arm-reloc.def: Likewise.
8400         * arm.cc: Likewise.
8401         * attributes.h: Likewise.
8402         * cref.cc: Likewise.
8403         * ehframe.cc: Likewise.
8404         * fileread.h: Likewise.
8405         * gold.h: Likewise.
8406         * i386.cc: Likewise.
8407         * icf.cc: Likewise.
8408         * incremental.h: Likewise.
8409         * int_encoding.cc: Likewise.
8410         * layout.h: Likewise.
8411         * main.cc: Likewise.
8412         * merge.h: Likewise.
8413         * object.cc: Likewise.
8414         * object.h: Likewise.
8415         * options.cc: Likewise.
8416         * readsyms.cc: Likewise.
8417         * reduced_debug_output.cc: Likewise.
8418         * reloc.cc: Likewise.
8419         * script-sections.cc: Likewise.
8420         * sparc.cc: Likewise.
8421         * symtab.h: Likewise.
8422         * target-reloc.h: Likewise.
8423         * target.cc: Likewise.
8424         * target.h: Likewise.
8425         * timer.cc: Likewise.
8426         * timer.h: Likewise.
8427         * x86_64.cc: Likewise.
8428
8429 2010-12-09  Cary Coutant  <ccoutant@google.com>
8430
8431         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
8432         stack.
8433         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
8434         parameter; change all callers.
8435         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
8436         * options.h (warn_execstack): New option.
8437
8438 2010-12-07  Doug Kwan  <dougkwan@google.com>
8439
8440         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
8441         like function call relocations.
8442
8443 2010-12-07  Ian Lance Taylor  <iant@google.com>
8444
8445         * archive.cc (Archive::get_elf_object_for_member): Permit
8446         punconfigured to be NULL.
8447         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
8448         (Archive::include_member): Pass NULL to get_elf_object_for_member
8449         if we searched for the archive and this is the first included
8450         object.
8451
8452 2010-12-01  Ian Lance Taylor  <iant@google.com>
8453
8454         * dwarf_reader.h (class Sized_dwarf_line_info): Add
8455         track_relocs_type_ field.
8456         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8457         Set track_relocs_type_.
8458         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
8459         contents when using RELA relocs.
8460         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
8461         reloc_map_.
8462         * reloc.cc (Track_relocs::next_addend): New function.
8463         * reloc.h (class Track_relocs): Declare next_addend.
8464
8465 2010-12-01  Ian Lance Taylor  <iant@google.com>
8466
8467         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
8468         virtual destructor.
8469
8470 2010-12-01  Ian Lance Taylor  <iant@google.com>
8471
8472         * README: Update compilers known to work and fail.
8473
8474 2010-11-23  Matthias Klose  <doko@ubuntu.com>
8475
8476         * configure.in: For --enable-gold, handle value `default' instead of
8477         `both*'.  Always install ld as ld.bfd, install as ld if gold is
8478         not the default.
8479         * configure: Regenerate.
8480
8481 2010-11-18  Doug Kwan  <dougkwan@google.com>
8482
8483         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
8484         and right_alignment to be zero.  Store result alignment only if it is
8485         greater than existing alignment.
8486
8487 2010-11-16  Cary Coutant  <ccoutant@google.com>
8488
8489         PR gold/12220
8490         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8491         Check for ".zdebug_line".
8492
8493 2010-11-16  Doug Kwan  <dougkwan@google.com>
8494             Cary Coutant  <ccoutant@google.com>
8495
8496         * output.h (Output_segment::set_section_addresses): Pass increase_relro
8497         by reference; adjust all callers.
8498         * output.cc (Output_segment::set_section_addresses): Adjust references
8499         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
8500         list is empty.
8501         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
8502         end at page boundary.
8503
8504 2010-11-16  Cary Coutant  <ccoutant@google.com>
8505
8506         PR gold/12220
8507         * layout.cc (Layout::choose_output_section): Transform names of
8508         compressed sections even when using a script with a SECTIONS clause.
8509         (Layout::output_section_name): Remove code to transform
8510         compressed debug section names.
8511         * output.cc (Output_section::add_input_section): Use uncompressed
8512         section size when tracking input sections.
8513
8514 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
8515
8516         * symtab.h (Symbol::NON_PIC_REF): Remove.
8517         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
8518         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
8519         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
8520         (Symbol::use_plt_offset): Take a flags argument and pass it
8521         directly to needs_dynamic_reloc.  Restrict check for undefined
8522         weak symbols to function calls.
8523         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
8524         (Target_arm::Scan::global): Use it.
8525         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
8526         (Target_arm::Relocate::relocate): Likewise.
8527         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
8528         parameter with an r_type parameter.  Use get_reference_flags
8529         to get the flags.
8530         (Target_arm::Relocate::relocate): Update accordingly.
8531         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
8532         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
8533         (Target_i386::Scan::global): Likewise.
8534         (Target_i386::Relocate::relocate): Likewise.
8535         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
8536         parameter with an r_type parameter.  Use get_reference_flags
8537         to get the flags.
8538         (Target_i386::Relocate::relocate): Update accordingly.
8539         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
8540         (Target_powerpc::Scan::global): Use it.
8541         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
8542         (Target_powerpc::Relocate::relocate): Likewise.
8543         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
8544         (Target_sparc::Scan::global): Use it.
8545         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
8546         (Target_sparc::Relocate::relocate): Likewise.
8547         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
8548         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
8549         (Target_x86_64::Scan::global): Likewise.
8550         (Target_x86_64::Relocate::relocate): Likewise.
8551
8552 2010-11-08  Doug Kwan  <dougkwan@google.com>
8553             Cary Coutant  <ccoutant@google.com>
8554
8555         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
8556         (Arm_exidx_merge_section::section_contents_): New data member.
8557         (Arm_input_section::Arm_input_section): Initialize original_contents_.
8558         (Arm_input_section::~Arm_input_section): De-allocate memory.
8559         (Arm_input_section::original_contents_): New data member.
8560         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
8561         in parameters instead of calling Object::section_contents without
8562         locking.
8563         (Arm_output_section::group_section): New parameter TASK.  Pass it
8564         to callees that need locking objects.
8565         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
8566         to lock EXIDX input sections.  Fix a formatting issue.  Call
8567         Arm_exidx_merged_section::build_contents to create merged section
8568         contents.
8569         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
8570         to lock object of stub table owner.
8571         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
8572         TEXT_SIZE to initialize data member TEXT_SIZE_.
8573         (Arm_exidx_input_section::addralign): Fix typo in comment.
8574         (Arm_exidx_input_section::text_size): New method.
8575         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
8576         that require locking objects.  Lock objects before scanning for stubs
8577         and updating local symbols.
8578         (Arm_input_section<big_endian>::init): Copy contents of original
8579         input section.
8580         (Arm_input_section<big_endian>::do_write): Use saved contents of
8581         original input section instead of calling Object::section_contents
8582         without locking.
8583         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
8584         size without calling Object::section_size().
8585         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
8586         for size.  Allocate a buffer for merged EXIDX entries.
8587         (Arm_exidx_merged_section::build_contents): New method.
8588         (Arm_exidx_merged_section::do_write): Move merge section contents
8589         building code to Arm_exidx_merged_section::build_contetns.  Write
8590         out contetns in buffer instead of building it on the fly.
8591         (Arm_relobj::make_exidx_input_section): Also pass text section size
8592         to Arm_exidx_input_section constructor.
8593         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
8594         (Arm_dynobj::do_read_symbols): Fix memory leak.
8595         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
8596         * target.h: (class Task): Add forward declaration.
8597         (Target::relax): Add new parameter TASK and pass it to
8598         Target::do_relax().
8599         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
8600
8601 2010-11-05  Cary Coutant  <ccoutant@google.com>
8602
8603         PR gold/10708
8604         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
8605         object when reading from the file.
8606         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
8607         second layout pass.
8608         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
8609         when reading section contents.
8610         (get_section_contents): Likewise.
8611         (icf::find_identical_sections): Likewise.
8612         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
8613         object when reading from the file.
8614         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
8615         the object when doing deferred section layout.
8616
8617 2010-11-03  Nick Clifton  <nickc@redhat.com>
8618
8619         PR gold/12001
8620         * script.h (class Symbol_assignment: name): New member.  Returns
8621         the name of the symbol.
8622         * scrfipt.cc (Script_options::is_pending_assignment): New member.
8623         Returns true if the given symbol name is on the list of
8624         assignments wating to be processed.
8625         * archive.cc (should_incldue_member): If the symbol is undefined,
8626         check to see if it is on the list of symbols pending assignment.
8627
8628 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
8629
8630         * script-sections.cc (Script_sections::find_memory_region): Check
8631         for a NULL output section pointer.
8632
8633 2010-10-29  Doug Kwan  <dougkwan@google.com>
8634
8635         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
8636         Output_section::add_relaxed_input_section.
8637         * output.cc (Output_section::add_relaxed_input_section): Add new
8638         arguments LAYOUT and NAME.  Set section order index.
8639         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8640         Copy section order index.
8641         * output.h (Output_section::add_relaxed_input_section): Add new
8642         arguments LAYOUT and NAME.
8643
8644 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8645
8646         * testsuite/Makefile.am: Move gcctestdir/ld rule to
8647         NATIVE_OR_CROSS_LINKER.
8648         * testsuite/Makefile.in: Regenerate.
8649
8650 2010-10-20  Doug Kwan  <dougkwan@google.com>
8651
8652         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
8653         without SHF_LINK_ORDER flags.
8654         * layout.cc (Layout::choose_output_section): Do not filter
8655         SHF_LINK_ORDER flag in a relocatable link.
8656
8657 2010-10-17  Cary Coutant  <ccoutant@google.com>
8658
8659         * output.h (Output_segment::set_section_addresses): Change function
8660         signature.  Update all callers.
8661         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
8662         sections.
8663         (Output_segment::set_section_addresses): Align after last TLS
8664         section.  Add padding before last relro section instead of after.
8665
8666 2010-10-17  Doug Kwan  <dougkwan@google.com>
8667
8668         * gold/arm.cc (Target_arm::got_section): Use correct order and set
8669         GOT output section to be writable.
8670
8671 2010-10-14  Cary Coutant  <ccoutant@google.com>
8672
8673         * debug.h (DEBUG_INCREMENTAL): New flag.
8674         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
8675         * gold.cc (queue_initial_tasks): Check parameters for incremental link
8676         mode.
8677         * incremental.cc (report_command_line): Ignore all forms of
8678         --incremental.
8679         * layout.cc (Layout::Layout): Check parameters for incremental link
8680         mode.
8681         * options.cc (General_options::parse_incremental): New function.
8682         (General_options::parse_no_incremental): New function.
8683         (General_options::parse_incremental_full): New function.
8684         (General_options::parse_incremental_update): New function.
8685         (General_options::incremental_mode_): New data member.
8686         (General_options::finalize): Check incremental_mode_.
8687         * options.h (General_options): Update help text for --incremental.
8688         Add --no-incremental, --incremental-full, --incremental-update.
8689         (General_options::Incremental_mode): New enum type.
8690         (General_options::incremental_mode): New function.
8691         (General_options::incremental_mode_): New data member.
8692         * parameters.cc (Parameters::incremental_mode_): New data member.
8693         (Parameters::set_options): Set incremental_mode_.
8694         (Parameters::set_incremental_full): New function.
8695         (Parameters::incremental): New function.
8696         (Parameters::incremental_update): New function.
8697         (set_parameters_incremental_full): New function.
8698         * parameters.h (Parameters::set_incremental_full): New function.
8699         (Parameters::incremental): New function.
8700         (Parameters::incremental_update): New function.
8701         (Parameters::incremental_mode_): New data member.
8702         (set_parameters_incremental_full): New function.
8703         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
8704         incremental link mode.
8705         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
8706         (Sized_relobj::do_relocate_sections): Likewise.
8707         * testsuite/Makefile.am (incremental_test): Use --incremental-full
8708         option.
8709         * testsuite/Makefile.in: Regenerate.
8710         * testsuite/incremental_test.sh: Filter all forms of --incremental.
8711
8712 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8713
8714         * script-sections.h (class Script_sections): Make
8715         Sections_elements typedef public.
8716         * script-sections.cc (class Sort_output_sections): Add elements_
8717         field.  Add constructor which sets it; change all callers.
8718         (Sort_output_sections::is_before): New function.
8719         (Sort_output_sections::operator()): Call is_before.
8720         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
8721         conditional.
8722         * testsuite/script_test_10.sh: New test. Test script section
8723         order.
8724         * testsuite/script_test_10.t: Likewise.
8725         * testsuite/script_test_10.s: Likewise.
8726         * testsuite/Makefile.am: Wrap the cross linker tests and the
8727         common tests into NATIVE_OR_CROSS_LINKER.
8728         (check_SCRIPTS): Add script_test_10.sh.
8729         (check_DATA): Add script_test_10.stdout.
8730         (script_test_10.o, script_test_10): New targets.
8731         (script_test_10.stdout): New target.
8732         * configure, testsuite/Makefile.in: Regenerate.
8733
8734 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8735
8736         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
8737         error for the deprecated relocations.
8738         (Target_arm::Scan::global): Likewise.
8739         (Target_arm::Relocate::relocate): Likewise.
8740
8741 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
8742
8743         * fileread.cc (Input_file::find_file): Initialize *found_name
8744         and *namep when using the fallback search for case 4.
8745
8746 2010-10-11  Cary Coutant  <ccoutant@google.com>
8747
8748         * options.h (class General_options): Redefine -z lazy as an alias for
8749         the negation of -z now.
8750
8751 2010-10-11  Ian Lance Taylor  <iant@google.com>
8752
8753         * resolve.cc (symbol_to_bits): Report the value of the unsupported
8754         binding.
8755
8756 2010-10-06  Nick Clifton  <nickc@redhat.com>
8757
8758         * script-sections.cc(class Memory_region): Remove
8759         current_lma_offset_ field.  Rename current_vma_offset_ to
8760         current_offset_.  Add last_section_ field.
8761         (Memory_region::get_current_vma_address): Rename to
8762         get_current_address.
8763         (Memory_region::get_current_lma_address): Delete.
8764         (Memory_region::increment_vma_offset): Rename to
8765         increment_offset.
8766         (Memory_region::increment_lma_offset): Delete.
8767         (Memory_region::attributes_compatible): New method.  Returns
8768         true if the provided section is compatible with the region.
8769         (Memory_region::get_last_section): New method.  Returns the last
8770         section to use the region.
8771         (Memory_region::set_last_section): New method.  Stores the last
8772         section to use the region.
8773         (Script_sections::block_in_region): New method.  Returns true if
8774         a block of memory is contained within a region.
8775         (Script_sections::find_memory_region): New method.  Locates a
8776         memory region to be used to set a VMA or LMA address.
8777         (Output_section_definition::set_section_addresses): Add code to
8778         check for addresses set by memory regions.
8779         (Output_segment::set_section_addresses): Remove memory region
8780         walking code.
8781         (Script_sections::create_segment): Add a warning if a header
8782         segment is created outside of any region.
8783         * script-sections.h (class Script_sections): Add prototypes for
8784         find_memory_region and block_in_region methods.
8785         * testsuite/memory_test.s: Use .long instead of .word.
8786         * testsuite/memory_test.t: Add some more output sections.
8787         * testsuite/memory_test.sh: Update expected output.
8788
8789 2010-10-02  Doug Kwan  <dougkwan@google.com>
8790
8791         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
8792         defintion to symtab.h
8793         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
8794         declaration to defintion.
8795
8796 2010-10-01  Nick Clifton  <nickc@redhat.com>
8797
8798         * expression.cc (eval): Replace dummy argument with NULL.
8799         (eval_maybe_dot): Check for a NULL result section pointer.
8800         (Symbol_expression::value): Likewise.
8801         (Dot_expression::value): Likewise.
8802         (BINARY_EXPRESSION): Likewise.
8803         (Max_expression::value): Likewise.
8804         (Min_expression::value): Likewise.
8805         (Absolute_expression::value): Likewise.
8806         (Addr_expression::value_from_output_section): Likewise.
8807         (Loaddddr_expression::value_from_output_section): Likewise.
8808         (Segment_start_expression::value): Likewise.
8809         * script-sections.cc
8810         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
8811         argument with NULL.
8812         (Sections_elememt_dot_assignment::set_section_addresses):
8813         Likewise.
8814         (Output_data_expression::do_write_to_buffer): Likewise.
8815         (Output_section_definition::finalize_symbols): Likewise.
8816         (Output_section_definition::set_section_addresses): Likewise.
8817
8818 2010-09-30  Doug Kwan  <dougkwan@google.com>
8819
8820         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
8821
8822 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
8823
8824         * target.h (Target::can_icf_inline_merge_sections): New virtual
8825         function.
8826         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
8827         virtual function.
8828         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
8829         virtual function.
8830         * icf.cc (get_section_contents): Inline merge sections only when
8831         target allows it.
8832
8833 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8834
8835         * configure: Regenerate.
8836
8837 2010-09-17  Ian Lance Taylor  <iant@google.com>
8838
8839         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
8840         * testsuite/Makefile.am (memory_test.o): New target.
8841         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
8842         memory_test.t.
8843         * testsuite/Makefile.in: Rebuild.
8844
8845 2010-09-17  Doug Kwan  <dougkwan@google.com>
8846
8847         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
8848         defintion if relocation uses GOT entries of the symbol.
8849         * testsuite/icf_safe_test.sh: Fix test.
8850         * testsuite/icf_safe_so_test.sh: Fix test.
8851
8852 2010-09-16  Cary Coutant  <ccoutant@google.com>
8853
8854         * script_sections.cc (class Memory_region): Remove "NULL" from
8855         vector initializations.
8856
8857 2010-09-15  Cary Coutant  <ccoutant@google.com>
8858
8859         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
8860         Resolve forwarding symbols.
8861
8862 2010-09-15  Doug Kwan  <dougkwan@google.com>
8863
8864         * gold/testsuite/script_test_3.t: Add ARM special sections.
8865         * gold/testsuite/script_test_4.t: Same.
8866         * gold/testsuite/script_test_5.t: Same.
8867         * gold/testsuite/script_test_6.t: Same.
8868         * gold/testsuite/script_test_7.t: Same.
8869         * gold/testsuite/script_test_7.t: Same.
8870         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
8871
8872 2010-09-14  Cary Coutant  <ccoutant@google.com>
8873
8874         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
8875         (Target_x86_64::Relocate::relocate_tls): Replace check for
8876         saw_tls_block_reloc_ with test for executable section.
8877
8878 2010-09-12  Cary Coutant  <ccoutant@google.com>
8879
8880         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
8881         position-independent executables to shared libraries need dynamic
8882         relocations.
8883         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
8884         position-independent executables.
8885         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
8886         * testsuite/Makefile.in: Regenerate.
8887
8888 2010-09-10  Nick Clifton  <nickc@redhat.com>
8889
8890         PR gold/11997
8891         * testsuite/memory_test.t: Discard any sections that are not
8892         needed.
8893
8894 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
8895
8896         PR gold/11996
8897         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8898         "This::" to work around a bug in gcc 4.2.
8899
8900         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
8901
8902 2010-09-09  Rafael Espindola  <espindola@google.com>
8903
8904         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
8905         sections with different PF_X flags in the same segment.
8906         (Layout::find_first_load_seg): Search all segments to find the first
8907         one.
8908         * options.h (rosegment): New.
8909
8910 2010-09-08  Rafael Espindola  <espindola@google.com>
8911
8912         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
8913
8914 2010-09-08  Doug Kwan  <dougkwan@google.com>
8915
8916         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
8917         (Arm_relobj::do_relocate_sections): Add new parameter for output
8918         file to match the parent.
8919         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
8920         of local symbols instead of input values.  Update code to track
8921         changes in gold::relocate_section.
8922         * object.cc (Sized_relobj::compute_final_local_value): New methods.
8923         (Sized_relobj::compute_final_local_value_internal): New methods.
8924         (Sized_relobj::do_finalize_local_symbols): Move code from loop
8925         body into private version of Sized_relobj::compute_final_local_value.
8926         Call the inline method.
8927         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
8928         merged symbol value if there is one.
8929         (Symbol_value::has_output_value): New method defintiion.
8930         (Sized_relobj::Compute_final_local_value_status): New enum type.
8931         (Sized_relobj::compute_final_local_value): New methods.
8932         (Sized_relobj::compute_final_local_value_internal): New methods.
8933         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
8934         and arm_cortex_a8.sh.
8935         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
8936         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
8937         New tests.
8938         * Makefile.in: Regenerate.
8939         * testsuite/arm_bl_out_of_range.s: Update test.
8940         * testsuite/thumb_bl_out_of_range.s: Ditto.
8941         * testsuite/thumb_blx_out_of_range.s: Ditto.
8942         * testsuite/arm_branch_out_of_range.sh: New file.
8943         * testsuite/arm_cortex_a8.sh: Ditto.
8944         * testsuite/arm_cortex_a8_b.s: Ditto.
8945         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
8946         * testsuite/arm_cortex_a8_b_local.s: Ditto.
8947         * testsuite/arm_cortex_a8_bl.s: Ditto.
8948         * testsuite/arm_cortex_a8_blx.s: Ditto.
8949         * testsuite/arm_cortex_a8_local.s: Ditto.
8950         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
8951         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
8952
8953 2010-09-08  Rafael Espindola  <espindola@google.com>
8954
8955         * Makefile.am (memory_test.stdout): Run readelf with -W.
8956         * Makefile.in: Regenerate.
8957         * testsuite/memory_test.sh: Make the regexps accept both 32 and
8958         64 bit output.
8959
8960 2010-09-08  Rafael Espindola  <espindola@google.com>
8961
8962         * script-sections.cc (Script_sections::add_memory_region): Convert
8963         field precision to int.
8964         * script.cc (script_set_section_region, script_set_section_region):
8965         Convert field precision to int.
8966
8967 2010-09-08  Rafael Espindola  <espindola@google.com>
8968
8969         * arm.cc (do_finalize_sections): Create the __exidx_start and
8970         __exdix_end symbols even when the section is missing.
8971
8972 2010-09-08  Nick Clifton  <nickc@redhat.com>
8973
8974         * README: Remove claim that MEMORY is not supported.
8975         * expression.cc (script_exp_function_origin)
8976         (script_exp_function_length): Move from here to ...
8977         * script.cc: ... here.
8978         (script_set_section_region, script_add_memory)
8979         (script_parse_memory_attr, script_include_directive): New
8980         functions.
8981         * script-sections.cc
8982         (class Memory_region): New class.
8983         (class Output_section_definition): Add set_memory_region,
8984         set_section_vma, set_section_lma and get_section_name methods.
8985         (class Script_Sections): Add add_memory_region,
8986         find_memory_region, find_memory_region_origin,
8987         find_memory_region_length and set_memory_region methods.
8988         Have set_section_addresses method walk the list of set memory
8989         regions.
8990         Extend the print methos to display memory regions.
8991         * script-sections.h: Add prototypes for new methods.
8992         Add enum for MEMORY region attributes.
8993         * yyscript.y: Add support for parsing MEMORY regions.
8994         * script-c.h: Add prototypes for new functions.
8995         * testsuite/Makefile.am: Add test of MEMORY region functionality.
8996         * testsuite/Makefile.in: Regenerate.
8997         * testsuite/memory_test.sh: New script.
8998         * testsuite/memory_test.s: New assembler source file.
8999         * testsuite/memory_test.t: New linker script.
9000
9001 2010-08-27  Doug Kwan  <dougkwan@google.com>
9002
9003         * gold/resolve.cc (Symbol_table::should_override): Let a weak
9004         reference override an existing dynamic weak reference.
9005         * testsuite/Makefile.am: Add new test dyn_weak_ref.
9006         * testsuite/Makefile.in: Regenerate.
9007         * testsuite/dyn_weak_ref.sh: New file.
9008         * testsuite/dyn_weak_ref_1.c: Ditto.
9009         * testsuite/dyn_weak_ref_2.c: Ditto.
9010
9011 2010-08-27  Ian Lance Taylor  <iant@google.com>
9012
9013         * incremental.h (class Incremental_input_entry): Add virtual
9014         destructor.
9015
9016 2010-08-27  Ian Lance Taylor  <iant@google.com>
9017
9018         * testsuite/start_lib_test_3.c: Mark t3 as used.
9019
9020 2010-08-27  Nick Clifton  <nickc@redhat.com>
9021
9022         * options.cc (version_script): Fix small typo in previous
9023         whitespace tidyup.
9024
9025 2010-08-25  Nick Clifton  <nickc@redhat.com>
9026
9027         * archive.cc: Formatting fixes: Remove whitespace between
9028         typename and following asterisk.  Remove whitespace between
9029         function name and opening parenthesis.
9030         * archive.h: Likewise.
9031         * arm.cc: Likewise.
9032         * attributes.cc: Likewise.
9033         * attributes.h: Likewise.
9034         * common.cc: Likewise.
9035         * copy-relocs.cc: Likewise.
9036         * dirsearch.h: Likewise.
9037         * dynobj.cc: Likewise.
9038         * ehframe.cc: Likewise.
9039         * ehframe.h: Likewise.
9040         * expression.cc: Likewise.
9041         * fileread.cc: Likewise.
9042         * fileread.h: Likewise.
9043         * gc.h: Likewise.
9044         * gold-threads.cc: Likewise.
9045         * gold.cc: Likewise.
9046         * i386.cc: Likewise.
9047         * icf.h: Likewise.
9048         * incremental-dump.cc: Likewise.
9049         * incremental.cc: Likewise.
9050         * layout.cc: Likewise.
9051         * layout.h: Likewise.
9052         * main.cc: Likewise.
9053         * merge.cc: Likewise.
9054         * merge.h: Likewise.
9055         * object.cc: Likewise.
9056         * object.h: Likewise.
9057         * options.cc: Likewise.
9058         * options.h: Likewise.
9059         * output.cc: Likewise.
9060         * output.h: Likewise.
9061         * plugin.cc: Likewise.
9062         * plugin.h: Likewise.
9063         * powerpc.cc: Likewise.
9064         * reloc.cc: Likewise.
9065         * script-c.h: Likewise.
9066         * script-sections.cc: Likewise.
9067         * script.cc: Likewise.
9068         * stringpool.cc: Likewise.
9069         * symtab.cc: Likewise.
9070         * symtab.h: Likewise.
9071         * target.cc: Likewise.
9072         * timer.cc: Likewise.
9073         * timer.h: Likewise.
9074         * version.cc: Likewise.
9075         * x86_64.cc: Likewise.
9076
9077 2010-08-24  Nick Clifton  <nickc@redhat.com>
9078
9079         PR 11899
9080         * layout.cc (segment_precedes): Sort segments by their physical
9081         addresses, if they have been set.
9082
9083 2010-08-23  Cary Coutant  <ccoutant@google.com>
9084
9085         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
9086         symbols data.
9087         (Lib_group::include_member): Unlock object after deleting its
9088         symbols data.
9089         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
9090         the bug fixed here.
9091
9092 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
9093             Cary Coutant  <ccoutant@google.com>
9094
9095         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
9096         constructor, and set_blocker.
9097         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
9098         readsyms_blocker_.
9099         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
9100         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
9101         * testsuite/Makefile.am (start_lib_test): New test case.
9102         * testsuite/Makefile.in: Regenerate.
9103         * testsuite/start_lib_test_main.c: New file.
9104         * testsuite/start_lib_test_1.c: New file.
9105         * testsuite/start_lib_test_2.c: New file.
9106         * testsuite/start_lib_test_3.c: New file.
9107
9108 2010-08-19  Ian Lance Taylor  <iant@google.com>
9109
9110         * Makefile.in: Rebuild with automake 1.11.1.
9111         * aclocal.m4: Likewise.
9112         * testsuite/Makefile.in: Likewise.
9113
9114 2010-08-19  Ian Lance Taylor  <iant@google.com>
9115
9116         PR 10893
9117         * i386.cc (class Output_data_plt_i386): Update declarations.
9118         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
9119         local_ifuncs_ fields.
9120         (Target_i386::do_plt_section_for_global): New function.
9121         (Target_i386::do_plt_section_for_local): New function.
9122         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
9123         parameter; change all callers.  Initialize global_ifuncs_ and
9124         local_ifuncs_.  If doing a static link define __rel_iplt_start and
9125         __rel_iplt_end.
9126         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
9127         (Output_data_plt_i386::add_local_ifunc_entry): New function.
9128         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
9129         symbols.
9130         (Target_i386::make_plt_section): New function, broken out of
9131         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
9132         (Target_i386::make_plt_entry): Call make_plt_section.
9133         (Target_i386::make_local_ifunc_plt_entry): New function.
9134         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
9135         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
9136         R_386_IRELATIVE to switch.
9137         (Target_i386::Scan::global): Likewise.
9138         (Target_i386::Relocate::relocate): Likewise.
9139         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
9140         switch.
9141         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
9142         (Target_x86_64::do_plt_section_for_global): New function.
9143         (Target_x86_64::do_plt_section_for_local): New function.
9144         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
9145         parameter; change all callers.  If doing a static link define
9146         __rela_iplt_start and __rela_iplt_end.
9147         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
9148         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
9149         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
9150         to point to .plt.
9151         (Target_x86_64::make_local_ifunc_plt_entry): New function.
9152         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
9153         switch.
9154         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
9155         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
9156         R_X86_64_IRELATIVE to switch.
9157         (Target_x86_64::Scan::global): Likewise.
9158         (Target_x86_64::Relocate::relocate): Likewise.
9159         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
9160         switch.
9161         * target.h (class Target): Add plt_section_for_global and
9162         plt_section_for_local functions.  Add do_plt_section_for_global
9163         and do_plt_section_for_local virtual functions.
9164         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
9165         clarifying comments.
9166         (Symbol::use_plt_offset): Handle IFUNC symbol.
9167         * object.cc (Sized_relobj::Sized_relobj): Initialize
9168         local_plt_offsets_.
9169         (Sized_relobj::local_has_plt_offset): New function.
9170         (Sized_relobj::local_plt_offset): New function.
9171         (Sized_relobj::set_local_plt_offset): New function.
9172         (Sized_relobj::do_count): Handle IFUNC symbol.
9173         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
9174         a bit away from input_shndx_ field.  Add set_is_func_symbol and
9175         is_ifunc_symbol functions.
9176         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
9177         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
9178         local_plt_offsets_ field.
9179         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
9180         * output.h (class Output_section_data): Add non-const
9181         output_section function.
9182         (class Output_data_got): Update declarations.
9183         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
9184         Add use_plt_offset parameter to global and local constructors.
9185         Change all callers.  Change local_sym_index_ field to 31 bits.
9186         Change GSYM_CODE and CONSTANT_CODE accordingly.
9187         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
9188         doing a static link don't set sh_link field.
9189         (Output_data_got::Got_entry::write): Use PLT offset if
9190         appropriate.
9191         (Output_data_got::add_global_plt): New function.
9192         (Output_data_got::add_local_plt): New function.
9193         * target-reloc.h (relocate_section): Handle IFUNC symbol.
9194         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
9195         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
9196         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
9197         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
9198         IFUNC conditional.
9199         * testsuite/ifunc-sel.h: New file.
9200         * testsuite/ifuncmain1.c: New file.
9201         * testsuite/ifuncmain1vis.c: New file.
9202         * testsuite/ifuncmod1.c: New file.
9203         * testsuite/ifuncdep2.c: New file.
9204         * testsuite/ifuncmain2.c: New file.
9205         * testsuite/ifuncmain3.c: New file.
9206         * testsuite/ifuncmod3.c: New file.
9207         * testsuite/ifuncmain4.c: New file.
9208         * testsuite/ifuncmain5.c: New file.
9209         * testsuite/ifuncmod5.c: New file.
9210         * testsuite/ifuncmain6pie.c: New file.
9211         * testsuite/ifuncmod6.c: New file.
9212         * testsuite/ifuncmain7.c: New file.
9213         * configure, testsuite/Makefile.in: Rebuild.
9214
9215 2010-08-18  Ian Lance Taylor  <iant@google.com>
9216
9217         * incremental.cc
9218         (Output_section_incremental_inputs::write_input_files): Add cast
9219         to avoid signed/unsigned comparison warning.
9220         (Output_section_incremental_inputs::write_info_blocks): Likewise.
9221
9222 2010-08-12  Cary Coutant  <ccoutant@google.com>
9223
9224         * common.cc (Sort_commons::operator()): Remove unnecessary code.
9225
9226 2010-08-13  Ian Lance Taylor  <iant@google.com>
9227
9228         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
9229
9230 2010-08-12  Cary Coutant  <ccoutant@google.com>
9231             Doug Kwan  <dougkwan@google.com>
9232
9233         * resolve.cc (Symbol_table::should_override): When a weak dynamic
9234         defintion overrides non-weak undef, remember that the original undef
9235         is not weak.
9236         * symtab.cc (Symbol_table::sized_write_global): For undef without
9237         an original weak binding, set binding to global in output.
9238         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
9239         * testsuite/Makefile.in: Regenerate.
9240         * testsuite/strong_ref_weak_def.sh: New file.
9241         * testsuite/strong_ref_weak_def_1.c: Ditto.
9242         * testsuite/strong_ref_weak_def_2.c: Ditto.
9243
9244 2010-08-12  Cary Coutant  <ccoutant@google.com>
9245
9246         * testsuite/incremental_test.sh: Rewrite.
9247         * testsuite/incremental_test_1.c: Rewrite.
9248         * testsuite/incremental_test_2.c: Rewrite.
9249
9250 2010-08-12  Cary Coutant  <ccoutant@google.com>
9251
9252         * arm.cc (Target_arm::got_size): Add const.
9253         (Target_arm::got_entry_count): New function.
9254         (Target_arm::plt_entry_count): New function.
9255         (Target_arm::first_plt_entry_offset): New function.
9256         (Target_arm::plt_entry_size): New function.
9257         (Output_data_plt_arm::entry_count): New function.
9258         (Output_data_plt_arm::first_plt_entry_offset): New function.
9259         (Output_data_plt_arm::get_plt_entry_size): New function.
9260         * i386.cc (Target_i386::got_size): Add const.
9261         (Target_i386::got_entry_count): New function.
9262         (Target_i386::plt_entry_count): New function.
9263         (Target_i386::first_plt_entry_offset): New function.
9264         (Target_i386::plt_entry_size): New function.
9265         (Output_data_plt_i386::entry_count): New function.
9266         (Output_data_plt_i386::first_plt_entry_offset): New function.
9267         (Output_data_plt_i386::get_plt_entry_size): New function.
9268         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
9269         find_incremental_inputs_sections.  Dump incremental_got_plt section.
9270         * incremental.cc: Include target.h.
9271         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
9272         parameter.  Adjust all callers.  Find incremental_got_plt section.
9273         (Incremental_inputs::create_data_sections): Create incremental_got_plt
9274         section.
9275         (Output_section_incremental_inputs::set_final_data_size): Calculate
9276         size of incremental_got_plt section.
9277         (Output_section_incremental_inputs::do_write): Write the
9278         incremental_got_plt section.
9279         (Got_plt_view_info): New struct.
9280         (Local_got_offset_visitor): New class.
9281         (Global_got_offset_visitor): New class.
9282         (Global_symbol_visitor_got_plt): New class.
9283         (Output_section_incremental_inputs::write_got_plt): New function.
9284         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
9285         Add parameter.  Adjust all callers.
9286         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9287         (Incremental_inputs::got_plt_section): New function.
9288         (Incremental_inputs::got_plt_section_): New data member.
9289         (Incremental_got_plt_reader): New class.
9290         * layout.cc (Layout::create_incremental_info_sections): Add the
9291         incremental_got_plt section.
9292         * object.h (Got_offset_list::get_list): New function.
9293         (Got offset_list::for_all_got_offsets): New function.
9294         (Sized_relobj::local_got_offset_list): New function.
9295         * powerpc.cc (Target_powerpc::got_size): Add const.
9296         (Target_powerpc::got_entry_count): New function.
9297         (Target_powerpc::plt_entry_count): New function.
9298         (Target_powerpc::first_plt_entry_offset): New function.
9299         (Target_powerpc::plt_entry_size): New function.
9300         (Output_data_plt_powerpc::entry_count): New function.
9301         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
9302         (Output_data_plt_powerpc::get_plt_entry_size): New function.
9303         * sparc.cc (Target_sparc::got_size): Add const.
9304         (Target_sparc::got_entry_count): New function.
9305         (Target_sparc::plt_entry_count): New function.
9306         (Target_sparc::first_plt_entry_offset): New function.
9307         (Target_sparc::plt_entry_size): New function.
9308         (Output_data_plt_sparc::entry_count): New function.
9309         (Output_data_plt_sparc::first_plt_entry_offset): New function.
9310         (Output_data_plt_sparc::get_plt_entry_size): New function.
9311         * symtab.h (Symbol::got_offset_list): New function.
9312         (Symbol_table::for_all_symbols): New function.
9313         * target.h (Sized_target::got_entry_count): New function.
9314         (Sized_target::plt_entry_count): New function.
9315         (Sized_target::plt_entry_size): New function.
9316         * x86_64.cc (Target_x86_64::got_size): Add const.
9317         (Target_x86_64::got_entry_count): New function.
9318         (Target_x86_64::plt_entry_count): New function.
9319         (Target_x86_64::first_plt_entry_offset): New function.
9320         (Target_x86_64::plt_entry_size): New function.
9321         (Output_data_plt_x86_64::entry_count): New function.
9322         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
9323         (Output_data_plt_x86_64::get_plt_entry_size): New function.
9324
9325 2010-08-12  Cary Coutant  <ccoutant@google.com>
9326
9327         * archive.cc: Include incremental.h.
9328         (Archive::Archive): Initialize incremental_info_.
9329         (Archive::include_member): Record archive members in incremental info.
9330         (Add_archive_symbols::run): Record begin and end of an archive in
9331         incremental info.
9332         (Lib_group::include_member): Record objects in incremental info.
9333         * archive.h (Incremental_archive_entry): Forward declaration.
9334         (Archive::set_incremental_info): New member function.
9335         (Archive::incremental_info): New member function.
9336         (Archive::Unused_symbol_iterator): New class.
9337         (Archive::unused_symbols_begin): New member function.
9338         (Archive::unused_symbols_end): New member function.
9339         (Archive::incremental_info_): New data member.
9340         * incremental-dump.cc (find_input_containing_global): New function.
9341         (dump_incremental_inputs): Dump new incremental info sections.
9342         * incremental.cc: Include symtab.h.
9343         (Output_section_incremental_inputs): New class.
9344         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
9345         new incremental info sections.
9346         (Sized_incremental_binary::do_check_inputs): Likewise.
9347         (Incremental_inputs::report_archive): Remove.
9348         (Incremental_inputs::report_archive_begin): New function.
9349         (Incremental_inputs::report_archive_end): New function.
9350         (Incremental_inputs::report_object): New function.
9351         (Incremental_inputs::finalize_inputs): Remove.
9352         (Incremental_inputs::report_input_section): New function.
9353         (Incremental_inputs::report_script): Rewrite.
9354         (Incremental_inputs::finalize): Do nothing but finalize string table.
9355         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9356         (Incremental_inputs::sized_create_inputs_section_data): Remove.
9357         (Incremental_inputs::create_data_sections): New function.
9358         (Incremental_inputs::relocs_entsize): New function.
9359         (Output_section_incremental_inputs::set_final_data_size): New function.
9360         (Output_section_incremental_inputs::do_write): New function.
9361         (Output_section_incremental_inputs::write_header): New function.
9362         (Output_section_incremental_inputs::write_input_files): New function.
9363         (Output_section_incremental_inputs::write_info_blocks): New function.
9364         (Output_section_incremental_inputs::write_symtab): New function.
9365         * incremental.h (Incremental_script_entry): Forward declaration.
9366         (Incremental_object_entry): Forward declaration.
9367         (Incremental_archive_entry): Forward declaration.
9368         (Incremental_inputs): Forward declaration.
9369         (Incremental_inputs_header_data): Remove.
9370         (Incremental_inputs_header): Remove.
9371         (Incremental_inputs_header_write): Remove.
9372         (Incremental_inputs_entry_data): Remove.
9373         (Incremental_inputs_entry): Remove.
9374         (Incremental_inputs_entry_write): Remove.
9375         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
9376         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
9377         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9378         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
9379         Likewise.
9380         (Incremental_input_entry): New class.
9381         (Incremental_script_entry): New class.
9382         (Incremental_object_entry): New class.
9383         (Incremental_archive_entry): New class.
9384         (Incremental_inputs::Incremental_inputs): Initialize new data members.
9385         (Incremental_inputs::report_inputs): Remove.
9386         (Incremental_inputs::report_archive): Remove.
9387         (Incremental_inputs::report_archive_begin): New function.
9388         (Incremental_inputs::report_archive_end): New function.
9389         (Incremental_inputs::report_object): Change prototype.
9390         (Incremental_inputs::report_input_section): New function.
9391         (Incremental_inputs::report_script): Change prototype.
9392         (Incremental_inputs::get_reloc_count): New function.
9393         (Incremental_inputs::set_reloc_count): New function.
9394         (Incremental_inputs::create_data_sections): New function.
9395         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9396         (Incremental_inputs::inputs_section): New function.
9397         (Incremental_inputs::symtab_section): New function.
9398         (Incremental_inputs::relocs_section): New function.
9399         (Incremental_inputs::get_stringpool): Add const.
9400         (Incremental_inputs::command_line): Add const.
9401         (Incremental_inputs::inputs): Remove.
9402         (Incremental_inputs::command_line_key): New function.
9403         (Incremental_inputs::input_file_count): New function.
9404         (Incremental_inputs::input_files): New function.
9405         (Incremental_inputs::relocs_entsize): New function.
9406         (Incremental_inputs::sized_create_inputs_section_data): Remove.
9407         (Incremental_inputs::finalize_inputs): Remove.
9408         (Incremental_inputs::Input_info): Remove.
9409         (Incremental_inputs::lock_): Remove.
9410         (Incremental_inputs::inputs_): Change type.
9411         (Incremental_inputs::inputs_map_): Remove.
9412         (Incremental_inputs::current_object_entry_): New data member.
9413         (Incremental_inputs::inputs_section_): New data member.
9414         (Incremental_inputs::symtab_section_): New data member.
9415         (Incremental_inputs::relocs_section_): New data member.
9416         (Incremental_inputs::reloc_count_): New data member.
9417         (Incremental_inputs_reader): New class.
9418         (Incremental_symtab_reader): New class.
9419         (Incremental_relocs_reader): New class.
9420         * layout.cc (Layout::finalize): Move finalization of incremental info
9421         and creation of incremental info sections to follow finalization of
9422         symbol table.  Set offsets for postprocessing sections.
9423         (Layout::create_incremental_info_sections): Call
9424         Incremental_inputs::create_data_sections.  Add incremental symtab
9425         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
9426         sections to layout after input sections.
9427         * layout.h (struct Timespec): Forward declaration.
9428         (Layout::incremental_inputs): Add const.
9429         (Layout::create_incremental_info_sections): Add parameter.
9430         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
9431         * object.cc: Include incremental.h.
9432         (Relobj::finalize_incremental_relocs): New function.
9433         (Sized_relobj::do_layout): Record input sections in incremental info.
9434         * object.h (Object::output_section): New function.
9435         (Object::output_section_offset): Moved from Relobj.
9436         (Object::get_incremental_reloc_base): New function.
9437         (Object::get_incremental_reloc_count): New function.
9438         (Object::do_output_section): New function.
9439         (Object::do_output_section_offset): Moved from Relobj.
9440         (Object::do_get_incremental_reloc_base): New function.
9441         (Object::do_get_incremental_reloc_count): New function.
9442         (Object::Object): Initialize new data members.
9443         (Relobj::output_section): Renamed do_output_section and moved to
9444         protected.
9445         (Relobj::output_section_offset): Moved to Object.
9446         (Relobj::do_get_incremental_reloc_base): New function.
9447         (Relobj::do_get_incremental_reloc_count): New function.
9448         (Relobj::allocate_incremental_reloc_counts): New function.
9449         (Relobj::count_incremental_reloc): New function.
9450         (Relobj::finalize_incremental_relocs): New function.
9451         (Relobj::next_incremental_reloc_index): New function.
9452         (Relobj::reloc_counts_): New data member.
9453         (Relobj::reloc_bases_): New data member.
9454         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
9455         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
9456         (Sized_relobj::incremental_relocs_scan): New function.
9457         (Sized_relobj::incremental_relocs_scan_reltype): New function.
9458         (Sized_relobj::incremental_relocs_write): New function.
9459         (Sized_relobj::incremental_relocs_write_reltype): New function.
9460         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
9461         incremental link.
9462         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
9463         archives and object files elsewhere.
9464         (Add_symbols::run): Report object files here.
9465         (Finish_group::run): Report end of archive at end of group.
9466         * reloc.cc: Include layout.h, incremental.h.
9467         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
9468         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
9469         (Sized_relobj::incremental_relocs_scan): New function.
9470         (Sized_relobj::incremental_relocs_scan_reltype): New function.
9471         (Sized_relobj::do_relocate_sections): Write incremental relocations.
9472         (Sized_relobj::incremental_relocs_write): New function.
9473         (Sized_relobj::incremental_relocs_write_reltype): New function.
9474         * script.cc (read_input_script): Rewrite test for incremental link.
9475         Change call to Incremental_inputs::report_script.
9476         * symtab.h (Symbol_table::first_global_index): New function.
9477         (Symbol_table::output_count): New function.
9478
9479 2010-08-12  Doug Kwan  <dougkwan@google.com>
9480
9481         * arm.cc (Target_arm::merge_object_attributes): Check command line
9482         options --no-wchar-size-warning and --no-enum-size-warning.
9483         * options.h (General_options): Add ld-compatible options
9484         --no-enum-size-warning and --no-wchar-size-warning.
9485
9486 2010-08-04  Ian Lance Taylor  <iant@google.com>
9487
9488         * x86_64.cc (Target_x86_64::Scan::local): Use
9489         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
9490         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
9491         (Target_x86_64::Scan::global): Likewise.
9492         (Target_x86_64::Relocate::relocate): Likewise.
9493         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
9494         Likewise.
9495
9496 2010-08-03  Cary Coutant  <ccoutant@google.com>
9497
9498         * merge.cc (Output_merge_string::do_add_input_section): Count strings
9499         to reserve space in merged_strings vector. Keep total input size
9500         for stats.
9501         (Output_merge_string::do_print_merge_stats): Print total input size.
9502         * merge.h (Output_merge_string): Add input_size_ field.
9503         * stringpool.cc (Stringpool_template::string_length): Move
9504         implementations out of Stringpool_template class and place in
9505         stringpool.h.
9506         * stringpool.h (string_length): Move out of Stringpool_template.
9507
9508 2010-08-03  Ian Lance Taylor  <iant@google.com>
9509
9510         PR 11712
9511         * layout.cc (relaxation_loop_body): If address of load segment is
9512         set, adjust address to include headers if possible.
9513
9514 2010-08-03  Ian Lance Taylor  <iant@google.com>
9515
9516         * version.cc (version_string): Bump to 1.10.
9517
9518 2010-08-03  Ian Lance Taylor  <iant@google.com>
9519
9520         PR 11805
9521         * layout.h (enum Output_section_order): Define.
9522         (class Layout): Update declarations.
9523         * layout.cc (Layout::get_output_section): Add order parameter.
9524         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
9525         is_first_non_relro parameters.  Change all callers.
9526         (Layout::choose_output_section): Likewise.
9527         (Layout::add_output_section_data): Likewise.
9528         (Layout::make_output_section): Likewise.  Set order.
9529         (Layout::default_section_order): New function.
9530         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
9531         * output.cc (Output_section::Output_section): Initialize order_.
9532         Don't initialize deleted fields.
9533         (Output_segment::Output_segment): Don't initialize deleted
9534         fields.
9535         (Output_segment::add_output_section_to_load): New function
9536         replacing add_output_section.  Change all callers to call this or
9537         add_output_section_to_nonload.
9538         (Output_segment::add_output_section_to_nonload): New function.
9539         (Output_segment::remove_output_section): Rewrite.
9540         (Output_segment::add_initial_output_data): Likewise.
9541         (Output_segment::has_any_data_sections): Likewise.
9542         (Output_segment::is_first_section_relro): Likewise.
9543         (Output_segment::maximum_alignment): Likewise.
9544         (Output_segment::has_dynamic_reloc): New function replacing
9545         dynamic_reloc_count.  Change all callers.
9546         (Output_segment::has_dynamic_reloc_list): New function replacing
9547         dynamic_reloc_count_list.  Change all callers.
9548         (Output_segment::set_section_addresses): Rewrite.
9549         (Output_segment::set_offset): Rewrite.
9550         (Output_segment::find_first_and_last_list): Remove.
9551         (Output_segment::set_tls_offsets): Rewrite.
9552         (Output_segment::first_section_load_address): Likewise.
9553         (Output_segment::output_section_count): Likewise.
9554         (Output_segment::section_with_lowest_load_address): Likewise.
9555         (Output_segment::write_section_headers): Likewise.
9556         (Output_segment::print_sections_to_map): Likewise.
9557         * output.h (class Output_data): Remove dynamic_reloc_count_
9558         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
9559         (Output_data::add_dynamic_reloc): Rewrite.
9560         (Output_data::has_dynamic_reloc): New function.
9561         (Output_data::dynamic_reloc_count): Remove.
9562         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
9563         is_last_relro_, is_first_non_relro_, is_interp_,
9564         is_dynamic_linker_section_ fields.  Add order and set_order
9565         functions.  Remove is_relro_local, set_is_relro_local,
9566         is_last_relro, set_is_last_relro, is_first_non_relro,
9567         set_is_first_non_relro functions, is_interp, set_is_interp,
9568         is_dynamic_linker_section, and set_is_dynamic_linker_section
9569         functions.
9570         (class Output_segment): Change Output_data_list from std::list to
9571         std:;vector.  Add output_lists_ field.  Remove output_data_ and
9572         output_bss_ fields.  Update declarations.
9573
9574 2010-08-02  Ian Lance Taylor  <iant@google.com>
9575
9576         * arm.cc (Target_arm::gc_process_relocs): Use typename.
9577         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
9578         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
9579
9580 2010-08-02  Ian Lance Taylor  <iant@google.com>
9581
9582         PR 11855
9583         * script.cc (Script_options::Script_options): Initialize
9584         symbol_definitions_ and symbol_references_.
9585         (Script_options::add_symbol_assignment): Update
9586         symbol_definitions_ and symbol_references_.
9587         (Script_options::add_symbol_reference): New function.
9588         (script_symbol): New function.
9589         * script.h (class Script_options): Add symbol_definitions_ and
9590         symbol_references_ fields.
9591         (Script_options::referenced_const_iterator): New type.
9592         (Script_options::referenced_begin): New function.
9593         (Script_options::referenced_end): New function.
9594         (Script_options::is_referenced): New function.
9595         (Script_options::any_unreferenced): New function.
9596         * script-c.h (script_symbol): Declare.
9597         * yyscript.y (exp): Call script_symbol.
9598         * symtab.cc: Include "script.h".
9599         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
9600         Change all callers.  Check symbols referenced by scripts.
9601         (Symbol_table::add_undefined_symbols_from_command_line): Add
9602         layout parameter.  Change all callers.
9603         (Symbol_table::do_add_undefined_symbols_from_command_line):
9604         Likewise.  Break out loop body.  Check symbols referenced by
9605         scripts.
9606         (Symbol_table::add_undefined_symbol_from_command_line): New
9607         function broken out of
9608         do_add_undefined_symbols_from_command_line.
9609         * symtab.h (class Symbol_table): Update declarations.
9610         * archive.cc: Include "layout.h".
9611         (Archive::should_include_member): Add layout parameter.  Change
9612         all callers.  Check for symbol mentioned in expression.
9613         * archive.h (class Archive): Update declaration.
9614         * object.cc (Sized_relobj::do_should_include_member): Add layout
9615         parameter.
9616         * object.h (Object::should_include_member): Add layout parameter.
9617         Change all callers.
9618         (Object::do_should_include_member): Add layout parameter.
9619         (class Sized_relobj): Update declaration.
9620         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
9621         parameter.
9622         * dynobj.h (class Sized_dynobj): Update declaration.
9623         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
9624         layout parameter.
9625         * plugin.h (class Sized_pluginobj): Update declaration.
9626
9627 2010-08-02  Ian Lance Taylor  <iant@google.com>
9628
9629         PR 11866
9630         * output.cc (Output_segment::set_offset): Search for the first and
9631         last sections rather than assuming that the list is in order.
9632         (Output_segment::find_first_and_last_list): New function.
9633         * output.h (class Output_segment): Update declarations.
9634         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
9635         (relro_strip_test_SOURCES): New variable.
9636         (relro_strip_test_DEPENDENCIES): New variable.
9637         (relro_strip_test_LDFLAGS): New variable.
9638         (relro_strip_test_LDADD): New variable.
9639         (relro_strip_test.so): New target.
9640
9641 2010-08-02  Ian Lance Taylor  <iant@google.com>
9642
9643         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
9644         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
9645         (Target_i386::got_tlsdesc_section): New function.
9646         (Target_i386::got_section): Create space for GOT entries for
9647         TLSDESC relocations.
9648         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
9649         R_386_TLS_GOTDESC.
9650         (Target_i386::Scan::global): Likewise.
9651         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
9652         using TLSDESC GOT.
9653         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
9654         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
9655         (Target_x86_64::got_tlsdesc_section): New function.
9656         (Target_x86_64::got_section): Create space for GOT entries for
9657         TLSDESC relocations.
9658         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
9659         R_386_TLS_GOTDESC.
9660         (Target_x86_64::Scan::global): Likewise.
9661         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
9662         using TLSDESC GOT.
9663
9664 2010-08-02  Ian Lance Taylor  <iant@google.com>
9665
9666         * testsuite/final_layout.sh: Use dc to convert from hex to
9667         decimal.
9668
9669 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
9670
9671         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
9672         paramter to the call to gold::gc_process_relocs.
9673         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
9674         paramter to the call to gold::gc_process_relocs.
9675         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
9676         parameter to the call to gold::gc_process_relocs.
9677         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
9678         template parameter to the call to gold::gc_process_relocs.
9679         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
9680         paramter to the call to gold::gc_process_relocs.
9681         * gc.h (get_embedded_addend_size): New function.
9682         (gc_process_relocs): Save the size of the reloc for use by ICF.
9683         * icf.cc (get_section_contents): Get the addend from the text section
9684         for SHT_REL relocation sections.
9685         * icf.h (Icf::Reloc_addend_size_info): New typedef.
9686         (Icf::Reloc_info): Add new member reloc_addend_size_info.
9687         * int_encoding.h (read_from_pointer): New overloaded function.
9688         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
9689         * testsuite/icf_sht_rel_addend_test.sh: New file.
9690         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
9691         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
9692
9693 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9694
9695         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
9696         * Makefile.in: Regenerate.
9697         * testsuite/Makefile.in: Regenerate.
9698
9699 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
9700
9701         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
9702         * gold/testsuite/debug_msg.cc: Likewise.
9703         * gold/testsuite/odr_violation1.cc
9704         * gold/testsuite/odr_violation2.cc
9705
9706 2010-07-21  Cary Coutant  <ccoutant@google.com>
9707
9708         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
9709         string, and length fields.
9710         (Output_merge_string::Merged_strings_list): New type.
9711         (Output_merge_string::Merged_strings_lists): New typedef.
9712         (Output_merge_string): Replace merged_strings_ with
9713         merged_strings_lists_.
9714         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
9715         Merged_strings_list per input object and section.  Don't store pointer
9716         to the string.  Don't store length with each merged string entry.
9717         (Output_merge_string::finalize_merged_data): Loop over list of merged
9718         strings lists.  Recompute length of each merged string.
9719
9720 2010-07-15  Cary Coutant  <ccoutant@google.com>
9721
9722         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
9723         here.
9724
9725 2010-07-14  Ian Lance Taylor  <iant@google.com>
9726
9727         * descriptors.cc (Descriptors::open): Report correct name in error
9728         message.
9729
9730 2010-07-13  Doug Kwan  <dougkwan@google.com>
9731
9732         * arm.cc (Arm_input_section::Arm_input_section): For a
9733         SHT_ARM_EXIDX section, always keeps the input sections.
9734         (Arm_input_section::set_exidx_section_link): New method.
9735         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
9736         has_errors_ to false.
9737         (Arm_exidx_input_section::has_errors,
9738         Arm_exidx_input_section::set_has_errors): New methods.
9739         (Arm_exidx_input_section::has_errors_): New data member.
9740         (Arm_relobj::get_exidx_shndx_list): New method.
9741         (Arm_output_section::append_text_sections_to_list): Do not skip
9742         section without SHF_EXECINSTR.
9743         (Arm_output_section::fix_exidx_coverage): Skip input sections with
9744         errors.
9745         (Arm_relobj::make_exidx_input_section): Add new parameter for text
9746         section header.  Make error messages more verbose.  Check for
9747         a non-executable section linked to an EXIDX section.
9748         (Arm_relobj::do_read_symbols): Remove error checking, which has been
9749         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
9750         check that there is no deferred EXIDX section if we exit early.
9751         Instead of not making an EXIDX section in case of an error, make one
9752         and set the has_errors flag of it.
9753         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
9754         in a relocatable link.
9755         (Target_arm::do_relax): Look for the EXIDX output section instead of
9756         assuming that it is called .ARM.exidx.
9757         (Target_arm::fix_exidx_coverage): Add a new parameter for input
9758         section list.  Do not check for SHF_EXECINSTR section flags but
9759         skip any input section with errors.
9760         * output.cc (Output_section::Output_section): Initialize
9761         always_keeps_input_sections_ to false.
9762         (Output_section::add_input_section): Check for
9763         always_keeps_input_sections_.
9764         *  output.h (Output_section::always_keeps_input_sections,
9765         Output_section::set_always_keeps_input_sections): New methods.
9766         (Output_section::always_keeps_input_sections): New data member.
9767
9768 2010-07-13  Rafael Espindola  <espindola@google.com>
9769
9770         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
9771         * fileread.h (Input_file): Add try_extra_search_path and find_file.
9772
9773 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
9774             Ian Lance Taylor  <iant@google.com>
9775
9776         * output.h (Output_section_lookup_maps::add_merge_section):
9777         Correct check of whether value was inserted.
9778         (Output_section_lookup_maps::add_merge_input_section): Likewise.
9779         (Output_section_lookup_maps::add_relaxed_input_section):
9780         Likewise.
9781         * arm.cc (Target_arm::got_section): Remove used local os.
9782         * i386.cc (Target_i386::got_section): Likewise.
9783         * x86_64.cc (Target_x86_64::got_section): Likewise.
9784         * sparc.cc (Target_sparc::got_section): Likewise.
9785         (Target_sparc::relocate): Remove unused local have_got_offset.
9786         * powerpc.cc (Target_powerpc::relocate): Likewise.
9787
9788 2010-07-13  Ian Lance Taylor  <iant@google.com>
9789
9790         * compressed_output.cc (zlib_decompress): Fix signature in
9791         !HAVE_ZLIB_H case.
9792
9793         * archive.cc (Archive::include_member): Unlock an external member
9794         of a thin archive.  Don't bother to delete an object we know is
9795         NULL.
9796
9797 2010-07-12  Cary Coutant  <ccoutant@google.com>
9798
9799         * compressed_output.cc (zlib_decompress): New function.
9800         (get_uncompressed_size): New function.
9801         (decompress_input_section): New function.
9802         * compressed_output.h (get_uncompressed_size): New function.
9803         (decompress_input_section): New function.
9804         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
9805         Handle compressed debug sections.
9806         * layout.cc (is_compressed_debug_section): New function.
9807         (Layout::output_section_name): Map compressed section names to
9808         canonical names.
9809         * layout.h (is_compressed_debug_section): New function.
9810         (is_debug_info_section): Recognize compressed debug sections.
9811         * merge.cc: Include compressed_output.h.
9812         (Output_merge_data::do_add_input_section): Handle compressed
9813         debug sections.
9814         (Output_merge_string::do_add_input_section): Handle compressed
9815         debug sections.
9816         * object.cc: Include compressed_output.h.
9817         (Sized_relobj::Sized_relobj): Initialize new data members.
9818         (build_compressed_section_map): New function.
9819         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
9820         * object.h (Object::section_is_compressed): New method.
9821         (Object::do_section_is_compressed): New method.
9822         (Sized_relobj::Compressed_section_map): New type.
9823         (Sized_relobj::do_section_is_compressed): New method.
9824         (Sized_relobj::compressed_sections_): New data member.
9825         * output.cc (Output_section::add_input_section): Handle compressed
9826         debug sections.
9827         * reloc.cc: Include compressed_output.h.
9828         (Sized_relobj::write_sections): Handle compressed debug sections.
9829
9830 2010-07-08  Cary Coutant  <ccoutant@google.com>
9831
9832         * resolve.cc (Symbol_table::resolve): Remember whether undef was
9833         weak when resolving to a dynamic def.
9834         (Symbol_table::should_override): Add adjust_dyndef flag; set it
9835         for weak undef/dynamic def cases. Adjust callers.
9836         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
9837         undef_binding_weak_.
9838         (Symbol_table::sized_write_globals): Adjust symbol binding.
9839         (Symbol_table::sized_write_symbol): Add binding parameter.
9840         * symtab.h (Symbol::set_undef_binding): New method.
9841         (Symbol::is_undef_binding_weak): New method.
9842         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
9843         (Symbol_table::should_override): Add new parameter.
9844         (Symbol_table::sized_write_symbol): Add new parameter.
9845
9846         * testsuite/weak_undef_file1.cc: Add new test case.
9847         * testsuite/weak_undef_file2.cc: Fix header comment.
9848         * testsuite/weak_undef_test.cc: Add new test case.
9849
9850 2010-06-29  Doug Kwan  <dougkwan@google.com>
9851
9852         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
9853         Initialize USE_SYMBOL_.
9854         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
9855         definition.
9856         (Arm_reloc_property::uses_symbol_): New data member declaration.
9857         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
9858         uses symbol value and symbol is undefined but not weakly undefined.
9859
9860 2010-06-28  Rafael Espindola  <espindola@google.com>
9861
9862         * plugin.cc (Plugin::load): Use dlerror.
9863
9864 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
9865
9866         * symtab.cc (detect_odr_violations): When reporting an ODR
9867         violation, report an object where the symbol is defined.
9868
9869 2010-06-25  Doug Kwan  <dougkwan@google.com>
9870
9871         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
9872         (Target_arm::section_may_have_icf_unsafe_pointers): New method
9873         definition.
9874         (Target_arm::Scan::local_reloc_may_be_function_pointer,
9875         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
9876         target hook to detect function points.
9877         (Target_arm::Scan::possible_function_pointer_reloc): New method.
9878         * icf.h (Icf::check_section_for_function_pointers): Change type of
9879         parameter SECTION_NAME to const reference to std::string.  Use
9880         target hook to determine if section may have unsafe pointers.
9881         * target.h (Target::section_may_have_icf_unsafe_pointers): New
9882         method definition.
9883
9884 2010-06-21  Rafael Espindola  <espindola@google.com>
9885
9886         * fileread.cc (Input_file::find_fie): New
9887         (Input_file::open): Use Input_file::find_fie.
9888         * fileread.h (Input_file::find_fie): New
9889         * plugin.cc (set_extra_library_path): New.
9890         (Plugin::load): Add set_extra_library_path to the transfer vector.
9891         (Plugin_manager::set_extra_library_path): New.
9892         (Plugin_manager::add_input_file): Use the extra search path if set.
9893         (set_extra_library_path(): New.
9894         * plugin.h (Plugin_manager): Add set_extra_library_path and
9895         extra_search_path_.
9896
9897 2010-06-19  Cary Coutant  <ccoutant@google.com>
9898
9899         * layout.cc (gdb_sections): Add .debug_types.
9900         (lines_only_debug_sections): Likewise.
9901
9902 2010-06-18  Rafael Espindola  <espindola@google.com>
9903
9904         * plugin.cc (add_input_file,add_input_library)
9905         (Plugin_manager::add_input_file): Make filename arguments const.
9906         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
9907         const.
9908
9909 2010-06-16  Doug Kwan  <dougkwan@google.com>
9910
9911         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
9912         .ARM.attributes section if we have not merged any input
9913         attributes sections.
9914
9915 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9916
9917         * arm.cc: Allow combining objects with no EABI version
9918         information.
9919
9920 2010-06-15  Rafael Espindola  <espindola@google.com>
9921
9922         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
9923
9924 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9925
9926         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
9927         (struct iovec): Correct !HAVE_READV definition.
9928
9929 2010-06-10  Cary Coutant  <ccoutant@google.com>
9930
9931         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
9932         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
9933         reloc sections.
9934         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
9935
9936         PR 11683
9937         * symtab.h (Symbol::is_placeholder): New member function.
9938         * target-reloc.h (relocate_section): Check for placeholder symbols.
9939
9940         * testsuite/Makefile.am (plugin_test_8): New test.
9941         (plugin_test_9): New test.
9942         * testsuite/Makefile.in: Regenerate.
9943
9944 2010-06-09  Nick Clifton  <nickc@redhat.com>
9945
9946         * yyscript.y (input_list_element): Allow strings prefixed with
9947         the '-' character.  Treat these as libraries.
9948         * script.cc (script_add_library): New function.  Adds a library
9949         specified by "-l<name>" found in an input script.
9950         * script-c.h: Add prototype for script_add_library.
9951
9952 2010-06-07  Doug Kwan  <dougkwan@google.com>
9953
9954         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
9955         Restrict stub-group size to be within long conditional branch
9956         range when working around cortex-A8 erratum.
9957
9958 2010-06-07  Damien Diederen  <dd@crosstwine.com>
9959
9960         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
9961         #ifdef typo.
9962
9963 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
9964
9965         PR gold/11658
9966         * output.cc
9967         (Output_section::Input_section_sort_entry::compare_section_ordering):
9968         Change to return non-zero correctly.
9969         (Output_section::Input_section_sort_section_order_index_compare
9970         ::operator()): Change to fix ambiguity in comparisons.
9971
9972 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
9973
9974         * gold.h (is_wildcard_string): New function.
9975         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
9976         (Layout::layout_eh_frame): Ditto.
9977         (Layout::find_section_order_index): New method.
9978         (Layout::read_layout_from_file): New method.
9979         * layout.h (Layout::find_section_order_index): New method.
9980         (Layout::read_layout_from_file): New method.
9981         (Layout::input_section_position_): New private member.
9982         (Layout::input_section_glob_): New private member.
9983         * main.cc (main): Call read_layout_from_file here.
9984         * options.h (--section-ordering-file): New option.
9985         * output.cc (Output_section::input_section_order_specified_): New
9986         member.
9987         (Output_section::Output_section): Initialize new member.
9988         (Output_section::add_input_section): Add new parameter.
9989         Keep input sections when --section-ordering-file is used.
9990         (Output_section::set_final_data_size): Sort input sections when
9991         section ordering file is specified.
9992         (Output_section::Input_section_sort_entry): Add new parameter.
9993         Check sorting type.
9994         (Output_section::Input_section_sort_entry::compare_section_ordering):
9995         New method.
9996         (Output_section::Input_section_sort_compare::operator()): Change to
9997         consider section_order_index.
9998         (Output_section::Input_section_sort_init_fini_compare::operator()):
9999         Change to consider section_order_index.
10000         (Output_section::Input_section_sort_section_order_index_compare
10001         ::operator()): New method.
10002         (Output_section::sort_attached_input_sections): Change to sort
10003         according to section order when specified.
10004         (Output_section::add_input_section<32, true>): Add new parameter.
10005         (Output_section::add_input_section<64, true>): Add new parameter.
10006         (Output_section::add_input_section<32, false>): Add new parameter.
10007         (Output_section::add_input_section<64, false>): Add new parameter.
10008         * output.h (Output_section::add_input_section): Add new parameter.
10009         (Output_section::input_section_order_specified): New
10010         method.
10011         (Output_section::set_input_section_order_specified): New method.
10012         (Input_section::Input_section): Initialize section_order_index_.
10013         (Input_section::section_order_index): New method.
10014         (Input_section::set_section_order_index): New method.
10015         (Input_section::section_order_index_): New member.
10016         (Input_section::Input_section_sort_section_order_index_compare): New
10017         struct.
10018         (Output_section::input_section_order_specified_): New member.
10019         * script-sections.cc (is_wildcard_string): Delete and move modified
10020         method to gold.h.
10021         (Output_section_element_input::Output_section_element_input): Modify
10022         call to is_wildcard_string.
10023         (Output_section_element_input::Input_section_pattern
10024         ::Input_section_pattern): Ditto.
10025         (Output_section_element_input::Output_section_element_input): Ditto.
10026         * testsuite/Makefile.am (final_layout): New test case.
10027         * testsuite/Makefile.in: Regenerate.
10028         * testsuite/final_layout.cc: New file.
10029         * testsuite/final_layout.sh: New file.
10030
10031 2010-06-01  Rafael Espindola  <espindola@google.com>
10032
10033         * plugin.cc (Plugin::load): Pass the output name to the plugin.
10034
10035 2010-06-01  Rafael Espindola  <espindola@google.com>
10036
10037         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
10038         visibility of symbols.
10039
10040 2010-05-27  Doug Kwan  <dougkwan@google.com>
10041
10042         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
10043         from start of output section instead of address for a local symbol
10044         in a merged or relaxed section when doing a relocatable link.
10045
10046 2010-05-26  Rafael Espindola  <espindola@google.com>
10047
10048         PR 11604
10049         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
10050         adding sections the garbage collector removed.
10051         * gold/testsuite/Makefile.am: Add test.
10052         * gold/testsuite/Makefile.in: Regenerate.
10053         * gold/testsuite/plugin_test_7.sh: New.
10054         * gold/testsuite/plugin_test_7_1.c: New.
10055         * gold/testsuite/plugin_test_7_2.c: New.
10056
10057 2010-05-26  Rafael Espindola  <espindola@google.com>
10058
10059         * script-sections.cc (Output_section_definition::set_section_addresses):
10060         Check for --section-start.
10061
10062 2010-05-26  Doug Kwan  <dougkwan@google.com>
10063
10064         * arm.cc (Arm_scan_relocatable_relocs): New class.
10065         (Target_arm::relocate_special_relocatable): New method.
10066         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
10067         (Arm_relocate_functions::thumb_branch_common): Same.
10068         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
10069         instead of Default_scan_relocatable_relocs.
10070         * target-reloc.h (relocate_for_relocatable): Let target handle
10071         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
10072         * target.h (Sized_target::relocate_special_relocatable): New method.
10073
10074 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10075
10076         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
10077
10078 2010-05-23  Doug Kwan  <dougkwan@google.com>
10079
10080         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
10081         instead of a cast.
10082         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
10083         with a direct branch, not a conditional branch, to a stub.
10084         * merge.cc (Output_merge_base::record_input_section): New method
10085         defintion.
10086         (Output_merge_data::do_add_input_section): Record input section if
10087         keeps-input-sections flag is set.
10088         (Output_merge_string::do_add_input_section): Ditto.
10089         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
10090         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
10091         INPUT_SECTIONS_.
10092         (Output_merge_base::keeps_input_sections,
10093         Output_merge_base::set_keeps_input_sections,
10094         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
10095         method definitions.
10096         (Output_merge_base::Input_sections): New type declaration.
10097         (Output_merge_base::input_sections_begin,
10098         Output_merge_base::input_sections_end,
10099         Output_merge_base::do_set_keeps_input_sections): New method definitions.
10100         (Output_merge_base::bool keeps_input_sections_,
10101         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
10102         Output_merge_base::input_sections_): New data members.
10103         (Output_merge_data::do_set_keeps_input_sections): New method
10104         defintion.
10105         (Output_merge_string::do_set_keeps_input_sections): Ditto.
10106         * output.cc (Output_section::Input_section::relobj): Move method
10107         defintion from class declaration to here and handle merge sections.
10108         (Output_section::Input_section::shndx): Ditto.
10109         (Output_section::Output_section): Remove initializations of removed
10110         data members and initialize new data member LOOKUP_MAPS_.
10111         (Output_section::add_input_section): Set keeps-input-sections flag
10112         for a newly created merge output section as appropriate.  Adjust code
10113         to use Output_section_lookup_maps class.
10114         (Output_section::add_relaxed_input_section): Adjst code for lookup
10115         maps code refactoring.
10116         (Output_section::add_merge_input_section): Add a new parameter
10117         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
10118         class.  If adding input section to a newly created merge output
10119         section fails, remove the new merge section.
10120         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
10121         Adjust code for use of the Output_section_lookup_maps class.
10122         (Output_section::find_merge_section): Ditto.
10123         (Output_section::build_lookup_maps): New method defintion.
10124         (Output_section::find_relaxed_input_section): Adjust code to use
10125         Output_section_lookup_maps class.
10126         (Output_section::get_input_sections): Export merge sections.  Adjust
10127         code to use Output_section_lookup_maps class.
10128         (Output_section:::add_script_input_section): Adjust code to use
10129         Output_section_lookup_maps class.  Update lookup maps for merge
10130         sections also.
10131         (Output_section::discard_states): Use Output_section_lookup_maps.
10132         (Output_section::restore_states): Same.
10133         * output.h (Merge_section_properties): Move class defintion out of
10134         Output_section.
10135         (Output_section_lookup_maps): New class.
10136         (Output_section::Input_section::is_merge_section): New method
10137         defintion.
10138         (Output_section::Input_section::relobj): Move defintion out of class
10139         defintion.  Declare method only.
10140         (Output_section::Input_section::shndx): Ditto.
10141         (Output_section::Input_section::output_merge_base): New method defintion.
10142         (Output_section::Input_section::u2_.pomb): New union field.
10143         (Output_section::Merge_section_by_properties_map,
10144         Output_section::Output_section_data_by_input_section_map,
10145         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
10146         Remove types.
10147         (Output_section::add_merge_input_section): Add new parameter
10148         KEEPS_INPUT_SECTIONS.
10149         (Output_section::build_lookup_maps): New method declaration.
10150         (Output_section::merge_section_map_,
10151         Output_section::merge_section_by_properties_map_,
10152         Output_section::relaxed_input_section_map_,
10153         Output_section::is_relaxed_input_section_map_valid_): Remove data
10154         members.
10155         (Output_section::lookup_maps_): New data member.
10156
10157 2010-05-21  Doug Kwan  <dougkwan@google.com>
10158
10159         PR gold/11619
10160         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
10161         avoid a compilation error.
10162
10163 2010-05-19  Rafael Espindola  <espindola@google.com>
10164
10165         * script-sections.cc (Output_section_definition::allocate_to_segment):
10166         Update the phdrs_list even when the output section is NULL.
10167         * testsuite/Makefile.am: Add test.
10168         * testsuite/Makefile.in: Regenerate.
10169         * testsuite/script_test_9.cc: New.
10170         * testsuite/script_test_9.sh: New.
10171         * testsuite/script_test_9.t: New.
10172
10173 2010-05-19  Doug Kwan  <dougkwan@google.com>
10174
10175         * arm.cc (Arm_input_section::original_size): New method.
10176         (Arm_input_section::do_addralign): Add a cast.
10177         (Arm_input_section::do_output_offset): Remove static cast.
10178         (Arm_input_section::original_addralign,
10179          Arm_input_section::original_size_): Change type to uint32_t.
10180         (Arm_input_section::init): Add safe casts for section alignment
10181         and size.
10182         (Arm_input_section::set_final_data_size): Do not set address and
10183         offset of stub table.
10184         (Arm_output_section::fix_exidx_coverage): Change use of of
10185         Output_section::Simple_input_section to that of
10186         Output_section::Input_section.
10187         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
10188         except for the first pass.
10189         * output.cc (Output_section::get_input_sections): Change type of
10190         input_sections to std::list<Input_section>.
10191         (Output_section::add_script_input_section): Rename from
10192         Output_section::add_simple_input_section.  Change type of SIS
10193         parameter from Simple_input_section to Input_section.
10194         * output.h (Output_section::Simple_input_section): Remove class.
10195         (Output_section::Input_section): Change class visibility to public.
10196         (Output_section::Input_section::addralign): Use stored alignments
10197         for special input sections if set.
10198         (Output_section::Input_section::set_addralign): New method.
10199         (Output_section::get_input_sections): Change parameter type from
10200         list of Simple_input_section to list of Input_section.
10201         (Output_section::add_script_input_section): Rename from
10202         Output_section::add_simple_input_section. Change first parameter's
10203         type from Simple_input_section to Input_section and remove the
10204         second and third parameters.
10205         * script-sections.cc (Input_section::Input_section_list): Change
10206         type to list of Output_section::Input_section/
10207         (Input_section_info::Input_section_info): Change parameter type of
10208         INPUT_SECTION to Output_section::Input_section.
10209         (Input_section_info::input_section): Change return type.
10210         (Input_section_info::input_section_): Change type to
10211         Output_section::Input_section.
10212         (Output_section_element_input::set_section_addresses): Adjust code
10213         to use Output_section::Input_section instead of
10214         Output_section::Simple_input_section.  Adjust code for renaming
10215         of Output_section::add_simple_input_section.
10216         (Orphan_output_section::set_section_addresses): Ditto.
10217
10218 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10219
10220         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
10221         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
10222
10223 2010-05-18  Rafael Espindola  <espindola@google.com>
10224
10225         * options.cc (General_options::finalize): Handle -nostdlib.
10226         * options.h (nostdlib): New option.
10227         * script.cc (script_add_search_dir): Handle -nostdlib.
10228
10229 2010-05-12  Doug Kwan  <dougkwan@google.com>
10230
10231         * arm.cc (Target_arm::do_finalize_sections): Create an empty
10232         attributes section only if there no attributes section after merging.
10233         (Target_arm::merge_object_attributes): Move value of
10234         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
10235         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
10236         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
10237         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
10238         and arm_attr_merge_7.stdout.
10239         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
10240         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
10241         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
10242         arm_attr_merge_7b.o): New rules.
10243         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
10244         arm_attr_merge_7
10245         * testsuite/Makefile.in: Regenerate.
10246         * testsuite/arm_attr_merge.sh: New file.
10247         * testsuite/arm_attr_merge_[67][ab].s: Same.
10248
10249 2010-05-05  Nick Clifton  <nickc@redhat.com>
10250
10251         * po/es.po: Updated Spanish translation.
10252
10253 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
10254
10255         * Makefile.am (install-exec-local): Properly install gold as
10256         default cross linker.
10257         * Makefile.in: Regenerated.
10258
10259 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
10260             Nick Clifton  <nickc@redhat.com>
10261
10262         * configure.ac (install_as_default): Define and set to false
10263         unless --enable-gold or --enable-gold=both/gold has been
10264         specified.
10265         * configure: Regenerate.
10266
10267         * Makefile.am (install-exec-local): Install the executable as
10268         'ld.gold'.  If install_as_default is true then also install it as
10269         'ld'.
10270         * Makefile.in: Regenerated.
10271
10272 2010-04-24  Ian Lance Taylor  <iant@google.com>
10273
10274         * layout.cc (Layout::layout_reloc): In relocatable link don't
10275         combine reloc sections for grouped sections.
10276
10277 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
10278
10279         * gc.h (gc_process_relocs): Pass information on relocs pointing to
10280         sections that are not ordinary to icf.
10281         * icf.cc (get_section_contents): Handle relocation pointing to section
10282         with no object or shndx information.
10283         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
10284         * testsuite/Makefile.in: Regenerate.
10285         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
10286         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
10287
10288 2010-04-22  Ian Lance Taylor  <iant@google.com>
10289
10290         * expression.cc (Expression::Expression_eval_info): Add
10291         result_alignment_pointer field.
10292         (Expression::eval_with_dot): Add result_alignment_pointer
10293         parameter.  Change all callers.
10294         (Expression::eval_maybe_dot): Likewise.
10295         (class Binary_expression): Add alignment_pointer parameter to
10296         left_value and right_value.  Change all callers.
10297         (BINARY_EXPRESSION): Set result alignment.
10298         (class Trinary_expression): Add alignment_pointer parameter to
10299         arg2_value and arg3_value.  Change all callers.
10300         (Trinary_cond::value): Set result alignment.
10301         (Max_expression::value, Min_expression::value): Likewise.
10302         (Align_expression::value): Likewise.
10303         * script-sections.cc (class Sections_element): Add dot_alignment
10304         parameter to set_section_addresses virtual function.  Update
10305         instantiations.
10306         (class Output_section_element): Likewise.
10307         (Script_sections::create_segments): Add dot_alignment parameter.
10308         Change all callers.
10309         (Script_sections::create_segments_from_phdrs_clause): Likewise.
10310         (Script_sections::set_phdrs_clause_addresses): Likewise.
10311         * script-sections.h: Update declarations.
10312         * script.h: Update declarations.
10313         * output.h (Output_segment::set_minimum_p_align): Don't decrease
10314         min_p_align.
10315         * testsuite/script_test_3.t: Set large alignment.
10316         * testsuite/script_test_3.sh: Make sure that at least one LOAD
10317         segment has expected alignment.
10318
10319 2010-04-22  Nick Clifton  <nickc@redhat.com>
10320
10321         * po/gold.pot: Updated by the Translation project.
10322         * po/vi.po: Updated Vietnamese translation.
10323
10324 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
10325
10326         * testsuite/Makefile.am (check_PROGRAMS): Add
10327         icf_virtual_function_folding_test.
10328         * testsuite/Makefile.in: Regenerated.
10329
10330 2010-04-15  Andrew Haley  <aph@redhat.com>
10331
10332         * options.h (merge_exidx_entries): New option.
10333         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
10334         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
10335         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
10336         (Target_arm::merge_exidx_entries): New function.
10337         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
10338         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
10339         to Arm_exidx_fixup constructor.
10340         Add new arg, merge_exidx_entries.
10341         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
10342         Arm_output_section::fix_exidx_coverage.
10343
10344 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
10345
10346         * icf.cc (get_section_contents): Check for preemptible functions.
10347         Ignore addend when appropriate.
10348         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
10349         section folded.
10350         (add_from_relobj): Check for section folded.
10351         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
10352         * symtab.h (should_add_dynsym_entry): Add new parameter.
10353         * target-reloc.h (scan_relocs): Check for section folded.
10354         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
10355         Check reloc types for function pointers in shared objects.
10356         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
10357         case.
10358         (icf_preemptible_functions_test): New test case.
10359         (icf_string_merge_test): New test case.
10360         * testsuite.Makefile.in: Regenerate.
10361         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
10362         bar_glob.  Refactor code.
10363         * testsuite/icf_preemptible_functions_test.cc: New file.
10364         * testsuite/icf_preemptible_functions_test.sh: New file.
10365         * testsuite/icf_string_merge_test.cc: New file.
10366         * testsuite/icf_string_merge_test.sh: New file.
10367         * testsuite/icf_virtual_function_folding_test.cc: New file.
10368         * testsuite/icf_virtual_function_folding_test.sh: New file.
10369
10370 2010-04-14  Doug Kwan  <dougkwan@google.com>
10371
10372         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
10373         for local symbol recounting if we remove a section due to ICF.
10374         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
10375         there are no regular objects in input.
10376
10377 2010-04-13  Doug Kwan  <dougkwan@google.com>
10378
10379         * arm.cc (Arm_input_section::set_final_data_size): Compute
10380         accurate final data size instead of using current data size.
10381
10382 2010-04-09  Doug Kwan  <dougkwan@google.com>
10383
10384         * layout.cc (Layout::choose_output_section): Handle script section
10385         types.
10386         (Layout::make_output_section_for_script): Add section type parameter.
10387         Handle script section types.
10388         * layout.h (Layout::make_output_section_for_script): Add section
10389         type parameter.
10390         * output.cc (Output_section::Output_section): Initialize data member
10391         is_noload_.
10392         (Output_section::do_reset_address_and_file_offset): Do not set address
10393         to 0 if section is a NOLOAD section.
10394         * output.h (Output_section::is_noload): New method.
10395         (Output_section::set_is_noload): Ditto.
10396         (Output_section::is_noload_): New data member.
10397         * script-c.h (Script_section_type): New enum type.
10398         (struct Parser_output_section_header): Add new file section_type.
10399         * script-sections.cc (Sections_element::output_section_name): Add
10400         parameter for returning script section type.
10401         (Output_section_definition::output_section_name): Ditto.
10402         (Output_section_definition::section_type)P; New method.
10403         (Output_section_definiton::script_section_type_name): Ditto.
10404         (Output_section_definition::script_section_type_): New data member.
10405         (Output_section_definition::Output_section_definition): Initialize
10406         data member Output_section_definition::script_section_type_.
10407         (Output_section_definition::create_sections): Pass script section type
10408         to Layout::make_output_section_for_script.
10409         (Output_section_definition::output_section_name): Return script
10410         section type to caller.
10411         (Output_section_definition::set_section_address): Do not advance
10412         dot value and load address if section type is NOLOAD.  Set address
10413         of NOLOAD sections regardless of section flags.
10414         (Output_section_definition::print): Print section type if it is
10415         not SCRIPT_SECTION_TYPE_NONE.
10416         (Output_section_definition::section_type): New method.
10417         (Output_section_definition::script_section_type_name): Ditto.
10418         (Script_sections::output_section_name): Add new parameter
10419         PSECTION_TYPE for returning script section type.  Pass it to
10420         section elements.  Handle discard sections.
10421         (Sort_output_sections::operator()): Handle NOLOAD sections.
10422         * script-sections.h (Script_sections::Section_type): New enum type.
10423         (Script_sections::output_section_name): Add a new parameter for
10424         returning script section type.
10425         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
10426         INFO and NOLOAD.
10427         * yyscript.y (union): Add new field SECTION_TYPE.
10428         (COPY, DSECT, INFO, NOLOAD): New tokens.
10429         (opt_address_and_section_type): Change type to output_section_header.
10430         (section_type): New non-terminal
10431         (section_header): Handle section type.
10432         (opt_address_and_section_type): Return section type value.
10433
10434 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
10435
10436         * testsuite/plugin_common_test_1.c (foo): Add prototype.
10437         * testsuite/plugin_common_test_2.c (foo): Likewise.
10438
10439 2010-04-08  Doug Kwan  <dougkwan@google.com>
10440
10441         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
10442         Output_merge_data.
10443         * output.cc (Output_section::add_merge_input_section): Simplify
10444         code and return status of Output_merge_base::add_input_section.
10445         Update merge section map only if Output_merge_base::add_input_section
10446         returns true.
10447
10448 2010-04-07  Doug Kwan  <dougkwan@google.com>
10449
10450         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
10451         if section is marked as containing instructions but has no mapping
10452         symbols.
10453         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
10454         correct section index.
10455         (Arm_relobj::find_linked_text_section): Ditto.
10456
10457 2010-04-07  Cary Coutant  <ccoutant@google.com>
10458
10459         * archive.cc (include_member): Destroy Read_symbols_data object before
10460         releasing file.
10461         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
10462         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
10463         (Read_symbols_data::~Read_symbols_data) New destructor.
10464         (Section_relocs::Section_relocs) New constructor.
10465         (Section_relocs::~Section_relocs) New destructor.
10466         (Read_relocs_data::Read_relocs_data) New constructor.
10467         (Read_relocs_data::~Read_relocs_data) New destructor.
10468         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
10469         pointers to NULL after deleting.
10470
10471 2010-04-07  Doug Kwan  <dougkwan@google.com>
10472
10473         * arm.cc: Replace "endianity" with "endianness" in comments.
10474         (Arm_exidx_cantunwind): Ditto.
10475         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
10476         (Arm_relobj::merge_flags_and_attributes): New method.
10477         (Arm_relobj::merge_flags_and_attributes_): New data member.
10478         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
10479         (Arm_relobj::scan_sections_for_stubs): Ditto.
10480         (Arm_relobj::do_read_symbols): Check to see if we really want to
10481         merge processor-specific flags and attributes.  Exit early if
10482         an object is empty except for section names and the undefined symbol.
10483         (Target_arm::do_finalize_sections): Move check for ELF format to
10484         Arm_relobj::do_read_symbols.  Merge processor specific flags and
10485         attributes from a regular object only when we have determined that
10486         it is aapropriate.  Do not create an .ARM.attributes section in
10487         output if there is no regular input object.
10488         (Target_arm::merge_processor_specific_flags): Check
10489         --warn-mismatch before printing any error.
10490         (Target_arm::merge_object_attributes): Ditto.
10491         * gold.cc (queue_middle_tasks): Handle the case in which there is
10492         no regular object in input.
10493         * options.cc (General_options::parse_EB): New method.
10494         (General_options::parse_EL): Same.
10495         (General_options::General_options): Initialize endianness_.
10496         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
10497         New options.
10498         (General_options::Endianness): New enum.
10499         (General_options::endianness): New method.
10500         (General_options::endianness_): New data member.
10501         * parameters.cc (Parameters::set_options): Check target endianness.
10502         (Parameters::set_target_once): Ditto.
10503         (Parameters::check_target_endianness): New method.
10504         (parameters_force_valid_target): If either -EL or -EB is specified,
10505         use it to define endianness of default target.
10506         * parameters.h (Parameters::check_target_endianness): New method
10507         declaration.
10508         * target.h (class Target): Change "endianity" to "endianness"
10509         in comments.
10510
10511 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10512
10513         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
10514         * configure: Regenerate.
10515         * Makefile.in: Regenerate.
10516         * testsuite/Makefile.in: Regenerate.
10517
10518 2010-04-06  Cary Coutant  <ccoutant@google.com>
10519
10520         gcc PR lto/42757
10521         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
10522         prevailing definitions of common symbols.
10523         * testsuite/plugin_test_6.sh: New test case.
10524         * testsuite/plugin_common_test_1.c: New test case.
10525         * testsuite/plugin_common_test_2.c: New test case.
10526         * testsuite/Makefile.am (plugin_test_6): New test case.
10527         * testsuite/Makefile.in: Regenerate.
10528
10529 2010-04-06  Nick Clifton  <nickc@redhat.com>
10530
10531         * po/vi.po: New Vietnamese translation.
10532
10533 2010-03-30  Doug Kwan  <dougkwan@google.com>
10534
10535         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
10536
10537 2010-03-25  Doug Kwan  <dougkwan@google.com>
10538
10539         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
10540         to avoid a conversion warning on a 32-bit host.
10541
10542 2010-03-24  Ian Lance Taylor  <iant@google.com>
10543
10544         * testsuite/script_test_3.t: Add a TLS segment.
10545         * testsuite/Makefile.am (check_PROGRAMS): Add
10546         tls_phdrs_script_test.
10547         (tls_phdrs_script_test_SOURCES): Define.
10548         (tls_phdrs_script_test_DEPENDENCIES): Define.
10549         (tls_phdrs_script_test_LDFLAGS): Define.
10550         (tls_phdrs_script_test_LDADD): Define.
10551         * testsuite/Makefile.in: Rebuild.
10552
10553 2010-03-23  Cary Coutant  <ccoutant@google.com>
10554
10555         * fileread.cc (find_or_make_view): Fix comment.
10556
10557 2010-03-23  Ian Lance Taylor  <iant@google.com>
10558
10559         * script-sections.cc (class Orphan_section_placement): Define
10560         PLACE_TLS and PLACE_TLS_BSS.
10561         (Orphan_section_placement::Orphan_section_placement): Initialize
10562         new places.
10563         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
10564         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
10565         (tls_script_test_SOURCES): Define.
10566         (tls_script_test_DEPENDENCIES): Define.
10567         (tls_script_test_LDFLAGS): Define.
10568         (tls_script_test_LDADD): Define.
10569         * testsuite/Makefile.in: Rebuild.
10570
10571 2010-03-22  Doug Kwan  <dougkwan@google.com>
10572
10573         * arm.cc (Arm_relocate_functions::abs8,
10574         Arm_relocate_functions::abs16): Use correct check for overflow
10575         specified in the ARM ELF specs.
10576         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
10577         target of a BLX instruction specially.
10578         (Reloc_stub::stub_type_for_reloc): Ditto.
10579         (Relocate::relocate): Use symbolic names instead of numeric relocation
10580         codes to report error.
10581         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
10582         workaround.
10583         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
10584         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
10585         thumb2_blx_out_of_range.stdout
10586         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
10587         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
10588         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
10589         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
10590         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
10591         thumb2_blx_in_range, thumb2_blx_in_range.o,
10592         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
10593         thumb2_blx_out_of_range.o): New rules.
10594         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
10595         thumb2_blx_in_range and thumb2_blx_out_of_range.
10596         * testsuite/Makefile.in: Regenerate.
10597         * arm_branch_in_range.sh: Add tests for THUMB BLX.
10598         * testsuite/thumb_blx_in_range.s: New file.
10599         * testsuite/thumb_blx_out_of_range.s: New file.
10600
10601 2010-03-22  Rafael Espindola  <espindola@google.com>
10602
10603         * archive.cc (Should_include): Move to archive.h.
10604         (should_include_member): Make it a member of Archive.
10605         (Lib_group): New.
10606         (Add_lib_group_symbols): New.
10607         * archive.h: Include options.h.
10608         (Archive_member): Moved from Archive.
10609         (Should_include): Moved from archive.cc.
10610         (Lib_group): New.
10611         (Add_lib_group_symbols): New.
10612         * dynobj.cc (do_should_include_member): New.
10613         * dynobj.h (do_should_include_member): New.
10614         * gold.cc (queue_initial_tasks): Update call to queue.
10615         * main.cc (main): Print lib group stats.
10616         * object.cc (do_should_include_member): New.
10617         * object.h: Include archive.h.
10618         (Object::should_include_member): New.
10619         (Object::do_should_include_member): New.
10620         (Sized_relobj::do_should_include_member): New.
10621         * options.cc (General_options::parse_start_lib): New.
10622         (General_options::parse_end_lib): New.
10623         (Input_arguments::add_file): Handle lib groups.
10624         (Input_arguments::start_group): Check we are not in a lib.
10625         (Input_arguments::start_lib): New.
10626         (Input_arguments::end_lib): New.
10627         * options.h (General_options): Add start_lib and end_lib.
10628         (Input_argument::lib_): New.
10629         (Input_argument::lib): New.
10630         (Input_argument::is_lib): New.
10631         (Input_file_lib): New.
10632         (Input_arguments::in_lib_): New.
10633         (Input_arguments::in_lib): New.
10634         (Input_arguments::start_lib): New.
10635         (Input_arguments::end_lib_): New.
10636         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
10637         in unused members as preempted.
10638         (Sized_pluginobj::do_should_include_member): New.
10639         * plugin.h (Sized_pluginobj::do_should_include_member): New.
10640         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
10641         return the blocker.
10642         (Read_symbols::do_whole_lib_group): New.
10643         (Read_symbols::do_lib_group): New.
10644         (Read_symbols::do_read_symbols): Handle lib groups.
10645         (Read_symbols::get_name): Handle lib groups.
10646         * readsyms.h (Read_symbols): Add an archive member pointer.
10647         (Read_symbols::do_whole_lib_group): New.
10648         (Read_symbols::do_lib_group): New.
10649         (Read_symbols::member_): New.
10650         * script.cc (read_input_script): Update call to queue_soon.
10651
10652 2010-03-19  Doug Kwan  <dougkwan@google.com>
10653
10654         * arm.cc (Stub_table::Stub_table): Initialize new data members
10655         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10656         (Stub_table::add_reloc_stub): Assign stub offset and update
10657         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10658         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
10659         New data members.
10660         (Stub_table::update_data_size_and_addralign): Use
10661         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
10662         instead of going over all reloc stubs.
10663         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
10664         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10665         Stringpool_template::offset_ to size of Stringpool_char.
10666         (Stringpool_template::new_key_offset): Remove code to initialize
10667         Stringpool_template::offset_.
10668         * stringpool.h (Stringpool_template::set_no_zero_null): Set
10669         Stringpool_template::offset_ to zero.
10670
10671 2010-03-15  Doug Kwan  <dougkwan@google.com>
10672
10673         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10674         offset_.
10675         (Stringpool_template::new_key_offset): New method.
10676         (Stringpool_template::add_string): Assign offsets when adding new
10677         strings.
10678         (Stringpool_template::set_string_offsets): Do not set string offsets
10679         when not optimizing.
10680         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
10681         member size_.
10682         (Chunked_vector::clear): Clear size_.
10683         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
10684         (Chunked_vector::size): Return size_.
10685         (Chunked_vector::push_back): Use size_ to find insert position.
10686         (Chunked_vector::size_): New data member.
10687         (Stringpool_template::set_no_zero_null): Assert string set is empty.
10688         (Stringpool_template::new_key_offset): New method declaration.
10689         (Stringpool_template::offset_): New data member.
10690
10691 2010-03-15   Rafael Espindola  <espindola@google.com>
10692
10693         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
10694         Add_symbols' constructor.
10695         * readsyms.h (Add_symbols): Remove the input_group member.
10696
10697 2010-03-10  Ian Lance Taylor  <iant@google.com>
10698
10699         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
10700         target to ask whether a reference to a symbol requires a stack
10701         split.
10702         * target.h (Target::is_call_to_non_split): New function.
10703         (Target::do_is_call_to_non_split): Declare virtual function.
10704         * target.cc: Include "symtab.h".
10705         (Target::do_is_call_to_non_split): New function.
10706         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
10707
10708 2010-03-10  Cary Coutant  <ccoutant@google.com>
10709
10710         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
10711         (File_read::open[1]): Remove initial mapping of whole_file_view_.
10712         (File_read::open[2]): Add whole_file_view_ to list of views.
10713         (File_read::make_view): Remove test of whole_file_view_.
10714         (File_read::find_or_make_view): Create whole_file_view_ if
10715         necessary.
10716         (File_read::clear_views): Replace bool parameter with enum;
10717         adjust all callers.  Don't delete views with permanent data;
10718         do delete cached views and views from archives if
10719         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
10720         if clearing the corresponding view.
10721         * fileread.h (File_read::Clear_views_mode): New enum.
10722         (File_read::View::is_permanent_view): New method.
10723         (File_read::clear_views): Replace bool parameter
10724         with enum; adjust all callers.
10725         * options.h (General_options): Change keep_files_mapped option;
10726         add map_whole_files.
10727         * readsyms.cc (Add_symbols::run): Delete sd_ object before
10728         releasing the file.
10729         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
10730         the file.
10731
10732 2010-03-10  David S. Miller  <davem@davemloft.net>
10733
10734         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
10735
10736 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
10737
10738         * icf.cc (get_section_contents): Add '@' marker after processing the
10739         merge reloc.
10740
10741 2010-03-08  Doug Kwan  <dougkwan@google.com>
10742
10743         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
10744         due to a conversion warning.
10745         (Arm_relobj::update_output_local_symbol_count): Check for local
10746         symbol with unset output index.
10747
10748 2010-03-05  Ian Lance Taylor  <iant@google.com>
10749
10750         * options.h (class General_options): Add --spare-dynamic-tags.
10751         * output.cc (Output_data_dynamic::set_final_data_size): Implement
10752         --spare-dynamic-tags.
10753
10754 2010-03-05  Ian Lance Taylor  <iant@google.com>
10755
10756         * incremental.cc: Include "libiberty.h".
10757
10758 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
10759
10760         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
10761         function, is_info_ member.
10762         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
10763         (Versions::Versions): Update caller.
10764         (Versions::define_base_version): Likewise.
10765         (Versions::add_def): Likewise.
10766
10767 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
10768
10769         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
10770         (Scan::possible_function_pointer_reloc): New function.
10771         (Scan::local_reloc_may_be_function_pointer): Change to call
10772         possible_function_pointer_reloc.
10773         (Scan::global_reloc_may_be_function_pointer): Ditto.
10774         * icf.h (Icf::check_section_for_function_pointers): Change to reject
10775         relocations in ".data.rel.ro._ZTV" section.
10776         * testsuite/icf_safe_so_test.sh: Change to pass i386.
10777         * testsuite/icf_safe_so_test.cc: Ditto.
10778         * testsuite/icf_safe_test.cc: Ditto.
10779         * testsuite/icf_safe_test.sh: Ditto.
10780
10781 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10782             Ian Lance Taylor  <iant@google.com>
10783
10784         * target-reloc.h (relocate_section): Check the symbol table index
10785         for -1U before setting the local symbol index.
10786         (scan_relocatable_relocs): If copying the relocation, record that
10787         the local symbol is required.
10788         * object.h (Symbol_value::is_output_symtab_index_set): New
10789         function.
10790         (Symbol_value::may_be_discarded_from_output_symtab): New
10791         function.
10792         (Symbol_value::has_output_symtab_entry): New function.
10793         (Symbol_value::needs_output_symtab_entry): Remove.
10794         (Symbol_value::output_symtab_index): Make sure the symbol index is
10795         set.
10796         (Symbol_value::set_output_symtab_index): Make sure the symbol
10797         index is not set.  Make sure the new index is valid.
10798         (Symbol_value::set_must_have_output_symtab_entry): New function.
10799         (Symbol_value::has_output_dynsym_entry): New function.
10800         (Symbol_value::set_output_dynsym_index): Make sure the new index
10801         is valid.
10802         (Sized_relobj::set_must_have_output_symtab_entry): New function.
10803         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
10804         local symbol if permitted.
10805         (Sized_relobj::do_finalize_local_symbols): Call
10806         is_output_symtab_index_set rather than needs_output_symtab_entry.
10807         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
10808         rather than needs_output_symtab_entry.  Call
10809         has_output_dynsym_entry rather than needs_output_dynsym_entry.
10810         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
10811         is_output_symtab_index_set rather than needs_output_symtab_entry.
10812         * testsuite/discard_locals_relocatable_test.c: New file.
10813         * testsuite/discard_locals_test.sh: Test -r.
10814         * testsuite/Makefile.am (check_DATA): Add
10815         discard_locals_relocatable_test1.syms,
10816         discard_local_relocatable_test2.syms.
10817         (MOSTLYCLEANFILES): Likewise.  Also add
10818         discard_locals_relocatable_test1.lout and
10819         discard_locals_relocatable_test2.out.
10820         (discard_locals_relocatable_test1.syms): New target.
10821         (discard_locals_relocatable_test.o): New target.
10822         (discard_locals_relocatable_test1.out): New target.
10823         (discard_locals_relocatable_test2.syms): New target.
10824         (discard_locals_relocatable_test2.out): New target.
10825         (various): Add missing ../ld-new dependencies.
10826         * testsuite/Makefile.in: Rebuild.
10827
10828 2010-03-03  Nick Clifton  <nickc@redhat.com>
10829
10830         * po/fi.po: New Finnish translation.
10831
10832 2010-03-01  Doug Kwan  <dougkwan@google.com>
10833
10834         * layout.cc (Layout::Layout): Force section types of .init_array*,
10835         .preinit_array* and .fini_array* sections.
10836         * output.cc (Output_section::Input_section_sort_entry::has_priority):
10837         Fix check of return value of std::string::find.().
10838         (Output_section::Input_section_sort_compare::operator()): Remove
10839         comment about .init_array.
10840         (Output_section::Input_section_sort_init_fini_compare::operator()):
10841         New method.
10842         (Output_section::sort_attached_input_sections): Handle .init_array
10843         and .fini_array specially.
10844         * output.h (Output_section::Inut_section_sort_compare): Update
10845         comment.
10846         (Output_section::Input_section_sort_init_fini_compare): New struct.
10847
10848 2010-02-26  Doug Kwan  <dougkwan@google.com>
10849
10850         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
10851         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
10852         * testsuite/debug_msg.sh: Avoid matching source line number for
10853         use of global variable undef_int.
10854
10855 2010-02-26  Doug Kwan  <dougkwan@google.com>
10856
10857         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
10858         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
10859         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
10860         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
10861         * options.cc (General_options::General_options): Initialize member
10862         fix_v4bx_.
10863         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
10864         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
10865         and rm_no_fix_v4bx.stdout
10866         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
10867         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
10868         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
10869         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
10870         and arm_no_fix_v4bx.
10871         * Makefile.in: Regenerate.
10872         * testsuite/arm_fix_v4bx.s: New file.
10873         * testsuite/arm_fix_v4bx.sh: Ditto.
10874
10875 2010-02-24  Doug Kwan  <dougkwan@google.com>
10876
10877         * arm.cc (Target_arm::got_section): Make the .got section the first
10878         non RELRO section in the data segment.
10879         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
10880         suffixes of section names.
10881
10882 2010-02-24  Doug Kwan  <dougkwan@google.com>
10883
10884         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
10885         flags and attributes merging if an input file is a binary file.
10886         * fileread.cc (Input_file::open): Record format of original file.
10887         * fileread.h (Input_file::Format): New enum type.
10888         (Input_file::Input_file): Initialize data member format_.
10889         (Input_file::format): New method definition.
10890         (Input_file::format_):: New data member.
10891
10892 2010-02-24  Doug Kwan  <dougkwan@google.com>
10893
10894         * arm.cc (Arm_output_data_got): New class.
10895         (ARM_TCB_SIZE): New constant
10896         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
10897         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10898         If user uses a script with a SECTIONS clause, issue only a warning
10899         for a misplaced EXIDX input section.  Otherwise, issue an error.
10900         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
10901         garbage collection.
10902         (Target_arm::got_mode_index_entry): Handle static linking.
10903         (Target_arm::Scan::local): Ditto.
10904         (Target_arm::Scan::global): Ditto.
10905         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
10906         all incorrectly implemented relocations.
10907         (Target_arm::fix_exidx_coverage): Pass layout to
10908         Arm_output_section::fix_exidx_coverage.
10909         * layout.cc (Layout::section_name_mapping): Remove trailing dots
10910         from ".ARM.exidx." and ".ARM.extab.".
10911
10912 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10913
10914         * arm.cc (Target_arm::do_finalize_sections): Create attribute
10915         section if it does not already exist.
10916         * attributes.cc (Attributes_section_data::Attributes_section_data):
10917         Don't crash if size is zero.
10918
10919 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10920             Ian Lance Taylor  <iant@google.com>
10921
10922         * gold.cc (queue_middle_tasks): If no input files were opened,
10923         exit.
10924         * workqueue.h (Task_function::Task_function): Assert that there is
10925         a blocker.
10926
10927 2010-02-22  Doug Kwan  <dougkwan@google.com>
10928
10929         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
10930         * icf.cc (get_section_contents): Cast snprintf arguments to long long
10931         types to avoid warnings due to different uint64_t implementations
10932         on different hosts.
10933
10934 2010-02-21  Doug Kwan  <dougkwan@google.com>
10935
10936         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
10937         handling of the maximum backward branch offset.
10938         (Arm_relocate_functions::thumb_branch_common): Ditto.
10939         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
10940         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
10941         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
10942         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
10943         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
10944         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
10945         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
10946         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
10947         thumb_bl_out_of_range thumb_bl_out_of_range.o,
10948         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
10949         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
10950         thumb2_bl_out_of_range.o): New rules.
10951         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
10952         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
10953         thumb2_bl_out_of_range
10954         * testsuite/Makefile.in: Regenerate.
10955         * testsuite/arm_bl_in_range.s: New file.
10956         * testsuite/arm_bl_out_of_range.s: Ditto.
10957         * testsuite/arm_branch_in_range.sh: Ditto.
10958         * testsuite/arm_branch_range.t: Ditto.
10959         * testsuite/thumb2_branch_range.t: Ditto.
10960         * testsuite/thumb_bl_in_range.s: Ditto.
10961         * testsuite/thumb_bl_out_of_range.s: Ditto.
10962         * testsuite/thumb_branch_range.t: Ditto.
10963
10964 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
10965
10966         * gc.h (gc_process_relocs): Change vectors to point to the new list.
10967         Add reloc offset information.
10968         * icf.cc (get_section_contents): Change iterators to point to the new
10969         vectors. Add reloc offset information to the contents.
10970         * icf.h (Icf::Sections_reachable_info): New typedef.
10971         (Icf::Sections_reachable_list): New typedef.
10972         (Icf::Offset_info): New typedef.
10973         (Icf::Reloc_info): New struct typedef.
10974         (Icf::Reloc_info_list): New typedef.
10975         (Icf::symbol_reloc_list): Delete method.
10976         (Icf::addend_reloc_list): Delete method.
10977         (Icf::section_reloc_list): Delete method.
10978         (Icf::reloc_info_list): New method.
10979         (Icf::reloc_info_list_): New member.
10980
10981 2010-02-19  Doug Kwan  <dougkwan@google.com>
10982
10983         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
10984         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
10985         * arm.cc (Arm_relocation_functions): New forward declaration.
10986         (Target_arm::Target_arm): Initialize new data members
10987         got_mod_index_offset_ and tls_base_symbol_defined_.
10988         (Target_arm::Relocate::relocate_tls): New method.
10989         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
10990          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
10991         New methods.
10992         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
10993         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
10994         (Target_arm::got_mod_index_offset_,
10995         Target_arm::tls_base_symbol_defined_): New data members.
10996         (Target_arm::Scan::local, Target::Scan::global,
10997         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
10998         relocations.
10999
11000 2010-02-18  Doug Kwan  <dougkwan@google.com>
11001
11002         * arm.cc (Arm_relobj::find_linked_text_section): New method.
11003         (Arm_relobj::make_exidx_input_section): Pass section index of linked
11004         text section as a parameter becuase some broken tools may not set
11005         the link in section header.
11006         (Target_arm::has_got_section): New method.
11007         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
11008         without any mapping symbol as data only.  Remove warning.
11009         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
11010         link in its section header, try to discover the link by inspecting the
11011         REL31 relocation at the beginning of the section.
11012         (Target_arm::Scan::check_non_pic): Report name of offending relocation
11013         in error message.
11014         (Target_arm::Scan::global): Treat any reference to the symbol
11015         _GLOBAL_OFFSET_TABLE_ as a GOT access.
11016
11017 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
11018
11019         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
11020         (Scan::global_reloc_may_be_function_pointer): New function.
11021         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
11022         (Scan::global_reloc_may_be_function_pointer): New function.
11023         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
11024         (Scan::global_reloc_may_be_function_pointer): New function.
11025         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
11026         (Scan::global_reloc_may_be_function_pointer): New function.
11027         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
11028         (Scan::global_reloc_may_be_function_pointer): New function.
11029         (Scan::possible_function_pointer_reloc): New function.
11030         (Target_x86_64::can_check_for_function_pointers): New function.
11031         * gc.h (gc_process_relocs): Scan relocation types to determine if
11032         function pointers were taken for targets that support it.
11033         * icf.cc (Icf::find_identical_sections): Include functions for
11034         folding in safe ICF whose pointer is not taken.
11035         * icf.h (Secn_fptr_taken_set): New typedef.
11036         (fptr_section_id_): New member.
11037         (section_has_function_pointers): New function.
11038         (set_section_has_function_pointers): New function.
11039         (check_section_for_function_pointers): New function.
11040         * options.h: Fix comment for safe ICF option.
11041         * target.h (can_check_for_function_pointers): New function.
11042         * testsuite/Makefile.am: Add icf_safe_so_test test case.
11043         Modify icf_safe_test for X86-64.
11044         * testsuite/Makefile.in: Regenerate.
11045         * testsuite/icf_safe_so_test.cc: New file.
11046         * testsuite/icf_safe_so_test.sh: New file.
11047         * testsuite/icf_safe_test.cc (kept_func_3): New function.
11048         (main): Change to take pointer to function kept_func_3.
11049         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
11050         folding is done correctly for X86-64.
11051
11052 2010-02-12  David S. Miller  <davem@davemloft.net>
11053
11054         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
11055         is_symbolless parameter.
11056         (Output_reloc<SHT_REL>::is_symbolless): New.
11057         (Output_reloc<SHT_REL>::is_symbolless_): New.
11058         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
11059         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
11060         (Output_reloc<SHT_RELA>::is_symbolless): New.
11061         (Output_data_reloc::add_global): Handle is_symbolless.
11062         (Output_data_reloc::add_global_relative): Likewise.
11063         (Output_data_reloc::add_local): Likewise.
11064         (Output_data_reloc::add_local_relative): Likewise.
11065         (Output_data_reloc::add_symbolless_global_addend): New.
11066         (Output_data_reloc::add_symbolless_local_addend): New.
11067         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
11068         is_symbolless.
11069         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
11070         instead of ->is_relative_
11071         (Output_reloc::write): Likewise.
11072         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
11073         (Output_reloc::write_rel): Simplify.
11074
11075         * sparc.cc (Target_sparc::Scan::local): Use
11076         ->add_symbolless_local_addend as needed.
11077         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
11078         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
11079         based upon relocation offset.
11080
11081 2010-02-11  Doug Kwan  <dougkwan@google.com>
11082
11083         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
11084         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
11085         beginning of function.
11086         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
11087         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
11088         parameter is_32bit in calls to should_apply_static_reloc.
11089         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
11090         (check_DATA): Add arm_abs_global.stdout.
11091         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
11092         arm_abs_global.stdout): New rules.
11093         (MOSTLLYCLEANFILES): Add arm_abs_global
11094         * Makefile.in: Regenerate.
11095         * testsuite/arm_abs_global.s: New file.
11096         * testsuite/arm_abs_global.sh: Ditto.
11097         * testsuite/arm_abs_lib.s: Ditto.
11098
11099 2010-02-11  Ian Lance Taylor  <iant@google.com>
11100
11101         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
11102         Read_relocs task.
11103         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
11104         Allocate_commons_task first.
11105         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
11106         task, rather than symtab_lock_.
11107         (Gc_process_relocs::~Gc_process_relocs): New function.
11108         (Gc_process_relocs::is_runnable): Check this_blocker_.
11109         (Gc_process_relocs::locks): Use next_blocker_ rather than
11110         blocker_.
11111         (Scan_relocs::~Scan_relocs): New function.
11112         (Scan_relocs::is_runnable): Check this_blocker_ rather than
11113         symtab_lock_.
11114         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
11115         next_blocker_.
11116         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
11117         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
11118         constructor accordingly.
11119         (class Gc_process_relocs): Likewise.
11120         (class Scan_relocs): Likewise.
11121         * common.h (class Allocate_commons_task): Remove symtab_lock_
11122         field, and corresponding constructor parameter.
11123         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
11124         symtab_lock_.
11125         (Allocate_commons_task::locks): Likewise.
11126
11127 2010-02-11  Ian Lance Taylor  <iant@google.com>
11128
11129         * gold-threads.h (class Once): Define.
11130         (class Initialize_lock): Rewrite as child of Once.
11131         * gold-threads.cc (class Once_initialize): Define.
11132         (once_pointer_control): New static variable.
11133         (once_pointer, once_arg): New static variables.
11134         (c_run_once): New static function.
11135         (Once::Once, Once::run_once, Once::internal_run): New functions.
11136         (class Initialize_lock_once): Remove.
11137         (initialize_lock_control): Remove.
11138         (initialize_lock_pointer): Remove.
11139         (initialize_lock_once): Remove.
11140         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
11141         (Initialize_lock::initialize): Rewrite.
11142         (Initialize_lock::do_run_once): New function.
11143         * archive.cc (Archive::interpret_header): Only clear name if it is
11144         not already empty.
11145         * fileread.cc: Include "gold-threads.h"
11146         (file_counts_lock): New static variable.
11147         (file_counts_initialize_lock): Likewise.
11148         (File_read::release): Only increment counts when using --stats.
11149         Use a lock around the increment.
11150         * parameters.cc (class Set_parameters_target_once): Define.
11151         (set_parameters_target_once): New static variable.
11152         (Parameters::Parameters): Move here from parameters.h.
11153         (Parameters::set_target): Rewrite.
11154         (Parameters::set_target_once): New function.
11155         (Parameters::clear_target): Move here and rewrite.
11156         * parameters.h (class Parameters): Update declarations.  Add
11157         set_parameters_target_once_ field.
11158         (Parameters::Parameters): Move to parameters.cc.
11159         (Parameters::clear_target): Likewise.
11160         * readsyms.cc (Read_symbols::do_group): Create a Start_group
11161         task.
11162         (Start_group::~Start_group): New function.
11163         (Start_group::is_runnable): New function.
11164         (Start_group::locks, Start_group::run): New functions.
11165         (Finish_group::run): Change saw_undefined to size_t.
11166         * readsyms.h (class Start_group): Define.
11167         (class Finish_group): Change saw_undefined_ field to size_t.
11168         (Finish_group::Finish_group): Remove saw_undefined and
11169         this_blocker parameters.  Change all callers.
11170         (Finish_group::set_saw_undefined): New function.
11171         (Finish_group::set_blocker): New function.
11172         * symtab.h (class Symbol_table): Change saw_undefined to return
11173         size_t.  Change saw_undefined_ field to size_t.
11174         * target-select.cc (Set_target_once::do_run_once): New function.
11175         (Target_selector::Target_selector): Initialize set_target_once_
11176         field.  Don't initialize lock_ and initialize_lock_ fields.
11177         (Target_selector::instantiate_target): Rewrite.
11178         (Target_selector::set_target): New function.
11179         * target-select.h (class Set_target_once): Define.
11180         (class Target_selector): Update declarations.  Make
11181         Set_target_once a friend.  Remove lock_ and initialize_lock_
11182         fields.  Add set_target_once_ field.
11183
11184 2010-02-10  Ian Lance Taylor  <iant@google.com>
11185
11186         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
11187         queueing any tasks.
11188         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
11189         (queue_middle_tasks): Add all blockers before queueing any tasks.
11190         (queue_final_tasks): Likewise.
11191         * token.h (Task_token::add_blockers): New function.
11192         * object.h (Input_objects::number_of_relobjs): New function.
11193
11194 2010-02-10  Ian Lance Taylor  <iant@google.com>
11195
11196         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
11197         shared, not if not position independent.
11198         * x86_64.cc (Relocate::relocate_tls): Likewise.
11199         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
11200         (tls_pie_pic_test): New target.
11201         * testsuite/Makefile.in: Rebuild.
11202
11203         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
11204         (tls_test_main_pie.o, tls_test_pie.o): New targets.
11205         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
11206         * testsuite/Makefile.in: Rebuild.
11207
11208 2010-02-09  David S. Miller  <davem@davemloft.net>
11209
11210         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
11211         R_SPARC_RELATIVE using ->add_local_relative().
11212         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
11213
11214         * output.h (Output_data_dynamic::add_section_size): New method
11215         that takes two Output_data objects.
11216         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
11217         entry param.  Handle it in initializers.
11218         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
11219         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
11220         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
11221         arg.
11222         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
11223         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
11224         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
11225         for dynrel_includes_plt.
11226         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11227         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11228         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
11229         before .rela.plt
11230         (Target_sparc::do_finalize_sections): Update to pass true for
11231         dynrel_includes_plt.
11232         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
11233         output before .rela.plt
11234         (Target_powerpc::do_finalize_sections): Update to pass true for
11235         dynrel_includes_plt when 32-bit.
11236
11237 2010-02-08  Doug Kwan  <dougkwan@google.com>
11238
11239         * arm.cc (Arm_relobj::simple_input_section_output_address): New
11240         method.
11241         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
11242         Arm_relobj::scan_section_for_cortex_a8_stubs,
11243         Arm_relobj::do_relocation_section): Instead of calling
11244         Output_section::output_address, use faster
11245         Arm_relobj::simple_input_section_output_address.
11246
11247 2010-02-08  David S. Miller  <davem@davemloft.net>
11248
11249         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
11250         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
11251         relocation helper function.
11252
11253         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
11254         just like R_SPARC_GOT{10,13,22}.
11255         (Target_sparc::Scan::local): Likewise.
11256         (Target_sparc::Relocate:relocate): Likewise.
11257
11258 2010-02-06  Ian Lance Taylor  <iant@google.com>
11259
11260         * configure.ac: Rewrite targetobjs duplicate removal code to use
11261         only shell constructs.
11262         * configure: Rebuild.
11263
11264 2010-02-05  Doug Kwan  <dougkwan@google.com>
11265
11266         PR 11247
11267         * arm.cc (Arm_relobj::section_is_scannable): New method.
11268         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
11269         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
11270
11271 2010-02-04  Doug Kwan  <dougkwan@google.com>
11272
11273         PR 11247
11274         * arm-reloc-property.cc (cstdio): Include.
11275         * configure.ac (targetobjs): Remove duplicates.
11276         * configure: Regenerate.
11277         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
11278         big and little endian version for a given address size.
11279
11280 2010-02-03  Doug Kwan  <dougkwan@google.com>
11281
11282         * arm-reloc-property.cc
11283         (Arm_reloc_property_table::reloc_name_in_error_message): New method
11284         definition.
11285         * arm-reloc-property.h
11286         (Arm_reloc_property_table::get_implemented_static_reloc_property):
11287         New method definition.
11288         (Arm_reloc_property_table::reloc_name_in_error_message): New method
11289         declaration.
11290         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
11291         overflow to N.
11292         (GOT_PREL): Change implemented to Y.
11293         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
11294         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
11295         (Arm_relocate_functions::movw_abs_nc): Remove method.
11296         (Arm_relocate_functions::movt_abs): Ditto.
11297         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
11298         (Arm_relocate_functions::thm_movt_abs): Ditto.
11299         (Arm_relocate_functions::movw_rel_nc): Ditto.
11300         (Arm_relocate_functions::movw_rel): Ditto.
11301         (Arm_relocate_functions::movt_rel): Ditto.
11302         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
11303         (Arm_relocate_functions:thm_movw_rel): Ditto.
11304         (Arm_relocate_functions:thm_movt_rel): Ditto.
11305         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
11306         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
11307         New method definitions.
11308         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
11309         (Arm_relocation_functions::arm_grp_ldr): Ditto.
11310         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
11311         (Arm_relocation_functions::arm_grp_ldc): Ditto.
11312         (Target_arm::Relocate::relocate): Check for non-static or
11313         unimplemented relocation code and exit early.  Change calls to
11314         Target_arm::reloc_uses_thumb_bit and
11315         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
11316         instead.  Refactor code to handle similar relocations to increase
11317         code sharing.  Remove check for unsupported relocation code in switch
11318         statement.
11319         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
11320         relocation property table to find out size.  Change error message to
11321         print out the name of a relocation code instead of the numeric value.
11322         (Target_arm::scan_reloc_for_stub): Use relocation property table
11323         instead of calling Target_arm::reloc_uses_thumb_bit().
11324
11325 2010-02-02  Doug Kwan  <dougkwan@google.com>
11326
11327         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
11328         types of relaxed input section.
11329
11330 2010-02-02  Doug Kwan  <dougkwan@google.com>
11331
11332         * Makefile.am (HFILES): Add arm-reloc-property.h.
11333         (DEFFILES): New.
11334         (TARGETSOURCES): Add arm-reloc-property.cc
11335         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
11336         (libgold_a_SOURCES): $(DEFFILES)
11337         * Makefile.in: Regenerate.
11338         * arm-reloc-property.cc: New file.
11339         * arm-reloc-property.h: New file.
11340         * arm-reloc.def: New file.
11341         * arm.cc: Update comments.
11342         (arm-reloc-property.h): New included header.
11343         (arm_reloc_property_table): New global variable.
11344         (Target_arm::do_select_as_default_target): New method definition.
11345         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
11346         arm-reloc-property to targ_extra_obj.
11347         * parameters.cc (set_parameters_target): Call
11348         Target::select_as_default_target().
11349         * target.h (Target::select_as_default_target): New method definition.
11350         (Target::do_select_as_default_target): Same.
11351
11352 2010-02-01  Doug Kwan  <dougkwan@google.com>
11353
11354         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
11355         first_output_text_section_.
11356         (Arm_exidx_fixup::first_output_text_section): New method definition.
11357         (Arm_exidx_fixup::first_output_text_section_): New data member.
11358         (Arm_exidx_fixup::process_exidx_section): Record the first text
11359         output section seen.
11360         (Arm_output_section::fix_exidx_coverage): Set correct linked section
11361         and entsize in output section header.
11362
11363 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11364
11365         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
11366         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
11367         (Arm_relocate_functions::thm_alu11): New Method.
11368         (Arm_relocate_functions::thm_pc8): New Method.
11369         (Arm_relocate_functions::thm_pc12): New Method.
11370         (Target_arm::Scan::local): Handle the relocations.
11371         (Target_arm::Scan::global): Likewise.
11372         (Target_arm::Relocate::relocate): Likewise.
11373         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11374
11375 2010-01-29  Doug Kwan  <dougkwan@google.com>
11376
11377         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
11378         of relocation types as ld.
11379
11380 2010-01-29  Doug Kwan  <dougkwan@google.com>
11381
11382         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
11383         to public.
11384         (Arm_relocate_functions::thumb_branch_common): Ditto.
11385         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
11386         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
11387         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
11388         Arm_relocate_functions::jump24): Remove.
11389         (Target_arm::Relocate::relocate): Adjust code to call
11390         Arm_relocation_functions::arm_branch_common and
11391         Arm_relocation_functions::thumb_branch_common instead of their removed
11392         wrappers.  Merge switch-cases together to reduce source code size.
11393
11394 2010-01-29  Doug Kwan  <dougkwan@google.com>
11395
11396         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
11397         output_local_symbol_count_needs_update_.
11398         (Arm_relobj::output_local_symbol_count_needs_update,
11399          Arm_relobj::set_output_local_symbol_count_needs_update,
11400          Arm_relobj::update_output_local_symbol_count): New methods.
11401         (Arm_relobj::output_local_symbol_count_needs_update_): New data
11402         member.
11403         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
11404         of pointed function as in a R_ARM_PREL31 relocation.
11405         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
11406         for output local symbol count updating.
11407         (Target_arm::do_relax): Update output local symbol counts in objects
11408         if necessary.
11409         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
11410
11411 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11412
11413         * arm.cc: Added support for the ARM relocations:
11414         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
11415         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
11416         (Arm_relocate_functions::movw_rel_nc): Renamed (was
11417         movw_prel_nc).
11418         (Arm_relocate_functions::movw_rel): New method.
11419         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
11420         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
11421         thm_movw_prel_nc).
11422         (Arm_relocate_functions::thm_movw_rel): New method.
11423         (Arm_relocate_functions::thm_movt_rel): Renamed (was
11424         thm_movt_prel).
11425         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
11426         relocations.
11427         (Target_arm::Scan::global): Likewise.
11428         (Target_arm::Relocate::relocate): Likewise.
11429         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11430         Likewise.
11431
11432 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11433
11434         * arm.cc: Added support for ARM group relocations.
11435         (Target_arm::reloc_needs_sym_origin): New method.
11436         (Arm_relocate_functions::calc_grp_kn): New method.
11437         (Arm_relocate_functions::calc_grp_residual): New method.
11438         (Arm_relocate_functions::calc_grp_gn): New method.
11439         (Arm_relocate_functions::arm_grp_alu): New Method.
11440         (Arm_relocate_functions::arm_grp_ldr): New Method.
11441         (Arm_relocate_functions::arm_grp_ldrs): New Method.
11442         (Arm_relocate_functions::arm_grp_ldc): New Method.
11443         (Target_arm::Scan::local): Handle the ARM group relocations.
11444         (Target_arm::Scan::global): Likewise.
11445         (Target_arm::Relocate::relocate): Likewise.
11446         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11447         Likewise.
11448
11449 2010-01-26  Doug Kwan  <dougkwan@google.com>
11450
11451         * arm.cc (set): Include.
11452         (class Arm_exidx_fixup): Change type of last_input_section_ to const
11453         pointer type.
11454         (Arm_output_section::Text_section_list): New type.
11455         (Arm_output_section::append_text_sections_to_list): New method.
11456         (Arm_output_section::fix_exidx_coverage): Ditto.
11457         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
11458         (Arm_relobj::convert_input_section_to_relaxed_section): Use
11459         Relobj::set_section_offset() instead of
11460         Sized_relobj::invalidate_section_offset().
11461         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
11462         parameter for section headers. Ignore relocation sections for
11463         unallocated sections and EXIDX sections.
11464         (Target_arm::fix_exidx_coverage): New method.
11465         (Target_arm::output_section_address_less_than): New type.
11466         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
11467         linked text section instead of the EXIDX section.
11468         (Arm_output_section::create_stub_group): Add an assertion to check
11469         that this is not an EXIDX output section.
11470         (Arm_output_section::append_text_sections_to_list): New method.
11471         (Arm_output_section::fix_exidx_coverage): Ditto.
11472         (Arm_relobj::scan_sections_for_stubs): Adjust call to
11473         Arm_relobj::section_needs_reloc_stub_scanning.
11474         (Target_arm::do_relax): Fix EXIDX output section coverage in the
11475         first pass.
11476         (Target_arm::fix_exidx_coverage): New method.
11477         * object.h (Relobj::set_output_section): New method.
11478         (Sized_relobj::invalidate_section_offset): Remove method.
11479         (Sized_relobj::do_invalidate_section_offset): Remove method.
11480         (Sized_relobj::do_set_section_offset): Handle offset value -1.
11481
11482 2010-01-25  Doug Kwan  <dougkwan@google.com>
11483
11484         * arm.cc (Arm_exidx_merged_section::do_output_offset):
11485         Fix warning due to signed and unsigned comparison on a 32-bit host.
11486
11487 2010-01-22  Doug Kwan  <dougkwan@google.com>
11488
11489         * arm.cc (Target_arm::do_relax): Record an output section for section
11490         offset adjustment it contains any stub table that has changed.
11491         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
11492         offsets in an output section if necessary.
11493         * output.cc (Output_section::Output_section): Initialize
11494         section_offsets_need_adjustments_.
11495         (Output_section::add_input_section_for_script): Renamed to
11496         Output_section::add_simple_input_section.
11497         (Output_section::save_states): Add a comment.
11498         (Output_section::discard_states): New method defintion.
11499         (Output_section::adjust_section_offsets): Same.
11500         * output.h (Output_section::add_input_section_for_script): Renamed to
11501         Output_section::add_simple_input_section.
11502         (Output_section::discard_states): New method declaration.
11503         (Output_section::adjust_section_offsets): Same.
11504         (Output_section::section_offsets_need_adjustment,
11505         Output_section::set_section_offsets_need_adjustment): New method
11506         definitions.
11507         (Output_section::section_offsets_need_adjustment_): New data member.
11508         * script-sections.cc
11509         (Output_section_element_input::set_section_address): Adjust code for
11510         renaming of Output_section::add_input_section_for_script.
11511         (Orphan_output_section::set_section_address): Same.
11512
11513 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11514
11515         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
11516         Fix_v4bx enum values .
11517         * gold/options.h (General_options): New option definitions.
11518         (General_options::fix_v4bx): New method.
11519         (General_options::Fix_v4bx): New enum.
11520         * gold/options.cc (General_options::parse_fix_v4bx): New method.
11521         (General_options::parse_fix_v4bx_interworking): New method.
11522
11523 2010-01-22  Doug Kwan  <dougkwan@google.com>
11524
11525         * arm.cc (Arm_exidx_fixup): New class.
11526
11527 2010-01-21  Doug Kwan  <dougkwan@google.com>
11528
11529         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
11530         classes.
11531         (Arm_exidx_section_offset_map): New type.
11532
11533 2010-01-21  Doug Kwan  <dougkwan@google.com>
11534
11535         * arm.cc (Arm_exidx_input_section): New class.
11536         (Arm_relobj::exidx_input_section_by_link,
11537         Arm_relobj::exidx_input_section_by_shndx,
11538         Arm_relobj::make_exidx_input_section): New methods.
11539         (read_arm_attributes_section): Remove.
11540         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
11541         information about them.
11542         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
11543         to here.
11544
11545 2010-01-20  Doug Kwan  <dougkwan@google.com>
11546
11547         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
11548         Input_section_specifier to Section_id.
11549         (Target_arm::new_arm_input_section: Adjust code for change of key
11550         type.
11551         (Target_arm::find_arm_input_section): Ditto.
11552         * gc.h (object.h): Include for Section_id nand Section_id_hash.
11553         (Section_id): Remove.
11554         (Garbage_collection::Section_id_hash): Remove.
11555         * icf.h (object.h): Include for Section_id nand Section_id_hash.
11556         (Section_id): Remove.
11557         (Icf::Section_id_hash): Remove.
11558         * object.h (Section_id, Const_section_id, Section_id_hash,
11559         Const_section_id_hash): New type definitions.
11560         * output.cc (Output_section::add_relaxed_input_section): Change to
11561         use Const_section_id instead of Input_section_specifier as key type.
11562         (Output_section::add_merge_input_section): Ditto.
11563         (Output_section::build_relaxation_map): Change to use Section_id
11564         instead of Input_section_specifier as key type.
11565         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11566         Ditto.
11567         (Output_section::convert_input_sections_to_relaxed_sections): Change
11568         to use Const_section_id instead of Input_section_specifier as key type.
11569         (Output_section::find_merge_section): Ditto.
11570         (Output_section::find_relaxed_input_section): Ditto.
11571         * output.h (Input_section_specifier): Remove class.
11572         (Output_section::Output_section_data_by_input_section_map): Change
11573         key type to Const_section_id.
11574         (Output_section::Output_relaxed_input_section_by_input_section_map):
11575         Ditto.
11576         (Output_section::Relaxation_map): Change key type to Section_id.
11577
11578 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11579
11580         * gold/arm.cc: Added support for R_ARM_V4BX relocation
11581         (class Arm_v4bx_stub): New class.
11582         (DEF_STUBS): Updated definition to support v4_veneer_bx.
11583         (Stub_factory::make_arm_v4bx_stub): New method.
11584         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
11585         (Stub_table::empty): Handle v4bx stubs.
11586         (Stub_table::add_arm_v4bx_stub): New method.
11587         (Stub_table::find_arm_v4bx_stub): New method.
11588         (Arm_relocate_functions::v4bx): New method.
11589         (Target_arm::fix_v4bx): New method.
11590         (Target_arm::Target_arm): Handle R_ARM_V4BX.
11591         (Stub_table::relocate_stubs): Likewise.
11592         (Stub_table::do_write): Likewise.
11593         (Stub_table::update_data_size_and_addralign): Likewise.
11594         (Stub_table::finalize_stubs):  Likewise.
11595         (Target_arm::Scan::local): Likewise.
11596         (Target_arm::Scan::global): Likewise.
11597         (Target_arm::do_finalize_sections): Likewise.
11598         (Target_arm::Relocate::relocate): Likewise.
11599         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11600         Likewise.
11601         (Target_arm::scan_reloc_for_stub): Likewise.
11602         (Target_arm::scan_reloc_section_for_stubs): Likewise.
11603
11604 2010-01-19  Ian Lance Taylor  <iant@google.com>
11605
11606         * output.cc (Output_section_headers::do_sized_write): Write large
11607         segment count to sh_info field.
11608         (Output_file_header::do_sized_write): For large segment count,
11609         write PN_XNUM to e_phnum field.
11610
11611 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11612
11613         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
11614         (Arm_relocate_functions::thm_jump8): New function.
11615         (Arm_relocate_functions::thm_jump11): New function.
11616         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
11617         R_ARM_THM_JUMP11.
11618         (Target_arm::Scan::global): Likewise.
11619         (Target_arm::Relocate::relocate): Likewise.
11620         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11621         Likewise.
11622
11623 2010-01-14  Doug Kwan  <dougkwan@google.com>
11624
11625         * arm.cc (map, utility): Include headers.
11626         (Target_arm::apply_cortex_a8_workaround): New method.
11627         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
11628         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
11629         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
11630         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
11631         the --[no-]fix-cortex-a8 command line options.
11632         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
11633         (Target_arm::relocate_stub): Use addend in instruction template.
11634         * options.h (DEFINE_bool): Set the user-set flag.
11635         (General_options): Add --[no-]-fix-cortex options.
11636         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
11637         : Update fast look-up map after conversion.
11638
11639 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
11640
11641         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
11642         in the first pass of do_layout.
11643
11644 2010-01-13  Doug Kwan  <dougkwan@google.com>
11645
11646         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11647         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
11648         apparent compiler problem of not folding static constant integral
11649         data members of elfcpp::Elf_sizes<32>.
11650
11651 2010-01-13  Doug Kwan  <dougkwan@google.com>
11652
11653         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11654         Arm_relobj::section_needs_cortex_a8_stub_scanning,
11655         Arm_relobj::scan_section_for_cortex_a8_erratum,
11656         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
11657         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
11658         sections to scan for relocation stubs into a new method
11659         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
11660         relocation and Cortex-A8 stub scanning.
11661         (Target_arm::do_relax): Force stubs to be after stubbed sections
11662         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
11663         the beginning of a new relaxation pass.  Update a comment.
11664         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
11665
11666 2010-01-12  Ian Lance Taylor  <iant@google.com>
11667
11668         * target-reloc.h (visibility_error): New inline function.
11669         (relocate_section): Call visibility_error.
11670         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
11671         (MOSTLYCLEANFILES): Likewise.
11672         (protected_4_pic.o, protected_3.err): New targets.
11673         * testsuite/protected_4.cc: New file.
11674
11675 2010-01-12  Doug Kwan  <dougkwan@google.com>
11676
11677         * arm.cc (Cortex_a8_reloc): New class.
11678         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
11679         and cortex_a8_relocs_info_.
11680         (Target_arm::fix_cortex_a8): New method definition.
11681         (Target_arm::Cortex_a8_relocs_info): New type.
11682         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
11683         New data member declarations.
11684         (Target_arm::scan_reloc_for_stub): Record information about
11685         relocations for THUMB branches that might be exempted from the
11686         Cortex-A8 workaround.
11687         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
11688         at the beginning of a relaxation pass.
11689
11690 2010-01-12  Doug Kwan  <dougkwan@google.com>
11691
11692         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
11693         (Arm_relobj::Mapping_symbol_position,
11694          Arm_reloj::Mapping_symbol_position_less,
11695          Arm_relobj::Mapping_symbols_info): New types.
11696         (Target_arm::is_mapping_symbol_name): New method definition.
11697         (Arm_relobj::do_count_local_symbols): Save information about mapping
11698         symbols.
11699
11700 2010-01-11  Doug Kwan  <dougkwan@google.com>
11701
11702         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
11703         Arm_relocate_functions::thumb32_branch_upper,
11704         Arm_relocate_functions::thumb32_branch_lower,
11705         Arm_relocate_functions::thumb32_cond_branch_offset,
11706         Arm_relocate_functions::thumb32_cond_branch_upper,
11707         Arm_relocate_functions::thumb32_cond_branch_lower,
11708         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
11709         branch offset encoding.
11710         (Arm_relocate_functions::thumb_branch_common): Use new branch
11711         offset encoding methods to avoid code duplication.
11712         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
11713         (Stub_addend_reader::operator()): Use new branch encoding method
11714         to avoid code duplication.
11715
11716 2010-01-11  Doug Kwan  <dougkwan@google.com>
11717
11718         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
11719         (Target_arm::do_finalize_sections): Define special EXIDX section
11720         symbols only if referenced.
11721         * gc.h (Garbage_collection::add_reference): New method.
11722         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
11723         code duplication.
11724
11725 2010-01-11  Ian Lance Taylor  <iant@google.com>
11726
11727         * script.cc (Version_script_info::build_expression_list_lookup):
11728         Change complaing about duplicate wildcard match from error to
11729         warning.
11730
11731         * script.cc (class Lazy_demangler): Recreate--revert part of patch
11732         of 2009-12-30.
11733         (Version_script_info::Version_script_info): Initialize globs_,
11734         default_version_, default_is_global_, and exact_.  Don't
11735         initialize globals_ or locals_.
11736         (Version_script_info::build_lookup_tables): Build local symbols
11737         first.
11738         (Version_script_info::unquote): New function.
11739         (Version_script_info::add_exact_match): New function.
11740         (Version_script_info::build_expression_list_lookup): Remove lookup
11741         parameter.  Add is_global parameter.  Change all callers.  Handle
11742         wildcard pattern specially.  Unquote pattern.  Call
11743         add_exact_match.
11744         (Version_script_info::get_name_to_match): New function.
11745         (Version_script_info::get_symbol_version): New function.
11746         (Version_script_info::get_symbol_version_helper): Remove.
11747         (Version_script_info::check_unmatched_names): Call unquote.
11748         * script.h (class Version_script_info): Change get_symbol_version
11749         to be non-inline and add is_global parameter; change all callers.
11750         Rewrite symbol_is_local.  Update declarations.  Define struct
11751         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
11752         Remove globals_ and locals_ members.  Add exact_, globs_,
11753         default_version_, is_global_.
11754         (Version_script_info::Glob): Remove pattern, add expression and
11755         is_global.  Update constructor.  Change all callers.
11756         * dynobj.cc (Versions::finalize): Mark the version symbol as the
11757         default version.
11758         (Versions::symbol_section_contents): If a symbol is undefined, or
11759         defined in a dynamic object, set the version index to
11760         VER_NDX_LOCAL.
11761         * symtab.cc (Symbol_table::add_from_relobj): Don't call
11762         symbol_is_local.
11763         (Symbol_table::add_from_pluginobj): Likewise.
11764         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
11765
11766 2010-01-11  Doug Kwan  <dougkwan@google.com>
11767
11768         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
11769         (incremental_dump_LDADD): Add linking option for libintl.
11770         * Makefile.in: Regenerate.
11771
11772 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
11773
11774         PR gold/11144
11775         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
11776         instead of -Ds.
11777         * testsuite/Makefile.in: Regenerated.
11778
11779 2010-01-10  Doug Kwan  <dougkwan@google.com>
11780
11781         * options.h (DEFINE_var): Use parentheses around argument varname__
11782         in macro body to avoid any unintended subsequent substitutions.
11783
11784 2010-01-10  Ian Lance Taylor  <iant@google.com>
11785
11786         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
11787         candidates before doing symbol resolution.
11788
11789         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
11790         ODR candidates if only one is weak.
11791
11792 2010-01-08  Ian Lance Taylor  <iant@google.com>
11793
11794         * script.cc (Version_script_info::build_expression_list_lookup):
11795         Don't warn about ambiguous version, just record the ambiguity.
11796         (Version_script_info::get_symbol_version_helper): Give error if
11797         version is ambiguous.
11798
11799 2010-01-08  Doug Kwan  <dougkwan@google.com>
11800
11801         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
11802         prev_data_size_ and prev_addralign_.  Remove initializer for
11803         deleted data member has_been_changed_.
11804         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
11805         to determine if the table is empty.
11806         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
11807         Remove.
11808         (Stub_table::add_reloc_stub): Define method in class definition
11809         instead of just declaring it there.
11810         (Stub_table::add_cortex_a8_stub): New method definition.
11811         (Stub_table::update_data_size_and_addralign): Ditto.
11812         (Stub_table::finalize_stubs): Ditto.
11813         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
11814         (Stub_table::do_addralign_): Return address alignment in the
11815         (Stub_table::do_reset_address_and_file_offset): Define method in
11816         class definition instead of declaring it there.  Set current data
11817         size to be the data size of the previous pass.
11818         (Stub_table::set_final_data_size): Use current data size as the
11819         final data size.
11820         (Stub_table::relocate_stub): Change parameter type of stub from
11821         Reloc_stub pointer to Stub pointer.
11822         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
11823         (Stub_table::Cortex_a8_stub_list): New typedef.
11824         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
11825          Stub_table::prev_addralign_): New data member.
11826         (Arm_relobj::Arm_relobj): Initialize data member
11827         section_has_cortex_a8_workaround_.
11828         (Arm_relobj::section_has_cortex_a8_workaround,
11829          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
11830          definitions.
11831         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
11832         declarations.
11833         (Target_arm::relocate_stub): Change parameter type of stub from
11834         Reloc_stub pointer to Stub pointer.
11835         (Insn_template::size, Insn_template::alignment): Handle
11836         THUMB16_SPECIAL_TYPE.
11837         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
11838          Stub_table::update_data_size_and_addralign,
11839          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
11840         definitions.
11841         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
11842         (Stub_table::do_write): Ditto.
11843         (Target_arm::do_relax): Adjust code for changes in Stub_table.
11844
11845 2010-01-08  Ian Lance Taylor  <iant@google.com>
11846
11847         PR 11108
11848         * symtab.h (class Symbol): Remove fields is_target_special_ and
11849         has_plt_offset_.  Add field is_defined_in_discarded_section_.
11850         (Symbol::is_defined_in_discarded_section): New function.
11851         (Symbol::set_is_defined_in_discarded_section): New function.
11852         (Symbol::has_plt_offset): Rewrite.
11853         (Symbol::set_plt_offset): Verify that new offset is not -1U.
11854         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
11855         Don't initialize is_target_special_ or has_plt_offset_.
11856         Initialize is_defined_in_discarded_section_.
11857         (Symbol_table::add_from_relobj): If appropriate, set
11858         is_defined_in_discarded_section.
11859         * resolve.cc (Symbol::override_base_with_special): Don't test
11860         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
11861         * target-reloc.h (relocate_section): Do special handling for
11862         symbols defined in discarded sections for global symbols as well
11863         as local symbols.
11864
11865 2010-01-08  Ian Lance Taylor  <iant@google.com>
11866
11867         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
11868         the SHT_SYMTAB case.
11869
11870 2010-01-08  Ian Lance Taylor  <iant@google.com>
11871
11872         * object.cc (Sized_relobj::do_layout): Don't get confused if
11873         layout_eh_frame returns NULL.
11874
11875 2010-01-08  Ian Lance Taylor  <iant@google.com>
11876
11877         PR 11084
11878         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
11879         dynamic symbol table, use the normal symbol table.
11880         (Sized_dynobj::do_read_symbols): Remove assertion about type of
11881         symbol table.
11882
11883 2010-01-08  Ian Lance Taylor  <iant@google.com>
11884
11885         PR 11072
11886         * layout.cc (Layout::include_section): Remove .gnu_debuglink
11887         sections.
11888
11889 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
11890
11891         * version.cc (print_version): Change to "Copyright 2010".
11892
11893 2010-01-08  Ian Lance Taylor  <iant@google.com>
11894
11895         PR 10287
11896         PR 11063
11897         * i386.cc (class Target_i386): Change return type of plt_section
11898         to be non-const.
11899         (class Output_data_plt_i386): Add tls_desc_rel_ field.
11900         (Output_data_plt_i386::Output_data_plt_i386): Initialize
11901         tls_desc_rel_ field.
11902         (Output_data_plt_i386::rel_tls_desc): New function.
11903         (Target_i386::rel_tls_desc_section): New function.
11904         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
11905         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
11906         R_386_TLS_DESC reloc in rel_tls_desc_section.
11907         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
11908         Define struct Tlsdesc_info.
11909         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
11910         (Target_x86_64::do_reloc_symbol_index): New function.
11911         (Target_x86_64::add_tlsdesc_info): New function.
11912         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
11913         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
11914         tlsdesc_rel_ field.
11915         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
11916         all callers.
11917         (Output_data_plt_x86_64::rela_tlsdesc): New function.
11918         (Target_x86_64::rela_tlsdesc_section): New function.
11919         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
11920         handling.
11921         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
11922         (Target_x86_64::do_reloc_addend): New function.
11923         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
11924         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
11925         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
11926         (Output_reloc::type): New function.
11927         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
11928         (Output_reloc::is_target_specific): New function.
11929         (Output_reloc::target_arg): New function.
11930         (class Output_reloc) [SHT_RELA]: Add four new constructors for
11931         absolute relocs and target specific relocs.
11932         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
11933         add_target_specific.
11934         (class Output_data_reloc) [SHT_RELA]: Likewise.
11935         * output.cc (Output_reloc::Output_reloc): Add four new versions
11936         for absolute relocs and target specific relocs.
11937         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
11938         (Output_reloc::get_symbol_index): Likewise.
11939         (Output_reloc::local_section_offset): Check that local_sym_index_
11940         is not TARGET_CODE or 0.
11941         (Output_reloc::symbol_value): Likewise.
11942         (Output_reloc::write) [SHT_RELA]: Call target for target specific
11943         reloc.
11944         * target.h (class Target): Add reloc_symbol_index and reloc_addend
11945         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
11946         functions.
11947         * layout.cc (add_target_dynamic_tags): Use output section for
11948         DT_PLTRELSZ and DT_JMPREL.
11949
11950 2010-01-07  Ian Lance Taylor  <iant@google.com>
11951
11952         PR 11061
11953         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
11954         function.
11955         (class Output_data_reloc_generic): Define.
11956         (class Output_data_reloc_base): Change base class to
11957         Output_data_reloc_generic.  Change add() method to call
11958         bump_relative_reloc_count for a relative reloc.  Remove
11959         sort_relocs_ field.
11960         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
11961         to sort_relocs().
11962         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
11963         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
11964         appropriate.
11965         * layout.h (class Layout): Update declaration.
11966
11967 2010-01-07  Ian Lance Taylor  <iant@google.com>
11968
11969         * output.h (class Output_data): Add const version of
11970         output_section and do_output_section.
11971         (class Output_section_data): Add const version of
11972         do_output_section.
11973         (class Output_section): Likewise.
11974         * layout.cc (Layout::add_target_dynamic_tags): New function.
11975         * layout.h (class Layout): Update declarations.
11976         * arm.cc (Target_arm::do_finalize_sections): Use
11977         add_target_dynamic_tags.
11978         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11979         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11980         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11981         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11982
11983 2010-01-07  Ian Lance Taylor  <iant@google.com>
11984
11985         PR 11042
11986         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
11987         object as needed.
11988
11989 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
11990             Ian Lance Taylor  <iant@google.com>
11991
11992         PR 11019
11993         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
11994         Xindex::read_symtab_xindex.
11995
11996 2010-01-07  Doug Kwan  <dougkwan@google.com>
11997
11998         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
11999         (Insn_template::thumb16_bcond_insn): New method declaration.
12000         (Insn_template): Fix spelling.
12001         (Stub::thumb16_special): New method declaration.
12002         (Stub::do_write): Define virtual method which was previously pure
12003         virtual.
12004         (Stub::do_thumb16_special): New method declaration.
12005         (Stub::do_fixed_endian_write): New template member.
12006         (Reloc_stub::do_write): Remove.
12007         (Reloc_stub::do_fixed_endian_write): Remove.
12008         (Cortex_a8_stub): New class definition.
12009         (Stub_factory::make_cortex_a8_stub): New method definition.
12010         (Stub_factory::Stub_factory): Add missing static storage class
12011         qualifier for elf32_arm_stub_a8_veneer_blx.
12012
12013 2010-01-07  Ian Lance Taylor  <iant@google.com>
12014
12015         PR 10980
12016         * options.h (class General_options): Add --warn-unresolved-symbols
12017         and --error-unresolved-symbols.
12018         * errors.cc (Errors::undefined_symbol): Implement
12019         --warn-unresolved-symbols.
12020
12021         * options.h (class General_options): Add -z text and -z textoff.
12022         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
12023
12024 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
12025
12026         * gc.h (Garbage_collection::Cident_section_map): New typedef.
12027         (Garbage_collection::cident_sections): New function.
12028         (Garbage_collection::add_cident_section): New function.
12029         (Garbage_collection::cident_sections_): New member.
12030         (gc_process_relocs): Add references to sections whose names are C
12031         identifiers.
12032         * gold.h (cident_section_start_prefix): New constant.
12033         (cident_section_stop_prefix): New constant.
12034         (is_cident): New function.
12035         * layout.cc (Layout::define_section_symbols): Replace string constants
12036         with the newly defined constants.
12037         * object.cc (Sized_relobj::do_layout): Track sections whose names are
12038         C identifiers.
12039         * testsuite/Makefile.am: Add gc_orphan_section_test.
12040         * testsuite/Makefile.in: Regenerate.
12041         * testsuite/gc_orphan_section_test.cc: New file.
12042         * testsuite/gc_orphan_section_test.sh: New file.
12043
12044 2010-01-06  Ian Lance Taylor  <iant@google.com>
12045
12046         PR 10980
12047         * options.h (class General_options): Add --warn-shared-textrel.
12048         * layout.cc (Layout::finish_dynamic_section): Implement
12049         --warn-shared-textrel.
12050
12051         PR 10980
12052         * options.h (class General_options): Add --warn-multiple-gp.
12053
12054 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12055
12056         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
12057         $(THREADSLIB) and $(LIBDL).
12058         * Makefile.in: Rebuild.
12059
12060 2010-01-06  Ian Lance Taylor  <iant@google.com>
12061
12062         PR 10980
12063         * options.cc (General_options::parse_section_start): New function.
12064         (General_options::section_start): New function.
12065         (General_options::General_options): Initialize all members.
12066         * options.h: Include <map>
12067         (class General_options): Add --section-start.  Add section_starts_
12068         member.
12069         * layout.cc (Layout::attach_allocated_section_to_segment): If
12070         --section-start was used, set the address of the segment.  Remove
12071         local sort_sections.
12072         (Layout::relaxation_loop_body): If the address of the load segment
12073         has been set by --section-start, don't use it.
12074         * output.h (Output_segment::update_flags_for_output_section): New
12075         function.
12076         * output.cc (Output_segment::add_output_section): Call
12077         update_flags_for_output_section.
12078
12079 2010-01-05  Ian Lance Taylor  <iant@google.com>
12080
12081         PR 10980
12082         * options.h (class General_options): Add --undefined-version.
12083         * script.cc (struct Version_expression): Add was_matched_by_symbol
12084         field.
12085         (Version_script_info::matched_symbol): New function.
12086         (Version_script_info::get_symbol_version_helper): Call
12087         matched_symbol.
12088         (Version_script_info::check_unmatched_names): New function.
12089         * script.h (class Version_script_info): Update declarations.
12090         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
12091
12092         * options.h (class General_options): Use DEFINE_bool_alias for
12093         allow_multiple_definition.
12094         * resolve.cc (Symbol_table::should_override): Don't test
12095         allow_multiple_definition.
12096
12097         PR 10980
12098         * options.h (class General_options): Add --cref.
12099         * main.cc (main): Print cref table if --cref.  Don't close mapfile
12100         until after printing cref table.
12101         * cref.cc: Include "symtab.h".
12102         (class Cref_inputs): Define Cref_table_compare and Cref_table.
12103         (Cref_table_compare::operator()): New function.
12104         (Cref_inputs::gather_cref): New function.
12105         (filecol): New static const.
12106         (Cref_inputs::print_cref): New function.
12107         (Cref::print_cref): New function.
12108         * cref.h: Include <cstdio>.
12109         (class Cref): Update declarations.
12110         * mapfile.h (Mapfile::file): New function.
12111         * object.h (class Object): Define Symbols.  Declare virtual
12112         do_get_global_symbols.
12113         (Object::get_global_symbols): New function.
12114         * object.cc (Input_objects::add_object): Pass object to cref_ if
12115         --cref.
12116         (Input_objects::archive_start): Likewise.
12117         (Input_objects::archive_stop): Likewise.
12118         (Input_objects::print_cref): New function.
12119         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
12120         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
12121         --cref.
12122         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
12123         function.
12124         * plugin.h (class Sized_pluginobj): Update declarations.
12125
12126 2010-01-05  Ian Lance Taylor  <iant@google.com>
12127
12128         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
12129         to is_default_version.  Rename insdef to insdefault.
12130         (Symbol_table::add_from_relobj): Rename def to is_default_version
12131         and local to is_forced_local.
12132         (Symbol_table::add_from_pluginobj): Likewise.
12133         (Symbol_table::add_from_dynobj): Likewise.
12134         (Symbol_table::define_special_symbol): Rename insdef to
12135         insdefault.
12136
12137 2010-01-04  Ian Lance Taylor  <iant@google.com>
12138
12139         PR 10980
12140         * options.h (class General_options): Add
12141         --allow-multiple-definition and -z muldefs.
12142         * resolve.cc (Symbol_table::should_override): Don't warn about a
12143         multiple symbol definition if --allow-multiple-definition or -z
12144         muldefs.
12145
12146         PR 10980
12147         * options.h (class General_options): Add --add-needed and
12148         --copy-dt-needed-entries.  Tweak --as-needed help entry.
12149         * object.cc (Input_objects::check_dynamic_dependencies): Give an
12150         error if --copy-dt-needed-entries aka --add-needed is used and
12151         would cause a change in behaviour.
12152
12153         PR 10980
12154         * options.h (class General_options): Add -G as a short version of
12155         --shared.  Add no-op options -assert, -g, and -i.
12156
12157 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
12158
12159         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
12160         check for .text or .gnu.linkonce.t sections.
12161         * icf.cc (Icf::find_identical_sections): Ditto.
12162         Change the detection for mangled function name within the section
12163         name.
12164         * icf.h (is_section_foldable_candidate): New function.
12165
12166 2009-12-30  Ian Lance Taylor  <iant@google.com>
12167
12168         PR 10980
12169         * options.h (class General_options): Permit two dashes with
12170         --retain-symbols-file.
12171
12172 2009-12-30  Ian Lance Taylor  <iant@google.com>
12173
12174         PR 10979
12175         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
12176         don't put the file header and segment headers in the text
12177         segment.
12178
12179         PR 10979
12180         * common.cc (Sort_commons::operator()): Stabilize sort when both
12181         entries are NULL.
12182         (Symbol_table::do_allocate_commons_list): When allocating common
12183         symbols, skip a symbol which is no longer common.
12184         * symtab.h (Symbol::is_common): Test whether the symbol comes from
12185         an object before checking its type.
12186         * testsuite/common_test_2.c: New file.
12187         * testsuite/common_test_3.c: New file.
12188         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
12189         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
12190         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
12191         (common_test_2_pic.o, common_test_2.so): New targets.
12192         (common_test_3_pic.o, common_test_3.so): New targets.
12193         * testsuite/Makefile.in: Rebuild.
12194
12195         PR 10979
12196         * script.cc (read_input_script): If we see a new SECTIONS clause,
12197         and we have added an input section, give an error.
12198         * layout.h (class Layout): Add have_added_input_section function.
12199         Add have_added_input_section_ field.
12200         * layout.cc (Layout::Layout): Initialize
12201         have_added_input_section_.
12202         (Layout::layout): Set have_added_input_section_.
12203         (Layout::layout_eh_frame): Likewise.
12204
12205 2009-12-30  Ian Lance Taylor  <iant@google.com>
12206
12207         PR 10931
12208         * options.h (class General_options): Add --sort-common option.
12209         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
12210         * common.cc (Sort_common): Add sort_order parameter to
12211         constructor.  Add sort_order_ field.
12212         (Sort_commons::operator): Check sort_order_.
12213         (Symbol_table::allocate_commons): Determine the sort order.
12214         (Symbol_table::do_allocate_commons): Add sort_order parameter.
12215         Change all callers.
12216         (Symbol_table::do_allocate_commons_list): Likewise.
12217
12218 2009-12-30  Ian Lance Taylor  <iant@google.com>
12219
12220         PR 10916
12221         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
12222         symbols from this object, don't change the visibility of an
12223         undefined symbol.
12224         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
12225
12226 2009-12-30  Ian Lance Taylor  <iant@google.com>
12227
12228         PR 10861
12229         * script.h (class Version_script_info): Define Language enum.
12230         Update declarations.  Define Glob, Exact, and Lookup types.  Add
12231         new fields globals_, locals_, and is_finalized_.
12232         * script.cc: Various formatting fixes.
12233         (class Parser_closure): Change language_stack_ from a vector of
12234         std::string to one of Version_script_info::Language.  Adjust all
12235         uses accordingly.
12236         (class Lazy_demangler): Remove.
12237         (struct Version_expression): Change language from std::string to
12238         Version_script_info::Language.
12239         (Version_script_info::Version_script_info): New function.
12240         (Version_script_info::~Version_script_info): Don't call clear.
12241         (Version_script_info::finalize): New function.
12242         (Version_script_info::build_lookup_tables): New function.
12243         (Version_script_info::build_expression_list_lookup): New
12244         function.
12245         (Version_script_info::get_symbol_version_helper): Rewrite to use
12246         lookup tables.
12247         (Version_script_info::print_expression_list): Adjust to use
12248         Version_script_info::Language.
12249         (script_push_lex_into_version_mode): Check that the version script
12250         has not been finalized.
12251         (version_script_push_lang): Change language string to
12252         Version_script_info::Language.
12253         * options.cc (Command_line::version_script): New function.
12254         * options.h (class General_options): Add finalize_dynamic_list
12255         function.  Change version_script from declaration to definition.
12256         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
12257         * testsuite/version_script.map: Remove duplicate def of foo.
12258         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
12259         version_script.map.
12260         * testsuite/Makefile.in: Rebuild.
12261
12262 2009-12-30  Ian Lance Taylor  <iant@google.com>
12263
12264         PR 10843
12265         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
12266         if the input symbol index is 0, make the output symbol index 0.
12267
12268 2009-12-30  Ian Lance Taylor  <iant@google.com>
12269
12270         PR 10670
12271         * options.h (class General_options): Add -x/--discard-all.
12272         * object.cc (Sized_relobj::do_count_local_symbols): Handle
12273         --discard-all.  If the local symbol needs a dynamic entry, check
12274         that before handling --discard-locals.
12275
12276 2009-12-30  Ian Lance Taylor  <iant@google.com>
12277
12278         PR 10450
12279         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
12280         flags to PF_R.
12281         (Output_segment::add_output_section): Don't change the flags if
12282         the type is PT_TLS.
12283
12284         PR 10450
12285         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
12286         GNU hash table if they need a dynamic value.  Otherwise, don't add
12287         them if they are defined in a dynamic object or are forced local.
12288
12289 2009-12-29  Ian Lance Taylor  <iant@google.com>
12290
12291         PR 10450
12292         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
12293         .gnu.hash table for a 32-bit target.
12294
12295         PR 10450
12296         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
12297         regular and a dynamic object only needs a dynamic symbol table
12298         entry if it is externally visible.
12299
12300         PR 10450
12301         * i386.cc (class Target_i386): Initialize global_offset_table_ in
12302         constructor.  Add global_offset_table_ field.
12303         (Target_i386::got_section): Set global_offset_table_.
12304         (Target_i386::do_finalize_sections): Set global_offset_table_
12305         size.
12306         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
12307         in constructor.  Add global_offset_table_ field.
12308         (Target_x86_64::got_section): Set global_offset_table_.
12309         (Target_x86_64::do_finalize_sections): Set global_offset_table_
12310         size.
12311
12312         * layout.cc (Layout::Layout): Initialize increase_relro_.
12313         (Layout::get_output_section): Add is_relro, is_last_relro, and
12314         is_first_non_relro parameters.  Change all callers.
12315         (Layout::choose_output_section): Likewise.
12316         (Layout::add_output_section_data): Likewise.
12317         (Layout::make_output_section): Likewise.
12318         (Layout::set_segment_offsets): Clear increase_relro when using a
12319         linker script.
12320         * layout.h (class Layout): Add increase_relro method.  Add
12321         increase_relro_ field.  Update declarations.
12322         * output.cc (Output_section::Output_section): Initialize
12323         is_last_relro_ and is_first_non_relro_.
12324         (Output_segment::add_output_section): Group relro sections is
12325         do_sort is true.  Handle is_last_relro and is_first_non_relro.
12326         (Output_segment::maximum_alignment): Remove relro handling.
12327         (Output_segment::set_section_addresses): Add increase_relro
12328         parameter.  Change all callers.  Add initial alignment to align
12329         relro sections on separate page.  Remove old relro handling.
12330         (Output_segment::set_section_list_addresses): Remove in_relro
12331         parameter.  Change all callers.
12332         (Output_segment::set_offset): Add increase parameter.  Change all
12333         callers.  Remove old relro handling.
12334         * output.h (class Output_section): Add new methods: is_last_relro,
12335         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
12336         Add is_last_relro_ and is_first_non_relro_ fields.
12337         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
12338         Create separate .got.plt section.  Call increase_relro.
12339         * x86_64.cc (Target_x86_64::got_section): Likewise.
12340         * testsuite/relro_script_test.t: Add .got.plt.
12341
12342         PR 10450
12343         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
12344         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
12345         (Layout::finalize): Call set_dynamic_symbol_size.
12346         (Layout::set_dynamic_symbol_size): New function.
12347         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
12348         set_dynamic_symbol_size.
12349
12350         PR 10450
12351         * output.h (class Output_section): Add is_entsize_zero_ field.
12352         * output.cc (Output_section::Output_section): Initialize
12353         is_entsize_zero_.
12354         (Output_section::set_entsize): If two different entsizes are
12355         requested, force it to zero.
12356         (Output_section::add_input_section): Set flags for .debug_str
12357         before updating section flags.  Set entsize.
12358         (Output_section::update_flags_for_input_section): Set SHF_MERGE
12359         and SHF_STRING if all input sections have those flags.
12360
12361 2009-12-29   Rafael Espindola  <espindola@google.com>
12362
12363         * main.cc (main): Fix the sys time reporting.
12364         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
12365         reporting.
12366
12367 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
12368
12369         * options.cc (General_options::parse_version): Allow -v to exit
12370         without an error if there is nothing to link.
12371
12372 2009-12-29  Ian Lance Taylor  <iant@google.com>
12373
12374         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
12375         using a version of gcc before 4.1.
12376         * configure: Rebuild.
12377
12378 2009-12-28  Chris Demetriou  <cgd@google.com>
12379
12380         * attributes.cc (Output_attributes_section_data::do_write): Use
12381         std::vector::front rather than std::vector::data.
12382
12383 2009-12-28  Ian Lance Taylor  <iant@google.com>
12384
12385         * symtab.h (class Symbol_table): Add enum Defined.
12386         * resolve.cc (Symbol_table::should_override): Add defined
12387         parameter.  Change all callers.  Test whether object is NULL
12388         before calling a method on it.
12389         (Symbol_table::report_resolve_problem): Add defined parameter.
12390         Change all callers.
12391         (Symbol_table::should_override_with_special): Likewise.
12392         * symtab.cc (Symbol_table::define_in_output_data): Add defined
12393         parameter.  Change all callers.
12394         (Symbol_table::do_define_in_output_data): Likewise.
12395         (Symbol_table::define_in_output_segment): Likewise.
12396         (Symbol_table::do_define_in_output_segment): Likewise.
12397         (Symbol_table::define_as_constant): Likewise.
12398         (Symbol_table::do_define_as_constant): Likewise.
12399         * script.h (class Symbol_assignment): Add is_defsym parameter to
12400         constructor; change all callers.
12401         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
12402         parameter.  Change all callers.  Add is_defsym_ field.
12403         (class Parser_closure): Add parsing_defsym parameter to
12404         constructor; change all callers.  Add parsing_defsym accessor
12405         function.  Add parsing_defsym_ field.
12406
12407 2009-12-28  Ian Lance Taylor  <iant@google.com>
12408
12409         * gold.cc (queue_middle_tasks): Fix formatting.
12410         * object.cc (Relobj::is_section_name_included): Likewise.
12411
12412 2009-12-23  Ian Lance Taylor  <iant@google.com>
12413
12414         * i386.cc (Target_i386::do_calls_non_split): Recognize
12415         -fsplit-stack prologue for a function with a static chain.
12416         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
12417         -fsplit-stack prologue when using %r11.
12418
12419 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
12420
12421         * options.cc (General_options::parse_version): Make -v continue and do
12422         the link like GNU ld does.
12423
12424 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
12425
12426         * Makefile.am (CCFILES): Add timer.cc.
12427         (HFILES): Add timer.h.
12428         * configure.ac: Check for sysconf and times.
12429         * main.cc: include timer.h.
12430         (main): Use Timer instead of get_run_time.
12431         * timer.cc: New.
12432         * timer.h: New.
12433         * workqueue.cc: include timer.h.
12434         (Workqueue::find_and_run_task):
12435         Report user, sys and wall time.
12436         * Makefile.in: Regenerate.
12437         * config.in: Regenerate.
12438         * configure: Regenerate.
12439
12440 2009-12-16  Doug Kwan  <dougkwan@google.com>
12441
12442         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
12443         sections.
12444         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
12445         relaxed input sections.
12446         * output.cc (Output_section::find_relaxed_input_section): Change
12447         return type to Output_relaxed_input_section pointer.  Adjust code
12448         for new type of relaxed_input_section_map_.
12449         * output.h (Output_section::find_relaxed_input_section): Change
12450         return type to Output_relaxed_input_section pointer.
12451         (Output_section::Output_relaxed_input_section_by_input_section_map):
12452         New type.
12453         (Output_section::relaxed_input_section_map_): Change type to
12454         Output_section::Output_relaxed_input_section_by_input_section_map.
12455         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
12456         input section.
12457
12458 2009-12-15  Ian Lance Taylor  <iant@google.com>
12459
12460         * layout.cc (Layout::create_shstrtab): Only write out after input
12461         sections if we are compressing debug sections.
12462
12463 2009-12-15  Ian Lance Taylor  <iant@google.com>
12464
12465         * archive.cc (Archive::add_symbols): Only look up a symbol without
12466         a version if there is, in fact, a version.
12467
12468 2009-12-14  Ian Lance Taylor  <iant@google.com>
12469
12470         Revert -Wshadow changes, all changes from:
12471         2009-12-11  Doug Kwan  <dougkwan@google.com>
12472         2009-12-11  Nick Clifton  <nickc@redhat.com>
12473         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
12474
12475 2009-12-11  Doug Kwan  <dougkwan@google.com>
12476
12477         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
12478         due to -Wshadow.
12479         * attributes.cc (Object_attribute::size): Ditto.
12480         (Attributes_section_data::size): Ditto.
12481         (Attributes_section_data::Attributes_section_data): Ditto.
12482         (Output_attributes_section_data::do_write): Ditto.
12483         * attributes.h (Object_attribute::set_type): Ditto.
12484         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
12485
12486 2009-12-11  Nick Clifton  <nickc@redhat.com>
12487
12488         * archive.cc: Fix shadowed variable warnings.
12489         * arm.cc: Likewise.
12490         * compressed_output.cc: Likewise.
12491         * compressed_output.h: Likewise.
12492         * configure: Likewise.
12493         * dwarf_reader.cc: Likewise.
12494         * dynobj.cc: Likewise.
12495         * dynobj.h: Likewise.
12496         * ehframe.cc: Likewise.
12497         * ehframe.h: Likewise.
12498         * errors.cc: Likewise.
12499         * expression.cc: Likewise.
12500         * fileread.cc: Likewise.
12501         * fileread.h: Likewise.
12502         * freebsd.h: Likewise.
12503         * i386.cc: Likewise.
12504         * icf.cc: Likewise.
12505         * incremental.h: Likewise.
12506         * layout.cc: Likewise.
12507         * layout.h: Likewise.
12508         * mapfile.cc: Likewise.
12509         * merge.cc: Likewise.
12510         * merge.h: Likewise.
12511         * object.cc: Likewise.
12512         * object.h: Likewise.
12513         * options.h: Likewise.
12514         * output.cc: Likewise.
12515         * output.h: Likewise.
12516         * parameters.cc: Likewise.
12517         * plugin.cc: Likewise.
12518         * powerpc.cc: Likewise.
12519         * reduced_debug_output.cc: Likewise.
12520         * reduced_debug_output.h: Likewise.
12521         * reloc.cc: Likewise.
12522         * reloc.h: Likewise.
12523         * resolve.cc: Likewise.
12524         * script-sections.cc: Likewise.
12525         * script.cc: Likewise.
12526         * script.h: Likewise.
12527         * sparc.cc: Likewise.
12528         * symtab.cc: Likewise.
12529         * symtab.h: Likewise.
12530         * target-select.cc: Likewise.
12531         * target-select.h: Likewise.
12532         * token.h: Likewise.
12533         * workqueue.cc: Likewise.
12534         * workqueue.h: Likewise.
12535         * x86_64.cc: Likewise.
12536
12537 2009-12-10  Doug Kwan  <dougkwan@google.com>
12538
12539         * arm.cc (attributes.h): New include.
12540         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
12541         (Arm_relobj::~Arm_relobj): Delete object pointed by
12542         attributes_section_data_.
12543         (Arm_relobj::attributes_section_data): New method definition.
12544         (Arm_relobj::attributes_section_data_): New data member declaration.
12545         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
12546         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
12547         attributes_section_data_.
12548         (Arm_dynobj::attributes_section_data): New method definition.
12549         (Arm_dynobj::attributes_section_data_): New data member declaration.
12550         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
12551         initialization value of may_use_blx_ to false.
12552         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
12553         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
12554         object attributes to compute results instead of hard-coding.
12555         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
12556         Target_arm::get_secondary_compatible_arch,
12557         Target_arm::set_secondary_compatible_arch
12558         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12559         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
12560         New method declarations.
12561         (Target_arm::get_aeabi_object_attribute): New method definition.
12562         (Target_arm::attributes_section_data_): New data member declaration.
12563         (read_arm_attributes_section): New template definition.
12564         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
12565         (Arm_dynobj::do_read_symbols): Ditto.
12566         (Target_arm::do_finalize_sections): Merge attributes sections from
12567         input.  Check for BLX use after attributes section merging.
12568         Fix __exidx_start and __exidx_end visibility.  Create an
12569         .ARM.attributes section if necessary.
12570         (Target_arm::get_secondary_compatible_arch,
12571         Target_arm::set_secondary_compatible_arch,
12572         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12573         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
12574         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
12575         New method definitions.
12576
12577 2009-12-09  Ian Lance Taylor  <iant@google.com>
12578
12579         * plugin.cc (Plugin::load): Don't cast from void* to a function
12580         pointer.
12581
12582 2009-12-09  Ian Lance Taylor  <iant@google.com>
12583
12584         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
12585         information fields.
12586
12587 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
12588
12589         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
12590         Replace two_file_shared_1.so with two_file_shared_2.so.
12591         * testsuite/Makefile.in: Regenerated.
12592
12593 2009-12-08  Doug Kwan  <dougkwan@google.com>
12594
12595         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
12596         (HFILES): Add attributes.h and int_encoding.h.
12597         * Makefile.in: Regenerate.
12598         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
12599         function definitions to int_encoding.cc
12600         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
12601         prototypes to int_encoding.h
12602         * reduced_debug_output.cc (int_encoding.h): New include.
12603         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
12604         function definitions to int_encoding.cc
12605         (insert_into_vector, read_from_pointer): Move template definitions to
12606         int_encoding.h
12607         * attributes.cc: New file.
12608         * attributes.h: New file.
12609         * int_encoding.cc: New file.
12610         * int_encoding.h: New file.
12611
12612 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
12613
12614         PR gold/11055
12615         * incremental-dump.cc (dump_incremental_inputs): New.
12616         (main): Use dump_incremental_inputs.
12617
12618 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
12619
12620         PR gold/10893
12621         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
12622         checking elfcpp::STT_FUNC.
12623         (Target_i386::Relocate::relocate): Likewise.
12624         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
12625
12626         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
12627         symbols from shared libraries into normal FUNC symbols.
12628
12629         * symtab.h (Symbol): Add is_func and use it.
12630
12631 2009-12-05  Doug Kwan  <dougkwan@google.com>
12632
12633         * arm.cc (Target_arm::arm_info): Initialize new fields
12634         attributes_section and attributes_vendor.
12635         * i386.cc (Target_i386::i386_info): Same.
12636         * object.cc (Sized_relobj::do_layout): Skip attribute section.
12637         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
12638         fields attributes_section and attributes_vendor.
12639         * sparc.cc (Target_sparc::sparc_info): Same.
12640         * target.h (Target::attributes_section, Target::attributes_vendor,
12641         Target::is_attributes_section, Target::attribute_arg_type,
12642         Target::attributes_order): New method definitions.
12643         (Target::Target_info::attributes_section,
12644         Target::Target_info::attributes_vendor): New fields.
12645         (Target::do_attribute_arg_type, Target::do_attributes_order): New
12646         virtual method definitions.
12647         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
12648         attributes_section and attributes_vendor.
12649         * testsuite/testfile.cc (Target_test::test_target_info): Same.
12650
12651 2009-12-05  Doug Kwan  <dougkwan@google.com>
12652
12653         * arm.cc: Update comments about interworking and stub generation.
12654         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
12655         considered as non-PIC.
12656         (Arm_relocate_functions::base_abs): Fix formatting.
12657         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
12658         of function to use GOT entry address instead of offset.
12659         (Target_arm::Scan::global): Issue an error if a symbol would need a
12660         PLT does not get one because it is untyped.  Remove code to create
12661         dynamic symbols for relative branches.
12662         (Target_arm::Relocate::relocate: Use 0 instead of false since function
12663         takes unsigned integer instead of boolean.
12664
12665 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
12666
12667         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
12668         (two_file_test_LDADD): Likewise.
12669         (common_test_1_LDADD): Likewise.
12670         (exception_test_LDADD) Likewise.
12671         (weak_test_LDADD): Likewise.
12672         (many_sections_test_LDADD): Likewise.
12673         (initpri1_LDADD): Likewise.
12674         (script_test_1_LDADD): Likewise.
12675         (script_test_2_LDADD): Likewise.
12676         (justsyms_LDADD): Likewise.
12677         (binary_test_LDADD): Likewise.
12678         (large_LDADD): Likewise.
12679         * testsuite/Makefile.in: Regenerated.
12680
12681 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
12682
12683         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
12684         (Symbol_table::override_with_special): Likewise.
12685         (Symbol_table::add_from_object): Likewise.
12686
12687 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12688
12689         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12690         Don't set the data_offset twice.
12691
12692 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12693
12694         * testsuite/Makefile.in: Regenerate.
12695
12696 2009-12-03  Doug Kwan  <dougkwan@google.com>
12697
12698         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
12699         (Target_arm::do_finalize_sections): Add parameter for symbol table
12700         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
12701         * i386.cc (Target_i386::do_finalize_sections): Add an additional
12702         parameter for symbol table pointer.
12703         * layout.cc (Layout::finalize): Call Target::finalize_sections with
12704         an additional parameter for a pointer to symbol table.
12705         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
12706         parameter for a symbol table pointer.
12707         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
12708         * target.h (Target::finalize_sections, Target::do_finalize_sections):
12709         Ditto.
12710         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
12711         parameter for a symbol table pointer.
12712
12713 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
12714
12715         * incremental.cc (Incremental_inputs_header)
12716         (Incremental_inputs_header_write, Incremental_inputs_entry)
12717         (Incremental_inputs_entry_write): Move ...
12718         * incremental.h (Incremental_inputs_header)
12719         (Incremental_inputs_header_write, Incremental_inputs_entry)
12720         (Incremental_inputs_entry_write): here.
12721
12722 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12723
12724         * incremental.cc (make_sized_incremental_binary): Set the target.
12725         Error if it is incompatible.
12726         * output.h (Output_file): Add filename method.
12727
12728 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12729
12730         * incremental.cc (Incremental_inputs_entry): Remove unused argument
12731         from the get_* methods.
12732
12733 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12734
12735         * incremental-dump.cc (main): Check that the offeset of a script is 0.
12736         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12737         Write 0 for the data_offset of scripts.
12738
12739 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12740
12741         * testsuite/Makefile.am: Add the incremental_test.sh test.
12742         * testsuite/incremental_test.sh: New.
12743         * testsuite/incremental_test_1.c: New.
12744         * testsuite/incremental_test_2.c: New.
12745
12746 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
12747
12748         * incremental-dump.cc (main): Fix typos.
12749
12750 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
12751
12752         PR gold/11025
12753         * incremental-dump.cc (main): Use llu to print 64 bit values.
12754
12755 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
12756             H.J. Lu  <hongjiu.lu@intel.com>
12757
12758         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
12759         $(LIBDL).
12760         (incremental_dump_LDADD): Likewise.
12761         * Makefile.in: Regenerated.
12762
12763 2009-11-25  Doug Kwan  <dougkwan@google.com>
12764
12765         Revert:
12766
12767         2009-11-25  Doug Kwan  <dougkwan@google.com>
12768
12769                 * arm.cc (Target_arm::Target_arm): Move method definition
12770                 outside of class definition.  Add code to handle
12771                 --target1-rel, --target1-abs and --target2= options.
12772                 (Target_arm::get_reloc_reloc_type): Change method to be
12773                 non-static and const.
12774                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
12775                 New data member declaration.
12776                 (Target_arm::Scan::local, Target_arm::Scan::global,
12777                 Target_arm::Relocate::relocate,
12778                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12779                 Adjust call to Target_arm::get_real_reloc_type.
12780                 (Target_arm::get_real_reloc_type): Use command line options
12781                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12782                 * options.h (--target1-rel, --target1-abs, --target2): New
12783                 ARM-only options.
12784
12785 2009-11-25  Doug Kwan  <dougkwan@google.com>
12786
12787         * arm.cc (Target_arm::Target_arm): Move method definition outside of
12788         class definition.  Add code to handle --target1-rel, --target1-abs
12789         and --target2= options.
12790         (Target_arm::get_reloc_reloc_type): Change method to be non-static
12791         and const.
12792         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
12793         member declaration.
12794         (Target_arm::Scan::local, Target_arm::Scan::global,
12795         Target_arm::Relocate::relocate,
12796         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
12797         call to Target_arm::get_real_reloc_type.
12798         (Target_arm::get_real_reloc_type): Use command line options to
12799         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12800         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
12801         options.
12802
12803 2009-11-25  Doug Kwan  <dougkwan@google.com>
12804
12805         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
12806         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
12807         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
12808         formatting.
12809         (Arm_relocate_functions::thm_call): Replace body with a call to
12810         Arm_relocate_functions::thumb_branch_common.
12811         (Arm_relocate_functions::thm_jump24,
12812         Arm_relocate_functions::thm_xpc22): New method definitions.
12813         (Arm_relocate_functions::thumb_branch_common): New method definition.
12814         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
12815         operator.
12816         (Target_arm::Relocate::relocate): Adjust call to thm_call.
12817         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
12818
12819 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12820
12821         * Makefile.am: Build incremental-dump
12822         * Makefile.in: Regenerate.
12823         * incremental-dump.cc: New.
12824         * incremental.cc (Incremental_inputs_header_data,
12825         Incremental_inputs_entry_data): Move to incremental.h
12826         * incremental.h: (Incremental_inputs_header_data,
12827         Incremental_inputs_entry_data): Move from incremental.cc
12828
12829 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12830
12831         * incremental.cc (Incremental_inputs_header,
12832         Incremental_inputs_header_write, Incremental_inputs_entry,
12833         Incremental_inputs_entry_write): Add a typedef with the data type.
12834
12835 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12836
12837         * incremental.cc (Incremental_inputs_header,
12838         Incremental_inputs_header_write, Incremental_inputs_entry,
12839         Incremental_inputs_entry_write): Update comment about which
12840         type has the filed descriptions.
12841
12842 2009-11-15  Doug Kwan  <dougkwan@google.com>
12843
12844         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
12845         (Arm_relocate_functions::arm_branch_common): Change method defintion
12846         in class definition to a method declaration and update list of formal
12847         parameters.
12848         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
12849         Arm_relocation_functions::jump24): Adjust call to
12850         Arm_relocate_functions::arm_branch_common.  Update list of formal
12851         parameters.
12852         (Arm_relocate_functions::xpc25): New method definition.
12853         (Arm_relocate_functions::arm_branch_common): Move method defintion
12854         out from class definition.  Use stubs for mode-switching and extending
12855         branch ranges.
12856         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
12857         specially.  Change code to enable use of stubs in ARM branches.
12858
12859 2009-11-10  Doug Kwan  <dougkwan@google.com>
12860
12861         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
12862         in method declaration.
12863         (Target_arm::relocate_stub): New method declaration.
12864         (Target_arm::default_target): Change to return a pointer instead of
12865         a const reference.
12866         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
12867         Target_arm::default_target.
12868         (Arm_Relobj::do_relocate_sections): Remove options paramater in
12869         method definition.
12870         (Target_arm::relocate_section): Adjust view.
12871         (Target_arm::relocate_stub): New method definition.
12872
12873 2009-11-10  Doug Kwan  <dougkwan@google.com>
12874
12875         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
12876         a format warning.
12877         * incremental.cc (open_incremental_binary): Initialized local
12878         variables to avoid warnings.
12879         * object.cc (make_elf_object): Ditto.
12880         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
12881         a format warning.
12882
12883 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
12884
12885         PR gold/10930
12886         * testsuite/plugin_test.c: Include "config.h".
12887
12888 2009-11-09  Doug Kwan  <dougkwan@google.com>
12889
12890         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
12891         (arm_symbol_value): Remove.
12892         (Arm_relocate_functions::arm_branch_common,
12893         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
12894         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
12895         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
12896         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
12897         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12898         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12899         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12900         Arm_relocate_functions::thm_mobw_abs_nc,
12901         Arm_relocate_functions::thm_mov_abs,
12902         Arm_relocate_functions::movw_prel_nc,
12903         Arm_relocate_functions::thm_movt_abs,
12904         Arm_relocate_functions::movt_prel,
12905         Arm_relocate_functions::thm_movw_prel_nc,
12906         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
12907         (Target_arm::Relocate::relocate): Only decompose address into two
12908         parts if relocation type uses the thumb-bit and pass the actual
12909         bit instead of a flag indicating that the thumb-bit is used.  Adjust
12910         calls to methods in Arm_relocate_functions for this change.
12911
12912 2009-11-08  Ian Lance Taylor  <iant@google.com>
12913
12914         PR 10925
12915         * reloc.cc: Instantiate
12916         Sized_relobj::initialize_input_to_output_maps and
12917         Sized_relobj:free_input_to_output_maps.
12918
12919 2009-11-06  Ian Lance Taylor  <iant@google.com>
12920
12921         PR 10876
12922         * defstd.cc (in_segment): Set only_if_ref true for "end".
12923
12924 2009-11-06  Doug Kwan  <dougkwan@google.com>
12925
12926         * arm.cc (class Reloc_stub): Correct a comment.
12927         (Target_arm::Target_arm): Initialize arm_input_section_map_.
12928         (Target_arm::scan_section_for_stubs): New method declaration.
12929         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
12930         Change methods from private to protected.
12931         (Target_arm::do_may_relax): New method definition.
12932         (Target_arm::do_relax, Target_arm::group_sections,
12933         Target_arm::scan_reloc_for_stub,
12934         Target_arm::scan_reloc_section_for_stubs): New method declarations.
12935         (Target_arm::arm_input_section_map_): New data member declaration.
12936         (Target_arm::scan_reloc_for_stub,
12937         Target_arm::scan_reloc_section_for_stubs,
12938         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
12939         Target_arm::do_relax): New method definitions.
12940
12941 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
12942
12943         * configure.ac: Check for (struct stat)::st_mtim
12944         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
12945         * config.in: Regenerate.
12946         * configure: Regenerate.
12947
12948 2009-11-05  Ian Lance Taylor  <iant@google.com>
12949
12950         PR 10910
12951         * output.cc (Output_segment::add_output_section): Add missing
12952         return statement.
12953
12954 2009-11-04  Ian Lance Taylor  <iant@google.com>
12955
12956         PR 10880
12957         * object.h (class Object): Add is_needed and set_is_needed
12958         methods.  Add is_needed_ field.  Make bool fields into bitfields.
12959         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
12960         defined in a dynamic object and referenced by a regular object,
12961         set is_needed for the dynamic object.
12962         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
12963         if the file is marked with as_needed and it is not needed.
12964
12965 2009-11-04  Ian Lance Taylor  <iant@google.com>
12966
12967         PR 10887
12968         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
12969         tags if data is discarded by linker script.
12970         * i386.cc (Target_i386::do_finalize_sections): Likewise.
12971         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12972         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12973         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12974
12975 2009-11-04  Ian Lance Taylor  <iant@google.com>
12976
12977         * layout.cc (Layout::get_output_section): Add is_interp and
12978         is_dynamic_linker_section parameters.  Change all callers.
12979         (Layout::choose_output_section): Likewise.
12980         (Layout::make_output_section): Likewise.
12981         (Layout::add_output_section_data): Add is_dynamic_linker_section
12982         parameter.  Change all callers.
12983         * layout.h (class Layout): Update declarations.
12984         * output.h (class Output_section): Add is_interp, set_is_interp,
12985         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
12986         Add is_interp_, is_dynamic_linker_section_ fields.  Change
12987         generate_code_fills_at_write_ to a bitfield.
12988         * output.cc (Output_section::Output_sections): Initialize new
12989         fields.
12990         (Output_segment::add_output_section): Add do_sort parameter.
12991         Change all callers.
12992
12993 2009-11-03  Ian Lance Taylor  <iant@google.com>
12994
12995         PR 10860
12996         * options.h (class General_options): Add --warn-common.
12997         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
12998         merging two common symbols.
12999         (Symbol_table::should_override): Handle --warn-common when merging
13000         a common symbol with a defined symbol.  Use report_resolve_problem
13001         for multiple definitions.
13002         (Symbol_table::report_resolve_problem): New function.
13003         * symtab.h (class Symbol_table): Declare report_resolve_problem.
13004
13005 2009-11-03  Doug Kwan  <dougkwan@google.com>
13006
13007         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
13008         stub_factory_.
13009         (Target_arm::stub_factory): New method definition.
13010         (Target_arm::new_arm_input_section,
13011         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
13012         Target_arm::reloc_uses_thumb_bit): New method declarations.
13013         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
13014         New type definitions.
13015         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
13016         member declarations.
13017         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
13018         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
13019         New method definitions.
13020
13021 2009-11-03  Ian Lance Taylor  <iant@google.com>
13022
13023         * options.h (class General_options): Add --warn_constructors.
13024
13025 2009-11-03  Ian Lance Taylor  <iant@google.com>
13026
13027         PR 10893
13028         * defstd.cc (in_section): Add entries for __rel_iplt_start,
13029         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
13030
13031 2009-11-03  Ian Lance Taylor  <iant@google.com>
13032
13033         PR 10895
13034         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
13035         --msgid-bugs-address.
13036         (install-pdf): New target.
13037         (install-data_yes): Look up one directory to find mkinstalldirs.
13038
13039 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
13040
13041         * po/Make-in (.po.gmo): Don't generate .gmo files in source
13042         tree.
13043
13044 2009-10-30  Doug Kwan  <dougkwan@google.com>
13045
13046         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
13047
13048 2009-10-30  Doug Kwan  <dougkwan@google.com>
13049
13050         * arm.cc (Stub_addend_reader): New struct template definition
13051         and partial specializations.
13052         (Stub_addend_reader::operator()): New method definition for a
13053         partially specialized template.
13054
13055 2009-10-30  Doug Kwan  <dougkwan@google.com>
13056
13057         * arm.cc (Arm_relobj::processor_specific_flags): New method
13058         definition.
13059         (Arm_relobj::do_read_symbols): New method declaration.
13060         (Arm_relobj::processor_specific_flags_): New data member declaration.
13061         (Arm_dynobj): New class definition.
13062         (Target_arm::do_finalize_sections): Add input_objects parameter.
13063         (Target_arm::do_adjust_elf_header): New method declaration.
13064         (Target_arm::are_eabi_versions_compatible,
13065         (Target_arm::merge_processor_specific_flags): New method declaration.
13066         (Target_arm::do_make_elf_object): New overloaded method definitions
13067         and declaration.
13068         (Arm_relobj::do_read_symbols): New method definition.
13069         (Arm_dynobj::do_read_symbols): Ditto.
13070         (Target_arm::do_finalize_sections): Add input_objects parameters.
13071         Merge processor-specific flags from all input objects.
13072         (Target_arm::are_eabi_versions_compatible,
13073         Target_arm::merge_processor_specific_flags,
13074         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
13075         New method definitions.
13076         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
13077         Input_objects pointer type parameter.
13078         * layout.cc (Layout::finalize): Pass input objects to target's.
13079         finalize_sections function.
13080         * output.cc (Output_file_header::do_sized_write): Set ELF file
13081         header's processor-specific flags.
13082         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
13083         Input_objects pointer type parameter.
13084         * sparc.cc (Target_sparc::do_finalize_sections): Same.
13085         * target.h (Input_objects): New forward class declaration.
13086         (Target::processor_specific_flags,
13087         Target::are_processor_specific_flags_sect): New method definitions.
13088         (Target::finalize_sections): Add input_objects parameter.
13089         (Target::Target): Initialize processor_specific_flags_ and
13090         are_processor_specific_flags_set_.
13091         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
13092         parameter.
13093         (Target::set_processor_specific_flags): New method definition.
13094         (Target::processor_specific_flags_,
13095         Target::are_processor_specific_flags_set_): New data member
13096         declarations.
13097         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
13098         Input_objects pointer type parameter.
13099
13100 2009-10-30  Doug Kwan  <dougkwan@google.com>
13101
13102         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
13103
13104 2009-10-28  Ian Lance Taylor  <iant@google.com>
13105
13106         * object.h (class Relobj): Drop options parameter from
13107         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
13108         do_scan_relocs, do_relocate.  Change all callers.
13109         (class Sized_relobj): Drop options parameters from
13110         do_gc_process_relocs, do_scan_relocs, do_relocate,
13111         do_relocate_sections, relocate_sections, emit_relocs_scan,
13112         emit_relocs_scan_reltype.  Change all callers.
13113         (struct Relocate_info): Remove options field and all references to
13114         it.
13115         * reloc.h (class Read_relocs): Remove options constructor
13116         parameter and options_ field.  Change all callers.
13117         (class Gc_process_relocs, class Scan_relocs): Likewise.
13118         (class Relocate_task): Likewise.
13119         * target-reloc.h (scan_relocs): Remove options parameter.  Change
13120         all callers.
13121         (scan_relocatable_relocs): Likewise.
13122         * target.h (class Sized_target): Remove options parameter from
13123         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
13124         all callers.
13125         * gc.h (gc_process_relocs): Remove options parameter.  Change all
13126         callers.
13127         * arm.cc: Update functions to remove options parameters.
13128         * i386.cc: Likewise.
13129         * powerpc.cc: Likewise.
13130         * sparc.cc: Likewise.
13131         * x86_64.cc: Likewise.
13132         * testsuite/testfile.cc: Likewise.
13133
13134 2009-10-28  Doug Kwan  <dougkwan@google.com>
13135
13136         * arm.cc (Arm_relobj): New class definition.
13137         (Arm_relobj::scan_sections_for_stubs,
13138         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
13139         New method definitions.
13140
13141 2009-10-28  Cary Coutant  <ccoutant@google.com>
13142
13143         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
13144         (Plugin::cleanup_done_): New member.
13145         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
13146         (Plugin_manager::cleanup_done_): Remove.
13147         (Plugin_manager::add_input_file): Edit error message.
13148         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
13149         (Plugin_manager::cleanup): Remove use of cleanup_done_.
13150
13151 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
13152
13153         * fileread.cc: (File_read::View::~View): Use the new
13154         data_ownership_ filed.
13155         (File_read::~File_read): Dispose the new whole_file_view_.
13156         (File_read::open): Mmap the whole file if needed.
13157         (File_read::open): Use whole_file_view_ instead of contents_.
13158         (File_read::find_view): Use whole_file_view_ if applicable.
13159         (File_read::do_read): Use whole_file_view_ instead of contents_.
13160         (File_read::make_view): Use whole_file_view_ instead of contents_,
13161         update File_read::View::View call.
13162         (File_read::find_or_make_view): Update File_read::View::View
13163         call.
13164         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
13165         remove contents_
13166         (File_read::View::Data_ownership): New enum.
13167         (File_read::View::View): Replace bool mapped_ with Data_ownership
13168         argument.
13169         (File_read::View::mapped_): Remove (replaced by data_ownership_).
13170         (File_read::View::data_ownership_): New field.
13171         (File_read::contents_): Remove (replaced by whole_file_view_).
13172         (File_read::whole_file_view_): New field.
13173         * options.h (class General_options): Add --keep-files-mapped.
13174
13175 2009-10-27  Cary Coutant  <ccoutant@google.com>
13176
13177         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
13178         * testsuite/Makefile.am (plugin_test_5): New test case.
13179         * testsuite/Makefile.in: Regenerate.
13180
13181 2009-10-25  Doug Kwan  <dougkwan@google.com>
13182
13183         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
13184         from private to protected to allow access by child class.
13185         (Sized_relobj::do_relocate_sections): New method declaration.
13186         (Sized_relobj::relocate_sections): Virtualize.
13187         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
13188         Sized_relobj::relocate_sections.  Instantiate template explicitly
13189         for different target sizes and endianity.
13190
13191 2009-10-24  Doug Kwan  <dougkwan@google.com>
13192
13193         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
13194         (Arm_input_section::as_arm_input_section): New method.
13195         (Arm_output_section): New class definition.
13196         (Arm_output_section::create_stub_group,
13197         Arm_output_section::group_sections): New method definitions.
13198
13199 2009-10-22  Doug Kwan  <dougkwan@google.com>
13200
13201         * arm.cc (Arm_input_section): New class definition.
13202         (Arm_input_section::init, Arm_input_section:do_write,
13203         Arm_input_section::set_final_data_size,
13204         Arm_input_section::do_reset_address_and_file_offset): New method
13205         definitions.
13206
13207 2009-10-21  Doug Kwan  <dougkwan@google.com>
13208
13209         * arm.cc (Stub_table, Arm_input_section): New forward class
13210         declarations.
13211         (Stub_table): New class defintion.
13212         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
13213         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
13214         New method definition.
13215
13216 2009-10-21  Doug Kwan  <dougkwan@google.com>
13217
13218         * arm.cc: Update copyright comments.
13219         (Target_arm): New forward class template declaration.
13220         (Arm_address): New type.
13221         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
13222         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
13223         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
13224         constants.
13225         (Insn_template): Same.
13226         (DEF_STUBS): New macro.
13227         (Stub_type): New enum type.
13228         (Stub_template): New class definition.
13229         (Stub): Same.
13230         (Reloc_stub): Same.
13231         (Stub_factory): Same.
13232         (Target_arm::Target_arm): Initialize may_use_blx_ and
13233         should_force_pic_veneer_.
13234         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
13235         Target_arm::should_force_pic_veneer,
13236         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
13237         Target_arm::using_thumb_only, Target_arm:;default_target): New
13238         method defintions.
13239         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
13240         New data member declarations.
13241         (Insn_template::size, Insn_template::alignment): New method defintions.
13242         (Stub_template::Stub_template): New method definition.
13243         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
13244         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
13245         (Stub_factory::Stub_factory): New method definition.
13246         * gold.h (string_hash): New template.
13247         * output.h (Input_section_specifier::hash_value): Use
13248         gold::string_hash.
13249         (Input_section_specifier::string_hash): Remove.
13250         * stringpool.cc (Stringpool_template::string_hash): Use
13251         gold::string_hash.
13252
13253 2009-10-20  Doug Kwan  <dougkwan@google.com>
13254
13255         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
13256         symbols of relaxed input sections.
13257         * output.h (Output_section::find_relaxed_input_section): Make
13258         method public.
13259
13260 2009-10-16  Doug Kwan  <dougkwan@google.com>
13261
13262         * dynobj.cc (Versions::Versions): Initialize version_script_.
13263         Only insert base version symbol definition for a shared object
13264         if version script defines any version versions.
13265         (Versions::define_base_version): New method definition.
13266         (Versions::add_def): Check that base version is not needed.
13267         (Versions::add_need): Define base version lazily.
13268         * dynobj.h (Versions::define_base_version): New method declaration.
13269         (Versions::needs_base_version_): New data member declaration.
13270         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
13271         (check_DATA): Add no_version_test.stdout.
13272         (libno_version_test.so, no_version_test.o no_version_test.stdout):
13273         New make rules.
13274         * testsuite/Makefile.in: Regenerate.
13275         * testsuite/no_version_test.c: New file.
13276         * testsuite/no_version_test.sh: Ditto.
13277
13278 2009-10-16  Doug Kwan  <dougkwan@google.com>
13279
13280         * expression.cc (class Segment_start_expression): New class definition.
13281         (Segment_start_expression::value): New method definition.
13282         (script_exp_function_segment_start): Return a new
13283         Segment_start_expression.
13284         * gold/script-c.h (script_saw_segment_start_expression): New function
13285         prototype.
13286         * script-sections.cc (Script_sections::Script_sections): Initialize
13287         SAW_SEGMENT_START_EXPRESSION_ to false.
13288         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
13289         and -Tbbs options to specify section addresses if given in
13290         command line and no SEGMENT_START expression is seen in a script.
13291         * script-sections.h (Script_sections::saw_segment_start_expression,
13292         Script_sections::set_saw_segment_start_expression): New method
13293         definition.
13294         (Script_sections::saw_segment_start_expression_): New data member
13295         declaration.
13296         * script.cc (script_saw_segment_start_expression): New function.
13297         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
13298         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
13299         script_test_7.sh and script_test_8.sh.
13300         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
13301         script_test_8.stdout.
13302         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
13303         (script_test_6, script_test_6.stdout, script_test_7,
13304         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
13305         * Makefile.in: Regenerate.
13306         * testsuite/script_test_6.sh: New file.
13307         * testsuite/script_test_6.t: Same.
13308         * testsuite/script_test_7.sh: Same.
13309         * testsuite/script_test_7.t: Same.
13310         * testsuite/script_test_8.sh: Same.
13311
13312 2009-10-16  Doug Kwan  <dougkwan@google.com>
13313
13314         * output.cc (Output_segment::set_section_list_address): Cast
13315         expressions to unsigned long long type to avoid format warnings.
13316
13317 2009-10-15  Ian Lance Taylor  <iant@google.com>
13318
13319         * script.cc (Script_options::add_symbol_assignment): Always add a
13320         dot assignment to script_sections_.
13321         * script-sections.cc (Script_sections::add_dot_assignment):
13322         Initialize if necessary.
13323
13324         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
13325         program headers with no load segment if there is a linker script.
13326
13327         * layout.cc (Layout::set_segment_offsets): Align the file offset
13328         to the segment aligment for -N or -n with no load segment.
13329         * output.cc (Output_segment::add_output_section): Don't crash if
13330         the first section is a TLS section.
13331         (Output_segment::set_section_list_addresses): Print an error
13332         message if the address moves backward in a linker script.
13333         * script-sections.cc
13334         (Output_section_element_input::set_section_addresses): Don't
13335         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
13336         (Orphan_output_section::set_section_addresses): Likewise.
13337
13338 2009-10-15  Doug Kwan  <dougkwan@google.com>
13339
13340         * layout.cc (Layout::finish_dynamic_section): Generate tags
13341         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
13342         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
13343         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
13344
13345 2009-10-14  Ian Lance Taylor  <iant@google.com>
13346
13347         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
13348         fields.
13349         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
13350         data_shdr fields of relinfo.
13351         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
13352         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
13353         R_386_TLS_LDO_32, adjust based on section flags.
13354         (Target_i386::Relocate::fix_up_ldo): Remove.
13355
13356 2009-10-13  Ian Lance Taylor  <iant@google.com>
13357
13358         Add support for -pie.
13359         * options.h (class General_options): Add -pie and
13360         --pic-executable.
13361         (General_options::output_is_position_independent): Test -pie.
13362         (General_options::output_is_executable): Return true if not shared
13363         and not relocatable.
13364         (General_options::output_is_pie): Remove.
13365         * options.cc (General_options::finalize): Reject incompatible uses
13366         of -pie.
13367         * gold.cc (queue_middle_tasks): A -pie link is not static.
13368         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
13369         * symtab.cc (Symbol::final_value_is_known): Return false if
13370         output_is_position_independent.
13371         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
13372         output_is_position_independent.
13373         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
13374         output_is_position_independent.
13375         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
13376         output_is_position_independent.
13377         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
13378         two_file_pie_test.
13379         (basic_pie_test.o, basic_pie_test): New targets.
13380         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
13381         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
13382         (two_file_pie_test): New target.
13383         * testsuite/Makefile.in: Rebuild.
13384         * README: Remove note saying that -pie is not supported.
13385
13386 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
13387
13388         * options.h (class General_options): Add -init and -fini.
13389         * layout.cc (Layout::finish_dynamic_section): Emit
13390         given init and fini functions.
13391
13392 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
13393
13394         * gc.h (gc_process_relocs): Check if icf is enabled using new
13395         function.
13396         * gold.cc (queue_initial_tasks): Likewise.
13397         (queue_middle_tasks): Likewise.
13398         * object.cc (do_layout): Likewise.
13399         * symtab.cc (is_section_folded): Likewise.
13400         * main.cc (main): Likewise.
13401         * reloc.cc (Read_relocs::run): Likewise.
13402         (Sized_relobj::do_scan_relocs): Likewise.
13403         * icf.cc (is_function_ctor_or_dtor): New function.
13404         (Icf::find_identical_sections): Check if function is ctor or dtor when
13405         safe icf is chosen.
13406         * options.h (General_options::icf): Change option to be an enum.
13407         (Icf_status): New enum.
13408         (icf_enabled): New method.
13409         (icf_safe_folding): New method.
13410         (set_icf_status): New method.
13411         (icf_status_): New variable.
13412         * (options.cc) (General_options::finalize): Set icf_status_.
13413         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
13414         icf_test and icf_keep_unique_test to use the --icf enum flag.
13415         * testsuite/icf_safe_test.sh: New file.
13416         * testsuite/icf_safe_test.cc: New file.
13417
13418 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
13419
13420         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
13421         includes to gc.h and icf.h.
13422         * arm.cc: Include gc.h.
13423         * gold.cc: Likewise.
13424         * i386.cc: Likewise.
13425         * powerpc.cc: Likewise.
13426         * sparc.cc: Likewise.
13427         * x86_64.cc: Likewise.
13428         * gc.h: Include icf.h.
13429
13430 2009-10-11  Ian Lance Taylor  <iant@google.com>
13431
13432         * plugin.cc: Include "gold.h" before other header files.
13433
13434 2009-10-10  Chris Demetriou  <cgd@google.com>
13435
13436         * options.h (Input_file_argument::Input_file_type): New enum.
13437         (Input_file_argument::is_lib_): Replace with...
13438         (Input_file_argument::type_): New member.
13439         (Input_file_argument::Input_file_argument): Take Input_file_type
13440         'type' rather than boolean 'is_lib' as second argument.
13441         (Input_file_argument::is_lib): Use type_.
13442         (Input_file_argument::is_searched_file): New function.
13443         (Input_file_argument::may_need_search): Handle is_searched_file.
13444         * options.cc (General_options::parse_library): Support -l:filename.
13445         (General_options::parse_just_symbols): Update for Input_file_argument
13446         changes.
13447         (Command_line::process): Likewise.
13448         * archive.cc (Archive::get_file_and_offset): Likewise.
13449         * plugin.cc (Plugin_manager::release_input_file): Likewise.
13450         * script.cc (read_script_file, script_add_file): Likewise.
13451         * fileread.cc (Input_file::Input_file): Likewise.
13452         (Input_file::will_search_for): Handle is_searched_file.
13453         (Input_file::open): Likewise.
13454         * readsyms.cc (Read_symbols::get_name): Likewise.
13455         * testsuite/Makefile.am (searched_file_test): New test.
13456         * testsuite/Makefile.in: Regenerate.
13457         * testsuite/searched_file_test.cc: New file.
13458         * testsuite/searched_file_test_lib.cc: New file.
13459
13460 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13461             Ian Lance Taylor  <iant@google.com>
13462
13463         * descriptor.cc: Include <cstdio> and "binary-io.h".
13464         (Descriptors::open): Open the files in binary mode always.
13465         * script.cc (Lex::get_token): Treat \r as whitespace.
13466
13467 2009-10-09  Ian Lance Taylor  <iant@google.com>
13468
13469         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
13470
13471 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13472             Ian Lance Taylor  <iant@google.com>
13473
13474         * configure.ac: Check for readv function also.
13475         * fileread.cc (readv): Define if not HAVE_READV.
13476         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
13477         does not exist.
13478         * config.in: Regenerate.
13479         * configure: Regenerate.
13480
13481 2009-10-09  Doug Kwan  <dougkwan@google.com>
13482
13483         * layout.cc (Layout::make_output_section): Call target hook to make
13484         ordinary output section.
13485         (Layout::finalize): Adjust parameter list of call the
13486         Target::may_relax().
13487         * layout.h (class Layout::section_list): New method.
13488         * merge.h (Output_merge_base::entsize): Change visibility to public.
13489         (Output_merge_base::is_string, Output_merge_base::do_is_string):
13490         New methods.
13491         (Output_merge_string::do_is_string): New method.
13492         * object.cc (Sized_relobj::do_setup): renamed from
13493         Sized_relobj::set_up.
13494         * object.h (Sized_relobj::adjust_shndx,
13495         Sized_relobj::initializ_input_to_output_maps,
13496         Sized_relobj::free_input_to_output_maps): Change visibilities to
13497         protected.
13498         (Sized_relobj::setup): Virtualize.
13499         (Sized_relobj::do_setup): New method declaration.
13500         (Sized_relobj::invalidate_section_offset,
13501         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
13502         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
13503         * options.cc (parse_int): New function.
13504         * options.h (parse_int): New declaration.
13505         (DEFINE_int): New macro.
13506         (stub_group_size): New option.
13507         * output.cc (Output_section::Output_section): Initialize memebers
13508         merge_section_map_, merge_section_by_properties_map_,
13509         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
13510         (Output_section::add_input_section): Handled deferred code-fill
13511         generation and remove an old comment.
13512         (Output_section::add_relaxed_input_section): New method definition.
13513         (Output_section::add_merge_input_section): Use merge section by
13514         properties map to speed to search.  Update merge section maps
13515         as appropriate.
13516         (Output_section::build_relaxation_map): New method definition.
13517         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
13518         Same.
13519         (Output_section::relax_input_section): Renamed to
13520         Output_section::convert_input_sections_to_relaxed_sections and change
13521         interface to take a vector of pointers to relaxed sections.
13522         (Output_section::find_merge_section,
13523         Output_section::find_relaxed_input_section): New method definitions.
13524         (Output_section::is_input_address_mapped,
13525         Output_section::output_offset, Output_section::output_address):
13526         Use output section data maps to speed up searching.
13527         (Output_section::find_starting_output_address): Add comments.
13528         (Output_section::do_write,
13529         Output_section::write_to_postprocessing_buffer): Do code-fill
13530         generation as appropriate.
13531         (Output_section::get_input_sections): Invalidate relaxed input section
13532         map.
13533         (Output_section::restore_states): Adjust type of checkpoint .
13534         Invalidate relaxed input section map.
13535         * output.h (Output_merge_base): New class declaration.
13536         (Input_section_specifier): New class defintion.
13537         (class Output_relaxed_input_section) Change base class to
13538         Output_section_data_build.
13539         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
13540         base class initializer.
13541         (Output_section::add_relaxed_input_section): New method declaration.
13542         (Output_section::Input_section): Change visibility to protected.
13543         (Output_section::Input_section::relobj,
13544         Output_section::Input_section::shndx): Handle relaxed input sections.
13545         Output_section::input_sections) Change visibility to protected.  Also
13546         define overload to return a non-const pointer.
13547         (Output_section::Merge_section_properties): New class defintion.
13548         (Output_section::Merge_section_by_properties_map,
13549         Output_section::Output_section_data_by_input_section_map,
13550         Output_section::Relaxation_map): New types.
13551         (Output_section::relax_input_section): Rename method to
13552         Output_section::convert_input_sections_to_relaxed_sections and change
13553         interface to take a vector of relaxed section pointers.
13554         (Output_section::find_merge_section,
13555         Output_section::find_relaxed_input_section,
13556         Output_section::build_relaxation_map,
13557         Output_section::convert_input_sections_in_list_to_relaxed_sections):
13558         New method declarations.
13559         (Output_section::merge_section_map_
13560         Output_section::merge_section_by_properties_map_,
13561         Output_section::relaxed_input_section_map_,
13562         Output_section::is_relaxed_input_section_map_valid_,
13563         Output_section::generate_code_fills_at_write_): New data members.
13564         * script-sections.cc
13565         (Output_section_element_input::set_section_addresses): Call
13566         current_data_size and addralign methods of relaxed input sections.
13567         (Orphan_output_section::set_section_addresses): Call current_data_size
13568         and addralign methods of relaxed input sections.
13569         * symtab.cc (Symbol_table::compute_final_value): Extract template
13570         from the body of Symbol_table::sized_finalize_symbol.
13571         (Symbol_table::sized_finalized_symbol): Call
13572         Symbol_table::compute_final_value.
13573         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
13574         (Symbol_table::compute_final_value): New templated method declaration.
13575         * target.cc (Target::do_make_output_section): New method defintion.
13576         * target.h (Target::make_output_section): New method declaration.
13577         (Target::relax): Add more parameters for input objects, symbol table
13578         and layout.  Adjust call to do_relax.
13579         (Target::do_make_output_section): New method declaration.
13580         (Target::do_relax): Add parameters for input objects, symbol table
13581         and layout.
13582
13583 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13584
13585         * pread.c: Include stdio.h.
13586
13587 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13588
13589         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
13590         defined.
13591
13592 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13593
13594         * dwarf_reader.cc (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         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
13600         Change read_shndx type to unsigned int.
13601         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13602         int.
13603         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13604         * layout.cc (Layout::create_symtab_sections): Cast the result of
13605         local_symcount * symsize to off_t in the gold_assert.
13606
13607 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13608
13609         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
13610         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
13611         R_ARM_BASE_ABS.
13612         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
13613         (Arm_relocate_functions::thm_abs5): New function.
13614         (Arm_relocate_functions::abs12): New function.
13615         (Arm_relocate_functions::abs16): New function.
13616         (Arm_relocate_functions::base_abs): New function.
13617         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
13618         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
13619         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
13620         R_ARM_BASE_ABS.
13621         (Scan::global): Likewise.
13622         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
13623         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
13624         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
13625         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
13626         R_ARM_BASE_ABS.
13627
13628 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13629
13630         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
13631         (Arm_relocate_functions::movt_prel): New function.
13632         (Arm_relocate_functions::thm_movw_prel_nc): New function.
13633         (Arm_relocate_functions::thm_movt_prel): New function.
13634         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
13635         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
13636         (Scan::global, Relocate::relocate): Likewise.
13637         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13638
13639 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13640
13641         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
13642         Incremental_checker.
13643         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
13644         unsigned int.
13645         (class Incremental_inputs_header): New class.
13646         (Incremental_inputs_header_writer): Edit comment.
13647         (Incremental_inputs_entry): New class.
13648         (Incremental_inputs_entry_writer): Edit comment.
13649         (Sized_incremental_binary::do_find_incremental_inputs_section):
13650         Add *strtab_shndx parameter, fill it.
13651         (Sized_incremental_binary::do_check_inputs): New method.
13652         (Incremental_checker::can_incrementally_link_output_file): Use
13653         Sized_incremental_binary::check_inputs.
13654         (Incremental_inputs::report_command_line): Save command line in
13655         command_line_.
13656         * incremental.h:
13657         (Incremental_binary::find_incremental_inputs_section): New
13658         method.
13659         (Incremental_binary::do_find_incremental_inputs_section): Add
13660         strtab_shndx parameter.
13661         (Incremental_binary::do_check_inputs): New pure virtual method.
13662         (Sized_incremental_binary::do_check_inputs): Declare.
13663         (Incremental_checker::Incremental_checker): Add incremental_inputs
13664         parameter, use it to initialize incremental_inputs_.
13665         (Incremental_checker::incremental_inputs_): New field.
13666         (Incremental_checker::command_line): New method.
13667         (Incremental_checker::inputs): New method.
13668         (Incremental_checker::command_line_): New field.
13669
13670 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13671
13672         * incremental.cc: Include <cstdarg> and "target-select.h".
13673         (vexplain_no_incremental): New function.
13674         (explain_no_incremental): New function.
13675         (Incremental_binary::error): New method.
13676         (Sized_incremental_binary::do_find_incremental_inputs_section): New
13677         method.
13678         (make_sized_incremental_binary): New function.
13679         (open_incremental_binary): New function.
13680         (can_incrementally_link_file): Add checks if output is ELF and has
13681         inputs section.
13682         * incremental.h: Include "elfcpp_file.h" and "output.h".
13683         (Incremental_binary): New class.
13684         (Sized_incremental_binary): New class.
13685         (open_incremental_binary): Declare.
13686         * object.cc (is_elf_object): Use
13687         elfcpp::Elf_recognizer::is_elf_file.
13688         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
13689         * output.h (Output_file::filesize): New method.
13690
13691 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13692
13693         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
13694         New function.
13695         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
13696         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
13697         function.
13698         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
13699         function.
13700         (Arm_relocate_functions::movw_abs_nc): New function.
13701         (Arm_relocate_functions::movt_abs): New function.
13702         (Arm_relocate_functions::thm_movw_abs_nc): New function.
13703         (Arm_relocate_functions::thm_movt_abs): New function.
13704         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
13705         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
13706         (Scan::global): Likewise.
13707         (Relocate::relocate): Likewise.
13708         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13709
13710 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13711
13712         * arm.cc (Arm_relocate_functions::got_prel) New function.
13713         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
13714         (Relocate::relocate): Likewise.
13715         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13716
13717 2009-10-06  Ian Lance Taylor  <iant@google.com>
13718
13719         * options.h (class General_options): Define
13720         split_stack_adjust_size parameter.
13721         * object.h (class Object): Add uses_split_stack_ and
13722         has_no_split_stack_ fields.  Add uses_split_stack and
13723         has_no_split_stack accessor functions.  Declare
13724         handle_split_stack_section.
13725         (class Reloc_symbol_changes): Define.
13726         (class Sized_relobj): Define Function_offsets.  Declare
13727         split_stack_adjust, split_stack_adjust_reltype, and
13728         find_functions.
13729         * object.cc (Object::handle_split_stack_section): New function.
13730         (Sized_relobj::do_layout): Call handle_split_stack_section.
13731         * dynobj.cc (Sized_dynobj::do_layout): Call
13732         handle_split_stack_section.
13733         * reloc.cc (Sized_relobj::relocate_sections): Call
13734         split_stack_adjust for executable sections in split_stack
13735         objects.  Pass reloc_map to relocate_section.
13736         (Sized_relobj::split_stack_adjust): New function.
13737         (Sized_relobj::split_stack_adjust_reltype): New function.
13738         (Sized_relobj::find_functions): New function.
13739         * target-reloc.h: Include "object.h".
13740         (relocate_section): Add reloc_symbol_changes parameter.  Change
13741         all callers.
13742         * target.h (class Target): Add calls_non_split method.  Declare
13743         do_calls_non_split virtual method.  Declare match_view and
13744         set_view_to_nop.
13745         * target.cc: Include "elfcpp.h".
13746         (Target::do_calls_non_split): New function.
13747         (Target::match_view): New function.
13748         (Target::set_view_to_nop): New function.
13749         * gold.cc (queue_middle_tasks): Give an error if mixing
13750         split-stack and non-split-stack objects with -r.
13751         * i386.cc (Target_i386::relocate_section): Add
13752         reloc_symbol_changes parameter.
13753         (Target_i386::do_calls_non_split): New function.
13754         * x86_64.cc (Target_x86_64::relocate_section): Add
13755         reloc_symbol_changes parameter.
13756         (Target_x86_64::do_calls_non_split): New function.
13757         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
13758         parameter.
13759         * powerpc.cc (Target_powerpc::relocate_section): Add
13760         reloc_symbol_changes parameter.
13761         * sparc.cc (Target_sparc::relocate_section): Add
13762         reloc_symbol_changes parameter.
13763         * configure.ac: Call AM_CONDITIONAL for the default target.
13764         * configure: Rebuild.
13765         * testsuite/Makefile.am (TEST_AS): New variable.
13766         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
13767         (check_DATA): Add split_i386 and split_x86_64 files.
13768         (SPLIT_DEFSYMS): Define.
13769         (split_i386_[1234n].o): New targets.
13770         (split_i386_[124]): New targets.
13771         (split_i386_[1234r].stdout): New targets.
13772         (split_x86_64_[1234n].o): New targets.
13773         (split_x86_64_[124]): New targets.
13774         (split_x86_64_[1234r].stdout): New targets.
13775         (MOSTLYCLEANFILES): Add new executables.
13776         * testsuite/split_i386.sh: New file.
13777         * testsuite/split_x86_64.sh: New file.
13778         * testsuite/split_i386_1.s: New file.
13779         * testsuite/split_i386_2.s: New file.
13780         * testsuite/split_i386_3.s: New file.
13781         * testsuite/split_i386_4.s: New file.
13782         * testsuite/split_i386_n.s: New file.
13783         * testsuite/split_x86_64_1.s: New file.
13784         * testsuite/split_x86_64_2.s: New file.
13785         * testsuite/split_x86_64_3.s: New file.
13786         * testsuite/split_x86_64_4.s: New file.
13787         * testsuite/split_x86_64_n.s: New file.
13788         * testsuite/testfile.cc (Target_test): Update relocation_section
13789         function.
13790         * testsuite/Makefile.in: Rebuild.
13791
13792 2009-10-06  Ian Lance Taylor  <iant@google.com>
13793
13794         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
13795         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
13796         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
13797         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
13798         the address on ldo_addrs_.
13799         (Target_i386::Relocate::fix_up_ldo): New function.
13800
13801 2009-10-06   Rafael Espindola  <espindola@google.com>
13802
13803         * plugin.cc (add_input_library): New.
13804         (Plugin::load): Add add_input_library to tv.
13805         (Plugin_manager::add_input_file): Add the is_lib argument.
13806         (add_input_file): Update call to Plugin_manager::add_input_file.
13807         (add_input_library): New.
13808         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
13809
13810 2009-09-30  Doug Kwan  <dougkwan@google.com>
13811
13812         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
13813         symbol and call Symbol::may_need_copy_reloc to determine if
13814         a copy reloc is needed.
13815         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
13816         nocopyreloc is given in command line.
13817         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
13818         given in command line.
13819         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
13820         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
13821         of the removed Target_i386::may_need_copy_reloc.
13822         * options.h (copyreloc): New option with default value false.
13823         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13824         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
13825         instead of the removed Target_powerpc::may_need_copy_reloc.
13826         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13827         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
13828         instead of the removed Target_sparc::may_need_copy_reloc.
13829         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
13830         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
13831         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
13832         instead of the removed Target_x86_64::may_need_copy_reloc.
13833
13834 2009-09-30  Ian Lance Taylor  <iant@google.com>
13835
13836         * object.h (class Object): Remove target_ field, and target,
13837         sized_target, and set_target methods.
13838         (Object::sized_target): Remove.
13839         (class Sized_relobj): Update declarations.  Remove sized_target.
13840         * object.cc (Sized_relobj::setup): Remove target parameter.
13841         Change all callers.
13842         (Input_objects::add_object): Don't do anything with the target.
13843         (make_elf_sized_object): Add punconfigured parameter.  Change all
13844         callers.  Set or test parameter target.
13845         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
13846         Change all callers.
13847         * parameters.cc (Parameters::set_target): Change parameter type to
13848         be non-const.
13849         (Parameters::default_target): Remove.
13850         (set_parameters_target): Change parameter type to be non-const.
13851         (parameters_force_valid_target): New function.
13852         (parameters_clear_target): New function.
13853         * parameters.h (class Parameters): Update declarations.  Remove
13854         default_target method.  Add sized_target and clear_target
13855         methods.  Change target_ to be non-const.
13856         (set_parameters_target): Update declaration.
13857         (parameters_force_valid_target): Declare.
13858         (parameters_clear_target): Declare.
13859         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
13860         as NULL if we aren't searching.
13861         (Add_symbols::run): Don't check for compatible target.
13862         * fileread.cc (Input_file::open_binary): Call
13863         parameters_force_valid_target.
13864         * gold.cc (queue_middle_tasks): Likewise.
13865         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
13866         set_target on object.
13867         * dynobj.h (class Sized_dynobj): Update declarations.
13868         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
13869         make_elf_object returns NULL.
13870         (Archive::include_member): Don't check whether object target is
13871         compatible.
13872         * output.cc (Output_section::add_input_section): Get target from
13873         parameters.
13874         (Output_section::relax_input_section): Likewise.
13875         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
13876         parameters.
13877         (Sized_relobj::do_scan_relocs): Likewise.
13878         (Sized_relobj::relocate_sections): Likewise.
13879         * resolve.cc (Symbol_table::resolve): Likewise.
13880         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
13881         parameter.  Change all callers.
13882         (Symbol_table::add_from_object): Get target from parameters.
13883         (Symbol_table::add_from_relobj): Don't check object target.
13884         (Symbol_table::add_from_dynobj): Likewise.
13885         (Symbol_table::define_special_symbol): Get target from
13886         parameters.
13887         * symtab.h (class Symbol_table): Update declaration.
13888         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
13889         parameter.  Change all callers.  Clear parameter target.
13890         (Binary_test): Test target here.
13891         * testsuite/object_unittest.cc (gold_testsuite): Remove
13892         target_test_pointer parameter.  Change all callers.
13893         (Object_test): Test target here.
13894
13895 2009-09-26  Ian Lance Taylor  <iant@google.com>
13896
13897         * testsuite/initpri1.c: Don't try to use constructor priorities if
13898         compiling with gcc before 4.3.
13899
13900 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
13901
13902         * testsuite/retain_symbols_file_test.sh (check_present): Change
13903         output file name to retain_symbols_file_test.stdout.
13904         (check_absent): Likewise.
13905
13906 2009-09-18  Craig Silverstein  <csilvers@google.com>
13907
13908         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
13909         * options.cc: Include <cerrno> and <fstream>.
13910         (General_options::finalize): Parse -retain-symbols-file tag.
13911         * options.h: New flag.
13912         (General_options): New method should_retain_symbol, new
13913         variable symbols_to_retain.
13914         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
13915         should_retain_symbol map.
13916         * testsuite/Makefile.am (retain_symbols_file_test): New test.
13917         * testsuite/Makefile.in: Regenerate.
13918         * testsuite/retain_symbols_file_test.sh: New file.
13919
13920 2009-09-18  Nick Clifton  <nickc@redhat.com>
13921
13922         * po/es.po: Updated Spanish translation.
13923
13924 2009-09-17  Doug Kwan  <dougkwan@google.com>
13925
13926         * debug.h (DEBUG_RELAXATION): New constant.
13927         (DEBUG_ALL): Add DEBUG_RELAXATION.
13928         (debug_string_to_enum): Add relaxation debug option.
13929         * layout.cc
13930         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
13931         Layout::Relaxation_debug_check::read_sections,
13932         Layout::Relaxation_debug_check::read_sections): New method definitions.
13933         (Layout::Layout): Initialize data members
13934         record_output_section_data_from_scrips_,
13935         script_output_section_data_list_ and relaxation_debug_check_.
13936         (Layout::save_segments, Layout::restore_segments,
13937         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13938         Layout::relaxation_loop_body): New method definitions.
13939         (Layout::finalize): Support relaxation.  Move section layout code to
13940         Layout::relaxation_loop_body.
13941         (Layout::set_asection_address_from_script): Move code for orphan
13942         section placement out.
13943         (Layout::place_orphan_sections_in_script): New method definition.
13944         * layout.h (Output_segment_headers, Output_file_header):
13945         New forward class declarations.
13946         (Layout::~Layout): Define.
13947         (Layout::new_output_section_data_from_script): New method definition.
13948         (Layout::place_orphan_sections_in_script): New method declaration.
13949         (Layout::Segment_states): New type declaration.
13950         (Layout::save_segments, Layout::restore_segments,
13951         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13952         Layout::relaxation_loop_body): New method declarations.
13953         (Layout::Output_section_data_list): New type declaration.
13954         (Layout::Relaxation_debug_check): New class definition.
13955         (Layout::record_output_section_data_from_script_,
13956         Layout::script_output_section_data_list_, Layout::segment_states_,
13957         Layout::relaxation_debug_check_): New data members.
13958         * output.cc: (Output_section_headers::do_size): New method definition.
13959         (Output_section_headers::Output_section_headers): Move size
13960         computation to Output_section_headers::do_size.
13961         (Output_segment_headers::do_size): New method definition.
13962         (Output_file_header::Output_file_header): Move size computation to
13963         Output_file_header::do_size and call it.
13964         (Output_file_header::do_size): New method definition.
13965         (Output_data_group::Output_data_group): Adjust call to
13966         Output_section_data.
13967         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
13968         (Output_symtab_xindex::do_write): Add array bound check.
13969         (Output_section::Input_section::print_to_mapfile): Handle
13970         RELAXED_INPUT_SECTION_CODE.
13971         (Output_section::Output_section): Initialize data member checkpoint_.
13972         (Output_section::~Output_section): Delete checkpoint object pointed
13973         by checkpoint_.
13974         (Output_section::add_input_section): Always add an Input_section if
13975         relaxing.
13976         (Output_section::add_merge_input_section): Add assert.
13977         (Output_section::relax_input_section): New method definition.
13978         (Output_section::set_final_data_size): Set load address to zero for
13979         an unallocated section.
13980         (Output_section::do_address_and_file_offset_have_reset_values):
13981         New method definition.
13982         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
13983         Handle relaxed input section.
13984         (Output_section::sort_attached_input_sections): Checkpoint input
13985         section list lazily.
13986         (Output_section::get_input_sections): Change type of input_sections to
13987         list of Simple_input_section pointers.  Checkpoint input section list
13988         lazily.  Also handle relaxed input sections.
13989         (Output_section::add_input_section_for_script): Take a reference to
13990         a Simple_input_section object instead of Relobj pointer and section
13991         index as parameter.  Handle relaxed input sections.
13992         (Output_section::save_states, Output_section::restore_states): New
13993         method definitions.
13994         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
13995         (Output_data::is_data_size_fixed): New method definition.
13996         (Output_data::reset_addresss_and_file_offset): Do not reset data size
13997         if it is fixed.
13998         (Output_data::address_and_file_offset_have_reset_values): New method
13999         definition.
14000         (Output_data::do_address_and_file_offset_have_reset_values): New method
14001         definition.
14002         (Output_data::set_data_size): Check that data size is not fixed.
14003         (Output_data::fix_data_size): New method definition.
14004         (Output_data::is_data_size_fixed_): New data member.
14005         (Output_section_headers::set_final_data_size): New method definition.
14006         (Output_section_headers::do_size): New method declaration.
14007         (Output_segment_headers::set_final_data_size): New method definition.
14008         (Output_segment_headers::do_size): New method declaration.
14009         (Output_file_header::set_final_data_size)::New method definition.
14010         (Output_file_header::do_size)::New method declaration.
14011         (Output_section_data::Output_section_data): Add new parameter
14012         is_data_size_fixed and use it to fix data size.
14013         (Output_data_const::Output_data_const): Adjust call to base class
14014         constructor and fix data size.
14015         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
14016         base class constructor and fix data size.
14017         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
14018         base class constructor and fix data size.
14019         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
14020         class constructor and fix data size.
14021         (Output_data_group::set_final_data_size): New method definition.
14022         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
14023         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
14024         class constructor and fix data size.
14025         (Output_relaxed_input_section): New class definition.
14026         (Output_section::Simple_input_section): New class definition.
14027         (Output_section::get_input_sections): Adjust parameter list.
14028         (Output_section::add_input_section_for_script): Same.
14029         (Output_section::save_states, Output_section::restore_states,
14030         Output_section::do_address_and_file_offset_have_reset_values,
14031         (Output_section::Input_section::Input_section): Handle
14032         RELAXED_INPUT_SECTION_CODE.  Add new overload for
14033         Output_relaxed_input_section.
14034         (Output_section::Input_section::is_input_section,
14035         Output_section::Input_section::set_output_section): Handle relaxed
14036         input section.
14037         (Output_section::Input_section::is_relaxed_input_section,
14038         Output_section::Input_section::output_section_data,
14039         Output_section::Input_section::relaxed_input_section): New method
14040         definitions.
14041         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
14042         value.
14043         (Output_section::Input_section::u1_): Update comments.
14044         (Output_section::Input_section::u2_): Add new union member poris.
14045         (Output_section::Checkpoint_output_section): New classs definition.
14046         (Output_section::relax_input_section): New method declaration.
14047         (Output_section::checkpoint_): New data member.
14048         (Output_segment): Update comments.
14049         (Output_segment::Output_segment): Un-privatize copy constructor.
14050         (Output_segment::operator=): Un-privatize.
14051         * script-sections.cc (Output_section_element::Input_section_list):
14052         Change element type to Output_section::Simple_input_section.
14053         (Output_section_element_dot_assignment::set_section_addresses):
14054         Register output section data for relaxation clean up.
14055         (Output_data_exression::Output_data_expression): Adjust call to base
14056         constructor to fix data size.
14057         (Output_section_element_data::set_section_addresses): Register
14058         Output_data_expression object for relaxation clean up.
14059         (struct Input_section_info): Replace Relobj pointer and section index
14060         pair with Output_section::Simple_input_section and Convert struct to a
14061         class.
14062         (Input_section_sorter::operator()): Adjust access to
14063         Input_section_info data member to use accessors.
14064         (Output_section_element_input::set_section_addresses): Use layout
14065         parameter.  Adjust code to use Output_section::Simple_input_section
14066         and Input_secction_info classes.  Register filler for relaxation
14067         clean up.
14068         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
14069         and section index pair with Output_section::Simple_input_section
14070         class.  Adjust code accordingly.
14071         (Phdrs_element::release_segment): New method definition.
14072         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
14073         segment list.
14074         (Script_sections::release_segments): New method definition.
14075         * gold/script-sections.h (Script_sections::release_segments): New
14076         method declaration.
14077         * gold/target.h (Target::may_relax, Target::relax,
14078         Target::do_may_relax, Target::do_relax): New method definitions.
14079
14080 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
14081
14082         * arm.cc (has_signed_unsigned_overflow): New function.
14083         (Arm_relocate_functions::abs8): New function.
14084         (Target_arm::Scan::local): Handle R_ARM_ABS8.
14085         (Target_arm::Scan::global): Likewise.
14086         (Target_arm::relocate::relocate): Likewise.
14087         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
14088         Likewise.
14089
14090 2009-09-16  Cary Coutant  <ccoutant@google.com>
14091
14092         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
14093         * testsuite/Makefile.in: Regenerate.
14094
14095 2009-09-11  Nick Clifton  <nickc@redhat.com>
14096
14097         * po/gold.pot: Updated by the Translation project.
14098
14099 2009-09-08  Cary Coutant  <ccoutant@google.com>
14100
14101         * output.cc (Output_file::open): Add execute permission to empty file.
14102         * testsuite/Makefile.am (permission_test): New test.
14103         * testsuite/Makefile.in: Regenerate.
14104
14105 2009-09-02  Ian Lance Taylor  <iant@google.com>
14106
14107         * output.cc (Output_file::resize): Call map_no_anonymous rather
14108         than map.
14109
14110 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
14111
14112         * gold.cc: Include "incremental.h".
14113         (queue_initial_tasks): Call Incremental_checker methods.
14114         * incremental.cc: Include "output.h".
14115         (Incremental_checker::can_incrementally_link_output_file): New
14116         method.
14117         * incremental.h (Incremental_checker): New class.
14118
14119         * output.cc (Output_file::open_for_modification): New method.
14120         (Output_file::map_anonymous): Changed return type to bool.  Record
14121         map in base_ field.
14122         (Output_file::map_no_anonymous): New method, broken out of map.
14123         (Output_file::map): Use map_no_anonymous and map_anonymous.
14124         * output.h (class Output_file): Update declarations.
14125
14126 2009-08-24  Cary Coutant  <ccoutant@google.com>
14127
14128         * options.h (Command_line::Pre_options): New class.
14129         (Command_line::pre_options): New member.
14130         * options.cc (gold::options::ready_to_register): New variable.
14131         (One_option::register_option): Do nothing if not registering options.
14132         Assert if same short option registered twice.
14133         (General_options::General_options): Turn off option registration when
14134         done constructing.
14135         (Command_line::Pre_options::Pre_options): New constructor.
14136
14137 2009-08-24  Cary Coutant  <ccoutant@google.com>
14138
14139         * options.h (General_options::no_keep_memory): Remove incorrect
14140         short option.
14141
14142 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
14143
14144         * Makefile.am (am__skiplex, am__skipyacc): New.
14145         * Makefile.in: Regenerate.
14146
14147 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
14148
14149         * Makefile.am (AM_CPPFLAGS): Renamed from ...
14150         (INCLUDES): ... this.
14151         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
14152         (AM_CPPFLAGS): Renamed from ...
14153         (INCLUDE): ... this.
14154         * Makefile.in, testsuite/Makefile.in: Regenerate.
14155
14156         * Makefile.in: Regenerate.
14157         * aclocal.m4: Likewise.
14158         * config.in: Likewise.
14159         * configure: Likewise.
14160         * testsuite/Makefile.in: Likewise.
14161
14162         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
14163         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
14164         * Makefile.in: Regenerate.
14165         * testsuite/Makefile.in: Regenerate.
14166
14167 2009-08-19  Cary Coutant  <ccoutant@google.com>
14168
14169         * resolve.cc (Symbol_table::resolve): Don't complain about defined
14170         symbols in shared libraries overridden by hidden or internal symbols
14171         in the main program.
14172
14173 2009-08-19  Chris Demetriou  <cgd@google.com>
14174
14175         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
14176         checking source file names in error messages.
14177
14178 2009-08-18  Doug Kwan  <dougkwan@google.com>
14179
14180         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
14181         an elcpp::Ehdr as parameter.  Adjust call to set_target.
14182         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
14183         an elfcpp::Ehdr as parameter.
14184         * object.cc (Object::set_target): Remove the version that looks up
14185         a target and sets it.
14186         (Sized_relobj::setup): Take a Target object instead of
14187         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
14188         (make_elf_sized_object): Find target and ask target to
14189         make an ELF object.
14190         * object.h: (Object::set_target): Remove the version that looks up
14191         a target and sets it.
14192         (Sized_relobj::setup): Take a Target object instead of
14193         an elfcpp:Ehdr as parameter.
14194         * target.cc: Include dynobj.h.
14195         (Target::do_make_elf_object_implementation): New.
14196         (Target::do_make_elf_object): New.
14197         * target.h (Target::make_elf_object): New template declaration.
14198         (Target::do_make_elf_object): New method declarations.
14199         (Target::do_make_elf_object_implementation): New template declaration.
14200
14201 2009-08-14  Ian Lance Taylor  <iant@google.com>
14202
14203         * gold.h (FUNCTION_NAME): Define.
14204         (gold_unreachable): Use FUNCTION_NAME.
14205
14206 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
14207
14208         * icf.cc (Icf::find_identical_sections): Issue a warning when a
14209         symbol in the --keep-unique list is not found.
14210
14211 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
14212
14213         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
14214         been maked as --keep-unique.
14215         (Icf::unfold_section): New function.
14216         * icf.h (Icf::unfold_section): New function.
14217         * options.h (General_options::keep_unique): New option.
14218         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
14219         * testsuite/Makefile.in: Regenerate.
14220         * testsuite/icf_keep_unique_test.sh: New file.
14221         * testsuite/icf_keep_unique_test.cc: New file.
14222
14223 2009-08-12  Cary Coutant  <ccoutant@google.com>
14224
14225         PR 10471
14226         * resolve.cc (Symbol_table::resolve): Check for references from
14227         dynamic objects to hidden and internal symbols.
14228         * testsuite/Makefile.am (hidden_test.sh): New test.
14229         * testsuite/Makefile.in: Regenerate.
14230         * testsuite/hidden_test.sh: New script.
14231         * testsuite/hidden_test_1.c: New test source.
14232         * testsuite/hidden_test_main.c: New test source.
14233
14234 2009-08-11  Doug Kwan  <dougkwan@google.com>
14235
14236         * arm.cc: Update comments.
14237         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
14238         segment to locate the .ARM.exidx section if present.
14239
14240 2009-08-09  Doug Kwan  <dougkwan@google.com>
14241
14242         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
14243         patch.
14244
14245 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
14246         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
14247         compiler warnings.
14248
14249 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
14250
14251         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
14252         valid tls_segment only for non-debug-section relocations.
14253         * testsuite/Makefile.am: Add gc_tls_test.
14254         * testsuite/Makefile.in: Regenerate.
14255         * testsuite/gc_tls_test.cc: New file.
14256         * testsuite/gc_tls_test.sh: New file.
14257
14258 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
14259
14260         * icf.cc: New file.
14261         * icf.h: New file.
14262         * Makefile.am (CCFILES): Add icf.cc.
14263         (HFILES): Add icf.h
14264         * Makefile.in: Regenerate.
14265         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
14266         * gc.h (gc_process_relocs): Populate lists used by icf to contain
14267         section, symbol and addend information for the relocs.
14268         * gold.cc (queue_middle_tasks): Call identical code folding.
14269         * gold.h: Add defines for multimap.
14270         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
14271         to the call of finalize_local_symbols.
14272         * main.cc (main): Create object of class Icf.
14273         * object.cc (Sized_relobj::do_layout): Allow this function to be
14274         called twice during icf.
14275         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
14276         to sections marked as identical by icf.
14277         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
14278         when available.
14279         (Sized_relobj::do_section_entsize): New function.
14280         * object.h (Object::section_entsize): New function.
14281         (Object::do_section_entsize): New pure virtual function.
14282         (Relobj::finalize_local_symbols): Add new parameter.
14283         (Relobj::do_section_entsize): New function.
14284         * options.h (General_options::icf): New option.
14285         (General_options::icf_iterations): New option.
14286         (General_options::print_icf_sections): New option.
14287         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
14288         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
14289         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
14290         icf.
14291         * symtab.cc (Symbol_table::is_section_folded): New function.
14292         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
14293         to sections marked as identical by icf.
14294         * symtab.h (Symbol_table::set_icf): New function.
14295         (Symbol_table::icf): New function.
14296         (Symbol_table::is_section_folded): New function.
14297         (Symbol_table::icf_): New data member.
14298         * target-reloc.h (relocate_section): Ignore sections folded by icf.
14299         * testsuite/Makefile.am: Add commands to build icf_test.
14300         * testsuite/Makefile.in: Regenerate.
14301         * testsuite/icf_test.sh: New file.
14302         * testsuite/icf_test.cc: New file.
14303
14304 2009-07-24  Chris Demetriou  <cgd@google.com>
14305
14306         * layout.cc (is_compressible_debug_section): Fix incorrect
14307         comment about compressed section names.
14308
14309 2009-07-20  Ian Lance Taylor  <ian@airs.com>
14310
14311         PR 10419
14312         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
14313
14314 2009-07-16  Ian Lance Taylor  <iant@google.com>
14315
14316         PR 10400
14317         * layout.h: #include <map>.
14318         (class Kept_section): Change from struct to class.  Add accessors
14319         and setters.  Add section size to Comdat_group mapping.  Change
14320         Comdat_group to std::map.  Add is_comdat_ field.  Add
14321         linkonce_size field in union.
14322         (class Layout): Update declaration of find_or_add_kept_section.
14323         Don't declare find_kept_object.
14324         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
14325         parameter.  Add object, shndx, is_comdat, and is_group_name
14326         parameters.  Change all callers.  Adjust for new Kept_section.
14327         (Layout::find_kept_object): Remove.
14328         * object.cc (Sized_relobj::include_section_group): Update use of
14329         Kept_section.  Rename secnum to shndx.  Only record
14330         Kept_comdat_section if sections are the same size.
14331         (Sized_relobj::include_linkonce_section): Update use of
14332         Kept_section.  Only record Kept_comdat_section if sections are the
14333         same size.  Set size of linkonce section.
14334         (Sized_relobj::map_to_kept_section): Update call to
14335         get_kept_comdat_section.
14336         * object.h (class Sized_relobj): Rename fields in
14337         Kept_comdat_section to drop trailing underscores; change object
14338         field to Relobj*.  Change Kept_comdat_section_table to store
14339         struct rather than pointer.
14340         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
14341         Add kept_object and kept_shndx parameters.  Change all callers.
14342         (Sized_relobj::get_kept_comdat_section): Change return type to
14343         bool.  Add kept_object and kept_shndx parameters.  Change all
14344         callers.
14345         * plugin.cc (Pluginobj::include_comdat_group): Update call to
14346         Layout::find_or_add_kept_section.
14347
14348 2009-07-09  Ian Lance Taylor  <iant@google.com>
14349
14350         * merge.cc (Object_merge_map::initialize_input_to_output_map):
14351         Reserve space in the hash table.
14352
14353 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
14354
14355         * fileread.cc (File_read::get_mtime): New method.
14356         * fileread.h (Timespec): New structure.
14357         (File_read::get_mtime): New method.
14358         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
14359         Renamed from timestamp_nsec.
14360         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
14361         Elf_Xword.
14362         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
14363         timestamp_nsec.
14364         (Incremental_inputs::report_archive): Save mtime; style fix.
14365         (Incremental_inputs::report_obejct): Save mtime; style fix.
14366         (Incremental_inputs::report_script): Save mtime; style fix.
14367         (Incremental_inputs::finalize_inputs): Style fix.
14368         (Incremental_inputs::finalize): Style fix.
14369         (Incremental_inputs::create_input_section_data): Store inputs
14370         mtime.
14371         * incremental.h (Incremental_inputs::report_script): Add mtime
14372         argument.
14373         (Incremental_inputs::Input_info::Input_info): Intialize only one
14374         union member.
14375         (Incremental_inputs::Input_info::archive): Move to nameless
14376         union.
14377         (Incremental_inputs::Input_info::obejct): Move to nameless union.
14378         (Incremental_inputs::Input_info::script): Move to nameless union.
14379         (Incremental_inputs::mtime): New field.
14380         * script.cc (read_input_script): Pass file mtime to
14381         Incremental_input.
14382         * script.h (Script_info::inputs): Style fix.
14383
14384 2009-07-01  Ian Lance Taylor  <ian@airs.com>
14385
14386         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
14387         instead of 32.
14388
14389 2009-06-24  Ian Lance Taylor  <iant@google.com>
14390
14391         PR 10156
14392         * layout.cc (Layout::choose_output_section): If we find an
14393         existing section, update the flags.
14394         (Layout::create_notes): New function, broken out of
14395         Layout::finalize.
14396         (Layout::finalize): Don't create note sections.
14397         (Layout::create_note): Don't crash if linker script discards
14398         section.
14399         (Layout::create_gold_note): Likewise.
14400         (Layout::create_build_id): Likewise.  Don't set
14401         after_input_sections on the section.
14402         (Layout::create_executable_stack_info): Remove target parameter.
14403         Change caller.
14404         * layout.h (class Layout): Declare create_notes.  Update
14405         declaration of create_executable_stack_info.
14406         * gold.cc (queue_middle_tasks): Call create_notes.
14407         * output.cc (Output_section::update_flags_for_input_section): Move
14408         here from output.h.  If SHF_ALLOC flag is newly set, mark address
14409         invalid.
14410         * output.h (Output_data::mark_address_invalid): New function.
14411         (class Output_section): Only declare, not define,
14412         update_flags_for_input_section.  Remove set_flags.
14413
14414 2009-06-24  Ian Lance Taylor  <iant@google.com>
14415
14416         * script-sections.cc (Output_section_definition::
14417         set_section_addresses): Rename shadowing local load_address to
14418         laddr.
14419
14420 2009-06-24  Ian Lance Taylor  <iant@google.com>
14421
14422         PR 10244
14423         * reloc.cc (relocate_sections): Skip empty relocation sections.
14424
14425 2009-06-23  Ian Lance Taylor  <iant@google.com>
14426
14427         PR 10156
14428         * layout.cc (Layout::create_note): Use choose_output_section
14429         rather than make_output_section.
14430
14431 2009-06-23  Ian Lance Taylor  <iant@google.com>
14432
14433         PR 10237
14434         * options.cc (General_options::parse_V): Set printed_version_.
14435         (General_options::General_options): Initialize printed_version_.
14436         * options.h (class General_options): Add printed_version_ field.
14437         * gold.cc (queue_initial_tasks): If there are no input files,
14438         don't give a fatal error if we printed the version information.
14439         (queue_middle_tasks): If using -r with a shared object, give a
14440         fatal error rather than an ordinary error.
14441
14442 2009-06-23  Ian Lance Taylor  <iant@google.com>
14443
14444         PR 10219
14445         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
14446         (Layout::make_output_section): Set have_stabstr_section_ if we see
14447         a .stab*str section.
14448         (Layout::finalize): Call link_stabs_sections.
14449         (Layout::link_stabs_sections): New file.
14450         * layout.h (class Layout): Add have_stabstr_section_ field.
14451         Declare link_stabs_sections.
14452
14453 2009-06-23  Doug Kwan  <dougkwan@google.com>
14454
14455         * Makefile.am (libgold_a_LIBADD): New.
14456         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
14457         * Makefile.in: Regenerate.
14458         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
14459         * configure: Regenerate.
14460         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
14461         * fileread.cc: Include sys/state.h
14462         * gold.h: Declare memmem and strndup if found missing.
14463         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
14464
14465 2009-06-23  Ian Lance Taylor  <iant@google.com>
14466
14467         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
14468         * configure: Rebuild.
14469
14470 2009-06-23  Ian Lance Taylor  <iant@google.com>
14471
14472         PR 10147
14473         * object.cc (Object::section_contents): Don't try to get a view if
14474         the section has length zero.
14475         (Object::handle_gnu_warning_section): If the section is empty, use
14476         the name of the section as the warning.
14477
14478 2009-06-23  Ian Lance Taylor  <iant@google.com>
14479
14480         PR 10133
14481         * stringpool.h (class Stringpool_template): Add optimize_ field.
14482         (Stringpool_template::set_optimize): New function.
14483         * stringpool.cc (Stringpool_template::Stringpool_template):
14484         Initialize optimize_ field.
14485         (Stringpool_template::set_string_offsets): Test local optimize
14486         fild rather than parameter.
14487         * layout.cc (Layout::Layout): Call set_optimize on the section
14488         name stringpool.
14489
14490 2009-06-22  Ian Lance Taylor  <iant@google.com>
14491
14492         PR 10030
14493         * yyscript.y: Parse TARGET.
14494         * script.cc (script_set_target): New function.
14495         * script-c.h (script_set_target): Declare.
14496         * options.cc (General_options::string_to_object_format): Rename
14497         from string_to_object_format in anonymous namespace.  Change
14498         callers.
14499         * options.h (class General_options): Declare
14500         string_to_object_format.
14501
14502 2009-06-22  Ian Lance Taylor  <iant@google.com>
14503
14504         * script-sections.cc (Script_sections::create_segments): Don't put
14505         program headers in a PT_LOAD segment if -n or -N.
14506
14507 2009-06-22  Ian Lance Taylor  <iant@google.com>
14508
14509         PR 10141
14510         * options.h (class General_options): Add -z lazy and -z now.  Sort
14511         -z options into alphabetical order.
14512         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
14513
14514 2009-06-21  Ian Lance Taylor  <iant@google.com>
14515
14516         * layout.cc (Layout::make_output_section): Call
14517         Target::new_output_section.
14518         (Layout::attach_allocated_section_to_segment): Put large section
14519         sections in a separate load segment with the large segment flag
14520         set.
14521         (Layout::segment_precedes): Sort large data segments after other
14522         load segments.
14523         (align_file_offset): New static function.
14524         (Layout::set_segment_offsets): Use align_file_offset.
14525         * output.h (class Output_section): Add is_small_section_ and
14526         is_large_section_ fields.
14527         (Output_section::is_small_section): New function.
14528         (Output_section::set_is_small_section):  New function.
14529         (Output_section::is_large_section): New function.
14530         (Output_section::set_is_large_section): New function.
14531         (Output_section::is_large_data_section): New function.
14532         (class Output_segment): Add is_large_data_segment_ field.
14533         (Output_segment::is_large_data_segment): New function.
14534         (Output_segment::set_is_large_data_segment): New function.
14535         * output.cc (Output_section::Output_section): Initialize new
14536         fields.
14537         (Output_segment::Output_segment): Likewise.
14538         (Output_segment::add_output_section): Add assertion that large
14539         data sections always go in large data segments.  Force small data
14540         sections to the end of the list of data sections.  Force small BSS
14541         sections to the start of the list of BSS sections.  For large BSS
14542         sections to the end of the list of BSS sections.
14543         * symtab.h (class Symbol): Declare is_common_shndx.
14544         (Symbol::is_defined): Check Symbol::is_common_shndx.
14545         (Symbol::is_common): Likewise.
14546         (class Symbol_table): Define enum Commons_section_type.  Update
14547         declarations.  Add small_commons_ and large_commons_ fields.
14548         * symtab.cc (Symbol::is_common_shndx): New function.
14549         (Symbol_table::Symbol_table): Initialize new fields.
14550         (Symbol_table::add_from_object): Put small and large common
14551         symbols in the right list.
14552         (Symbol_table::sized_finalized_symbol): Check
14553         Symbol::is_common_shndx.
14554         (Symbol_table::sized_write_globals): Likewise.
14555         * common.cc (Symbol_table::do_allocate_commons): Allocate new
14556         common symbol lists.  Don't call do_allocate_commons_list if the
14557         list is empty.
14558         (Symbol_table::do_allocate_commons_list): Remove is_tls
14559         parameter.  Add comons_section_type parameter.  Change all
14560         callers.  Handle small and large common symbols.
14561         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
14562         Symbol::is_common_shndx.
14563         * resolve.cc (symbol_to_bits): Likewise.
14564         * target.h (Target::small_common_shndx): New function.
14565         (Target::small_common_section_flags): New function.
14566         (Target::large_common_shndx): New function.
14567         (Target::large_common_section_flags): New function.
14568         (Target::new_output_section): New function.
14569         (Target::Target_info): Add small_common_shndx, large_common_shndx,
14570         small_common_section_flags, and large_common_section_flags
14571         fields.
14572         (Target::do_new_output_section): New virtual function.
14573         * arm.cc (Target_arm::arm_info): Initialize new fields.
14574         * i386.cc (Target_i386::i386_info): Likewise.
14575         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
14576         Likewise.
14577         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
14578         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14579         (Target_x86_64::do_new_output_section): New function.
14580         * configure.ac: Define conditional MCMODEL_MEDIUM.
14581         * testsuite/Makefile.am (check_PROGRAMS): Add large.
14582         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
14583         (large_LDFLAGS): Define.
14584         * testsuite/large.c: New file.
14585         * testsuite/testfile.cc (Target_test::test_target_info):
14586         Initialize new fields.
14587         * configure, testsuite/Makefile.in: Rebuild.
14588
14589 2009-06-05  Doug Kwan  <dougkwan@google.com>
14590
14591         * Makefile.am (CCFILES): Add target.cc.
14592         * Makefile.in: Regenerate.
14593         * i386.cc (class Target_i386): Define new virtual method to
14594         override do_is_local_label_name in parent.
14595         * object.cc (Sized_relobj::do_count_local_symbols): Discard
14596         local symbols if --discard-locals or -X is given.
14597         * options.h (class General_options): Declare new options
14598         '--discard-locals' and '-X' for discarding locals.
14599         * target.h (class Target): Define new methods is_local_label_name.
14600         Declare new virtual method do_is_local_label_name.
14601         * target.cc: New file.
14602         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
14603         (check_SCRIPTS): Add discard_locals_test.sh.
14604         (check_DATA): Add discard_local_tests.syms.
14605         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
14606         (discard_local_tests.syms, discard_locals_test.o): New make rules.
14607         * testsuite/Makefile.in: Regenerate.
14608         * testsuite/discard_locals_test.c: New file.
14609         * testsuite/discard_locals_test.sh: Same.
14610
14611 2009-06-05  Doug Kwan  <dougkwan@google.com>
14612
14613         * object.cc (Sized_relobj::Sized_relobj): Initialize
14614         discarded_eh_frame_shndx_ to -1U.
14615         (Sized_relobj::do_layout): Record index of a discard .eh_frame
14616         section.
14617         (Sized_relobj::do_count_local_symbols): Skip local symbols in
14618         a discarded .eh_frame section.
14619         (Sized_relobj::do_finalize_local_symbols): Ditto.
14620         * object.h (class Sized_relobj): Declare new member
14621         discarded_eh_frame_shndx_.
14622         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
14623         (local_labels_test.o, local_labels_test): New rules.
14624         * testsuite/Makefile.in: Regenerate.
14625
14626 2009-06-04  Doug Kwan  <dougkwan@google.com>
14627
14628         * layout.cc (Layout::section_name_mapping): Add mapping for
14629         special ARM sections.
14630
14631 2009-06-03  Doug Kwan  <dougkwan@google.com>
14632
14633         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
14634         (utils::has_overflow): Same.
14635
14636 2009-06-03  Ian Lance Taylor  <iant@google.com>
14637
14638         * layout.cc (Layout::section_name_mapping): New array, replacing
14639         Layout::linkonce_mapping.
14640         (Layout::section_name_mapping_count): New variable, replacing
14641         Layout::linkonce_mapping_count.
14642         (Layout::linkonce_output_name): Remove.
14643         (Layout::output_section_name): Rewrite.
14644         * layout.h (class Layout): Rename Linkonce_mapping to
14645         Section_name_mapping, linkonce_mapping to section_name_mapping,
14646         linkonce_mapping_count to section_name_mapping_count.  Don't
14647         declare linkonce_output_name.
14648
14649 2009-06-03  Doug Kwan  <dougkwan@google.com>
14650
14651         * gold/arm.cc (namespace utils): New.
14652         (Target_arm::reloc_is_non_pic): Define new method.
14653         (class Arm_relocate_functions): New.
14654         (Target_arm::Relocate::relocate): Handle relocation types used by
14655         Android.
14656
14657 2009-06-03  Ian Lance Taylor  <iant@google.com>
14658
14659         * arm.cc (Target_arm::scan::global): Use || instead of |.
14660
14661 2009-06-02  Doug Kwan  <dougkwan@google.com>
14662
14663         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
14664         issued_non_pic_error_.
14665         (class Target_arm::Scan): Declare new method check_non_pic.
14666         Define new method symbol_needs_plt_entry.
14667         Declare new data member issued_non_pic_error_.
14668         (class Target_arm::Relocate): Declare new method
14669         should_apply_static_reloc.
14670         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
14671         (Target_arm::Scan::check_non_pic): Define new method.
14672         (Target_arm::Scan::local): Handle a small subset of reloc types used
14673         by Android.
14674         (Target_arm::Scan::local): Same.
14675         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
14676
14677 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
14678
14679         * incremental.cc (Incremental_inputs::report_command_line): Filter
14680         out --incremental-* options.
14681
14682 2009-05-29  Doug Kwan  <dougkwan@google.com>
14683
14684         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
14685         template class.
14686         (class Target_arm): Update comment.
14687         (Target_arm::Target_arm): Initialize new data members GOT_,
14688         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
14689         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
14690         and Target_arm::rel_dyn_section.
14691         Declare new_enum Target_arm::Got_type.
14692         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
14693         and DYNBSS_.
14694         Update commments for member do_dynsym_value.
14695         (Target_arm::got_size, Target_arm::plt_section,
14696         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
14697         new methods inside class defintion.
14698         (Target_arm::got_section): Define new method.
14699         (Target_arm::rel_dyn_section): Same.
14700         (Output_data_plt_arm): New template class.
14701         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
14702         (Output_data_plt_arm:do_adjust_output_section): Define new method.
14703         (Output_data_plt_arm::add_entry): Same.
14704         (Output_data_plt_arm::first_plt_entry): Define new
14705         static data member for PLT instruction template.
14706         (Output_data_plt_arm::plt_entry): Same.
14707         (Output_data_plt_arm::do_write): Define new method.
14708         (Target_arm::make_plt_entry): Same.
14709         (Target_arm::do_finalize_sections): Same.
14710         (Target_arm::do_dynsym_value): Same.
14711
14712 2009-05-28  Doug Kwan  <dougkwan@google.com>
14713
14714         * Makefile.am (TARGETSOURCES): Add arm.cc.
14715         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
14716         * Makefile.in: Regenerate.
14717         * arm.cc: New file.
14718         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
14719
14720 2009-05-26  Doug Kwan  <dougkwan@google.com>
14721
14722         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
14723         (General_options::check_excluded_libs): Strip off directories in
14724         archive name before matching like GNU ld does.
14725         * testsuite/Makefile.am (MOSTLYCLEANFILES,
14726         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
14727         (exclude_libs_test_LDFLAGS): Add linker option
14728         -Wl,--exclude-libs,libexclude_libs_test_3
14729         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
14730         an explicit archive without using -l.
14731         (alt/libexclude_libs_test_3.a): New make rule.
14732         * testsuite/Makefile.in: Regenerate.
14733         * testsuite/exclude_libs_test.c : Declare lib3_default().
14734         (main): Call it.
14735         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
14736         * exclude_libs_test_3.c: New file.
14737
14738 2009-05-26  Nick Clifton  <nickc@redhat.com>
14739
14740         * po/id.po: New Indonesian translation.
14741         * po/gold.pot: Updated template file.
14742
14743 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
14744
14745         * testsuite/Makefile.am: Add -ffunction-sections to compile
14746         gc_comdat_test files.  Add -Wl,--gc-sections to build
14747         gc_comdat_test.
14748         * testsuite/Makefile.in: Regenerate.
14749         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
14750
14751 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
14752
14753         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
14754         kept comdat section was garbage collected.
14755         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
14756         * testsuite/Makefile.in: Regenerate.
14757         * testsuite/gc_comdat_test.sh: New file.
14758         * testsuite/gc_comdat_test_1.cc: New file.
14759         * testsuite/gc_comdat_test_2.cc: New file.
14760
14761 2009-05-19  Doug Kwan  <dougkwan@google.com>
14762
14763         * archive.cc (Archive::Archive): Move constructor from archive.h
14764         to here.  Initialize no_export_.
14765         (Archive::get_elf_object_for_member): Set no_export flag of object.
14766         * archive.h (Archive::Archive): Move constructor body to
14767         archive.cc.
14768         (Archive::no_export): New method.
14769         (Archive::no_export_): New field.
14770         * object.h (Object::Object): Initialize no_export_ to false.
14771         (Object::no_export, Object::set_no_export): New methods.
14772         (Object::no_export_): New field.
14773         * options.cc (General_options::parse_exclude_libs): New method.
14774         (General_options::check_excluded_libs) Same.
14775         * options.h (exclude_libs): New option.
14776         (General_options::check_excluded_libs): New method declaration.
14777         (General_options::excluded_libs_): New field.
14778         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
14779         default or protected visibility if an object has no-export flag set.
14780         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
14781         (check_SCRIPTS): Add exclude_libs_test.sh.
14782         (check_DATA): Add exclude_libs_test.syms.
14783         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
14784         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
14785         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
14786         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
14787         (exclude_libs_test.syms, libexclude_libs_test_1.a,
14788         libexclude_libs_test_2.a): New rules.
14789         * testsuite/Makefile.in: Regenerate.
14790         * testsuite/exclude_libs_test.c: New file.
14791         * testsuite/exclude_libs_test.sh: Ditto.
14792         * testsuite/exclude_libs_test_1.c: Ditto.
14793         * testsuite/exclude_libs_test_2.c: Ditto.
14794
14795 2009-05-15  Ian Lance Taylor  <iant@google.com>
14796
14797         * configure.ac: Check for declarations for cases where libiberty.h
14798         checks HAVE_DECL_xxx.
14799         * configure, config.in: Rebuild.
14800
14801 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
14802
14803         * gold.h (Incremental_argument_list): Remove (invalid) forward
14804         declaration.
14805         * incremental.cc (Incremental_inputs::report_achive): New method.
14806         (Incremental_inputs::report_object): New method.
14807         (Incremental_inputs::report_script): New method.
14808         (Incremental_inputs::finalize_inputs): New method.
14809         (Incremental_inputs::finalize): Call finalize_inputs().
14810         (Incremental_inputs::sized_create_incremental_inputs_section_data):
14811         Create inputs entries.
14812         * incremental.h (Incremental_input_type): New enum.
14813         (Incremental_inputs::Incremental_input): Initialize new fields.
14814         (Incremental_inputs::report_inputs): New method.
14815         (Incremental_inputs::report_achive): New method.
14816         (Incremental_inputs::report_object): New method.
14817         (Incremental_inputs::report_script): New method.
14818         (Incremental_inputs::finalize_inputs): New method.
14819         (Incremental_inputs::Input_info): New struct.
14820         (Incremental_inputs::Input_info_map): New typedef.
14821         (Incremental_inputs::lock_): New field.
14822         (Incremental_inputs::Inputs_): New field.
14823         (Incremental_inputs::Inputs_map): New field.
14824         * main.cc (main): Call Incremental_input::report_inputs.
14825         * options.h (Input_argument_list): Typedef moved from
14826         Input_arguments.
14827         (Input_file_group::Files): Remove, use ::Input_argument_list.
14828         (Input_file_group::Input_argument_list): Remove, use
14829         ::Input_argument_list.
14830         * plugin.cc (Plugin_manager::add_input_file): Add error in
14831         incremental build.
14832         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
14833         functions.
14834         * script.cc (read_input_script): Call
14835         Incremental_input::report_script.
14836         * script.h (Script_info): New class.
14837
14838 2009-04-27  Ian Lance Taylor  <iant@google.com>
14839
14840         * x86_64.cc (do_adjust_output_section): Set entsize to
14841         plt_entry_size.
14842
14843 2009-04-23  Elliott Hughes  <enh@google.com>
14844
14845         * output.cc (Output_file::close): After short writes, continue
14846         writing from the correct offset in the buffer being written.
14847
14848 2009-04-23  Chris Demetriou  <cgd@google.com>
14849
14850         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
14851         * configure: Regenerate.
14852         * config.in: Regenerate.
14853         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
14854         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
14855
14856 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
14857
14858         * incremental.cc (Incremental_inputs_header_data): Renamed from
14859         Incremental_input_header_data.
14860         (Incremental_inputs_header_data::data_size): New field.
14861         (Incremental_inputs_header_data::put_input_file_count): Renamed
14862         from input_file_count.
14863         (Incremental_inputs_header_data::put_command_line_offset): Renamed
14864         from command_line_offset.
14865         (Incremental_inputs_header_data::put_reserved): Renamed from
14866         put_reserved.
14867         (Incremental_inputs_entry_data): Renamed from
14868         Incremental_input_entry_data.
14869         (Incremental_inputs_entry_data::data_size): New field.
14870         (Incremental_inputs::report_command_line): New method.
14871         (Incremental_inputs::finalize): New method.
14872         (Incremental_inputs::create_incremental_inputs_data): New method.
14873         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
14874         * incremental.h: New file.
14875         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
14876         (Layout::finalize): Create incremental inputs section in
14877         incremental builds.
14878         (Layout::create_incremental_info_sections): New method.
14879         * layout.h (Layout::incremental_inputs): New method.
14880         (Layout::create_incremental_info_sections): New method.
14881         (Layout::incremental_inputs_): New field.
14882         * main.cc (main): Notify Incremental_input of the command line.
14883
14884 2009-04-01  Ian Lance Taylor  <iant@google.com>
14885             Mikolaj Zalewski  <mikolajz@google.com>
14886
14887         * gold.h (reserve_unordered_map): Define, three versions, one for
14888         each version of Unordered_map.
14889         * layout.cc (Layout::Layout): Remove options parameter.  Add
14890         number_of_input_files parameter.  Don't initialize options_.
14891         Initialize number_of_input_files_ and resized_signatures_.  Move
14892         sections_are_attached_.
14893         (Layout::layout_group): Reserve space for group_signatures_.
14894         (Layout::find_or_add_kept_section): Change name parameter to be a
14895         reference.  Resize signatures_ map when it gets large enough.
14896         (Layout::layout_eh_frame): Use parameters->options() instead of
14897         this->options_.
14898         (Layout::make_output_section): Likewise.
14899         (Layout::attach_allocated_section_to_segment): Likewise.
14900         (Layout::finalize, Layout::create_executable_stack): Likewise.
14901         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
14902         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
14903         * layout.h (class Layout): Update declarations.  Remove options_
14904         field.  Add number_of_input_files_ and resized_signatures_
14905         fields.  Move sections_are_attached_ field.
14906         * main.cc (main): Pass number of input files to Layout
14907         constructor.  Don't pass options.
14908
14909 2009-03-30  Ian Lance Taylor  <iant@google.com>
14910
14911         * ffsll.c (ffsll): Correct implementation.
14912
14913 2009-03-27  Ian Lance Taylor  <iant@google.com>
14914
14915         * ffsll.c: New file.
14916         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
14917         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
14918         * ftruncate.c (ftruncate): Declare before definition.
14919         * mremap.c (mremap): Likewise.
14920         * pread.c (pread): Likewise.
14921         * configure, Makefile.in, config.in: Rebuild.
14922
14923         * mremap.c: New file.
14924         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
14925         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
14926         (mremap): Declare if HAVE_MREMAP is not defined.
14927         * configure, Makefile.in, config.in: Rebuild.
14928
14929 2009-03-27  Cary Coutant  <ccoutant@google.com>
14930
14931         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
14932         position independent.
14933         * sparc.cc (Target_sparc::check_non_pic): Likewise.
14934         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
14935
14936 2009-03-24  Cary Coutant  <ccoutant@google.com>
14937
14938         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
14939         an executable.
14940         (needs_dynamic_reloc): Likewise.
14941
14942 2009-03-24  Ian Lance Taylor  <iant@google.com>
14943
14944         * yyscript.y (file_cmd): Recognize EXTERN.
14945         (extern_name_list, extern_name_list_body): New nonterminals.
14946         * script.cc (script_add_extern): Define.
14947         * script-c.h (script_add_extern): Declare.
14948
14949 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
14950
14951         * object.cc (is_elf_object): Define.
14952         * object.h (is_elf_object): Declare.
14953         * archive.cc (Archive::get_elf_object_for_member): Call
14954         is_elf_object.
14955         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
14956
14957 2009-03-24  Elliott Hughes  <enh@google.com>
14958
14959         * output.cc (Output_file::map_anonymous): Define.
14960         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
14961         try an anonymous one.  Report the size if the mmap fails.
14962         * output.h (class Output_file): Declare map_anonymous.
14963
14964 2009-03-24  Ian Lance Taylor  <iant@google.com>
14965
14966         * target-select.cc (instantiate_target): Don't acquire the lock if
14967         the instantiated_target_ field has already been set.
14968
14969 2009-03-23  Ian Lance Taylor  <iant@google.com>
14970
14971         * gold-threads.h (class Initialize_lock): Define.
14972         * gold-threads.cc (class Initialize_lock_once): Define.
14973         (initialize_lock_control): New static variable.
14974         (initialize_lock_pointer): New static variable.
14975         (initialize_lock_once): New static function.
14976         (Initialize_lock::Initialize_lock): Define.
14977         (Initialize_lock::initialize): Define.
14978         * target-select.h: Include "gold-threads.h".
14979         (class Target_selector): Add lock_ and initialize_lock_ fields.
14980         Don't define instantiate_target, just declare it.
14981         * target-select.cc (Target_selector::Target_selector): Initialize
14982         new fields.
14983         (Target_selector::instantiate_target): Define.
14984         * descriptors.h: Include "gold-threads.h".
14985         (class Descriptors): Add initialize_lock_ field.
14986         * descriptors.cc (Descriptors::Descriptors): Initialize new
14987         field.
14988         (Descriptors::open): Use initialize_lock_ field
14989         * errors.h (class Errors): Add initialize_lock_ field.
14990         * errors.cc (Errors::Errors): Initialize new field.
14991         (Errors::initialize_lock): Use initialize_lock_ field.
14992         * powerpc.cc (class Target_selector_powerpc): Remove
14993         instantiated_target_ field.  In do_recognize call
14994         instantiate_target rather than do_instantiate_target.  In
14995         do_instantiate_target just allocate a new target.
14996         * sparc.cc (class Target_selector_sparc): Likewise.
14997
14998         * freebsd.h: New file.
14999         * i386.cc: Include "freebsd.h".
15000         (Target_i386): Derive from Target_freebsd rather than
15001         Sized_target.
15002         (Target_selector_i386): Derive from Target_selector_freebsd rather
15003         than Target_selector.
15004         * x86_64.cc: Include "freebsd.h".
15005         (Target_x86_64): Derive from Target_freebsd rather than
15006         Sized_target.
15007         (Target_selector_x86_64): Derive from Target_selector_freebsd
15008         rather than Target_selector.
15009         * target.h (class Target): Add adjust_elf_header and
15010         do_adjust_elf_header.
15011         * output.cc (Output_file_header:: do_sized_write): Call target
15012         adjust_elf_header routine.
15013         * configure.tgt: Set targ_osabi.
15014         * configure.ac: Define GOLD_DEFAULT_OSABI.
15015         * parameters.cc (Parameters::default_target): Pass
15016         GOLD_DEFAULT_OSABI to select_target.
15017         * target-select.h (class Target_selector): Make instantiate_target
15018         protected rather than private.
15019         * Makefile.am (HFILES): Add freebsd.h.
15020         * configure, Makefile.in, config.in: Rebuild.
15021
15022         * merge.cc (do_add_input_section): Correct pend value.  Change
15023         message about last entry not being null terminated from error to
15024         warning.
15025
15026 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
15027
15028         * incremental.cc: New file.
15029         * Makefile.am (CCFILES): Add incremental.cc.
15030         * Makefile.in: Rebuild.
15031
15032 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
15033
15034         * layout.cc (Layout::output_section_name): Preserve names
15035         of '.note.' sections.
15036
15037 2009-03-19  Ian Lance Taylor  <iant@google.com>
15038
15039         * descriptors.cc (Descriptors::open): Check that the options are
15040         valid before using them.
15041
15042 2009-03-18  Ian Lance Taylor  <iant@google.com>
15043
15044         * script-sections.h: Include <list>.
15045         (class Script_sections): Change Sections_elements from std::vector
15046         to std::list.  Typedef public Elements_iterator.  Add
15047         orphan_section_placement_, data_segment_align_start_, and
15048         saw_data_segment_align_ fields.  Remove data_segment_align_index_
15049         field.
15050         * script-sections.cc (class Orphan_section_placement): New class.
15051         (class Sections_element): Add virtual functions is_relro and
15052         orphan_section_init.  Remove virtual function place_orphan_here.
15053         (class Output_section_definition): Add is_relro and
15054         orphan_section_init.  Remove place_orphan_here.
15055         (class Orphan_output_section): Likewise.
15056         (Script_sections::Script_sections): Update for field changes.
15057         (Script_sections::data_segment_align): Set saw_data_segment_align_
15058         and data_segment_align_start_, not data_segment_align_index.
15059         (Script_sections::data_segment_relro_end): Check
15060         saw_data_segment_align_.  Use data_segment_align_start_ rather
15061         than data_segment_align_index_.
15062         (Script_sections::place_orphan): Rewrite to use
15063         Orphan_section_placement.
15064
15065 2009-03-17  Ian Lance Taylor  <iant@google.com>
15066
15067         * archive.cc (Archive::add_symbols): Check for a version attached
15068         to the symbol name in the archive map.
15069         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
15070         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
15071         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
15072         (ver_test_11.a): New target.
15073         * testsuite/Makefile.in: Rebuild.
15074
15075         * configure.ac: Check for chsize and posix_fallocate.  Replace
15076         ftruncate.
15077         * ftruncate.c: New file, from gnulib.
15078         * output.cc (posix_fallocate): Define dummy version if not
15079         HAVE_POSIX_FALLOCATE.
15080         (Output_file::map): Call posix_fallocate rather than lseek and
15081         write.
15082         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
15083         * configure, Makefile.in, config.in: Rebuild.
15084
15085 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
15086
15087         * layout.h (Layout::create_note): Add section_name parameter.
15088         * layout.cc (Layout::create_note): Likewise.
15089         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
15090
15091 2009-03-17  Ian Lance Taylor  <iant@google.com>
15092
15093         * descriptors.cc: Include "options.h".
15094         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
15095         (Descriptors::open): Always use O_CLOEXEC when opening a new
15096         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
15097         then set FD_CLOEXEC.
15098
15099         * sparc.cc (class Target_sparc): Add has_got_section.
15100         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
15101         make sure we have a GOT section.
15102
15103         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
15104         (Target_sparc::Scan::local): Likewise.
15105         (Target_sparc::Scan::global): Likewise.
15106         (Target_sparc::Relocate::relocate): Likewise.
15107         (Target_sparc::Relocate::relocate_tls): Likewise.
15108
15109         * symtab.cc (Symbol_table::define_default_version): New function,
15110         broken out of add_from_object.
15111         (Symbol_table::add_from_object): Call define_default_version.
15112         (Symbol_table::define_special_symbol): Add resolve_oldsym
15113         parameter.  Change all callers.  If the version for a symbol comes
15114         from a version script, resolve it with the symbol with the same
15115         name with no version.  Also add the symbol without a version if
15116         appropriate.
15117         (do_define_in_output_data): If resolving with oldsym, don't delete
15118         sym.
15119         (do_define_in_output_segment): Likewise.
15120         (do_define_as_constant): Likewise.
15121         * symtab.h (class Symbol_table): Update declarations.
15122
15123 2009-03-13  Ian Lance Taylor  <iant@google.com>
15124
15125         * readsyms.cc (Read_symbols::incompatible_warning): New function.
15126         (Read_symbols::requeue): New function.
15127         (Read_symbols::do_read_symbols): If make_elf_object fails because
15128         the target type is not configured, and the file was searched for,
15129         issue a warning and retry with the next directory.
15130         (Add_symbols::run): If the file has an incompatible format, and
15131         it was searched for, requeue the Read_symbols task.  On error,
15132         release the object.
15133         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
15134         dirindex parameter to constructor.  Change all callers.  Declare
15135         incompatible_warning and requeue.
15136         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
15137         input_argument_ and input_group_ fields.  Add them to
15138         constructor.  Change all callers.
15139         (class Read_script): Add dirindex_ field.  Add it to constructor.
15140         Change all callers.
15141         * archive.cc (Archive::setup): Remove input_objects parameter.
15142         Change all callers.
15143         (Archive::get_file_and_offset): Likewise.
15144         (Archive::read_all_symbols): Likewise.
15145         (Archive::read_symbols): Likewise.
15146         (Archive::get_elf_object_for_member): Remove input_objects
15147         parameter.  Add punconfigured parameter.  Change all callers.
15148         (Archive::add_symbols): Change return type to bool.  Check return
15149         value of include_member.
15150         (Archive::include_all_members): Likewise.
15151         (Archive::include_member): Change return type to bool.  Return
15152         false if first included object has incompatible target.  Set
15153         included_member_ field.
15154         (Add_archive_symbols::run): If add_symbols returns false, requeue
15155         Read_symbols task.
15156         * archive.h (class Archive): Add included_member_ field.
15157         Initialize it in constructor.  Add input_file and searched_for
15158         methods.  Update declarations.
15159         (class Add_archive_symbols): Add dirpath_, dirindex_, and
15160         input_argument_ fields.  Add them to constructor.  Change all
15161         callers.
15162         * script.cc: Include "target-select.h".
15163         (class Parser_closure): Add skip_on_incompatible_target_ and
15164         found_incompatible_target_ fields.  Add
15165         skip_on_incompatible_target parameter to constructor.  Change all
15166         callers.  Add methods skip_on_incompatible_target,
15167         clear_skip_on_incompatible_target, found_incompatible_target, and
15168         set_found_incompatible_target.
15169         (read_input_script): Add dirindex parameter.  Change all callers.
15170         If parser finds an incompatible target, requeue Read_symbols
15171         task.
15172         (script_set_symbol): Clear skip_on_incompatible_target in
15173         closure.
15174         (script_add_assertion, script_parse_option): Likewise.
15175         (script_start_sections, script_add_phdr): Likewise.
15176         (script_check_output_format): New function.
15177         * script.h (read_input_script): Update declaration.
15178         * script-c.h (script_check_output_format): Declare.
15179         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
15180         (ignore_cmd): Remove OUTPUT_FORMAT.
15181         * fileread.cc (Input_file::Input_file): Add explicit this.
15182         (Input_file::will_search_for): New function.
15183         (Input_file::open): Add pindex parameter.  Change all callers.
15184         * fileread.h (class Input_file): Add input_file_argument method.
15185         Declare will_search_for.  Update declarations.
15186         * object.cc (make_elf_object): Add punconfigured parameter.
15187         Change all callers.
15188         * object.h (class Object): Make input_file public.  Add
15189         searched_for method.
15190         (make_elf_object): Update declaration.
15191         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
15192         restart search.
15193         * dirsearch.h (class Dirsearch): Update declaration.
15194         * options.h (class General_options): Add --warn-search-mismatch.
15195         * parameters.cc (Parameters::is_compatible_target): New function.
15196         * parameters.h (class Parameters): Declare is_compatible_target.
15197         * workqueue.cc (Workqueue::add_blocker): New function.
15198         * workqueue.h (class Workqueue): Declare add_blocker.
15199
15200         * fileread.cc (Input_file::open): Remove options parameter.
15201         Change all callers.
15202         (Input_file::open_binary): Likewise.
15203         * script.cc (read_input_script): Likewise.
15204         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
15205         options parameter from constructor.  Change all callers.
15206         (class Read_script): Likewise.
15207         * fileread.h (class Input_file): Update declarations.
15208         * script.h (read_input_script): Update declaration.
15209
15210 2009-03-10  Nick Clifton  <nickc@redhat.com>
15211
15212         * po/es.po: New Spanish translation.
15213
15214 2009-03-06  Cary Coutant  <ccoutant@google.com>
15215
15216         * options.cc (parse_short_option): Keep dash_z from registering itself.
15217
15218 2009-03-03  Ian Lance Taylor  <iant@google.com>
15219
15220         PR 9918
15221         * target-reloc.h (relocate_section): Pass output_section to
15222         relocate.
15223         * i386.cc (Target_i386::should_apply_static_reloc): Add
15224         output_section parameter.  Change all callers.
15225         (Target_i386::Relocate::relocate): Add output_section parameter.
15226         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15227         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
15228         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
15229         * testsuite/two_file_shared.sh: New script.
15230         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
15231         (check_DATA): Add two_file_shared.dbg.
15232         (two_file_shared.dbg): New target.
15233         * testsuite/Makefile.in: Rebuild.
15234
15235 2009-03-01  Ian Lance Taylor  <iant@google.com>
15236
15237         * configure.ac: Check for byteswap.h.
15238         * configure: Rebuild.
15239         * config.in: Rebuild.
15240
15241 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
15242
15243         * layout.cc (Layout::find_or_add_kept_section): New function.
15244         (Layout::add_comdat): Removed.
15245         * layout.h (struct Kept_section): Move out of class Layout.
15246         Remove trailing underscores from field names.  Add group_sections
15247         field.  Rename group_ field to is_group.  Change all uses.
15248         (class Layout): Declare find_or_add_kept_section, not add_comdat.
15249         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
15250         comdat_groups_ field.
15251         (Sized_relobj::include_section_group): Use
15252         find_or_add_kept_section and Kept_section::group_sections.
15253         (Sized_relobj::include_linkonce_section): Likewise.
15254         * object.cc (class Sized_relobj): Don't define Comdat_group or
15255         Comdat_group_table.  Remove find_comdat_group and
15256         add_comdat_group.  Remove comdat_groups_ field.
15257         * plugin.cc (include_comdat_group): Use
15258         Layout::find_or_add_kept_section.
15259
15260 2009-02-28  Ian Lance Taylor  <iant@google.com>
15261
15262         * README: --gc-sections and map files are now supported.  Document
15263         some build requirements.
15264
15265         PR 6992
15266         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
15267         relocatable link set the value of the section symbol to zero.
15268         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
15269         relocatable link don't include the section address in the local
15270         symbol value.
15271
15272 2009-02-27  Ian Lance Taylor  <iant@google.com>
15273
15274         PR 6811
15275         * options.h (class Search_directory): Add is_system_directory.
15276         (class General_options): Declare is_in_system_directory.
15277         * options.cc (get_relative_sysroot): Make static.
15278         (get_default_sysroot): Make static.
15279         (General_optoins::is_in_system_directory): New function.
15280         * fileread.cc (Input_file::is_in_system_directory): New function.
15281         * fileread.h (class Input_file): Declare is_in_system_directory.
15282         * object.h (class Object): Add is_in_system_directory.
15283         (class Input_objects): Remove system_library_directory_ field.
15284         * object.cc (Input_objects::add_object): Don't set
15285         system_library_directory_.
15286         (input_objects::found_in_system_library_directory): Remove.
15287         * symtab.cc (Symbol_table::write_globals): Remove input_objects
15288         parameter.  Change all callers.
15289         (Symbol_table::sized_write_globals): Likewise.
15290         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
15291         Call Object::is_in_system_directory.
15292         * symtab.h (class Symbol_table): Update declarations.
15293
15294         PR 5990
15295         * descriptors.h (Open_descriptor): Add is_on_stack field.
15296         * descriptors.cc (Descriptors::open): If the descriptor is on the
15297         top of the stack, remove it.  Initialize is_on_stack field.
15298         (Descriptors::release): Only add pod to stack if it is not on the
15299         stack already.
15300         (Descriptors::close_some_descriptor): Clear stack_next and
15301         is_on_stack fields.
15302
15303         PR 7091
15304         * output.cc (Output_section::find_starting_output_address): Rename
15305         from starting_output_address; add PADDR parameter; change return
15306         type.
15307         * output.h (class Output_section): Declare
15308         find_starting_output_address instead of starting_output_address.
15309         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
15310         section symbol for which we can't find a merge section.
15311
15312         PR 9836
15313         * symtab.cc (Symbol_table::add_from_object): If the visibility is
15314         hidden or internal, force the symbol to be local.
15315         * resolve.cc (Symbol::override_visibility): Define.
15316         (Symbol::override_base): Use override_visibility.
15317         (Symbol_table::resolve): Likewise.
15318         (Symbol::override_base_with_special): Likewise.
15319         (Symbol_table::override_with_special): If the visibility is hidden
15320         or internal, force the symbol to be local.
15321         * symtab.h (class Symbol): Add set_visibility and
15322         override_visibility.
15323         * testsuite/ver_test_1.sh: New file.
15324         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
15325         (check_DATA): Add ver_test_1.syms.
15326         (ver_test_1.syms): New target.
15327         * testsuite/Makefile.in: Rebuild.
15328
15329 2009-02-25  Cary Coutant  <ccoutant@google.com>
15330
15331         * layout.cc (Layout::choose_output_section): Don't rename sections
15332         when using a linker script that has a SECTIONS clause.
15333         * Makefile.in: Regenerate.
15334
15335         * testsuite/Makefile.am (script_test_5.sh): New test case.
15336         * testsuite/Makefile.in: Regenerate.
15337         * testsuite/script_test_5.cc: New file.
15338         * testsuite/script_test_5.sh: New file.
15339         * testsuite/script_test_5.t: New file.
15340
15341 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
15342
15343         * archive.cc (Archive::include_member): Update calls to add_symbols.
15344         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
15345         the Layout argument.
15346         * dynobj.h (do_add_symbols): Add the Layout argument.
15347         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
15348         Layout argument.
15349         * object.h (Object::add_symbols): Add the Layout argument.
15350         (Object::do_add_symbols): Add the Layout argument.
15351         (Sized_relobj::do_add_symbols): Add the Layout argument.
15352         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
15353         Unify the two versions.
15354         (Add_plugin_symbols): Remove.
15355         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
15356         (Sized_pluginobj::do_add_symbols): Unify the two versions.
15357         (Add_plugin_symbols): Remove.
15358         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
15359         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
15360         (Add_symbols::run): Make it work with Pulginobj.
15361
15362 2009-02-06  Ian Lance Taylor  <iant@google.com>
15363
15364         * object.cc (Sized_relobj::do_layout): Make info message start
15365         with lower case letter.
15366
15367 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
15368
15369         * binary.cc: Fix file comment.
15370
15371         * options.h (enum Incremental_disposition): Define.
15372         (class General_options): Add new options: --incremental,
15373         --incremental_changed, --incremental_unchanged,
15374         --incremental_unknown.  Add incremental_disposition_ and
15375         implicit_incremental_ fields.
15376         (General_options::incremental_disposition): New function.
15377         (class Position_dependent_options): Add incremental_disposition
15378         option.
15379         (Position_dependent_options::copy_from_options): Set incremental
15380         dispositions.
15381         * options.cc (General_options::parse_incremental_changed): New
15382         function.
15383         (General_options::parse_incremental_unchanged): New function.
15384         (General_options::parse_incremental_unknown): New function.
15385         (General_options::General_options): Initialize new fields
15386         incremental_disposition_ and implicit_incremental_.
15387         (General_options::finalize): Check for uasge of --incremental-*
15388         without --incremental.
15389
15390 2009-02-06  Chris Demetriou  <cgd@google.com>
15391
15392         * gold.h (gold_undefined_symbol): Change to take only a Symbol
15393         pointer and to report location as the file name associated with
15394         the symbol.
15395         (gold_undefined_symbol_at_location): New function to replace the
15396         old gold_undefined_symbol functionality.
15397         * target-reloc.h (relocate_section): Update to use
15398         gold_undefined_symbol_at_location.
15399         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15400         Call gold_undefined_symbol function rather than gold_error.
15401         * errors.h (Errors::undefined_symbol): Take location as a
15402         string, rather than calculating it from a relocation.
15403         * errors.cc (Errors::fatal): Print "fatal error:" before the
15404         formatted message.
15405         (Errors::error, Errors::error_at_location): Print "error: "
15406         before the formatted message.
15407         (Errors::undefined_symbol): Take location as a string, rather
15408         than calculating it from a relocation.
15409         (gold_undefined_symbol_at_location): New function akin to
15410         old gold_undefined_symbol, calculates location from relocation.
15411         (gold_undefined_symbol): Change to take only a Symbol pointer
15412         and to report location as the file name associated with the symbol.
15413         * testsuite/debug_msg.sh: Update for changed error messages.
15414         * testsuite/undef_symbol.sh: Likewise.
15415
15416 2009-02-04  Duncan Sands  <baldrick@free.fr>
15417
15418         PR 9812
15419         * reduced_debug_output.h
15420         (Output_reduced_debug_abbrev_section::failed): Use format for
15421         gold_warning.
15422         (Output_reduced_debug_info_section::faild): Likewise.
15423
15424 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
15425
15426         * script.cc (Lazy_demangler): New class.
15427         (Version_script_info::get_symbol_version_helper): Demangle a
15428         symbol only once.
15429
15430 2009-01-29  Cary Coutant  <ccoutant@google.com>
15431
15432         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
15433         to __tls_get_addr.
15434         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15435
15436 2009-01-28  Ian Lance Taylor  <iant@google.com>
15437
15438         * version.cc (version_string): Bump to 1.9.
15439
15440         * gold.h: Include <cstring> and <stdint.h>.
15441         * version.cc: Include <cstdio>.
15442         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
15443         warning.
15444         * reduced_debug_output.cc (insert_into_vector): Rename from
15445         Insert_into_vector; change all callers.  Use Swap_unaligned to
15446         avoid aliasing issue; remove union since it is unnecessary.
15447
15448 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
15449
15450         * Makefile.am (CCFILES): Add gc.cc.
15451         (HFILES): Add gc.h.
15452         * Makefile.in: Regenerate.
15453         * gold.cc (Gc_runner): New class.
15454         (queue_initial_tasks): Call garbage collection related tasks
15455         when corresponding options are invoked.
15456         (queue_middle_gc_tasks): New function.
15457         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
15458         processed early before laying out sections during garbage collection.
15459         * gold.h (queue_middle_gc_tasks): New function.
15460         (is_prefix_of): Move from "layout.cc".
15461         * i386.cc (Target_i386::gc_process_relocs): New function.
15462         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
15463         * main.cc (main): Create object of class "Garbage_collection".
15464         * object.cc (Relobj::copy_symbols_data): New function.
15465         (Relobj::is_section_name_included): New function.
15466         (Sized_relobj::do_layout): Allow this function to be called twice
15467         during garbage collection and defer layout of section during the
15468         first call.
15469         * object.h (Relobj::get_symbols_data): New function.
15470         (Relobj::is_section_name_included): New function.
15471         (Relobj::copy_symbols_data): New function.
15472         (Relobj::set_symbols_data): New function.
15473         (Relobj::get_relocs_data): New function.
15474         (Relobj::set_relocs_data): New function.
15475         (Relobj::is_output_section_offset_invalid): New pure virtual function.
15476         (Relobj::gc_process_relocs): New function.
15477         (Relobj::do_gc_process_relocs): New pure virtual function.
15478         (Relobj::sd_): New data member.
15479         (Sized_relobj::is_output_section_offset_invalid): New function.
15480         (Sized_relobj::do_gc_process_relocs): New function.
15481         * options.h (General_options::gc_sections): Modify to not be a no-op.
15482         (General_options::print_gc_sections): New option.
15483         * plugin.cc (Plugin_finish::run): Remove function call to
15484         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
15485         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
15486         * reloc.cc (Read_relocs::run): Add task to process relocs and
15487         determine unreferenced sections when doing garbage collection.
15488         (Gc_process_relocs): New class.
15489         (Sized_relobj::do_gc_process_relocs): New function.
15490         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
15491         sections that are garbage collected.
15492         * reloc.h (Gc_process_relocs): New class.
15493         * sparc.cc (Target_sparc::gc_process_relocs): New function.
15494         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
15495         symbols whose corresponding sections are garbage collected.
15496         (Symbol_table::Symbol_table): Add new parameter for the garbage
15497         collection object.
15498         (Symbol_table::gc_mark_undef_symbols): New function.
15499         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15500         (Symbol_table::gc_mark_dyn_syms): New function.
15501         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
15502         as garbage.
15503         (Symbol_table::add_from_object): Likewise.
15504         (Symbol_table::add_from_relobj): When building shared objects, do not
15505         treat externally visible symbols as garbage.
15506         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
15507         table information for static and relocatable links.
15508         * symtab.h (Symbol_table::set_gc): New function.
15509         (Symbol_table::gc): New function.
15510         (Symbol_table::gc_mark_undef_symbols): New function.
15511         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15512         (Symbol_table::gc_mark_dyn_syms): New function.
15513         (Symbol_table::gc_): New data member.
15514         * target.h (Sized_target::gc_process_relocs): New pure virtual
15515         function.
15516         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
15517         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
15518
15519 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
15520
15521         * options.h (General_options::gc_sections): Define as a no-op for now.
15522         (General_options::no_keep_memory): Ditto.
15523         (General_options::Bshareable): Define.
15524         * options.cc (General_options::finalize): Honor -Bshareable.
15525
15526 2009-01-20  Andreas Schwab  <schwab@suse.de>
15527
15528         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
15529         read the value in the contents, since we don't use it.  Use the
15530         template endianness when writing.
15531         (Relocate::relocate): Use it for R_PPC_REL16_HA.
15532
15533 2009-01-19  Andreas Schwab  <schwab@suse.de>
15534
15535         * configure.tgt (powerpc64-*): Fix targ_obj.
15536
15537 2009-01-15  Ian Lance Taylor  <iant@google.com>
15538
15539         * object.cc (Sized_relobj::write_local_symbols): Don't write out
15540         local symbols when stripping all symbols.
15541
15542 2009-01-14  Cary Coutant  <ccoutant@google.com>
15543
15544         * output.cc (Output_reloc): Add explicit instantiations.
15545
15546 2009-01-14  Cary Coutant  <ccoutant@google.com>
15547
15548         * archive.cc (Archive::get_elf_object_for_member): Remove call
15549         to File_read::claim_for_plugin.
15550         * descriptors.cc (Descriptors::open): Remove reference to
15551         is_claimed.
15552         (Descriptors::claim_for_plugin): Remove.
15553         * descriptors.h (Descriptors::claim_for_plugin): Remove.
15554         (Descriptors::is_claimed): Remove.
15555         (claim_descriptor_for_plugin): Remove.
15556         * fileread.cc (File_read::claim_for_plugin): Remove.
15557         * fileread.h (File_read::claim_for_plugin): Remove.
15558         (File_read::descriptor): Reopen descriptor if necessary.
15559         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
15560         (Plugin_manager::all_symbols_read): Add task parameter. Change
15561         all callers.
15562         (Plugin_manager::get_input_file): New function.
15563         (Plugin_manager::release_input_file): New function.
15564         (Pluginobj::Pluginobj): Add filesize parameter and initialize
15565         corresponding data member.
15566         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
15567         and pass to base constructor. Change all callers.
15568         (get_input_file, release_input_file): New functions.
15569         (make_sized_plugin_object): Add filesize parameter. Change all callers.
15570         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
15571         (Plugin_manager::all_symbols_read): Add task parameter.
15572         (Plugin_manager::get_input_file): New function.
15573         (Plugin_manager::release_input_file): New function.
15574         (Plugin_manager::task_): New data member.
15575         (Pluginobj::Pluginobj): Add filesize parameter.
15576         (Pluginobj::filename): New function.
15577         (Pluginobj::descriptor): New function.
15578         (Pluginobj::filesize): New function.
15579         (Pluginobj::filesize_): New data member.
15580         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
15581         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
15582         File_read::claim_for_plugin; use Object::unlock to unlock the file.
15583
15584         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
15585         with archive libraries.
15586         * testsuite/Makefile.in: Regenerate.
15587         * testsuite/plugin_test.c (struct sym_info): New type.
15588         (get_input_file, release_input_file): New static variables.
15589         (onload): Capture new transfer vector entries.
15590         (claim_file_hook): Stop reading at end of file according to filesize.
15591         Factor out parsing of readelf output into separate function.
15592         (all_symbols_read_hook): Exercise get_input_file and release_input_file
15593         APIs and get the source file name from the symbol table.  Convert
15594         source file name to corresponding object file name.  Print info
15595         message when adding new input files.
15596         (parse_readelf_line): New function.
15597         * testsuite/plugin_test_1.sh: Add checks for new info messages.
15598         * testsuite/plugin_test_2.sh: Likewise.
15599         * testsuite/plugin_test_3.sh: Likewise.
15600         * testsuite/plugin_test_4.sh: New test case.
15601
15602 2009-01-07  Ian Lance Taylor  <iant@google.com>
15603
15604         * version.cc (version_string): Bump to 1.8.
15605
15606 2008-12-23  Cary Coutant  <ccoutant@google.com>
15607
15608         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
15609         * plugin.cc (Plugin_manager::finish): Rename as
15610         layout_deferred_objects.  Move cleanup to separate function.
15611         (Plugin_manager::cleanup): New function.
15612         (Plugin_finish::run): Call layout_deferred_objects and cleanup
15613         separately.
15614         * plugin.h (Plugin_manager::finish): Rename as
15615         layout_deferred_objects.
15616         (Plugin_manager::cleanup): New function.
15617         (Plugin_manager::cleanup_done): New field.
15618
15619 2008-12-23  Cary Coutant  <ccoutant@google.com>
15620
15621         * plugin.cc (is_visible_from_outside): New function.
15622         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
15623         so we don't return "IR only" status for exported symbols or -r links.
15624
15625         * testsuite/Makefile.am (plugin_test_3): New test case.
15626         * testsuite/Makefile.in: Regenerate.
15627         * testsuite/plugin_test_3.sh: New file.
15628
15629 2008-12-22  Cary Coutant  <ccoutant@google.com>
15630
15631         * object.cc (Sized_relobj::layout_section): New function.
15632         (Sized_relobj::do_layout): Defer layout of input sections until after
15633         plugin has provided replacement files.
15634         (Sized_relobj::do_layout_deferred_sections): New function.
15635         * object.h (Relobj::set_section_offset): Remove virtual keyword.
15636         (Relobj::layout_deferred_sections): New function.
15637         (Relobj::do_layout_deferred_sections): New function.
15638         (Sized_relobj::do_layout_deferred_sections): New function.
15639         (Sized_relobj::layout_section): New function.
15640         (Sized_relobj::Deferred_layout): New structure.
15641         (Sized_relobj::deferred_layout_): New field.
15642         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
15643         Change all callers.  Layout deferred sections.
15644         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
15645         references.
15646         (Plugin_hook::run): Move code from do_plugin_hook inline.
15647         (Plugin_hook::do_plugin_hook): Remove.
15648         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
15649         (Plugin_manager::finish): Renamed, was cleanup.
15650         (Plugin_manager::should_defer_layout): New function.
15651         (Plugin_manager::add_deferred_layout_object): New function.
15652         (Plugin_manager::Deferred_layout_list): New type.
15653         (Plugin_manager::deferred_layout_objects_): New field.
15654         (Plugin_hook::do_plugin_hook): Remove.
15655
15656 2008-12-17  Ian Lance Taylor  <iant@google.com>
15657
15658         * options.h (class General_options): Add --no case for
15659         --export-dynamic.
15660
15661 2008-12-16  Cary Coutant  <ccoutant@google.com>
15662
15663         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
15664         vector.
15665         (Plugin_manager::claim_file): Create plugin object even if
15666         plugin did not call the add_symbols callback.
15667         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
15668         asking for more symbols than were added.
15669         * testsuite/Makefile.am (plugin_test_1): Add test case with
15670         no global symbols.
15671         (empty.syms): New target.
15672         * testsuite/Makefile.in: Regenerate.
15673         * testsuite/plugin_test.c (claim_file_hook): Add new debug
15674         message. Don't call add_symbols if no globals.
15675         (all_symbols_read_hook): Don't provide replacement for empty
15676         claimed file.
15677
15678 2008-12-12  Ian Lance Taylor  <iant@google.com>
15679
15680         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
15681         r_type == 0 for a local symbol with r_sym == 0.
15682         (scan_relocatable_relocs): Pass r_sym to
15683         local_non_section_strategy.
15684         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
15685         r_sym parameter.
15686
15687         * configure.ac: Update test for TLS descriptors: they are
15688         supported as of glibc 2.9.
15689         * configure: Rebuild.
15690
15691 2008-12-11  Ian Lance Taylor  <iant@google.com>
15692
15693         PR 7091
15694         * target-reloc.h (Default_scan_relocatable_relocs): For each
15695         function, map r_type == 0 to RELOC_DISCARD.
15696
15697 2008-12-10  Cary Coutant  <ccoutant@google.com>
15698
15699         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
15700         object to override a kept COMDAT group from a plugin object.
15701
15702 2008-12-09  Ian Lance Taylor  <iant@google.com>
15703
15704         PR 7088
15705         * yyscript.y (file_cmd): Handle INPUT.
15706
15707         * testsuite/initpri1.c: Change all declarations to be full
15708         prototypes by adding void, to avoid compiler warnings.
15709
15710 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
15711
15712         * options.cc (General_options::parse_plugin_opt): New.
15713         (General_options::add_plugin): The argument now is just the filename.
15714         (General_options::add_plugin_option): New.
15715         * options.h (plugin_opt): New.
15716         (add_plugin): Change argument name.
15717         (add_plugin_option): New.
15718         * plugin.cc (Plugin::load): Don't parse the plugin option.
15719         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
15720         (Plugin::add_option): New.
15721         (Plugin::args_): Change type.
15722         (Plugin::filename_): New.
15723         (Plugin_manager::add_plugin_option): New.
15724         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
15725         * testsuite/Makefile.in: Regenerate.
15726
15727 2008-12-05  Cary Coutant  <ccoutant@google.com>
15728
15729         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
15730         Handle --strip-lto-sections option.
15731         * options.h (strip_lto_sections): New option.
15732
15733 2008-12-01  Cary Coutant  <ccoutant@google.com>
15734
15735         * plugin.cc (ld_plugin_message): Change format parameter to const.
15736         Fix mismatch between new[] and delete.
15737
15738 2008-11-14  Cary Coutant  <ccoutant@google.com>
15739
15740         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
15741         instead of -1U.
15742
15743 2008-11-05  Craig Silverstein  <csilvers@google.com>
15744
15745         * options.cc (General_options::parse_dynamic_list): New function.
15746         * options.h (General_options): New flags dynamic_list,
15747         dynamic_list_data, dynamic_list_cpp_new, and
15748         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
15749         (General_options::in_dynamic_list): New function.
15750         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
15751         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
15752         (Lex::can_continue_name): Likewise.
15753         (yylex): Likewise.
15754         (read_script_file): New parameter script_options.
15755         (read_dynamic_list): New function.
15756         (Script_options::define_dynamic_list): New function.
15757         (dynamic_list_keyword_parsecodes): New variable.
15758         (dynamic_list_keywords): New variable.
15759         * script.h (Script_options::define_dynamic_list): New function
15760         prototype.
15761         (read_dynamic_list): New function prototype.
15762         * symtab.cc (strprefix): New macro.
15763         (Symbol::should_add_dynsym_entry): Support dynamic_list,
15764         dynamic_list_data, dynamic_list_cpp_new, and
15765         dynamic_list_cpp_typeinfo.
15766         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
15767         (dynamic_list_expr): New rule.
15768         (dynamic_list_nodes): Likewise.
15769         (dynamic_list_node): Likewise.
15770         * testsuite/Makefile.am (dynamic_list): New test.
15771         * testsuite/Makefile.in: Regenerated.
15772         * testsuite/dynamic_list.t: New file.
15773         * testsuite/dynamic_list.sh: New file.
15774
15775 2008-11-05  Craig Silverstein  <csilvers@google.com>
15776
15777         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
15778         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
15779         (t11_last): Likewise.
15780         * testsuite/ver_test_6.c (main): Likewise.
15781
15782 2008-10-07  Cary Coutant  <ccoutant@google.com>
15783
15784         * options.c (General_options::finalize): Add check for -static and
15785         -shared.
15786         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
15787         is not empty.
15788
15789 2008-10-02  Cary Coutant  <ccoutant@google.com>
15790
15791         * plugin.cc (make_sized_plugin_object): Fix conditional
15792         compilation to work when not all targets are enabled.
15793
15794 2008-09-29  Cary Coutant  <ccoutant@google.com>
15795
15796         * archive.cc (Archive::get_file_and_offset): Use filename instead
15797         of name to get library path.
15798         (Archive::include_member): Unlock external member of a thin archive.
15799
15800         * testsuite/Makefile.am (TEST_AR): New variable.
15801         (thin_archive_test_1): New test.
15802         (thin_archive_test_2): New test.
15803         * testsuite/Makefile.in: Regenerate.
15804         * testsuite/thin_archive_main.cc: New file.
15805         * testsuite/thin_archive_test_1.cc: New file.
15806         * testsuite/thin_archive_test_2.cc: New file.
15807         * testsuite/thin_archive_test_3.cc: New file.
15808         * testsuite/thin_archive_test_4.cc: New file.
15809
15810 2008-09-29  Cary Coutant  <ccoutant@google.com>
15811
15812         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
15813         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
15814         instead of -1U.
15815         (Sized_relobj::do_finalize_local_symbols): Likewise.
15816         (Sized_relobj::map_to_kept_section): Likewise.
15817         * object.h (Sized_relobj::invalid_address): New constant.
15818         (Sized_relobj::do_output_section_offset): Check for invalid_address
15819         and return -1ULL.
15820         * output.cc (Output_reloc::local_section_offset): Use constant
15821         invalid_address instead of -1U.
15822         (Output_reloc::get_address): Likewise.
15823         (Output_section::output_address): Change -1U to -1ULL.
15824         * output.h (Output_reloc::invalid_address): New constant.
15825         * reloc.cc (Sized_relobj::write_sections): Use constant
15826         invalid_address instead of -1U.
15827         (Sized_relobj::relocate_sections): Likewise.
15828         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
15829         values for merge sections.
15830         * target-reloc.h (relocate_for_relocatable): Use constant
15831         invalid_address instead of -1U.
15832
15833 2008-09-19  Cary Coutant  <ccoutant@google.com>
15834
15835         Add plugin functionality for link-time optimization (LTO).
15836         * configure.ac (plugins): Add --enable-plugins option.
15837         * configure: Regenerate.
15838         * config.in: Regenerate.
15839         * Makefile.am (LIBDL): New variable.
15840         (CCFILES): Add plugin.cc.
15841         (HFILES): Add plugin.h.
15842         (ldadd_var): Add LIBDL.
15843         * Makefile.in: Regenerate.
15844
15845         * archive.cc: Include "plugin.h".
15846         (Archive::setup): Don't preread archive symbols when using a plugin.
15847         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
15848         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
15849         files.
15850         (Archive::include_member): Add symbols from plugin objects.
15851         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
15852         * descriptors.cc (Descriptors::open): Check for file descriptors
15853         abandoned by plugins.
15854         (Descriptors::claim_for_plugin): New function.
15855         * descriptors.h (Descriptors::claim_for_plugin): New function.
15856         (Open_descriptor::is_claimed): New field.
15857         (claim_descriptor_for_plugin): New function.
15858         * fileread.cc (File_read::claim_for_plugin): New function.
15859         * fileread.h (File_read::claim_for_plugin): New function.
15860         (File_read::descriptor): New function.
15861         * gold.cc: Include "plugin.h".
15862         (queue_initial_tasks): Add task to call plugin hooks for generating
15863         new object files.
15864         * main.cc: Include "plugin.h".
15865         (main): Load plugin libraries.
15866         * object.h (Pluginobj): Declare.
15867         (Object::pluginobj): New function.
15868         (Object::do_pluginobj): New function.
15869         (Object::set_target): New function.
15870         * options.cc: Include "plugin.h".
15871         (General_options::parse_plugin): New function.
15872         (General_options::General_options): Initialize plugins_ field.
15873         (General_options::add_plugin): New function.
15874         * options.h (Plugin_manager): Declare.
15875         (General_options): Add --plugin option.
15876         (General_options::has_plugins): New function.
15877         (General_options::plugins): New function.
15878         (General_options::add_plugin): New function.
15879         (General_options::plugins_): New field.
15880         * plugin.cc: New file.
15881         * plugin.h: New file.
15882         * readsyms.cc: Include "plugin.h".
15883         (Read_symbols::do_read_symbols): Check for archive before checking
15884         for ELF file.  Call plugin hooks to claim files.
15885         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
15886         from a real object file; force override when processing replacement
15887         files.
15888         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
15889         (Symbol::init_base_object): Likewise.
15890         (Symbol::init_base_output_data): Likewise.
15891         (Symbol::init_base_output_segment): Likewise.
15892         (Symbol::init_base_constant): Likewise.
15893         (Symbol::init_base_undefined): Likewise.
15894         (Symbol::output_section): Assert that object is not a plugin.
15895         (Symbol_table::add_from_pluginobj): New function.
15896         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15897         undefined.
15898         (Symbol_table::sized_write_globals): Likewise.
15899         (Symbol_table::add_from_pluginobj): Instantiate template.
15900         * symtab.h (Sized_pluginobj): Declare.
15901         (Symbol::in_real_elf): New function.
15902         (Symbol::set_in_real_elf): New function.
15903         (Symbol::in_real_elf_): New field.
15904         (Symbol_table::add_from_pluginobj): New function.
15905
15906         * testsuite/Makefile.am (AM_CFLAGS): New variable.
15907         (LIBDL): New variable.
15908         (LDADD): Add LIBDL.
15909         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
15910         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
15911         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
15912         (MOSTLYCLEANFILES): Likewise.
15913         * testsuite/Makefile.in: Regenerate.
15914         * testsuite/plugin_test.c: New file.
15915         * testsuite/plugin_test_1.sh: New file.
15916         * testsuite/plugin_test_2.sh: New file.
15917
15918 2008-09-16  Ian Lance Taylor  <iant@google.com>
15919
15920         * target-reloc.h (relocate_section): Check whether a symbol is
15921         defined by the ABI before reporting an undefined symbol error.
15922         * target.h (Target::is_defined_by_abi): Make parameter const.
15923         (Target::do_is_defined_by_abi): Likewise.
15924         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
15925         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
15926         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
15927         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
15928         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
15929         * testsuite/Makefile.in: Rebuild.
15930
15931         * fileread.cc (make_view): Add casts to avoid warning.
15932
15933 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15934
15935         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
15936         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15937
15938 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15939
15940         * options.h (General_options::output_is_executable): New.
15941         (General_options::output_is_pie): New.
15942         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
15943         for shared libraries.
15944         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15945
15946 2008-09-11  Chris Demetriou  <cgd@google.com>
15947
15948         * options.h (origin): New -z option.
15949         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
15950         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
15951         in DT_FLAGS_1.
15952
15953 2008-09-05  Cary Coutant  <ccoutant@google.com>
15954
15955         * fileread.cc (File_read::make_view): Add check for attempt to map
15956         beyond end of file.
15957
15958 2008-09-05  Cary Coutant  <ccoutant@google.com>
15959
15960         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
15961         explicit instantiations.
15962
15963 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
15964
15965         PR gold/6858
15966         * options.cc (General_options::finalize): Allow undefined symbols
15967         in shlibs if linking -shared.
15968
15969         PR gold/6859
15970         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
15971         symbols as not needing a dynsym entry.
15972
15973 2008-08-20  Craig Silverstein  <csilvers@google.com>
15974
15975         * fileread.cc (File_read::open): Do not lock the file unless it
15976         was successfully opened.
15977
15978 2008-08-14  Cary Coutant  <ccoutant@google.com>
15979
15980         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
15981         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
15982         * testsuite/tls_test.cc (struct int128): 128-bit struct
15983         for testing TLS relocs with non-zero addend.
15984         (v12): New TLS variable.
15985         (t12): New test.
15986         (t_last): Add check for v12.
15987         * testsuite/tls_test.h (t12): New function.
15988         * testsuite/tls_test_main.cc (thread_routine): Call new test.
15989
15990 2008-08-13  Ian Lance Taylor  <iant@google.com>
15991
15992         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
15993         set tls_segment_ or relro_segment_.
15994         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
15995         when appropriate.
15996         * output.h (Output_section::clear_is_relro): New function.
15997         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
15998         sections specially even when output_data_ is empty.
15999         (Output_segment::maximum_alignment): When first section is relro,
16000         only force alignment for PT_LOAD segments.
16001         * script.cc (script_data_segment_align): New function.
16002         (script_data_segment_relro_end): New function.
16003         * script-c.h (script_data_segment_align): Declare.
16004         (script_data_segment_relro_end): Declare.
16005         * script-sections.h (class Script_sections): Declare
16006         data_segment_align and data_segment_relro_end.  Add fields
16007         segment_align_index_ and saw_relro_end_.
16008         * script-sections.cc (class Sections_element): Add set_is_relro
16009         virtual function.  Add new bool* parameter to place_orphan_here.
16010         Add get_output_section virtual function.
16011         (class Output_section_definition): Add set_is_relro.  Add new
16012         bool* parameter to place_orphan_here.  Add get_output_section.
16013         Add is_relro_ field.
16014         (Output_section_definition::Output_section_definition): Initialize
16015         evaluated_address_, evaluated_load_address, evaluated_addralign_,
16016         and is_relro_ fields.
16017         (Output_section_definition::place_orphan_here): Add is_relro
16018         parameter.
16019         (Output_section_definition::set_section_addresses): Set relro for
16020         output section.
16021         (Output_section_definition::alternate_constraint): Likewise.
16022         (class Orphan_output_section): Add new bool* parameter to
16023         place_orphan_here.  Add get_output_section.
16024         (Orphan_output_section::place_orphan_here): Add is_relro
16025         parameter.
16026         (Script_sections::Script_sections): Initialize
16027         data_segment_align_index_ and saw_relro_end_.
16028         (Script_sections::data_segment_align): New function.
16029         (Script_sections::data_segment_relro_end): New function.
16030         (Script_sections::place_orphan): Set or clear is_relro.
16031         (Script_sections::set_section_addresses): Force alignment of first
16032         TLS section.
16033         * yyscript.y (exp): Call script_data_segment_align and
16034         script_data_segment_relro_end.
16035         * testsuite/relro_script_test.t: New file.
16036         * testsuite/relro_test.cc (using_script): Declare.
16037         (t1, t2): Test using_script.
16038         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
16039         (relro_script_test_SOURCES): Define.
16040         (relro_script_test_DEPENDENCIES): Define.
16041         (relro_script_test_LDFLAGS): Define.
16042         (relro_script_test_LDADD): Define.
16043         (relro_script_test.so): New target.
16044         * testsuite/Makefile.in: Rebuild.
16045
16046 2008-08-06  Cary Coutant <ccoutant@google.com>
16047
16048         * archive.cc (Archive::total_archives, Archive::total_members)
16049         (Archive::total_members_loaded): New variables.
16050         (Archive::setup): Add parameter.  Add option to preread
16051         archive symbols.
16052         (Archive::read_armap): Add counter.
16053         (Archive::get_file_and_offset): New function.
16054         (Archive::get_elf_object_for_member): New function.
16055         (Archive::read_all_symbols): New function.
16056         (Archive::read_symbols): New function.
16057         (Archive::add_symbols): Add counters.
16058         (Archive::include_all_members): Use armap to find members if it's
16059         already built.
16060         (Archive::include_member): Skip reading symbols if already read.
16061         Factored code into Archive::get_file_and_offset and
16062         Archive::get_elf_object_for_member.  Changed call to
16063         Mapfile::report_include_archive_member.
16064         (Archive::print_stats): New function.
16065         * archive.h: Declare Object and Read_symbols_data classes.
16066         (Archive::Archive): Add initializers for new members.
16067         (Archive::setup): Add parameter.
16068         (Archive::print_stats): New function.
16069         (Archive::total_archives, Archive::total_members)
16070         (Archive::total_members_loaded): New variables.
16071         (Archive::get_file_and_offset): New function.
16072         (Archive::get_elf_object_for_member): New function.
16073         (Archive::read_all_symbols): New function.
16074         (Archive::read_symbols): New function.
16075         (Archive::Archive_member): New class.
16076         (Archive::members_): New member.
16077         (Archive::num_members_): New member.
16078         * main.cc: Include archive.h.
16079         (main): Call Archive::print_stats.
16080         * mapfile.cc (Mapfile::report_include_archive_member): Delete
16081         archive parameter; member_name is now the fully-decorated name.
16082         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
16083         * options.h: (General_options): Add --preread-archive-symbols option.
16084         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
16085         Archive::setup.
16086
16087 2008-08-04  Ian Lance Taylor  <iant@google.com>
16088
16089         * symtab.h (Symbol::use_plt_offset): New function.
16090         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
16091         * powerpc.cc (Relocate::relocate): Likewise.
16092         * sparc.cc (Relocate::relocate): Likewise.
16093         * x86_64.cc (Relocate::relocate): Likewise.
16094         * testsuite/weak_plt.sh: New test.
16095         * testsuite/weak_plt_main.cc: New test.
16096         * testsuite/weak_plt_shared.cc: New test.
16097         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
16098         (check_PROGRAMS): Add weak_plt.
16099         (check_DATA): Add weak_plt_shared.so.
16100         (weak_plt_main_pic.o, weak_plt): New targets.
16101         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
16102         * testsuite/Makefile.in: Rebuild.
16103
16104         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
16105         gcctestdir/ld.
16106         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
16107         * testsuite/Makefile.in: Rebuild.
16108
16109 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
16110
16111         * Makefile.am (POTFILES.in): Set LC_ALL=C.
16112         * Makefile.in: Regenerate.
16113         * po/POTFILES.in: Regenerate.
16114
16115 2008-07-29  Ian Lance Taylor  <iant@google.com>
16116
16117         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
16118         symbols before other symbols.
16119         * testsuite/script_test_2.cc (test_addr): Declare.
16120         (test_addr_alias): Declare.
16121         (main): Check that test_addr and test_addr_alias have the right
16122         values.
16123         * testsuite/script_test_2.t: Define test_addr_alias and
16124         test_addr.
16125
16126 2008-07-24  Ian Lance Taylor  <iant@google.com>
16127
16128         PR 5990
16129         * descriptors.cc: New file.
16130         * descriptors.h: New file.
16131         * gold-threads.h (class Hold_optional_lock): New class.
16132         * fileread.cc: Include "descriptors.h".
16133         (File_read::~File_read): Release descriptor rather than closing
16134         it.
16135         (File_read::open) [file]: Call open_descriptor rather than open.
16136         Set is_descriptor_opened_.
16137         (File_read::open) [memory]: Assert that descriptor is not open.
16138         (File_read::reopen_descriptor): New function.
16139         (File_read::release): Release descriptor.
16140         (File_read::do_read): Make non-const.  Reopen descriptor.
16141         (File_read::read): Make non-const.
16142         (File_read::make_view): Reopen descriptor.
16143         (File_read::do_readv): Likewise.
16144         * fileread.h (class File_read): Add is_descriptor_opened_ field.
16145         Update declarations.
16146         * layout.cc: Include "descriptors.h".
16147         (Layout::create_build_id): Use open_descriptor rather than open.
16148         * output.cc: Include "descriptors.h".
16149         (Output_file::open): Use open_descriptor rather than open.
16150         * archive.cc (Archive::const_iterator): Change Archive to be
16151         non-const.
16152         (Archive::begin, Archive::end): Make non-const.
16153         (Archive::count_members): Likewise.
16154         * archive.h (class Archive): Update declarations.
16155         * object.h (Object::read): Make non-const.
16156         * Makefile.am (CCFILES): Add descriptors.cc.
16157         (HFILES): Add descriptors.h.
16158         * Makefile.in: Rebuild.
16159
16160         PR 6716
16161         * gold.h: Always include <clocale>.  Add Solaris workarounds
16162         following code in binutils/sysdep.h.
16163
16164         PR 6048
16165         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
16166         this->eh_frame_hdr_ is NULL before using it.
16167
16168         * dynobj.cc (Versions::Versions): Update comment.
16169
16170         * dynobj.cc (Versions::Versions): If there is an soname, use it as
16171         the base version name.
16172
16173         * stringpool.cc (Stringpool_template::add_with_length): Set key to
16174         array size plus one.
16175         (Stringpool_template::set_string_offsets): Subtract one from key
16176         before using it as an array index.
16177         (Stringpool_template::get_offset_with_length): Likewise.
16178         (Stringpool_template::write_to_buffer): Likewise.
16179         * stringpool.h (Stringpool_template::get_offset_from_key):
16180         Likewise.
16181
16182 2008-07-23  Ian Lance Taylor  <iant@google.com>
16183
16184         PR 6658
16185         * object.h (Merged_symbol_value::value): Do our best to handle a
16186         negative addend.
16187
16188         PR 6647
16189         * script.cc (Version_script_info::get_versions): Don't add empty
16190         version tag to return value.
16191         (Version_script_info::get_symbol_version_helper): Change return
16192         type to bool.  Add pversion parameter.  Change all callers.
16193         (script_register_vers_node): Don't require a non-NULL tag.
16194         * script.h (class Version_script_info): Update declarations.
16195         (Version_script_info::get_symbol_version): Change return type to
16196         bool.  Add version parameter.  Change all callers.
16197         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
16198         handling.  Handle an empty version from a version script.
16199         (Symbol_table::define_special_symbol): Likewise.
16200         * testsuite/ver_test_10.script: New file.
16201         * testsuite/ver_test_10.sh: New file.
16202         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
16203         (check_DATA): Add ver_test_10.syms.
16204         (ver_test_10.syms, ver_test_10.so): New target.
16205         * testsuite/Makefile.in: Rebuild.
16206
16207 2008-07-23  Simon Baldwin  <simonb@google.com>
16208
16209         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
16210         to zero for undefined symbols from dynamic libraries.
16211
16212 2008-07-23  Ian Lance Taylor  <iant@google.com>
16213
16214         * symtab.cc (Symbol_table::resolve): Remove version parameter.
16215         Change all callers.
16216         * symtab.h (class Symbol_table): Update declaration.
16217         * testsuite/ver_test_9.cc: New file.
16218         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
16219         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
16220         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
16221         (ver_test_9.so, ver_test_9.o): New targets.
16222         * testsuite/Makefile.in: Rebuild.
16223
16224 2008-07-22  Ian Lance Taylor  <iant@google.com>
16225
16226         * options.h (class General_options): Define --check-sections.
16227         * layout.cc (Layout::set_segment_offsets): Handle
16228         --check-sections.
16229
16230         * options.h (class General_options): Define -n/--nmagic and
16231         -N/--omagic.
16232         * options.cc (General_options::finalize): For -n/--nmagic or
16233         -N/--omagic, set -static.
16234         * layout.cc (Layout::attach_allocated_section_to_segment): If
16235         -N/--omagic, don't put read-only and read-write sections in
16236         different segments.
16237         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
16238         finding a read-only segment.
16239         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
16240         don't set the minimum segment alignment to the common page size,
16241         and don't set the file offset to the address modulo the page size.
16242         * script-sections.cc (Script_sections::create_segments): If
16243         -n/--omagic, don't put read-only and read-write sections in
16244         different segments.
16245
16246         * cref.cc: New file.
16247         * cref.h: New file.
16248         * options.h (class General_options): Add --print-symbol-counts.
16249         * main.cc (main): Issue defined symbol report if requested.
16250         * archive.cc (Archive::interpret_header): Make into a const member
16251         function.
16252         (Archive::add_symbols): Call Input_objects::archive_start and
16253         archive_stop.
16254         (Archive::const_iterator): Define new class.
16255         (Archive::begin, Archive::end): New functions.
16256         (Archive::include_all_members): Rewrite to use iterator.
16257         (Archive::count_members): New function.
16258         * archive.h (class Archive): Update declarations.
16259         (Archive::filename): New function.
16260         * object.cc: Include "cref.h".
16261         (Sized_relobj::Sized_relobj): Initialize defined_count_.
16262         (Sized_relobj::do_get_global_symbol_counts): New function.
16263         (Input_objects::add_object): Add object to cross-referencer.
16264         (Input_objects::archive_start): New function.
16265         (Input_objects::archive_stop): New function.
16266         (Input_objects::print_symbol_counts): New function.
16267         * object.h: Declare Cref and Archive.
16268         (Object::get_global_symbol_counts): New function.
16269         (Object::do_get_global_symbol_counts): New pure virtual function.
16270         (class Sized_relobj): Add defined_count_ field.  Update
16271         declarations.
16272         (class Input_objects): Add cref_ field.  Update constructor.
16273         Update declarations.
16274         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
16275         defined_count_.
16276         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
16277         symbol counts.
16278         (Sized_dynobj::do_get_global_symbol_counts): New function.
16279         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
16280         defined_count_.  Update declarations.  Define Symbols typedef.
16281         * symtab.cc (Symbol_table::add_from_relobj): Add defined
16282         parameter.  Change all callers.
16283         (Symbol_table::add_from_dynobj): Add sympointers and defined
16284         parameters.  Change all callers.
16285         * symtab.h (class Symbol_table): Update declarations.
16286         * Makefile.am (CCFILES): Add cref.cc.
16287         (HFILES): Add cref.h.
16288         * Makefile.in: Rebuild.
16289
16290 2008-07-22  Simon Baldwin  <simonb@google.com>
16291
16292         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
16293         to zero when writing undefined symbols.
16294
16295 2008-07-22  Ian Lance Taylor  <iant@google.com>
16296
16297         * output.cc (Output_section::add_input_section): Don't try to
16298         merge empty merge sections.
16299
16300 2008-07-21  Craig Silverstein  <csilvers@google.com>
16301
16302         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
16303         Include symbol version in error message.
16304
16305 2008-07-20  Chris Demetriou  <cgd@google.com>
16306
16307         * configure.ac (gold_cv_c_random_seed): New configured variable.
16308         (RANDOM_SEED_CFLAGS): New substituted variable.
16309         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
16310         * configure: Rebuild.
16311         * Makefile.in: Likewise.
16312         * testsuite/Makefile.in: Likewise.
16313
16314 2008-07-18  Ian Lance Taylor  <iant@google.com>
16315
16316         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
16317         where we see NAME/NULL and NAME/VERSION  as separate symbols.
16318         * testsuite/ver_test_main.cc (main): Call t4.
16319         (t4, t4_2a): Define.
16320         * testsuite/ver_test_2.cc (t4_2): Define.
16321         * testsuite/ver_test_2.script: Put t4_2a in VER2.
16322         * testsuite/ver_test_4.cc (t4_2a): Define.
16323         * testsuite/ver_test_4.script: Put t4_2a in VER2.
16324         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
16325
16326 2008-07-17  Ian Lance Taylor  <iant@google.com>
16327
16328         * dynobj.cc (Versions::add_def): If we give an error about a
16329         missing version, go ahead and create the version anyhow.
16330
16331 2008-07-10  Ian Lance Taylor  <iant@google.com>
16332
16333         Handle output sections with more than 0x7fffffff bytes.
16334         * object.h (class Relobj): Change map_to_output_ to
16335         output_sections_, and just keep a section pointer.  Change all
16336         uses.  Move comdat group support to Sized_relobj.
16337         (Relobj::is_section_specially_mapped): Remove.
16338         (Relobj::output_section): Remove poff parameter.  Change all
16339         callers.
16340         (Relobj::output_section_offset): New function.
16341         (Relobj::set_section_offset): Rewrite.
16342         (Relobj::map_to_output): Remove.
16343         (Relobj::output_sections): New function.
16344         (Relobj::do_output_section_offset): New pure virtual function.
16345         (Relobj::do_set_section_offset): Likewise.
16346         (class Sized_relobj): Add section_offsets_ field.  Add comdat
16347         group support from Relobj.  Update declarations.
16348         (Sized_relobj::get_output_section_offset): New function.
16349         (Sized_relobj::do_output_section_offset): New function.
16350         (Sized_relobj::do_set_section_offset): New function.
16351         * object.cc (Relobj::output_section_address): Remove.
16352         (Sized_relobj::Sized_relobj): Initialize new fields.
16353         (Sized_relobj::include_section_group): Cast find_kept_object to
16354         Sized_relobj.
16355         (Sized_relobj::include_linkonce_section): Likewise.
16356         (Sized_relobj::do_layout): Use separate arrays for output section
16357         and output offset.
16358         (Sized_relobj::do_count_local_symbols): Change map_to_output to
16359         output_sections.
16360         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
16361         output_sections and section_offsets.
16362         (Sized_relobj::write_local_symbols): Likewise.
16363         (map_to_kept_section): Compute output address directly.
16364         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
16365         output_sections and section_offsets.
16366         (Sized_relobj::write_sections): Likewise.
16367         (Sized_relobj::relocate_sections): Likewise.
16368         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
16369         * output.h (class Output_reloc): Update declarations.  Change
16370         u2_.relobj to Sized_relobj*.
16371         (class Output_data_reloc): Change add functions to use
16372         Sized_relobj*.
16373         * output.cc (Output_reloc::Output_reloc): Change relobj to
16374         Sized_relobj*.
16375         (Output_reloc::local_section_offset): Change return type to
16376         Elf_Addr.  Use get_output_section_offset.
16377         (Output_reloc::get_address): Likewise.
16378         (Output_section::is_input_address_mapped): Don't call
16379         is_section_specially_mapped.
16380         (Output_section::output_offset): Likewise.
16381         (Output_section::output_address): Likewise.
16382         (Output_section::starting_output_address): Likewise.
16383         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
16384         parameter to Sized_relobj*.
16385         (Copy_relocs::need_copy_reloc): Likewise.
16386         (Copy_relocs::save): Likewise.
16387         * copy-relocs.h (class Copy_relocs): Update declarations.
16388         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
16389         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
16390         * target-reloc.h (relocate_for_relocatable): Change
16391         offset_in_output_section type to Elf_Addr.  Change code that uses
16392         it as well.
16393         * layout.cc (Layout::layout): Always set *off.
16394         * mapfile.cc (Mapfile::print_input_section): Use
16395         output_section_offset.
16396         * i386.cc (Target_i386::copy_reloc): Change object parameter to
16397         Sized_relobj*.
16398         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
16399         * sparc.cc (Target_sparc::copy_reloc): Likewise.
16400         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
16401
16402 2008-07-03  Ian Lance Taylor  <iant@google.com>
16403
16404         * layout.cc (Layout::include_section): Do not discard unrecognized
16405         SHT_STRTAB sections.
16406
16407 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
16408
16409         * script.cc (Lex::can_continue_name): Make '?' allowable in
16410         version-script names.
16411         * testsuite/version_script.map: Change glob pattern to use '?'
16412
16413 2008-06-30  Manish Singh  <yosh@gimp.org>
16414
16415         PR 6585
16416         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
16417         Correct typo.
16418
16419 2008-06-30  Ian Lance Taylor  <iant@google.com>
16420
16421         PR 6660
16422         PR 6682
16423         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
16424         versions]: Don't try to read the value in the contents, since we
16425         don't use it.  Use the template endianness when writing.
16426
16427 2008-06-25  Cary Coutant  <ccoutant@google.com>
16428
16429         * fileread.cc (File_read::make_view): Assert on zero-length view.
16430         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
16431         symbol table when there are no symbols to read.
16432
16433 2008-06-23  Craig Silverstein  <csilvers@google.com>
16434
16435         * version.cc (version_string): Bump to 1.7
16436
16437 2008-06-18  Craig Silverstein  <csilvers@google.com>
16438
16439         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
16440         constant 0xFFFF to type Valtype.
16441         (Powerpc_relocate_functions::rel16_ha): Likewise.
16442
16443 2008-06-17  Ian Lance Taylor  <iant@google.com>
16444
16445         * output.h (Output_section::Input_section): Initialize p2align_ to
16446         zero for Output_section_data constructors.
16447         (Output_section::Input_section::addralign): If not an input
16448         section, return the alignment of the Output_section_data.
16449         * testsuite/copy_test.cc: New file.
16450         * testsuite/copy_test_1.cc: New file.
16451         * testsuite/copy_test_2.cc: New file.
16452         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
16453         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
16454         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
16455         (copy_test_1_pic.o, copy_test_1.so): New targets.
16456         (copy_test_2_pic.o, copy_test_2.so): New targets.
16457         * testsuite/Makefile.in: Rebuild.
16458
16459         * script-sections.cc (Script_sections::place_orphan): Initialize
16460         local variable exact.
16461
16462 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
16463
16464         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
16465
16466 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
16467             David S. Miller  <davem@davemloft.net>
16468
16469         * powerpc.cc: New file.
16470         * Makefile.am (TARGETSOURCES): Add powerpc.cc
16471         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
16472         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
16473         * Makefile.in: Rebuild.
16474
16475 2008-06-09  Ian Lance Taylor  <iant@google.com>
16476
16477         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
16478         <exception>.
16479         (throwing, orig_terminate): New static variables.
16480         (terminate_handler): New static function.
16481         (t2): Set terminate handler.
16482
16483 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
16484
16485         PR 6584
16486         * binary.cc (Binary_to_elf::sized_convert): Fix .data
16487         alignment.
16488
16489 2008-05-30  Cary Coutant  <ccoutant@google.com>
16490
16491         * archive.cc (Archive::include_all_members) Correct to step
16492         over symbol table and extended name table in thin archives.
16493
16494 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
16495
16496         PR 6407
16497         * target-reloc.h (relocate_for_relocatable): Fix new_offset
16498         calculation.
16499
16500 2008-05-28  Caleb Howe  <cshowe@google.com>
16501
16502         * reduced_debug_output.cc: New file.
16503         * reduced_debug_output.h: New file.
16504         * options.h (class General_options): Add --strip-debug-non-line.
16505         * options.cc (General_options::finalize): Add strip_debug_non_line
16506         to the strip heirarchy.
16507         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
16508         fields.
16509         * layout.cc: Include "reduced_debug_output.h".
16510         (Layout::Layout): Initialize new fields.
16511         (line_only_debug_sections): New static array.
16512         (is_lines_only_debug_sections): New static inline function.
16513         (Layout::include_section): Handle --strip-debug-non-line.
16514         (Layout::make_output_section): If --strip-debug-non-line, build
16515         new output sections for .debug_abbrev and .debug_info.
16516         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
16517         gold.  Warn about possible overflow.
16518         (read_signed_LEB_128): Likewise.
16519         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
16520         (read_signed_LEB_128): Declare.
16521         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
16522         (HFILES): Add reduced_debug_output.h.
16523         * Makefile.in: Rebuild.
16524
16525 2008-05-21  Ian Lance Taylor  <iant@google.com>
16526
16527         * mapfile.cc: New file.
16528         * mapfile.h: New file.
16529         * options.h (class General_options): Add -M/--print-map and -Map.
16530         * options.cc (General_options::finalize): Make -M equivalent to
16531         -Map -.
16532         * main.cc: Include <cstdio> and "mapfile.h".
16533         (main): Open mapfile if requested.
16534         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
16535         constructor.  Change caller.
16536         (queue_initial_tasks): Add mapfile parameter.  Change caller.
16537         (queue_middle_tasks): Likewise.
16538         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
16539         declarations.
16540         * archive.cc: Include "mapfile.h".
16541         (Archive::add_symbols): Add mapfile parameter.  Change all
16542         callers.  Pass mapfile, symbol, and reason to include_member.
16543         (Archive::include_all_members): Add mapfile parameter.  Change all
16544         callers.
16545         (Archive::include_member): Add mapfile, sym, and why parameters.
16546         Change all callers.  Report inclusion to map file.
16547         * archive.h: Include "fileread.h".
16548         (class Archive): Update declarations.
16549         (Archive::file): New const method.
16550         (class Add_archive_symbols): Add mapfile_ field.  Update
16551         constructor.  Change all callers.
16552         * readsyms.h (class Read_symbols): Likewise.
16553         (class Finish_group): Likewise.
16554         (class Read_script): Likewise.
16555         * common.cc: Include "mapfile.h".
16556         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
16557         all callers.
16558         (Symbol_table::do_allocate_commons): Likewise.
16559         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
16560         symbol allocation to mapfile.
16561         * common.h (class Allocate_commons_task): Add mapfile_ field.
16562         Update constructor.  Change all callers.
16563         * symtab.h (class Symbol_table): Update declarations.
16564         * layout.cc: Include "mapfile.h".
16565         (Layout_task_runner::run): Print information to mapfile.
16566         (Layout::create_gold_note): Change Output_data_fixed_space to
16567         Output_data_zero_fill.
16568         (Layout::create_build_id): Likewise.
16569         (Layout::print_to_mapfile): New function.
16570         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
16571         constructor.  Change caller.
16572         (class Layout): Declare print_to_mapfile.
16573         * output.cc (Output_section::Input_section::print_to_mapfile): New
16574         function.
16575         (Output_section::add_input_section): If producing a map, always
16576         add to input_sections_ list.
16577         (Output_section::do_print_to_mapfile): New function.
16578         (Output_segment::print_sections_to_mapfile): New function.
16579         (Output_segment::print_section_list_to_mapfile): New function.
16580         * output.h: Include "mapfile.h".
16581         (Output_data::print_to_mapfile): New function.
16582         (Output_data::do_print_to_mapfile): New virtual function.
16583         (Output_segment_headers::do_print_to_mapfile): New function.
16584         (Output_file_header::do_print_to_mapfile): New function.
16585         (Output_data_const::do_print_to_mapfile): New function.
16586         (class Output_data_const_buffer): Add map_name_ field.  Update
16587         constructor.  Change all callers.  Add do_print_to_mapfile
16588         function.
16589         (class Output_data_fixed_space): Likewise.
16590         (class Output_data_space): Likewise.
16591         (class Output_data_zero_fill): New class.
16592         (Output_data_strtab::do_print_to_mapfile): New function.
16593         (Output_data_reloc_base::do_print_to_mapfile): New function.
16594         (Output_relocatable_relocs::do_print_to_mapfile): New function.
16595         (Output_data_group::do_print_to_mapfile): New function.
16596         (Output_data_got::do_print_to_mapfile): New function.
16597         (Output_data_dynamic::do_print_to_mapfile): New function.
16598         (Output_symtab_xindex::do_print_to_mapfile): New function.
16599         (class Output_section): Declare do_print_to_mapflie.  Declare
16600         print_to_mapfile in Input_section.
16601         (class Output_segment): Declare new functions.
16602         * object.h (Sized_relobj::symbol_count): New function.
16603         * script-sections.cc
16604         (Output_section_element_dot_assignment::set_section_addresses):
16605         Change Output_data_fixed_space to Output_data_zero_fill.
16606         (Output_data_expression::do_print_to_mapfile): New function.
16607         * script.cc (read_input_script): Add mapfile parameter.  Change
16608         all callers.
16609         * script.h (read_input_script): Update declaration.
16610         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
16611         (Eh_frame::do_print_to_mapfile): New function.
16612         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
16613         (Output_merge_string::do_print_to_mapfile): New function.
16614         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
16615         function.
16616         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
16617         function.
16618         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
16619         function.
16620         * Makefile.am (CCFILES): Add mapfile.cc.
16621         (HFILES): Add mapfile.h.
16622         * Makefile.in: Rebuild.
16623
16624 2008-05-19  Ian Lance Taylor  <iant@google.com>
16625
16626         * options.h (class General_options): Add -z relro.
16627         * layout.cc (Layout::Layout): Initialize relro_segment_.
16628         (Layout::add_output_section_data): Return the output section.
16629         (Layout::make_output_section): Rcognize relro sections and mark
16630         them appropriately.
16631         (Layout::attach_allocated_section_to_segment): Put relro sections
16632         in a PT_GNU_RELRO segment.
16633         (Layout::create_initial_dynamic_sections): Mark the .dynamic
16634         section as relro.
16635         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
16636         PT_TLS segments.
16637         (Layout::linkonce_mapping): Map d.rel.ro.local to
16638         .data.rel.ro.local.
16639         (Layout::output_section_name): Us .data.rel.ro.local for any
16640         section which begins with that.
16641         * layout.h (class Layout): Update add_output_section_data
16642         declaration.  Add relro_segment_ field.
16643         * output.cc (Output_section::Output_section): Initialize is_relro_
16644         and is_relro_local_ fields.
16645         (Output_segment::add_output_section): Group relro sections.
16646         (Output_segment::is_first_section_relro): New function.
16647         (Output_segment::maximum_alignment): If there is a relro section,
16648         align the segment to the common page size.
16649         (Output_segment::set_section_addresses): Track whether we are
16650         looking at relro sections.  If the last section is a relro
16651         section, align to the common page size.
16652         (Output_segment::set_section_list_addresses): Add in_relro
16653         parameter.  Change all callers.  Align to the page size when
16654         moving from relro to non-relro section.
16655         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
16656         segment.
16657         * output.h (class Output_section): Add is_relro_ and
16658         is_relro_local_ fields.
16659         (Output_section::is_relro): New function.
16660         (Output_section::set_is_relro): New function.
16661         (Output_section::is_relro_local): New function.
16662         (Output_section::set_is_relro_local): New function.
16663         (class Output_segment): Update declarations.
16664         * i386.cc (Target_i386::got_section): Mark .got section as relro.
16665         * sparc.cc (Target_sparc::got_section): Likewise.
16666         * x86_64.cc (Target_x86_64::got_section): Likewise.
16667         * testsuite/relro_test_main.cc: New file.
16668         * testsuite/relro_test.cc: New file.
16669         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
16670         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
16671         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
16672         (relro_test.so, relro_test_pic.o): New targets.
16673         * testsuite/Makefile.in: Rebuild.
16674
16675 2008-05-16  Ian Lance Taylor  <iant@google.com>
16676
16677         * output.cc (Output_segment::add_output_section): Remove front
16678         parameter.
16679         * output.h (class Output_segment): Remove
16680         add_initial_output_section and overloaded add_output_section.
16681         Update declaration of remaining add_output_section.
16682         * layout.cc (Layout::create_interp): Call add_output_section
16683         rather than add_initial_output_section.
16684         (Layout::finish_dynamic_section): Likewise.
16685
16686         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
16687         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
16688         know the dynamic type.
16689         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
16690         field.  Initialize it in constructor.
16691         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
16692         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
16693         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
16694         reloc.
16695
16696         * output.cc (Output_reloc::get_address): Change return type to
16697         Elf_Addr.
16698         * output.h (class Output_reloc): Update get_address declaration.
16699         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
16700         for section addresses.
16701
16702 2008-05-09  Ian Lance Taylor  <iant@google.com>
16703
16704         PR 6493
16705         * gold.cc (gold_nomem): Use return value of write.
16706
16707 2008-05-08  Ian Lance Taylor  <iant@google.com>
16708
16709         * symtab.c (Symbol::init_base_output_data): Add version
16710         parameter.  Change all callers.
16711         (Symbol::init_base_output_segment): Likewise.
16712         (Symbol::init_base_constant): Likewise.
16713         (Symbol::init_base_undefined): Likewise.
16714         (Sized_symbol::init_output_data): Likewise.
16715         (Sized_symbol::init_output_segment): Likewise.
16716         (Sized_symbol::init_constant): Likewise.
16717         (Sized_symbol::init_undefined): Likewise.
16718         (Symbol_table::do_define_in_output_data): If the new symbol has a
16719         version, mark it as the default.
16720         (Symbol_table::do_define_in_output_segment): Likewise.
16721         (Symbol_table::do_define_as_constant): Likewise.
16722         * symtab.h (class Symbol): Update declarations.
16723         (class Sized_symbol): Likewise.
16724         * resolve.cc (Symbol::override_version): New function.
16725         (Symbol::override_base): Call override_version.
16726         (Symbol::override_base_with_special): Likewise.
16727         * testsuite/ver_script_8.script: New file.
16728         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
16729         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
16730         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
16731         (ver_test_8_1.so, ver_test_8_2.so): New targets.
16732
16733 2008-05-06  Ian Lance Taylor  <iant@google.com>
16734
16735         PR 6049
16736         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
16737         functions.
16738         (class General_options): Remove existing --undefined, and add
16739         --no-undefined instead.  Add new --undefined as synonym for -u.
16740         * archive.cc (Archive::add_symbols): Check whether symbol was
16741         named with -u.
16742         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
16743         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
16744         all uses.  Add IS_UNDEFINED.  Update declarations to split
16745         different versions of init_base.  Declare init_base_undefined.
16746         (Symbol::is_defined): Handle IS_UNDEFINED.
16747         (Symbol::is_undefined): Likewise.
16748         (Symbol::is_weak_undefined): Call is_undefined.
16749         (Symbol::is_absolute): Handle IS_CONSTANT.
16750         (class Sized_symbol): Update declarations to split different
16751         versions of init.  Declare init_undefined.
16752         (class Symbol_table): Declare new functions.
16753         * symtab.cc (Symbol::init_base_object): Rename from init_base.
16754         Change all callers.
16755         (Symbol::init_base_output_data): Likewise.
16756         (Symbol::init_base_output_segment): Likewise.
16757         (Symbol::init_base_constant): Likewise.
16758         (Symbol::init_base_undefined): New function.
16759         (Sized_symbol::init_object): Rename from init.  Change all
16760         callers.
16761         (Sized_symbol::init_output_data): Likewise.
16762         (Sized_symbol::init_output_segment): Likewise.
16763         (Sized_symbol::init_constant): Likewise.
16764         (Sized_symbol::init_undefined): New function.
16765         (Symbol_table::add_undefined_symbols_from_command_line): New
16766         function.
16767         (Symbol_table::do_add_undefined_symbols_from_command_line): New
16768         function.
16769         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
16770         (Symbol::output_section): Likewise.
16771         (Symbol::set_output_section): Likewise.
16772         (Symbol_table::sized_finalize_symbol): Likewise.
16773         (Symbol_table::sized_write_globals): Likewise.
16774         * resolve.cc (Symbol_table::should_override): Likewise.
16775         (Symbol::override_base_with_special): Likewise.
16776
16777         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
16778         symbol, change it to have default visibility.
16779         * testsuite/protected_1.cc: New file.
16780         * testsuite/protected_2.cc: New file.
16781         * testsuite/protected_3.cc: New file.
16782         * testsuite/protected_main_1.cc: New file.
16783         * testsuite/protected_main_2.cc: New file.
16784         * testsuite/protected_main_3.cc: New file.
16785         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
16786         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
16787         (protected_1_LDFLAGS, protected_1_LDADD): Define.
16788         (protected_1.so): New target.
16789         (protected_1_pic.o, protected_2_pic.o): New targets.
16790         (protected_3_pic.o): New target.
16791         (check_PROGRAMS): Add protected_2.
16792         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
16793         (protected_2_LDFLAGS, protected_2_LDADD): Define.
16794         * testsuite/Makefile.in: Rebuild.
16795
16796         * options.h (DEFINE_var): Add set_user_set_##varname__.
16797         (DEFINE_bool_alias): New macro.
16798         (class General_options): Define -Bstatic using DEFINE_bool_alias
16799         rather than DEFINE_special.  Add --undefined as an alias for -z
16800         defs.
16801         * options.cc (General_options::parse_Bstatic): Remove.
16802
16803         * options.h (class General_options): Add --fatal-warnings.
16804         * main.cc (main): Implement --fatal-warnings.
16805         * errors.h (Errors::warning_count): New function.
16806
16807         * options.h (class General_options): Add -Bsymbolic-functions.
16808         * symtab.h (Symbol::is_preemptible): Check for
16809         -Bsymbolic-functions.
16810
16811 2008-05-05  Ian Lance Taylor  <iant@google.com>
16812
16813         * options.h (DEFINE_bool): For DASH_Z, create the negative option
16814         as noVARNAME rather than no-VARNAME.
16815         (class General_options): Add option -z combreloc.
16816         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
16817         get_address.
16818         (Output_reloc::sort_before) [SHT_REL]: New function.
16819         (Output_reloc::sort_before) [SHT_RELA]: New function.
16820         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
16821         Sort_relocs_comparison.
16822         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
16823         parameter.  Change all callers.
16824         (Output_data_reloc::Output_data_reloc) [both versions]: Add
16825         sort_relocs parameter.  Change all callers.
16826         * output.cc (Output_reloc::get_address): New function, broken out
16827         of write_rel.
16828         (Output_reloc::write_rel): Call it.
16829         (Output_reloc::compare): New function.
16830         (Output_data_reloc_base::do_write): Optionally sort relocs.
16831
16832         * configure.ac: If targ_extra_obj is set, link it in.
16833         * configure.tgt: Initialize all variables.
16834         (x86_64*): Set targ_extra_obj and targ_extra_size.
16835         * configure: Rebuild.
16836
16837         * object.cc (Sized_relobj::include_section_group): Adjust section
16838         indexes read from group data.  Build vector to pass to
16839         layout_group.
16840         * layout.cc (Layout::layout_group): Add flags and shndxes
16841         parameters.  Remove contents parameter.  Change caller.  Update
16842         explicit instantiations.
16843         * layout.h (class Layout): Update layout_group declaration.
16844         * output.cc (Output_data_group::Output_data_group): Add flags and
16845         input_shndxes parameters.  Remove contents parameter.  Change
16846         caller.
16847         (Output_data_group::do_write): Change input_sections_ to
16848         input_shndxes_.
16849         * output.h (class Output_data_group): Update constructor
16850         declaration.  Rename input_sections_ to input_shndxes_.
16851         * testsuite/many_sections_test.cc: Add template.
16852
16853 2008-04-30  Cary Coutant  <ccoutant@google.com>
16854
16855         * target-reloc.h (relocate_section): Fix dead-pointer bug.
16856
16857         * layout.cc (Layout::include_section): Refactored check for debug
16858         info section.
16859         (Layout::add_comdat): Add new parameters.  Change type
16860         of signature parameter.  Add object and shndx to signatures table.
16861         (Layout::find_kept_object): New function.
16862         * layout.h: Include <cstring>.
16863         (Layout::is_debug_info_section): New function.
16864         (Layout::add_comdat): Add new parameters.
16865         (Layout::find_kept_object): New function.
16866         (Layout::Kept_section): New struct.
16867         (Layout::Signatures): Change type of map range.
16868         * object.cc (Relobj::output_section_address): New function.
16869         (Sized_relobj::include_section_group): Add new parameters.  Change
16870         calls to Layout::add_comdat.  Change to build table of kept comdat
16871         groups and table mapping discarded sections to kept sections.
16872         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
16873         (Sized_relobj::do_layout): Change calls to include_section_group and
16874         include_linkonce_section.
16875         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
16876         value to zero when section is discarded.
16877         (Sized_relobj::map_to_kept_section): New function.
16878         * object.h (Relobj::output_section_address): New function.
16879         (Relobj::Comdat_group): New type.
16880         (Relobj::find_comdat_group): New function.
16881         (Relobj::Comdat_group_table): New type.
16882         (Relobj::Kept_comdat_section): New type.
16883         (Relobj::Kept_comdat_section_table): New type.
16884         (Relobj::add_comdat_group): New function.
16885         (Relobj::set_kept_comdat_section): New function.
16886         (Relobj::get_kept_comdat_section): New function.
16887         (Relobj::comdat_groups_): New field.
16888         (Relobj::kept_comdat_sections_): New field.
16889         (Symbol_value::input_value): Update comment.
16890         (Sized_relobj::map_to_kept_section) New function.
16891         (Sized_relobj::include_linkonce_section): Add new parameter.
16892         * target-reloc.h (Comdat_behavior): New type.
16893         (get_comdat_behavior): New function.
16894         (relocate_section): Add code to map a discarded section to the
16895         corresponding kept section when applying a relocation.
16896
16897 2008-04-30  Craig Silverstein  <csilvers@google.com>
16898
16899         * dwarf_reader.cc (next_generation_count): New static var.
16900         (Addr2line_cache_entry): New struct.
16901         (addr2line_cache): New static var.
16902         (Dwarf_line_info::one_addr2line): Added caching.
16903         (Dwarf_line_info::clear_addr2line_cache): New function.
16904         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
16905         cache-size parameter.
16906         (Dwarf_line_info::one_addr2line_cache): New function.
16907         * symtab.cc (Symbol_table::detect_odr_violations): Pass
16908         new cache-size argument to one_addr2line(), and clear cache.
16909
16910 2008-04-28  Cary Coutant  <ccoutant@google.com>
16911
16912         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
16913         R_386_PC8 relocations.
16914
16915 2008-04-23  Ian Lance Taylor  <iant@google.com>
16916
16917         * object.cc (Sized_relobj::include_section_group): Check for
16918         invalid section group.
16919
16920         * object.cc (make_elf_object): Correct test for 64-bit ELF file
16921         header size.
16922
16923         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
16924         than read for file header.
16925         * archive.cc (Archive::include_member): Likewise.
16926
16927 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
16928
16929         * aclocal.m4: Regenerate.
16930         * configure: Regenerate.
16931
16932 2008-04-19  Ian Lance Taylor  <iant@google.com>
16933
16934         * version.cc (version_string): Bump to 1.6.
16935
16936         * testsuite/Makefile.am (many_sections_r_test): New target.
16937         (many_sections_r_test_SOURCES): Remove.
16938         (many_sections_r_test_DEPENDENCIES): Remove.
16939         (many_sections_r_test_LDFLAGS): Remove.
16940         (many_sections_r_test_LDADD): Remove.
16941
16942         * object.cc (Sized_relobj::do_add_symbols): Always pass
16943         local_symbol_count_ to add_from_relobj.
16944
16945         * testsuite/Makefile.am (many_sections_check.h): Only check one in
16946         every thousand variables.
16947         * testsuite/Makefile.in: Rebuild.
16948
16949         * object.cc (Xindex::initialize_symtab_xindex): New function.
16950         (Xindex::read_symtab_xindex): New function.
16951         (Xindex::sym_xindex_to_shndx): New function.
16952         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
16953         available.
16954         (Sized_relobj::do_initialize_xindex): New function.
16955         (Sized_relobj::do_read_symbols): Adjust section links.
16956         (Sized_relobj::symbol_section_and_value): Add is_ordinary
16957         parameter.  Change all callers.
16958         (Sized_relobj::include_section_group): Adjust section links and
16959         symbol section indexes.
16960         (Sized_relobj::do_layout): Adjust section links.
16961         (Sized_relobj::do_count_local_symbols): Adjust section links and
16962         symbol section indexes.
16963         (Sized_relobj::do_finalize_local_symbols): Distinguish between
16964         ordinary and special symbols.
16965         (Sized_relobj::write_local_symbols): Add symtab_xindex and
16966         dynsym_xindex parameters.  Change all callers.  Adjust section
16967         links.  Use SHN_XINDEX when needed.
16968         (Sized_relobj::get_symbol_location_info): Adjust section links.
16969         Don't get fooled by special symbols.
16970         * object.h (class Xindex): Define.
16971         (class Object): Add xindex_ parameter.  Declare virtual functoin
16972         do_initialize_xindex.
16973         (Object::adjust_sym_shndx): New function.
16974         (Object::set_xindex): New protected function.
16975         (class Symbol_value): Add is_ordinary_shndx_ field.
16976         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
16977         (Symbol_value::value): Assert ordinary section.
16978         (Symbol_value::initialize_input_to_output_map): Likewise.
16979         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
16980         Change all callers.
16981         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
16982         all callers.
16983         (class Sized_relobj): Update declarations.
16984         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
16985         parameter.  Change all callers.
16986         (Sized_relobj::adjust_shndx): New function.
16987         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
16988         field.
16989         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
16990         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
16991         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
16992         (Sized_dynobj::read_dynsym_section): Adjust section links.
16993         (Sized_dynobj::read_dynamic): Likewise.
16994         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
16995         section links.
16996         (Sized_dynobj::do_initialize_xindex): New function.
16997         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
16998         do_initialize_xindex.
16999         (Sized_dynobj::adjust_shndx): New function.
17000         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
17001         dynsym_xindex_ fields.
17002         (Layout::finalize): Add a call to set_section_indexes before
17003         creating the symtab sections.
17004         (Layout::set_section_indexes): Don't do anything if the section
17005         already has a section index.
17006         (Layout::create_symtab_sections): Add shnum parameter.  Change
17007         caller.  Create .symtab_shndx section if needed.
17008         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
17009         caller.
17010         (Layout::allocated_output_section_count): New function.
17011         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
17012         needed.
17013         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
17014         fields.  Update declarations.
17015         (Layout::symtab_xindex): New function.
17016         (Layout::dynsym_xindex): New function.
17017         (class Write_symbols_task): Add layout_ field.
17018         (Write_symbols_task::Write_symbols_task): Add layout parameter.
17019         Change caller.
17020         * output.cc (Output_section_headers::Output_section_headers): Add
17021         shstrtab_section parameter.  Change all callers.
17022         (Output_section_headers::do_sized_write): Store overflow values
17023         for section count and section string table section index in
17024         section header zero.
17025         (Output_file_header::do_sized_write): Check for overflow of
17026         section count and section string table section index.
17027         (Output_symtab_xindex::do_write): New function.
17028         (Output_symtab_xindex::endian_do_write): New function.
17029         * output.h (class Output_section_headers): Add shstrtab_section_.
17030         Update declarations.
17031         (class Output_symtab_xindex): Define.
17032         (Output_section::has_out_shndx): New function.
17033         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
17034         field.
17035         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
17036         Change all callers.
17037         (Sized_symbol::init): Likewise.
17038         (Symbol::output_section): Check for ordinary symbol.
17039         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
17040         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
17041         callers.
17042         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
17043         Change all callers.  Simplify handling of symbols from sections
17044         not included in the link.
17045         (Symbol_table::add_from_dynobj): Handle ordinary symbol
17046         distinction.
17047         (Weak_alias_sorter::operator()): Assert that symbols are
17048         ordinary.
17049         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
17050         distinction.
17051         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
17052         parameters.  Change all callers.
17053         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
17054         symbol distinction.  Use SHN_XINDEX when needed.
17055         (Symbol_table::write_section_symbol): Add symtab_xindex
17056         parameter.  Change all callers.
17057         (Symbol_table::sized_write_section_symbol): Likewise.  Use
17058         SHN_XINDEX when needed.
17059         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
17060         declarations.
17061         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
17062         (Symbol::is_defined): Check is_ordinary.
17063         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
17064         (Symbol::is_absolute, Symbol::is_common): Likewise.
17065         (class Sized_symbol): Update declarations.
17066         (class Symbol_table): Update declarations.
17067         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
17068         parameters.  Change all callers.
17069         (Sized_symbol::override): Likewise.
17070         (Symbol_table::override): Likewise.
17071         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
17072         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
17073         is_ordinary, and orig_st_shndx parameters.  Change all callers.
17074         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
17075         to be in an ordinary section.
17076         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
17077         object and is_ordinary parameters.  Change all callers.
17078         (Sized_dwarf_line_info::read_relocs): Add object parameter.
17079         Change all callers.  Don't add undefined or non-ordinary symbols
17080         to reloc_map_.
17081         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
17082         Change all callers.
17083         * dwarf_reader.h (class Sized_dwarf_line_info): Update
17084         declarations.
17085         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
17086         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
17087         (Sized_relobj::relocate_sections): Likewise.
17088         * target-reloc.h (scan_relocs): Adjust section symbol index.
17089         (scan_relocatable_relocs): Likewise.
17090         * i386.cc (Scan::local): Check for ordinary symbols.
17091         * sparc.cc (Scan::local): Likewise.
17092         * x86_64.cc (Scan::local): Likewise.
17093         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
17094         to symbol_section_and_value.
17095         * testsuite/many_sections_test.cc: New file.
17096         * testsuite/Makefile.am (BUILT_SOURCES): Define.
17097         (check_PROGRAMS): Add many_sections_test.
17098         (many_sections_test_SOURCES): Define.
17099         (many_sections_test_DEPENDENCIES): Define.
17100         (many_sections_test_LDFLAGS): Define.
17101         (BUILT_SOURCES): Add many_sections_define.h.
17102         (many_sections_define.h): New target.
17103         (BUILT_SOURCES): Add many_sections_check.h.
17104         (many_sections_check.h): New target.
17105         (check_PROGRAMS): Add many_sections_r_test.
17106         (many_sections_r_test_SOURCES): Define.
17107         (many_sections_r_test_DEPENDENCIES): Define.
17108         (many_sections_r_test_LDFLAGS): Define.
17109         (many_sections_r_test_LDADD): Define.
17110         (many_sections_r_test.o): New target.
17111         * testsuite/Makefile.in: Rebuild.
17112
17113 2008-04-17  Cary Coutant  <ccoutant@google.com>
17114
17115         * errors.cc (Errors::info): New function.
17116         (gold_info): New function.
17117         * errors.h (Errors::info): New function.
17118         * gold.h (gold_info): New function.
17119         * object.cc (Input_objects::add_object): Print trace output.
17120         * options.cc (options::parse_set): New function.
17121         (General_options::parse_wrap): Deleted.
17122         (General_options::General_options): Deleted initializer.
17123         * options.h (options::String_set): New typedef.
17124         (options::parse_set): New function.
17125         (DEFINE_set): New macro.
17126         (General_options::wrap): Changed to use DEFINE_set. Changed
17127         callers of any_wrap_symbols and is_wrap_symbol.
17128         (General_options::trace, General_options::trace_symbol):
17129         New options.
17130         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
17131         (General_options::wrap_symbols_): Deleted.
17132         * symtab.cc (Symbol_table::add_from_object): Print trace output.
17133
17134 2008-04-17  David S. Miller  <davem@davemloft.net>
17135
17136         * options.cc (General_options::parse_V): New function.
17137         * options.h: Add entries for -V and -Qy.
17138
17139 2008-04-17  Ian Lance Taylor  <iant@google.com>
17140
17141         * common.cc (Symbol_table::allocate_commons): Remove options
17142         parameter.  Change caller.
17143         (Symbol_table::do_allocate_commons): Remove options parameter.
17144         Change caller.  Just call do_allocate_commons_list twice.
17145         (Symbol_table::do_allocate_commons_list): New function, broken out
17146         of do_allocate_commons.
17147         * common.h (class Allocate_commons_task): Remove options_ field.
17148         Update constructor.
17149         * symtab.cc (Symbol_table::Symbol_table): Initialize
17150         tls_commons_.
17151         (Symbol_table::add_from_object): Put TLS common symbols on
17152         tls_commons_ list.
17153         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
17154         which are IN_OUTPUT_DATA.
17155         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
17156         allocate_commons and do_allocate_commons declarations.  Declare
17157         do_allocate_commons_list.
17158         * gold.cc (queue_middle_tasks): Update creation of
17159         Allocate_commons_task to not pass options.
17160         * testsuite/Makefile.am (INCLUDES): Add -I.. .
17161         (TLS_TEST_C_FLAGS): New variable.
17162         (tls_test_c_pic.o): New target.
17163         (tls_test_shared.so): Link in tls_test_c_pic.o.
17164         (tls_test_c_pic_ie.o): New target.
17165         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
17166         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
17167         (tls_test_c.o): New target.
17168         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
17169         (tls_pic_test_LDADD): Likewise.
17170         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
17171         (tls_shared_gd_to_ie_test_LDADD): Likewise.
17172         (tls_test_c_gnu2.o): New target.
17173         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
17174         tls_test_c_gnu2.o.
17175         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
17176         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
17177         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
17178         * testsuite/tls_test.cc: Include "config.h".
17179         (t_last): Call t11_last.
17180         * testsuite/tls_test.h (t11, t11_last): Declare.
17181         * testsuite/tls_test_c.c: New file.
17182         * testsuite/tls_test_main.cc (thread_routine): Call t11.
17183         * configure.ac: Check for OpenMP support.
17184         * configure, config.in, Makefile.in: Rebuild.
17185         * testsuite/Makefile.in: Rebuild.
17186
17187 2008-04-16  Cary Coutant  <ccoutant@google.com>
17188
17189         * i386.cc (Target_i386::define_tls_base_symbol): New function.
17190         (Target_i386::tls_base_symbol_defined_): New field.
17191         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
17192         (Target_i386::Scan::global): Likewise.
17193         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
17194         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
17195         (Target_x86_64::tls_base_symbol_defined_): New field.
17196         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
17197         (Target_x86_64::Scan::global): Likewise.
17198
17199 2008-04-16  Cary Coutant  <ccoutant@google.com>
17200
17201         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
17202         (Symbol::needs_plt_entry): Allow weak undefined symbols.
17203         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
17204         building shared libraries.
17205         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
17206         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
17207         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
17208         * testsuite/Makefile.in: Rebuild.
17209         * testsuite/weak_undef.h: New file.
17210         * testsuite/weak_undef_file1.cc: Add extra test cases.
17211         * testsuite/weak_undef_file2.cc: Likewise.
17212         * testsuite/weak_undef_test.cc: Likewise.
17213
17214 2008-04-16  David S. Miller  <davem@davemloft.net>
17215
17216         * sparc.cc (Target_sparc::Scan): Change from struct to class.
17217         Add issued_non_pic_error_ field.  Declare check_non_pic.
17218         (Target_sparc::Scan::check_non_pic): New function.
17219         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
17220         (Target_sparc::Scan::global): Likewise.
17221
17222         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
17223         * configure: Rebuild.
17224
17225         * options.h (DEFINE_enable): New macro.
17226         (new_dtags): New enable option.
17227         (initfirst, interpose, loadfltr, nodefaultlib,
17228         nodelete, nodlopen, nodump): New -z options.
17229         * layout.cc (Layout:finish_dynamic_section): If new
17230         dtags enabled, emit DT_RUNPATH.  Also, emit a
17231         DT_FLAGS_1 containing any specified -z flags.
17232
17233 2008-04-16  Ian Lance Taylor  <iant@google.com>
17234
17235         * copy-relocs.cc: New file.
17236         * copy-relocs.h: New file.
17237         * reloc.cc: Remove Copy_relocs code.
17238         * reloc.h: Likewise.
17239         * reloc-types.h (struct Reloc_types) [both versions]: Add
17240         get_reloc_addend_noerror.
17241         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
17242         variants of add_global which take an addend which must be zero.
17243         * i386.cc: Include "copy-relocs.h".
17244         (class Target_i386): Change type of copy_relocs_ to variable,
17245         update initializer.
17246         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
17247         Change all callers.
17248         (Target_i386::do_finalize_sections): Change handling of
17249         copy_relocs_.
17250         * sparc.cc: Include "copy-relocs.h".
17251         (class Target_sparc): Change type of copy_relocs_ to variable,
17252         update initializer.
17253         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
17254         Change all callers.
17255         (Target_sparc::do_finalize_sections): Change handling of
17256         copy_relocs_.
17257         * x86_64.cc: Include "copy-relocs.h".
17258         (class Target_x86_64): Change type of copy_relocs_ to variable,
17259         update initializer.
17260         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
17261         class.  Change all callers.
17262         (Target_x86_64::do_finalize_sections): Change handling of
17263         copy_relocs_.
17264         * Makefile.am (CCFILES): Add copy-relocs.cc.
17265         (HFILES): Add copy-relocs.h.
17266
17267         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
17268
17269         * testsuite/script_test_4.sh: Permit leading zeroes.
17270
17271 2008-04-15  Ian Lance Taylor  <iant@google.com>
17272
17273         * script-sections.cc (Script_sections::create_segments): Use
17274         header_size_adjustment even when there is enough room for the
17275         headers.
17276         * testsuite/script_test_4.sh: New file.
17277         * testsuite/script_test_4.t: New file.
17278         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
17279         (check_DATA): Add script_test_4.stdout.
17280         (MOSTLYCLEANFILES): Likewise.
17281         (script_test_4): New target.
17282         (script_test_4.stdout): New target.
17283         * testsuite/Makefile.in: Rebuild.
17284
17285         * sparc.cc: Add definitions for Output_data_plt_sparc class
17286         constants.
17287
17288 2008-04-14  David S. Miller  <davem@davemloft.net>
17289
17290         * sparc.cc: New file.
17291         * Makefile.am (TARGETSOURCES): Add sparc.cc
17292         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
17293         * configure.tgt: Document targ_extra_size and
17294         targ_extra_big_endian.  Add entries for sparc-* and
17295         sparc64-*.
17296         * configure.ac: Handle targ_extra_size and
17297         targ_extra_big_endian.
17298         * Makefile.in: Rebuild.
17299         * configure: Likewise.
17300         * po/POTFILES.in: Likewise.
17301         * po/gold.pot: Likewise.
17302
17303 2008-04-14  Ian Lance Taylor  <iant@google.com>
17304
17305         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
17306         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
17307         in the name/type/flags to section mapping.  Don't call
17308         allocate_output_section.
17309         (Layout::choose_output_section): Change parameter from adjust_name
17310         to is_input_section.  Don't permit input sections after sections
17311         are attached to segments.  Don't call allocate_output_section.
17312         (Layout::layout_eh_frame): Call update_flags_for_input_section,
17313         not write_enable_output_section.
17314         (Layout::make_output_section): Don't push to
17315         unattached_section_list_ nor call attach_to_segment.  Call
17316         attach_section_to_segment if sections are attached.
17317         (Layout::attach_sections_to_segments): New function.
17318         (Layout::attach_section_to_segment): New function.
17319         (Layout::attach_allocated_section_to_segment): Rename from
17320         attach_to_segment.  Remove flags parameter.
17321         (Layout::allocate_output_section): Remove function.
17322         (Layout::write_enable_output_section): Remove function.
17323         * layout.h (class Layout): Update for above changes.  Add new
17324         field sections_are_attached_.
17325         * output.h (Output_section::update_flags_for_input_section): New
17326         function.
17327         * output.cc (Output_section::add_input_section): Call
17328         update_flags_for_input_section.
17329         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
17330
17331 2008-04-11  Cary Coutant  <ccoutant@google.com>
17332
17333         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
17334         thought unnecessary.
17335         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
17336
17337 2008-04-11  Ian Lance Taylor  <iant@google.com>
17338
17339         * output.h (class Output_section_data): Remove inline definition
17340         of set_addralign.
17341         * output.cc (Output_section_data::set_addralign): New function.
17342
17343 2008-04-11  Cary Coutant  <ccoutant@google.com>
17344
17345         Add support for TLS descriptors for i386 and x86_64.
17346         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
17347         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
17348         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
17349         GOT_TYPE_TLS_DESC.
17350         (Target_i386::got_mod_index_entry): Remove unnecessary code.
17351         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
17352         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
17353         relocations.
17354         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
17355         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
17356         Fix problem with initial-exec relocations.
17357         (Target_i386::Relocate::relocate_tls): Likewise.
17358         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
17359         relaxation.
17360         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
17361         support for section-plus-offset dynamic table entries.
17362         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
17363         (Output_data_dynamic::Dynamic_entry): Add support for
17364         section-plus-offset dynamic table entries.
17365         (Output_data_dynamic::Classification): Likewise.
17366         (Output_data_dynamic::classification_): Renamed offset_.
17367         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
17368         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
17369         (Target_x86_64::make_plt_section): New function.
17370         (Target_x86_64::reserve_tlsdesc_entries): New function.
17371         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
17372         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
17373         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
17374         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
17375         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
17376         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
17377         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
17378         add extra PLT entry for TLS descriptors.
17379         (Output_data_plt_x86_64::got_): New field.
17380         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
17381         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
17382         fields.
17383         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
17384         descriptors.
17385         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
17386         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
17387         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
17388         R_386_TLS_DESC_CALL relocations.
17389         (Target_x86_64::Scan::global): Likewise.
17390         (Target_x86_64::do_finalize_sections): Add dynamic table entries
17391         for TLS descriptors.
17392         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
17393         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
17394         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
17395         GD-to-IE relaxation.
17396         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
17397         and TLS_DESCRIPTORS.
17398         * Makefile.in: Rebuild.
17399         * configure: Rebuild.
17400         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
17401         (tls_test_shared2.so): New target.
17402         (tls_shared_gd_to_ie_test_SOURCES): New variable.
17403         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
17404         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
17405         (tls_shared_gd_to_ie_test_LDADD): New variable.
17406         (tls_shared_gnu2_gd_to_ie_test): New target.
17407         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
17408         New targets.
17409         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
17410         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
17411         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
17412         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
17413         (tls_shared_gnu2_test): New target.
17414         (tls_test_gnu2_shared.so): New target.
17415         (tls_shared_gnu2_test_SOURCES): New variable.
17416         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
17417         (tls_shared_gnu2_test_LDFLAGS): New variable.
17418         (tls_shared_gnu2_test_LDADD): New variable.
17419         * testsuite/Makefile.in: Rebuild.
17420         * testsuite/Makefile.
17421
17422 2008-04-11  Ian Lance Taylor  <iant@google.com>
17423
17424         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
17425         justsyms.t.
17426         * testsuite/Makefile.in: Rebuild.
17427
17428         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
17429         long.
17430         * testsuite/script_test_2.cc (main): Adjust test.
17431
17432 2008-04-11  David S. Miller  <davem@davemloft.net>
17433             Ian Lance Taylor  <iant@google.com>
17434
17435         * options.h (General_options): Add entries for '-Y' and
17436         '-relax'.
17437         * options.cc (General_options:finalize): If -Y was used, add those
17438         entries to the library path instead of the default "/lib" and
17439         "/usr/lib".
17440
17441 2008-04-11  David S. Miller  <davem@davemloft.net>
17442
17443         * testsuite/justsyms.t: Start at 0x100.
17444         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
17445         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
17446         long.
17447         * testsuite/script_test_2.cc: Adjust string and section length
17448         checks.
17449
17450 2008-04-09  Ian Lance Taylor  <iant@google.com>
17451
17452         PR gold/5996
17453         * script-sections.cc (Sections_element::allocate_to_segment): Add
17454         orphan parameter.
17455         (Output_section_definition::allocate_to_segment): Likewise.
17456         (Orphan_output_section::allocate_to_segment): Likewise.
17457         (Script_sections::attach_sections_using_phdrs_clause): Don't
17458         propagate non-PT_LOAD segments to orphan sections.
17459         * testsuite/Makefile.am (script_test_3.stdout): Generate using
17460         readelf rather than objdump.
17461         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
17462         .interp section and PT_INTERP segment are the same size.
17463         * testsuite/Makefile.in: Rebuild.
17464
17465         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
17466         aliases for symbols defined in the same object.
17467         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
17468         (weak_alias_test_SOURCES): New variable.
17469         (weak_alias_test_DEPENDENCIES): New variable.
17470         (weak_alias_test_LDFLAGS): New variable.
17471         (weak_alias_test_LDADD): New variable.
17472         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
17473         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
17474         (weak_alias_test_3.o): New target.
17475         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
17476         * testsuite/weak_alias_test_main.cc: New file.
17477         * testsuite/weak_alias_test_1.cc: New file.
17478         * testsuite/weak_alias_test_2.cc: New file.
17479         * testsuite/weak_alias_test_3.cc: New file.
17480
17481 2008-04-08  Ian Lance Taylor  <iant@google.com>
17482
17483         * options.h (class General_options): Add --noinhibit-exec option.
17484         * main.cc (main): Check --noinhibit-exec.
17485
17486         * options.h (class General_options): Define --wrap as a special
17487         option.  Add wrap_symbols_ field.
17488         (General_options::any_wrap_symbols): New function.
17489         (General_options::is_wrap_symbol): New function.
17490         * options.cc (General_options::parse_wrap): New function.
17491         (General_options::General_options): Initialize wrap_symbols_.
17492         * symtab.cc (Symbol_table::wrap_symbol): New function.
17493         (Symbol_table::add_from_object): Handle --wrap.
17494         * symtab.h (class Symbol_table): Declare wrap_symbol.
17495         * target.h (Target::wrap_char): New function.
17496         (Target::Target_info): Add wrap_char field.
17497         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
17498         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
17499         * testsuite/testfile.cc (Target_test::test_target_info):
17500         Likewise.
17501
17502         * errors.cc (Errors::undefined_symbol): Mention symbol version if
17503         there is one.
17504
17505         * layout.h (class Layout): Add added_eh_frame_data_ field.
17506         * layout.cc (Layout::Layout): Initialize new field.
17507         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
17508         output section until we find a section we merged successfully.
17509         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
17510         that the size be non-zero.
17511
17512         * merge.cc (Object_merge_map::get_output_offset): Remove inline
17513         qualifier.
17514
17515 2008-04-08  Craig Silverstein  <csilvers@google.com>
17516
17517         * configure.ac: Export new conditional variable HAVE_ZLIB.
17518         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
17519         on HAVE_ZLIB.
17520         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
17521         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17522
17523 2008-04-07  Ian Lance Taylor  <iant@google.com>
17524
17525         * version.cc (version_string): Set to "1.5".
17526
17527         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
17528         Add issued_non_pic_error_ field.  Declare check_non_pic.
17529         (Target_x86_64::Scan::check_non_pic): New function.
17530         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
17531         (Target_x86_64::Scan::global): Likewise.
17532
17533         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
17534         addend parameter.  Change caller.  Handle merge sections.
17535         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
17536         Address to Addend.  Don't add in the result of
17537         local_section_offset, pass down the addend and use the returned
17538         value.
17539         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
17540         Update declarations of local_section_offset and symbol_value.
17541         * testsuite/two_file_test_1.cc (t18): New function.
17542         * testsuite/two_file_test_2.cc (f18): New function.
17543         * testsuite/two_file_test_main.cc (main): Call t18.
17544         * testsuite/two_file_test.h (t18, f18): Declare.
17545
17546         * configure.ac: Don't test for objdump, c++filt, or readelf.
17547         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
17548         conditionals.
17549         (TEST_READELF): New variable.
17550         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
17551         (check_PROGRAMS): Add two_file_strip_test.
17552         (two_file_strip_test): New target.
17553         (check_PROGRAMS): Add two_file_same_shared_strip_test.
17554         (two_file_same_shared_strip_test_SOURCES): New variable.
17555         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
17556         (two_file_same_shared_strip_test_LDFLAGS): New variable.
17557         (two_file_same_shared_strip_test_LDADD): New variable.
17558         (two_file_shared_strip.so): New target.
17559         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
17560         (ver_test_5.syms, ver_test_7.syms): Likewise.
17561         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
17562         (strip_test_3.stdout): Use TEST_OBJDUMP.
17563         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17564
17565 2008-04-04  Cary Coutant  <ccoutant@google.com>
17566
17567         * symtab.h (Symbol::is_weak_undefined): New function.
17568         (Symbol::is_strong_undefined): New function.
17569         (Symbol::is_absolute): New function.
17570         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
17571         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
17572         absolute symbols.
17573         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
17574         (weak_undef_test): New target.
17575         * testsuite/Makefile.in: Rebuild.
17576         * testsuite/weak_undef_file1.cc: New file.
17577         * testsuite/weak_undef_file2.cc: New file.
17578         * testsuite/weak_undef_test.cc: New file.
17579
17580 2008-04-03  Craig Silverstein  <csilvers@google.com>
17581
17582         * compressed_output.h (class Output_compressed_section): Use
17583         unsigned buffer.
17584         * compressed_output.cc (zlib_compress): Use unsigned buffers,
17585         add zlib header.
17586         (zlib_compressed_suffix): Removed.
17587         (Output_compressed_section::set_final_data_size): Use unsigned
17588         buffers.
17589         * testsuite/Makefile.am (flagstest_compress_debug_sections):
17590         Fix linker invocation.
17591         (flagstest_o_specialfile_and_compress_debug_sections):
17592         Likewise.
17593         * testsuite/Makefile.in: Regenerated.
17594
17595 2008-04-02  David S. Miller  <davem@davemloft.net>
17596
17597         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
17598         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
17599
17600 2008-04-02  Craig Silverstein  <csilvers@google.com>
17601
17602         * TODO: New file.
17603
17604 2008-04-02  Ian Lance Taylor  <iant@google.com>
17605
17606         * fileread.cc (File_read::find_view): Add byteshift and vshifted
17607         parameters.  Update for new key type to views_.  Change all
17608         callers.
17609         (File_read::read): Adjust for byteshift in returned view.
17610         (File_read::add_view): New function, broken out of
17611         find_and_make_view.
17612         (File_read::make_view): New function, broken out of
17613         find_and_make_view.
17614         (File_read::find_or_make_view): Add offset and aligned
17615         parameters.  Rewrite accordingly.  Change all callers.
17616         (File_read::get_view): Add offset and aligned parameters.  Adjust
17617         for byteshift in return value.
17618         (File_read::get_lasting_view): Likewise.
17619         * fileread.h (class File_read): Update declarations.
17620         (class File_read::View): Add byteshift_ field.  Add byteshift to
17621         constructor.  Add byteshift method.
17622         * archive.h (Archive::clear_uncached_views): New function.
17623         (Archive::get_view): Add aligned parameter.  Change all callers.
17624         * object.h (Object::get_view): Add aligned parameter.  Change all
17625         callers.
17626         (Object::get_lasting_view): Likewise.
17627
17628         * fileread.cc (File_read::release): Don't call clear_views if
17629         there are multiple objects.
17630         * fileread.h (File_read::clear_uncached_views): New function.
17631         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
17632         on the archive.
17633
17634 2008-03-31  Cary Coutant  <ccoutant@google.com>
17635
17636         Add thin archive support.
17637         * archive.cc (Archive::armagt): New const.
17638         (Archive::setup): Remove task parameter and calls to unlock.
17639         (Archive::unlock_nested_archives): New function.
17640         (Archive::read_header): Add nested_off parameter. Change
17641         all callers.
17642         (Archive::interpret_header): Likewise.
17643         (Archive::include_all_members): Change to handle thin
17644         archives.
17645         (Archive::include_member): Likewise.
17646         * archive.h (Archive::Archive): Add new parameters and
17647         initializers.
17648         (Archive::armagt): New const.
17649         (Archive::setup): Remove task parameter.
17650         (Archive::unlock_nested_archives): New function.
17651         (Archive::read_header): Add nested_off parameter.
17652         (Archive::interpret_header): Likewise.
17653         (Archive::Nested_archive_table): New typedef.
17654         (Archive::is_thin_archive_): New field.
17655         (Archive::nested_archives_): New field.
17656         (Archive::options_): New field.
17657         (Archive::dirpath_): New field.
17658         (Archive::task_): New field.
17659         * readsyms.cc (Read_symbols::do_read_symbols): Add check
17660         for thin archives.  Pass additional parameters to
17661         Archive::Archive.  Unlock the archive file after calling
17662         Archive::setup.
17663
17664 2008-03-29  Ian Lance Taylor  <iant@google.com>
17665
17666         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
17667         version symbol to be local.
17668         * testsuite/ver_test_4.sh: New file.
17669         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
17670         (check_DATA): Add ver_test_4.syms.
17671         (ver_test_4.syms): New target.
17672         * testsuite/Makefile.in: Rebuild.
17673
17674         * output.cc
17675         (Output_section::Input_section_sort_entry::has_priority): New
17676         function.
17677         (Output_section::Input_section_sort_entry::match_file_name): New
17678         function.
17679         (Output_section::Input_section_sort_entry::match_section_name):
17680         Remove.
17681         (Output_section::Input_section_sort_entry::match_section_name_prefix):
17682         Remove.
17683         (Output_section::Input_section_sort_entry::match_section_file):
17684         Remove.
17685         (Output_section::Input_section_sort_compare::operator()): Rewrite
17686         using new Input_section_sort_entry functions.  Sort crtbegin and
17687         crtend first.  Sort sections with no priority before sections with
17688         a priority.
17689         * testsuite/initpri1.c (d3): Check j != 4.
17690         (cd5): New constructor/destructor function.
17691         (main): Check j != 2.
17692
17693         * symtab.cc (Symbol_table::add_from_object): If we don't use the
17694         new symbol when resolving, don't call set_is_default.
17695         * testsuite/ver_test_7.cc: New file.
17696         * testsuite/ver_test_7.sh: New file.
17697         * testsuite/Makefile.am (ver_test_7.so): New target.
17698         (ver_test_7.o): New target.
17699         (check_SCRIPTS): Add ver_test_7.sh.
17700         (check_DATA): Add ver_test_7.syms.
17701         (ver_test_7.syms): New target.
17702
17703 2008-03-28  Ian Lance Taylor  <iant@google.com>
17704
17705         * layout.cc (Layout::layout): If we see an input section with a
17706         name that needs sorting, set the must_sort flag for the output
17707         section.
17708         (Layout::make_output_section): If the name of the output section
17709         indicates that it might require sorting, set the may_sort flag.
17710         * output.h (Output_section::may_sort_attached_input_sections): New
17711         function.
17712         (Output_section::set_may_sort_attached_input_sections): New
17713         function.
17714         (Output_section::must_sort_attached_input_sections): New
17715         function.
17716         (Output_section::set_must_sort_attached_input_sections): New
17717         function.
17718         (class Output_section): Declare Input_section_sort_entry.  Define
17719         Input_section_sort_compare.  Declare
17720         sort_attached_input_sections.  Add new fields:
17721         may_sort_attached_input_sections_,
17722         must_sort_attached_input_sections_,
17723         attached_input_sections_are_sorted_.
17724         * output.cc (Output_section::Output_section): Initialize new
17725         fields.
17726         (Output_section::add_input_section): Add an entry to
17727         input_sections_ if may_sort or must_sort are true.
17728         (Output_section::set_final_data_size): Call
17729         sort_attached_input_sections if necessary.
17730         (Output_section::Input_section_sort_entry): Define new class.
17731         (Output_section::Input_section_sort_compare::operator()): New
17732         function.
17733         (Output_section::sort_attached_input_sections): New function.
17734         * configure.ac: Check whether the compiler supports constructor
17735         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
17736         * testsuite/initpri1.c: New file.
17737         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
17738         CONSTRUCTOR_PRIORITY.
17739         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
17740         (initpri1_LDFLAGS): New variable.
17741         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17742
17743 2008-03-27  Ian Lance Taylor  <iant@google.com>
17744
17745         * common.cc (Sort_commons::operator): Correct sorting algorithm.
17746         * testsuite/common_test_1.c: New file.
17747         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
17748         (common_test_1_SOURCES): New variable.
17749         (common_test_1_DEPENDENCIES): New variable.
17750         (common_test_1_LDFLAGS): New variable.
17751
17752         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
17753         and commons_ correctly when NAME/VERSION does not override
17754         NAME/NULL.
17755         * testsuite/ver_test_6.c: New file.
17756         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
17757         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
17758         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
17759
17760 2008-03-26  Ian Lance Taylor  <iant@google.com>
17761
17762         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
17763         of an undefined symbol from a version script.
17764         * testsuite/Makefile.am (ver_test_5.so): New target.
17765         (ver_test_5.o): New target.
17766         (check_SCRIPTS): Add ver_test_5.sh.
17767         (check_DATA): Add ver_test_5.syms.
17768         (ver_test_5.syms): New target.
17769         * testsuite/ver_test_5.cc: New file.
17770         * testsuite/ver_test_5.script: New file.
17771         * testsuite/ver_test_5.sh: New file.
17772         * Makefile.in, testsuite/Makefile.in: Rebuild.
17773
17774         PR gold/5986
17775         Fix problems building gold with gcc 4.3.0.
17776         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
17777         (gold_error_at_location, gold_warning_at_location): Use it.
17778         * configure.ac: Check whether we can compile and use a template
17779         function with a printf attribute.
17780         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
17781         when jumping over bytes.
17782         * object.cc: Instantiate Object::read_section_data.
17783         * debug.h: Include <cstring>
17784         * dwarf_reader.cc: Include <algorithm>
17785         * main.cc: Include <cstring>.
17786         * options.cc: Include <cstring>.
17787         * output.cc: Include <cstring>.
17788         * script.cc: Include <cstring>.
17789         * script.h: Include <string>.
17790         * symtab.cc: Include <cstring> and <algorithm>.
17791         * target-select.cc: Include <cstring>.
17792         * version.cc: Include <string>.
17793         * testsuite/testmain.cc: Include <cstdlib>.
17794         * configure, config.in: Rebuild.
17795
17796 2008-03-25  Ian Lance Taylor  <iant@google.com>
17797
17798         * options.cc: Include "../bfd/bfdver.h".
17799         (options::help): Print bug reporting address.
17800
17801         * version.cc (print_version): Adjust output for current value of
17802         BFD_VERSION_STRING.
17803
17804         * NEWS: New file.
17805
17806         * options.cc (options::help): Print list of supported targets.
17807         * target-select.h: Include <vector>.
17808         (class Target_selector): Make machine_, size_, and is_big_endian_
17809         fields const.  Add bfd_name_ and instantiated_target_ fields.
17810         (Target_selector::Target_selector): Add bfd_name parameter.
17811         (Target_selector::recognize): Make non-virtual, call
17812         do_recognize.
17813         (Target_selector::recognize_by_name): Make non-virtual, call
17814         do_recognize_by_name.
17815         (Target_selector::supported_names): New function.
17816         (Target_selector::bfd_name): New function.
17817         (Target_selector::do_instantiate_target): New pure virtual
17818         function.
17819         (Target_selector::do_recognize): New virtual function.
17820         (Target_selector::do_recognize_by_name): New virtual function.
17821         (Target_selector::instantiate_target): New private function.
17822         (supported_target_names): Declare.
17823         * target-select.cc (Target_selector::Target_selector): Update for
17824         new parameter and fields.
17825         (select_target_by_name): Check that the name matches before
17826         calling recognize_by_name.
17827         (supported_target_names): New function.
17828         * i386.cc (class Target_selector_i386): Update Target_selector
17829         constructor call.  Remove recognize and recognize_by_name.  Add
17830         do_instantiate_target.
17831         * x86_64.cc (class Target_selector_x86_64): Likewise.
17832         * testsuite/testfile.cc (class Target_selector_test): Update for
17833         changes to Target_selector.
17834
17835         * README: Rewrite, with some notes on unsupported features.
17836
17837 2008-03-24  Cary Coutant  <ccoutant@google.com>
17838
17839         * i386.cc (Target_i386::Got_type): New enum declaration.
17840         (Target_i386::Scan::local): Updated callers of Output_data_got
17841         member functions.
17842         (Target_i386::Scan::global): Likewise.
17843         (Target_i386::Relocate::relocate): Likewise.
17844         (Target_i386::Relocate::relocate_tls): Likewise.
17845         * object.h (Got_offset_list): New class.
17846         (Sized_relobj::local_has_got_offset): Added got_type parameter.
17847         (Sized_relobj::local_got_offset): Likewise.
17848         (Sized_relobj::set_local_got_offset): Likewise.
17849         (Sized_relobj::local_has_tls_got_offset): Removed.
17850         (Sized_relobj::local_tls_got_offset): Removed.
17851         (Sized_relobj::set_local_tls_got_offset): Removed.
17852         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
17853         * output.cc (Output_data_got::add_global): Added got_type parameter.
17854         (Output_data_got::add_global_with_rel): Likewise.
17855         (Output_data_got::add_global_with_rela): Likewise.
17856         (Output_data_got::add_global_pair_with_rel): New function.
17857         (Output_data_got::add_global_pair_with_rela): New function.
17858         (Output_data_got::add_local): Added got_type parameter.
17859         (Output_data_got::add_local_with_rel): Likewise.
17860         (Output_data_got::add_local_with_rela): Likewise.
17861         (Output_data_got::add_local_pair_with_rel): New function.
17862         (Output_data_got::add_local_pair_with_rela): New function.
17863         (Output_data_got::add_global_tls): Removed.
17864         (Output_data_got::add_global_tls_with_rel): Removed.
17865         (Output_data_got::add_global_tls_with_rela): Removed.
17866         (Output_data_got::add_local_tls): Removed.
17867         (Output_data_got::add_local_tls_with_rel): Removed.
17868         (Output_data_got::add_local_tls_with_rela): Removed.
17869         * output.h (Output_data_got::add_global): Added got_type parameter.
17870         (Output_data_got::add_global_with_rel): Likewise.
17871         (Output_data_got::add_global_with_rela): Likewise.
17872         (Output_data_got::add_global_pair_with_rel): New function.
17873         (Output_data_got::add_global_pair_with_rela): New function.
17874         (Output_data_got::add_local): Added got_type parameter.
17875         (Output_data_got::add_local_with_rel): Likewise.
17876         (Output_data_got::add_local_with_rela): Likewise.
17877         (Output_data_got::add_local_pair_with_rel): New function.
17878         (Output_data_got::add_local_pair_with_rela): New function.
17879         (Output_data_got::add_global_tls): Removed.
17880         (Output_data_got::add_global_tls_with_rel): Removed.
17881         (Output_data_got::add_global_tls_with_rela): Removed.
17882         (Output_data_got::add_local_tls): Removed.
17883         (Output_data_got::add_local_tls_with_rel): Removed.
17884         (Output_data_got::add_local_tls_with_rela): Removed.
17885         * resolve.cc (Symbol::override_base_with_special): Removed
17886         reference to has_got_offset_ field.
17887         * symtab.cc (Symbol::init_fields): Replaced initialization
17888         of got_offset_ with got_offsets_.  Removed initialization
17889         of has_got_offset_
17890         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
17891         (Symbol::got_offset): Likewise.
17892         (Symbol::set_got_offset): Likewise.
17893         (Symbol::has_tls_got_offset): Removed.
17894         (Symbol::tls_got_offset): Removed.
17895         (Symbol::set_tls_got_offset): Removed.
17896         (Symbol::got_offset_): Removed.
17897         (Symbol::tls_mod_got_offset_): Removed.
17898         (Symbol::tls_pair_got_offset_): Removed.
17899         (Symbol::got_offsets_): New field.
17900         (Symbol::has_got_offset): Removed.
17901         (Symbol::has_tls_mod_got_offset): Removed.
17902         (Symbol::has_tls_pair_got_offset): Removed.
17903         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
17904         (Target_x86_64::Scan::local): Updated callers of Output_data_got
17905         member functions.
17906         (Target_x86_64::Scan::global): Likewise.
17907         (Target_x86_64::Relocate::relocate): Likewise.
17908         (Target_x86_64::Relocate::relocate_tls): Likewise.
17909
17910 2008-03-25  Ben Elliston  <bje@au.ibm.com>
17911
17912         * yyscript.y: Fix spelling error in comment.
17913
17914 2008-03-24  Ian Lance Taylor  <iant@google.com>
17915
17916         * options.h (class General_options): Define build_id option.
17917         * layout.h (class Layout): Declare write_build_id, create_note,
17918         create_build_id.  Add build_id_note_ member.
17919         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
17920         "libiberty.h", "md5.h", "sha1.h".
17921         (Layout::Layout): Initialize eh_frame_data_,
17922         eh_frame_hdr_section_, and build_id_note_.
17923         (Layout::finalize): Call create_build_id.
17924         (Layout::create_note): New function, broken out of
17925         Layout::create_gold_note.
17926         (Layout::create_gold_note): Call create_note.
17927         (Layout::create_build_id): New function.
17928         (Layout::write_build_id): New function.
17929         (Close_task_runner::run): Call write_build_id.
17930
17931         * x86_64.cc: Correct license to GPLv3.
17932
17933 2008-03-23  Ian Lance Taylor  <iant@google.com>
17934
17935         * options.cc: Include "demangle.h".
17936         (parse_optional_string): New function.
17937         (parse_long_option): Handle takes_optional_argument.
17938         (parse_short_option): Update dash_z initializer.  Handle
17939         takes_optional_argument.
17940         (General_options::General_options): Initialize do_demangle_.
17941         (General_options::finalize): Set do_demangle_.  Handle demangling
17942         style.
17943         * options.h (parse_optional_string): Declare.
17944         (struct One_option): Add optional_arg field.  Update constructor.
17945         Update call constructor calls.  Add takes_optional_argument
17946         function.
17947         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
17948         (DEFINE_optional_string): Define.
17949         (General_options::demangle): Change from DEFINE_bool to
17950         DEFINE_optional_string.
17951         (General_options::no_demangle): New function.
17952         (General_options::do_demangle): New function.
17953         (General_options::set_do_demangle): New function.
17954         (General_options::execstack_status_): Move definition to end of
17955         class definition.
17956         (General_options::static_): Likewise.
17957         (General_options::do_demangle_): New field.
17958         * object.cc (big_endian>::get_symbol_location_info): Call
17959         Options::do_demangle, not Options::demangle.
17960         * symtab.cc (demangle): Likewise.
17961
17962 2008-03-22  Ian Lance Taylor  <iant@google.com>
17963
17964         * gold.h: Include <cstddef> and <sys/types.h>
17965         * options.h: Include <cstring>.
17966
17967 2008-03-21  Ian Lance Taylor  <iant@google.com>
17968
17969         * Added source code to GNU binutils.
17970 \f
17971 Copyright (C) 2008-2015 Free Software Foundation, Inc.
17972
17973 Copying and distribution of this file, with or without modification,
17974 are permitted in any medium without royalty provided the copyright
17975 notice and this notice are preserved.
17976
17977 Local Variables:
17978 mode: change-log
17979 left-margin: 8
17980 fill-column: 74
17981 version-control: never
17982 End: