[GOLD] Align PowerPC64 GOT
[external/binutils.git] / gold / ChangeLog
1 2015-11-25  Alan Modra  <amodra@gmail.com>
2
3         * powerpc.cc (Output_data_got_powerpc::Output_data_got_powerpc): Align
4         to 256 byte boundary.
5
6 2015-11-19  Alan Modra  <amodra@gmail.com>
7
8         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): Correct
9         GOT16 and TOC16 relocs to RELATIVE_REF.
10
11 2015-11-14  Cary Coutant  <ccoutant@gmail.com>
12
13         PR gold/19244
14         PR gold/18548
15         * symtab.cc (Symbol_table::do_define_in_output_data): Check for forced
16         local symbols only for predefined symbols.
17
18 2015-11-11  Alan Modra  <amodra@gmail.com>
19             Peter Bergner <bergner@vnet.ibm.com>
20
21         * gold/powerpc.cc (Powerpc_relocate_functions::addr16_dq): New function.
22         (Powerpc_relocate_functions::addr16dx_ha): Likewise.
23         (Target_powerpc::Scan::local): Handle R_POWERPC_REL16DX_HA.
24         (Target_powerpc::Scan::global): Likewise.
25         (Target_powerpc::Relocate::relocate): Likewise.
26
27 2015-11-09  Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
28
29         * layout.h (Layout::is_debug_info_section): Recognize .pdr debug
30         sections.
31
32 2015-11-09  Cary Coutant  <ccoutant@gmail.com>
33             Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
34
35         * copy-relocs.h (Copy_relocs::copy_reloc): Replace reloc parameter
36         with type, offset, addend.
37         (Copy_relocs::save): Likewise.
38         * copy-relocs.cc (Copy_relocs::copy_reloc): Likewise.
39         (Copy_relocs::save): Likewise.
40         * aarch64.cc (Target_aarch64::copy_reloc): Pass r_type, r_offset,
41         and r_addend to Copy_relocs::copy_reloc.
42         * arm.cc (Target_arm::copy_reloc): Likewise.
43         * i386.cc (Target_i386::copy_reloc): Likewise.
44         * mips.cc (Target_mips::copy_reloc): Likewise.
45         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
46         * s390.cc (Target_s390::copy_reloc): Likewise.
47         * sparc.cc (Target_sparc::copy_reloc): Likewise.
48         * tilegx.cc (Target_tilegx::copy_reloc): Likewise.
49         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
50
51 2015-11-05  Cary Coutant  <ccoutant@gmail.com>
52
53         PR gold/19119
54         PR gold/19172
55         PR gold/19197
56         Revert commit 6457197210144f50a696097c0d308d81d46d5510:
57         2015-10-16  H.J. Lu  <hongjiu.lu@intel.com>
58                 * options.h (General_options): Remove "obsolete" from -m.
59                 * parameters.cc (set_parameters_target): Check if input target
60                 is compatible with output emulation set by "-m emulation".
61
62 2015-11-05  Cary Coutant  <ccoutant@gmail.com>
63
64         PR gold/19163
65         * aarch64.cc (Target_aarch64::Relocate::relocate): Don't apply
66         certain relocations if --no-apply-dynamic-relocs is set.
67         * options.h (--apply-dynamic-relocs): New aarch64-specific option.
68
69 2015-11-03  Alan Modra  <amodra@gmail.com>
70
71         * po/POTFILES.in: Regenerate.
72
73 2015-10-30  Nick Clifton  <nickc@redhat.com>
74
75         * po/zh_CN.po: New (simplified) Chinese translation.
76
77 2015-10-29  H.J. Lu  <hongjiu.lu@intel.com>
78
79         PR gold/19184
80         * incremental.cc (Got_plt_view_info): Add got_entry_size.
81         (Local_got_offset_visitor::visit): Replace got_entry_size_
82         with info_.got_entry_size.
83         (Local_got_offset_visitor::got_entry_size_): Removed.
84         (Global_got_offset_visitor::visit): Replace got_entry_size_
85         with info_.got_entry_size.
86         (Global_got_offset_visitor::got_entry_size_): Removed.
87         (Output_section_incremental_inputs::write_got_plt): Initialize
88         view_info.got_entry_size.
89         * target.h (Sized_target::got_entry_size): New virtual function.
90         * x86_64.cc (Target_x86_64::got_entry_size): New function.
91
92 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
93
94         * testsuite/binary_test.cc: Add __attribute__((aligned(1))).
95         * testsuite/script_test_12a.c: Likewise.
96         * testsuite/script_test_1a.cc: Likewise.
97         * testsuite/script_test_2.cc: Likewise.
98
99 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
100
101         * testsuite/debug_msg.sh: Accept more fuzz in line numbers.
102
103 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
104
105         PR gold/18959
106         * stringpool.cc (Stringpool_template::new_key_offset): Align all
107         strings, even zero-length.
108         (Stringpool_template::set_string_offsets): Likewise.
109
110 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
111
112         * s390.cc: New file.
113         * Makefile.am (TARGETSOURCES): Add s390.cc.
114         (ALL_TARGETOBJS): Add s390.o.
115         * Makefile.in: Regenerate.
116         * configure.ac: Add s390 support.
117         * configure: Regenerate.
118         * configure.tgt: Add s390-*-* and s390x-*-*.
119         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Add s390
120         support.
121
122 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
123
124         * archive.cc (Archive::sym64name): New const.
125         (Archive::setup): Add support for SYM64 armap.
126         (Archive::read_armap): Likewise.
127         (Archive::interpret_header): Likewise.
128         (Archive::const_iterator::read_next_header): Likewise.
129         * archive.h (Archive::sym64name): New const.
130         (Archive::read_armap): Add mapsize template parameter.
131
132 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
133
134         * dynobj.cc (Dynobj::create_elf_hash_table): Create hash table with
135         target-specific entry size.
136         (Dynobj::sized_create_elf_hash_table): Add size template parameter.
137         * dynobj.h (Dynobj::sized_create_elf_hash_table): Likewise.
138         * layout.cc (Layout::create_dynamic_symtab): Set entsize to
139         hash_entry_size.
140         * target.h (Target::hash_entry_size): New method.
141         (Target::Target_info::hash_entry_size): New data member.
142
143         * aarch64.cc (Target_aarch64::aarch64_info): Add hash_entry_size.
144         * arm.cc (Target_arm::arm_info): Likewise.
145         (Target_arm_nacl::arm_nacl_info): Likewise.
146         * i386.cc (Target_i386::i386_info): Likewise.
147         (Target_i386_nacl::i386_nacl_info): Likewise.
148         (Target_iamcu::iamcu_info): Likewise.
149         * mips.cc (Target_mips::mips_info): Likewise.
150         (Target_mips_nacl::mips_nacl_info): Likewise.
151         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
152         * sparc.cc (Target_sparc::sparc_info): Likewise.
153         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
154         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
155         (Target_x86_64_nacl::x86_64_nacl_info): Likewise.
156         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
157
158 2015-10-28  H.J. Lu  <hongjiu.lu@intel.com>
159
160         PR gold/19177
161         * i386.cc (Target_i386::Relocate::relocate): Check R_386_GOT32
162         and R_386_GOT32X relocations without base register.
163
164 2015-10.27  Han Shen  <shenhan@google.com>
165
166         PR gold/19042 - unsupported reloc 311/312.
167
168         * aarch64.cc (Target_aarch64::Scan::local): Add support for
169         reloc 311/312.
170
171 2015-10-22  H.J. Lu  <hongjiu.lu@intel.com>
172
173         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
174         Treat R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX the same
175         as R_X86_64_GOTPCREL.
176         (Target_x86_64<size>::Scan::local): Likewise.
177         (Target_x86_64<size>::Scan::possible_function_pointer_reloc):
178         Likewise.
179         (Target_x86_64<size>::Scan::global): Likewise.
180         (Target_x86_64<size>::Relocate::relocate): Likewise.
181         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
182         Likewise.
183
184 2015-10-22  H.J. Lu  <hongjiu.lu@intel.com>
185
186         * i386.cc (Target_i386::Scan::get_reference_flags(): Treat
187         R_386_GOT32X the same as R_386_GOT32.
188         (Target_i386::Scan::local): Likewise.
189         (Target_i386::Scan::possible_function_pointer_reloc): Likewise.
190         (Target_i386::Scan::global): Likewise.
191         (Target_i386::Relocate::relocate): Likewise.
192         (Target_i386::Relocatable_size_for_reloc::get_size_for_reloc):
193         Likewise.
194
195 2015-10-20  H.J. Lu  <hongjiu.lu@intel.com>
196
197         * testsuite/Makefile.am (x86_64_mov_to_lea11): Replace
198         x86_64_mov_to_lea1.o with x86_64_mov_to_lea2.o.
199         (x86_64_mov_to_lea12): Replace x86_64_mov_to_lea2.o with
200         x86_64_mov_to_lea1.o.
201         * testsuite/Makefile.in: Regenerated.
202
203 2015-10-16  H.J. Lu  <hongjiu.lu@intel.com>
204
205         PR gold/19119
206         * options.h (General_options): Remove "obsolete" from -m.
207         * parameters.cc (set_parameters_target): Check if input target
208         is compatible with output emulation set by "-m emulation".
209
210 2015-10-13  H.J. Lu  <hongjiu.lu@intel.com>
211
212         PR gold/19118
213         * i386.cc (Target_iamcu): New class.
214         (Target_selector_iamcu): Likewise.
215         (Target_iamcu::iamcu_info): New variable.
216         (target_selector_iamcu): Likewise.
217
218 2015-10-07  Andreas Schwab  <schwab@suse.de>
219
220         * aarch64.cc (aarch64_info): Set abi_pagesize to 64K.
221
222 2015-10-06  Cary Coutant  <ccoutant@gmail.com>
223
224         PR gold/18855
225         * sparc.cc (Sparc_relocate_functions::gdop_hix22): Remove addend
226         parameter.
227         (Sparc_relocate_functions::gdop_lox10): Likewise.
228         (Target_sparc::Relocate::relocate): Use addend when computing
229         symbol value for R_SPARC_GOTDATA_OP*.
230
231 2015-09-07  Cary Coutant  <ccoutant@gmail.com>
232
233         PR gold/18930
234         PR gold/18886
235         * resolve.cc (Symbol::override_base): Don't convert IFUNC symbols here.
236         * symtab.cc (Symbol_table::add_from_dynobj): Convert them here instead.
237
238 2015-09-02  H.J. Lu  <hongjiu.lu@intel.com>
239
240         PR gold/18886
241         * resolve.cc (Symbol::override_base): Turn IFUNC symbols from
242         shared libraries into normal FUNC symbols.
243         * symtab.cc (Symbol_table::sized_write_symbol): Assert IFUNC
244         symbols aren't from shared libraries.
245
246 2015-09-02  Alan Modra  <amodra@gmail.com>
247
248         PR 18878
249         * powerpc.cc (Target_powerpc): Add savres_section_ and accessor.
250         (Target_powerpc::Branch_info::make_stub): Determine whether long
251         branch stub is for save/restore function.
252         (Branch_stub_ent): Add save_res_, and extra parm to constructor.
253         (Stub_table): Add need_save_res_.
254         (Stub_table:clear_stubs): Clear need_save_res_.
255         (Stub_table:set_address_and_size): Add save/restore section size.
256         (Stub_table::add_long_branch_entry): Add save_res param.  Set
257         need_save_res_, but don't add space for save/restore stubs.
258         (Stub_table::find_long_branch_entry): Return offset to local copy
259         of save/restore func.
260         (Stub_table::do_write): Don't output save/restore stubs.  Instead
261         copy the save/restore functions.
262         (Output_data_save_res:contents): New accessor.
263         (Target_powerpc::define_save_restore_funcs): Set savres_section_.
264
265 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
266
267         PR gold/18847
268         * script-sections.cc (Memory_region::set_address): New method.
269         (Script_sections::find_memory_region): Add explicit_only parameter.
270         (Output_section_definition::set_section_addresses): Handle case where
271         script specifies both address and vma region.
272         * script-sections.h (Script_sections::find_memory_region): Add
273         explicit_only parameter.
274
275 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
276
277         PR gold/18859
278         * object.cc (Input_objects::add_object): Store objects in a map,
279         indexed by soname; update as-needed flag when necessary.
280         * object.h (Object::clear_as_needed): New method.
281         (Input_objects::so_names_): Change from set to map.
282
283 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
284
285         PR gold/14746
286         * expression.cc (Expression::Expression_eval_info): Add
287         is_valid_pointer field.
288         (Expression::eval_maybe_dot): Add is_valid_pointer parameter.
289         Adjust all callers.
290         (Addr_expression::value_from_output_section): Check whether address
291         is valid.
292         * script.cc (Symbol_assignment::set_if_absolute): Defer assignment
293         if evaluation failed due to address that is not yet valid.
294         * script.h: (Expression::eval_maybe_dot): Add is_valid_pointer
295         parameter.
296
297 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
298
299         PR gold/18866
300         PR gold/18703
301         * symtab.cc (Symbol_table): Reorder conditions to avoid internal error.
302
303 2015-08-20  Alan Modra  <amodra@gmail.com>
304
305         PR gold/18846
306         * target-reloc.h (relocate_relocs <RELOC_ADJUST_FOR_SECTION_RELA>):
307         Subtract os->address() from addend.
308         * powerpc.cc (relocate_relocs): Likewise.
309
310 2015-08-12  Simon Dardis  <simon.dardis@imgtec.com>
311
312         * mips.cc (plt0_entry_o32, plt0_entry_n32, plt0_entry_n64,
313         lazy_stub_normal_1, lazy_stub_normal_1_n64,
314         lazy_stub_normal_2, lazy_stub_normal_2_n64, lazy_stub_big,
315         lazy_stub_big_n64, lazy_stub_micromips32_normal_1_n64,
316         lazy_stub_micromips32_normal_2_n64, lazy_stub_micromips32_big,
317         lazy_stub_micromips32_big_n64): Update to use 'or' for move instead
318         of 'addu/daddu'.
319
320 2015-07-27  H.J. Lu  <hongjiu.lu@intel.com>
321
322         * configure: Regenerated.
323
324 2015-07-26  Doug Kwan  <dougkwan@google.com>
325
326         * testsuite/arm_unaligned_reloc.{s,sh}: Make test less sensitive to
327           disassembler output format.
328
329 2015-07-23  Ian Coolidge  <icoolidge@google.com>
330         Plumb --pic-veneer option for gold.
331
332         * arm.cc (Reloc_stub::stub_type_for_reloc): Plumb to stub
333         generation.
334         * options.h (General_options): Add --pic-veneer option.
335
336 2015-07-22  H.J. Lu  <hongjiu.lu@intel.com>
337
338         PR gold/18663
339         * testsuite/Makefile.am (script_test_1_SOURCES): Set to
340         script_test_1a.cc script_test_1b.cc.
341         (script_test_11_r.o): Replace script_test_11.o with
342         script_test_11a.o script_test_11b.o.
343         (script_test_11.o): Removed.
344         (script_test_11a.o): New.
345         (script_test_11b.o): Likewise.
346         * testsuite/Makefile.in: Regenerated.
347         * testsuite/script_test_1.h: New file.
348         * testsuite/script_test_1b.cc: Likewise.
349         * testsuite/script_test_11.h: Likewise.
350         * testsuite/script_test_11b.c: Likewise.
351         * testsuite/script_test_1.cc: Renamed to ...
352         * testsuite/script_test_1a.cc: This.
353         Include "script_test_1.h".
354         (main): Call check_int and check_ptr.
355         * testsuite/script_test_11.c: Renamed to ...
356         * testsuite/script_test_11a.c: This.
357         Include "script_test_11.h".
358         (main): Call ptr_equal.
359
360 2015-07-22  H.J. Lu  <hongjiu.lu@intel.com>
361
362         PR gold/18628
363         * testsuite/ifuncdep2.c (global): Change protected to hidden.
364         * testsuite/ifuncmod1.c (global): Likewise.
365         * testsuite/ifuncmod5.c (global): Likewise.
366
367 2015-07-22  Alan Modra  <amodra@gmail.com>
368
369         * aarch64.cc (try_fix_erratum_843419_optimized): Warning fix.
370
371 2015-07-21  Cary Coutant  <ccoutant@gmail.com>
372
373         PR gold/18548
374         * symtab.cc (Symbol_table::do_define_in_output_data): Check for
375         forced local symbol even when oldsym != NULL.
376         (Symbol_table::do_define_in_output_segment): Likewise.
377         (Symbol_table::do_define_as_constant): Likewise.
378
379 2015-07-21  Cary Coutant  <ccoutant@gmail.com>
380
381         PR gold/18698
382         * archive.cc (Library_base::should_include_member): Don't use entry
383         point for relocatable links, or if target is not yet valid.
384         * parameters.cc (Parameters::entry): Check target_valid().
385
386 2015-07-20  Han Shen  <shenhan@google.com>
387
388         Optimize erratum 843419 fix.
389
390         * aarch64.cc (AArch64_insn_utilities::is_adr): New method.
391         (AArch64_insn_utilities::aarch64_adr_encode_imm): New method.
392         (AArch64_insn_utilities::aarch64_adrp_decode_imm): New method.
393         (E843419_stub): New sub-class of Erratum_stub.
394         (AArch64_relobj::try_fix_erratum_843419_optimized): New method.
395         (AArch64_relobj::section_needs_reloc_stub_scanning): Try optimized fix.
396         (AArch64_relobj::create_erratum_stub): Add 1 argument.
397         (Target_aarch64::scan_erratum_843419_span): Pass in adrp insn offset.
398
399 2015-07-20  Han Shen  <shenhan@google.com>
400
401         Fix arm elf header flags wrt hardfp bit.
402
403         * arm.cc (Target_arm::do_adjust_elf_header): Set flags into view.
404
405 2015-07-20  H.J. Lu  <hongjiu.lu@intel.com>
406
407         PR gold/18689
408         * layout.cc (Layout::layout): Clear the SHF_COMPRESSED flag bit
409         from input group section for relocatable link.
410         * testsuite/Makefile.am (check_SCRIPTS): Add pr18689.sh.
411         (check_DATA): Add pr18689.stdout.
412         (MOSTLYCLEANFILES): Add pr18689a.o pr18689b.o.
413         (pr18689.stdout): New rule.
414         (pr18689a.o): Likewise.
415         (pr18689b.o): Likewise.
416         (pr18689.o): Likewise.
417         * testsuite/pr18689.c: New file.
418         * testsuite/pr18689.sh: Likewise.
419         * testsuite/Makefile.in: Regenerated.
420
421 2015-07-20  Yiran Wang  <yiran@google.com>
422         Cary Coutant  <ccoutant@gmail.com>
423
424         PR gold/15574
425         * resolve.cc (Symbol_table): Remove warning about references
426         from shared objects to hidden symbols.
427         * testsuite/Makefile.am (hidden_test): Add hidden_test.syms.
428         * testsuite/Makefile.in: Regenerate.
429         * testsuite/hidden_test.sh: Check dynamic symbol table; update
430         expected error messages.
431
432 2015-07-14  H.J. Lu  <hongjiu.lu@intel.com>
433
434         * compressed_output.cc (Output_compressed_section::set_final_data_size):
435         Make --compress-debug-sections=zlib the same as
436         --compress-debug-sections=zlib-gabi.
437         * testsuite/Makefile.am (flagstest_compress_debug_sections.check):
438         Expect ".debug_.*" with the SHF_COMPRESSED bit, instead of
439         ".zdebug_".
440         * testsuite/Makefile.in: Regenerated.
441
442 2015-07-12  H.J. Lu  <hongjiu.lu@intel.com>
443
444         PR gold/18322
445         * compressed_output.cc (zlib_compress): Add argument for
446         compression header size.  Set header size to compression header
447         size if it isn't 0.  Don't write out the zlib header here.
448         (Output_compressed_section::set_final_data_size): Support
449         zlib-gnu and zlib-gabi compressions.  Pass compression header
450         size to zlib_compress and write out compression header.  Set
451         the SHF_COMPRESSED bit for zlib-gabi compression.  Otherwise
452         clear the SHF_COMPRESSED bit
453         * options.h (compress_debug_sections): Add zlib-gnu and
454         zlib-gabi.
455         * output.h (Output_section::set_flags): New.
456         * testsuite/Makefile.am (check_PROGRAMS): Add
457         flagstest_compress_debug_sections_none,
458         flagstest_compress_debug_sections_gnu and
459         flagstest_compress_debug_sections_gabi.
460         (check_DATA): Add flagstest_compress_debug_sections_none.stdout.
461         flagstest_compress_debug_sections.stdout,
462         flagstest_compress_debug_sections.cmp,
463         flagstest_compress_debug_sections.check,
464         flagstest_compress_debug_sections_gnu.stdout,
465         flagstest_compress_debug_sections_gnu.cmp,
466         flagstest_compress_debug_sections_gnu.check,
467         flagstest_compress_debug_sections_gabi.stdout,
468         flagstest_compress_debug_sections_gabi.cmp and
469         flagstest_compress_debug_sections_gabi.check.
470         (flagstest_compress_debug_sections_none): New.
471         (flagstest_compress_debug_sections_none.stdout): Likewise.
472         (flagstest_compress_debug_sections.stdout): Likewise.
473         (flagstest_compress_debug_sections.check): Likewise.
474         (flagstest_compress_debug_sections.cmp): Likewise.
475         (flagstest_compress_debug_sections_gnu): Likewise.
476         (flagstest_compress_debug_sections_gnu.stdout): Likewise.
477         (flagstest_compress_debug_sections_gnu.check): Likewise.
478         (flagstest_compress_debug_sections_gnu.cmp): Likewise.
479         (flagstest_compress_debug_sections_gabi): Likewise.
480         (flagstest_compress_debug_sections_gabi.stdout): Likewise.
481         (flagstest_compress_debug_sections_gnu.check): Likewise.
482         (flagstest_compress_debug_sections_gnu.cmp): Likewise.
483         * testsuite/Makefile.in: Regenerated.
484
485 2015-07-12  H.J. Lu  <hongjiu.lu@intel.com>
486
487         PR gold/18321
488         * compressed_output.h (decompress_input_section): Add arguments
489         for ELF class, big endian and sh_flags.
490         * compressed_output.cc (decompress_input_section): Likewise.
491         Support the SHF_COMPRESSED section.
492         * dynobj.h (Dynobj): Add elfsize and is_big_endian member
493         functions.
494         * plugin.h (Pluginobj): Likewise.
495         * layout.cc (Layout::get_output_section_flags): Also clear the
496         SHF_COMPRESSED bit.
497         * object.h (Compressed_section_info): Add flag to store sh_flags.
498         (Object): Add pure virtual elfsize and is_big_endian member
499         functions.
500         * object.cc (need_decompressed_section): Don't skip the ".zdebug"
501         prefix here.
502         (build_compressed_section_map): Check SHF_COMPRESSED for
503         uncompressed size.  Store sh_flags in Compressed_section_info.
504         Pass size, big_endian and sh_flags to decompress_input_section.
505         Skip the ".debug"/".zdebug" prefix when passing section name to
506         need_decompressed_section.
507         (Sized_relobj_file<size, big_endian>::do_find_special_section):
508         Don't check ".zdebug_*" sections.
509         (Object::decompressed_section_contents): Pass ELF class, big
510         endian and sh_flags to decompress_input_section.
511         * reloc.cc (Sized_relobj_file<size, big_endian>::write_sections):
512         Likewise.
513         * testsuite/Makefile.am (check_DATA): Add
514         debug_msg_cdebug_gabi.err and gdb_index_test_2_gabi.stdout.
515         (MOSTLYCLEANFILES): Add debug_msg_cdebug_gabi.err and
516         gdb_index_test_2_gabi.stdout.
517         (debug_msg_cdebug_gabi.o): New.
518         (odr_violation1_cdebug_gabi.o): Likewise.
519         (odr_violation2_cdebug_gabi.o): Likewise.
520         (debug_msg_cdebug_gabi.err): Likewise.
521         (check_SCRIPTS): Add gdb_index_test_2_gabi.sh.
522         (gdb_index_test_cdebug_gabi.o): Likewise.
523         (gdb_index_test_2_gabi): Likewise.
524         (gdb_index_test_2_gabi.stdout): Likewise.
525         * testsuite/gdb_index_test_2_gabi.sh: New file.
526         * testsuite/Makefile.in: Regenerated.
527
528 2015-07-09  Han Shen  <shenhan@google.com>
529
530         Use "gold_info" instead of "gold_warning" for erratum fix.
531
532         * aarch64.cc (Target_aarch64::scan_erratum_843419_span): Use
533         'gold_info'.
534         (Target_aarch64::scan_erratum_835769_span): USe 'gold_info'.
535
536 2015-07-09  Han Shen  <shenhan@google.com>
537
538         Drop missing symbol warning for arm/aarch64.
539
540         * aarch64.cc (AArch64_relobj::scan_errata): Drop missing symbol warning.
541         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Drop missing
542         symbol warning.
543
544 2015-07-07  Han Shen  <shenhan@google.com>
545
546         Make gold aarch64 accept long form of mapping symbols.
547
548         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Make legal
549         of mapping symbols.
550
551 2015-06-29  Doug Kwan  <dougkwan@google.com>
552
553         * testsuite/arm_bl_out_of_range.s: Align stub table so that it appears
554           at address expected by test.
555         * testsuite/arm_cortex_a8_b.s: Ditto.
556         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
557         * testsuite/arm_cortex_a8_bl.s: Ditto.
558         * testsuite/arm_cortex_a8_blx.s: Ditto.
559         * testsuite/arm_cortex_a8_local.s: Ditto.
560         * testsuite/arm_fix_v4bx.s: Ditto.
561         * testsuite/arm_unaligned_reloc.s: Ditto.
562         * testsuite/thumb_bl_out_of_range.s: Ditto.
563         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
564         * testsuite/thumb_blx_out_of_range.s: Ditto.
565
566 2015-06-29  Han Shen  <shenhan@google.com>
567
568         Patch for erratum 843419 internal error.
569
570         * aarch64.cc (Erratum_stub::Insn_utilities): New typedef.
571         (Erratum_stub::update_erratum_insn): New method.
572         (Stub_table::relocate_stubs): Modified to place relocated insn.
573         (AArch64_relobj::fix_errata): Modified gold_assert.
574
575 2015-06-12  Han Shen  <shenhan@google.com>
576
577         Fix erratum 835769.
578
579         * aarch64.cc (AArch64_insn_utilities::BYTES_PER_INSN): Move
580         defintion outside class definition.
581         (AArch64_insn_utilities::AARCH64_ZR): New static constant.
582         (AArch64_insn_utilities::aarch64_op31): New member.
583         (AArch64_insn_utilities::aarch64_ra): New member.
584         (AArch64_insn_utilities::aarch64_mac): New member.
585         (AArch64_insn_utilities::aarch64_mlxl): New member.
586         (ST_E_835769): New global enum member.
587         (Stub_table::relocate_stubs): Add 835769 handler.
588         (Stub_template_repertoire::Stub_template_repertoire): Install new
589         stub type.
590         (AArch64_relobj::scan_errata): This func is renamed from
591         scan_erratum_843419.
592         (AArch64_relobj::do_count_local_symbols): Add 835769 handler.
593         (AArch64_relobj::do_relocate_sections): Add 835769 handler.
594         (AArch64_relobj::scan_sections_for_stubs): Add 835769 handler.
595         (Target_aarch64::scan_erratum_835769_span): New method.
596         (Target_aarch64::create_erratum_stub): New method.
597         (Target_aarch64::is_erratum_835769_sequence): New method.
598         (Target_aarch64::scan_erratum_843419_sequence): Move part of the
599         code into create_erratum_stub.
600         * options.h (fix_cortex_a53_835769): New option.
601
602 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
603
604         * aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
605         outside class body.
606         (Reloc_stub::STUB_ADDR_ALIGN): Likewise.
607
608 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
609
610         PR gold/17731
611         * layout.cc (corresponding_uncompressed_section_name): New function.
612         (Layout::choose_output_section): Call it.
613         * layout.h (corresponding_uncompressed_section_name): New function.
614         * script-sections.cc (Input_section_info::set_section_name): Check
615         for compressed debug section (.zdebug style).
616
617 2015-06-11  Jing Yu  <jingyu@google.com>
618
619         * testsuite/Makefile.am: Add -O0 for script_test_12 test.
620         * testsuite/Makefile.in: Regenerate.
621
622 2015-06-11  Davide Italiano  <dccitaliano@gmail.com>
623
624         * gold.h (is_cident): Correct typo.
625
626 2015-06-10  Han Shen  <shenhan@google.com>
627         Patch for erratum-843419 (2 of 2 - fix erratum occurrences).
628
629         Now fixing for 843419 is fully functional.
630
631         The first part of the erratum fix CL is here -
632         https://sourceware.org/ml/binutils/2015-04/msg00229.html
633
634         * aarch64.cc(global enum): New constants representing stub types.
635         (Stub_template): New POD struct.
636         (Stub_template_repertoire): New class.
637         (Stub_base): New class.
638         (Erratum_stub): New class.
639         (Reloc_stub): Refactored to be a subclass of Stub_base.
640         (Reloc_stub::Stub_type): Removed.
641         (Reloc_stub::offset): Moved to Stub_base.
642         (Reloc_stub::set_offset): Moved to Stub_base.
643         (Reloc_stub::destination_address): Moved to Stub_base.
644         (Reloc_stub::set_destination_address): Moved to Stub_base.
645         (Reloc_stub::reset_destination_address): Moved to Stub_base.
646         (Reloc_stub::stub_type): Renamed and moved to Stub_base.
647         (Reloc_stub::stub_size): Renamed and moved to Stub_base.
648         (Reloc_stub::stub_insns): Renamed and moved to Stub_base.
649         (Reloc_stub::write): Moved to Stub_base.
650         (Reloc_stub::invalid_offset): Moved to Stub_base.
651         (Reloc_stub::invalid_address): Moved to Stub_base.
652         (Reloc_stub::stub_type_): Renamed and moved to Stub_base.
653         (Reloc_stub::stub_insns_): Moved to Stub_base.
654         (Reloc_stub::offset_): Moved to Stub_base.
655         (Reloc_stub::destination_address_): Moved to Stub_base.
656         (Stub_table::The_aarch64_relobj): New typedef.
657         (Stub_table::The_erratum_stub): New typedef.
658         (Stub_table::The_erratum_stub_less): New typedef.
659         (Stub_table::The_erratum_stub_set): New typedef.
660         (Stub_table::The_erratum_stub_set_iter): New typedef.
661         (Stub_table::empty): Added emptiness testing for erratum stubs.
662         (Stub_table::add_erratum_stub): New method to add an erratum stub.
663         (Stub_table::find_erratum_stub): New method.
664         (Stub_table::find_erratum_stubs_for_input_section): New method.
665         (Stub_table::erratum_stub_address): New method.
666         (Stub_table::update_date_size_changed_p): Modified to handle erratum stubs.
667         (Stub_table::do_addralign): Modified to handle erratum stubs.
668         (Stub_table::erratum_stubs_): New member.
669         (Stub_table::erratum_stub_size_): New member.
670         (Stub_table::relocate_stubs): Modified to handle erratum stubs.
671         (Stub_table::do_write): Modified to handle erratum stubs.
672         (AArch64_relobj::The_erratum_stub): New typedef.
673         (AArch64_relobj::Erratum_stub_set_iter): New typedef.
674         (AArch64_relobj::fix_errata): New method.
675         (Target_aarch64::The_reloc_stub_type): Removed.
676         (Target_aarch64::The_erratum_stub): New typede.
677         (AArch64_relocate_functions::construct_b): New method.
678
679 2015-06-08  Nick Clifton  <nickc@redhat.com>
680
681         * po/fr.po: New French Translation.
682
683 2015-06-07  Cary Coutant  <ccoutant@gmail.com>
684
685         PR gold/18288
686         * resolve.cc (symbol_to_bits): Remove type parameter; adjust all
687         callers. Don't use STT_COMMON to check for common symbols.
688         (Symbol_table::resolve): Warn if relocatable object has STT_COMMON
689         symbol that's not in a common section.
690         * symtab.h (Symbol::is_common): Don't use STT_COMMON to check for
691         common symbols.
692
693 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
694
695         PR gold/18200
696         * Makefile.am (diststuff): Add target.
697         * Makefile.in: Regenerate.
698
699 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
700
701         PR gold/17498
702         * object.cc (Sized_relobj_file::do_count_local_symbols): Discard
703         temporary locals in merge sections.
704         * options.cc (General_options::parse_discard_all): New method.
705         (General_options::parse_discard_locals): New method.
706         (General_options::parse_discard_none): New method.
707         (General_options::General_options): Initialize discard_locals_.
708         * options.h (--discard-all): Convert to special option.
709         (--discard-locals): Likewise.
710         (--discard-none): New option.
711         (General_options::discard_all): New method.
712         (General_options::discard_locals): New method.
713         (General_options::discard_sec_merge): New method.
714         (General_options::Discard_locals): New enum.
715         (General_options::discard_locals_): New data member.
716
717 2015-06-03  Cary Coutant  <cary@google.com>
718
719         * script-sections.cc (Script_sections::Script_sections): Initialize
720         segments_created_.
721         (Script_sections::create_note_and_tls_segments): Set flag when
722         segments are created.
723         (Script_sections::expected_segment_count): Count PT_INTERP.
724         (Script_sections::attach_sections_using_phdrs_clause): Set flag when
725         segments are created.
726         * script-sections.h (Script_sections::segments_created_): New data
727         member.
728
729 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
730
731         PR gold/15370
732         * script-sections.cc
733         (Output_section_element_input::set_section_addresses): When there
734         are several patterns with no sort spec, put all sections in the same
735         bin.
736         * testsuite/Makefile.am (script_test_12): New testcase.
737         (script_test_12i): New testcase.
738         * testsuite/Makefile.in: Regenerate.
739         * testsuite/script_test_12.t: New test linker script.
740         * testsuite/script_test_12i.t: New test linker script.
741         * testsuite/script_test_12a.c: New test source file.
742         * testsuite/script_test_12b.c: New test source file.
743
744 2015-06-02  Cary Coutant  <ccoutant@gmail.com>
745
746         * nacl.h (Sniff_file): Switch parameters to get_view to get an
747         aligned view.
748
749 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
750
751         PR gold/17819
752         * gold.cc (queue_final_tasks): When --build-id=tree, queue a
753         separate task to schedule the build id computation.
754         * layout.cc (Hash_task::Hash_task): Remove build_id_blocker,
755         add Output_file and offset.
756         (Hash_task::run): Get and release the input views.
757         (Hash_task::is_runnable): Always return NULL (always runnable).
758         (Layout::queue_build_id_tasks): Remove.
759         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
760         parameters; use them instead of class members.
761         (Build_id_task_runner::run): New function.
762         (Close_task_runner::run): Pass array_of_hashes and size_of_hashes
763         to write_build_id.
764         * layout.h (Layout::queue_build_id_tasks): Remove.
765         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
766         parameters.
767         (Layout::array_of_hashes_): Remove.
768         (Layout::size_of_array_of_hashes_): Remove.
769         (Layout::input_view_): Remove.
770         (Build_id_task_runner): New class.
771         (Close_task_runner::Close_task_runner): Add array_of_hashes and
772         size_of_hashes parameters.
773         (Close_task_runner::array_of_hashes_): New data member.
774         (Close_task_runner::size_of_hashes_): New data member.
775         * testsuite/Makefile.am
776         (flagstest_compress_debug_sections_and_build_id_tree): New test.
777         * testsuite/Makefile.in: Regenerate.
778
779 2015-06-01  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
780
781         * merge.cc (get_input_merge_map): Update for data structure change.
782         (get_or_make_input_merge_map): Update for data structure change.
783         * merge.h (Object_merge_map): Use a std::vector<std::pair>> instead of
784         a std::map. Remove first_shnum_, first_map_, second_shnum_, second_map_.
785
786 2015-05-16  Alan Modra  <amodra@gmail.com>
787
788         * reloc.cc (Sized_relobj_file::find_functions): Use function_location.
789         * powerpc.cc (Target_powerpc::do_calls_non_split): New function.
790         (addi_12_1, addis_2_12, addis_12_1, cmpld_7_12_0): New constants.
791         (lis_0): Rename from lis_0_0.
792
793 2015-04-29  Cary Coutant  <cary@google.com>
794             Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
795
796         * gc.h (Garbage_collection::is_section_garbage): Change Object*
797         to Relobj*.
798         (Garbage_collection::add_reference): Likewise.
799         (Garbage_collection::gc_process_relocs): Likewise. Don't push
800         object/shndx pair onto *secvec for dynamic objects. Don't follow
801         relocations pointing to dynamic objects for GC.
802         * icf.cc (Icf::find_identical_sections): Change Object* to Relobj*.
803         (Icf::unfold_section): Likewise.
804         (Icf::is_section_folded): Likewise.
805         (Icf::get_folded_section): Likewise.
806         * icf.h: (Icf::get_folded_section): Likewise.
807         (Icf::unfold_section): Likewise.
808         (Icf::is_section_folded): Likewise.
809         (Icf::section_has_function_pointers): Likewise.
810         (Icf::set_section_has_function_pointers): Likewise.
811         * object.h (Section_id): Likewise.
812         (Const_section_id): Likewise.
813         * output.cc (Output_section::update_section_layout): Likewise.
814         * output.h: (Output_section_lookup_maps::find_relaxed_input_section):
815         Likewise.
816         * plugin.cc (update_section_order): Likewise.
817         (unique_segment_for_sections): Likewise.
818         * powerpc.cc (Powerpc_relobj::add_reference): Likewise.
819         (Target_powerpc::do_gc_add_reference): Likewise.
820         (Target_powerpc::gc_process_relocs): Likewise.
821         (Target_powerpc::do_gc_add_reference): Likewise.
822         * symtab.cc (Symbol_table::is_section_folded): Likewise.
823         (Symbol_table::gc_mark_symbol): Likewise.
824         * symtab.h: (Symbol_table::is_section_folded): Likewise.
825         * target.h: (Sized_target::gc_add_reference): Likewise.
826         (Sized_target::do_gc_add_reference): Likewise.
827
828 2015-04-29  Nick Clifton  <nickc@redhat.com>
829
830         * po/fi.po: Updated Finnish translation.
831
832 2015-04-28  Alan Modra  <amodra@gmail.com>
833
834         * powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather
835         than unsigned int for find_global_entry result temp.  Compare
836         against invalid_address.
837         (Target_powerpc::do_plt_address_for_global): Likewise.
838         (Target_powerpc::Relocate::relocate): Likewise.  Don't assert
839         on plt call stub existence for debug info.  Do assert for plt
840         and global entry stub existence if an alloc section.
841
842 2015-04-28  Alan Modra  <amodra@gmail.com>
843
844         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert
845         on missing global entry stub due to bogus debug info.
846
847 2015-04-27  Han Shen  <shenhan@google.com>
848
849         * options.h (--fix-cortex-a53-843419): Rename option.
850         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Use renamed
851         option.
852         (AArch64_relobj::scan_sections_for_stubs): Use renamed option.
853
854 2015-04-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
855
856         PR gold/18327
857         * output.cc (Output_section::is_input_address_mapped): Assume a missing
858         entry is mapped.
859         * testsuite/Makefile.am: Add the eh_test test.
860         * testsuite/Makefile.in: Regenerate.
861         * testsuite/eh_test_a.cc: New test.
862         * testsuite/eh_test_b.cc: New test.
863
864 2015-04-23  Sriraman Tallam  <tmsriram@google.com>
865
866         * options.h (--weak-unresolved-symbols): New option.
867         * symtab.cc (Symbol_table::sized_write_globals): Change symbol
868         binding to weak with new option.
869         * symtab.h (is_weak_undefined): Check for new option.
870         (is_strong_undefined): Check for new option.
871         * testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
872         * testsuite/Makefile.in: Regenerate.
873         * testsuite/weak_unresolved_symbols_test.cc: New file.
874
875 2015-04-20  Ian Coolidge  <icoolidge@google.com>
876
877         * symtab.cc (Symbol::should_add_dynsym_entry): Return true for
878         GNU_UNIQUE.
879
880 2015-04-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
881
882         * gc.cc (Garbage_collection::do_transitive_closure): Use back and
883         push_back.
884         * gc.h (Garbage_collection): Use a std::vector instead of a std::queue.
885         * object.cc (Sized_relobj_file::do_layout): Use push_back.
886         * powerpc.cc (process_gc_mark): Use push_back.
887         (Target_powerpc::do_gc_mark_symbol): Use push_back.
888         * symtab.cc (Symbol_table::gc_mark_symbol): Use push_back.
889
890 2015-04-16  Han Shen  <shenhan@google.com>
891
892         * aarch64.cc (AArch64_insn_utilities): New utility class.
893         (AArch64_relobj::Mapping_symbol_position): New struct.
894         (AArch64_relobj::Mapping_symbol_info): New typedef.
895         (AArch64_relobj::do_count_local_symbols): New function overriding
896         parent's implementation.
897         (AArch64_relobj::mapping_symbol_info_): New member
898         (AArch64_relobj::scan_erratum_843419): New method.
899         (Target_aarch64::scan_erratum_843419_span): New method.
900         (Target_aarch64::is_erratum_843419_sequence): New method.
901         * options.h (fix_cortex_a53): New option.
902
903 2015-04-09  Cary Coutant  <ccoutant@google.com>
904
905         * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
906         in a PIE link.
907         * testsuite/Makefile.am (tls_pie_test.sh): New test.
908         * testsuite/Makefile.in: Regenerate.
909         * testsuite/tls_pie_test.sh: New.
910
911 2015-04-09  Cary Coutant  <ccoutant@google.com>
912
913         * debug.h (DEBUG_LOCATION): New.
914         (DEBUG_ALL): Include DEBUG_LOCATION.
915         (debug_string_to_enum): Add DEBUG_LOCATION.
916         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
917         output to print correct context.
918         (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
919         up to 4 more locations at the beginning of the function.
920         * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
921         result before sorting list of line numbers.
922         * testsuite/debug_msg.sh: Allow range of line numbers for
923         canonical results on optimized code.
924
925 2015-04-07  HC Yen <hc.yen@mediatek.com>
926
927         Add AArch32 support for gold linker.
928         gold/
929         * arm.cc: Add V8 arch combine table.
930
931 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
932
933         * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
934
935 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
936
937         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
938         to find by using the return value of insert.
939
940 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
941
942         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
943         constructor call.
944
945 2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>
946
947         PR gold/17641
948         * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
949         (Target_x86_64::Scan::local): Don't create GOT entry, when we
950         can convert mov to lea.
951         (Target_x86_64::Scan::global): Ditto.
952         (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
953         %reg to lea foo(%rip), %reg if possible.
954         * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
955         * testsuite/x86_64_mov_to_lea1.s: New.
956         * testsuite/x86_64_mov_to_lea2.s: Ditto.
957         * testsuite/x86_64_mov_to_lea3.s: Ditto.
958         * testsuite/x86_64_mov_to_lea4.s: Ditto.
959         * testsuite/x86_64_mov_to_lea.sh: Ditto.
960
961 2015-04-02  H.J. Lu  <hongjiu.lu@intel.com>
962
963         * configure: Regenerated.
964
965 2015-04-01  Ilya Tocar  <ilya.tocar@intel.com>
966
967         PR gold/17640
968         * i386.cc (Target_i386::can_convert_mov_to_lea): New.
969         (Target_i386::Scan::local): Don't create GOT entry, when we
970         can convert GOT to GOTOFF.
971         (Target_i386::Scan::global): Ditto.
972         (Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
973         lea foo@GOTOFF(%reg), %reg if possible.
974         * testsuite/Makefile.am (i386_mov_to_lea): New test.
975         * testsuite/i386_mov_to_lea1.s: New.
976         * testsuite/i386_mov_to_lea2.s: Ditto.
977         * testsuite/i386_mov_to_lea3.s: Ditto.
978         * testsuite/i386_mov_to_lea4.s: Ditto.
979         * testsuite/i386_mov_to_lea5.s: Ditto.
980         * testsuite/i386_mov_to_lea.sh: Ditto.
981
982 2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>
983
984         * Makefile.am (ZLIB): New.
985         (ZLIBINC): Likewise.
986         (AM_CFLAGS): Add $(ZLIBINC).
987         (AM_CXXFLAGS): Likewise.
988         (ldadd_varldadd_var): Add $(ZLIB).
989         (incremental_dump_LDADD): Likewise.
990         (dwp_LDADD): Likewise.
991         * compressed_output.cc: Don't check HAVE_ZLIB_H to include
992         <zlib.h>.
993         (zlib_compress): Don't check HAVE_ZLIB_H.
994         (zlib_decompress): Likewise.
995         * options.h (compress_debug_sections): Likewise.
996         * configure.ac (AM_CONDITIONAL): Removed.
997         * testsuite/Makefile.am (ZLIB): New.
998         (LDADD): Add $(ZLIB).
999         Don't check HAVE_ZLIB.
1000         * Makefile.in: Regenerated.
1001         * config.in: Likewise.
1002         * configure: Likewise.
1003         * testsuite/Makefile.in: Likewise.
1004
1005 2015-03-30  Jing Yu  <jingyu@google.com>
1006
1007         * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
1008         TLSLD_ADD_DTPREL_LO12_NC.
1009         * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
1010         _TLS_MODULE_BASE_ point to the start of tls segment.
1011         (Target_aarch64::optimize_tls_reloc): Add cases for
1012         R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
1013         R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
1014         (Target_aarch64::Scan::local): Likewise.
1015         (Target_aarch64::Scan::global): Likewise.
1016         (Target_aarch64::Relocate::relocate): Likewise.
1017         (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
1018         subtracting tls segment size from symbol value for TLSLD_*_DTPREL
1019         relocations.
1020
1021 2015-03-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1022
1023         * merge.cc (Object_merge_map::add_mapping): call
1024         Object_merge_map::Input_merge_map::add_mapping.
1025         (Object_merge_map::Input_merge_map::add_mapping): New.
1026         (Output_merge_data::do_add_input_section): Call
1027         get_or_make_input_merge_map before a loop.
1028         (Output_merge_string<Char_type>::finalize_merged_data): Call
1029         get_or_make_input_merge_map before a loop.
1030         * merge.h (Object_merge_map): Make Input_merge_map public.
1031         * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
1032         (Relobj::get_or_create_merge_map): New.
1033         * object.h (Relobj::get_or_create_merge_map): New.
1034
1035 2015-03-24  Alan Modra  <amodra@gmail.com>
1036
1037         PR 18147
1038         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
1039         relocation errors for branches to strong undefined symbols.
1040
1041 2015-03-23  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1042
1043         * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
1044         (Object_merge_map::is_merge_section_for): Remove.
1045         (Object_merge_map::find_merge_section): New.
1046         * merge.h (Object_merge_map::is_merge_section_for): Remove.
1047         (Object_merge_map::find_merge_section): New.
1048         (Object_merge_map::get_input_merge_map): Add a const version.
1049         * object.cc (Relobj::is_merge_section_for): Remove.
1050         (Relobj::find_merge_section): New.
1051         * object.h (Relobj::is_merge_section_for): Remove.
1052         (Relobj::find_merge_section): New.
1053         * output.cc
1054         (Output_section::Input_section::is_merge_section_for): Remove.
1055         (Output_section::add_merge_input_section): Don't call
1056         add_merge_input_section.
1057         (Output_section::find_merge_section): Return const. Use
1058         object->find_merge_section.
1059         (Output_section::build_lookup_maps): Don't build a map for
1060         merge sections.
1061         (Output_section::is_input_address_mapped): Return false if
1062         section is not found.
1063         (Output_section::find_starting_output_address): Use
1064         find_merge_section instead of is_merge_section_for.
1065         (Output_section::add_script_input_section):  Don't build a map for
1066         merge sections.
1067         * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
1068         (Output_section_lookup_maps::find_merge_section): Remove.
1069         (Output_section_lookup_maps::add_merge_input_section) Remove.
1070         (Output_section::find_merge_section): Return const.
1071
1072 2015-03-22  Cary Coutant  <cary@google.com>
1073
1074         PR gold/18106
1075         * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
1076         non-SIB form of lea, with nop after the call.
1077
1078 2015-03-21  Cary Coutant  <cary@google.com>
1079
1080         PR gold/14217
1081         * output.cc (Output_segment::is_first_section_relro): Don't ignore
1082         .tdata section.
1083         (Output_segment::set_section_addresses): Don't align size of relro
1084         segment for .tbss.
1085
1086 2015-03-21  Cary Coutant  <cary@google.com>
1087
1088         PR gold/18010
1089         * stringpool.cc (Stringpool_template): Don't optimize if section
1090         alignment is greater than sizeof(char).
1091
1092 2015-03-21  Cary Coutant  <cary@google.com>
1093
1094         PR gold/18048
1095         * script-c.h (script_include_directive): Add first_token parameter.
1096         * script.cc (script_include_directive): Add first_token parameter, and
1097         pass it to read_script_file.
1098         * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
1099         (PARSING_MEMORY_DEF): New tokens.
1100         (top): Add new productions for INCLUDE files.
1101         (file_cmd): Replace file_or_sections_cmd with copy of its productions.
1102         Pass PARSING_LINKER_SCRIPT to script_include_directive.
1103         (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
1104         (section_cmd): Pass PARSING_SECTION_CMDS.
1105         (file_or_sections_cmd): Remove.
1106         (memory_def): Pass PARSING_MEMORY_DEF.
1107         * testsuite/Makefile.am (memory_test_2): New test.
1108         * testsuite/Makefile.in: Regenerate.
1109         * testsuite/memory_test_inc.t: New script file.
1110         * testsuite/memory_test_inc_1.t.src: New script file.
1111         * testsuite/memory_test_inc_2.t.src: New script file.
1112         * testsuite/memory_test_inc_3.t.src: New script file.
1113
1114 2015-03-21  Cary Coutant  <cary@google.com>
1115
1116         * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
1117         (Sized_relobj_dwo::setup): Build compressed section map.
1118         (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
1119         * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
1120         section map.
1121         * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
1122         compressed_sections_ field.
1123         (build_compressed_section_map): Take Object instead of
1124         Sized_relobj_file parameter; add decompress_if_needed parameter.
1125         (Sized_relobj_file::do_find_special_sections): Store compressed
1126         section map in parent Object.
1127         (Sized_relobj_file::do_decompressed_section_contents): Move
1128         implementation to Object::decompressed_section_contents.
1129         (Sized_relobj_file::do_discard_decompressed_sections): Move
1130         implementation to Object::discard_decompressed_sections.
1131         * object.h (build_compressed_section_map): Declare.
1132         (Object::Object): Add compressed_sections_ field.
1133         (Object::section_is_compressed): Move implementation here.
1134         (Object::decompressed_section_contents): De-virtualize.
1135         (Object::discard_decompressed_sections): De-virtualize.
1136         (Object::do_section_is_compressed): Delete.
1137         (Object::do_decompressed_section_contents): Delete.
1138         (Object::set_compressed_sections): New method.
1139         (Object::compressed_sections): New method.
1140         (Object::compressed_sections_): New data member.
1141         (Compressed_section_info, Compressed_section_map): Move to top of file.
1142         (Sized_relobj_file::do_section_is_compressed): Delete.
1143         (Sized_relobj_file::do_decompressed_section_contents): Delete.
1144         (Sized_relobj_file::do_discard_decompressed_sections): Delete.
1145         (Sized_relobj_file::compressed_sections_): Move to Object class.
1146
1147 2015-03-21  Cary Coutant  <ccoutant@google.com>
1148
1149         PR gold/18152
1150         * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
1151         deferred objects.
1152
1153 2015-03-11  Cary Coutant  <ccoutant@google.com>
1154
1155         * options.cc (General_options::finalize): Don't allow -z relro
1156         with incremental linking.
1157         * testsuite/Makefile.am (incremental_test): Add -z norelro.
1158         (incremental_test_2): Likewise.
1159         (incremental_test_3): Likewise.
1160         (incremental_test_4): Likewise.
1161         (incremental_test_5): Likewise.
1162         (incremental_test_6): Likewise.
1163         (incremental_copy_test): Likewise.
1164         (incremental_common_test_1): Likewise.
1165         (incremental_comdat_test_1): Likewise.
1166         * testsuite/Makefile.in: Regenerate.
1167
1168 2015-03-09  Cary Coutant  <ccoutant@google.com>
1169
1170         PR gold/14675
1171         * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
1172         return enum indicating whether .eh_frame section is empty, optimizable,
1173         unrecognized, or an end marker. Adjust explicit instantiations.
1174         * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
1175         (Eh_frame::add_ehframe_input_section): Change return type.
1176         * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
1177         * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
1178         to the .eh_frame output section until we see the end marker.
1179         (Layout::finalize_eh_frame_section): New.
1180         * layout.h: (Layout::finalize_eh_frame_section): New.
1181
1182 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
1183
1184         * output.cc (Relobj::initialize_input_to_output_map<size>):
1185         Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
1186
1187 2015-03-04  Cary Coutant  <ccoutant@google.com>
1188
1189         * parameters.cc (Parameters::set_target_once): Call
1190         Target::select_as_default_target just once from here...
1191         (set_parameters_target): ...instead of from here.
1192
1193 2015-03-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1194
1195         * ehframe.cc (Cie::set_output_offset): Pass in and use a
1196         Output_section_data instead of a Merge_map.
1197         (Eh_frame::Eh_frame): Don't initialize merge_map_.
1198         (Eh_frame::read_cie): Use add_merge_mapping instead of
1199         Merge_map::add_mapping.
1200         (Eh_frame::read_fde): Ditto.
1201         (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
1202         (Eh_frame::do_output_offset): Use merge_output_offset istead of
1203         merge_map_->get_output_offset.
1204         (Eh_frame::do_is_merge_section_for): Delete.
1205         * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
1206         instead of a Merge_map.
1207         (Cie::set_output_offset): Pass in a Output_section_data instead of a
1208         Merge_map.
1209         (Eh_frame::do_is_merge_section_for): Delete.
1210         (Eh_frame::merge_map_): Delete.
1211         * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
1212         and use a Output_section_data instead of a Merge_map.
1213         (Object_merge_map::add_mapping): Ditto.
1214         (Object_merge_map::get_output_offset): Remove the merge_map argument.
1215         (Object_merge_map::is_merge_section_for): Pass in and use a
1216         Output_section_data instead of a Merge_map.
1217         (Merge_map): Delete.
1218         (Output_merge_base::do_output_offset): Use merge_output_offset instead
1219         of merge_map_.get_output_offset.
1220         (Output_merge_base::do_is_merge_section_for): Delete.
1221         (Output_merge_data::do_add_input_section): Use
1222         object->add_merge_mapping instead of add_mapping.
1223         (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
1224         * merge.h (Merge_map): Delete forward declaration.
1225         (Object_merge_map::add_mapping): Pass in and use a Output_section_data
1226         instead of a Merge_map.
1227         (Object_merge_map::get_output_offset): Remove the merge_map argument.
1228         (Object_merge_map::is_merge_section_for): Pass in and use a
1229         Output_section_data instead of a Merge_map.
1230         (Input_merge_map::Object_merge_map::merge_map): Replace with
1231         output_data.
1232         (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
1233         Output_section_data instead of a Merge_map.
1234         (Merge_map): Delete.
1235         (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
1236         (Output_merge_base::do_is_merge_section_for): Delete.
1237         (Output_merge_base::add_mapping): Delete.
1238         (Output_merge_base::merge_map_): Delete.
1239         * object.cc (Relobj::initialize_input_to_output_map): New.
1240         (Relobj::initialize_input_to_output_map): New.
1241         (Relobj::merge_output_offset): New.
1242         (Relobj::is_merge_section_for): New.
1243         (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
1244         bits.
1245         * object.h (Relobj::merge_map): Delete.
1246         (initialize_input_to_output_map): New.
1247         (set_merge_map): Delete.
1248         (add_merge_mapping): New.
1249         (merge_output_offset): New.
1250         (is_merge_section_for): New.
1251         * output.cc (Output_section::Input_section::is_merge_section_for):
1252         Use object->is_merge_section_for.
1253         * output.h (Output_section_data::is_merge_section_for): Delete.
1254         (Output_section_data::do_is_merge_section_for): Delete.
1255         * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
1256         Use object->initialize_input_to_output_map.
1257         (Merged_symbol_value<size>::value_from_output_section): Use
1258         object->merge_output_offset.
1259
1260 2015-03-02  Peter Collingbourne  <pcc@google.com>
1261             Cary Coutant  <ccoutant@google.com>
1262
1263         * output.cc (Output_section::add_merge_input_section): Do not
1264         attempt to merge sections with an entsize of 0.
1265
1266 2015-03-02  Khem Raj  <raj.khem@gmail.com>
1267
1268         * attributes.h (class Output_attributes_section_data ): Add
1269         do_print_to_mapfile function.
1270
1271 2015-02-24  Alan Modra  <amodra@gmail.com>
1272
1273         PR 18010
1274         * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
1275         complain if value is not a multiple of four.
1276         (Target_powerpc::Relocate::relocate): Correct handling of
1277         R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
1278
1279 2015-02-21  H.J. Lu  <hongjiu.lu@intel.com>
1280
1281         * configure.ac (default_size): Set to 32 for x32.
1282         * configure: Regenerated.
1283
1284 2015-02-18  Alan Modra  <amodra@gmail.com>
1285
1286         PR 17954
1287         * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
1288         visibility.
1289
1290 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1291
1292         * gc.h (Garbage_collection::add_reference): Don't use find.
1293
1294 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1295
1296         * object.cc (write_local_symbols): avoid std::vector copy.
1297
1298 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1299
1300         * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
1301
1302 2015-02-09  Mark Wielaard  <mjw@redhat.com>
1303
1304         * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
1305         DW_LANG_Fortran03 and DW_LANG_Fortran08.
1306
1307 2015-02-16  Cary Coutant  <ccoutant@google.com>
1308
1309         PR gold/13577
1310         PR gold/16992
1311         * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
1312         DF_SYMBOLIC if --dynamic-list option is used.
1313         * options.cc (General_options::finalize): --dynamic-list is not
1314         mutually exclusive with -Bsymbolic.
1315         * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
1316         listed in --dynamic-list.
1317         * testsuite/Makefile.am (dynamic_list_lib2.so): Add
1318         -Bsymbolic-functions.
1319         * testsuite/Makefile.in: Regenerate.
1320
1321 2015-02-16  Cary Coutant  <ccoutant@google.com>
1322
1323         PR gold/17971
1324         * incremental.cc: Remove redundant include of "output.h".
1325
1326 2015-02-12  Jing Yu  <jingyu@google.com>
1327
1328         * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
1329         TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
1330         New relocation.
1331         * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
1332         TLSLE_MOVW_* relocations.
1333         (Target_aarch64::Scan::global): Likewise.
1334         (Target_aarch64::Relocate::relocate): Likewise.
1335         (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
1336         for new TLSLE_MOVW_* relocations.
1337
1338 2015-02-11  Will Newton  <will.newton@linaro.org>
1339
1340         PR gold/13321
1341         * arm.cc (Target_arm::make_plt_section): Create an ARM
1342         state mapping symbol at the start of the PLT.
1343
1344 2015-02-09  H.J. Lu  <hongjiu.lu@intel.com>
1345
1346         * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
1347         Replace two_file_shared_2.so with two_file_shared_1.so.
1348         * testsuite/Makefile.in: Regenerated.
1349
1350 2015-02-09  Alan Modra  <amodra@gmail.com>
1351
1352         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
1353         plugin_test_thin.a and defsym_test.
1354         * testsuite/Makefile.in: Regenerate.
1355
1356 2015-02-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1357
1358         * merge.cc (do_add_input_section): Combine loop epilogue into main loop
1359         body.
1360
1361 2015-02-04  Peter Collingbourne  <pcc@google.com>
1362
1363         * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
1364         forwarding symbols when computing symbol resolution info for plugins.
1365         * plugin.h (Plugin_manager::symtab): New method.
1366         (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
1367
1368 2015-02-03  Cary Coutant  <ccoutant@google.com>
1369             Peter Collingbourne  <pcc@google.com>
1370
1371         PR gold/15660
1372         * archive.cc (Thin_archive_object_unlocker): New class.
1373         (Archive::include_member): Unlock external members of thin archives.
1374         * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
1375         (plugin_test_2): Likewise.
1376         (plugin_test_3): Likewise.
1377         (plugin_test_4): Likewise.
1378         (plugin_test_5): Likewise.
1379         (plugin_test_6): Likewise.
1380         (plugin_test_7): Likewise.
1381         (plugin_test_8): Likewise.
1382         (plugin_test_9): Likewise.
1383         (plugin_test_10): Likewise.
1384         (plugin_test_11): New test case.
1385         * testsuite/Makefile.in: Regenerate.
1386         * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
1387         file to decide whether to claim file.
1388         (all_symbols_read_hook): Likewise.
1389         * testsuite/plugin_test_1.sh: Adjust expected output.
1390         * testsuite/plugin_test_2.sh: Likewise.
1391         * testsuite/plugin_test_3.sh: Likewise.
1392         * testsuite/plugin_test_6.sh: Likewise.
1393         * testsuite/plugin_test_tls.sh: Likewise.
1394         * testsuite/plugin_test_11.sh: New testcase.
1395
1396 2015-02-03  Cary Coutant  <ccoutant@google.com>
1397
1398         * descriptors.cc (Descriptors::open): Set artificially-low limit for
1399         file descriptors when debugging enabled. Add debug output.
1400         (Descriptors::release): Add debug output.
1401         (Descriptors::close_some_descriptor): Likewise.
1402         (Descriptors::close_all): Likewise.
1403         * fileread.cc (File_read::lock): Likewise.
1404         (File_read::unlock): Likewise.
1405
1406 2015-02-02  Cary Coutant  <ccoutant@google.com>
1407
1408         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
1409         executable output file.
1410
1411 2015-01-22  Han Shen  <shenhan@google.com>
1412
1413         * arm.cc (Target_arm::Target_arm): Add initialization for new members.
1414         (Target_arm::do_plt_address_for_global): New method.
1415         (Target_arm::do_plt_address_for_local): New method.
1416         (Target_arm::rel_irelative_section): New method.
1417         (Target_arm::make_data_plt): Add more parameters for plt ctor.
1418         (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
1419         (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
1420         (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
1421         (Target_arm::Scan::check_non_pic): Add ifunc support.
1422         (Target_arm::Scan::local): Add ifunc support.
1423         (Target_arm::Scan::global): Add ifunc support.
1424         (Target_arm::make_plt_section): New method.
1425         (Target_arm::make_plt_entry): Change to call to make_plt_section.
1426         (Target_arm::make_local_ifunc_plt_entry): New method.
1427         (Target_arm::got_irelative_): New member.
1428         (Target_arm::rel_irelative_): New member.
1429         (Target_arm::got_section): Add creation for got_irelative_.
1430         (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
1431         (Target_arm::Relocate::relocate): Properly set local ifunc address.
1432         (Target_arm::do_dynsym_value): Properly set global ifunc address.
1433         (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
1434         (Output_data_plt_arm::IRelative_data): New type.
1435         (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
1436         (Output_data_plt_arm::add_entry): Add more parameters.
1437         (Output_data_plt_arm::add_relocation): New method.
1438         (Output_data_plt_arm::add_local_ifunc_entry): New method.
1439         (Output_data_plt_arm::rel_irelative): New method.
1440         (Output_data_plt_arm::entry_count): Modified.
1441         (Output_data_plt_arm::address_for_global): New method.
1442         (Output_data_plt_arm::address_for_local): New method.
1443 gold/
1444         (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
1445         (Output_data_plt_arm::insert_irelative_data): New method.
1446         (Output_data_plt_arm::irelative_rel_): New member.
1447         (Output_data_plt_arm::got_): New member.
1448         (Output_data_plt_arm::got_irelative_): New member.
1449         (Output_data_plt_arm::irelative_count_): New member.
1450         (Output_data_plt_arm::IRelative_data_vec): New typedef.
1451         (Output_data_plt_arm::irelative_data_vec_): New member.
1452         (Output_data_plt_arm::do_write): Write out irelative entries.
1453         (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
1454         more parameters to ctor.
1455         (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
1456         more parameters to ctor.
1457         * output.h (Output_data_reloc::add_local_relative): New method.
1458         * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
1459
1460 2015-01-29  Alan Modra  <amodra@gmail.com>
1461
1462         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
1463         and GOT_TLSGD to LE optimization.
1464
1465 2015-01-28  Cary Coutant  <ccoutant@google.com>
1466
1467         * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
1468         for undef TLS symbols.
1469         (Target_x86_64::Relocate::relocate_tls): Likewise.
1470         (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
1471
1472 2015-01-25  Cary Coutant  <ccoutant@google.com>
1473
1474         * output.cc (Output_segment::set_section_addresses): Fix calculation
1475         of size of relro segment.
1476
1477 2015-01-22  Alan Modra  <amodra@gmail.com>
1478
1479         * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
1480         condition for need of ifunc plt entry.
1481         (Target_powerpc::Scan::global <got relocs>): Likewise.
1482
1483 2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1484
1485         * mips.cc (reloc_high): Add r_sym.
1486         (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
1487         reloc_high constructor.
1488         (Mips_relocate_functions::relgot16_local): Likewise.
1489         (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
1490         r_type to decide whether LO16 matches HI16.
1491         (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
1492         rello16 and relgot16_local.
1493
1494 2015-01-09  Cary Coutant  <ccoutant@google.com>
1495
1496         * layout.cc (Layout::set_segment_offsets): Don't align start of segment
1497         unless alignment is larger than page size.
1498
1499 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1500             Cary Coutant  <ccoutant@google.com>
1501
1502         PR gold/17729
1503         * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
1504         (DEFAULT_TARGET_X32): Set for x32.
1505         * x86_64.cc (cmp_insn_32): New.
1506         (lea_r10_insn_32): Likewise.
1507         (lea_r11_insn_32): Likewise.
1508         (cmp_insn_64): Likewise.
1509         (lea_r10_insn_64): Likewise.
1510         (lea_r11_insn_64): Likewise.
1511         (Target_x86_64<size>::do_calls_non_split): Handle x32.
1512         * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
1513         (check_DATA): Add split_x32 files.
1514         (split_x32_[1234n].o): New targets.
1515         (split_x32_[124]): New targets.
1516         (split_x32_[1234r].stdout): New targets.
1517         * testsuite/split_x32.sh: New file.
1518         * testsuite/split_x32_1.s: Likewise.
1519         * testsuite/split_x32_2.s: Likewise.
1520         * testsuite/split_x32_3.s: Likewise.
1521         * testsuite/split_x32_4.s: Likewise.
1522         * testsuite/split_x32_n.s: Likewise.
1523         * configure: Regenerated.
1524         * testsuite/Makefile.in: Likewise.
1525
1526 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1527
1528         PR gold/17809
1529         * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
1530         x32.
1531
1532 2015-01-02  Alan Modra  <amodra@gmail.com>
1533
1534         * version.cc (print_version): Just print current year.
1535         * dwp.cc (print_version): Likewise.
1536
1537 2015-01-01  Alan Modra  <amodra@gmail.com>
1538
1539         Update year range in copyright notice of all files.
1540
1541 2014-12-25  Alan Modra  <amodra@gmail.com>
1542
1543         * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
1544         new enums.
1545         (Target_arm::merge_object_attributes, ): Likewise.
1546
1547 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
1548
1549         * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
1550         as hard float only when Tag_ABI_VFP_args is 1, using new enum value
1551         AEABI_VFP_args_vfp to check that.
1552         (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
1553         value and replace hardcoded values by enum values.
1554
1555 2014-12-22  Cary Coutant  <ccoutant@google.com>
1556
1557         * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
1558
1559 2014-12-20  H.J. Lu  <hongjiu.lu@intel.com>
1560
1561         PR gold/14608
1562         * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
1563         to "return i * i * 3;".
1564
1565 2014-12-16  Cary Coutant  <ccoutant@google.com>
1566
1567         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
1568         (Mapfile::print_output_data): Use current_data_size() to avoid
1569         assert for sections requiring postprocessing; if address is not valid,
1570         print 0.
1571         (Mapfile::print_output_section): Use current_data_size(); print note
1572         that addresses and sizes are before compression.
1573
1574 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
1575
1576         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1577         Cast current_group_size to unsigned long when reporting error.
1578
1579 2014-12-10  Jing Yu  <jingyu@google.com>
1580
1581         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
1582         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
1583         Update error message.
1584         (Target_aarch64::do_relax): Use absolute value of option
1585         stub_group_size. Replace local variable with class member
1586         stub_group_size_.
1587
1588 2014-12-04  Alan Modra  <amodra@gmail.com>
1589
1590         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
1591         addend of PLTREL24 reloc when not generating a plt stub.  Make
1592         max_branch_offset an "Address".
1593         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
1594         (Target_powerpc::Relocate::relocate): Likewise.
1595
1596 2014-12-04  Alan Modra  <amodra@gmail.com>
1597
1598         PR 17670
1599         * symtab.cc (Symbol::set_undefined): Remove assertion.
1600         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1601         on symbols defined in discarded sections, instead return false.
1602         Rearrange params, update all callers.
1603         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
1604         branches to syms in discarded sections.
1605         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
1606         undefined and flag as discarded.
1607         (Target_powerpc::Relocate::relocate): Localize variable.
1608
1609 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
1610
1611         PR gold/17675
1612         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
1613         * testsuite/Makefile.in: Regenerated.
1614
1615 2014-12-03  Alan Modra  <amodra@gmail.com>
1616
1617         PR 17566
1618         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
1619         when adding dynamic relocations against section symbols.
1620
1621 2014-12-01  Dimitry Ivanov <dimitry@google.com>
1622
1623         * layout.cc (Layout::finish_dynamic_section): When '-z global'
1624         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
1625         * options.h (General_options): New -z option (global).
1626
1627 2014-12-01  Cary Coutant  <ccoutant@google.com>
1628
1629         PR gold/17578
1630         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
1631         is given.
1632         (Layout::create_executable_stack_info): Warn when -z noexecstack is
1633         given but some inputs require executable stack.
1634
1635 2014-11-26  Cary Coutant  <ccoutant@google.com>
1636
1637         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
1638         .debug_str_offsets; strip .debug_gnu_pubnames and
1639         .debug_gnu_pubtypes.
1640         (lines_only_debug_sections): Strip all four new sections.
1641
1642 2014-11-26  Jing Yu  <jingyu@google.com>
1643
1644         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
1645         register to be x0 when to relax TLSDESC_LD64_LO12.
1646
1647 2014-11-26  Alan Modra  <amodra@gmail.com>
1648
1649         * powerpc.cc (struct Stub_table_owner): New.
1650         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
1651         unsigned int vector.  Update all references.
1652         (powerpc_relobj::set_stub_table): Take an unsigned int param
1653         rather than a Stub_table.  Update callers.
1654         (Powerpc_relobj::clear_stub_table): New function.
1655         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
1656         stub_group_size_ vars.
1657         (Target_powerpc::new_stub_table): Delete.
1658         (max_branch_delta): New function, extracted from..
1659         (Target_powerpc::Relocate::relocate): ..here..
1660         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
1661         status on whether stub created successfully.
1662         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
1663         default sizing to..
1664         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
1665         reduce on relax failure.
1666         (Target_powerpc::group_sections): Add "no_size_errors" param.
1667         Use stub_group_size_.  Set up group info in a temp vector,
1668         before building Stub_table vector.  Account for input sections
1669         possibly already converted to relaxed sections.
1670         (Stub_table::init): Delete.  Merge into..
1671         (Stub_table::Stub_table): ..here.
1672         (Stub_table::can_reach_stub): New function.
1673         (Stub_table::add_plt_call_entry): Add "from" parameter and
1674         return true iff stub could be reached.
1675         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
1676         param too.
1677         (Stub_table::clear_stubs): Add "all" param.
1678
1679 2014-11-26  Alan Modra  <amodra@gmail.com>
1680
1681         * powerpc.cc (Stub_control::set_output_and_owner): New function.
1682         (Target_powerpc::group_sections): Use it.
1683
1684 2014-11-25  Cary Coutant  <ccoutant@google.com>
1685
1686         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
1687         (Binary_to_elf::write_symbol): Add st_size parameter.
1688         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
1689
1690 2014-11-25  Cary Coutant  <ccoutant@google.com>
1691
1692         PR gold/17639
1693         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
1694         (Sized_relobj_file::do_layout): Handle deferred sections properly
1695         during GC pass 1. Don't add reloc sections to deferred list twice.
1696         * object.h (Sized_relobj_file::is_deferred_layout): New function.
1697         (Sized_relobj_file::is_deferred_layout_): New data member.
1698
1699 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
1700
1701         PR gold/17619
1702         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
1703         Check PC-relative offset overflow in PLT entry.
1704
1705 2014-11-21  Alan Modra  <amodra@gmail.com>
1706
1707         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
1708         for undefined weaks.
1709
1710 2014-11-20  Alan Modra  <amodra@gmail.com>
1711
1712         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
1713         from --stub-group-size parameter divided by 1024.
1714         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
1715         template parameter.  Update all uses.
1716         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
1717         has_stub_value.  Set for long branches.  Don't report overflow for
1718         branch to undefined weak symbols.  Print info message on
1719         overflowing branch to stub.
1720
1721 2014-11-20  Alan Modra  <amodra@gmail.com>
1722
1723         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
1724
1725 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
1726
1727         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
1728         entry for R_X86_64_GOTPLT64.
1729         (Target_x86_64<size>::Relocate::relocate): Update comments for
1730         R_X86_64_GOTPLT64.
1731
1732 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
1733
1734         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
1735         * plugin.h: add lock definition
1736
1737 2014-10-29  Han Shen  <shenhan@google.com>
1738             Jing Yu   <jingyu@google.com>
1739
1740         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
1741         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1742         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
1743         Symbol::TLS_REF.
1744         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
1745         method.
1746         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
1747         (Target_aarch64::tls_ld_to_le): New method.
1748         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
1749         for 64bit targets.
1750         (Output_data_plt_aarch64::irelative_rel_): New data member.
1751         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
1752         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
1753         (Output_data_plt_aarch64::add_relocation): New method.
1754         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
1755         offset. Add got_irelative size to got size.
1756         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
1757         type string with the new typename.
1758         (AArch64_relocate_functions::update_adr): Replace parameter x with
1759         immed.
1760         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
1761         (AArch64_relocate_functions::reloc_common): New method.
1762         (AArch64_relocate_funcsions::rela_general): Extract common part out
1763         into reloc_common method.
1764         (AArch64_relocate_functions::rela_general): Likewise.
1765         (AArch64_relocate_functions::pcrela_general): Likewise.
1766         (AArch64_relocate_functions::adr): New method.
1767         (AArch64_relocate_functions::adrp): Calculate immed before calling
1768         update_adr.
1769         (AArch64_relocate_functions::adrp): Likewise.
1770         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
1771         comparing x to 0. Calculate immed from ~x when x < 0.
1772         (Target_aarch64::optimize_tls_reloc): Add new cases for
1773         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1774         TLSLD_MOVW_DTPREL_G0_NC.
1775         (Target_aarch64::possible_function_pointer_reloc): Implement this
1776         method.
1777         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
1778         comment.
1779         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
1780         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1781         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1782         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
1783         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1784         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1785         (Target_aarch64::make_plt_entry): Call add_entry with two more
1786         parameters.
1787         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1788         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
1789         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1790         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1791         (Target_aarch64::Relocate::relocate_tls): Add cases for
1792         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1793         TLSLD_MOVW_DTPREL_G0_NC.
1794         * testsuite/icf_safe_so_test.cc: Correct test comment.
1795         * testsuite/icf_safe_test.sh: Add AArch64 arch.
1796
1797 2014-10-22  Alan Modra  <amodra@gmail.com>
1798
1799         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
1800         thread_starter.
1801
1802 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
1803
1804         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
1805
1806 2014-10-17  Cary Coutant  <ccoutant@google.com>
1807
1808         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1809         Add "typename" keyword.
1810
1811 2014-10-15  Han Shen  <shenhan@google.com>
1812             Jing Yu   <jingyu@google.com>
1813
1814         Patch for gold aarch64 backend to support relaxation.
1815         * aarch64-reloc.def: Change format.
1816         * aarch64.cc (class Reloc_stub): New class.
1817         (class Stub_table): New class.
1818         (class AArch64_relobj): New class.
1819         (class AArch64_input_section): New class.
1820         (class AArch64_output_section): New class.
1821         (Target_aarch64::new_stub_table): New method.
1822         (Target_aarch64::new_aarch64_input_section): New method.
1823         (Target_aarch64::find_aarch64_input_section): New method.
1824         (Target_aarch64::scan_section_for_stubs): New method.
1825         (Target_aarch64::scan_reloc_section_for_stubs): New method.
1826         (Target_aarch64::relocate_stub): New method.
1827         (Target_aarch64::current_target): New method.
1828         (Target_aarch64::do_make_elf_object): New method.
1829         (Target_aarch64::do_may_relax): New method.
1830         (Target_aarch64::do_relax): New method.
1831         (Target_aarch64::group_sections): New method.
1832         (Target_aarch64::scan_reloc_for_stub): New method.
1833         (Target_aarch64::do_make_output_section): New method.
1834         (Target_aarch64::stub_tables_): New data member.
1835         (Target_aarch64::aarch64_input_section_map_): New data member.
1836         (AArch64_relocate_functions::maybe_apply_stub): New method.
1837
1838 2014-09-30  Cary Coutant  <ccoutant@google.com>
1839
1840         PR gold/17432
1841         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
1842
1843 2014-09-30  Kito Cheng  <kito@0xlab.org>
1844
1845         PR gold/13597
1846         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
1847         hash table before sysv-style hash table.
1848
1849 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
1850
1851         * options.h (--pic-executable): Add negative to alias to -no-pie.
1852
1853 2014-09-26  Cary Coutant  <ccoutant@google.com>
1854
1855         PR gold/16773
1856         * object.cc (Sized_relobj_file): Compute value of section symbols
1857         for TLS sections the same as TLS symbols.
1858
1859 2014-09-25  Cary Coutant  <ccoutant@google.com>
1860
1861         PR gold/17432
1862         * resolve.cc (Symbol_table::resolve): Override common placeholder
1863         symbols, but adjust sizes.
1864         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
1865         symbols to common lists.
1866
1867 2014-09-24  Alan Modra  <amodra@gmail.com>
1868
1869         * po/POTFILES.in: Regenerate.
1870
1871 2014-09-23  Taiju Tsuiki  <tzik@google.com>
1872             Cary Coutant  <ccoutant@google.com>
1873
1874         PR gold/14860
1875         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
1876         on input_sections_blocker.
1877         * layout.cc (Write_sections_task::locks): Unblock
1878         input_sections_blocker_.
1879         * layout.h (Write_sections_task::Write_sections_task): Add
1880         input_sections_blocker.
1881         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
1882         to DEPENDENCIES.
1883         * testsuite/Makefile.in: Regenerate.
1884
1885 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1886
1887         * testsuite/Makefile.am (plugin_test_10): New test.
1888         * testsuite/Makefile.in: Regenerate
1889         * testsuite/plugin_common_test_2.c (c1): Align to 8.
1890         * testsuite/plugin_test_10.sh: New file.
1891
1892 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1893
1894         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
1895         * resolve.cc (Symbol_table::resolve): Don't override common symbols
1896         during the replacement phase.
1897
1898 2014-09-17  Han Shen  <shenhan@google.com>
1899             Jing Yu  <jingyu@google.com>
1900
1901         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
1902         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
1903         * aarch64.cc (Target_aarch64): Add data members
1904         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
1905         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
1906         constructor.
1907         (Target_aarch64::do_reloc_symbol_index): New method.
1908         (Target_aarch64::do_reloc_addend): New method.
1909         (Target_aarch64::add_tlsdesc_info): New method.
1910         (Target_aarch64::do_dynsym_value): New method.
1911         (Target_aarch64::do_make_data_plt): Add new parameters: got,
1912         got_irelative. Pass them to Output_data_plt_aarch64_standard.
1913         (Target_aarch64::make_data_plt): Add new parameters: got,
1914         got_irelative. Pass them to do_make_data_plt.
1915         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
1916         (Target_aarch64::Relocate:tls_gd_to_le): New method.
1917         (Target_aarch64::Relocate:tls_ie_to_le): New method.
1918         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
1919         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
1920         (Target_aarch64::got_tlsdesc_section): New method.
1921         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1922         (Target_aarch64::define_tls_base_symbol): New method.
1923         (Target_aarch64::reserve_tlsdesc_entries): New method.
1924         (Target_aarch64::got_mod_index_entry): New method.
1925         (Target_aarch64::rela_tlsdesc_section): New method.
1926         (Target_aarch64::rela_irelative_section): New method.
1927         (Target_aarch64::Tlsdesc_info): New struct.
1928         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
1929         relocations and tlsdesc relocations.
1930         (Target_aarch64::optimize_tls_reloc): Implement method.
1931         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
1932         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
1933         in constructor.
1934         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
1935         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
1936         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
1937         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
1938         (Output_data_plt_aarch64::rela_tlsdesc): New method.
1939         (Output_data_plt_aarch64::rela_irelative): New method.
1940         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
1941         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
1942         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
1943         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
1944         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
1945         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
1946         (Output_data_plt_aarch64_standard): New member variables:
1947         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
1948         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
1949         New parameter: got, got_irelative.
1950         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
1951         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
1952         (Output_data_plt_aarch64::do_write): Replace got_address with
1953         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
1954         (AArch64_relocate_functions::update_movnz): New method.
1955         (AArch64_relocate_functions): Correct format.
1956         (AArch64_relocate_functions::movnz): New method.
1957         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
1958         before the switch. Add new cases to switch.
1959         Check ie_to_le relaxation on tlsie relocations. Add code handling
1960         tlsgd tlsdesc cases.
1961         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
1962         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
1963         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
1964         Call reloc_name_in_error_message to print unsupported reloc.
1965         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
1966         make_data_plt.
1967         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
1968         relocs. Fill in some more dynamic tags.
1969         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
1970         Skip call tls_get_addr when tlsgd is relaxed.
1971         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
1972         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
1973         tlsdesc->ie relaxation.
1974
1975 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1976
1977         * mips.cc (Target_mips_nacl): New class.
1978         (Target_selector_mips_nacl): New class.
1979         (target_selector_mips32): Rename from target_selector_mips32be and use
1980         Target_selector_mips_nacl instead of Target_selector_mips.
1981         (target_selector_mips32el): Rename from target_selector_mips32 and use
1982         Target_selector_mips_nacl instead of Target_selector_mips.
1983         (target_selector_mips64): Rename from target_selector_mips64be and use
1984         Target_selector_mips_nacl instead of Target_selector_mips.
1985         (target_selector_mips64el): Rename from target_selector_mips64 and use
1986         Target_selector_mips_nacl instead of Target_selector_mips.
1987         (Target_mips::mips_info): Add const attribute.
1988
1989 2014-09-02  Cary Coutant  <ccoutant@google.com>
1990
1991         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
1992         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
1993         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
1994         (Sized_incr_dynobj::do_section_name): Likewise.
1995         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
1996         (Sized_incr_dynobj::do_section_name): Likewise.
1997         * object.h (Object::section_name): Likewise.
1998         (Object::do_section_name): Likewise.
1999         (Sized_relobj_file::do_section_name): Likewise.
2000         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
2001         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
2002
2003 2014-09-02  Cary Coutant  <ccoutant@google.com>
2004
2005         PR gold/17005
2006         * ehframe.cc (Fde::write): Add output_offset parameter.
2007         (Cie::write): Likewise.
2008         (Eh_frame::set_final_data_size): Account for offset within output
2009         section.
2010         (Eh_frame::do_sized_write): Likewise.
2011         * ehframe.h (Fde::write): Add output_offset parameter.
2012         (Cie::write): Likewise.
2013         * output.cc (Output_section::Input_section_sort_entry): Remove
2014         section_has_name_; add output_section_name parameter. Use
2015         output section name for non-input sections.
2016         (Output_section::Input_section_sort_entry::section_has_name): Remove.
2017         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
2018         (Output_section::Input_section_sort_compare): Remove logic for
2019         sections without names.
2020         (Output_section::Input_section_sort_init_fini_compare): Likewise.
2021         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
2022         Likewise.
2023         (Output_section::Input_section_sort_section_name_compare): Likewise.
2024
2025 2014-08-29 Han Shen <shenhan@google.com>
2026            Jing Yu <jingyu@google.com>
2027
2028         * aarch64-reloc-property.cc
2029         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
2030         reference reloc property in the table.
2031         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
2032         3 other entries.
2033         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
2034         2 new overloaded methods.
2035         (Output_data_got_aarch64::do_write): Add code to write out
2036         static relocs.
2037         (class Output_data_got_aarch64::Static_reloc): New class to wrap
2038         static relocs.
2039         (Output_data_got_aarch64::static_relocs): New vector to
2040         hold static relocs.
2041         (Target_aarch64::TCB_SIZE): New const static memeber.
2042         (Target_aarch64::tcb_size): New method.
2043         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
2044         (Target_aarch64::Relocate::relocate_tls): New method.
2045         (Target_aarch64::Scan::local): Add code handling new reloc types.
2046         (Target_aarch64::Scan::global): Add code handling new reloc types.
2047
2048 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
2049
2050         * options.h (-no-pie): Add option.
2051
2052 2014-08-08  Jing Yu  <jingyu@google.com>
2053             Han Shen  <shenhan@google.com>
2054
2055         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
2056         (DEFFILES): add aarch64-reloc.def.
2057         (TARGETSOURCES): Add aarch64-reloc-property.cc.
2058         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
2059         * Makefile.in: Regenerate.
2060         * aarch64-reloc-property.cc: New file.
2061         * aarch64-reloc-property.h: New file.
2062         * aarch64-reloc.def: New file.
2063         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
2064         with tab to make the format consistent.
2065         (Output_data_got_aarch64::symbol_table_): New method.
2066         (Target_aarch64::do_plt_address_for_global): New method.
2067         (Target_aarch64::do_plt_address_for_local): New method.
2068         (Target_aarch64::do_select_as_default_target): New method.
2069         (Target_aarch64::do_make_data_plt): New method.
2070         (Target_aarch64::make_data_plt): New method.
2071         (Output_data_plt_aarch64::has_irelative_section): New method.
2072         (Output_data_plt_aarch64::address_for_global): New method.
2073         (Output_data_plt_aarch64::address_for_local): New method.
2074         (Output_data_plt_aarch64::irelative_rel_): New parameter.
2075         (Output_data_plt_aarch64::add_entry): Implement contents.
2076         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
2077         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
2078         the got_pov entry to plt0.
2079         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
2080         Implement contents.
2081         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
2082         (AArch64_howto): New struct.
2083         (aarch64_howto[]): New static const array.
2084         (AArch64_relocate_functions): New class.
2085         (Target_aarch64::Scan::get_reference_flags): Remove method.
2086         (Target_aarch64::Scan::local): Implement to support a few relocations.
2087         (Target_aarch64::Scan::global): Implement to support a few relocations.
2088         (Target_aarch64::make_plt_section): Implement contents.
2089         (Target_aarch64::make_plt_entry): Implement contents.
2090         (Target_aarch64::do_finalize_sections): Implement contents.
2091         (Target_aarch64::Relocate::relocate): Implement a few relocations.
2092         (Target_aarch64::relocate_section): Implement contents.
2093
2094 2014-08-06  Alan Modra  <amodra@gmail.com>
2095
2096         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
2097
2098 2014-08-06  Alan Modra  <amodra@gmail.com>
2099
2100         PR 13227
2101         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
2102
2103 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
2104
2105         * object.cc (Relobj::is_section_name_included): Add
2106         ".rodata.nptl_version" to not garbage collect this section.
2107
2108 2014-07-08  Cary Coutant  <ccoutant@google.com>
2109
2110         * expression.cc (struct Expression::Expression_eval_info): Add
2111         new fields type_pointer, vis_pointer, and nonvis_pointer.
2112         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
2113         nonvis_pointer parameters. Adjust all calls.
2114         (Symbol_expression::value): Update type, visibility, and nonvis bits
2115         in caller.
2116         * script.cc (Symbol_assignment::sized_finalize): Update type,
2117         visibility, and remaining st_other bits for new symbol.
2118         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
2119         vis_pointer, and nonvis_pointer parameters.
2120         * symtab.h (Symbol::set_type): New method.
2121
2122         * testsuite/Makefile.am (defsym_test): New test.
2123         * testsuite/Makefile.in: Regenerate.
2124         * testsuite/defsym_test.c: New file.
2125         * testsuite/defsym_test.sh: New file.
2126
2127 2014-07-08  Cary Coutant  <ccoutant@google.com>
2128
2129         PR gold/15639
2130         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
2131         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
2132         (Sized_dynobj::base_read_symbols): ...new method.
2133         * object.h (Sized_relobj_file::base_read_symbols): New method.
2134         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
2135         (Sized_relobj_file::base_read_symbols): ...new method.
2136         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
2137         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
2138         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
2139
2140 2014-07-04  Alan Modra  <amodra@gmail.com>
2141
2142         * po/POTFILES.in: Regenerate.
2143
2144 2014-07-02  Jing Yu  <jingyu@google.com>
2145
2146         * aarch64.cc: New file
2147         * Makefile.am (TARGETSOURCES): Add aarch64.cc
2148         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
2149         * Makefile.in: Regenerate.
2150         * configure.tgt: Add entries for aarch64*.
2151         * configure.ac:  Likewise.
2152         * configure: Likewise.
2153
2154 2014-06-27  Alan Modra  <amodra@gmail.com>
2155
2156         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
2157
2158 2014-06-24  Cary Coutant  <ccoutant@google.com>
2159
2160         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
2161         sections.
2162         (Dwo_file::sized_read_unit_index): Likewise.
2163
2164 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2165
2166         * mips.cc: New file.
2167         * Makefile.am (TARGETSOURCES): Add mips.cc
2168         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
2169         * configure.tgt: Add entries for mips*.
2170         * configure.ac: Likewise.
2171         * Makefile.in: Regenerate.
2172         * configure: Likewise.
2173
2174 2014-06-09  Cary Coutant  <ccoutant@google.com>
2175
2176         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
2177         unit_length is within section bounds.
2178
2179 2014-06-09  Cary Coutant  <ccoutant@google.com>
2180
2181         PR gold/16980
2182         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
2183         map.
2184
2185 2014-06-07  Alan Modra  <amodra@gmail.com>
2186
2187         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
2188
2189 2014-06-06  Cary Coutant  <ccoutant@google.com>
2190
2191         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
2192         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
2193         (Dwarf_pubnames_table::read_header): Likewise.
2194         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
2195         .debug_gnu_pubtypes.
2196
2197 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
2198
2199         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
2200         * Makefile.in, configure: Regenerate.
2201
2202 2014-06-03  Alan Modra  <amodra@gmail.com>
2203
2204         * powerpc.cc (addis_12_2): Define.
2205         (Stub_table::do_write): Support fusion on ELFv2 stubs.
2206
2207 2014-06-03  Alan Modra  <amodra@gmail.com>
2208
2209         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
2210         st_other output.
2211
2212 2014-06-02  Alan Modra  <amodra@gmail.com>
2213
2214         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
2215         Only ignore relocs on ELFv1.
2216         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
2217
2218 2014-05-30  Cary Coutant  <ccoutant@google.com>
2219
2220         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
2221         * testsuite/Makefile.in: Regenerate.
2222         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
2223
2224 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
2225
2226         PR gold/16945
2227         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
2228         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
2229
2230 2014-05-15  Alan Modra  <amodra@gmail.com>
2231
2232         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
2233         Compare FDE contents with DW_CFA_nop rather than 0.
2234
2235 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
2236
2237         * symtab.h (may_need_copy_reloc): Remove check for position independent
2238         code.
2239         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
2240         position independence before pc absolute may_need_copy_reloc call.
2241         Add check for executable output befor pc relative may_need_copy_reloc
2242         call.
2243         * i386.cc: Ditto.
2244         * arm.cc: Ditto.
2245         * sparc.cc: Ditto.
2246         * tilegx.cc: Ditto.
2247         * powerpc.cc: Add check for no position independence before
2248         may_need_copy_reloc calls.
2249         * testsuite/pie_copyrelocs_test.cc: New file.
2250         * testsuite/pie_copyrelocs_shared_test.cc: New file.
2251         * Makefile.am (pie_copyrelocs_test): New test.
2252         * Makefile.in: Regenerate.
2253
2254 2014-05-08  Martin Liška  <mliska@suse.cz>
2255
2256         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
2257
2258 2014-05-06  Cary Coutant  <ccoutant@google.com>
2259
2260         PR gold/16900
2261         * i386.cc (Output_data_got_plt_i386): New class.
2262         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
2263         parameter. Change all callers.
2264         (Output_data_plt_i386::layout_): Remove.
2265         (Output_data_plt_i386::got_plt_): Change type.
2266         (Target_i386::got_plt_): Change type. Change all references.
2267         (Target_i386::got_section): Create instance of new class.
2268         (Output_data_got_plt_i386::do_write): New function.
2269         * x86_64.cc (Output_data_got_plt_x86_64): New class.
2270         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
2271         parameter. Change all callers.
2272         (Output_data_plt_x86_64::layout_): Remove.
2273         (Output_data_plt_x86_64::got_plt_): Change type.
2274         (Target_x86_64::got_plt_): Change type. Change all references.
2275         (Target_x86_64::got_section): Create instance of new class.
2276         (Output_data_got_plt_x86_64::do_write): New function.
2277         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
2278         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
2279         class.
2280
2281 2014-05-05  Cary Coutant  <ccoutant@google.com>
2282
2283         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
2284         if we have pubnames/pubtypes.
2285
2286 2014-05-02  Cary Coutant  <ccoutant@google.com>
2287
2288         * defstd.cc (in_segment): Define __ehdr_start here...
2289         * layout.cc (Layout::finalize): ...Instead of here.  Set the
2290         output segment when known.
2291         * resolve.cc (Symbol::override_base_with_special): Remember
2292         the original binding.
2293         * symtab.cc (Symbol::set_output_segment): New function.
2294         (Symbol::set_undefined): New function.
2295         * symtab.h (Symbol::is_weak_undefined): Check original undef
2296         binding.
2297         (Symbol::is_strong_undefined): New function.
2298         (Symbol::set_output_segment): New function.
2299         (Symbol::set_undefined): New function.
2300         * target-reloc.h (is_strong_undefined): Remove.
2301         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
2302         Check for hidden undefs.
2303         (relocate_section): Call Symbol::is_strong_undefined.
2304
2305         * testsuite/Makefile.am (ehdr_start_test_1)
2306         (ehdr_start_test_2, ehdr_start_test_3)
2307         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
2308         * testsuite/Makefile.in: Regenerate.
2309         * testsuite/ehdr_start_def.cc: New source file.
2310         * testsuite/ehdr_start_test.cc: New source file.
2311         * testsuite/ehdr_start_test.t: New linker script.
2312         * testsuite/ehdr_start_test_4.sh: New shell script.
2313
2314 2014-04-23  Cary Coutant  <ccoutant@google.com>
2315
2316         PR gold/16870
2317         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
2318
2319 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2320
2321         * layout.cc (Layout::include_section): Allow a target to decide
2322         whether to include a section.
2323         * target.h (Target::should_include_section): New function.
2324         (Target::do_should_include_section): New function.
2325
2326 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2327
2328         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
2329         inline into ...
2330         (Copy_relocs::emit): ... here.
2331         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
2332         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
2333         (Copy_reloc_entry::entries_): Change from private to protected.
2334
2335 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
2336
2337         * icf.cc (get_section_contents): Replace copies of reloc
2338         vectors with const references.
2339
2340 2014-04-02  Cary Coutant  <ccoutant@google.com>
2341
2342         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
2343         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
2344         * configure: Regenerate.
2345         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
2346         -fno-use-linker-plugin.
2347         (LINK1, CXXLINK1): Add it to the link command.
2348         * testsuite/Makefile.in: Regenerate.
2349
2350 2014-03-12  Alan Modra  <amodra@gmail.com>
2351
2352         * Makefile.in: Regenerate.
2353
2354 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2355
2356         * symtab.h (Symbol::set_nonvis): New function.
2357
2358 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2359
2360         * symtab.cc (Sized_symbol<32>::init_output_data):
2361         Instantiate the template.
2362         (Sized_symbol<64>::init_output_data): Likewise.
2363
2364 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2365
2366         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
2367         adjust dynamic symbol value.
2368         * target.h (Target::adjust_dyn_symbol): New function.
2369         (Target::do_adjust_dyn_symbol): New function.
2370
2371 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2372
2373         * output.cc (Output_data_dynamic::Dynamic_entry::write):
2374         Get the value of DYNAMIC_CUSTOM dynamic entry.
2375         * output.h (Output_data_dynamic::add_custom): New function.
2376         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
2377         dynamic entry.
2378         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
2379         * target.h (Target::dynamic_tag_custom_value): New function.
2380         (Target::do_dynamic_tag_custom_value): New function.
2381
2382 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2383
2384         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
2385         dynsym indexes.
2386         * target.h (Target::has_custom_set_dynsym_indexes): New function.
2387         (Target::do_has_custom_set_dynsym_indexes): New function.
2388         (Target::set_dynsym_indexes): New function.
2389         (Target::do_set_dynsym_indexes): New function.
2390
2391 2014-03-07  Alan Modra  <amodra@gmail.com>
2392
2393         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
2394         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
2395         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
2396         (Powerpc_relocate_functions::has_overflow_bitfield,
2397         overflowed): Use the above.
2398         (Target_powerpc::Relocate::relocate): Correct overflow checking
2399         for a number of relocations.  Modify overflow test for 16-bit
2400         fields in instructions to signed/unsigned according to whether
2401         the field takes a signed or unsigned value.
2402
2403 2014-03-05  Alan Modra  <amodra@gmail.com>
2404
2405         Update copyright years.
2406
2407 2014-03-05  Alan Modra  <amodra@gmail.com>
2408
2409         * powerpc.cc (Target_powerpc::Scan::local, global): Support
2410         R_PPC64_ADDR64_LOCAL.
2411         (Target_powerpc::Relocate::relocate): Likewise.
2412
2413 2014-03-03  Alan Modra  <amodra@gmail.com>
2414
2415         * dwp.cc (print_version): Update copyright year to current.
2416
2417 2014-02-10  Alan Modra  <amodra@gmail.com>
2418
2419         * po/gold.pot: Regenerate.
2420
2421 2014-02-06  Cary Coutant  <ccoutant@google.com>
2422
2423         Fix problem where -u is ignored when a weak undef is seen.
2424
2425         * archive.cc (Library_base::should_include_member): Reorder
2426         code to check for -u option if a weak undef has already been seen.
2427         * testsuite/Makefile.am (weak_undef_test_2): New test case.
2428         * testsuite/Makefile.in: Regenerate.
2429         * testsuite/weak_undef_file3.cc: New file.
2430         * testsuite/weak_undef_file4.cc: New file.
2431         * testsuite/weak_undef_test_2.cc: New file.
2432
2433 2014-02-05  Cary Coutant  <ccoutant@google.com>
2434
2435         Fix issues with gold undefined symbol diagnostics.
2436
2437         PR binutils/15435
2438         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
2439         check to here.
2440         * target-reloc.h (is_strong_undefined): New function.
2441         (relocate_section): Move undef vtable symbol check from here.
2442         Check for is_strong_undefined.
2443
2444 2014-02-05  Cary Coutant  <ccoutant@google.com>
2445
2446         Fix problems with the --dynamic-list option.
2447
2448         PR gold/13577
2449         * options.cc (General_options::parse_dynamic_list):
2450         Set have_dynamic_list_.
2451         (General_options::General_options): Initialize have_dynamic_list_.
2452         (General_options::finalize): Turn off -Bsymbolic and
2453         -Bsymbolic-functions if --dynamic-list provided.
2454         * options.h (General_options::have_dynamic_list): New function.
2455         (General_options::have_dynamic_list_): New data member.
2456         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
2457         correctly.
2458
2459         PR gold/16530
2460         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
2461         in --dynamic-list, mark it.
2462
2463         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
2464         (dynamic_list_2): New test case.
2465         * testsuite/Makefile.in: Regenerate.
2466         * testsuite/dynamic_list_2.cc: New file.
2467         * testsuite/dynamic_list_2.t: New file.
2468         * testsuite/dynamic_list_lib1.cc: New file.
2469         * testsuite/dynamic_list_lib2.cc: New file.
2470         * testsuite/gc_dynamic_list_test.c: New file.
2471         * testsuite/gc_dynamic_list_test.sh: New file.
2472         * testsuite/gc_dynamic_list_test.t: New file.
2473
2474 2014-01-28  Cary Coutant  <ccoutant@google.com>
2475
2476         Add .gdb_index version 7 support.
2477
2478         * gold/dwarf_reader.cc: include <utility> (for make_pair).
2479         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
2480         debug sections.
2481         (Dwarf_ranges_table::read_ranges_table): Likewise.
2482         (Dwarf_pubnames_table::read_section): Check for GNU-style
2483         sections, and for compressed debug sections.
2484         (Dwarf_pubnames_table::read_header): Compute end address of table.
2485         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
2486         for end of list by offset, not by offset == 0.
2487         (Dwarf_info_reader::do_read_string_table): Check for compressed
2488         debug sections.
2489         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2490         Initialize new data members.
2491         (Dwarf_pubnames_table::next_name): return flag_byte.
2492         (Dwarf_pubnames_table::end_of_table_): New data member.
2493         (Dwarf_pubnames_table::is_gnu_style_): New data member.
2494         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
2495         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
2496         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
2497         read skeleton type unit DIEs.
2498         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
2499         (Gdb_index::do_write): Write flag_byte.
2500         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
2501         (Gdb_index::Cu_vector): Store flags along with cu indexes.
2502         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
2503         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
2504
2505 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
2506
2507         * version.cc (print_version): Update copyright year to 2014.
2508
2509 2013-12-19  Dimitry Andric  <dimitry@andric.com>
2510
2511         * stringpool.cc (Stringpool_template::reserve): Add
2512         HAVE_UNORDERED_MAP case.
2513         * stringpool.cc (Stringpool_template::print_stats): Likewise.
2514
2515 2013-12-18  Cary Coutant  <ccoutant@google.com>
2516
2517         * configure.ac: Check for <unordered_set> and <unordered_map>.
2518         * config.in: Regenerate.
2519         * configure: Regenerate.
2520         * system.h: Use <unordered_set> and <unordered_map> if available.
2521
2522 2013-12-10  Roland McGrath  <mcgrathr@google.com>
2523
2524         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
2525         with $(INSTALL_PROGRAM_ENV).
2526         * Makefile.in: Regenerate.
2527
2528 2013-11-22  Cary Coutant  <ccoutant@google.com>
2529
2530         * configure.ac: Add check for which library is needed for
2531         dlopen.
2532         * configure: Regenerate.
2533
2534 2013-11-22  Cary Coutant  <ccoutant@google.com>
2535
2536         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
2537         assembler.
2538         * testsuite/Makefile.in: Regenerate.
2539
2540 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
2541
2542         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
2543         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
2544         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
2545         (Target_x86_64<size>::Scan::local): Likewise.
2546         (Target_x86_64<size>::Scan::global): Likewise.
2547         (Target_x86_64<size>::Relocate::relocate): Likewise.
2548         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
2549         Likewise.
2550         (Target_x86_64<size>::Scan::check_non_pic(): Handle
2551         R_X86_64_PC32_BND.
2552
2553         * testsuite/Makefile.am (check_PROGRAMS): Add
2554         exception_x86_64_bnd_test.
2555         (exception_x86_64_bnd_test_SOURCES): New macro.
2556         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
2557         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
2558         (exception_x86_64_bnd_test_LDADD): Likewise.
2559         (exception_x86_64_bnd_1.o): New rule.
2560         (exception_x86_64_bnd_2.o): Likewise.
2561         * testsuite/Makefile.in: Regenerated.
2562
2563 2013-11-15  Alan Modra  <amodra@gmail.com>
2564
2565         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
2566         accessor.
2567         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
2568         Only call ppc64_local_entry_offset for 64-bit.  Restrict
2569         symval_for_branch lookup to ELFv1.
2570         (Stub_table::add_plt_call_entry): Use unsigned int off.
2571         (Output_data_glink::Address, invalid_address): New.
2572         (Output_data_glink::add_eh_frame): Move out of line.  Add
2573         support for ELFv2.
2574         (Output_data_glink::add_global_entry, find_global_entry,
2575         global_entry_address): New functions.
2576         (Output_data_glink::global_entry_stubs_, end_branch_table_,
2577         ge_size): New variables.
2578         (Output_data_glink::set_final_data_size): Add global entry
2579         stub sizing.
2580         (Output_data_glink::do_write): Write global entry stubs.
2581         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
2582         parameter.  Return true for ELFv2.  Adjust callers.
2583         (Target_powerpc::Scan::local, global): Restrict opd lookup to
2584         ELFv1.  Similarly for ifunc and dynamic relocation processing
2585         specific to ELFv1.  Recognize that symbols are defined on
2586         their plt entries for ELFv2.
2587         (Target_powerpc::symval_for_branch): Assert if called for
2588         ELFv2 or ppc32.
2589         (Target_powerpc::Relocate::relocate): Use global entry plt
2590         stub for symbol value if such exists on ELFv2.
2591         (Target_powerpc::Relocate::relocate): Don't call
2592         symval_for_branch when ELFv2.  Do adjust for local entry
2593         offset when ELFv2.
2594         (Target_powerpc::do_dynsym_value): Set symbols to global entry
2595         plt stub for ELFv2.
2596         (Target_powerpc::do_plt_address_for_global): Similarly.
2597
2598 2013-11-14  Cary Coutant  <ccoutant@google.com>
2599
2600         Revert patch -- this did not fix the problem, and there is
2601         no race there.
2602
2603         2013-11-14  Cary Coutant  <ccoutant@google.com>
2604
2605             PR gold/14860
2606             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2607             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2608             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2609             updating fde_offsets_.
2610             (Eh_frame_hdr::lock_): New data member.
2611
2612 2013-11-14  Cary Coutant  <ccoutant@google.com>
2613
2614         * dwp.cc (Dwo_file_entry): New type.
2615         (File_list): Use Dwo_file_entry.
2616         (Dwo_file::verify): New function.
2617         (Dwo_file::verify_dwo_list): New function.
2618         (Dwo_file::sized_verify_dwo_list): New function.
2619         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
2620         list.
2621         (Dwp_options): New enum type.
2622         (dwp_options): Add --verify-only.
2623         (usage): Likewise.
2624         (main): Likewise.
2625         * dwp.h (gold_info): Add declaration.
2626
2627 2013-11-14  Cary Coutant  <ccoutant@google.com>
2628
2629         PR gold/14860
2630         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2631         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2632         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2633         updating fde_offsets_.
2634         (Eh_frame_hdr::lock_): New data member.
2635
2636 2013-11-06  Cary Coutant  <ccoutant@google.com>
2637
2638         PR gold/15758
2639         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
2640         before reloc sections.
2641
2642 2013-11-04  Alan Modra  <amodra@gmail.com>
2643
2644         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
2645         (Symbol::needs_dynamic_reloc): Test new flag.
2646         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
2647         (Target_powerpc::Scan::get_reference_flags): Add target param.
2648         Return FUNC_DESC_ABI for 64-bit ELFv1.
2649         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
2650         call.
2651         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
2652         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
2653
2654 2013-10-31  Cary Coutant  <ccoutant@google.com>
2655
2656         Restore support for dwp v2 DWARF package file format.
2657
2658         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2659         tu_length parameter.  Adjust all callers.
2660         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2661         * dwp.cc: Include dwarf.h.
2662         (Section_bounds): New struct type.
2663         (Unit_set): New struct type.
2664         (Dwo_file::Dwo_file): Initialize new data member.
2665         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2666         Combine and rename to...
2667         (Dwo_file::read_unit_index): ...this.
2668         (Dwo_file::sized_read_compunit_index)
2669         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2670         (Dwo_file::sized_read_unit_index): ...this.
2671         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2672         parameters; add section_id parameter.
2673         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2674         (Dwo_file::add_unit_set): ...this.
2675         (Dwo_file::shndx_map_): Remove.
2676         (Dwo_file::sect_offsets_): New data member.
2677         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2678         (Dwp_output_file::add_section): Rename to...
2679         (Dwp_output_file::add_contribution): ...this.
2680         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2681         (Dwp_output_file::add_tu_set): Likewise.
2682         (Dwp_output_file::Contribution): New type.
2683         (Dwp_output_file::Section::contributions): New data member.
2684         (Dwp_output_file::Cu_or_tu_set): Remove.
2685         (Dwp_output_file::Section::Section): New ctor.
2686         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2687         (Dwp_output_file::Dwp_index::Section_table): New type.
2688         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2689         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2690         parameter.
2691         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2692         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2693         (Dwp_output_file::Dwp_index::section_table): New member function.
2694         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2695         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2696         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2697         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2698         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2699         (Dwp_output_file::Dwp_index::section_table_): New data member.
2700         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2701         (Dwp_output_file::add_output_section): New member function.
2702         (Dwp_output_file::write_new_section): New member function.
2703         (Dwp_output_file::write_contributions): New member function.
2704         (Dwp_output_file::section_id_map_): New data member.
2705         (class Dwo_id_info_reader): Remove.
2706         (class Unit_reader): New class.
2707         (get_dwarf_section_name): New function.
2708         (Dwo_file::read_executable): Adjust initializations of class data.
2709         (Dwo_file::read): Add support for v2 package file format.
2710         (Dwo_file::read_unit_index): Likewise.
2711         (Dwo_file::sized_read_unit_index): Likewise.
2712         (Dwo_file::copy_section): Likewise.
2713         (Dwo_file::add_unit_set): Likewise.
2714         (Dwp_output_file::add_output_section): Likewise.
2715         (Dwp_output_file::add_contribution): Likewise.
2716         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2717         for empty slot.
2718         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2719         file format.
2720         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2721         slot.
2722         (Dwp_output_file::initialize): Remove unused function.
2723         (Dwp_output_file::finalize): Add support for v2 package file format.
2724         (Dwp_output_file::write_index): Likewise.
2725         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2726         function prototype.
2727
2728 2013-10-31  Cary Coutant  <ccoutant@google.com>
2729
2730         * configure.ac: Fix check for -fmerge-constants.
2731         * configure.ac: Regenerate.
2732
2733 2013-10-30  Roland McGrath  <mcgrathr@google.com>
2734
2735         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
2736         Correct 9-byte nop sequence to match what the assembler generates.
2737
2738 2013-10-30  Alan Modra  <amodra@gmail.com>
2739
2740         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
2741         ppc64_local_entry_offset, ppc64_local_entry_offset,
2742         do_read_symbols): New functions.
2743         (Powerpc_relobj::e_flags_, st_other_): New vars.
2744         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
2745         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
2746         (Powerpc_relobj::e_flags_): New var.
2747         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
2748         and adjust for ELFv2.
2749         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
2750         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
2751         (Powerpc_dynobj::do_find_special_sections): Likewise.
2752         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
2753         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
2754         to ELFv2 local entry.
2755         (Target_powerpc::do_relax): No thread safe barriers needed for
2756         ELFv2.
2757         (Output_data_plt_powerpc::initial_plt_entry_size_,
2758         plt_entry_size): Delete.  Replace all uses with
2759         first_plt_entry_offset() and plt_entry_size().
2760         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
2761         reserved_size parm.  Update callers.
2762         (Output_data_plt_powerpc::entry_count): Update.
2763         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
2764         and use Target_powerpc::first_plt_entry_offset().
2765         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
2766         rename to plt_entry_size.
2767         (Output_data_plt_powerpc::add_ifunc_entry,
2768         add_local_ifunc_entry): Adjust reloc for ELFv2.
2769         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
2770         (glink_eh_frame_fde_64v2): New.
2771         (Stub_table::plt_call_size): Support ELFv2 sizing.
2772         (Output_data_glink::add_eh_frame): Use the new FDE.
2773         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
2774         (Stub_table::do_write): Write ELFv2 stubs and glink.
2775         (Target_powerpc::Relocate::relocate): Replaces nop after call
2776         with ld 2,24(1) and adjust local offset destination for ELFv2.
2777
2778 2013-10-30  Alan Modra  <amodra@gmail.com>
2779
2780         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
2781         (Target_powerpc::Scan::global, local): Likewise.
2782         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
2783         on all ppc64 @h and @ha relocs.
2784
2785 2013-10-14  Alan Modra  <amodra@gmail.com>
2786
2787         * output.h (Output_data_got::add_constant): Tidy.
2788         (Output_data_got::add_constant_pair): New function.
2789         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
2790         methods used so as to first call reserve_ent().
2791
2792 2013-10-11  Roland McGrath  <mcgrathr@google.com>
2793
2794         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
2795         add_got_entry and add_got_entry_pair.
2796
2797         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
2798         (HAVE_PUBNAMES): Likewise.
2799         * configure: Regenerate.
2800
2801         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
2802         * testsuite/Makefile.in: Regenerate.
2803
2804         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
2805         Remove const from declaration.
2806         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
2807         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
2808         * output.h (Output_file_header): Remove const from member target_
2809         and corresponding constructor argument.
2810         * output.cc (Output_file_header::Output_file_header): Update prototype.
2811         (Output_file_header::do_sized_write): Use this->target_ in place
2812         of parameters()->target().
2813
2814         * testsuite/undef_symbol.cc (Foo::get_a): New method.
2815
2816         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
2817         * configure: Regenerate.
2818         * Makefile.in: Regenerate.
2819         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
2820         * testsuite/merge_string_literals_2.c: Likewise.
2821         * testsuite/Makefile.am
2822         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
2823         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
2824         literal -fmerge-constants.
2825         * testsuite/Makefile.in: Regenerate.
2826
2827         * i386.cc (Target_i386): Remove unused member dynbss_.
2828         * arm.cc (Target_arm): Likewise.
2829         * powerpc.cc (Target_powerpc): Likewise.
2830         * sparc.cc (Target_sparc): Likewise.
2831         * tilegx.cc (Target_tilegx): Likewise.
2832         * x86_64.cc (Target_x86_64): Likewise.
2833         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
2834         type_signature_, type_offset_.
2835         * plugin.h (Plugin_hook): Remove unused member layout_.
2836         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
2837         mapfile_.
2838         (Read_member): Remove unused members input_objects_, symtab_,
2839         mapfile_, layout_.
2840         (Check_library): Remove unused member symtab_.
2841         * archive.h (Lib_group): Remove unused member lib_.
2842         * archive.cc (Lib_group::Lib_group): Update initializer.
2843         * incremental.h (Incremental_binary): Remove unused member target_.
2844         (Incremental_script_entry): Removed unused member script_.
2845         * layout.h (Write_symbols_task): Remove unused member input_objects_.
2846         * icf.h (Icf): Remove unused member num_tracked_relocs.
2847
2848         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
2849         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
2850         its only use.
2851         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
2852
2853         * archive.h: Use struct rather than class for forward declaration
2854         of Read_symbols_data.
2855
2856 2013-10-07  Cary Coutant  <ccoutant@google.com>
2857
2858         PR gold/16010
2859         * testsuite/Makefile.am (icf_test): Fix dependencies.
2860         (icf_safe_test): Likewise.
2861         (icf_safe_so_test): Likewise.
2862         (large_symbol_alignment): Add empty _LDADD rule.
2863         * testsuite/Makefile.in: Regenerate.
2864
2865 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
2866
2867         PR gold/15927
2868         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
2869         relocation for R_X86_64_32 on x32.
2870
2871 2013-08-27  Roland McGrath  <mcgrathr@google.com>
2872
2873         * output.cc (Output_segment::set_section_addresses): Take new
2874         Target* argument.  If target->isolate_execinstr() and the segment
2875         is executable and starts at a target->abi_pagesize() boundary,
2876         pad its end out to a target->abi_pagesize() boundary with code fill.
2877         * output.h (Output_segment::set_section_addresses): Update decl.
2878         * layout.h (Layout::check_output_data_for_reset_values): Take new
2879         argument RELAX_OUTPUTS.
2880         (Layout): New member relax_output_list_.
2881         (Layout::add_relax_output): New method.
2882         * layout.cc (Layout::Layout): Update constructor.
2883         (Layout::reset_relax_output): New method.
2884         (Layout::clean_up_after_relaxation): Call it.
2885         (Layout::prepare_for_relaxation): Update caller.
2886         (Layout::set_segment_offsets): Update callers of set_section_addresses.
2887         Call reset_relax_output before re-processing segments for
2888         isolate_execinstr case.
2889         (Layout::write_data): Handle relax_output_list_.
2890         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
2891         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
2892
2893 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
2894
2895         PR binutils/15834
2896         * object.h: Fix typos.
2897
2898 2013-08-16  Roland McGrath  <mcgrathr@google.com>
2899
2900         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
2901         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
2902
2903 2013-08-07  Cary Coutant  <ccoutant@google.com>
2904
2905         Revert support for v2 DWP files:
2906
2907         2013-03-01  Cary Coutant  <ccoutant@google.com>
2908
2909             Add dwp support for v2 DWARF package file format.
2910             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2911             tu_length parameter.  Adjust all callers.
2912             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2913             * dwp.cc: Include dwarf.h.
2914             (Section_bounds): New struct type.
2915             (Unit_set): New struct type.
2916             (Dwo_file::Dwo_file): Initialize new data member.
2917             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2918             Combine and rename to...
2919             (Dwo_file::read_unit_index): ...this.
2920             (Dwo_file::sized_read_compunit_index)
2921             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2922             (Dwo_file::sized_read_unit_index): ...this.
2923             (Dwo_file::copy_section): Remove section_name, is_str_offsets
2924             parameters; add section_id parameter.
2925             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2926             (Dwo_file::add_unit_set): ...this.
2927             (Dwo_file::shndx_map_): Remove.
2928             (Dwo_file::sect_offsets_): New data member.
2929             (Dwp_output_file::Dwp_output_file): Initialize new data members.
2930             (Dwp_output_file::add_section): Rename to...
2931             (Dwp_output_file::add_contribution): ...this.
2932             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2933             (Dwp_output_file::add_tu_set): Likewise.
2934             (Dwp_output_file::Contribution): New type.
2935             (Dwp_output_file::Section::contributions): New data member.
2936             (Dwp_output_file::Cu_or_tu_set): Remove.
2937             (Dwp_output_file::Section::Section): New ctor.
2938             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2939             (Dwp_output_file::Dwp_index::Section_table): New type.
2940             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2941             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2942             parameter.
2943             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2944             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2945             (Dwp_output_file::Dwp_index::section_table): New member function.
2946             (Dwp_output_file::Dwp_index::section_table_end): New member function.
2947             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2948             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2949             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2950             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2951             (Dwp_output_file::Dwp_index::section_table_): New data member.
2952             (Dwp_output_file::Dwp_index::section_mask_): New data member.
2953             (Dwp_output_file::add_output_section): New member function.
2954             (Dwp_output_file::write_new_section): New member function.
2955             (Dwp_output_file::write_contributions): New member function.
2956             (Dwp_output_file::section_id_map_): New data member.
2957             (class Dwo_id_info_reader): Remove.
2958             (class Unit_reader): New class.
2959             (get_dwarf_section_name): New function.
2960             (Dwo_file::read_executable): Adjust initializations of class data.
2961             (Dwo_file::read): Add support for v2 package file format.
2962             (Dwo_file::read_unit_index): Likewise.
2963             (Dwo_file::sized_read_unit_index): Likewise.
2964             (Dwo_file::copy_section): Likewise.
2965             (Dwo_file::add_unit_set): Likewise.
2966             (Dwp_output_file::add_output_section): Likewise.
2967             (Dwp_output_file::add_contribution): Likewise.
2968             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2969             for empty slot.
2970             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2971             file format.
2972             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2973             slot.
2974             (Dwp_output_file::initialize): Remove unused function.
2975             (Dwp_output_file::finalize): Add support for v2 package file format.
2976             (Dwp_output_file::write_index): Likewise.
2977             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2978             function prototype.
2979
2980 2013-07-31  Cary Coutant  <ccoutant@google.com>
2981
2982         * object.cc (Sized_relobj::do_output_section_address): New function.
2983         (Sized_relobj): Instantiate explicitly.
2984         * object.h (Object::output_section_address): New function.
2985         (Object::do_output_section_address): New function.
2986         (Sized_relobj::do_output_section_address): New function.
2987         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
2988
2989 2013-07-30  Cary Coutant  <ccoutant@google.com>
2990             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2991
2992         * parameters.cc (Parameters::entry): Return target-specific entry
2993         symbol name.
2994         * target.h (Target::entry_symbol_name): New function.
2995         (Target_info::entry_symbol_name): New data member.
2996
2997         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
2998         * i386.cc (Target_i386::i386_info): Likewise.
2999         (Target_i386_nacl::i386_nacl_info): Likewise.
3000         * sparc.cc (Target_sparc::sparc_info): Likewise.
3001         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
3002         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
3003         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
3004         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3005
3006 2013-07-22  Sterling Augustine  <saugustine@google.com>
3007
3008         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
3009         Convert parameter shndx to local variable. Add parameters symtab
3010         and symtab_size.  Scan over section names.  Find relocation
3011         section corresponding to current section.  Create and initialize
3012         reloc_mapper_ and reloc_type_.
3013         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
3014         unit_length to off_t.  Initialize member unit_length_.  Fill in field
3015         cu_offset_.
3016         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
3017         Initialize new fields unit_length_ and cu_offset_.
3018         (Dwarf_pubnames_table::read_section): Update prototype.
3019         (Dwarf_pubnames_table::cu_offset): New member function.
3020         (Dwarf_pubnames_table::subsection_size): Likewise.
3021         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
3022         New fields.
3023         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
3024         member functions public.
3025         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
3026         Update comment.  Rework logic.  Move repeated parts to...
3027         (Gdb_index_info_reader::read_pubtable): ...here. New function.
3028         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
3029         pubtypes_table_, and stmt_list_offset.
3030         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
3031         Gdb_index::find_pubtype_offset,
3032         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
3033         (Gdb_index::pubnames_read): Update prototype and rework logic.
3034         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
3035         Forward declare.
3036         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
3037         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
3038         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
3039         Gdb_index::map_pubtable_to_dies):
3040         Declare functions.
3041         (Gdb_index::pubnames_read): Update declaration.
3042         (Gdb_index::Pubname_offset_map): New type.
3043         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
3044         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
3045         Gdb_index::stmt_list_offset): Declare.
3046         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
3047         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
3048         Gdb_index::pubtypes_offset_): Remove.
3049
3050 2013-07-19  Roland McGrath  <mcgrathr@google.com>
3051
3052         * options.h (General_options): Add -Trodata-segment option.
3053         * parameters.cc (Parameters::check_rodata_segment): New function.
3054         (Parameters::set_target_once): Call it.
3055         * parameters.h (Parameters): Declare it (private member function).
3056         * layout.cc (load_seg_unusable_for_headers): New function, broken
3057         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
3058         then validate rodata segment rather than text segment.
3059         (relaxation_loop_body): Call that.
3060         (is_text_segment): New function.  Don't admit a non-executable
3061         segment if TARGET->isolate_execinstr().
3062         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
3063
3064 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
3065
3066         PR gold/15070
3067         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
3068         * nacl.h (Sniff_file::View::View): Request aligned view.
3069
3070 2013-07-11  Cary Coutant  <ccoutant@google.com>
3071
3072         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
3073         correct BRLT entry size.
3074
3075 2013-07-03  Alan Modra  <amodra@gmail.com>
3076
3077         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
3078         comment.
3079
3080 2013-07-01  Cary Coutant  <ccoutant@google.com>
3081
3082         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
3083         reloc_type_.
3084         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
3085         (Dwarf_ranges_table::lookup_reloc): New function.
3086         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
3087         reloc_type_.
3088         (Dwarf_ranges_table::lookup_reloc): New function.
3089         (Dwarf_ranges_table::reloc_type_): New data member.
3090
3091 2013-06-27  Jing Yu  <jingyu@google.com>
3092
3093         PR gold/15662
3094         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
3095         function.
3096         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
3097         (Target_powerpc::do_relax): Call the above.
3098
3099 2013-06-27  Cary Coutant  <ccoutant@google.com>
3100
3101         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
3102         on garbage collected .opd section.
3103
3104 2013-06-27  Alan Modra  <amodra@gmail.com>
3105
3106         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
3107         is non-zero.
3108         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
3109         (Target_powerpc::do_function_location): Likewise for loc->shndx.
3110
3111 2013-06-14  Cary Coutant  <ccoutant@google.com>
3112
3113         * resolve.cc (Symbol::override_base): Don't override st_type
3114         from plugin placeholder symbols.
3115         (Symbol_table::resolve): Likewise.
3116         (Symbol_table::should_override): Don't complain about TLS mismatch
3117         if the TO symbol is a plugin placeholder.
3118         * testsuite/Makefile.am (plugin_test_tls): New test.
3119         * testsuite/Makefile.in: Regenerate.
3120         * testsuite/plugin_test_tls.sh: New test script.
3121         * testsuite/two_file_test_2_tls.cc: New test source.
3122         * testsuite/two_file_test_tls.cc: New test source.
3123
3124 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3125
3126         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
3127         the maximum segment alignment is larger than the page size.
3128         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
3129         correctly aligns the symbols with large alignemnt.
3130         * testsuite/Makefile.in: Regenerate.
3131         * testsuite/large_symbol_alignment.cc: New file.
3132
3133 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3134             Sriraman Tallam  <tmsriram@google.com>
3135
3136         * options.h (sort_section): New option.
3137         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
3138         Rename from Input_section_sort_section_name_special_ordering_compare.
3139         (Input_section_sort_section_name_compare): New struct.
3140         * output.cc (Output_section::Input_section_sort_section_name_compare::
3141         operator()): New function.
3142         (Output_section::sort_attached_input_sections): Use new sort function
3143         for .text if --sort-section=name is specified.
3144         * layout.cc (Layout::make_output_section):
3145         Add sorting by name when --sort-section=name is specified.
3146         * testsuite/Makefile.am (text_section_grouping): Test option
3147         --sort-section=name.
3148         * testsuite/Makefile.in: Regenerate.
3149         * testsuite/section_sorting_name.cc: New file.
3150         * testsuite/section_sorting_name.sh: New file.
3151
3152 2013-05-21  Cary Coutant  <ccoutant@google.com>
3153
3154         * symtab.h (Symbol::is_cxx_vtable): New function.
3155         * target-reloc.h (relocate_section): Check for vtable symbol.
3156         * testsuite/Makefile.am (missing_key_func.sh): New test case.
3157         * testsuite/Makefile.in: Regenerate.
3158         * testsuite/missing_key_func.cc: New test source.
3159         * testsuite/missing_key_func.sh: New test script.
3160
3161 2013-05-21  Cary Coutant  <ccoutant@google.com>
3162
3163         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
3164         type of enclosing symbol.
3165         (Relocate_info::location): Check symbol type when describing symbol.
3166         * object.h (Symbol_location_info): Remove unused line_number;
3167         add enclosing_symbol_type.
3168         * testsuite/debug_msg.sh: Adjust expected output.
3169
3170 2013-05-13  Cary Coutant  <ccoutant@google.com>
3171
3172         * configure.ac: Export DEFAULT_TARGET.
3173         * configure: Regenerate.
3174         * Makefile.in: Regenerate.
3175         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
3176         * testsuite/Makefile.in: Regenerate.
3177         * testsuite/debug_msg.sh: Delete duplicate tests.
3178         Don't check undef_int error message match for powerpc where the
3179         source file and line number aren't available.
3180
3181 2013-05-10  Roland McGrath  <mcgrathr@google.com>
3182
3183         * options.h (General_options): Add --rosegment-gap option.
3184         * options.cc (finalize): --rosegment-gap implies --rosegment.
3185         * layout.cc (set_segment_offsets): Let user option override
3186         target->rosegment_gap().
3187
3188 2013-05-10  Roland McGrath  <mcgrathr@google.com>
3189
3190         * options.h (General_options): Remove leading space from help
3191         messages for -nostdlib and --rosegment.
3192
3193 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
3194
3195         PR ld/15365
3196         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
3197
3198 2013-05-03  Alan Modra  <amodra@gmail.com>
3199
3200         * merge.cc (Output_merge_string::do_add_input_section): Correct
3201         scan for number of strings.  Rename vars to avoid shadowing.
3202         Include missing terminator in input_size_.
3203
3204 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
3205
3206         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
3207         Restore empty string handling.
3208
3209 2013-05-01  Cary Coutant  <ccoutant@google.com>
3210
3211         * stringpool.cc (Stringpool_template::new_key_offset): Fix
3212         uninitialized warning.
3213
3214 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3215
3216         * output.cc (Output_section::add_merge_input_section): Allow
3217         to merge sections if the alignment is more than character size.
3218         * merge.h (Output_merge_string::Output_merge_string): Remove
3219         assert.
3220         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
3221         only not-null strings. Check the alignment of strings.
3222         * stringpool.h
3223         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
3224         alignment as the argument.
3225         (Stringpool_template<Stringpool_char>::addralign_): New class member.
3226         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
3227         Align non-zero length strings according to the addralign_.
3228         (Stringpool_template<Stringpool_char>::set_string_offsets):
3229         Updating offsets according to the given alignment.
3230         * testsuite/Makefile.am (text_section_grouping): Test if string
3231         literals are getting merged.
3232         * testsuite/Makefile.in: Regenerate.
3233         * testsuite/merge_string_literals_1.c: New file.
3234         * testsuite/merge_string_literals_2.c: Ditto.
3235         * testsuite/merge_string_literals.sh: Ditto.
3236
3237 2013-04-26  Ian Lance Taylor  <iant@google.com>
3238
3239         * target-reloc.h (relocate_section): If the reloc offset is out of
3240         range, pass VIEW as NULL to relocate.relocate.
3241         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
3242         * i386.cc (Target_i386::Relocate::relocate): Likewise.
3243         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
3244         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
3245         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
3246         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3247
3248 2013-04-26  Geoff Pike  <gpike@chromium.org>
3249
3250         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
3251         * layout.cc (Hash_task): New class.
3252         (Layout::queue_build_id_tasks): New function.
3253         (Layout::write_build_id): Handle single-thread portion of build ID
3254         computation.  (In some cases, all of it is single-threaded.)  Replace
3255         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
3256         functionality in fewer lines of code.
3257         * layout.h (Layout::queue_build_id_tasks): New function declaration.
3258         * options.h (General_options): make "--build-id" default to tree
3259         rather than sha1.  Add two new options related to --build-id=tree:
3260         --build-id-chunk-size-for-treehash and
3261         --build-id-min-file-size-for-treehash.
3262         * Makefile.am: add testing of --build-id=tree and related new options
3263         (these tests will be invoked by "make check").
3264         * Makefile.in: Regenerate.
3265
3266 2013-04-25  Alan Modra  <amodra@gmail.com>
3267
3268         * configure.tgt: Add powerpcle and powerpc64le.
3269
3270 2013-04-22  Alan Modra  <amodra@gmail.com>
3271
3272         PR gold/15355
3273         * layout.cc (Layout::segment_precedes): Allow more than one
3274         segment with the same type and flags.
3275
3276 2013-04-15  Cary Coutant  <ccoutant@google.com>
3277
3278         * layout.cc (Layout::set_relocatable_section_offsets): Don't
3279         allocate space in file for BSS sections.
3280
3281 2013-04-15  Cary Coutant  <ccoutant@google.com>
3282
3283         * script-sections.cc (Orphan_output_section): Reset address
3284         to zero after each orphaned section for relocatable links.
3285
3286 2013-04-15  Cary Coutant  <ccoutant@google.com>
3287
3288         * symtab.cc (Symbol_table::sized_write_globals): Subtract
3289         section starting address for relocatable link.
3290         * testsuite/Makefile.am (script_test_11): New test.
3291         * testsuite/Makefile.in: Regenerate.
3292         * testsuite/script_test_11.c: New source file.
3293         * testsuite/script_test_11.t: New linker script.
3294
3295 2013-04-13  Alan Modra  <amodra@gmail.com>
3296
3297         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
3298         owner when sections are not adjacent and exceed group size.
3299         (Target_powerpc::group_sections): Handle corner case.
3300         (Target_powerpc::Branch_info::make_stub): Handle case where
3301         stub table doesn't exist due to branches in non-exec sections.
3302         (Target_powerpc::Relocate::relocate): Likewise.
3303
3304 2013-04-11  Alan Modra  <amodra@gmail.com>
3305
3306         PR gold/15354
3307         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
3308         .branch_lt to match bfd ld.  Adjust comments throughout file.
3309
3310 2013-04-04  Ian Lance Taylor  <iant@google.com>
3311
3312         GCC PR c++/56840
3313         * object.cc (do_layout_deferred_sections): Handle .eh_frame
3314         sections before checking whether they are included in the link.
3315
3316 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
3317
3318         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
3319         object before calling the plugin claim_file handler.  Pass the elf
3320         object of the archive to the plugin. Delete the elf object if the
3321         plugin claims the file.
3322
3323 2013-03-21  Alan Modra  <amodra@gmail.com>
3324
3325         * layout.cc (Layout::set_segment_offsets): Accept writable .text
3326         segment when omagic.
3327
3328 2013-03-21  Alan Modra  <amodra@gmail.com>
3329
3330         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
3331         comparison warning.
3332         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
3333         uninitialized" warning.
3334
3335 2013-03-20  Alan Modra  <amodra@gmail.com>
3336
3337         * symtab.h (Symbol::clear_version): New function.
3338         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
3339         is_needed by weak references.  Clear version for symbols defined
3340         in as-needed objects that are not needed.
3341
3342 2013-03-15  Alan Modra  <amodra@gmail.com>
3343
3344         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
3345         static and public.  Add report_err param.  Return false for data refs.
3346         (Target_powerpc::rela_dyn_section): New overloaded function.
3347         (Target_powerpc::plt_, iplt_): Elucidate.
3348         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
3349         (Output_data_plt_powerpc::do_write): Don't write .iplt.
3350         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
3351         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
3352         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
3353         push_branch and make_plt_entry for ifunc syms when
3354         reloc_needs_plt_for_ifunc.
3355         (Target_powerpc::Relocate::relocate): Don't use plt entry value
3356         for ifunc unless reloc_needs_plt_for_ifunc.
3357
3358 2013-03-15  Alan Modra  <amodra@gmail.com>
3359
3360         * gc.h (gc_process_relocs): Don't look through function descriptors.
3361         * icf.cc (get_section_contents): Do so here instead.
3362
3363 2013-03-13  Alan Modra  <amodra@gmail.com>
3364
3365         * powerpc.cc (is_branch_reloc): Forward declare.
3366         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
3367         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
3368         false for 64-bit, true for 32-bit non-branch relocs.
3369         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
3370         * testsuite/Makefile.am (icf_test): Use linker map file instead of
3371         nm output.
3372         (icf_safe_test): Generate linker map file as well as nm output.
3373         (icf_safe_so_test): Likewise.
3374         * testsuite/Makefile.in: Regenerate.
3375         * testsuite/icf_test.sh: Parse linker map file to determine
3376         section folding.
3377         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
3378         * testsuite/icf_safe_so_test.sh: Likewise.
3379         (X86_32_or_ARM_specific_safe_fold): Merge into..
3380         (arch_specific_safe_fold): ..this.
3381         (X86_64_specific_safe_fold): Delete unused function.
3382
3383 2013-03-12  Alan Modra  <amodra@gmail.com>
3384
3385         * gc.h (gc_process_relocs): Look through function descriptors
3386         to determine shndx, symvalue and addend used by ICF.  Tidy
3387         variable duplication.
3388
3389 2013-03-11  Alan Modra  <amodra@gmail.com>
3390
3391         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
3392         * layout.cc (Layout_task_runner::run): ..to here.
3393         * symtab.h (struct Symbol_location): Extract from..
3394         (class Symbol_table): ..here.
3395         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
3396         * target.h (class Target): Add function_location and
3397         do_function_location functions.
3398         (class Sized_target): Add do_function_location.
3399         * object.h (class Sized_relobj_file): Move find_shdr..
3400         (class Object): ..to here.
3401         * object.cc: Likewise.  Update to suit.  Instantiate.
3402         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
3403         * powerpc.cc (class Powerpc_dynobj): New.
3404         (Target_powerpc::do_function_location): New function.
3405         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
3406         (Powerpc_dynobj::do_read_symbols): New function.
3407         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
3408
3409 2013-03-08  Ian Lance Taylor  <iant@google.com>
3410
3411         * options.cc (General_options::string_to_object_format): Accept
3412         "default".
3413
3414 2013-03-08  Alan Modra  <amodra@gmail.com>
3415
3416         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
3417         pointer to Post_fde.
3418         (struct Post_fde): Move definition to here..
3419         * ehframe.cc (struct Post_fde): ..from here.
3420         (Cie::write): Don't alloc Post_fde.
3421         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
3422
3423 2013-03-07  Alan Modra  <amodra@gmail.com>
3424
3425         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
3426         relocation referencing .LC0.
3427         * testsuite/discard_locals_test.sh: Remove FIXMEs.
3428
3429 2013-03-07  Alan Modra  <amodra@gmail.com>
3430
3431         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
3432         always_inline.  Add assembly for powerpc to avoid GOT.
3433
3434 2013-03-07  Alan Modra  <amodra@gmail.com>
3435
3436         * testsuite/script_test_10.sh: Don't test .bss section
3437         header number.
3438
3439 2013-03-06  Alan Modra  <amodra@gmail.com>
3440
3441         * powerpc.cc (class Powerpc_relobj): Move some member functions.
3442         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
3443         all callers.  Handle folded sections.
3444         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
3445         to Powerpc_relobj.
3446         (Global_symbol_visitor_opd::operator()): Likewise.
3447
3448 2013-03-04  Alan Modra  <amodra@gmail.com>
3449
3450         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
3451         * testsuite/Makefile.in: Regenerate.
3452
3453 2013-03-01  Cary Coutant  <ccoutant@google.com>
3454
3455         Add dwp support for v2 DWARF package file format.
3456         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
3457         tu_length parameter.  Adjust all callers.
3458         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
3459         * dwp.cc: Include dwarf.h.
3460         (Section_bounds): New struct type.
3461         (Unit_set): New struct type.
3462         (Dwo_file::Dwo_file): Initialize new data member.
3463         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
3464         Combine and rename to...
3465         (Dwo_file::read_unit_index): ...this.
3466         (Dwo_file::sized_read_compunit_index)
3467         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
3468         (Dwo_file::sized_read_unit_index): ...this.
3469         (Dwo_file::copy_section): Remove section_name, is_str_offsets
3470         parameters; add section_id parameter.
3471         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
3472         (Dwo_file::add_unit_set): ...this.
3473         (Dwo_file::shndx_map_): Remove.
3474         (Dwo_file::sect_offsets_): New data member.
3475         (Dwp_output_file::Dwp_output_file): Initialize new data members.
3476         (Dwp_output_file::add_section): Rename to...
3477         (Dwp_output_file::add_contribution): ...this.
3478         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
3479         (Dwp_output_file::add_tu_set): Likewise.
3480         (Dwp_output_file::Contribution): New type.
3481         (Dwp_output_file::Section::contributions): New data member.
3482         (Dwp_output_file::Cu_or_tu_set): Remove.
3483         (Dwp_output_file::Section::Section): New ctor.
3484         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
3485         (Dwp_output_file::Dwp_index::Section_table): New type.
3486         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
3487         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
3488         parameter.
3489         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
3490         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
3491         (Dwp_output_file::Dwp_index::section_table): New member function.
3492         (Dwp_output_file::Dwp_index::section_table_end): New member function.
3493         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
3494         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
3495         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
3496         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
3497         (Dwp_output_file::Dwp_index::section_table_): New data member.
3498         (Dwp_output_file::Dwp_index::section_mask_): New data member.
3499         (Dwp_output_file::add_output_section): New member function.
3500         (Dwp_output_file::write_new_section): New member function.
3501         (Dwp_output_file::write_contributions): New member function.
3502         (Dwp_output_file::section_id_map_): New data member.
3503         (class Dwo_id_info_reader): Remove.
3504         (class Unit_reader): New class.
3505         (get_dwarf_section_name): New function.
3506         (Dwo_file::read_executable): Adjust initializations of class data.
3507         (Dwo_file::read): Add support for v2 package file format.
3508         (Dwo_file::read_unit_index): Likewise.
3509         (Dwo_file::sized_read_unit_index): Likewise.
3510         (Dwo_file::copy_section): Likewise.
3511         (Dwo_file::add_unit_set): Likewise.
3512         (Dwp_output_file::add_output_section): Likewise.
3513         (Dwp_output_file::add_contribution): Likewise.
3514         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
3515         for empty slot.
3516         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
3517         file format.
3518         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
3519         slot.
3520         (Dwp_output_file::initialize): Remove unused function.
3521         (Dwp_output_file::finalize): Add support for v2 package file format.
3522         (Dwp_output_file::write_index): Likewise.
3523         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
3524         function prototype.
3525
3526 2013-03-01  Cary Coutant  <ccoutant@google.com>
3527
3528         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
3529         function into class definition in header file.
3530         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
3531         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
3532         New function.
3533         (Dwarf_info_reader::check_buffer): Move here from .cc file.
3534
3535 2013-02-28  Alan Modra  <amodra@gmail.com>
3536
3537         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
3538         * target.cc (Target::do_plt_fde_location): New function.
3539         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
3540         accessor function, and constructor param.
3541         (struct Post_fde, Post_fdes): Declare.
3542         (Cie::write): Add post_fdes param.
3543         * ehframe.cc (Fde::write): Use plt_fde_location.
3544         (struct Post_fde): Define.
3545         (Cie::write): Stash FDEs added post merge mapping.
3546         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
3547         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
3548         (Eh_frame::do_sized_write): Arrange to write post map FDES after
3549         other FDEs.
3550         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
3551         (Target_powerpc::has_glink): New function.
3552         (Target_powerpc::do_relax): Add eh_frame info for stubs.
3553         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
3554         glink_eh_frame_fde_32, default_fde): New data.
3555         (Stub_table::eh_frame_added_): New var.
3556         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
3557         Make const.
3558         (Stub_table::add_eh_frame): New function.
3559         (Output_data_glink::add_eh_frame): New function.
3560         (Target_powerpc::make_glink_section): Call add_eh_frame.
3561
3562 2013-02-15  Ian Lance Taylor  <iant@google.com>
3563
3564         * options.h (DEFINE_uint64_alias): Define.
3565         (class General_options): Add -Ttext-segment as an alias for
3566         -Ttext.
3567
3568 2013-02-15  Alan Modra  <amodra@gmail.com>
3569
3570         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
3571         (Stub_table::do_write): ..here, two places.
3572         (Stub_table::plt_call_size): Use it here too.
3573
3574 2013-02-11  Ian Lance Taylor  <iant@google.com>
3575
3576         * descriptors.cc (Descriptors::close_all): New function.
3577         * descriptors.h (class Descriptors): Declare close_all.
3578         (close_all_descriptors): New inline function.
3579         * plugin.cc: Include "descriptors.h".
3580         (Plugin_manager::cleanup): Call close_all_descriptors.
3581
3582 2013-02-06  Alan Modra  <amodra@gmail.com>
3583
3584         * README: Update coding style link.
3585
3586 2013-01-28  Cary Coutant  <ccoutant@google.com>
3587
3588         * dwp.cc (File_list): New typedef.
3589         (Dwo_name_info_reader): New class.
3590         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
3591         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
3592         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
3593         (Dwo_file::read_executable): New function.
3594         (Dwo_file::read): Move common setup code to ...
3595         (Dwo_file::make_object): ... here.
3596         (dwp_options): Add --exec/-e.
3597         (usage): Likewise.
3598         (main): Likewise.
3599
3600 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
3601
3602         * layout.cc (Layout::layout): Check for option text_reorder.
3603         (Layout::make_output_section): Ditto.
3604         * options.h (text_reorder): New option.
3605         * output.cc (Input_section_sort_compare): Remove special ordering
3606         of section names.
3607         (Output_section::
3608          Input_section_sort_section_name_special_ordering_compare::
3609          operator()): New function.
3610         (Output_section::sort_attached_input_sections): Use new sort function
3611         for .text.
3612         * output.h (Input_section_sort_section_name_special_ordering_compare):
3613         New struct.
3614         * testsuite/Makefile.am (text_section_grouping): Test option
3615         --no-text-reorder
3616         * testsuite/Makefile.in: Regenerate.
3617         * testsuite/text_section_grouping.sh: Check order of functions without
3618         default text reordering.
3619
3620 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3621
3622         * options.h (General_options): Change default to true for new_dtags.
3623
3624 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3625
3626         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
3627         when enable_new_dtags is false.  Only add DT_RUNPATH when
3628         enable_new_dtags is true.
3629
3630 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
3631
3632         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
3633         used in declaration and definition consistent.
3634         (Target_powerpc::symval_for_branch): Ditto.
3635
3636 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3637
3638         * testsuite/plugin_final_layout.cc: Fix comment.
3639
3640 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3641
3642         * layout.cc (Layout::layout): Do not do default sorting for
3643         text sections when section ordering is specified.
3644         (make_output_section): Ditto.
3645         * testsuite/plugin_final_layout.cc: Name the function sections
3646         to catch reordering issues.
3647
3648 2013-01-15  Alan Modra  <amodra@gmail.com>
3649
3650         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
3651         plt-thread-safe.
3652
3653 2013-01-15  Alan Modra  <amodra@gmail.com>
3654
3655         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
3656         * testsuite/Makefile.in: Regenerate.
3657
3658 2013-01-14  Alan Modra  <amodra@gmail.com>
3659
3660         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
3661         * testsuite/Makefile.in: Regenerate.
3662
3663 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
3664
3665         PR bfd/14430
3666         Fix mingw gold build with plugins enabled
3667         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
3668         * configure.ac: Export DLOPEN_LIBS and add headers check.
3669         * plugin.cc: Handle non-dlfcn case.
3670         * Makefile.in: Regenerate.
3671         * config.in: Regenerate.
3672         * configure: Regenerate.
3673         * testsuite/Makefile.in: Regenerate.
3674
3675 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
3676
3677         * output.h (sort_attached_input_sections): Change to be public.
3678         * script-sections.cc
3679         (Output_section_definition::set_section_addresses): Sort
3680         attached input sections according to section order before linker
3681         script assigns section addresses.
3682         (Orphan_output_section::set_section_addresses): Sort
3683         attached input sections according to section order before linker
3684         script assigns section addresses.
3685         * Makefile.am (final_layout.sh): Use a simple linker script to
3686         check if section ordering still works.
3687         * Makefile.in: Regenerate.
3688
3689 2013-01-09  Ben Cheng  <bccheng@google.com>
3690
3691         * arm.cc (Target_arm::attributes_accept_div): New function.
3692         (Target_arm::attributes_forbid_div): New function.
3693         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
3694         attribute using the same new functions as what bfd/elf32_arm.c
3695         does.
3696
3697 2013-01-07  Cary Coutant  <ccoutant@google.com>
3698
3699         PR gold/14993
3700         * output.cc (Output_section::add_input_section): For incremental
3701         updates, don't track input sections that are allocated from patch
3702         space.
3703
3704 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3705             Ian Lance Taylor  <iant@google.com>
3706
3707         PR gold/14897
3708         * configure.ac (--enable-ld): Removed.
3709         (install_as_default): Set to yes only for --enable-gold=default
3710         or --disable-ld.
3711         * configure: Regenerated.
3712
3713 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3714
3715         * options.h (General_options): Add -fuse-ld= for GCC linker
3716         option compatibility.
3717
3718 2013-01-04  Cary Coutant  <ccoutant@google.com>
3719
3720         * configure.ac: Fix typo restoring CXXFLAGS.
3721         * configure: Regenerate.
3722
3723 2013-01-04  Cary Coutant  <ccoutant@google.com>
3724
3725         * testsuite/Makefile.am (CXXLINK_S): New macro.
3726         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
3727         * testsuite/Makefile.in: Regenerate.
3728
3729 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
3730
3731         * version.cc (print_version): Update copyright year to 2013.
3732
3733 2012-12-20  Ian Lance Taylor  <iant@google.com>
3734
3735         * layout.cc (Layout::special_ordering_of_input_section): New
3736         function.
3737         (Layout::layout): If input section requires special ordering, must
3738         sort input sections.
3739         (Layout::make_output_section): May sort .text input sections.
3740         (Layout::is_section_name_prefix_grouped): Remove.
3741         * layout.h (class Layout): Declare
3742         special_ordering_of_input_section.  Don't declare
3743         is_section_name_prefix_grouped.
3744         * output.cc (Output_section::add_input_section): Revert last
3745         change.
3746         (Output_section::Input_section_sort::match_file_name): Don't crash
3747         if called on output section data.
3748         (Output_section::Input_section_sort_compare): Sort based on
3749         special ordering.
3750         (Output_section::Input_section_sort_section_order_index_compare):
3751         Revert last patch.
3752         (Output_section::sort_attached_input_sections): Likewise.
3753
3754 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
3755
3756         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
3757         * layout.h (Layout::is_section_name_prefix_grouped): New function.
3758         * output.cc (Output_section::add_input_section): Check if section
3759         name contains special prefix.  Keep input sections to sort such
3760         sections.
3761         (Output_section::Input_section_sort_section_order_index_compare
3762          ::operator()): Group sections according to prefixes.
3763         (Output_section::sort_attached_input_sections): Add condition to
3764         Input_section_entry constructor call.
3765         * testsuite/Makefile.am (text_section_grouping): New test.
3766         * testsuite/Makefile.in: Regenerate.
3767         * testsuite/text_section_grouping.cc: New file.
3768         * testsuite/text_section_grouping.sh: New file.
3769
3770 2012-12-17  Nick Clifton  <nickc@redhat.com>
3771
3772         * Makefile.am: Add copyright notice.
3773         * NEWS: Likewise.
3774         * README: Likewise.
3775         * configure.ac: Likewise.
3776         * ftruncate.c: Likewise.
3777         * Makefile.in: Regenerate.
3778
3779 2012-12-14  Cary Coutant  <ccoutant@google.com>
3780
3781         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
3782         --no-as-needed flag.
3783         (exception_separate_shared_12_test): Likewise.
3784         (incremental_copy_test): Likewise.
3785         * testsuite/Makefile.in: Regenerate.
3786
3787 2012-12-14  Cary Coutant  <ccoutant@google.com>
3788
3789         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
3790         (Dwp_output_file::Dwp_index::enter_set): Add assert.
3791
3792 2012-12-12  Alan Modra  <amodra@gmail.com>
3793
3794         * powerpc.cc (class Track_tls): New.
3795         (class Relocate, class Scan): Inherit Track_tls.
3796         (Target_powerpc::Scan::local, global): Track tls optimization
3797         and avoid creating plt entry for __tls_get_addr if all uses
3798         are optimized away.
3799         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
3800
3801 2012-12-12  Alan Modra  <amodra@gmail.com>
3802
3803         * options.h (General_options): Add --toc-sort/--no-toc-sort.
3804         Replace no_toc_optimize with toc_optimize.
3805         * output.h (Output_section::input_sections): Provide non-const variant.
3806         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
3807         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
3808         accessors.
3809         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
3810         (class Sort_toc_sections): New.
3811         (Target_powerpc::do_finalize_sections): Sort toc sections.
3812         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
3813
3814 2012-12-10  Roland McGrath  <mcgrathr@google.com>
3815
3816         * testsuite/binary_unittest.cc (read_all): New function.
3817         (Sized_binary_test): Use it instead of ::read.
3818         * fileread.cc (do_read): Don't assume pread always reads the whole
3819         amount in a single call.
3820
3821 2012-12-10  Alan Modra  <amodra@gmail.com>
3822
3823         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
3824         Set EM_PPC64 or EM_PPC here.
3825         (Target_selector_powerpc::do_recognize): Delete.
3826
3827 2012-12-10  Alan Modra  <amodra@gmail.com>
3828
3829         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
3830         stub_table_.
3831         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
3832
3833 2012-12-07  Roland McGrath  <mcgrathr@google.com>
3834
3835         * testsuite/binary_unittest.cc (Sized_binary_test):
3836         Use open_descriptor rather than ::open.
3837
3838 2012-12-07  Alan Modra  <amodra@gmail.com>
3839
3840         * powerpc.cc (Stub_table::do_write): Delete redundant Address
3841         typedef and invalid_address constant.
3842         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
3843         instantiate constants.
3844
3845 2012-12-06  Roland McGrath  <mcgrathr@google.com>
3846
3847         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
3848         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
3849         * aclocal.m4: Regenerate.
3850         * configure: Regenerate.
3851         * Makefile.in: Regenerate.
3852         * testsuite/Makefile.in: Regenerate.
3853
3854 2012-12-07  Alan Modra  <amodra@gmail.com>
3855
3856         * options.h (General_options): Add no_toc_optimize.
3857         * powerpc.cc (ok_lo_toc_insn): New function.
3858         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
3859
3860 2012-12-06  Alan Modra  <amodra@gmail.com>
3861
3862         * options.h (General_options): Add plt_align, plt_static_chain,
3863         plt_thread_safe.  Update stub_group_size help text.
3864         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
3865         for new plt_thread_safe_ var.
3866         (use_plt_offset): Correct comments.
3867         (Target_powerpc::do_relax): Look for thread creation symbols to
3868         determine default plt_thread_safe value.  Clear plt call stubs
3869         as well as branch stubs each iteration.
3870         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
3871         insn constants.
3872         (l, hi, ha, write_insn): Move earlier.
3873         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
3874         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
3875         plt stubs too.
3876         (Stub_table::update_size): Adjust.
3877         (Stub_table::prev_size, set_prev_size): Delete.
3878         (Stub_table::stub_align): Let --plt-align affect result.
3879         (Stub_table::plt_call_size): Calculate sizes for various stubs.
3880         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
3881         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
3882         (Stub_table::do_write): Support more stub variants.
3883
3884 2012-12-04  Alan Modra  <amodra@gmail.com>
3885
3886         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
3887         (Target_powerpc::do_define_standard_symbols): New function.
3888
3889 2012-12-03  Alan Modra  <amodra@gmail.com>
3890
3891         * output.h: Formatting, whitespace.
3892
3893 2012-12-03  Alan Modra  <amodra@gmail.com>
3894
3895         * layout.h (Layout::get_executable_sections): Declare.
3896         * layout.cc (Layout::get_executable_sections): New function.
3897         * arm.cc (Target_arm::group_sections): Use it.
3898         (Arm_output_section::group_sections): Delete now redundant test.
3899         * output.cc (Output_reloc::Output_reloc): Add is_relative.
3900         param to handle relative relocs.
3901         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
3902         (Output_data_reloc::add_absolute): Adjust.
3903         (Output_data_reloc::add_relative): New function.
3904         (Output_data::reset_data_size): New function.
3905         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
3906         (Output_section::set_addralign): New function.
3907         (Output_section::checkpoint_set_addralign): New function.
3908         (Output_section::clear_section_offsets_need_adjustment): New function.
3909         (Output_section::input_sections): Make public.
3910         * powerpc.cc (class Output_data_brlt_powerpc): New.
3911         (class Stub_table, class Stub_control): New.
3912         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
3913         stub_table_, set_stub_table, stub_table): New vectors and accessor
3914         functions.
3915         (Target_powerpc::do_may_relax, do_relax, push_branch,
3916         new_stub_table, stub_tables, brlt_section, group_sections,
3917         add_branch_lookup_table, find_branch_lookup_table,
3918         write_branch_lookup_table, make_brlt_section): New functions.
3919         (Target_powerpc::struct Sort_sections, class Branch_info): New.
3920         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
3921         branch_info_): New vars.
3922         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
3923         make call stubs here.
3924         (Output_data_glink): Remove all call stub handling from this class.
3925         (Target_powerpc::Scan::local, global): Save interesting branch
3926         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
3927         (Target_powerpc::do_finalize_sections): Only make reg save/restore
3928         functions on final link.
3929         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
3930         Handle long branch destinations too.
3931         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
3932         do_plt_address_for_local): Adjust lookup of plt call stubs.
3933
3934 2012-11-30  Alan Modra  <amodra@gmail.com>
3935
3936         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
3937         relocs against protected symbols when building 32-bit shared libs.
3938
3939 2012-11-30  Alan Modra  <amodra@gmail.com>
3940
3941         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
3942         param.  Call got_section() to make .got.  Update all callers
3943         and their callers and so on.
3944
3945 2012-11-30  Alan Modra  <amodra@gmail.com>
3946
3947         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
3948         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
3949         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
3950         value if it already exists.
3951
3952 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
3953
3954         PR gold/14858
3955         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
3956
3957 2012-11-14  Roland McGrath  <mcgrathr@google.com>
3958
3959         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
3960         than bfc instruction for data sandboxing.
3961
3962 2012-11-08  Alan Modra  <amodra@gmail.com>
3963
3964         * po/POTFILES.in: Regenerate.
3965
3966 2012-11-05  Alan Modra  <amodra@gmail.com>
3967
3968         * configure.ac: Apply 2012-09-10 change to config.in here.
3969         * configure: Regenerate.
3970
3971 2012-11-05  Alan Modra  <amodra@gmail.com>
3972
3973         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
3974         (struct Opd_ent): Use "Address" rather than "Offset".
3975         (Output_data_got_powerpc::got_base_offset): Return Valtype.
3976         (Target_powerpc::got_section): Make public.
3977         (Target_powerpc::scan_relocs): Move code setting symbols..
3978         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
3979         Create _SDA_BASE_ only when referenced.
3980
3981 2012-11-02  Roland McGrath  <mcgrathr@google.com>
3982
3983         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
3984         from last change.
3985
3986 2012-11-01  Roland McGrath  <mcgrathr@google.com>
3987
3988         * target.h (Sized_target::relocate_relocs): Use Elf_Off
3989         for offset_in_output_section parameter.
3990         (Sized_target::relocate_special_relocatable): Likewise.
3991         * arm.cc (Target_arm::relocate_relocs): Likewise.
3992         (Target_arm::relocate_special_relocatable): Likewise.
3993         * i386.cc (Target_i386::relocate_relocs): Likewise.
3994         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
3995         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
3996         * target-reloc.h (relocate_relocs): Likewise.
3997         * testsuite/testfile.cc (Target_test): Likewise.
3998         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
3999         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
4000
4001         * system.h: Move inclusion of <clocale> to after <libintl.h> in
4002         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
4003
4004         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
4005         parameter, which is unused in the [!F_SETFD] case.
4006
4007         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
4008         SYMNDX to off_t before comparing it to this->data_size().
4009         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
4010         * incremental.cc (Output_section_incremental_inputs::do_write):
4011         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
4012
4013         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
4014
4015 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
4016
4017         * gold.cc (Target_arm::do_adjust_elf_header): Add the
4018         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
4019         in EABI_VER5.
4020
4021 2012-10-29  Cary Coutant  <ccoutant@google.com>
4022
4023         * dwp.cc (usage): Add file and exit status parameters;
4024         add --help and --version options.
4025         (print_version): New function.
4026         (main): Add --help and --version options.
4027
4028 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4029
4030         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
4031         final_layout_sequence.txt.
4032         * testsuite/Makefile.in: Regenerated.
4033
4034 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4035
4036         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
4037         COMPILE generated by automake.
4038         (LINK1): Likewise.
4039         (CXXCOMPILE1): Likewise.
4040         (CXXLINK1): Likewise.
4041         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
4042         (LINK): Likewise.
4043         (CXXCOMPILE): Likewise.
4044         (CXXLINK): Likewise.
4045         * testsuite/Makefile.in: Regenerated.
4046
4047 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4048
4049         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
4050         on bad fwrite return.
4051
4052 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4053
4054         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
4055         on val.
4056
4057 2012-10-23  Cary Coutant  <ccoutant@google.com>
4058
4059         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
4060         * testsuite/Makefile.in: Regenerate.
4061         * testsuite/dwp_test.h: New source file.
4062         * testsuite/dwp_test_1.cc: New source file.
4063         * testsuite/dwp_test_1.s: New source file.
4064         * testsuite/dwp_test_1.sh: New source file.
4065         * testsuite/dwp_test_1b.cc: New source file.
4066         * testsuite/dwp_test_1b.s: New source file.
4067         * testsuite/dwp_test_2.cc: New source file.
4068         * testsuite/dwp_test_2.s: New source file.
4069         * testsuite/dwp_test_2.sh: New source file.
4070         * testsuite/dwp_test_main.cc: New source file.
4071         * testsuite/dwp_test_main.s: New source file.
4072
4073 2012-10-23  Cary Coutant  <ccoutant@google.com>
4074
4075         * dwp.h: New header file.
4076         * dwp.cc: New source file.
4077         * gold.h: Move shared declarations to system.h.
4078         * system.h: New header file.
4079         * Makefile.am: Add dwp.
4080         * Makefile.in: Regenerate.
4081
4082 2012-10-23  Cary Coutant  <ccoutant@google.com>
4083
4084         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
4085         Dwarf_info_reader::read_from_pointer.
4086         (Dwarf_pubnames_table::read_header): Likewise.
4087         (Dwarf_pubnames_table::next_name): Likewise.
4088         (Dwarf_die::read_attributes): Likewise.
4089         (Dwarf_die::skip_attributes): Likewise.
4090         (Dwarf_info_reader::read_from_pointer): New function template.
4091         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
4092         (Dwarf_pubnames_table): Likewise.
4093         (Dwarf_info_reader::read_from_pointer): New function template.
4094         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
4095         Dwarf_pubnames_table ctor.
4096
4097 2012-10-23  Cary Coutant  <ccoutant@google.com>
4098
4099         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
4100         abbrev_shndx.
4101         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
4102         abbrev_shndx_.
4103         (Dwarf_info_reader::set_abbrev_shndx): New method.
4104         (Dwarf_info_reader::abbrev_shndx_): New data member.
4105
4106 2012-10-23  Cary Coutant  <ccoutant@google.com>
4107
4108         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
4109         from object, not parameters.
4110         (Dwarf_info_reader::parse): Likewise.
4111         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
4112         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
4113         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
4114         methods.
4115
4116 2012-10-23  Cary Coutant  <ccoutant@google.com>
4117
4118         * fileread.cc (Input_file::Input_file): New constructor.
4119         * fileread.h (class Input_file): Add new constructor.
4120
4121 2012-10-18  Alan Modra  <amodra@gmail.com>
4122
4123         PR gold/14727
4124         * object.cc (Relobj::is_section_name_included): Also match
4125         .sdata personality section.
4126
4127 2012-10-18  Alan Modra  <amodra@gmail.com>
4128
4129         * target-reloc.h (class Default_comdat_behavior): New, package up..
4130         (get_comdat_behaviour): ..this.
4131         (relocate_section): Add Relocate_comdat_behavior template arg,
4132         adjust code to suit.
4133         * arm.cc (Target_arm::relocate_section): Adjust to suit.
4134         (Target_arm::scan_reloc_section): Likewise.
4135         * i386.cc (Target_i386::relocate_section): Likewise.
4136         * sparc.cc (Target_sparc::relocate_section): Likewise.
4137         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
4138         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
4139         * powerpc.cc (class Relocate_comdat_behavior): New.
4140         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
4141         gold::relocate_section with new template arg.
4142
4143 2012-10-18  Alan Modra  <amodra@gmail.com>
4144
4145         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
4146         dynamic relocs for GOT_TPREL got entries, without symbol if
4147         resolving locally.
4148         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
4149         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
4150         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
4151
4152 2012-10-17  Alan Modra  <amodra@gmail.com>
4153
4154         PR gold/14726
4155         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
4156
4157 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
4158
4159         * layout.cc (Layout::include_section): Keep sections marked
4160         SHF_EXCLUDE when doing relocatable links.
4161
4162 2012-10-16  Alan Modra  <amodra@gmail.com>
4163
4164         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
4165         (Target_powerpc::do_finalize_sections): Call it.
4166         (Output_data_save_res): New class and supporting functions.
4167         (Target_powerpc::symval_for_branch): Only look up .opd entry for
4168         normal symbols defined in object files.
4169
4170 2012-10-12  Alan Modra  <amodra@gmail.com>
4171
4172         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
4173         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
4174         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
4175         section if scan_opd_relocs not yet called.
4176         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
4177
4178 2012-10-12  Alan Modra  <amodra@gmail.com>
4179
4180         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
4181         add_local_ifunc_entry): Revert last change.
4182         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
4183
4184 2012-10-05  Alan Modra  <amodra@gmail.com>
4185
4186         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
4187         do_plt_address_for_global): New functions.
4188         (Output_data_got_powerpc::do_write): Don't segfault when linking
4189         statically.
4190         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
4191         add_local_ifunc_entry): Return true on adding entry..
4192         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
4193         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
4194         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
4195         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
4196         set up symbols here.
4197         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
4198         syms here.  Do so even when no .iplt.  Don't segfault when linking
4199         statically.
4200         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
4201         new variants without reloc param.
4202         (Glink_sym_ent::Glink_sym_ent): Likewise.
4203         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
4204         reloc when refs will resolve to plt call stub.
4205         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
4206         R_PPC_PLTREL24 to resolve locally.
4207         (Target_powerpc::Scan::global): Correct ifunc handling.
4208         (Target_powerpc::Relocate::relocate): Correct local sym glink
4209         lookup.  Don't destroy "value" when we have a plt call stub,
4210         and when checking plt call validity.
4211         (Target_powerpc::do_dynsym_value): Simplify.
4212
4213 2012-10-05  Alan Modra  <amodra@gmail.com>
4214
4215         * i386.cc (Output_data_plt_i386::address_for_global,
4216         address_for_local): Add plt offset to returned value.  Adjust uses.
4217         * sparc.cc (Output_data_plt_sparc::address_for_global,
4218         address_for_local): Likewise.
4219         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
4220         address_for_local): Likewise.
4221         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
4222         address_for_local): Likewise.
4223         * target.h (Target::plt_address_for_global, plt_address_for_local):
4224         Update comment.
4225         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
4226         (Output_data_got::Got_entry::write): Nor here.
4227         * output.h: Comment fix.
4228
4229 2012-10-02  Jiong Wang  <jiwang@tilera.com>
4230
4231         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
4232         global_offset_table_ value for larget got.
4233         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
4234
4235 2012-09-29  Alan Modra  <amodra@gmail.com>
4236
4237         * powerpc.cc (Target_powerpc::iplt_): New output section.
4238         (Target_powerpc::iplt_section, make_iplt_section,
4239         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
4240         (Target_powerpc::make_plt_entry): Handle ifunc syms.
4241         Target_powerpc::plt_entry_count): Count iplt entries too.
4242         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
4243         reloc section in constructor.  New params.
4244         (Target_powerpc::make_plt_section): Create reloc section here instead.
4245         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
4246         functions.
4247         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
4248         (Output_data_glink::add_entry, find_entry): New functions to
4249         deal with local syms.
4250         (Glink_sym_ent): Add support for local syms.
4251         (Output_data_glink::do_write): Handle ifunc plt entries.
4252         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4253         (Target_powerpc::Scan::local, global): Handle ifunc syms.
4254         (Target_powerpc::Relocate::relocate): Likewise.
4255         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
4256
4257 2012-09-25  Alan Modra  <amodra@gmail.com>
4258
4259         * object.h (Sized_relobj_file::adjust_local_symbol,
4260         do_adjust_local_symbol): New functions.
4261         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
4262         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
4263         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
4264         and irregular opd entry spacing.
4265         (Powerpc_relobj::do_read_relocs): Add opd size checks.
4266         (Global_symbol_visitor_opd): New functor.
4267         (Target_powerpc::do_finalize_sections): Omit global symbols defined
4268         on deleted opd entries.
4269
4270 2012-09-15  Jiong Wang  <jiwang@tilera.com>
4271
4272         * tilegx.cc: New file.
4273         * Makefile.am (TARGETSOURCES): Add tilegx.cc
4274         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
4275         * configure.tgt: Add entries for tilegx*.
4276         * configure.ac: Likewise.
4277         * Makefile.in: Rebuild.
4278         * configure: Likewise.
4279         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
4280         tilegx.
4281
4282 2012-09-13  Alan Modra  <amodra@gmail.com>
4283
4284         * target-reloc.h (scan_relocs): Call scan.local for relocs
4285         against symbols in discarded sections.  Pass is_discarded
4286         param.
4287         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
4288         Add is_discarded param.
4289         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
4290         is_discarded to flag opd entry as discarded.  Don't emit dyn
4291         relocs on such entries.
4292         (Target_powerpc::Scan::global): Similarly detect and handle
4293         such opd entries.
4294         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
4295         opd_ent_.  Update all uses.
4296         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
4297         (Target_powerpc::relocate_section): Zero out discarded opd
4298         entry relocs.
4299
4300 2012-09-12  Ian Lance Taylor  <iant@google.com>
4301
4302         PR gold/14570
4303         * output.cc: Rename Output_data_got template parameter from size
4304         to got_size for all functions.  Compile all variants of
4305         Output_data_got.
4306         (Output_data_got::Got_entry::write): Correct use of size for
4307         symbol value.  Use local_is_tls rather than casting to
4308         Sized_relobj_file.
4309         * object.h (class Object): Add local_is_tls and do_local_is_tls.
4310         (class Sized_relobj_file): Add do_local_is_tls.
4311         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
4312
4313 2012-09-11  Alan Modra  <amodra@gmail.com>
4314
4315         PR gold/14566
4316         * layout.cc (Layout::set_segment_offsets): When using
4317         common-page-size alignment, ensure we are on a new max-page-size
4318         page.
4319         * output.cc (Output_segment::set_section_addresses): Use
4320         abi_pagesize, not common_pagesize for relro boundary.
4321         (Output_segment::set_offset): Likewise.
4322
4323 2012-09-11  Alan Modra  <amodra@gmail.com>
4324
4325         * output.h (Output_data_got::add_global_tls, add_local_tls,
4326         add_local_tls_pair): New functions.
4327         (Output_data_got::add_local_pair_with_rel): Remove second
4328         reloc param.  Expand comment.
4329         (Output_data_got::Got_entry): Rename use_plt_offset_ to
4330         use_plt_or_tls_offset_, similarly for constructor param.
4331         (Output_data_got::Got_entry::write): Add got_index param.
4332         * output.cc (Output_data_got::add_global_tls, add_local_tls,
4333         add_local_tls_pair): New functions.
4334         (Output_data_got::Got_entry::write): Handle tls symbols
4335         with use_plt_or_tls_offset_ set specially.
4336         (Output_data_got::add_local_pair_with_rel): Only one reloc.
4337         (Output_data_got::do_write): Replace iterator with index, pass
4338         index to entry write function.
4339         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
4340         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
4341         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
4342         call.
4343         * i386.cc (Target_i386::Scan::local): Likewise.
4344         * sparc.cc (Target_sparc::Scan::local): Likewise.
4345         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
4346         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
4347         do_tls_offset_for_global): New functions.
4348         (Target_powerpc::Scan::local): Correct TLS relocations and got
4349         entry values.
4350         (Target_powerpc::Scan::global): Don't emit unnecessary
4351         dynamic relocations on TLS GOT entries.
4352
4353 2012-09-10  Matthias Klose  <doko@ubuntu.com>
4354
4355         * config.in: Disable sanity check for kfreebsd.
4356
4357 2012-09-10  Sterling Augustine  <saugustine@google.com>
4358
4359         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
4360         (Gdb_index::pubtypes_read): New parameter.
4361         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
4362         to calls.
4363         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
4364         pubtypes_object_.
4365
4366 2012-09-09  Alan Modra  <amodra@gmail.com>
4367
4368         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
4369         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
4370         * gc.h (gc_process_relocs): Call target gc_add_reference.
4371         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
4372         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
4373         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
4374         unnecessary cast.
4375         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
4376         to cater for when we don't need code offset.  Update use.
4377         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
4378         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
4379         set_opd_valid): New functions.
4380         (Target_powerpc::do_gc_add_reference): New function.
4381         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
4382         stashed refs.
4383         (Target_powerpc::do_gc_mark_symbol): New function.
4384
4385 2012-09-06  Cary Coutant  <ccoutant@google.com>
4386
4387         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
4388         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
4389         (Dwarf_die::skip_attributes): Likewise.
4390         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
4391         * testsuite/gdb_index_test.cc (inline_func_1): New function.
4392         (main): Call it.
4393         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
4394
4395 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
4396
4397         * testsuite/script_test_3.t: Add .got.plt output section
4398         statement.
4399         * testsuite/script_test_4.t: Likewise.
4400
4401 2012-09-05  Alan Modra  <amodra@gmail.com>
4402
4403         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
4404         update all uses and lose "enum" when using type.
4405
4406 2012-09-05  Alan Modra  <amodra@gmail.com>
4407
4408         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
4409         * configure: Regenerate.
4410         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
4411         (plugin_final_layout.stdout): Likewise.
4412         (memory_test): Set page sizes to 0x1000.
4413         * testsuite/Makefile.in: Regenerate.
4414         * testsuite/discard_locals_test.sh: Add FIXME comment.
4415         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
4416         * testsuite/pr14265.t: Add .got output section statement.
4417         * testsuite/script_test_2.t: Likewise.
4418         * testsuite/script_test_3.t: Likewise.
4419         * testsuite/script_test_4.t: Likewise.
4420         * testsuite/script_test_5.t: Likewise.
4421         * testsuite/script_test_6.t: Likewise.
4422         * testsuite/script_test_7.t: Likewise.
4423         * testsuite/script_test_9.t: Likewise.
4424
4425 2012-09-05  Alan Modra  <amodra@gmail.com>
4426
4427         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
4428         (Powerpc_relocate_functions::Status): New typedef.
4429         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4430         (Target_powerpc::Scan::local): Handle REL64.
4431         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
4432         for REL32 and REL64.
4433         (Target_powerpc::symval_for_branch): New function, extracted from..
4434         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
4435         checks.  Report overflow errors.
4436
4437 2012-09-05  Alan Modra  <amodra@gmail.com>
4438
4439         * object.h (Sized_relobj_file::emit_relocs): Delete.
4440         (Sized_relobj_file::emit_relocs_reltype): Delete.
4441         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
4442         relocate_relocs for --emit-relocs.
4443         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
4444         * output.h: Update comment.
4445         (Output_segment::first_section): New function.
4446         (Output_segment::first_section_load_address): Use first_section.
4447         * output.cc (Output_segment::first_section): New function extracted..
4448         (Output_segment::first_section_load_address): ..from here.  Delete.
4449         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
4450         * target.h (Sized_target::relocate_for_relocatable): Likewise.
4451         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
4452         adjust call to target.h function.
4453         * i386.cc (Target_i386): Likewise.
4454         * sparc.cc (Target_sparc): Likewise.
4455         * x86_64.cc (Target_x86_64): Likewise.
4456         * powerpc.cc (Target_powerpc): Likewise.
4457         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
4458         first tls section has section symbol for optimised local dynamic
4459         output relocs.
4460         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
4461         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
4462         optimised tls code.
4463         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
4464         Rename to relocate_relocs.  Update error message.
4465
4466 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
4467
4468         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
4469         --just-symbols.
4470
4471 2012-08-31  Alan Modra  <amodra@gmail.com>
4472
4473         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
4474         (Powerpc_relobj::toc_base_offset): New stub function.
4475         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
4476         got_mod_index_offset to tlsld_got_offset.  Update all refs.
4477         (Target_powerpc::Relocate::enum skip_tls): New.
4478         (Target_powerpc::call_tls_get_addr_): New var.
4479         (Target_powerpc::is_branch_reloc): Move to file scope.
4480         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
4481         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
4482         New functions.
4483         (Target_powerpc::enum Got_type): Delete old values, add new ones.
4484         (powerpc_info): Correct common_pagesize for ppc64.
4485         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
4486         (Powerpc_relocate_functions): Add overflow check enums and functions.
4487         Add non-shift version of rela, rela_ua.  Delete all rel public
4488         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
4489         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
4490         addr16_ha3, addr14 functions.
4491         (Output_data_got_powerpc::add_constant_pair): New function.
4492         (Output_data_got_powerpc::got_base_offset): Likewise.
4493         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
4494         (instruction constants): Sort, add some more.
4495         (Output_data_glink::do_write): Add and use Address typedef.  Use
4496         object->toc_base_offset() stub for 64-bit.
4497         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
4498         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4499         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
4500         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
4501         Always treat .opd relocs as against locally defined symbol.
4502         Correct condition for RELATIVE relocs.
4503         (Target_powerpc::do_finalize_sections): Test for NULL sections.
4504         (Target_powerpc::Relocate::relocate): Use plt call stub as value
4505         for 32-bit syms with a plt entry.  Correct ppc64 toc base
4506         calculations.  Handle TLS relocs, and more.  Add overflow
4507         checking and adjust for Powerpc_relocate_functions changes.
4508         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
4509         Reinstate --emit-relocs code with FIXME.
4510
4511 2012-08-30  Alan Modra  <amodra@gmail.com>
4512
4513         * layout.cc (Layout::set_segment_offsets): Set p_align to
4514         abi_pagesize, not common_pagesize.
4515         (Layout::relaxation_loop_body): Similarly use abi_pagesize
4516         to determine whether file header can go in segment.
4517
4518 2012-08-30  Alan Modra  <amodra@gmail.com>
4519
4520         * output.h (Output_reloc::Output_reloc <output section>): Add
4521         is_relative param.  Adjust calls.
4522         (Output_reloc::add_output_section_relative): New functions.
4523         * output.cc (Output_reloc::Output_reloc <output section>): Handle
4524         is_relative.
4525         (Output_reloc::symbol_value): Handle SECTION_CODE.
4526
4527 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
4528
4529         * gold.cc (queue_middle_tasks): Call layout again when unique
4530         segments for sections is desired.
4531         * layout.cc (Layout::Layout): Initialize new members.
4532         (Layout::get_output_section_flags): New function.
4533         (Layout::choose_output_section): Call get_output_section_flags.
4534         (Layout::layout): Make output section for mapping to a unique segment.
4535         (Layout::insert_section_segment_map): New function.
4536         (Layout::attach_allocated_section_to_segment): Make unique segment for
4537         output sections marked so.
4538         (Layout::segment_precedes): Check for unique segments when sorting.
4539         * layout.h (Layout::Unique_segment_info): New struct.
4540         (Layout::Section_segment_map): New typedef.
4541         (Layout::insert_section_segment_map): New function.
4542         (Layout::get_output_section_flags): New function.
4543         (Layout::is_unique_segment_for_sections_specified): New function.
4544         (Layout::set_unique_segment_for_sections_specified): New function.
4545         (Layout::unique_segment_for_sections_specified_): New member.
4546         (Layout::section_segment_map_): New member.
4547         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
4548         Rename is_gc_pass_one to is_pass_one.
4549         Rename is_gc_pass_two to is_pass_two.
4550         Rename is_gc_or_icf to is_two_pass.
4551         Check for which pass based on whether symbols data is present.
4552         Make it two pass when unique segments for sections is desired.
4553         * output.cc (Output_section::Output_section): Initialize new
4554         members.
4555         * output.h (Output_section::is_unique_segment): New function.
4556         (Output_section::set_is_unique_segment): New function.
4557         (Output_section::is_unique_segment_): New member.
4558         (Output_section::extra_segment_flags): New function.
4559         (Output_section::set_extra_segment_flags): New function.
4560         (Output_section::extra_segment_flags_): New member.
4561         (Output_section::segment_alignment): New function.
4562         (Output_section::set_segment_alignment): New function.
4563         (Output_section::segment_alignment_): New member.
4564         (Output_segment::Output_segment): Initialize is_unique_segment_.
4565         (Output_segment::is_unique_segment): New function.
4566         (Output_segment::set_is_unique_segment): New function.
4567         (Output_segment::is_unique_segment_): New member.
4568         * plugin.cc (allow_unique_segment_for_sections): New function.
4569         (unique_segment_for_sections): New function.
4570         (Plugin::load): Add new functions to transfer vector.
4571         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
4572         * Makefile.in: Regenerate.
4573         * testsuite/plugin_final_layout.sh: Check if unique segment
4574         functionality works.
4575         * testsuite/plugin_section_order.c (onload): Check if new interfaces
4576         are available.
4577         (allow_unique_segment_for_sections): New global.
4578         (unique_segment_for_sections): New global.
4579         (claim_file_hook): Call allow_unique_segment_for_sections.
4580         (all_symbols_read_hook): Call unique_segment_for_sections.
4581
4582 2012-08-22  Cary Coutant  <ccoutant@google.com>
4583
4584         * layout.cc (Layout::include_section): Don't assert on GROUP
4585         sections with --emit-relocs.
4586
4587 2012-08-21  Cary Coutant  <ccoutant@google.com>
4588
4589         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
4590         if --export-dynamic-symbol names an undef symbol.
4591
4592 2012-08-18  Alan Modra  <amodra@gmail.com>
4593
4594         * powerpc.cc: Formatting and white space.
4595         (Powerpc_relobj): Rename got2_section_ to special_.
4596         Add opd_ent_shndx_ and opd_ent_off_ vectors.
4597         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
4598         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
4599         (Target_powerpc): Add Address typedef and invalid_address.  Use
4600         throughout.
4601         (Target_powerpc::is_branch_reloc): New function.
4602         (Powerpc_relocate_functions): Add Address typedef, use throughout.
4603         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
4604         for dst_mask, value and addend.
4605         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
4606         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
4607         (Output_data_glink::do_write): Correct toc base.  Don't try to use
4608         uint16_t for 24-bit offset.  Use get_output_section_offset and
4609         check return.
4610         (Target_powerpc::Scan::local): Handle more relocs.
4611         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
4612         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
4613         Plug in toc restoring insn after plt calls.  Translate branches
4614         to function descriptor symbols to corresponding entry point.
4615         (Target_powerpc::relocate_for_relocatable): Check return from
4616         get_output_section_offset.
4617         * symtab.h: Comment typo.
4618
4619 2012-08-14  Ian Lance Taylor  <iant@google.com>
4620
4621         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
4622         unsupported_relocal_local to call unsupported_reloc_global.
4623
4624 2012-08-14  Nick Clifton  <nickc@redhat.com>
4625
4626         PR ld/14265
4627         * script-sections.cc (Sections_element::output_section_name): Add
4628         keep return parameter.
4629         (Output_section_element::match_name): Add keep return parameter.
4630         Return the value of the keep_ member.
4631         * script-sections.h (class Output_section): Update
4632         output_section_name prototype.
4633         * layout.cc (Layout::keep_input_section): New public member
4634         function.
4635         (Layout::choose_output_section): Pass keep parameter to
4636         output_section_name.
4637         * layout.h (class Layout): Add keep_input_section.
4638         * object.cc (Sized_relobj_file::do_layout): Check for kept input
4639         sections.
4640         * testsuite/Makefile.am: Add a test.
4641         * testsuite/Makefile.in: Regenerate.
4642         * testsuite/pr14265.c: Source file for the test.
4643         * testsuite/pr14265.t: Linker script for the test.
4644         * testsuite/pr14265.sh: Shell script for the test.
4645
4646 2012-08-14  Alan Modra  <amodra@gmail.com>
4647
4648         * target.h (Target::output_section_name): New function.
4649         (Target::do_output_section_name): New function.
4650         * layout.cc (Layout::choose_output_section): Call the above.
4651         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
4652
4653 2012-08-14  Alan Modra  <amodra@gmail.com>
4654
4655         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
4656         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
4657         for replace_constant call.
4658         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
4659         (Output_data_glink::do_print_to_mapfile): New function.
4660         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
4661         (Target_powerpc::Relocate::relocate): Likewise.
4662
4663 2012-08-14  Alan Modra  <amodra@gmail.com>
4664
4665         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
4666         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
4667         (Output_data_glink::add_entry,find_entry): Remove shndx param.
4668         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
4669         all references to shndx_.  Handle special case for R_PPC_PLTREL24
4670         here.
4671         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
4672         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
4673         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
4674         here.
4675         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
4676         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
4677
4678 2012-08-12  Alan Modra  <amodra@gmail.com>
4679
4680         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
4681         (glink insn constants): Use uint32_t.
4682         (Output_data_glink::add_entry): Use insert, not [] operator.
4683
4684 2012-08-11  Alan Modra  <amodra@gmail.com>
4685
4686         * object.h (Sized_relobj_file::find_shdr): New function.
4687         (Sized_relobj_file::find_special_sections): New function.
4688         * object.cc (Sized_relobj_file::find_shdr): New function.
4689         (Sized_relobj_file::find_eh_frame): Use find_shdr.
4690         (Sized_relobj_file::find_special_sections): New function, split out..
4691         (Sized_relobj_file::do_read_symbols): ..from here.
4692         * output.h (Output_data_got::replace_constant): New function.
4693         (Output_data_got::num_entries): New function.
4694         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
4695         (Output_data_got::got_offset): Protected rather than private.
4696         (Output_data_got::replace_got_entry): New function.
4697         * output.cc (Output_data_got::replace_got_entry): New function.
4698         * powerpc.cc (class Powerpc_relobj): New.
4699         (class Powerpc_relocate_functions): Delete all psymval variants or
4700         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
4701         Implement _ha functions using corresponding _hi function.
4702         (Powerpc_relobj::find_special_sections): New function.
4703         (Target_powerpc::do_make_elf_object): New function.
4704         (class Output_data_got_powerpc): New.
4705         (class Output_data_glink): New.
4706         (class Powerpc_scan_relocatable_reloc): New.
4707         Many more changes througout file.
4708
4709 2012-08-09  Nick Clifton  <nickc@redhat.com>
4710
4711         * po/vi.po: Updated Vietnamese translation.
4712
4713 2012-08-07  Ian Lance Taylor  <iant@google.com>
4714
4715         * layout.cc (Layout::add_target_dynamic_tags): If
4716         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
4717         plt_rel.
4718
4719 2012-07-30  Nick Clifton  <nickc@redhat.com>
4720
4721         * po/gold.pot: Updated template.
4722         * po/es.po: Updated Spanish translation.
4723
4724 2012-07-18  Cary Coutant  <ccoutant@google.com>
4725
4726         PR gold/14344
4727         * configure.ac: Add check for -gpubnames support.
4728         * configure: Regenerate.
4729         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
4730         support; force -gno-pubnames.
4731         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
4732         support.
4733         (gdb_index_test_4): New test.
4734         * testsuite/Makefile.in: Regenerate.
4735         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
4736         * testsuite/gdb_index_test_2.sh: Likewise.
4737         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
4738         * testsuite/gdb_index_test_4.sh: New script.
4739         * testsuite/gdb_index_test_comm.sh: New script with common code;
4740         don't look for space after colon.
4741
4742 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
4743
4744         * gold.cc (queue_middle_tasks): Update function order only after
4745         deferred objects due to plugins are processed.
4746
4747 2012-07-11  Ian Lance Taylor  <iant@google.com>
4748
4749         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
4750         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
4751         (Target_arm::scan_reloc_for_stub): Likewise.
4752         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
4753         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
4754         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
4755         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
4756         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
4757
4758 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
4759             Ian Lance Taylor  <iant@google.com>
4760
4761         PR gold/14309
4762         * configure.ac: Test whether std::tr1::hash<off_t> works.
4763         * gold.h: Add a specialization for std::tr1::hash<off_t> if
4764         needed.
4765         * output.h (class Output_fill): Add virtual destructor.
4766         * configure, config.in: Rebuild.
4767
4768 2012-06-22  Roland McGrath  <mcgrathr@google.com>
4769
4770         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
4771
4772 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
4773
4774         * plugin.cc (Plugin::load): Handle position independent executables.
4775
4776 2012-06-06  Cary Coutant  <ccoutant@google.com>
4777
4778         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
4779         add .debug_macro.
4780         (lines_only_debug_sections): Likewise.
4781         (gdb_fast_lookup_sections): New static array.
4782         (is_gdb_debug_section): Rename formal parameter.
4783         (is_lines_only_debug_section): Likewise.
4784         (is_gdb_fast_lookup_section): New function.
4785         (Layout::include_section): Check for ".zdebug_" prefix; pass
4786         section name suffix to is_gdb_debug_section, et al.; check for
4787         fast-lookup sections when building .gdb_index.
4788         * options.h (--strip-debug-gdb): Update GDB version number.
4789
4790 2012-06-06  Cary Coutant  <ccoutant@google.com>
4791
4792         * configure.ac: Add check for fallocate.
4793         * configure: Regenerate.
4794         * config.in: Regenerate.
4795
4796         * options.h (class General_options): Add --mmap-output-file and
4797         --posix-fallocate options.
4798         * output.cc: (posix_fallocate): Remove; replace with...
4799         (gold_fallocate): New function.
4800         (Output_file::map_no_anonymous): Call gold_fallocate.
4801         (Output_file::map): Check --mmap-output-file option.
4802
4803 2012-06-05  Jing Yu  <jingyu@google.com>
4804
4805         * gold.h (textdomain): Add do {} to empty while(0).
4806         (bindtextdomain): Likewise.
4807
4808 2012-06-04  Cary Coutant  <ccoutant@google.com>
4809
4810         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
4811         has_dynsym_index.
4812
4813 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
4814
4815         * symtab.cc (Symbol_table::define_special_symbol):
4816         Initialize *poldsym to prevent uninitialized variable errors.
4817
4818 2012-05-23  Cary Coutant  <ccoutant@google.com>
4819
4820         * layout.cc (Layout::section_name_mapping): Add rules to handle
4821         exact match on .data.rel.ro.local or .data.rel.ro.
4822         (Layout::output_section_name): Check for exact matches.
4823
4824 2012-05-23  Cary Coutant  <ccoutant@google.com>
4825
4826         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
4827         more carefully.
4828
4829 2012-05-22  Cary Coutant  <ccoutant@google.com>
4830
4831         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
4832         object before exporting symbol.
4833
4834 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
4835
4836         * testsuite/tls_test.cc: Include "config.h" first.
4837         * testsuite/tls_test_c.c: Likewise.
4838
4839 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
4840             Nick Clifton  <nickc@redhat.com>
4841
4842         PR 14072
4843         * configure.in: Add check that sysdep.h has been included before
4844         any system header files.
4845         * configure: Regenerate.
4846         * config.in: Regenerate.
4847
4848 2012-05-14  Cary Coutant  <ccoutant@google.com>
4849
4850         * layout.cc (Layout::make_output_section): Mark .tdata section
4851         as RELRO.
4852         * testsuite/relro_test.cc: Add a TLS variable.
4853
4854 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
4855
4856         PR gold/14091
4857         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
4858         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
4859         R_X86_64_64.
4860
4861 2012-05-08  Cary Coutant  <ccoutant@google.com>
4862
4863         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
4864         (lines_only_debug_sections): Likewise.
4865
4866 2012-05-02  Roland McGrath  <mcgrathr@google.com>
4867
4868         * nacl.cc: New file.
4869         * nacl.h: New file.
4870         * Makefile.am (CCFILES, HFILES): Add them.
4871         * Makefile.in: Regenerate.
4872         * i386.cc (Output_data_plt_i386_nacl): New class.
4873         (Output_data_plt_i386_nacl_exec): New class.
4874         (Output_data_plt_i386_nacl_dyn): New class.
4875         (Target_i386_nacl): New class.
4876         (Target_selector_i386_nacl): New class.
4877         (target_selector_i386): Use it instead of Target_selector_i386.
4878         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
4879         (Target_x86_64_nacl): New class.
4880         (Target_selector_x86_64_nacl): New class.
4881         (target_selector_x86_64, target_selector_x32): Use it instead of
4882         Target_selector_x86_64.
4883         * arm.cc (Output_data_plt_arm_nacl): New class.
4884         (Target_arm_nacl): New class.
4885         (Target_selector_arm_nacl): New class.
4886         (target_selector_arm, target_selector_armbe): Use it instead of
4887         Target_selector_arm.
4888
4889         * target-select.cc (select_target): Take new Input_file* and off_t
4890         arguments, pass them on to recognize method of selector.
4891         * object.cc (make_elf_sized_object): Update caller.
4892         * parameters.cc (parameters_force_valid_target): Likewise.
4893         * incremental.cc (make_sized_incremental_binary): Likewise.
4894         * target-select.h: Update decl.
4895         (Target_selector::recognize): Take new Input_file* argument,
4896         pass it on to do_recognize.
4897         (Target_selector::do_recognize): Take new Input_file* argument.
4898         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
4899         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
4900         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
4901         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
4902
4903         * target.h (Target::Target_info): New members isolate_execinstr
4904         and rosegment_gap.
4905         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
4906         * arm.cc (Target_arm::arm_info): Update initializer.
4907         * i386.cc (Target_i386::i386_info): Likewise.
4908         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
4909         * sparc.cc (Target_sparc::sparc_info): Likewise.
4910         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4911         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
4912         * layout.cc (Layout::attach_allocated_section_to_segment):
4913         Take new const Target* argument.  If target->isolate_execinstr(), act
4914         like --rosegment.
4915         (Layout::find_first_load_seg): Take new const Target* argument;
4916         if target->isolate_execinstr(), reject PF_X segments.
4917         (Layout::relaxation_loop_body): Update caller.
4918         (Layout::set_segment_offsets): If target->isolate_execinstr(),
4919         reset file offset to zero when we hit LOAD_SEG, and then do a second
4920         loop over the segments before LOAD_SEG to reassign offsets after
4921         addresses have been determined.  Handle target->rosegment_gap().
4922         (Layout::attach_section_to_segment): Take new const Target* argument;
4923         pass it to attach_allocated_section_to_segment.
4924         (Layout::make_output_section): Update caller.
4925         (Layout::attach_sections_to_segments): Take new const Target* argument;
4926         pass it to attach_section_to_segment.
4927         * gold.cc (queue_middle_tasks): Update caller.
4928         * layout.h (Layout): Update method decls with new arguments.
4929
4930         * arm.cc (Target_arm::Target_arm): Take optional argument for the
4931         Target_info pointer to use.
4932         (Target_arm::do_make_data_plt): New virtual method.
4933         (Target_arm::make_data_plt): New method that calls it.
4934         (Target_arm::make_plt_entry): Use it.
4935         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
4936         for the section alignment.
4937         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
4938         method.
4939         (Output_data_plt_arm::first_plt_entry_offset): Call it.
4940         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
4941         method.
4942         (Output_data_plt_arm::get_plt_entry_size): Call it.
4943         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
4944         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
4945         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
4946         method.
4947         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
4948         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
4949         method instead of sizeof(plt_entry).
4950         (Output_data_plt_arm::add_entry): Likewise.
4951         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
4952         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
4953         than static method.
4954         (Target_arm::plt_entry_size): Likewise.
4955         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
4956         Move to ...
4957         (Output_data_plt_arm_standard): ... here, new class.
4958         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
4959         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
4960         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
4961
4962         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4963         Take additional argument for the PLT entry size.
4964         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
4965         Use get_plt_entry_size method rather than plt_entry_size variable.
4966         (Output_data_plt_x86_64::reserve_slot): Likewise.
4967         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
4968         (Output_data_plt_x86_64::add_entry): Likewise.
4969         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
4970         (Output_data_plt_x86_64::address_for_global): Likewise.
4971         (Output_data_plt_x86_64::address_for_local): Likewise.
4972         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4973         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
4974         Make method non-static.
4975         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
4976         method.
4977         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
4978         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
4979         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
4980         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
4981         virtual method.
4982         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
4983         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
4984         virtual method.
4985         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
4986         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
4987         virtual method.
4988         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
4989         (Output_data_plt_x86_64::plt_entry_size)
4990         (Output_data_plt_x86_64::first_plt_entry)
4991         (Output_data_plt_x86_64::plt_entry)
4992         (Output_data_plt_x86_64::tlsdesc_plt_entry)
4993         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
4994         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
4995         (Output_data_plt_x86_64_standard): ... here, new class.
4996         (Target_x86_64::Target_x86_64): Take optional argument for the
4997         Target_info pointer to use.
4998         (Target_x86_64::do_make_data_plt): New virtual method.
4999         (Target_x86_64::make_data_plt): New method to call it.
5000         (Target_x86_64::init_got_plt_for_update): Use that.
5001         Call this->plt_->add_eh_frame method here.
5002         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
5003         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
5004         rather than static method.
5005         (Target_x86_64::plt_entry_size): Likewise.
5006         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
5007         rather than plt_entry_size variable.  Move guts of PLT filling to...
5008         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
5009         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
5010         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
5011
5012         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
5013         additional argument for the section alignment.
5014         Don't do add_eh_frame_for_plt here.
5015         (Output_data_plt_i386::first_plt_entry_offset): Make the method
5016         non-static.  Use get_plt_entry_size method rather than plt_entry_size
5017         variable.
5018         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
5019         method.
5020         (Output_data_plt_i386::get_plt_entry_size): Call it.
5021         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
5022         (Output_data_plt_i386::add_eh_frame): New method to call it.
5023         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
5024         method.
5025         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
5026         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
5027         method.
5028         (Output_data_plt_i386::fill_plt_entry): New method to call it.
5029         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
5030         method instead of plt_entry_size.
5031         (Output_data_plt_i386::plt_entry_size)
5032         (Output_data_plt_i386::plt_eh_frame_fde_size)
5033         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
5034         (Output_data_plt_i386_standard): ... here, new class.
5035         (Output_data_plt_i386_exec): New class.
5036         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
5037         (Output_data_plt_i386_exec::first_plt_entry): ... here.
5038         (Output_data_plt_i386::exec_plt_entry): Move to ...
5039         (Output_data_plt_i386_exec::plt_entry): ... here.
5040         (Output_data_plt_i386_dyn): New class.
5041         (Output_data_plt_i386::first_plt_entry): Move to ...
5042         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
5043         (Output_data_plt_i386::dyn_plt_entry): Move to ...
5044         (Output_data_plt_i386_dyn::plt_entry): ... here.
5045         (Target_i386::Target_i386): Take optional argument for the Target_info
5046         pointer to use.
5047         (Target_i386::do_make_data_plt): New virtual method.
5048         (Target_i386::make_data_plt): New method to call it.
5049         (Target_i386::make_plt_section): Use that.
5050         Call this->plt_->add_eh_frame method here.
5051         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
5052         rather than plt_entry_size variable.
5053         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
5054         (Output_data_plt_i386::address_for_local): Likewise.
5055         (Output_data_plt_i386::do_write): Likewise.
5056         Move guts of PLT filling to...
5057         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
5058         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
5059         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
5060         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
5061
5062 2012-05-01  Cary Coutant  <ccoutant@google.com>
5063
5064         * dwarf_reader.cc (Dwarf_die::read_attributes)
5065         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
5066         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
5067         * reduced_debug_output.cc
5068         (Output_reduced_debug_info_section::get_die_end): Remove
5069         DW_FORM_GNU_ref_index.  Add default case.
5070
5071 2012-04-26  Mark Wielaard  <mjw@redhat.com>
5072
5073         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
5074         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
5075         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
5076         DW_AT_high_pc as offset from DW_AT_low_pc.
5077
5078         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
5079         * testsuite/Makefile.in: Regenerate.
5080         * testsuite/gdb_index_test_3.c: New test source file.
5081         * testsuite/gdb_index_test_3.sh: New test source file.
5082
5083 2012-04-25  Ian Lance Taylor  <iant@google.com>
5084
5085         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
5086         pointer.
5087         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
5088         as a class, not a struct.
5089         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
5090         (Target_arm::apply_cortex_a8_workaround): Likewise.
5091         * gc.h: Declare Reloc_types as a struct, not a class.
5092         * object.h: Declare Symbols_data as a struct.
5093         * reloc.h: Declare Read_relocs_data as a struct.
5094         * target.h: Declare Relocate_info as a struct.
5095
5096 2012-04-24  David S. Miller  <davem@davemloft.net>
5097
5098         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
5099         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
5100         and R_SPARC_WPLT30.
5101
5102 2012-04-24  Cary Coutant  <ccoutant@google.com>
5103
5104         * incremental-dump.cc (find_input_containing_global): Replace
5105         magic number with symbolic constant.
5106         (dump_incremental_inputs): Update version number.
5107         * incremental.cc (Output_section_incremental_inputs): Update version
5108         number; import symbolic constants from Incremental_inputs_reader.
5109         (Incremental_inputs::create_data_sections): Align relocations
5110         section correctly for 64-bit targets.
5111         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
5112         constants; add padding.
5113         (Output_section_incremental_inputs::write_header): Add assert for
5114         header_size.
5115         (Output_section_incremental_inputs::write_input_files): Add assert
5116         for input_entry_size.
5117         (Output_section_incremental_inputs::write_info_blocks): Add padding;
5118         add assert for object_info_size, input_section_entry_size,
5119         global_sym_entry_size.
5120         * incremental.h (Incremental_inputs_reader): Add symbolic constants
5121         for data structure sizes; use them.
5122         (Incremental_input_entry_reader): Import symbolic constants from
5123         Incremental_inputs_reader; use them.
5124
5125 2012-04-23  David S. Miller  <davem@davemloft.net>
5126
5127         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
5128         and elf_flags_set_.
5129         (Target_sparc::Target_sparc): Initialize new fields.
5130         (Target_sparc::do_make_elf_object): New function.
5131         (Target_sparc::do_adjust_elf_header): New function.
5132
5133 2012-04-23  Cary Coutant  <ccoutant@google.com>
5134
5135         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
5136         CU range table of gdb index.
5137
5138 2012-04-20  David S. Miller  <davem@davemloft.net>
5139
5140         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
5141         instead of false.
5142
5143 2012-04-16  David S. Miller  <davem@davemloft.net>
5144
5145         * sparc.cc (Target_sparc::got_address): New function.
5146         (Sparc_relocate_functions::gdop_hix22): New function.
5147         (Sparc_relocate_functions::gdop_lox10): New function.
5148         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
5149         relocs.
5150         (Target_sparc::Scan::local): Likewise if the global symbol is not
5151         preemptible and is not IFUNC.
5152         (Target_sparc::Relocate::relocate): Perform GOTDATA code
5153         transformations for local and non-preemptible non-IFUNC global
5154         symbols.
5155
5156         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
5157         writing out 64-bit part of ranges.
5158
5159         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
5160         -fpic and -fpie respectively.
5161         * Makefile.in: Regenerate.
5162
5163         * sparc.cc (class Target_sparc): Add rela_ifunc_.
5164         (Target_sparc::Target_sparc): Initialize new field.
5165         (Target_sparc::do_plt_section_for_global): New function.
5166         (Target_sparc::do_plt_section_for_local): New function.
5167         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
5168         (Target_sparc::make_plt_section): New function, broken out of
5169         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
5170         (Target_sparc::make_plt_entry): Call make_plt_section.
5171         (Target_sparc::make_local_ifunc_plt_entry): New function.
5172         (Target_sparc::rela_ifunc_section): New function.
5173         (Target_sparc::plt_section): Remove const.
5174         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
5175         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
5176         and ifunc_count_ fields.
5177         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
5178         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
5179         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
5180         (Output_data_plt_sparc::rela_ifunc): New function.
5181         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
5182         (Output_data_plt_sparc::has_ifunc_section): New function.
5183         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
5184         (Output_data_plt_sparc::address_for_global): New function.
5185         (Output_data_plt_sparc::address_for_local): New function.
5186         (Output_data_plt_sparc::plt_index_to_offset): New function.
5187         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
5188         and entry_count.
5189         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
5190         entry_count.
5191         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
5192         R_SPARC_JMP_IREL to switch.
5193         (Target_sparc::Scan::check_non_pic): Likewise.
5194         (Target_sparc::Scan::local): Handle IFUNC symbols.
5195         (Target_sparc::Scan::local): Likewise.
5196         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
5197         and plt_address_for_local.
5198         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
5199         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
5200
5201         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
5202         (class Output_data_reloc): Adjust calls to Output_reloc_type.
5203         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
5204         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
5205         global relocs too.
5206         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
5207         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
5208         calls.
5209         * sparc.cc (Target_sparc::Scan::global): Likewise.
5210         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5211
5212 2012-04-16  Cary Coutant  <ccoutant@google.com>
5213
5214         * archive.cc (Library_base::should_include_member): Check for
5215         --export-dynamic-symbol.
5216         * options.h (class General_options): Add --export-dynamic-symbol.
5217         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
5218         --export-dynamic-symbol.
5219         (Symbol_table::gc_mark_undef_symbols): Likewise.
5220         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
5221
5222 2012-04-12  David S. Miller  <davem@davemloft.net>
5223
5224         * sparc.cc (Reloc::wdisp10): New relocation method.
5225         (Reloc::h34): Likewise.
5226         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
5227         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
5228         R_SPARC_WDISP10.
5229         (Target_sparc::Scan::local): Likewise.
5230         (Target_sparc::Scan::global): Likewise.
5231         (Target_sparc::Relocate::relocate): Likewise.
5232
5233 2012-04-09  Cary Coutant  <ccoutant@google.com>
5234
5235         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
5236         low_pc == 0.
5237
5238 2012-04-06  Ian Lance Taylor  <iant@google.com>
5239
5240         * timer.cc: #include <unistd.h>.
5241
5242 2012-04-06  Roland McGrath  <mcgrathr@google.com>
5243
5244         * configure.in (AC_CHECK_HEADERS): Add locale.h.
5245         * config.in: Regenerate.
5246         * configure: Regenerate.
5247
5248 2012-04-05  Nick Clifton  <nickc@redhat.com>
5249
5250         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
5251         (AM_LC_MESSAGES): Add.
5252         * aclocal.m4: Regenerate.
5253         * config.in: Regenerate.
5254         * configure: Regenerate.
5255
5256 2012-03-21  Cary Coutant  <ccoutant@google.com>
5257
5258         * Makefile.am: Add gdb-index.cc, gdb-index.h.
5259         * Makefile.in: Regenerate.
5260         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
5261         (Sized_elf_reloc_mapper::symbol_section): New function.
5262         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
5263         (make_elf_reloc_mapper): New function.
5264         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
5265         (Dwarf_abbrev_table::do_read_abbrevs): New function.
5266         (Dwarf_abbrev_table::do_get_abbrev): New function.
5267         (Dwarf_ranges_table::read_ranges_table): New function.
5268         (Dwarf_ranges_table::read_range_list): New function.
5269         (Dwarf_pubnames_table::read_section): New function.
5270         (Dwarf_pubnames_table::read_header): New function.
5271         (Dwarf_pubnames_table::next_name): New function.
5272         (Dwarf_die::Dwarf_die): New function.
5273         (Dwarf_die::read_attributes): New function.
5274         (Dwarf_die::skip_attributes): New function.
5275         (Dwarf_die::set_name): New function.
5276         (Dwarf_die::set_linkage_name): New function.
5277         (Dwarf_die::attribute): New function.
5278         (Dwarf_die::string_attribute): New function.
5279         (Dwarf_die::int_attribute): New function.
5280         (Dwarf_die::uint_attribute): New function.
5281         (Dwarf_die::ref_attribute): New function.
5282         (Dwarf_die::child_offset): New function.
5283         (Dwarf_die::sibling_offset): New function.
5284         (Dwarf_info_reader::check_buffer): New function.
5285         (Dwarf_info_reader::parse): New function.
5286         (Dwarf_info_reader::do_parse): New function.
5287         (Dwarf_info_reader::do_read_string_table): New function.
5288         (Dwarf_info_reader::lookup_reloc): New function.
5289         (Dwarf_info_reader::get_string): New function.
5290         (Dwarf_info_reader::visit_compilation_unit): New function.
5291         (Dwarf_info_reader::visit_type_unit): New function.
5292         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
5293         Sized_elf_reloc_mapper.
5294         (Sized_dwarf_line_info::symbol_section): Remove function.
5295         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
5296         (Sized_dwarf_line_info::read_line_mappings): Remove object
5297         parameter, adjust callers.
5298         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
5299         * dwarf_reader.h: Include <sys/types.h>.
5300         (class Track_relocs): Remove forward declaration.
5301         (class Elf_reloc_mapper): New class.
5302         (class Sized_elf_reloc_mapper): New class.
5303         (class Dwarf_abbrev_table): New class.
5304         (class Dwarf_range_list): New class.
5305         (class Dwarf_ranges_table): New class.
5306         (class Dwarf_pubnames_table): New class.
5307         (class Dwarf_die): New class.
5308         (class Dwarf_info_reader): New class.
5309         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
5310         (Sized_dwarf_line_info::symbol_section): Remove member function.
5311         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
5312         base class.
5313         * gdb-index.cc: New source file.
5314         * gdb-index.h: New source file.
5315         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
5316         and .debug_types sections, call Layout::add_to_gdb_index.
5317         (Sized_relobj_incr::do_section_name): Implement.
5318         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
5319         return type; Implement.
5320         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
5321         return type.
5322         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
5323         parameter list and return type.
5324         (Sized_incr_dynobj::do_section_contents): Likewise.
5325         * layout.cc: Include gdb-index.h.
5326         (Layout::Layout): Initialize gdb_index_data_.
5327         (Layout::init_fixed_output_section): Check for .gdb_index section.
5328         (Layout::add_to_gdb_index): New function. Instantiate.
5329         * layout.h: Add forward declaration for class Gdb_index.
5330         (Layout::add_to_gdb_index): New member function.
5331         (Layout::gdb_index_data_): New data member.
5332         * main.cc: Include gdb-index.h.
5333         (main): Print statistics for gdb index.
5334         * object.cc (Object::section_contents): Move code into
5335         do_section_contents.
5336         (need_decompressed_section): Check for sections needed when building
5337         gdb index.
5338         (build_compressed_section_map): Likewise.
5339         (Sized_relobj_file::do_read_symbols): Need local symbols when building
5340         gdb index.
5341         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
5342         sections; call Layout::add_to_gdb_index.
5343         (Sized_relobj_file::do_decompressed_section_contents): Call
5344         do_section_contents directly.
5345         * object.h (Object::do_section_contents): Adjust parameter list and
5346         return type.
5347         (Object::do_decompressed_section_contents): Call do_section_contents
5348         directly.
5349         (Sized_relobj_file::do_section_contents): Adjust parameter list and
5350         return type.
5351         * options.h (class General_options): Add --gdb-index option.
5352         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
5353         list and return type.
5354         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
5355         * reloc.h (Track_relocs::checkpoint): New function.
5356         (Track_relocs::reset): New function.
5357
5358         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
5359         New test cases.
5360         * testsuite/Makefile.in: Regenerate.
5361         * testsuite/gdb_index_test.cc: New test source file.
5362         * testsuite/gdb_index_test_1.sh: New test source file.
5363         * testsuite/gdb_index_test_2.sh: New test source file.
5364
5365 2012-03-19  Doug Kwan  <dougkwan@google.com>
5366
5367         * arm.cc (Target_arm::do_define_standard_symbols): New method.
5368         (Target_arm::do_finalize_sections): Remove code which defines
5369         __exidx_start and __exidx_end.  Make symbol table parameter
5370         anonymous as it is not used.
5371         * gold.cc (queue_middle_tasks): Call target hook to define any
5372         target-specific symbols.
5373         * target.h (Target::define_standard_symbols): New method.
5374         (Target::do_define_standard_symbols): Same.
5375         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
5376         * testsuite/Makefile.in: Regenerate.
5377         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
5378         and __exidx_end.
5379         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
5380         relocations are generated for __exidx_start and __exidx_end.
5381
5382 2012-03-16  Doug Kwan  <dougkwan@google.com>
5383
5384         * testsuite/Makefile.am: Disable test initpri3b.
5385         * testsuite/Makefile.in: Regenerate.
5386
5387 2012-03-15  Doug Kwan  <dougkwan@google.com>
5388
5389         * arm.cc (Target_arm::got_section): Make .got section read-only
5390         if -z now is given.
5391
5392 2012-03-15  Ian Lance Taylor  <iant@google.com>
5393
5394         PR gold/13850
5395         * layout.cc (Layout::make_output_section): Correctly mark
5396         SHT_INIT_ARRAY, et. al., as relro.
5397
5398 2012-03-14  Doug Kwan  <dougkwan@google.com>
5399
5400         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
5401         dynamic relocations for protected symbols in shared objects.
5402
5403 2012-03-13  Ian Lance Taylor  <iant@google.com>
5404
5405         * resolve.cc (Symbol_table::resolve): When merging common symbols,
5406         keep the larger alignment.
5407
5408 2012-03-12  Cary Coutant  <ccoutant@google.com>
5409
5410         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
5411         handling of DW_LNE_define_file.
5412
5413 2012-03-12  Cary Coutant  <ccoutant@google.com>
5414
5415         * reduced_debug_output.cc
5416         (Output_reduced_debug_info_section::get_die_end): Add new FORM
5417         codes to switch.
5418
5419 2012-02-29  Cary Coutant  <ccoutant@google.com>
5420
5421         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
5422
5423 2012-02-29  Cary Coutant  <ccoutant@google.com>
5424
5425         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5426         Call Object::decompressed_section_contents.
5427         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
5428         New dtor.
5429         (Sized_dwarf_line_info::buffer_start_): New data member.
5430         * merge.cc (Output_merge_data::do_add_input_section): Call
5431         Object::decompressed_section_contents.
5432         (Output_merge_string::do_add_input_section): Likewise.
5433         * object.cc (need_decompressed_section): New function.
5434         (build_compressed_section_map): Decompress sections needed later.
5435         (Sized_relobj_file::do_decompressed_section_contents): New function.
5436         (Sized_relobj_file::do_discard_decompressed_sections): New function.
5437         * object.h (Object::decompressed_section_contents): New function.
5438         (Object::discard_decompressed_sections): New function.
5439         (Object::do_decompressed_section_contents): New function.
5440         (Object::do_discard_decompressed_sections): New function.
5441         (Compressed_section_info): New type.
5442         (Compressed_section_map): Include decompressed section contents.
5443         (Sized_relobj_file::do_decompressed_section_contents): New function.
5444         (Sized_relobj_file::do_discard_decompressed_sections): New function.
5445
5446 2012-02-16  Cary Coutant  <ccoutant@google.com>
5447
5448         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
5449         * testsuite/Makefile.in: Regenerate.
5450
5451 2012-02-14  Cary Coutant  <ccoutant@google.com>
5452
5453         * options.cc (General_options::finalize): Disallow -pie and -static.
5454
5455 2012-02-03  Doug Kwan  <dougkwan@google.com>
5456
5457         * arm.cc (Arm_relocate_functions::abs8,
5458         Arm_relocate_functions::abs16): Use
5459         Bits::has_signed_unsigned_overflow32.
5460         (Arm_relocate_functions::thm_abs8): Correct range of
5461         overflow check.
5462         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
5463         in assertions.
5464
5465 2012-02-02  Doug Kwan  <dougkwan@google.com>
5466
5467         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
5468         position independent outputs, not just shared objects.
5469
5470 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
5471
5472         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
5473         * configure: Regenerated.
5474
5475 2012-01-27  Ian Lance Taylor  <iant@google.com>
5476
5477         * reloc.h (Bits): New class with static functions, copied from
5478         namespace utils in arm.cc.
5479         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
5480         instead.
5481
5482 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5483
5484         * incremental.cc (write_info_blocks): Correct relocation offset.
5485
5486 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5487
5488         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
5489         (Relocate::tls_gd_to_le): Likewise.
5490
5491 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5492
5493         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
5494
5495 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5496
5497         * configure.ac: Check if -mcmodel=medium works.
5498         * configure: Regenerated.
5499
5500 2012-01-24  Cary Coutant  <ccoutant@google.com>
5501
5502         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
5503         definition and ...
5504         (read_unsigned_LEB_128_x): ... this new function.
5505         (read_signed_LEB_128): Replaced with inline definition and ...
5506         (read_signed_LEB_128_x): ... this new function.
5507         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
5508         (read_unsigned_LEB_128): Add inline definition.
5509         (read_signed_LEB_128_x): New function.
5510         (read_signed_LEB_128): Add inline definition.
5511         * testsuite/Makefile.am (leb128_unittest): New unit test.
5512         * testsuite/Makefile.in: Regenerate.
5513         * testsuite/leb128_unittest.cc: New unit test.
5514
5515 2012-01-23  Ian Lance Taylor  <iant@google.com>
5516
5517         PR gold/13617
5518         * i386.cc (Target_i386::do_code_fill): When using a jmp
5519         instruction, pad with nop instructions.
5520         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5521
5522 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
5523
5524         * x86_64.cc (gc_process_relocs): Add typename on types used in
5525         template.
5526         (scan_relocs): Likewise.
5527         (relocate_section): Likewise.
5528         (apply_relocation): Likewise.
5529
5530 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
5531
5532         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
5533         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
5534         under x32.
5535
5536 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
5537
5538         * x86_64.cc: Initial support for x32.
5539
5540 2012-01-03  Cary Coutant  <ccoutant@google.com>
5541
5542         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
5543         Use abstract base class for GOT.
5544         * gold/output.h (class Output_data_got_base): New abstract base class.
5545         (class Output_data_got): Derive from new base class, adjust ctors.
5546         (Output_data_got::reserve_slot): Make virtual; rename to
5547         do_reserve_slot; Adjust callers.
5548         * gold/target.h (Sized_target::init_got_plt_for_update): Return
5549         pointer to abstract base class.
5550         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
5551
5552 2011-12-18  Ian Lance Taylor  <iant@google.com>
5553
5554         * object.h (Relobj::local_symbol_value): New function.
5555         (Relobj::local_plt_offset): New function.
5556         (Relobj::local_has_got_offset): New function.
5557         (Relobj::local_got_offset): New function.
5558         (Relobj::set_local_got_offset): New function.
5559         (Relobj::do_local_symbol_value): New pure virtual function.
5560         (Relobj::do_local_plt_offset): Likewise.
5561         (Relobj::do_local_has_got_offset): Likewise.
5562         (Relobj::do_local_got_offset): Likewise.
5563         (Relobj::do_set_local_got_offset): Likewise.
5564         (Sized_relobj::do_local_has_got_offset): Rename from
5565         local_has_got_offset.
5566         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
5567         (Sized_relobj::do_set_local_got_offset): Rename from
5568         set_local_got_offset.
5569         (Sized_relobj_file::do_local_plt_offset): Rename from
5570         local_plt_offset.
5571         (Sized_relobj_file::do_local_symbol_value): New function.
5572         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
5573         local_plt_offset.
5574         * output.cc (Output_data_got::Got_entry::write): Change object to
5575         Relobj.  Use local_symbol_value.
5576         (Output_data_got::add_global_with_rel): Change rel_dyn to
5577         Output_data_reloc_generic*.  Use add_global_generic.
5578         (Output_data_got::add_global_with_rela): Remove.  Change all
5579         callers to use add_global_with_rel.
5580         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
5581         Output_data_reloc_generic*.  Use add_global_generic.
5582         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
5583         callers to use add_global_pair_with_rel.
5584         (Output_data_got::add_local): Change object to Relobj*.
5585         (Output_data_got::add_local_plt): Likewise.
5586         (Output_data_got::add_local_with_rel): Change object to Relobj*,
5587         change rel_dyn to Output_data_reloc_generic*.  Use
5588         add_local_generic.
5589         (Output_data_got::add_local_with_rela): Remove.  Change all
5590         callers to use all_local_with_rel.
5591         (Output_data_got::add_local_pair_with_rel): Change object to
5592         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
5593         add_output_section_generic.
5594         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
5595         callers to use add_local_pair_with_rel.
5596         (Output_data_got::reserve_local): Change object to Relobj*.
5597         * output.h: (class Output_data_reloc_generic): Add pure virtual
5598         declarations for add_global_generic, add_local_generic,
5599         add_output_section_generic.
5600         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
5601         functions for Output_data_reloc_generic.  Update declarations for
5602         changes listed in output.cc.
5603         (class Output_data_got): Change template parameter to got_size.
5604         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
5605         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
5606         function.
5607         (Sized_relobj_incr::do_local_plt_offset): New function.
5608         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
5609         add_global_generic.
5610
5611 2011-12-17  Cary Coutant  <ccoutant@google.com>
5612
5613         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
5614         * resolve.cc (Symbol_table::resolve): Likewise.
5615         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
5616         arrays.
5617         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5618
5619 2011-12-16  Ian Lance Taylor  <iant@google.com>
5620
5621         * output.h (Output_data_reloc_generic::add): Only call
5622         add_dynamic_reloc if this is a dynamic reloc section.
5623
5624 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
5625
5626         PR gold/13505
5627         * target-reloc.h (apply_relocation): Replace <64, false> with
5628         <size, big_endian>.
5629
5630 2011-11-25  Nick Clifton  <nickc@redhat.com>
5631
5632         * po/it.po: New Italian translation.
5633
5634 2011-11-17  Sterling Augustine  <saugustine@google.com>
5635
5636         * script.cc (script_include_directive): Implement.
5637         (read_script_file): New local variables name and search_path. Update
5638         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
5639         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
5640         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
5641
5642 2011-11-11  Sterling Augustine  <saugustine@google.com>
5643
5644         * yyscript.y (section_cmd): Add support for INCLUDE directive.
5645         (file_or_sections_cmd): Likewise.
5646
5647 2011-11-11  Doug Kwan  <dougkwan@google.com>
5648
5649         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
5650         if --just-symbols is given.
5651
5652 2011-11-10  Doug Kwan  <dougkwan@google.com>
5653
5654         PR gold/13362
5655         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
5656         when processing data relocs.
5657         * reloc.h (Relocate_functions::rel_unaligned): New method.
5658         (Relocate_functions::pcrel_unaligned): Ditto.
5659         (Relocate_functions::rel32_unaligned): Ditto.
5660         (Relocate_functions::pcrel32_unaligned): Ditto.
5661
5662 2011-11-09  Doug Kwan  <dougkwan@google.com>
5663
5664         PR gold/13362
5665         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
5666         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
5667         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
5668         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5669         (Relocate_functions::rel_unaligned): New.
5670         (Relocate_functions::rel32_unaligned): New.
5671         * target-reloc.h (relocate_for_relocatable): Add code to handle
5672         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5673         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
5674         arm_unaligned_reloc_r): New targets.
5675         * testsuite/Makefile.in: Regenerate.
5676         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
5677         linking.
5678
5679 2011-11-02  Ian Lance Taylor  <iant@google.com>
5680
5681         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
5682         NATIVE_LINKER.
5683         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
5684         * options.cc (General_options::finalize): Use library search path
5685         from configure script if specified.  If not native and no sysroot,
5686         only search TOOLLIBDIR.
5687         * options.h (Search_directory::Search_directory): Change name to
5688         const std::string&.
5689         (General_options::add_to_library_path_with_sysroot): Change arg to
5690         const std::string&.
5691         * configure, Makefile.in, config.in: Rebuild.
5692
5693 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5694
5695         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
5696         we are working around the ARM1176 Erratum.
5697         * options.h (General_options::fix_arm1176): Add option.
5698         * testsuite/Makefile.am: Add testcases, and keep current ones
5699         working.
5700         * testsuite/Makefile.in: Regenerate.
5701         * testsuite/arm_fix_1176.s: New file.
5702         * testsuite/arm_fix_1176.sh: Likewise.
5703
5704 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5705
5706         * arm.cc (Target_arm::Target_arm): Remove initialisation of
5707         may_use_blx_.
5708         (Target_arm::may_use_blx): Remove method.
5709         (Target_arm::set_may_use_blx): Likewise.
5710         (Target_arm::may_use_v4t_interworking): New method.
5711         (Target_arm::may_use_v5t_interworking): Likewise.
5712         (Target_arm::may_use_blx_): Remove member variable.
5713         (Arm_relocate_functions::arm_branch_common): Check for v5T
5714         interworking.
5715         (Arm_relocate_functions::thumb_branch_common): Likewise.
5716         (Reloc_stub::stub_type_for_reloc): Likewise.
5717         (Target_arm::do_finalize_sections): Correct interworking checks.
5718         * testsuite/Makefile.am: Add new tests.
5719         * testsuite/Makefile.in: Regenerate.
5720         * testsuite/arm_farcall_arm_arm.s: New test.
5721         * testsuite/arm_farcall_arm_arm.sh: Likewise.
5722         * testsuite/arm_farcall_arm_thumb.s: Likewise.
5723         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
5724         * testsuite/arm_farcall_thumb_arm.s: Likewise.
5725         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
5726         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
5727         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
5728
5729 2011-10-31  Cary Coutant  <ccoutant@google.com>
5730
5731         PR gold/13023
5732         * expression.cc (Expression::eval_with_dot): Add
5733         is_section_dot_assignment parameter.
5734         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
5735         absolute and assigning to dot within a section.
5736         * script-sections.cc
5737         (Output_section_element_assignment::set_section_addresses): Pass
5738         dot_section to set_if_absolute.
5739         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
5740         as is_section_dot_assignment flag to eval_with_dot.
5741         (Output_section_element_dot_assignment::set_section_addresses):
5742         Likewise.
5743         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
5744         parameter.  Also set value if relative to dot_section; set the
5745         symbol's output_section.
5746         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
5747         parameter.  Adjust all callers.
5748         (Expression::eval_maybe_dot): Likewise.
5749         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
5750         Adjust all callers.
5751         * testsuite/script_test_2.t: Test assignment of an absolute value
5752         to dot within an output section element.
5753
5754 2011-10-31  Cary Coutant  <ccoutant@google.com>
5755
5756         * options.h (class General_options): Add --[no-]gnu-unique options.
5757         * symtab.cc (Symbol_table::sized_write_globals): Convert
5758         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
5759
5760 2011-10-31  Cary Coutant  <ccoutant@google.com>
5761
5762         PR gold/13359
5763         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
5764         unnecessary assertion.
5765         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
5766
5767 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
5768
5769         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5770         gc_mark_symbol.
5771         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5772         gc_mark_symbol.
5773         Change to just keep the section associated with symbol.
5774         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
5775         they are externally visible and --export-dynamic is turned on.
5776         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
5777
5778 2011-10-19  Ian Lance Taylor  <iant@google.com>
5779
5780         PR gold/13163
5781         * script-sections.cc
5782         (Output_section_element_dot_assignment::needs_output_section): New
5783         function.
5784
5785 2011-10-19  Ian Lance Taylor  <iant@google.com>
5786
5787         PR gold/13204
5788         * layout.cc (Layout::segment_precedes): Don't assert failure if a
5789         --section-start option was seen.
5790         * options.h (General_options::any_section_start): New function.
5791
5792 2011-10-18  David S. Miller  <davem@davemloft.net>
5793
5794         PR binutils/13301
5795         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
5796         member to track relocation locations that have moved during TLS
5797         reloc optimizations.
5798         (Target_sparc::Relocate::Relocate): Initialize to NULL.
5799         (Target_sparc::Relocate::relocate): Adjust view down by 4
5800         bytes if it matches reloc_adjust_addr_.
5801         (Target_sparc::Relocate::relocate_tls): Always move the
5802         __tls_get_addr call delay slot instruction forward 4 bytes when
5803         performing relaxation.
5804
5805 2011-10-18  Cary Coutant  <ccoutant@google.com>
5806
5807         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
5808         (Output_file::map_no_anonymous): Check for non-zero
5809         return code from posix_fallocate.
5810
5811 2011-10-17  Cary Coutant  <ccoutant@google.com>
5812
5813         PR gold/13245
5814         * plugin.cc (is_visible_from_outside): Check for symbols
5815         referenced from dynamic objects.
5816         * resolve.cc (Symbol_table::resolve): Don't count references
5817         from dynamic objects as references from real ELF files.
5818         * testsuite/plugin_test_2.sh: Adjust expected result.
5819
5820 2011-10-17  Cary Coutant  <ccoutant@google.com>
5821
5822         * gold.cc: Include timer.h.
5823         (queue_middle_tasks): Stamp time.
5824         (queue_final_tasks): Likewise.
5825         * main.cc (main): Store timer in parameters.  Print timers
5826         for each pass.
5827         * parameters.cc (Parameters::Parameters): Initialize timer_.
5828         (Parameters::set_timer): New function.
5829         (set_parameters_timer): New function.
5830         * parameters.h (Parameters::set_timer): New function.
5831         (Parameters::timer): New function.
5832         (Parameters::timer_): New data member.
5833         (set_parameters_timer): New function.
5834         * timer.cc (Timer::stamp): New function.
5835         (Timer::get_pass_time): New function.
5836         * timer.h (Timer::stamp): New function.
5837         (Timer::get_pass_time): New function.
5838         (Timer::pass_times_): New data member.
5839
5840 2011-10-17  Cary Coutant  <ccoutant@google.com>
5841
5842         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
5843         task for members of lib groups.
5844
5845 2011-10-17  Cary Coutant  <ccoutant@google.com>
5846
5847         PR gold/13288
5848         * fileread.cc (File_read::find_view): Add assert.
5849         (File_read::make_view): Move bounds check (replace with assert)...
5850         (File_read::find_or_make_view): ... to here.
5851
5852 2011-10-12  Cary Coutant  <ccoutant@google.com>
5853
5854         * output.cc (Output_file::open_base_file): Handle case where
5855         ::read returns less than requested size.
5856
5857 2011-10-10  Cary Coutant  <ccoutant@google.com>
5858
5859         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
5860         Initialize defined_count_.
5861         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
5862         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
5863         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
5864         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
5865         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
5866         * incremental.h (Sized_relobj_incr::defined_count_): New data
5867         member.
5868         (Sized_incr_dynobj::defined_count_): New data member.
5869         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
5870         Return zeroes instead of internal error.
5871
5872 2011-10-10  Cary Coutant  <ccoutant@google.com>
5873
5874         PR gold/13249
5875         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
5876         (Output_reloc::symbol_value): Return PLT offset if flag is set.
5877         * output.h (class Output_reloc): Add use_plt_offset flag.
5878         (Output_reloc::type_): Adjust size of bit field.
5879         (Output_reloc::use_plt_offset_): New bit field.
5880         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
5881         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
5882         flag.  Adjust all callers.
5883         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
5884         creating RELATIVE relocations.
5885
5886 2011-10-10  Nick Clifton  <nickc@redhat.com>
5887
5888         * po/es.po: Updated Spanish translation.
5889         * po/fi.po: Updated Finnish translation.
5890
5891 2011-10-03   Diego Novillo  <dnovillo@google.com>
5892
5893         * options.cc (parse_uint): Fix dereference of RETVAL.
5894
5895 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
5896
5897         * layout.h (section_order_map_): New member.
5898         (get_section_order_map): New member function.
5899         * output.cc (Output_section::add_input_section): Check for patterns
5900         only when --section-ordering-file is specified.
5901         * gold.cc (queue_middle_tasks): Delay updating order of sections till
5902         output_sections have been formed.
5903         * layout.cc (Layout_Layout): Initialize section_order_map_.
5904         * plugin.cc (update_section_order): Store order in order_map. Do not
5905         update the order.
5906         * testsuite/Makefile.am: Add test case for plugin_final_layout.
5907         * testsuite/Makefile.in: Regenerate.
5908         * testsuite/plugin_section_order.c: New file.
5909         * testsuite/plugin_final_layout.cc: New file.
5910         * testsuite/plugin_final_layout.sh: New file.
5911
5912 2011-09-29  Cary Coutant  <ccoutant@google.com>
5913
5914         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5915         Check for NULL.
5916         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
5917         symbols during incremental update.
5918         (Symbol_table::add_from_dynobj): Likewise.
5919
5920 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5921             Ian Lance Taylor  <iant@google.com>
5922
5923         * symtab.cc (Symbol_table::define_special_symbol): Always
5924         canonicalize version string.
5925
5926 2011-09-26  Cary Coutant  <ccoutant@google.com>
5927
5928         * gold.cc (queue_initial_tasks): Move option checks ...
5929         * options.cc (General_options::finalize): ... to here. Disable
5930         some options; make others fatal.
5931
5932 2011-09-26  Cary Coutant  <ccoutant@google.com>
5933
5934         gcc PR lto/47247
5935         * plugin.cc (get_symbols_v2): New function.
5936         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
5937         (is_referenced_from_outside): New function.
5938         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
5939         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
5940         (get_symbols): Pass version parameter.
5941         (get_symbols_v2): New function.
5942         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
5943         parameter.
5944         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
5945         (onload): Add LDPT_GET_SYMBOLS_V2.
5946         (all_symbols_read_hook): Use get_symbols_v2; check for
5947         LDPR_PREVAILING_DEF_IRONLY_EXP.
5948         * testsuite/plugin_test_3.sh: Update expected results.
5949
5950 2011-09-23  Simon Baldwin  <simonb@google.com>
5951
5952         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5953         configuration options.
5954         * configure: Regenerate.
5955         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
5956         * Makefile.in: Regenerate.
5957         * testsuite/Makefile.in: Regenerate.
5958
5959 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
5960
5961         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
5962
5963 2011-09-19  Cary Coutant  <ccoutant@google.com>
5964
5965         * incremental.cc (can_incremental_update): Fix typo in comment.
5966         * incremental.h (can_incremental_update): Likewise.
5967
5968 2011-09-18  Cary Coutant  <ccoutant@google.com>
5969
5970         * incremental.cc (can_incremental_update): New function.
5971         * incremental.h (can_incremental_update): New function.
5972         * layout.cc (Layout::init_fixed_output_section): Call it.
5973         (Layout::make_output_section): Don't allow patch space in .eh_frame.
5974         * object.cc (Sized_relobj_file::do_layout): Call
5975         can_incremental_update.
5976
5977 2011-09-13  Cary Coutant  <ccoutant@google.com>
5978
5979         * configure.ac: Check for glibc support for gnu_indirect_function
5980         support with static linking, setting automake conditional
5981         IFUNC_STATIC.
5982         * Makefile.in: Regenerate.
5983         * configure: Regenerate.
5984
5985         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
5986         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
5987         for IFUNC_STATIC.
5988         * testsuite/Makefile.in: Regenerate.
5989
5990 2011-09-13  Cary Coutant  <ccoutant@google.com>
5991
5992         * incremental.cc (Sized_relobj_incr::do_layout): Call
5993         report_comdat_group for kept comdat sections.
5994         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
5995         * testsuite/Makefile.in: Regenerate.
5996         * testsuite/incr_comdat_test_1.cc: New source file.
5997         * testsuite/incr_comdat_test_2_v1.cc: New source file.
5998         * testsuite/incr_comdat_test_2_v2.cc: New source file.
5999         * testsuite/incr_comdat_test_2_v3.cc: New source file.
6000
6001 2011-09-13  Ian Lance Taylor  <iant@google.com>
6002
6003         * object.cc (Sized_relobj_file::do_layout): Remove unused local
6004         variable external_symbols_offset.
6005
6006 2011-09-12  Ian Lance Taylor  <iant@google.com>
6007
6008         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
6009         triggered if object has no symbols.
6010
6011 2011-09-09  David S. Miller  <davem@davemloft.net>
6012
6013         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
6014         (Output_fill_debug_line::do_write): Likewise.
6015
6016 2011-08-29  Cary Coutant  <ccoutant@google.com>
6017
6018         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
6019         casts to match formatting specs.
6020         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
6021
6022 2011-08-26  Cary Coutant  <ccoutant@google.com>
6023
6024         * layout.cc (Free_list::allocate): Provide guarantee of minimum
6025         remaining hole size when allocating.
6026         (Layout::make_output_section): Set fill methods for debug sections.
6027         * layout.h (Free_list::Free_list_node): Move from private to
6028         public.
6029         (Free_list::set_min_hole_size): New function.
6030         (Free_list::begin, Free_list::end): New functions.
6031         (Free_list::min_hole_): New data member.
6032         * output.cc: Include dwarf.h.
6033         (Output_fill_debug_info::do_minimum_hole_size): New function.
6034         (Output_fill_debug_info::do_write): New function.
6035         (Output_fill_debug_line::do_minimum_hole_size): New function.
6036         (Output_fill_debug_line::do_write): New function.
6037         (Output_section::Output_section): Initialize new data member.
6038         (Output_section::set_final_data_size): Ensure patch space is larger
6039         than minimum hole size.
6040         (Output_section::do_write): Fill holes in debug sections.
6041         * output.h (Output_fill): New class.
6042         (Output_fill_debug_info): New class.
6043         (Output_fill_debug_line): New class.
6044         (Output_section::set_free_space_fill): New function.
6045         (Output_section::free_space_fill_): New data member.
6046         * testsuite/Makefile.am (incremental_test_3): Add
6047         --incremental-patch option.
6048         (incremental_test_4): Likewise.
6049         (incremental_test_5): Likewise.
6050         (incremental_test_6): Likewise.
6051         (incremental_copy_test): Likewise.
6052         (incremental_common_test_1): Likewise.
6053         * testsuite/Makefile.in: Regenerate.
6054
6055 2011-08-26  Nick Clifton  <nickc@redhat.com>
6056
6057         * po/es.po: Updated Spanish translation.
6058
6059 2011-08-01  Cary Coutant  <ccoutant@google.com>
6060
6061         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
6062         * gold/testsuite/Makefile.in: Regenerate.
6063         * gold/testsuite/justsyms_exec.c: New source file.
6064         * gold/testsuite/justsyms_lib.c: New source file.
6065
6066 2011-08-01  Cary Coutant  <ccoutant@google.com>
6067
6068         * layout.cc (Layout::set_segment_offsets): Don't realign text
6069         segment if -Ttext was specified.
6070         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
6071         file type.
6072         * object.h (Sized_relobj_file::e_type): New function.
6073         (Sized_relobj_file::e_type_): New data member.
6074         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
6075         base address for ET_EXEC files.
6076         * target.cc (Target::do_make_elf_object_implementation): Allow
6077         ET_EXEC files with --just-symbols option.
6078
6079 2011-07-28  Cary Coutant  <ccoutant@google.com>
6080
6081         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
6082         Add thread_number parameter.
6083         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
6084         * workqueue-threads.cc
6085         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
6086         current thread if its thread number is greater than desired thread
6087         count.
6088         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
6089         Add thread_number parameter.
6090         (Workqueue::should_cancel_thread): Likewise.
6091         (Workqueue::find_runnable_or_wait): Pass thread_number to
6092         should_cancel_thread.
6093         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
6094         parameter.
6095
6096 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
6097
6098         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
6099         only after checking if it cannot be forced local.
6100         * symtab.h (is_externally_visible): Check if the symbol is not forced
6101         local.
6102
6103 2011-07-15  Ian Lance Taylor  <iant@google.com>
6104
6105         * options.h (class General_options): Add --print-output-format.
6106         Move -EL next to -EB, for  better --help output.
6107         * target-select.cc: Include <cstdio>, "options.h", and
6108         "parameters.h".
6109         (Target_selector::do_target_bfd_name): New function.
6110         (print_output_format): New function.
6111         * target-select.h (class Target_selector): Update declarations.
6112         (Target_selector::target_bfd_name): New function.
6113         (print_output_format): Declare.
6114         * main.cc: Include "target-select.h".
6115         (main): Handle --print-output-format.
6116         * gold.cc: Include "target-select.h".
6117         (queue_initial_tasks): Handle --print-output-format when there are
6118         no input files.
6119         * parameters.cc (parameters_force_valid_target): Give a better
6120         error message if -EB/-EL does not match target.
6121         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
6122         function.
6123
6124 2011-07-15  Ian Lance Taylor  <iant@google.com>
6125
6126         * i386.cc (class Output_data_plt_i386): Add layout_ field.
6127         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
6128         (Output_data_plt_i386::do_write): Write address of .dynamic
6129         section to first entry in .got.plt section.
6130         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
6131         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
6132         Initialize layout_.
6133         (Output_data_plt_x86_64::do_write): Write address of .dynamic
6134         section to first entry in .got.plt section.
6135         * layout.h (Layout::dynamic_section): New function.
6136
6137 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
6138
6139         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
6140         to claim_file call.
6141         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
6142         input_section_position_, and input_section_glob_.
6143         (read_layout_from_file): Call function section_ordering_specified.
6144         * layout.h (is_section_ordering_specified): New function.
6145         (section_ordering_specified): New function.
6146         (section_ordering_specified_): New boolean member.
6147         * main.cc(main): Call load_plugins after layout object is defined.
6148         * output.cc (Output_section::add_input_section): Use
6149         function section_ordering_specified to check if section ordering is
6150         needed.
6151         * output.cc (Output_section::add_relaxed_input_section): Use
6152         function section_ordering_specified to check if section ordering is
6153         needed.
6154         (Output_section::update_section_layout): New function.
6155         (Output_section::sort_attached_input_sections): Check if input section
6156         must be reordered.
6157         * output.h (Output_section::update_section_layout): New function.
6158         * plugin.cc (get_section_count): New function.
6159         (get_section_type): New function.
6160         (get_section_name): New function.
6161         (get_section_contents): New function.
6162         (update_section_order): New function.
6163         (allow_section_ordering): New function.
6164         (Plugin::load): Add the new interfaces to the transfer vector.
6165         (Plugin_manager::load_plugins): New parameter.
6166         (Plugin_manager::all_symbols_read): New parameter.
6167         (Plugin_manager::claim_file): New parameter. Save the elf object for
6168         unclaimed objects.
6169         (Plugin_manager::get_elf_object): New function.
6170         (Plugin_manager::get_view): Change to directly use the bool to check
6171         if get_view is called from claim_file_hook.
6172         * plugin.h (input_objects): New function
6173         (Plugin__manager::load_plugins): New parameter.
6174         (Plugin_manager::claim_file): New parameter.
6175         (Plugin_manager::get_elf_object): New function.
6176         (Plugin_manager::in_claim_file_handler): New function.
6177         (Plugin_manager::in_claim_file_handler_): New member.
6178         (layout): New function.
6179         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
6180         handler with an extra parameter. Make the elf object before calling
6181         claim_file handler.
6182         * testsuite/plugin_test.c (get_section_count): New function pointer.
6183         (get_section_type): New function pointer.
6184         (get_section_name): New function pointer.
6185         (get_section_contents): New function pointer.
6186         (update_section_order): New function pointer.
6187         (allow_section_ordering): New function pointer.
6188         (onload): Check if the new interfaces exist.
6189
6190 2011-07-13  Ian Lance Taylor  <iant@google.com>
6191
6192         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
6193         relro section.
6194         * x86_64.cc (Target_x86_64::got_section): Likewise.
6195         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
6196         (relro_now_test_SOURCES): New variable.
6197         (relro_now_test_DEPENDENCIES): New variable.
6198         (relro_now_test_LDFLAGS): New variable.
6199         (relro_now_test_LDADD): New variable.
6200         (relro_now_test.so): New target.
6201         * testsuite/Makefile.in: Rebuild.
6202
6203 2011-07-12  Ian Lance Taylor  <iant@google.com>
6204
6205         PR gold/12980
6206         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
6207         GLOB_DAT relocation rather than a RELATIVE relocation for a
6208         protected symbol when creating a shared library.
6209         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6210         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
6211         * testsuite/protected_main_1.cc (main): Test that protected
6212         function has same address.
6213
6214 2011-07-11  Ian Lance Taylor  <iant@google.com>
6215
6216         PR gold/12979
6217         * options.h (class General_options): Add -Bgroup.
6218         * options.cc (General_options::finalize): If -Bgroup is set,
6219         default to --unresolved-symbols=report-all.
6220         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
6221         * target-reloc.h (issue_undefined_symbol_error): Handle
6222         --unresolved-symbols=report-all.
6223
6224 2011-07-08  Ian Lance Taylor  <iant@google.com>
6225
6226         PR gold/11985
6227         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
6228         if linker script discards key sections.
6229         (Layout::create_dynamic_symtab): Likewise.
6230         (Layout::assign_local_dynsym_offsets): Likewise.
6231         (Layout::sized_create_version_sections): Likewise.
6232         (Layout::create_interp): Likewise.
6233         (Layout::finish_dynamic_section): Likewise.
6234         (Layout::set_dynamic_symbol_size): Likewise.
6235
6236 2011-07-08  Ian Lance Taylor  <iant@google.com>
6237
6238         PR gold/12386
6239         * options.h (class General_options): Add --unresolved-symbols.
6240         * target-reloc.h (issue_undefined_symbol_error): Check
6241         --unresolved-symbols.  Add comments.
6242
6243 2011-07-08  Ian Lance Taylor  <iant@google.com>
6244
6245         * testsuite/odr_violation2.cc (Ordering::operator()): Make
6246         expression more complex.
6247
6248 2011-07-08  Ian Lance Taylor  <iant@google.com>
6249
6250         PR gold/11317
6251         * target-reloc.h (issue_undefined_symbol_error): New inline
6252         function, broken out of relocate_section.
6253         (relocate_section): Call issue_undefined_symbol_error.
6254         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
6255         there is no TLS segment if we are about to issue an undefined
6256         symbol error.
6257         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
6258
6259 2011-07-08  Ian Lance Taylor  <iant@google.com>
6260
6261         PR gold/12279
6262         * resolve.cc (Symbol_table::should_override): Add fromtype
6263         parameter.  Change all callers.  Give error when linking together
6264         TLS and non-TLS symbol.
6265         (Symbol_table::should_override_with_special): Add fromtype
6266         parameter.  Change all callers.
6267         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
6268         there is no TLS segment if we have reported some errors.
6269         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
6270
6271 2011-07-08  Ian Lance Taylor  <iant@google.com>
6272
6273         PR gold/12372
6274         * target.h (Target::plt_address_for_global): New function.
6275         (Target::plt_address_for_local): New function.
6276         (Target::plt_section_for_global): Remove.
6277         (Target::plt_section_for_local): Remove.
6278         (Target::do_plt_address_for_global): New virtual function.
6279         (Target::do_plt_address_for_local): New virtual function.
6280         (Target::do_plt_section_for_global): Remove.
6281         (Target::do_plt_section_for_local): Remove.
6282         (Target::register_global_plt_entry): Add Symbol_table and Layout
6283         parameters.
6284         * output.cc (Output_data_got::Got_entry::write): Use
6285         plt_address_for_global and plt_address_for_local.
6286         * layout.cc (Layout::add_target_dynamic_tags): Use size and
6287         address of output section.
6288         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
6289         got_irelative_, and irelative_count_ fields.  Update
6290         declarations.
6291         (Output_data_plt_i386::has_irelative_section): New function.
6292         (Output_data_plt_i386::entry_count): Add irelative_count_.
6293         (Output_data_plt_i386::set_final_data_size): Likewise.
6294         (class Target_i386): Add got_irelative_ and rel_irelative_
6295         fields.  Update declarations.
6296         (Target_i386::Target_i386): Initialize new fields.
6297         (Target_i386::do_plt_address_for_global): New function replacing
6298         do_plt_section_for_global.
6299         (Target_i386::do_plt_address_for_local): New function replacing
6300         do_plt_section_for_local.
6301         (Target_i386::got_section): Create got_irelative_.
6302         (Target_i386::rel_irelative_section): New function.
6303         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
6304         fields.  Don't define __rel_iplt_{start,end}.
6305         (Output_data_plt_i386::add_entry): Add symtab and layout
6306         parameters.  Change all callers.  Use different PLT and GOT for
6307         IFUNC symbols.
6308         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
6309         layout parameters.  Change all callers.  Use different PLT and
6310         GOT.
6311         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
6312         (Output_data_plt_i386::rel_irelative): New function.
6313         (Output_data_plt_i386::address_for_global): New function.
6314         (Output_data_plt_i386::address_for_local): New function.
6315         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
6316         IRELATIVE GOT when changing IFUNC GOT entries.
6317         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
6318         reloc.
6319         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
6320         if we didn't create an IRELATIVE GOT.
6321         (Target_i386::Relocate::relocate): Use plt_address_for_global and
6322         plt_address_for_local.
6323         (Target_i386::do_dynsym_value): Use plt_address_for_global.
6324         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
6325         got_irelative_, and irelative_count_ fields.  Update
6326         declarations.
6327         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
6328         Initialize new fields.  Remove symtab parameter.  Change all
6329         callers.
6330         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
6331         irelative_count_.
6332         (Output_data_plt_x86_64::has_irelative_section): New function.
6333         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
6334         (class Target_x86_64): Add got_irelative_ and rel_irelative_
6335         fields.  Update declarations.
6336         (Target_x86_64::Target_x86_64): Initialize new fields.
6337         (Target_x86_64::do_plt_address_for_global): New function replacing
6338         do_plt_section_for_global.
6339         (Target_x86_64::do_plt_address_for_local): New function replacing
6340         do_plt_section_for_local.
6341         (Target_x86_64::got_section): Create got_irelative_.
6342         (Target_x86_64::rela_irelative_section): New function.
6343         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
6344         all callers.  Don't create __rel_iplt_{start,end}.
6345         (Output_data_plt_x86_64::add_entry): Add symtab and layout
6346         parameters.  Change all callers.  Use different PLT and GOT for
6347         IFUNC symbols.
6348         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
6349         layout parameters.  Change all callers.  Use different PLT and
6350         GOT.
6351         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
6352         parameters.  Change all callers.  Use different PLT and GOT for
6353         IFUNC symbols.
6354         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
6355         (Output_data_plt_x86_64::rela_irelative): New function.
6356         (Output_data_plt_x86_64::address_for_global): New function.
6357         (Output_data_plt_x86_64::address_for_local): New function.
6358         (Output_data_plt_x86_64::set_final_data_size): Likewise.
6359         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
6360         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
6361         (Target_x86_64::register_global_plt_entry): Add symtab and layout
6362         parameters.
6363         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
6364         reloc.
6365         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
6366         symbols if we didn't create an IRELATIVE GOT.
6367         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
6368         plt_address_for_local.
6369         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
6370         * testsuite/ifuncvar1.c: New test file.
6371         * testsuite/ifuncvar2.c: New test file.
6372         * testsuite/ifuncvar3.c: New test file.
6373         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
6374         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
6375         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
6376         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
6377         * testsuite/Makefile.in: Rebuild.
6378
6379 2011-07-07  Cary Coutant  <ccoutant@google.com>
6380
6381         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
6382         (two_file_test_1_ndebug.o): Likewise.
6383         (two_file_test_1b_ndebug.o): Likewise.
6384         (two_file_test_2_ndebug.o): Likewise.
6385         (two_file_test_main_ndebug.o): Likewise.
6386         (incremental_test_2): Link with no-debug versions.
6387
6388 2011-07-06  Cary Coutant  <ccoutant@google.com>
6389
6390         * gold/incremental.cc
6391         (Output_section_incremental_inputs::write_info_blocks): Check for
6392         hidden and internal symbols.
6393
6394 2011-07-06  Cary Coutant  <ccoutant@google.com>
6395
6396         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
6397         Check disposition for startup file.
6398         (Incremental_inputs::report_command_line): Ignore
6399         --incremental-startup-unchanged option.
6400         * options.cc (General_options::parse_incremental_startup_unchanged):
6401         New function.
6402         (General_options::General_options): Initialize new data member.
6403         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
6404         (General_options): Add --incremental-startup-unchanged option.
6405         (General_options::incremental_startup_disposition): New function.
6406         (General_options::incremental_startup_disposition_): New data member.
6407
6408 2011-07-06  Cary Coutant  <ccoutant@google.com>
6409
6410         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
6411         input file index to Script_info ctor.
6412         (Sized_incremental_binary::do_file_has_changed): Find the
6413         command-line argument for files named in scripts.
6414         * incremental.h (Script_info::Script_info): New ctor
6415         with input file index.
6416         (Script_info::input_file_index): New function.
6417         (Script_info::input_file_index_): New data member.
6418         (Incremental_binary::get_library): Add const.
6419         (Incremental_binary::get_script_info): Add const.
6420         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
6421         * testsuite/Makefile.am (incremental_test_5): New test case.
6422         (incremental_test_6): New test case.
6423         * testsuite/Makefile.in: Regenerate.
6424
6425 2011-07-06  Cary Coutant  <ccoutant@google.com>
6426
6427         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
6428         debug output when command lines differ.
6429
6430 2011-07-06  Cary Coutant  <ccoutant@google.com>
6431
6432         * incremental.cc (Incremental_inputs::report_command_line): Ignore
6433         --incremental-patch option.
6434         * layout.cc (Free_list::allocate): Extend allocation beyond original
6435         end if enabled.
6436         (Layout::make_output_section): Mark sections that should get
6437         patch space.
6438         * options.cc (parse_percent): New function.
6439         * options.h (parse_percent): New function.
6440         (DEFINE_percent): New macro.
6441         (General_options): Add --incremental-patch option.
6442         * output.cc (Output_section::Output_section): Initialize new data
6443         members.
6444         (Output_section::add_input_section): Print section name when out
6445         of patch space.
6446         (Output_section::add_output_section_data): Likewise.
6447         (Output_section::set_final_data_size): Add patch space when
6448         doing --incremental-full.
6449         (Output_section::do_reset_address_and_file_offset): Remove patch
6450         space.
6451         (Output_segment::set_section_list_addresses): Print debug output
6452         only if --incremental-update.
6453         * output.h (Output_section::set_is_patch_space_allowed): New function.
6454         (Output_section::is_patch_space_allowed_): New data member.
6455         (Output_section::patch_space_): New data member.
6456         * parameters.cc (Parameters::incremental_full): New function.
6457         * parameters.h (Parameters::incremental_full): New function
6458         * testsuite/Makefile.am (incremental_test_2): Add test for
6459         --incremental-patch option.
6460         * testsuite/Makefile.in: Regenerate.
6461         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
6462         (t18): Remove function body.
6463
6464 2011-07-05  Doug Kwan  <dougkwan@google.com>
6465
6466         PR gold/12771
6467         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
6468         Arm_Address type for relocation result.
6469         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
6470         overflow check.
6471         (Arm_relocate_functions::abs32): Use unaligned access.
6472         (Arm_relocate_functions::rel32): Ditto.
6473         (Arm_relocate_functions::prel31): Ditto.
6474         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
6475         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
6476         static data relocations.
6477         * testsuite/Makefile.in: Regnerate.
6478         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
6479
6480 2011-07-05  Ian Lance Taylor  <iant@google.com>
6481
6482         PR gold/12392
6483         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
6484         symbols if necessary.
6485         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6486
6487 2011-07-05  Ian Lance Taylor  <iant@google.com>
6488
6489         PR gold/12952
6490         * resolve.cc (Symbol::override_base_with_special): Simply override
6491         version with special symbol version, ignoring previous version.
6492
6493 2011-07-05  Ian Lance Taylor  <iant@google.com>
6494
6495         * object.cc (Sized_relobj_file::include_section_group): Add
6496         information to comment about signature location.
6497
6498 2011-07-02  Ian Lance Taylor  <iant@google.com>
6499
6500         PR gold/12957
6501         * options.h (class General_options): Add -f and -F.
6502         * options.cc (General_options::finalize): Fatal error if -f/-F
6503         are used without -shared.
6504         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
6505
6506 2011-07-02  Ian Lance Taylor  <iant@google.com>
6507
6508         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
6509
6510 2011-07-01  Ian Lance Taylor  <iant@google.com>
6511
6512         PR gold/12525
6513         PR gold/12952
6514         * resolve.cc (Symbol::override_base_with_special): Don't override
6515         the version if the overriding symbol has a different name.
6516         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
6517         all callers.  If we give an error about an undefined version,
6518         define the base version if necessary.
6519         * dynobj.h (class Versions): Update declaration.
6520         * testsuite/weak_alias_test_5.cc: New file.
6521         * testsuite/weak_alias_test.script: New file.
6522         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
6523         and versioned_alias have the right value, and call t2.
6524         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
6525         weak_alias_test_5.so.
6526         (weak_alias_test_LDADD): Likewise.
6527         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
6528         * testsuite/Makefile.in: Rebuild.
6529
6530 2011-07-01  Ian Lance Taylor  <iant@google.com>
6531
6532         PR gold/12525
6533         * options.h (class General_options): Support -z notext.
6534         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
6535         -Wl,-z,notext.
6536         (two_file_shared_nonpic.so): Likewise.
6537         (two_file_shared_mixed.so): Likewise.
6538         (two_file_shared_mixed_1.so): Likewise.
6539         (weak_undef_lib_nonpic.so): Likewise.
6540         (alt/weak_undef_lib_nonpic.so): Likewise.
6541         (tls_test_shared_nonpic.so): Likewise.
6542         * testsuite/Makefile.in: Rebuild.
6543
6544 2011-07-01  Ian Lance Taylor  <iant@google.com>
6545
6546         PR gold/12525
6547         * configure.ac: Test whether static linking works, setting
6548         the automake conditional HAVE_STATIC.
6549         * testsuite/Makefile.am: Disable tests using -static if
6550         HAVE_STATIC is not true.
6551         * configure, testsuite/Makefile.in: Rebuild.
6552
6553 2011-07-01  Ian Lance Taylor  <iant@google.com>
6554
6555         PR gold/12525
6556         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
6557         Assert if we see DW_EH_PE_indirect.
6558         * target.h (Target::ehframe_datarel_base): New function.
6559         (Target::do_ehframe_datarel_base): New target function.
6560         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
6561         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
6562         function.
6563
6564 2011-07-01  Ian Lance Taylor  <iant@google.com>
6565
6566         PR gold/12571
6567         * options.h (class General_options): Add
6568         --ld-generated-unwind-info.
6569         * ehframe.cc (Fde::write): Add address parameter.  Change all
6570         callers.  If associated with PLT, fill in address and size.
6571         (Cie::set_output_offset): Only add merge mapping if there is an
6572         object.
6573         (Cie::write): Add address parameter.  Change all callers.
6574         (Eh_frame::add_ehframe_for_plt): New function.
6575         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
6576         input_offset_ fields into union u_, with new plt field.
6577         (Fde::Fde): Adjust for new union field.
6578         (Fde::Fde) [Output_data version]: New constructor.
6579         (Fde::add_mapping): Only add merge mapping if there is an object.
6580         (class Cie): Update declarations.
6581         (class Eh_frame): Declare add_ehframe_for_plt.
6582         * layout.cc (Layout::layout_eh_frame): Break out code into
6583         make_eh_frame_section, and call it.
6584         (Layout::make_eh_frame_section): New function.
6585         (Layout::add_eh_frame_for_plt): New function.
6586         * layout.h (class Layout): Update declarations.
6587         * merge.cc (Merge_map::add_mapping): Add assertion.
6588         * i386.cc: Include "dwarf.h".
6589         (class Output_data_plt_i386): Make first_plt_entry,
6590         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
6591         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6592         and plt_eh_frame_fde.
6593         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
6594         boundary.  Call add_eh_frame_for_plt if appropriate.
6595         * x86_64.cc: Include "dwarf.h".
6596         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
6597         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
6598         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6599         and plt_eh_frame_fde.
6600         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
6601         appropriate.
6602
6603 2011-06-29  Ian Lance Taylor  <iant@google.com>
6604
6605         PR gold/12629
6606         * object.cc (Sized_relobj_file::layout_section): Change shdr
6607         parameter to be const.
6608         (Sized_relobj_file::layout_eh_frame_section): New function, broken
6609         out of do_layout.
6610         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
6611         appropriate.  Call layout_eh_frame_section.
6612         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
6613         sections.
6614         * object.h (class Sized_relobj_file): Update declarations.
6615
6616 2011-06-29  Ian Lance Taylor  <iant@google.com>
6617
6618         PR gold/12652
6619         * script.cc (Token::integer_value): Accept trailing M/m/K/k
6620         modifier.
6621         (Lex::gather_token): Accept trailing M/m/K/k for integers.
6622
6623 2011-06-29  Ian Lance Taylor  <iant@google.com>
6624
6625         PR gold/12675
6626         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
6627         SHT_X86_64_UNWIND.
6628         * layout.cc (Layout::layout_eh_frame): Likewise.
6629
6630 2011-06-29  Ian Lance Taylor  <iant@google.com>
6631
6632         PR gold/12695
6633         * layout.cc (Layout::symtab_section_shndx): New function.
6634         * layout.h (class Layout): Declare symtab_section_shndx.
6635         * output.cc (Output_section::write_header): Call it.
6636
6637 2011-06-29  Ian Lance Taylor  <iant@google.com>
6638
6639         PR gold/12818
6640         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
6641         symbols which are not used in a relocation.
6642
6643 2011-06-28  Ian Lance Taylor  <iant@google.com>
6644
6645         PR gold/12898
6646         * layout.cc (Layout::segment_precedes): Don't crash if a linker
6647         script create indistinguishable segments.
6648         (Layout::set_segment_offsets): Use stable_sort when sorting
6649         segments.  Pass this to Compare_segments constructor.
6650         * layout.h (class Layout): Make segment_precedes non-static.
6651         (class Compare_segments): Change from struct to class.  Add
6652         layout_ field.  Add constructor.
6653         * script-sections.cc
6654         (Script_sections::attach_sections_using_phdrs_clause): Rename
6655         local orphan to is_orphan.  Don't report failure to put empty
6656         section in segment.  On attachment failure, report name of
6657         section, and attach to first PT_LOAD segment.
6658
6659 2011-06-28  Ian Lance Taylor  <iant@google.com>
6660
6661         PR gold/12934
6662         * target-select.cc (Target_selector::Target_selector): Add
6663         emulation parameter.  Change all callers.
6664         (select_target_by_bfd_name): Rename from select_target_by_name.
6665         Change all callers.
6666         (select_target_by_emulation): New function.
6667         (supported_emulation_names): New function.
6668         * target-select.h (class Target_selector): Add emulation_ field.
6669         Update declarations.
6670         (Target_selector::recognize_by_bfd_name): Rename from
6671         recognize_by_name.  Change all callers.
6672         (Target_selector::supported_bfd_names): Rename from
6673         supported_names.  Change all callers.
6674         (Target_selector::recognize_by_emulation): New function.
6675         (Target_selector::supported_emulations): New function.
6676         (Target_selector::emulation): New function.
6677         (Target_selector::do_recognize_by_bfd_name): Rename from
6678         do_recognize_by_name.  Change all callers.
6679         (Target_selector::do_supported_bfd_names): Rename from
6680         do_supported_names.  Change all callers.
6681         (Target_selector::do_recognize_by_emulation): New function.
6682         (Target_selector::do_supported_emulations): New function.
6683         (select_target_by_bfd_name): Change name in declaration.
6684         (select_target_by_emulation): Declare.
6685         (supported_emulation_names): Declare.
6686         * parameters.cc (parameters_force_valid_target): Try to find
6687         target based on emulation from -m option.
6688         * options.h (class General_options): Change doc string for -m.
6689         * options.cc (help): Print emulations.
6690         (General_options::parse_V): Likewise.
6691         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
6692         Add emulation parameter.  Change all callers.
6693
6694 2011-06-28  Ian Lance Taylor  <iant@google.com>
6695
6696         * target.h (class Target): Add osabi_ field.
6697         (Target::osabi): New function.
6698         (Target::set_osabi): New function.
6699         (Target::Target): Initialize osabi_.
6700         (Target::do_adjust_elf_header): Make pure virtual.
6701         (Sized_target::do_adjust_elf_header): Declare.
6702         * target.cc (Sized_target::do_adjust_elf_header): New function.
6703         (class Sized_target): Instantiate all versions.
6704         * freebsd.h (class Target_freebsd): Remove.
6705         (Target_selector_freebsd::do_recognize): Call set_osabi on
6706         Target.
6707         (Target_selector_freebsd::do_recognize_by_name): Likewise.
6708         (Target_selector_freebsd::set_osabi): Remove.
6709         * i386.cc (class Target_i386): Inherit from Sized_target rather
6710         than Target_freebsd.
6711         * x86_64.cc (class Target_x86_64): Likewise.
6712
6713 2011-06-28  Ian Lance Taylor  <iant@google.com>
6714
6715         * target.h (Target::can_check_for_function_pointers): Rewrite.
6716         Make non-virtual.
6717         (Target::can_icf_inline_merge_sections): Likewise.
6718         (Target::section_may_have_icf_unsafe_poineters): Likewise.
6719         (Target::Target_info): Add can_icf_inline_merge_sections field.
6720         (Target::do_can_check_for_function_pointers): New virtual
6721         function.
6722         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
6723         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
6724         from can_check_for_function_pointers, move in file.
6725         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
6726         section_may_have_icf_unsafe_poineters, move in file.
6727         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
6728         * i386.cc (Target_i386::do_can_check_for_function_pointers):
6729         Rename from can_check_for_function_pointers, move in file.
6730         (Target_i386::can_icf_inline_merge_sections): Remove.
6731         (Target_i386::i386_info): Initialize
6732         can_icf_inline_merge_sections.
6733         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6734         Initialize can_icf_inline_merge_sections.
6735         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
6736         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
6737         Rename from can_check_for_function_pointers, move in file.
6738         (Target_x86_64::can_icf_inline_merge_sections): Remove.
6739         (Target_x86_64::x86_64_info): Initialize
6740         can_icf_inline_merge_sections.
6741         * testsuite/testfile.cc (Target_test::test_target_info):
6742         Likewise.
6743         * icf.cc (get_section_contents): Correct formatting.
6744
6745 2011-06-27  Ian Lance Taylor  <iant@google.com>
6746
6747         * symtab.cc (Symbol::versioned_name): New function.
6748         (Symbol_table::add_to_final_symtab): Use versioned_name when
6749         appropriate.
6750         (Symbol_table::sized_write_symbol): Likewise.
6751         * symtab.h (class Symbol): Declare versioned_name.
6752         * stringpool.h (class Stringpool_template): Add variant of add
6753         which takes a std::basic_string.
6754         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
6755         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
6756         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
6757         (ver_test_12.o): New target.
6758         * testsuite/Makefile.in: Rebuild.
6759
6760 2011-06-27  Doug Kwan  <dougkwan@google.com>
6761
6762         * arm.cc (Arm_relocate_functions::thm_jump8,
6763         Arm_relocate_functions::thm_jump11): Use a wider signed
6764         type to compute offset.
6765         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
6766         arm_thm_jump8.
6767         * testsuite/Makefile.in: Regenerate.
6768         * testsuite/arm_branch_in_range.sh: Check test results of
6769         arm_thm_jump11 and arm_thm_jump8.
6770         * testsuite/arm_thm_jump11.s: New test source file.
6771         * testsuite/arm_thm_jump11.t: New linker script.
6772         * testsuite/arm_thm_jump8.s: New test source file.
6773         * testsuite/arm_thm_jump8.t: New linker script.
6774
6775 2011-06-24  Ian Lance Taylor  <iant@google.com>
6776
6777         * layout.cc: Include "object.h".
6778         (ctors_sections_in_init_array): New static variable.
6779         (Layout::is_ctors_in_init_array): New function.
6780         (Layout::layout): Add entry to ctors_sections_in_init_array if
6781         appropriate.
6782         * layout.h (class Layout): Declare is_ctors_in_init_array.
6783         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
6784         is_ctors_reverse_view is set.
6785         (Sized_relobj_file::write_sections): Add layout parameter.  Change
6786         all callers.  Set is_ctors_reverse_view field of View_size.
6787         (Sized_relobj_file::reverse_words): New function.
6788         * object.h (Sized_relobj_file::View_size): Add
6789         is_ctors_reverse_view field.
6790         (class Sized_relobj_file): Update declarations.
6791         * testsuite/initpri3.c: New test.
6792         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
6793         initpri3b.
6794         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
6795         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
6796         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
6797         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
6798         * testsuite/Makefile.in: Rebuild.
6799
6800 2011-06-24  Cary Coutant  <ccoutant@google.com>
6801
6802         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
6803         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
6804         (debug_msg_cdebug.err): New targets.
6805         * testsuite/Makefile.in: Regenerate.
6806         * testsuite/debug_msg.sh: Check output of link with compressed debug.
6807         Fix checks for link with shared library.
6808
6809 2011-06-24  Doug Kwan  <dougkwan@google.com>
6810
6811         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
6812         skip empty text sections.
6813         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
6814
6815 2011-06-22  Ian Lance Taylor  <iant@google.com>
6816
6817         PR gold/12910
6818         * options.h (class General_options): Add --ctors-in-init-array.
6819         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
6820         friends as SHT_PROGBITS for merging sections.
6821         (Layout::layout): Remove special handling of .init_array and
6822         friends.  Don't sort if doing relocatable link.  Sort for .ctors
6823         and .dtors if ctors_in_init_array.
6824         (Layout::make_output_section): Force correct section types for
6825         .init_array and friends.  Don't sort if doing relocatable link,
6826         Don't sort .ctors and .dtors if ctors_in_init_array.
6827         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
6828         (Layout::output_section_name): Add relobj parameter.  Change all
6829         callers.  Handle .ctors. and .dtors. in code rather than table.
6830         Handle .ctors and .dtors if ctors_in_init_array.
6831         (Layout::match_file_name): New function, moved from output.cc.
6832         * layout.h (class Layout): Update declarations.
6833         * output.cc: Include "layout.h".
6834         (Input_section_sort_entry::get_priority): New function.
6835         (Input_section_sort_entry::match_file_name): Just call
6836         Layout::match_file_name.
6837         (Output_section::Input_section_sort_init_fini_compare::operator()):
6838         Handle .ctors and .dtors.  Sort by explicit priority rather than
6839         by name.
6840         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
6841         * testsuite/initpri2.c: New test.
6842         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
6843         (check_PROGRAMS): Add initpri2.
6844         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
6845         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
6846         * configure, testsuite/Makefile.in: Rebuild.
6847
6848 2011-06-19  Ian Lance Taylor  <iant@google.com>
6849
6850         PR gold/12880
6851         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
6852         .interp section to a PT_INTERP segment even if we have seen a
6853         --dynamic-linker option.  Don't do it if we have seen a PHDRS
6854         clause in a linker script.
6855         (Layout::finalize): Don't create a .interp section if we've
6856         already create a PT_INTERP segment.
6857         (Layout::create_interp): Always call choose_output_section (revert
6858         patch of 2011-06-17).  Don't create PT_INTERP segment.
6859         * script-sections.cc
6860         (Script_sections::create_note_and_tls_segments): Add a .interp
6861         section to a PT_INTERP segment even if we have seen a
6862         --dynamic-linker option.
6863
6864 2011-06-18  Ian Lance Taylor  <iant@google.com>
6865
6866         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
6867         merely because a non-PT_LOAD segment has a dynamic reloc.
6868
6869 2011-06-18  Ian Lance Taylor  <iant@google.com>
6870
6871         * layout.cc (Layout::finish_dynamic_section): Don't create
6872         DT_FLAGS entry if not needed.
6873
6874 2011-06-18  Ian Lance Taylor  <iant@google.com>
6875
6876         PR gold/12745
6877         * layout.cc (Layout::layout_eh_frame): Correct handling of
6878         writable .eh_frame section.
6879
6880 2011-06-17  Ian Lance Taylor  <iant@google.com>
6881
6882         PR gold/12893
6883         * resolve.cc (Symbol_table::resolve): Don't give an error if a
6884         symbol is redefined with the exact same object and value.
6885
6886 2011-06-17  Ian Lance Taylor  <iant@google.com>
6887
6888         PR gold/12880
6889         * layout.h (class Layout): Add interp_segment_ field.
6890         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
6891         (Layout::attach_allocated_section_to_segment): If making shared
6892         library, put .interp section in PT_INTERP segment.
6893         (Layout::finalize): Also call create_interp if -dynamic-linker
6894         option was used.
6895         (Layout::create_interp): Assert that there is no PT_INTERP
6896         segment.  If not using a SECTIONS clause, use make_output_section.
6897         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
6898         * script-sections.cc
6899         (Script_sections::create_note_and_tls_segments): If making shared
6900         library, put .interp section in PT_INTERP segment.
6901
6902 2011-06-17  Ian Lance Taylor  <iant@google.com>
6903
6904         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
6905         when making a shared library.
6906
6907 2011-06-17  Ian Lance Taylor  <iant@google.com>
6908
6909         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
6910         parameter.  Change all callers.  Don't issue warning about PC32
6911         against locally defined symbol.
6912
6913 2011-06-16  Ian Lance Taylor  <iant@google.com>
6914
6915         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
6916         occurs in same object.
6917
6918 2011-06-14  Alan Modra  <amodra@gmail.com>
6919
6920         * po/POTFILES.in: Regenerate.
6921
6922 2011-06-09  Ian Lance Taylor  <iant@google.com>
6923
6924         * script-sections.cc
6925         (Orphan_output_section::set_section_addresses): For a relocatable
6926         link set address to 0.
6927
6928 2011-06-09  Cary Coutant  <ccoutant@google.com>
6929
6930         PR gold/12804
6931         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
6932         used with --compress-debug-sections.
6933         * gold/object.cc (Sized_relobj_file::do_layout): Report
6934         uncompressed size of compressed input sections.
6935
6936 2011-06-08  Cary Coutant  <ccoutant@google.com>
6937
6938         PR gold/12804
6939         * testsuite/two_file_test_2_v1.cc: Change initialization of
6940         v2 to keep it in .data.
6941
6942 2011-06-07  Cary Coutant  <ccoutant@google.com>
6943
6944         * common.cc (Symbol_table::do_allocate_commons_list): Call
6945         gold_fallback.
6946         * errors.cc (Errors::fatal): Adjust call to gold_exit.
6947         (Errors::fallback): New function.
6948         (gold_fallback): New function.
6949         * errors.h (Errors::fallback): New function.
6950         * gold.cc (gold_exit): Change status parameter to enum; adjust
6951         all callers.
6952         (queue_initial_tasks): Call gold_fallback.
6953         * gold.h: Include cstdlib.
6954         (Exit_status): New enum type.
6955         (gold_exit): Change status parameter to enum.
6956         (gold_fallback): New function.
6957         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
6958         (Layout::create_symtab_sections): Likewise.
6959         (Layout::create_shdrs): Likewise.
6960         * main.cc (main): Adjust call to gold_exit.
6961         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
6962         (Output_data_got::add_got_entry_pair): Likewise.
6963         (Output_section::add_input_section): Likewise.
6964         (Output_section::add_output_section_data): Likewise.
6965         (Output_segment::set_section_list_addresses): Likewise.
6966         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
6967
6968 2011-06-07  Cary Coutant  <ccoutant@google.com>
6969
6970         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
6971         for incremental links.
6972         * output.cc (Output_segment::set_section_list_addresses): Remove
6973         FIXME and test for TLS or BSS.
6974
6975 2011-06-07  Cary Coutant  <ccoutant@google.com>
6976
6977         * testsuite/Makefile.am: Add incremental_copy_test,
6978         incremental_common_test_1.
6979         * testsuite/Makefile.in: Regenerate.
6980         * testsuite/common_test_1_v1.c: New source file.
6981         * testsuite/common_test_1_v2.c: New source file.
6982         * testsuite/copy_test_v1.cc: New source file.
6983
6984 2011-06-07  Cary Coutant  <ccoutant@google.com>
6985
6986         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
6987         update, allocate common from bss section's free list.
6988         * incremental-dump.cc (dump_incremental_inputs): Print flag for
6989         linker-defined symbols.
6990         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
6991         Skip GOT and PLT entries that are no longer referenced.
6992         (Output_section_incremental_inputs::write_info_blocks): Mark
6993         linker-defined symbols.
6994         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
6995         * output.cc (Output_section::allocate): New function.
6996         * output.h (Output_section::allocate): New function.
6997         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
6998         linker-defined symbols.
6999         (Symbol::override_base_with_special): Copy is_predefined_ flag.
7000         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
7001         (Symbol::init_base_output_data): Likewise.
7002         (Symbol::init_base_output_segment): Likewise.
7003         (Symbol::init_base_constant): Likewise.
7004         (Sized_symbol::init_output_data): Likewise.
7005         (Sized_symbol::init_output_segment): Likewise.
7006         (Sized_symbol::init_constant): Likewise.
7007         (Symbol_table::do_define_in_output_data): Likewise.
7008         (Symbol_table::do_define_in_output_segment): Likewise.
7009         (Symbol_table::do_define_as_constant): Likewise.
7010         * symtab.h (Symbol::is_predefined): New function.
7011         (Symbol::init_base_output_data): Add is_predefined parameter.
7012         (Symbol::init_base_output_segment): Likewise.
7013         (Symbol::init_base_constant): Likewise.
7014         (Symbol::is_predefined_): New data member.
7015         (Sized_symbol::init_output_data): Add is_predefined parameter.
7016         (Sized_symbol::init_output_segment): Likewise.
7017         (Sized_symbol::init_constant): Likewise.
7018         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
7019
7020 2011-06-07  Cary Coutant  <ccoutant@google.com>
7021
7022         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
7023         instead of emit_copy_reloc.
7024         (Copy_relocs::emit_copy_reloc): Refactor.
7025         (Copy_relocs::make_copy_reloc): New function.
7026         (Copy_relocs::add_copy_reloc): Remove.
7027         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
7028         section.
7029         (Copy_relocs::make_copy_reloc): New function.
7030         (Copy_relocs::add_copy_reloc): Remove.
7031         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
7032         unchanged input files.
7033         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
7034         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
7035         Reserve BSS space for COPY relocations.
7036         (Sized_incremental_binary::do_emit_copy_relocs): New function.
7037         (Output_section_incremental_inputs::write_info_blocks): Record
7038         whether a symbol is copied from a shared object.
7039         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
7040         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
7041         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
7042         (Incremental_input_entry_reader::get_output_symbol_index): Add
7043         is_copy parameter.
7044         (Incremental_binary::emit_copy_relocs): New function.
7045         (Incremental_binary::do_emit_copy_relocs): New function.
7046         (Sized_incremental_binary::Sized_incremental_binary): Initialize
7047         new data member.
7048         (Sized_incremental_binary::add_copy_reloc): New function.
7049         (Sized_incremental_binary::do_emit_copy_relocs): New function.
7050         (Sized_incremental_binary::Copy_reloc): New struct.
7051         (Sized_incremental_binary::Copy_relocs): New typedef.
7052         (Sized_incremental_binary::copy_relocs_): New data member.
7053         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
7054         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
7055         * target.h (Sized_target::emit_copy_reloc): New function.
7056         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
7057
7058 2011-06-02  Cary Coutant  <ccoutant@google.com>
7059
7060         PR gold/12163
7061         * gold/archive.cc (Archive::Archive): Initialize new data member.
7062         (Archive::include_all_members): Return if archive has already been
7063         included.
7064         * gold/archive.h (Archive::include_all_members_): New data member.
7065
7066 2011-06-02  Nick Clifton  <nickc@redhat.com>
7067
7068         * dynobj.h: Fix spelling mistake in comment.
7069         * output.cc: Likewise.
7070
7071 2011-05-31  Doug Kwan  <dougkwan@google.com>
7072             Asier Llano
7073
7074         PR gold/12826
7075         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
7076         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
7077         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
7078         redundant arm_exidx_test.so.
7079         * testsuite/Makefile.in: Regenerate.
7080         (check_SCRIPTS): Add pr12826.sh
7081         (check_DATA): Add pr12826.stdout
7082         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
7083         * testsuite/pr12826.sh: New file.
7084         * testsuite/pr12826_1.s: Ditto.
7085         * testsuite/pr12826_1.s: Ditto.
7086
7087 2011-05-30  Ian Lance Taylor  <iant@google.com>
7088
7089         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
7090         sections.
7091
7092 2011-05-29  Ian Lance Taylor  <iant@google.com>
7093
7094         PR gold/12804
7095         * testsuite/Makefile.am: Use different file name for two_file_test
7096         temporary file for each incremental test.
7097         * testsuite/Makefile.in: Rebuild.
7098
7099 2011-05-29  Ian Lance Taylor  <iant@google.com>
7100
7101         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
7102         binary input file is empty.
7103
7104 2011-05-27  Ian Lance Taylor  <iant@google.com>
7105
7106         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
7107         (ver_test_9.so): Likewise.
7108         * testsuite/Makefile.in: Rebuild.
7109
7110 2011-05-26 Cary Coutant  <ccoutant@google.com>
7111
7112         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
7113         * incremental.cc (Incremental_inputs::report_input_section): Fix
7114         comment, indentation.
7115         (Incremental_inputs::report_comdat_group): New function.
7116         (Output_section_incremental_inputs::set_final_data_size): Adjust size
7117         of data for incremental input file entry.
7118         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
7119         group count, COMDAT group signatures.
7120         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
7121         an unchanged input file.
7122         * incremental.h (Incremental_object_entry::Incremental_object_entry):
7123         Initialize new data member.
7124         (Incremental_object_entry::add_comdat_group): New function.
7125         (Incremental_object_entry::get_comdat_group_count): New function.
7126         (Incremental_object_entry::get_comdat_signature_key): New function.
7127         (Incremental_object_entry::groups_): New data member.
7128         (Incremental_inputs::report_comdat_group): New function.
7129         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
7130         data for incremental input file entry.
7131         (Incremental_input_entry_reader::get_comdat_group_count): New function.
7132         (Incremental_input_entry_reader::get_input_section): Adjust size of
7133         data for incremental input file entry.
7134         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
7135         (Incremental_input_entry_reader::get_comdat_group_signature): New
7136         function.
7137         * object.cc (Sized_relobj::include_section_group): Report kept
7138         COMDAT groups for incremental links.
7139
7140 2011-05-24  David Meyer  <pdox@google.com>
7141
7142         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
7143         with name parameter.  Add found_name parameter.
7144         * fileread.cc (Input_file::find_file): Adjust code accordingly.
7145         * dirsearch.h (class Dirsearch): Update declaration.
7146
7147 2011-05-24  Ian Lance Taylor  <iant@google.com>
7148
7149         * archive.cc (Library_base::should_include_member): Pull in object
7150         from archive if it defines the entry symbol.
7151         * parameters.cc (Parameters::entry): New function.
7152         * parameters.h (class Parameters): Declare entry.
7153         * output.h (class Output_file_header): Remove entry_ field.
7154         * output.cc (Output_file_header::Output_file_header): Remove entry
7155         parameter.  Change all callers.
7156         (Output_file_header::entry): Use parameters->entry.
7157         * gold.cc (queue_middle_tasks): Likewise.
7158         * plugin.cc (Plugin_hook::run): Likewise.
7159
7160 2011-05-24 Cary Coutant  <ccoutant@google.com>
7161
7162         * gold.cc (queue_initial_tasks): Pass incremental base filename
7163         to Output_file::open_base_file; don't print error message.
7164         * incremental-dump.cc (main): Adjust call to
7165         Output_file::open_for_modification.
7166         * incremental-dump.cc (main): Likewise.
7167         * incremental.cc (Incremental_inputs::report_command_line):
7168         Ignore --incremental-base option when comparing command lines.
7169         Ignore parameter when given as separate argument.
7170         * options.h (class General_options): Add --incremental-base.
7171         * output.cc (Output_file::Output_file):
7172         (Output_file::open_base_file): Add base_name and writable parameters;
7173         read base file into new file; print error message here.
7174         (Output_file::map_no_anonymous): Add writable parameter; adjust all
7175         callers.
7176         * output.h (Output_file::open_for_modification): Rename to...
7177         (Output_file::open_base_file): ...this; add base_name and
7178         writable parameters; adjust all callers.
7179         (Output_file::map_no_anonymous): Add writable parameter; adjust all
7180         callers.
7181         * testsuite/Makefile.am (incremental_test_4): Test
7182         --incremental-base.
7183         * testsuite/Makefile.in: Regenerate.
7184
7185 2011-05-24 Cary Coutant  <ccoutant@google.com>
7186
7187         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
7188         incremental_test_4.
7189         * testsuite/Makefile.in: Regenerate.
7190         * testsuite/two_file_test_1_v1.cc: New test source file.
7191         * testsuite/two_file_test_1b_v1.cc: New test source file.
7192         * testsuite/two_file_test_2_v1.cc: New test source file.
7193
7194 2011-05-24 Cary Coutant  <ccoutant@google.com>
7195
7196         * dynobj.h (Dynobj::do_dynobj): New function.
7197         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
7198         flag and soname for shared objects.
7199         * incremental.cc (Incremental_inputs::report_object): Make
7200         either Incremental_object_entry or Incremental_dynobj_entry; add
7201         soname to string table.
7202         (Incremental_inputs::report_input_section): Add assertion.
7203         (Output_section_incremental_inputs::set_final_data_size): Adjust
7204         type of input file entry for shared libraries; adjust size of
7205         shared library info entry.
7206         (Output_section_incremental_inputs::write_input_files): Write
7207         as_needed flag for shared libraries.
7208         (Output_section_incremental_inputs::write_info_blocks): Adjust type
7209         of input file entry for shared libraries; write soname.
7210         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
7211         soname from incremental info.
7212         * incremental.h (enum Incremental_input_flags): Add
7213         INCREMENTAL_INPUT_AS_NEEDED.
7214         (Incremental_input_entry::Incremental_input_entry): Initialize new
7215         data member.
7216         (Incremental_input_entry::set_as_needed): New function.
7217         (Incremental_input_entry::as_needed): New function.
7218         (Incremental_input_entry::do_dynobj_entry): New function.
7219         (Incremental_input_entry::as_needed_): New data member.
7220         (Incremental_object_entry::Incremental_object_entry): Don't check
7221         for shared library.
7222         (Incremental_object_entry::do_type): Likewise.
7223         (class Incremental_dynobj_entry): New class.
7224         (Incremental_input_entry_reader::as_needed): New function.
7225         (Incremental_input_entry_reader::get_soname): New function.
7226         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
7227         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
7228         size of shared library info entry.
7229         * layout.cc (Layout::finish_dynamic_section): Don't test for
7230         incremental link when adding DT_NEEDED entries.
7231         * object.h (Object::Object): Initialize new data member.
7232         (Object::dynobj): New function.
7233         (Object::set_as_needed): New function.
7234         (Object::as_needed): New function.
7235         (Object::do_dynobj): New function.
7236         (Object::as_needed_): New data member.
7237
7238 2011-05-24 Cary Coutant  <ccoutant@google.com>
7239
7240         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
7241         info; adjust display of GOT entries.
7242         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7243         vector of input objects; remove file_status_.
7244         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
7245         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
7246         got_plt reader; call target hooks to reserve GOT entries.
7247         (Output_section_incremental_inputs::set_final_data_size): Adjust size
7248         of input file info header and GOT info entry.
7249         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
7250         relocation info.
7251         (Got_plt_view_info::got_descriptor): Remove.
7252         (Got_plt_view_info::sym_index): New data member.
7253         (Got_plt_view_info::input_index): New data member.
7254         (Local_got_offset_visitor::visit): Write input file index.
7255         (Global_got_offset_visitor::visit): Write 0 for input file index.
7256         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
7257         with sym_index and input_index.
7258         (Output_section_incremental_inputs::write_got_plt): Adjust size of
7259         incremental info GOT entry; replace got_descriptor with input_index.
7260         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
7261         map from input file index to object.
7262         (Sized_relobj_incr::do_layout): Replace direct data member reference
7263         with accessor function.
7264         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
7265         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
7266         Adjust size of input file info header.
7267         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
7268         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
7269         (Incremental_input_entry_reader::get_input_section): Adjust size of
7270         input file info header.
7271         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
7272         of incremental info GOT entry.
7273         (Incremental_got_plt_reader::get_got_desc): Remove.
7274         (Incremental_got_plt_reader::get_got_symndx): New function.
7275         (Incremental_got_plt_reader::get_got_input_index): New function.
7276         (Sized_incremental_binary::Sized_incremental_binary): Remove
7277         file_status_; add input_objects_.
7278         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
7279         (Sized_incremental_binary::set_file_is_unchanged): Remove.
7280         (Sized_incremental_binary::file_is_unchanged): Remove.
7281         (Sized_incremental_binary::set_input_object): New function.
7282         (Sized_incremental_binary::input_object): New function.
7283         (Sized_incremental_binary::file_status_): Remove.
7284         (Sized_incremental_binary::input_objects_): New data member.
7285         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
7286         references.
7287         (Sized_relobj_incr::invalid_address): Move to base class.
7288         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
7289         class.
7290         (Sized_relobj_incr::do_output_section_offset): Likewise.
7291         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
7292         (Sized_relobj_incr::section_offsets_): Likewise.
7293         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
7294         function.
7295         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
7296         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
7297         with accessor function.
7298         (Sized_relobj_file::do_layout): Likewise.
7299         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
7300         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
7301         (Sized_relobj_file::compute_final_local_value): Replace refs to
7302         section_offsets_ with accessor function.
7303         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
7304         * object.h (Relobj::Relobj): Initialize new data members.
7305         (Relobj::add_dyn_reloc): New function.
7306         (Relobj::first_dyn_reloc): New function.
7307         (Relobj::dyn_reloc_count): New function.
7308         (Relobj::first_dyn_reloc_): New data member.
7309         (Relobj::dyn_reloc_count_): New data member.
7310         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
7311         references.
7312         (Sized_relobj::Address): New typedef.
7313         (Sized_relobj::invalid_address): Move here from child class.
7314         (Sized_relobj::Sized_relobj): Initialize new data members.
7315         (Sized_relobj::sized_relobj): New function.
7316         (Sized_relobj::is_output_section_offset_invalid): Move here from
7317         child class.
7318         (Sized_relobj::get_output_section_offset): Likewise.
7319         (Sized_relobj::local_has_got_offset): Likewise.
7320         (Sized_relobj::local_got_offset): Likewise.
7321         (Sized_relobj::set_local_got_offset): Likewise.
7322         (Sized_relobj::do_for_all_local_got_entries): Likewise.
7323         (Sized_relobj::clear_got_offsets): New function.
7324         (Sized_relobj::section_offsets): Move here from child class.
7325         (Sized_relobj::do_output_section_offset): Likewise.
7326         (Sized_relobj::do_set_section_offset): Likewise.
7327         (Sized_relobj::Local_got_offsets): Likewise.
7328         (Sized_relobj::local_got_offsets_): Likewise.
7329         (Sized_relobj::section_offsets_): Likewise.
7330         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
7331         references.
7332         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
7333         class.
7334         (Sized_relobj_file::sized_relobj): New function
7335         (Sized_relobj_file::local_has_got_offset): Move to base class.
7336         (Sized_relobj_file::local_got_offset): Likewise.
7337         (Sized_relobj_file::set_local_got_offset): Likewise.
7338         (Sized_relobj_file::get_output_section_offset): Likewise.
7339         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
7340         (Sized_relobj_file::do_output_section_offset): Likewise.
7341         (Sized_relobj_file::do_set_section_offset): Likewise.
7342         (Sized_relobj_file::Local_got_offsets): Likewise.
7343         (Sized_relobj_file::local_got_offsets_): Likewise.
7344         (Sized_relobj_file::section_offsets_): Likewise.
7345         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
7346         (all constructors).
7347         (set_needs_dynsym_index): Convert relobj to derived class pointer.
7348         (Output_reloc::get_symbol_index): Likewise.
7349         (Output_reloc::local_section_offset): Likewise.
7350         (Output_reloc::get_address): Likewise.
7351         (Output_reloc::symbol_value): Likewise.
7352         (Output_data_got::reserve_slot): Move to class definition.
7353         (Output_data_got::reserve_local): New function.
7354         (Output_data_got::reserve_slot_for_global): Remove.
7355         (Output_data_got::reserve_global): New function.
7356         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
7357         (all constructors, two instantiations).
7358         (Output_reloc::get_relobj): New function (two instantiations).
7359         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
7360         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
7361         (Output_data_reloc::add_global): Adjust type of relobj.
7362         (Output_data_reloc::add_global_relative): Likewise.
7363         (Output_data_reloc::add_symbolless_global_addend): Likewise.
7364         (Output_data_reloc::add_local): Likewise.
7365         (Output_data_reloc::add_local_relative): Likewise.
7366         (Output_data_reloc::add_symbolless_local_addend): Likewise.
7367         (Output_data_reloc::add_local_section): Likewise.
7368         (Output_data_reloc::add_output_section): Likewise.
7369         (Output_data_reloc::add_absolute): Likewise.
7370         (Output_data_reloc::add_target_specific): Likewise.
7371         (Output_data_got::reserve_slot): Move definition here.
7372         (Output_data_got::reserve_local): New function.
7373         (Output_data_got::reserve_global): New function.
7374         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
7375         section_offsets_ with accessor function.
7376         (Sized_relobj_file::write_sections): Likewise.
7377         (Sized_relobj_file::do_relocate_sections): Likewise.
7378         * target.h (Sized_target::reserve_local_got_entry): New function.
7379         (Sized_target::reserve_global_got_entry): New function.
7380         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
7381         (Target_x86_64::reserve_global_got_entry): New function.
7382         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
7383
7384 2011-05-23 Cary Coutant  <ccoutant@google.com>
7385
7386         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
7387         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
7388         bit when checking got_type.
7389         * incremental.cc (Sized_incremental_binary::setup_readers):
7390         Store symbol table and string table locations; initialize bit vector
7391         of file status flags.
7392         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
7393         unchanged files.
7394         (Sized_incremental_binary::do_process_got_plt): New function.
7395         (Sized_incremental_binary::get_symtab_view): Use stored locations.
7396         (Output_section_incremental_inputs::set_final_data_size): Record
7397         file index for each input file.
7398         (Output_section_incremental_inputs::write_got_plt): Store file index
7399         instead of input entry offset for each GOT entry.
7400         * incremental.h
7401         (Incremental_input_entry::Incremental_input_entry): Initialize new
7402         data member.
7403         (Incremental_input_entry::set_offset): Store file index.
7404         (Incremental_input_entry::get_file_index): New function.
7405         (Incremental_input_entry::file_index_): New data member.
7406         (Incremental_binary::process_got_plt): New function.
7407         (Incremental_binary::do_process_got_plt): New function.
7408         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7409         data members.
7410         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
7411         (Sized_incremental_binary::set_file_is_unchanged): New function.
7412         (Sized_incremental_binary::file_is_unchanged): New function.
7413         (Sized_incremental_binary::do_process_got_plt): New function.
7414         (Sized_incremental_binary::file_status_): New data member.
7415         (Sized_incremental_binary::main_symtab_loc_): New data member.
7416         (Sized_incremental_binary::main_strtab_loc_): New data member.
7417         * output.cc (Output_data_got::Got_entry::write): Add case
7418         RESERVED_CODE.
7419         (Output_data_got::add_global): Call add_got_entry.
7420         (Output_data_got::add_global_plt): Likewise.
7421         (Output_data_got::add_global_with_rel): Likewise.
7422         (Output_data_got::add_global_with_rela): Likewise.
7423         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
7424         (Output_data_got::add_global_pair_with_rela): Likewise.
7425         (Output_data_got::add_local): Call add_got_entry.
7426         (Output_data_got::add_local_plt): Likewise.
7427         (Output_data_got::add_local_with_rel): Likewise.
7428         (Output_data_got::add_local_with_rela): Likewise.
7429         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
7430         (Output_data_got::add_local_pair_with_rela): Likewise.
7431         (Output_data_got::reserve_slot): New function.
7432         (Output_data_got::reserve_slot_for_global): New function.
7433         (Output_data_got::add_got_entry): New function.
7434         (Output_data_got::add_got_entry_pair): New function.
7435         (Output_section::add_output_section_data): Edit FIXME.
7436         * output.h
7437         (Output_section_data_build::Output_section_data_build): New
7438         constructor with size parameter.
7439         (Output_data_space::Output_data_space): Likewise.
7440         (Output_data_got::Output_data_got): Initialize new data member; new
7441         constructor with size parameter.
7442         (Output_data_got::add_constant): Call add_got_entry.
7443         (Output_data_got::reserve_slot): New function.
7444         (Output_data_got::reserve_slot_for_global): New function.
7445         (class Output_data_got::Got_entry): Add RESERVED_CODE.
7446         (Output_data_got::add_got_entry): New function.
7447         (Output_data_got::add_got_entry_pair): New function.
7448         (Output_data_got::free_list_): New data member.
7449         * target.h (Sized_target::init_got_plt_for_update): New function.
7450         (Sized_target::register_global_plt_entry): New function.
7451         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
7452         Initialize new data member; call init; add constructor with PLT count.
7453         (Output_data_plt_x86_64::init): New function.
7454         (Output_data_plt_x86_64::add_relocation): New function.
7455         (Output_data_plt_x86_64::reserve_slot): New function.
7456         (Output_data_plt_x86_64::free_list_): New data member.
7457         (Target_x86_64::init_got_plt_for_update): New function.
7458         (Target_x86_64::register_global_plt_entry): New function.
7459         (Output_data_plt_x86_64::add_entry): Allocate from free list for
7460         incremental updates.
7461         (Output_data_plt_x86_64::add_relocation): New function.
7462         * testsuite/object_unittest.cc (Object_test): Set default options.
7463
7464 2011-05-16  Ian Lance Taylor  <iant@google.com>
7465
7466         * options.h (class General_options): Make -i a synonym for -r.
7467
7468 2011-05-16  Ian Lance Taylor  <iant@google.com>
7469
7470         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
7471
7472 2011-05-10 Cary Coutant  <ccoutant@google.com>
7473
7474         * object.cc (Sized_relobj::do_count_local_symbols): Check for
7475         strip_all (-s).
7476
7477 2011-05-06  Ian Lance Taylor  <iant@google.com>
7478
7479         * layout.cc (Layout::layout): If the output section flags change,
7480         update the ordering.
7481
7482 2011-04-25 Cary Coutant  <ccoutant@google.com>
7483
7484         * incremental-dump.cc (dump_incremental_inputs): Print local
7485         symbol info for each input file.
7486         * incremental.cc
7487         (Output_section_incremental_inputs::set_final_data_size): Add local
7488         symbol info to input file entries in incremental info.
7489         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7490         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
7491         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
7492         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
7493         implementation.
7494         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
7495         (Sized_incr_relobj::do_relocate): Write the local symbols.
7496         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
7497         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
7498         Adjust size of input file header.
7499         (Incremental_inputs_reader::get_local_symbol_offset): New function.
7500         (Incremental_inputs_reader::get_local_symbol_count): New function.
7501         (Incremental_inputs_reader::get_input_section): Adjust size of input
7502         file header.
7503         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
7504         (Sized_incr_relobj::This): New typedef.
7505         (Sized_incr_relobj::sym_size): New const data member.
7506         (Sized_incr_relobj::Local_symbol): New struct.
7507         (Sized_incr_relobj::do_output_local_symbol_count): New function.
7508         (Sized_incr_relobj::do_local_symbol_offset): New function.
7509         (Sized_incr_relobj::local_symbol_count_): New data member.
7510         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
7511         (Sized_incr_relobj::local_symbol_index_): New data member.
7512         (Sized_incr_relobj::local_symbol_offset_): New data member.
7513         (Sized_incr_relobj::local_dynsym_offset_): New data member.
7514         (Sized_incr_relobj::local_symbols_): New data member.
7515         * object.h (Relobj::output_local_symbol_count): New function.
7516         (Relobj::local_symbol_offset): New function.
7517         (Relobj::do_output_local_symbol_count): New function.
7518         (Relobj::do_local_symbol_offset): New function.
7519         (Sized_relobj::do_output_local_symbol_count): New function.
7520         (Sized_relobj::do_local_symbol_offset): New function.
7521
7522 2011-04-22  Vladimir Simonov  <sv@sw.ru>
7523
7524         * descriptors.cc (set_close_on_exec): New function.
7525         (Descriptors::open): Use set_close_on_exec.
7526         * output.cc (S_ISLNK): Define if not defined.
7527
7528 2011-04-22 Cary Coutant  <ccoutant@google.com>
7529
7530         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7531         global symbol map.
7532         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7533         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
7534         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
7535         relocations.
7536         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
7537         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
7538         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
7539         * incremental.h
7540         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
7541         function.
7542         (Incremental_binary::apply_incremental_relocs): New function.
7543         (Incremental_binary::do_apply_incremental_relocs): New function.
7544         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7545         data member.
7546         (Sized_incremental_binary::add_global_symbol): New function.
7547         (Sized_incremental_binary::global_symbol): New function.
7548         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7549         (Sized_incremental_binary::symbol_map_): New data member.
7550         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
7551         * target.h (Sized_target::apply_relocation): New function.
7552         * target-reloc.h (apply_relocation): New function.
7553         * x86_64.cc (Target_x86_64::apply_relocation): New function.
7554
7555 2011-04-22  Doug Kwan  <dougkwan@google.com>
7556
7557         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
7558         flag of a SHT_ARM_EXIDX section.
7559         * testsuite/Makefile.am (arm_exidx_test): New test rules.
7560         * testsuite/Makefile.in: Regenerate.
7561         * testsuite/arm_exidx_test.s: New file.
7562         * testsuite/arm_exidx_test.sh: Same.
7563
7564 2011-04-20 Cary Coutant  <ccoutant@google.com>
7565
7566         PR gold/12689
7567         * archive.h (Incremental_archive_entry::Archive_member):
7568         Initialize arg_serial_ (second constructor).
7569
7570 2011-04-17  Ian Lance Taylor  <iant@google.com>
7571
7572         * object.cc (Relocate_info::location): Simplify location string.
7573         * errors.cc (Errors::error_at_location): Don't print program
7574         name.
7575         (Errors::warning_at_location): Likewise.
7576         (Errors::undefined_symbol): Likewise.
7577         * testsuite/debug_msg.sh: Update accordingly.
7578
7579 2011-04-14 Cary Coutant  <ccoutant@google.com>
7580
7581         * gold/layout.cc (Layout::symtab_section_offset): New function.
7582         * gold/layout.h (Layout::symtab_section_offset): New function.
7583         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
7584
7585 2011-04-12  Ian Lance Taylor  <iant@google.com>
7586
7587         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
7588         with MREMAP_MAYMOVE.
7589         * output.h (class Output_file): Add map_is_allocated_ field.
7590         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
7591         not available, provide stubs.  If mremap is not available, #define
7592         it to gold_mremap.
7593         (MREMAP_MAYMOVE): Define if not defined.
7594         (Output_file::Output_file): Initialize map_is_allocated_.
7595         (Output_file::resize): Check map_is_allocated_.
7596         (Output_file::map_anonymous): If mmap fails, use malloc.
7597         (Output_file::unmap): Don't do anything for an anonymous map.
7598         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
7599         is not available, provide stubs.
7600         (File_read::View::~View): Use free rather than delete[].
7601         (File_read::make_view): Use malloc rather than new[].  If mmap
7602         fails, use malloc.
7603         (File_read::find_or_make_view): Use malloc rather than new[].
7604         * gold.h: Remove HAVE_REMAP code.
7605         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
7606         exists.  Rename mremap to gold_mremap.  If mmap is not available
7607         don't do anything.
7608         * configure, config.in: Rebuild.
7609
7610 2011-04-11  Ian Lance Taylor  <iant@google.com>
7611
7612         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
7613         initialize local variable v.
7614
7615 2011-04-11  Cary Coutant  <ccoutant@google.com>
7616
7617         * archive.cc (Archive::include_member): Adjust call to
7618         report_object.
7619         (Add_archive_symbols::run): Track argument serial numbers.
7620         (Lib_group::include_member): Likewise.
7621         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
7622         * archive.h (Incremental_archive_entry::Archive_member):
7623         Initialize arg_serial_.
7624         (Archive_member::arg_serial_): New data member.
7625         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
7626         (Sized_dynobj::do_add_symbols): Track symbols when doing an
7627         incremental link.
7628         (Sized_dynobj::do_for_all_local_got_entries): New function.
7629         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
7630         function.
7631         * fileread.cc (get_mtime): New function.
7632         * fileread.h (get_mtime): New function.
7633         * gold.cc (queue_initial_tasks): Check for incremental update.
7634         (process_incremental_input): New function.
7635         (queue_middle_tasks): Don't force valid target for incremental
7636         update.
7637         * incremental-dump.cc (find_input_containing_global): Adjust
7638         size of symbol info entry.
7639         (dump_incremental_inputs): Dump argument serial number and
7640         in_system_directory flag; bias shndx by 1; print symbol names
7641         when dumping per-file symbol lists; use new symbol info readers.
7642         * incremental.cc
7643         (Output_section_incremental_inputs:update_data_size): New function.
7644         (Sized_incremental_binary::setup_readers): Setup input readers
7645         for each input file; build maps for files added from libraries
7646         and scripts.
7647         (Sized_incremental_binary::check_input_args): New function.
7648         (Sized_incremental_binary::do_check_inputs): Build map of argument
7649         serial numbers to input arguments.
7650         (Sized_incremental_binary::do_file_has_changed): Rename
7651         do_file_is_unchanged to this; compare file modification times.
7652         (Sized_incremental_binary::do_init_layout): New function.
7653         (Sized_incremental_binary::do_reserve_layout): New function.
7654         (Sized_incremental_binary::do_get_input_reader): Remove.
7655         (Sized_incremental_binary::get_symtab_view): New function.
7656         (Incremental_checker::can_incrementally_link_output_file): Remove.
7657         (Incremental_inputs::report_command_line): Exclude --debug options.
7658         (Incremental_inputs::report_archive_begin): Add parameter; track
7659         argument serial numbers; don't put input file entry for archive
7660         before archive members.
7661         (Incremental_inputs::report_archive_end): Put input file entry
7662         for archive after archive members.
7663         (Incremental_inputs::report_object): Add parameter; track argument
7664         serial numbers and in_system_directory flag.
7665         (Incremental_inputs::report_script): Add parameter; track argument
7666         serial numbers.
7667         (Output_section_incremental_inputs::set_final_data_size): Adjust
7668         size of symbol info entry; check for forwarding symbols.
7669         (Output_section_incremental_inputs::write_input_files): Write
7670         in_system_directory flag and argument serial number.
7671         (Output_section_incremental_inputs::write_info_blocks): Map section
7672         indices between incremental info and original input file; store
7673         input section index for each symbol.
7674         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
7675         change operator() to visit().
7676         (class Global_got_offset_visitor): Likewise.
7677         (class Global_symbol_visitor_got_plt):
7678         (Output_section_incremental_inputs::write_got_plt): Use new visitor
7679         classes.
7680         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
7681         (Sized_incr_relobj::do_read_symbols): New function.
7682         (Sized_incr_relobj::do_layout): New function.
7683         (Sized_incr_relobj::do_layout_deferred_sections): New function.
7684         (Sized_incr_relobj::do_add_symbols): New function.
7685         (Sized_incr_relobj::do_should_include_member): New function.
7686         (Sized_incr_relobj::do_for_all_global_symbols): New function.
7687         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
7688         (Sized_incr_relobj::do_section_size): New function.
7689         (Sized_incr_relobj::do_section_name): New function.
7690         (Sized_incr_relobj::do_section_contents): New function.
7691         (Sized_incr_relobj::do_section_flags): New function.
7692         (Sized_incr_relobj::do_section_entsize): New function.
7693         (Sized_incr_relobj::do_section_address): New function.
7694         (Sized_incr_relobj::do_section_type): New function.
7695         (Sized_incr_relobj::do_section_link): New function.
7696         (Sized_incr_relobj::do_section_info): New function.
7697         (Sized_incr_relobj::do_section_addralign): New function.
7698         (Sized_incr_relobj::do_initialize_xindex): New function.
7699         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
7700         (Sized_incr_relobj::do_read_relocs): New function.
7701         (Sized_incr_relobj::do_gc_process_relocs): New function.
7702         (Sized_incr_relobj::do_scan_relocs): New function.
7703         (Sized_incr_relobj::do_count_local_symbols): New function.
7704         (Sized_incr_relobj::do_finalize_local_symbols): New function.
7705         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
7706         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
7707         (Sized_incr_relobj::do_relocate): New function.
7708         (Sized_incr_relobj::do_set_section_offset): New function.
7709         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
7710         (Sized_incr_dynobj::do_read_symbols): New function.
7711         (Sized_incr_dynobj::do_layout): New function.
7712         (Sized_incr_dynobj::do_add_symbols): New function.
7713         (Sized_incr_dynobj::do_should_include_member): New function.
7714         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
7715         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
7716         (Sized_incr_dynobj::do_section_size): New function.
7717         (Sized_incr_dynobj::do_section_name): New function.
7718         (Sized_incr_dynobj::do_section_contents): New function.
7719         (Sized_incr_dynobj::do_section_flags): New function.
7720         (Sized_incr_dynobj::do_section_entsize): New function.
7721         (Sized_incr_dynobj::do_section_address): New function.
7722         (Sized_incr_dynobj::do_section_type): New function.
7723         (Sized_incr_dynobj::do_section_link): New function.
7724         (Sized_incr_dynobj::do_section_info): New function.
7725         (Sized_incr_dynobj::do_section_addralign): New function.
7726         (Sized_incr_dynobj::do_initialize_xindex): New function.
7727         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
7728         (make_sized_incremental_object): New function.
7729         (Incremental_library::copy_unused_symbols): New function.
7730         (Incremental_library::do_for_all_unused_symbols): New function.
7731         * incremental.h (enum Incremental_input_flags): New type.
7732         (class Incremental_checker): Remove.
7733         (Incremental_input_entry::Incremental_input_entry): Add argument
7734         serial number.
7735         (Incremental_input_entry::arg_serial): New function.
7736         (Incremental_input_entry::set_is_in_system_directory): New function.
7737         (Incremental_input_entry::is_in_system_directory): New function.
7738         (Incremental_input_entry::arg_serial_): New data member.
7739         (Incremental_input_entry::is_in_system_directory_): New data member.
7740         (class Script_info): Move here from script.h.
7741         (Script_info::Script_info): Add filename parameter.
7742         (Script_info::filename): New function.
7743         (Script_info::filename_): New data member.
7744         (Incremental_script_entry::Incremental_script_entry): Add argument
7745         serial number.
7746         (Incremental_object_entry::Incremental_object_entry): Likewise.
7747         (Incremental_object_entry::add_input_section): Build list of input
7748         sections with map to original shndx.
7749         (Incremental_object_entry::get_input_section_index): New function.
7750         (Incremental_object_entry::shndx_): New data member.
7751         (Incremental_object_entry::name_key_): Rename; adjust all refs.
7752         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
7753         (Incremental_archive_entry::Incremental_archive_entry): Add argument
7754         serial number.
7755         (Incremental_inputs::report_archive_begin): Likewise.
7756         (Incremental_inputs::report_object): Likewise.
7757         (Incremental_inputs::report_script): Likewise.
7758         (class Incremental_global_symbol_reader): New class.
7759         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
7760         and store flags and input file type.
7761         (Incremental_input_entry_reader::arg_serial): New function.
7762         (Incremental_input_entry_reader::type): Extract type from flags.
7763         (Incremental_input_entry_reader::is_in_system_directory): New function.
7764         (Incremental_input_entry_reader::get_input_section_count): Call
7765         accessor function for type.
7766         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
7767         function for type; adjust size of global symbol entry.
7768         (Incremental_input_entry_reader::get_global_symbol_count): Call
7769         accessor function for type.
7770         (Incremental_input_entry_reader::get_object_count): Likewise.
7771         (Incremental_input_entry_reader::get_object_offset): Likewise.
7772         (Incremental_input_entry_reader::get_member_count): Likewise.
7773         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
7774         (Incremental_input_entry_reader::get_member_offset): Likewise.
7775         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
7776         (Incremental_input_entry_reader::Global_symbol_info): Remove.
7777         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
7778         (Incremental_input_entry_reader::get_global_symbol_reader): New
7779         function.
7780         (Incremental_input_entry_reader::get_output_symbol_index): New
7781         function.
7782         (Incremental_input_entry_reader::type_): Remove.
7783         (Incremental_input_entry_reader::flags_): New data member.
7784         (Incremental_inputs_reader::input_file_offset): New function.
7785         (Incremental_inputs_reader::input_file_index): New function.
7786         (Incremental_inputs_reader::input_file): Call input_file_offset.
7787         (Incremental_inputs_reader::input_file_at_offset): New function.
7788         (Incremental_relocs_reader::get_r_type): Reformat.
7789         (Incremental_relocs_reader::get_r_shndx): Reformat.
7790         (Incremental_relocs_reader::get_r_offset): Reformat.
7791         (Incremental_relocs_reader::data): New function.
7792         (Incremental_binary::Incremental_binary): Initialize new data members.
7793         (Incremental_binary::check_inputs): Add cmdline parameter.
7794         (Incremental_binary::file_is_unchanged): Remove.
7795         (Input_reader::arg_serial): New function.
7796         (Input_reader::get_unused_symbol_count): New function.
7797         (Input_reader::get_unused_symbol): New function.
7798         (Input_reader::do_arg_serial): New function.
7799         (Input_reader::do_get_unused_symbol_count): New function.
7800         (Input_reader::do_get_unused_symbol): New function.
7801         (Incremental_binary::input_file_count): New function.
7802         (Incremental_binary::get_input_reader): Change signature to use
7803         index instead of filename.
7804         (Incremental_binary::file_has_changed): New function.
7805         (Incremental_binary::get_input_argument): New function.
7806         (Incremental_binary::get_library): New function.
7807         (Incremental_binary::get_script_info): New function.
7808         (Incremental_binary::init_layout): New function.
7809         (Incremental_binary::reserve_layout): New function.
7810         (Incremental_binary::output_file): New function.
7811         (Incremental_binary::do_check_inputs): New function.
7812         (Incremental_binary::do_file_is_unchanged): Remove.
7813         (Incremental_binary::do_file_has_changed): New function.
7814         (Incremental_binary::do_init_layout): New function.
7815         (Incremental_binary::do_reserve_layout): New function.
7816         (Incremental_binary::do_input_file_count): New function.
7817         (Incremental_binary::do_get_input_reader): Change signature.
7818         (Incremental_binary::input_args_map_): New data member.
7819         (Incremental_binary::library_map_): New data member.
7820         (Incremental_binary::script_map_): New data member.
7821         (Sized_incremental_binary::Sized_incremental_binary): Initialize
7822         new data members.
7823         (Sized_incremental_binary::output_section): New function.
7824         (Sized_incremental_binary::inputs_reader): Add const.
7825         (Sized_incremental_binary::symtab_reader): Add const.
7826         (Sized_incremental_binary::relocs_reader): Add const.
7827         (Sized_incremental_binary::got_plt_reader): Add const.
7828         (Sized_incremental_binary::get_symtab_view): New function.
7829         (Sized_incremental_binary::Inputs_reader): New typedef.
7830         (Sized_incremental_binary::Input_entry_reader): New typedef.
7831         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
7832         (Sized_incremental_binary::do_file_is_unchanged): Remove.
7833         (Sized_incremental_binary::do_file_has_changed): New function.
7834         (Sized_incremental_binary::do_init_layout): New function.
7835         (Sized_incremental_binary::do_reserve_layout): New function.
7836         (Sized_input_reader::Inputs_reader): Remove.
7837         (Sized_input_reader::Input_entry_reader): Remove.
7838         (Sized_input_reader::do_arg_serial): New function.
7839         (Sized_input_reader::do_get_unused_symbol_count): New function.
7840         (Sized_input_reader::do_get_unused_symbol): New function.
7841         (Sized_incremental_binary::do_input_file_count): New function.
7842         (Sized_incremental_binary::do_get_input_reader): Change signature;
7843         use index instead of filename.
7844         (Sized_incremental_binary::section_map_): New data member.
7845         (Sized_incremental_binary::input_entry_readers_): New data member.
7846         (class Sized_incr_relobj): New class.
7847         (class Sized_incr_dynobj): New class.
7848         (make_sized_incremental_object): New function.
7849         (class Incremental_library): New class.
7850         * layout.cc (Free_list::num_lists): New static data member.
7851         (Free_list::num_nodes): New static data member.
7852         (Free_list::num_removes): New static data member.
7853         (Free_list::num_remove_visits): New static data member.
7854         (Free_list::num_allocates): New static data member.
7855         (Free_list::num_allocate_visits): New static data member.
7856         (Free_list::init): New function.
7857         (Free_list::remove): New function.
7858         (Free_list::allocate): New function.
7859         (Free_list::dump): New function.
7860         (Free_list::print_stats): New function.
7861         (Layout_task_runner::run): Resize output file for incremental updates.
7862         (Layout::Layout): Initialize new data members.
7863         (Layout::set_incremental_base): New function.
7864         (Layout::init_fixed_output_section): New function.
7865         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
7866         incremental updates.
7867         (Layout::create_gold_note): Do not create gold note section for
7868         incremental updates.
7869         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
7870         for incremental updates.
7871         (Layout::set_section_offsets): For incremental updates, allocate space
7872         from free list.
7873         (Layout::create_symtab_sections): Layout with offsets relative to
7874         start of section; for incremental updates, allocate space from free
7875         list.
7876         (Layout::create_shdrs): For incremental updates, allocate space from
7877         free list.
7878         (Layout::finish_dynamic_section): For incremental updates, do not
7879         check --as-needed (fixed in subsequent patch).
7880         * layout.h (class Free_list): New class.
7881         (Layout::set_incremental_base): New function.
7882         (Layout::incremental_base): New function.
7883         (Layout::init_fixed_output_section): New function.
7884         (Layout::allocate): New function.
7885         (Layout::incremental_base_): New data member.
7886         (Layout::free_list_): New data member.
7887         * main.cc (main): Print Free_list statistics.
7888         * object.cc (Relobj::finalize_incremental_relocs): Add
7889         clear_counts parameter; clear counts only when clear_counts is set.
7890         (Sized_relobj::Sized_relobj): Initialize new base class.
7891         (Sized_relobj::do_layout): Don't report special sections.
7892         (Sized_relobj::do_for_all_local_got_entries): New function.
7893         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
7894         symtab_off to all symbol table offsets.
7895         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
7896         * object.h (class Got_offset_list): Move to top of file.
7897         (Object::Object): Allow case where input_file == NULL.
7898         (Object::~Object): Likewise.
7899         (Object::input_file): Assert that input_file != NULL.
7900         (Object::lock): Allow case where input_file == NULL.
7901         (Object::unlock): Likewise.
7902         (Object::is_locked): Likewise.
7903         (Object::token): Likewise.
7904         (Object::release): Likewise.
7905         (Object::is_incremental): New function.
7906         (Object::get_mtime): New function.
7907         (Object::for_all_local_got_entries): New function.
7908         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
7909         (Object::set_is_in_system_directory): New function.
7910         (Object::is_in_system_directory): New function.
7911         (Object::do_is_incremental): New function.
7912         (Object::do_get_mtime): New function.
7913         (Object::do_for_all_local_got_entries): New function.
7914         (Object::is_in_system_directory_): New data member.
7915         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
7916         (class Sized_relobj_base): New class.
7917         (class Sized_relobj): Derive from Sized_relobj_base.
7918         (class Sized_relobj::Symbols): Redeclare from base class.
7919         (class Sized_relobj::local_got_offset_list): Remove.
7920         (class Sized_relobj::Output_sections): Redeclare from base class.
7921         (class Sized_relobj::do_for_all_local_got_entries): New function.
7922         (class Sized_relobj::write_local_symbols): Add offset parameter.
7923         (class Sized_relobj::local_symbol_offset_): Update comment.
7924         (class Sized_relobj::local_dynsym_offset_): Update comment.
7925         * options.cc (Input_arguments::add_file): Remove const.
7926         * options.h (Input_file_argument::Input_file_argument):
7927         Initialize arg_serial_ (all constructors).
7928         (Input_file_argument::set_arg_serial): New function.
7929         (Input_file_argument::arg_serial): New function.
7930         (Input_file_argument::arg_serial_): New data member.
7931         (Input_arguments::Input_arguments): Initialize file_count_.
7932         (Input_arguments::add_file): Remove const.
7933         (Input_arguments::number_of_input_files): New function.
7934         (Input_arguments::file_count_): New data member.
7935         (Command_line::number_of_input_files): Call
7936         Input_arguments::number_of_input_files.
7937         * output.cc (Output_segment_headers::Output_segment_headers):
7938         Set current size.
7939         (Output_section::Input_section::current_data_size): New function.
7940         (Output_section::Output_section): Initialize new data members.
7941         (Output_section::add_input_section): Don't do merge sections for
7942         an incremental link; allocate space from free list for an
7943         incremental update.
7944         (Output_section::add_output_section_data): Allocate space from
7945         free list for an incremental update.
7946         (Output_section::update_data_size): New function.
7947         (Output_section::set_fixed_layout): New function.
7948         (Output_section::reserve): New function.
7949         (Output_segment::set_section_addresses): Remove const.
7950         (Output_segment::set_section_list_addresses): Remove const; allocate
7951         space from free list for an incremental update.
7952         (Output_segment::set_offset): Adjust size of RELRO segment for an
7953         incremental update.
7954         * output.h (Output_data::current_data_size): Move here from
7955         child classes.
7956         (Output_data::pre_finalize_data_size): New function.
7957         (Output_data::update_data_size): New function.
7958         (Output_section_headers::update_data_size): new function.
7959         (Output_section_data_build::current_data_size): Move to Output_data.
7960         (Output_data_strtab::update_data_size): New function.
7961         (Output_section::current_data_size): Move to Output_data.
7962         (Output_section::set_fixed_layout): New function.
7963         (Output_section::has_fixed_layout): New function.
7964         (Output_section::reserve): New function.
7965         (Output_section::update_data_size): New function.
7966         (Output_section::has_fixed_layout_): New data member.
7967         (Output_section::free_list_): New data member.
7968         (Output_segment::set_section_addresses): Remove const.
7969         (Output_segment::set_section_list_addresses): Remove const.
7970         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
7971         New function.
7972         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
7973         New function.
7974         * readsyms.cc (Read_symbols::do_read_symbols): Add library
7975         parameter when calling Add_symbols constructor; store argument
7976         serial number for members of a lib group.
7977         (Add_symbols::locks): Allow case where token == NULL.
7978         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
7979         (Read_member::~Read_member): New function.
7980         (Read_member::is_runnable): New function.
7981         (Read_member::locks): New function.
7982         (Read_member::run): New function.
7983         (Check_script::~Check_script): New function.
7984         (Check_script::is_runnable): New function.
7985         (Check_script::locks): New function.
7986         (Check_script::run): New function.
7987         (Check_library::~Check_library): New function.
7988         (Check_library::is_runnable): New function.
7989         (Check_library::locks): New function.
7990         (Check_library::run): New function.
7991         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
7992         (Add_symbols::library_): New data member.
7993         (class Read_member): New class.
7994         (class Check_script): New class.
7995         (class Check_library): New class.
7996         * reloc.cc (Read_relocs::is_runnable): Allow case where
7997         token == NULL.
7998         (Read_relocs::locks): Likewise.
7999         (Scan_relocs::locks): Likewise.
8000         (Relocate_task::locks): Likewise.
8001         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
8002         to clear counters.
8003         (Sized_relobj::incremental_relocs_scan): Fix comment.
8004         (Sized_relobj::do_relocate): Pass output file offset to
8005         write_local_symbols.
8006         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
8007         from class declaration.
8008         * script.cc (read_input_script): Allocate Script_info; pass
8009         argument serial number to report_script.
8010         * script.h (class Script_info): Move to incremental.h.
8011         * symtab.cc (Symbol_table::add_from_incrobj): New function.
8012         * symtab.h (Symbol_table::add_from_incrobj): New function.
8013         (Symbol_table::set_file_offset): New function.
8014
8015 2011-04-05  Cary Coutant  <ccoutant@google.com>
8016
8017         * incremental-dump.cc (dump_incremental_inputs): Change signature
8018         to take a Sized_incremental_binary; change caller.  Use readers
8019         in Sized_incremental_binary.
8020         * incremental.cc
8021         (Sized_incremental_binary::find_incremental_inputs_sections):
8022         Rename do_find_incremental_inputs_sections to this.
8023         (Sized_incremental_binary::setup_readers): New function.
8024         (Sized_incremental_binary::do_check_inputs): Check
8025         has_incremental_info_ flag; move setup code to setup_readers;
8026         use input readers.
8027         (Sized_incremental_binary::do_file_is_unchanged): New function.
8028         (Sized_incremental_binary::do_get_input_reader): New function.
8029         * incremental.h (class Incremental_binary): Move to end of file.
8030         (Incremental_binary::file_is_unchanged): New function.
8031         (Incremental_binary::do_file_is_unchanged): New function.
8032         (Incremental_binary::Input_reader): New class.
8033         (Incremental_binary::get_input_reader): New function.
8034         (class Sized_incremental_binary): Move to end of file.
8035         (Sized_incremental_binary::Sized_incremental_binary): Setup the
8036         input section reader classes.
8037         (Sized_incremental_binary::has_incremental_info): New function.
8038         (Sized_incremental_binary::inputs_reader): New function.
8039         (Sized_incremental_binary::symtab_reader): New function.
8040         (Sized_incremental_binary::relocs_reader): New function.
8041         (Sized_incremental_binary::got_plt_reader): New function.
8042         (Sized_incremental_binary::do_file_is_unchanged): New function.
8043         (Sized_incremental_binary::Sized_input_reader): New class.
8044         (Sized_incremental_binary::get_input_reader): New function.
8045         (Sized_incremental_binary::find_incremental_inputs_sections):
8046         Rename do_find_incremental_inputs_sections to this.
8047         (Sized_incremental_binary::setup_readers): New function.
8048         (Sized_incremental_binary::has_incremental_info_): New data member.
8049         (Sized_incremental_binary::inputs_reader_): New data member.
8050         (Sized_incremental_binary::symtab_reader_): New data member.
8051         (Sized_incremental_binary::relocs_reader_): New data member.
8052         (Sized_incremental_binary::got_plt_reader_): New data member.
8053         (Sized_incremental_binary::current_input_file_): New data member.
8054
8055 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
8056
8057         PR gold/12640
8058         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
8059         violation.
8060
8061 2011-03-30  Cary Coutant  <ccoutant@google.com>
8062
8063         * archive.cc (Archive::include_member): Adjust call to report_object.
8064         (Add_archive_symbols::run): Add script_info to call to
8065         report_archive_begin.
8066         (Lib_group::include_member): Adjust call to report_object.
8067         (Add_lib_group_symbols::run): Adjust call to report_object.
8068         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
8069         blocks.  Add object count for script input files.
8070         * incremental.cc (Incremental_inputs::report_archive_begin): Add
8071         script_info parameter; change all callers.
8072         (Incremental_inputs::report_object): Add script_info parameter;
8073         change all callers.
8074         (Incremental_inputs::report_script): Store backpointer to
8075         incremental info entry.
8076         (Output_section_incremental_inputs::set_final_data_size): Record
8077         additional information for scripts.
8078         (Output_section_incremental_inputs::write_info_blocks): Likewise.
8079         * incremental.h (Incremental_script_entry::add_object): New function.
8080         (Incremental_script_entry::get_object_count): New function.
8081         (Incremental_script_entry::get_object): New function.
8082         (Incremental_script_entry::objects_): New data member; adjust
8083         constructor.
8084         (Incremental_inputs::report_archive_begin): Add script_info parameter.
8085         (Incremental_inputs::report_object): Add script_info parameter.
8086         (Incremental_inputs_reader::get_object_count): New function.
8087         (Incremental_inputs_reader::get_object_offset): New function.
8088         * options.cc (Input_arguments::add_file): Return reference to
8089         new input argument.
8090         * options.h (Input_argument::set_script_info): New function.
8091         (Input_argument::script_info): New function.
8092         (Input_argument::script_info_): New data member; adjust all
8093         constructors.
8094         (Input_file_group::add_file): Return reference to new input argument.
8095         (Input_file_lib::add_file): Likewise.
8096         (Input_arguments::add_file): Likewise.
8097         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
8098         * script.cc (Parser_closure::Parser_closure): Add script_info
8099         parameter; adjust all callers.
8100         (Parser_closure::script_info): New function.
8101         (Parser_closure::script_info_): New data member.
8102         (read_input_script): Report scripts earlier to incremental info.
8103         (script_add_file): Set script_info in Input_argument.
8104         (script_add_library): Likewise.
8105         * script.h (Script_options::Script_info): Rewrite class.
8106
8107 2011-03-29  Cary Coutant  <ccoutant@google.com>
8108
8109         * archive.cc (Library_base::should_include_member): Move
8110         method here from class Archive.
8111         (Archive::Archive): Initialize base class.
8112         (Archive::should_include_member): Move to base class.
8113         (Archive::do_for_all_unused_symbols): New function.
8114         (Add_archive_symbols::run): Remove redundant access to
8115         incremental_inputs.
8116         (Lib_group::Lib_group): Initialize base class.
8117         (Lib_group::do_filename): New function.
8118         (Lib_group::include_member): Pass pointer to Lib_group to
8119         report_object.
8120         (Lib_group::do_for_all_unused_symbols): New function.
8121         (Add_lib_group_symbols::run): Report archive information for
8122         incremental links.
8123         * archive.h (class Library_base): New base class.
8124         (class Archive): Derive from Library_base.
8125         (Archive::filename): Move to base class.
8126         (Archive::set_incremental_info): Likewise.
8127         (Archive::incremental_info): Likewise.
8128         (Archive::Should_include): Likewise.
8129         (Archive::should_include_member): Likewise.
8130         (Archive::Armap_entry): Remove.
8131         (Archive::Unused_symbol_iterator): Remove.
8132         (Archive::unused_symbols_begin): Remove.
8133         (Archive::unused_symbols_end): Remove.
8134         (Archive::do_filename): New function.
8135         (Archive::do_get_mtime): New function.
8136         (Archive::do_for_all_unused_symbols): New function.
8137         (Archive::task_): Move to base class.
8138         (Archive::incremental_info_): Likewise.
8139         (class Lib_group): Derive from Library_base.
8140         (Lib_group::do_filename): New function.
8141         (Lib_group::do_get_mtime): New function.
8142         (Lib_group::do_for_all_unused_symbols): New function.
8143         (Lib_group::task_): Move to base class.
8144         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
8145         function.
8146         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
8147         function.
8148         * incremental.cc (Incremental_inputs::report_archive_begin):
8149         Use Library_base; call library's get_mtime; add incremental inputs
8150         entry before members.
8151         (class Unused_symbol_visitor): New class.
8152         (Incremental_inputs::report_archive_end): Use Library_base; use
8153         visitor class to record unused symbols; don't add incremental inputs
8154         entry after members.
8155         (Incremental_inputs::report_object): Use Library_base.
8156         * incremental.h
8157         (Incremental_archive_entry::Incremental_archive_entry): Remove
8158         unused Archive parameter.
8159         (Incremental_inputs::report_archive_begin): Use Library_base.
8160         (Incremental_inputs::report_archive_end): Likewise.
8161         (Incremental_inputs::report_object): Likewise.
8162         * object.cc (Sized_relobj::do_for_all_global_symbols): New
8163         function.
8164         * object.h (Object::for_all_global_symbols): New function.
8165         (Object::do_for_all_global_symbols): New function.
8166         (Sized_relobj::do_for_all_global_symbols): New function.
8167         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
8168         function.
8169         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
8170         function.
8171
8172 2011-03-27  Ian Lance Taylor  <iant@google.com>
8173
8174         * archive.cc (Archive::interpret_header): Return -1 if something
8175         goes wrong.  Change callers accordingly.
8176
8177 2011-03-25  Cary Coutant  <ccoutant@google.com>
8178
8179         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
8180         * testsuite/Makefile.in: Regenerate.
8181
8182 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
8183
8184         * plugin.cc (get_view): New.
8185         (Plugin::load): Pass get_view to the plugin.
8186         (Plugin_manager::get_view): New.
8187
8188 2011-03-21  Ian Lance Taylor  <iant@google.com>
8189
8190         * testsuite/final_layout.sh: Rewrite to not use dc.
8191         * testsuite/relro_test.sh: Fail if dc is not present.
8192
8193 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
8194
8195         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
8196         Change == to -eq.
8197         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
8198         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
8199         Change == to -eq.
8200         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
8201         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
8202
8203 2011-03-14  Ian Lance Taylor  <iant@google.com>
8204
8205         * script-sections.cc (Sort_output_sections::script_compare):
8206         Rename from is_before, change return type.
8207         (Sort_output_sections::operator()): Adjust accordingly.
8208
8209 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
8210
8211         PR gold/12572
8212         * testsuite/odr_violation2.cc: Add comment to make all error line
8213         numbers double digits.
8214         * testsuite/debug_msg.sh: Adjust expected errors.
8215
8216 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
8217
8218         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
8219         but mark earlier ones as non-canonical
8220         (offset_to_iterator): Update search target and example
8221         (do_addr2line): Return extra lines in a vector*
8222         (format_file_lineno): Extract from do_addr2line
8223         (one_addr2line): Add vector* out-param
8224         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
8225         when a lineno entry appeared last for its instruction
8226         (Dwarf_line_info): Add vector* out-param
8227         * object.cc (Relocate_info): Pass NULL for the vector* out-param
8228         * symtab.cc (Odr_violation_compare): Include the lineno in the
8229         comparison again.
8230         (linenos_from_loc): New. Combine the canonical line for an
8231         address with its other lines.
8232         (True_if_intersect): New. Helper functor to make
8233         std::set_intersection a query.
8234         (detect_odr_violations): Compare sets of lines instead of just
8235         one line for each function. This became less deterministic, but
8236         has fewer false positives.
8237         * symtab.h: Declarations.
8238         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
8239         mix an optimized and non-optimized object in the same binary
8240         (odr_violation2.so): Same.
8241         * testsuite/Makefile.in: Regenerate from Makefile.am.
8242         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
8243         * testsuite/debug_msg.sh: Update line numbers and add
8244         assertions.
8245         * testsuite/odr_violation1.cc: Use OdrDerived, in a
8246         non-optimized context.
8247         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
8248         isn't inlined, and use OdrDerived in an optimized context.
8249         * testsuite/odr_header1.h: Defines OdrDerived, where
8250         optimization will change the
8251         first-instruction-in-the-destructor's file and line number.
8252         * testsuite/odr_header2.h: Defines OdrBase.
8253
8254 2011-03-09  Ian Lance Taylor  <iant@google.com>
8255
8256         * fileread.cc (File_read::clear_views): Don't delete the whole
8257         file view.
8258
8259 2011-03-08  Ian Lance Taylor  <iant@google.com>
8260
8261         PR gold/12525
8262         * fileread.cc: #include <climits>.
8263         (GOLD_IOV_MAX): Define.
8264         (File_read::read_multiple): Limit number of entries by iov_max.
8265         * fileread.h (class File_read): Always set max_readv_entries to
8266         128.
8267
8268 2011-03-07  Ian Lance Taylor  <iant@google.com>
8269
8270         PR gold/12525
8271         * options.h (class General_options): Add -dy and -dn.
8272
8273 2011-03-02  Cary Coutant  <ccoutant@google.com>
8274
8275         * testsuite/script_test_9.t: Add TLS segment.
8276
8277 2011-03-02  Simon Baldwin  <simonb@google.com>
8278
8279         * configure.ac: Add check for gnu_indirect_function support in
8280         the toolchain building binutils.
8281         * configure: Rebuild.
8282
8283 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
8284
8285         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
8286         plugin only symbols.
8287         (Symbol_table::sized_finalize_symbol) Mark symbol only present
8288         in plugin files as not needed in the symbol table.
8289
8290 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
8291
8292         * output.cc (Output_section::add_input_section): Delay fill
8293         generation for section ordering.
8294
8295 2011-02-09  Ian Lance Taylor  <iant@google.com>
8296
8297         PR gold/12316
8298         * object.h (class Sized_relobj): Remove clear_local_symbols.
8299         * reloc.cc (Sized_relobj::do_relocate): Don't call
8300         clear_local_symbols.
8301
8302 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
8303
8304         * plugin.cc (is_visible_from_outside): Return true for symbols
8305         in the -u option.
8306
8307 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
8308
8309         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
8310         filename.
8311
8312 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
8313
8314         * icf.h (is_section_foldable_candidate): Change type of parameter
8315         to std::string.
8316         * icf.cc (Icf::find_identical_sections): Change type of local variable
8317         section_name to be std::string.
8318         (is_function_ctor_or_dtor): Change type of parameter to std::string.
8319
8320 2011-01-25  Ian Lance Taylor  <iant@google.com>
8321
8322         * script.cc (script_add_extern): Rewrite to use
8323         add_symbol_reference.
8324
8325 2011-01-25  Doug Kwan  <dougkwan@google.com>
8326
8327         * icf.cc (get_section_contents): Always lock section's object.
8328
8329 2011-01-24  Ian Lance Taylor  <iant@google.com>
8330
8331         * options.h (class General_options): Accept
8332         --no-detect-odr-violations.
8333
8334 2011-01-24  Ian Lance Taylor  <iant@google.com>
8335
8336         * version.cc (version_string): Bump to 1.11.
8337
8338 2011-01-24  Ian Lance Taylor  <iant@google.com>
8339
8340         * plugin.cc (class Plugin_rescan): Define new class.
8341         (Plugin_manager::claim_file): Set any_claimed_.
8342         (Plugin_manager::save_archive): New function.
8343         (Plugin_manager::save_input_group): New function.
8344         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
8345         necessary.
8346         (Plugin_manager::new_undefined_symbol): New function.
8347         (Plugin_manager::rescan): New function.
8348         (Plugin_manager::rescannable_defines): New function.
8349         (Plugin_manager::add_input_file): Set any_added_.
8350         * plugin.h (class Plugin_manager): define new fields rescannable_,
8351         undefined_symbols_, any_claimed_, and any_added_.  Declare
8352         Plugin_rescan as friend.  Declare new functions.
8353         (Plugin_manager::Rescannable): Define type.
8354         (Plugin_manager::Rescannable_list): Define type.
8355         (Plugin_manager::Undefined_symbol_list): Define type.
8356         (Plugin_manager::Plugin_manager): Initialize new fields.
8357         * archive.cc (Archive::defines_symbol): New function.
8358         (Add_archive_symbols::run): Pass archive to plugins if any.
8359         * archive.h (class Archive): Declare defines_symbol.
8360         * readsyms.cc (Input_group::~Input_group): New function.
8361         (Finish_group::run): Pass input_group to plugins if any.
8362         * readsyms.h (class Input_group): Declare destructor.
8363         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
8364         any.
8365
8366 2011-01-10  Ian Lance Taylor  <iant@google.com>
8367
8368         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
8369         section as relro.
8370         (Layout::set_segment_offsets): Reset increase_relro before calling
8371         set_section_addresses a second time.
8372
8373 2011-01-04  Cary Coutant  <ccoutant@google.com>
8374
8375         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
8376         sections before NOBITS sections.
8377
8378 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
8379
8380         * version.cc (print_version): Update copyright to 2011.
8381
8382 2010-12-23  Cary Coutant  <ccoutant@google.com>
8383
8384         * output.h (Output_data_reloc::add_output_section): Pass OD instead
8385         of OS to this->add.  Add OD parameter to second form of the function.
8386
8387 2010-12-20  Ian Lance Taylor  <iant@google.com>
8388
8389         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
8390         second of two consecutive entries with same offset.
8391
8392 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8393
8394         * testsuite/Makefile.am (ifuncmain2static_LDADD)
8395         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
8396         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
8397         to avoid unneeded links against $(LDADD).
8398         * testsuite/Makefile.in: Regenerate.
8399
8400 2010-12-15  Ian Lance Taylor  <iant@google.com>
8401
8402         PR gold/12324
8403         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
8404         for R_X86_64_32 and R_X86_64_PC32.
8405         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
8406         ver_matching_def_pic.o.
8407         (ver_matching_def_pic.o): New target.
8408
8409 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8410
8411         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
8412         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
8413         Move definition before File_read::View member definitions.
8414         (File_read::View::~View): Initialize and hold lock before
8415         updating current_mapped_bytes.
8416
8417 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8418
8419         * dwarf_reader.cc: Remove outdated comment.
8420         * gold-threads.cc: Fix typo in error message.
8421         * archive.cc: Fix typos in comments.
8422         * archive.h: Likewise.
8423         * arm-reloc-property.cc: Likewise.
8424         * arm-reloc-property.h: Likewise.
8425         * arm-reloc.def: Likewise.
8426         * arm.cc: Likewise.
8427         * attributes.h: Likewise.
8428         * cref.cc: Likewise.
8429         * ehframe.cc: Likewise.
8430         * fileread.h: Likewise.
8431         * gold.h: Likewise.
8432         * i386.cc: Likewise.
8433         * icf.cc: Likewise.
8434         * incremental.h: Likewise.
8435         * int_encoding.cc: Likewise.
8436         * layout.h: Likewise.
8437         * main.cc: Likewise.
8438         * merge.h: Likewise.
8439         * object.cc: Likewise.
8440         * object.h: Likewise.
8441         * options.cc: Likewise.
8442         * readsyms.cc: Likewise.
8443         * reduced_debug_output.cc: Likewise.
8444         * reloc.cc: Likewise.
8445         * script-sections.cc: Likewise.
8446         * sparc.cc: Likewise.
8447         * symtab.h: Likewise.
8448         * target-reloc.h: Likewise.
8449         * target.cc: Likewise.
8450         * target.h: Likewise.
8451         * timer.cc: Likewise.
8452         * timer.h: Likewise.
8453         * x86_64.cc: Likewise.
8454
8455 2010-12-09  Cary Coutant  <ccoutant@google.com>
8456
8457         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
8458         stack.
8459         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
8460         parameter; change all callers.
8461         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
8462         * options.h (warn_execstack): New option.
8463
8464 2010-12-07  Doug Kwan  <dougkwan@google.com>
8465
8466         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
8467         like function call relocations.
8468
8469 2010-12-07  Ian Lance Taylor  <iant@google.com>
8470
8471         * archive.cc (Archive::get_elf_object_for_member): Permit
8472         punconfigured to be NULL.
8473         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
8474         (Archive::include_member): Pass NULL to get_elf_object_for_member
8475         if we searched for the archive and this is the first included
8476         object.
8477
8478 2010-12-01  Ian Lance Taylor  <iant@google.com>
8479
8480         * dwarf_reader.h (class Sized_dwarf_line_info): Add
8481         track_relocs_type_ field.
8482         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8483         Set track_relocs_type_.
8484         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
8485         contents when using RELA relocs.
8486         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
8487         reloc_map_.
8488         * reloc.cc (Track_relocs::next_addend): New function.
8489         * reloc.h (class Track_relocs): Declare next_addend.
8490
8491 2010-12-01  Ian Lance Taylor  <iant@google.com>
8492
8493         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
8494         virtual destructor.
8495
8496 2010-12-01  Ian Lance Taylor  <iant@google.com>
8497
8498         * README: Update compilers known to work and fail.
8499
8500 2010-11-23  Matthias Klose  <doko@ubuntu.com>
8501
8502         * configure.in: For --enable-gold, handle value `default' instead of
8503         `both*'.  Always install ld as ld.bfd, install as ld if gold is
8504         not the default.
8505         * configure: Regenerate.
8506
8507 2010-11-18  Doug Kwan  <dougkwan@google.com>
8508
8509         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
8510         and right_alignment to be zero.  Store result alignment only if it is
8511         greater than existing alignment.
8512
8513 2010-11-16  Cary Coutant  <ccoutant@google.com>
8514
8515         PR gold/12220
8516         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8517         Check for ".zdebug_line".
8518
8519 2010-11-16  Doug Kwan  <dougkwan@google.com>
8520             Cary Coutant  <ccoutant@google.com>
8521
8522         * output.h (Output_segment::set_section_addresses): Pass increase_relro
8523         by reference; adjust all callers.
8524         * output.cc (Output_segment::set_section_addresses): Adjust references
8525         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
8526         list is empty.
8527         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
8528         end at page boundary.
8529
8530 2010-11-16  Cary Coutant  <ccoutant@google.com>
8531
8532         PR gold/12220
8533         * layout.cc (Layout::choose_output_section): Transform names of
8534         compressed sections even when using a script with a SECTIONS clause.
8535         (Layout::output_section_name): Remove code to transform
8536         compressed debug section names.
8537         * output.cc (Output_section::add_input_section): Use uncompressed
8538         section size when tracking input sections.
8539
8540 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
8541
8542         * symtab.h (Symbol::NON_PIC_REF): Remove.
8543         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
8544         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
8545         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
8546         (Symbol::use_plt_offset): Take a flags argument and pass it
8547         directly to needs_dynamic_reloc.  Restrict check for undefined
8548         weak symbols to function calls.
8549         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
8550         (Target_arm::Scan::global): Use it.
8551         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
8552         (Target_arm::Relocate::relocate): Likewise.
8553         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
8554         parameter with an r_type parameter.  Use get_reference_flags
8555         to get the flags.
8556         (Target_arm::Relocate::relocate): Update accordingly.
8557         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
8558         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
8559         (Target_i386::Scan::global): Likewise.
8560         (Target_i386::Relocate::relocate): Likewise.
8561         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
8562         parameter with an r_type parameter.  Use get_reference_flags
8563         to get the flags.
8564         (Target_i386::Relocate::relocate): Update accordingly.
8565         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
8566         (Target_powerpc::Scan::global): Use it.
8567         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
8568         (Target_powerpc::Relocate::relocate): Likewise.
8569         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
8570         (Target_sparc::Scan::global): Use it.
8571         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
8572         (Target_sparc::Relocate::relocate): Likewise.
8573         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
8574         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
8575         (Target_x86_64::Scan::global): Likewise.
8576         (Target_x86_64::Relocate::relocate): Likewise.
8577
8578 2010-11-08  Doug Kwan  <dougkwan@google.com>
8579             Cary Coutant  <ccoutant@google.com>
8580
8581         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
8582         (Arm_exidx_merge_section::section_contents_): New data member.
8583         (Arm_input_section::Arm_input_section): Initialize original_contents_.
8584         (Arm_input_section::~Arm_input_section): De-allocate memory.
8585         (Arm_input_section::original_contents_): New data member.
8586         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
8587         in parameters instead of calling Object::section_contents without
8588         locking.
8589         (Arm_output_section::group_section): New parameter TASK.  Pass it
8590         to callees that need locking objects.
8591         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
8592         to lock EXIDX input sections.  Fix a formatting issue.  Call
8593         Arm_exidx_merged_section::build_contents to create merged section
8594         contents.
8595         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
8596         to lock object of stub table owner.
8597         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
8598         TEXT_SIZE to initialize data member TEXT_SIZE_.
8599         (Arm_exidx_input_section::addralign): Fix typo in comment.
8600         (Arm_exidx_input_section::text_size): New method.
8601         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
8602         that require locking objects.  Lock objects before scanning for stubs
8603         and updating local symbols.
8604         (Arm_input_section<big_endian>::init): Copy contents of original
8605         input section.
8606         (Arm_input_section<big_endian>::do_write): Use saved contents of
8607         original input section instead of calling Object::section_contents
8608         without locking.
8609         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
8610         size without calling Object::section_size().
8611         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
8612         for size.  Allocate a buffer for merged EXIDX entries.
8613         (Arm_exidx_merged_section::build_contents): New method.
8614         (Arm_exidx_merged_section::do_write): Move merge section contents
8615         building code to Arm_exidx_merged_section::build_contetns.  Write
8616         out contetns in buffer instead of building it on the fly.
8617         (Arm_relobj::make_exidx_input_section): Also pass text section size
8618         to Arm_exidx_input_section constructor.
8619         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
8620         (Arm_dynobj::do_read_symbols): Fix memory leak.
8621         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
8622         * target.h: (class Task): Add forward declaration.
8623         (Target::relax): Add new parameter TASK and pass it to
8624         Target::do_relax().
8625         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
8626
8627 2010-11-05  Cary Coutant  <ccoutant@google.com>
8628
8629         PR gold/10708
8630         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
8631         object when reading from the file.
8632         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
8633         second layout pass.
8634         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
8635         when reading section contents.
8636         (get_section_contents): Likewise.
8637         (icf::find_identical_sections): Likewise.
8638         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
8639         object when reading from the file.
8640         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
8641         the object when doing deferred section layout.
8642
8643 2010-11-03  Nick Clifton  <nickc@redhat.com>
8644
8645         PR gold/12001
8646         * script.h (class Symbol_assignment: name): New member.  Returns
8647         the name of the symbol.
8648         * scrfipt.cc (Script_options::is_pending_assignment): New member.
8649         Returns true if the given symbol name is on the list of
8650         assignments wating to be processed.
8651         * archive.cc (should_incldue_member): If the symbol is undefined,
8652         check to see if it is on the list of symbols pending assignment.
8653
8654 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
8655
8656         * script-sections.cc (Script_sections::find_memory_region): Check
8657         for a NULL output section pointer.
8658
8659 2010-10-29  Doug Kwan  <dougkwan@google.com>
8660
8661         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
8662         Output_section::add_relaxed_input_section.
8663         * output.cc (Output_section::add_relaxed_input_section): Add new
8664         arguments LAYOUT and NAME.  Set section order index.
8665         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8666         Copy section order index.
8667         * output.h (Output_section::add_relaxed_input_section): Add new
8668         arguments LAYOUT and NAME.
8669
8670 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8671
8672         * testsuite/Makefile.am: Move gcctestdir/ld rule to
8673         NATIVE_OR_CROSS_LINKER.
8674         * testsuite/Makefile.in: Regenerate.
8675
8676 2010-10-20  Doug Kwan  <dougkwan@google.com>
8677
8678         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
8679         without SHF_LINK_ORDER flags.
8680         * layout.cc (Layout::choose_output_section): Do not filter
8681         SHF_LINK_ORDER flag in a relocatable link.
8682
8683 2010-10-17  Cary Coutant  <ccoutant@google.com>
8684
8685         * output.h (Output_segment::set_section_addresses): Change function
8686         signature.  Update all callers.
8687         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
8688         sections.
8689         (Output_segment::set_section_addresses): Align after last TLS
8690         section.  Add padding before last relro section instead of after.
8691
8692 2010-10-17  Doug Kwan  <dougkwan@google.com>
8693
8694         * gold/arm.cc (Target_arm::got_section): Use correct order and set
8695         GOT output section to be writable.
8696
8697 2010-10-14  Cary Coutant  <ccoutant@google.com>
8698
8699         * debug.h (DEBUG_INCREMENTAL): New flag.
8700         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
8701         * gold.cc (queue_initial_tasks): Check parameters for incremental link
8702         mode.
8703         * incremental.cc (report_command_line): Ignore all forms of
8704         --incremental.
8705         * layout.cc (Layout::Layout): Check parameters for incremental link
8706         mode.
8707         * options.cc (General_options::parse_incremental): New function.
8708         (General_options::parse_no_incremental): New function.
8709         (General_options::parse_incremental_full): New function.
8710         (General_options::parse_incremental_update): New function.
8711         (General_options::incremental_mode_): New data member.
8712         (General_options::finalize): Check incremental_mode_.
8713         * options.h (General_options): Update help text for --incremental.
8714         Add --no-incremental, --incremental-full, --incremental-update.
8715         (General_options::Incremental_mode): New enum type.
8716         (General_options::incremental_mode): New function.
8717         (General_options::incremental_mode_): New data member.
8718         * parameters.cc (Parameters::incremental_mode_): New data member.
8719         (Parameters::set_options): Set incremental_mode_.
8720         (Parameters::set_incremental_full): New function.
8721         (Parameters::incremental): New function.
8722         (Parameters::incremental_update): New function.
8723         (set_parameters_incremental_full): New function.
8724         * parameters.h (Parameters::set_incremental_full): New function.
8725         (Parameters::incremental): New function.
8726         (Parameters::incremental_update): New function.
8727         (Parameters::incremental_mode_): New data member.
8728         (set_parameters_incremental_full): New function.
8729         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
8730         incremental link mode.
8731         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
8732         (Sized_relobj::do_relocate_sections): Likewise.
8733         * testsuite/Makefile.am (incremental_test): Use --incremental-full
8734         option.
8735         * testsuite/Makefile.in: Regenerate.
8736         * testsuite/incremental_test.sh: Filter all forms of --incremental.
8737
8738 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8739
8740         * script-sections.h (class Script_sections): Make
8741         Sections_elements typedef public.
8742         * script-sections.cc (class Sort_output_sections): Add elements_
8743         field.  Add constructor which sets it; change all callers.
8744         (Sort_output_sections::is_before): New function.
8745         (Sort_output_sections::operator()): Call is_before.
8746         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
8747         conditional.
8748         * testsuite/script_test_10.sh: New test. Test script section
8749         order.
8750         * testsuite/script_test_10.t: Likewise.
8751         * testsuite/script_test_10.s: Likewise.
8752         * testsuite/Makefile.am: Wrap the cross linker tests and the
8753         common tests into NATIVE_OR_CROSS_LINKER.
8754         (check_SCRIPTS): Add script_test_10.sh.
8755         (check_DATA): Add script_test_10.stdout.
8756         (script_test_10.o, script_test_10): New targets.
8757         (script_test_10.stdout): New target.
8758         * configure, testsuite/Makefile.in: Regenerate.
8759
8760 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8761
8762         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
8763         error for the deprecated relocations.
8764         (Target_arm::Scan::global): Likewise.
8765         (Target_arm::Relocate::relocate): Likewise.
8766
8767 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
8768
8769         * fileread.cc (Input_file::find_file): Initialize *found_name
8770         and *namep when using the fallback search for case 4.
8771
8772 2010-10-11  Cary Coutant  <ccoutant@google.com>
8773
8774         * options.h (class General_options): Redefine -z lazy as an alias for
8775         the negation of -z now.
8776
8777 2010-10-11  Ian Lance Taylor  <iant@google.com>
8778
8779         * resolve.cc (symbol_to_bits): Report the value of the unsupported
8780         binding.
8781
8782 2010-10-06  Nick Clifton  <nickc@redhat.com>
8783
8784         * script-sections.cc(class Memory_region): Remove
8785         current_lma_offset_ field.  Rename current_vma_offset_ to
8786         current_offset_.  Add last_section_ field.
8787         (Memory_region::get_current_vma_address): Rename to
8788         get_current_address.
8789         (Memory_region::get_current_lma_address): Delete.
8790         (Memory_region::increment_vma_offset): Rename to
8791         increment_offset.
8792         (Memory_region::increment_lma_offset): Delete.
8793         (Memory_region::attributes_compatible): New method.  Returns
8794         true if the provided section is compatible with the region.
8795         (Memory_region::get_last_section): New method.  Returns the last
8796         section to use the region.
8797         (Memory_region::set_last_section): New method.  Stores the last
8798         section to use the region.
8799         (Script_sections::block_in_region): New method.  Returns true if
8800         a block of memory is contained within a region.
8801         (Script_sections::find_memory_region): New method.  Locates a
8802         memory region to be used to set a VMA or LMA address.
8803         (Output_section_definition::set_section_addresses): Add code to
8804         check for addresses set by memory regions.
8805         (Output_segment::set_section_addresses): Remove memory region
8806         walking code.
8807         (Script_sections::create_segment): Add a warning if a header
8808         segment is created outside of any region.
8809         * script-sections.h (class Script_sections): Add prototypes for
8810         find_memory_region and block_in_region methods.
8811         * testsuite/memory_test.s: Use .long instead of .word.
8812         * testsuite/memory_test.t: Add some more output sections.
8813         * testsuite/memory_test.sh: Update expected output.
8814
8815 2010-10-02  Doug Kwan  <dougkwan@google.com>
8816
8817         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
8818         defintion to symtab.h
8819         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
8820         declaration to defintion.
8821
8822 2010-10-01  Nick Clifton  <nickc@redhat.com>
8823
8824         * expression.cc (eval): Replace dummy argument with NULL.
8825         (eval_maybe_dot): Check for a NULL result section pointer.
8826         (Symbol_expression::value): Likewise.
8827         (Dot_expression::value): Likewise.
8828         (BINARY_EXPRESSION): Likewise.
8829         (Max_expression::value): Likewise.
8830         (Min_expression::value): Likewise.
8831         (Absolute_expression::value): Likewise.
8832         (Addr_expression::value_from_output_section): Likewise.
8833         (Loaddddr_expression::value_from_output_section): Likewise.
8834         (Segment_start_expression::value): Likewise.
8835         * script-sections.cc
8836         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
8837         argument with NULL.
8838         (Sections_elememt_dot_assignment::set_section_addresses):
8839         Likewise.
8840         (Output_data_expression::do_write_to_buffer): Likewise.
8841         (Output_section_definition::finalize_symbols): Likewise.
8842         (Output_section_definition::set_section_addresses): Likewise.
8843
8844 2010-09-30  Doug Kwan  <dougkwan@google.com>
8845
8846         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
8847
8848 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
8849
8850         * target.h (Target::can_icf_inline_merge_sections): New virtual
8851         function.
8852         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
8853         virtual function.
8854         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
8855         virtual function.
8856         * icf.cc (get_section_contents): Inline merge sections only when
8857         target allows it.
8858
8859 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8860
8861         * configure: Regenerate.
8862
8863 2010-09-17  Ian Lance Taylor  <iant@google.com>
8864
8865         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
8866         * testsuite/Makefile.am (memory_test.o): New target.
8867         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
8868         memory_test.t.
8869         * testsuite/Makefile.in: Rebuild.
8870
8871 2010-09-17  Doug Kwan  <dougkwan@google.com>
8872
8873         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
8874         defintion if relocation uses GOT entries of the symbol.
8875         * testsuite/icf_safe_test.sh: Fix test.
8876         * testsuite/icf_safe_so_test.sh: Fix test.
8877
8878 2010-09-16  Cary Coutant  <ccoutant@google.com>
8879
8880         * script_sections.cc (class Memory_region): Remove "NULL" from
8881         vector initializations.
8882
8883 2010-09-15  Cary Coutant  <ccoutant@google.com>
8884
8885         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
8886         Resolve forwarding symbols.
8887
8888 2010-09-15  Doug Kwan  <dougkwan@google.com>
8889
8890         * gold/testsuite/script_test_3.t: Add ARM special sections.
8891         * gold/testsuite/script_test_4.t: Same.
8892         * gold/testsuite/script_test_5.t: Same.
8893         * gold/testsuite/script_test_6.t: Same.
8894         * gold/testsuite/script_test_7.t: Same.
8895         * gold/testsuite/script_test_7.t: Same.
8896         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
8897
8898 2010-09-14  Cary Coutant  <ccoutant@google.com>
8899
8900         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
8901         (Target_x86_64::Relocate::relocate_tls): Replace check for
8902         saw_tls_block_reloc_ with test for executable section.
8903
8904 2010-09-12  Cary Coutant  <ccoutant@google.com>
8905
8906         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
8907         position-independent executables to shared libraries need dynamic
8908         relocations.
8909         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
8910         position-independent executables.
8911         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
8912         * testsuite/Makefile.in: Regenerate.
8913
8914 2010-09-10  Nick Clifton  <nickc@redhat.com>
8915
8916         PR gold/11997
8917         * testsuite/memory_test.t: Discard any sections that are not
8918         needed.
8919
8920 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
8921
8922         PR gold/11996
8923         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8924         "This::" to work around a bug in gcc 4.2.
8925
8926         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
8927
8928 2010-09-09  Rafael Espindola  <espindola@google.com>
8929
8930         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
8931         sections with different PF_X flags in the same segment.
8932         (Layout::find_first_load_seg): Search all segments to find the first
8933         one.
8934         * options.h (rosegment): New.
8935
8936 2010-09-08  Rafael Espindola  <espindola@google.com>
8937
8938         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
8939
8940 2010-09-08  Doug Kwan  <dougkwan@google.com>
8941
8942         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
8943         (Arm_relobj::do_relocate_sections): Add new parameter for output
8944         file to match the parent.
8945         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
8946         of local symbols instead of input values.  Update code to track
8947         changes in gold::relocate_section.
8948         * object.cc (Sized_relobj::compute_final_local_value): New methods.
8949         (Sized_relobj::compute_final_local_value_internal): New methods.
8950         (Sized_relobj::do_finalize_local_symbols): Move code from loop
8951         body into private version of Sized_relobj::compute_final_local_value.
8952         Call the inline method.
8953         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
8954         merged symbol value if there is one.
8955         (Symbol_value::has_output_value): New method defintiion.
8956         (Sized_relobj::Compute_final_local_value_status): New enum type.
8957         (Sized_relobj::compute_final_local_value): New methods.
8958         (Sized_relobj::compute_final_local_value_internal): New methods.
8959         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
8960         and arm_cortex_a8.sh.
8961         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
8962         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
8963         New tests.
8964         * Makefile.in: Regenerate.
8965         * testsuite/arm_bl_out_of_range.s: Update test.
8966         * testsuite/thumb_bl_out_of_range.s: Ditto.
8967         * testsuite/thumb_blx_out_of_range.s: Ditto.
8968         * testsuite/arm_branch_out_of_range.sh: New file.
8969         * testsuite/arm_cortex_a8.sh: Ditto.
8970         * testsuite/arm_cortex_a8_b.s: Ditto.
8971         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
8972         * testsuite/arm_cortex_a8_b_local.s: Ditto.
8973         * testsuite/arm_cortex_a8_bl.s: Ditto.
8974         * testsuite/arm_cortex_a8_blx.s: Ditto.
8975         * testsuite/arm_cortex_a8_local.s: Ditto.
8976         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
8977         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
8978
8979 2010-09-08  Rafael Espindola  <espindola@google.com>
8980
8981         * Makefile.am (memory_test.stdout): Run readelf with -W.
8982         * Makefile.in: Regenerate.
8983         * testsuite/memory_test.sh: Make the regexps accept both 32 and
8984         64 bit output.
8985
8986 2010-09-08  Rafael Espindola  <espindola@google.com>
8987
8988         * script-sections.cc (Script_sections::add_memory_region): Convert
8989         field precision to int.
8990         * script.cc (script_set_section_region, script_set_section_region):
8991         Convert field precision to int.
8992
8993 2010-09-08  Rafael Espindola  <espindola@google.com>
8994
8995         * arm.cc (do_finalize_sections): Create the __exidx_start and
8996         __exdix_end symbols even when the section is missing.
8997
8998 2010-09-08  Nick Clifton  <nickc@redhat.com>
8999
9000         * README: Remove claim that MEMORY is not supported.
9001         * expression.cc (script_exp_function_origin)
9002         (script_exp_function_length): Move from here to ...
9003         * script.cc: ... here.
9004         (script_set_section_region, script_add_memory)
9005         (script_parse_memory_attr, script_include_directive): New
9006         functions.
9007         * script-sections.cc
9008         (class Memory_region): New class.
9009         (class Output_section_definition): Add set_memory_region,
9010         set_section_vma, set_section_lma and get_section_name methods.
9011         (class Script_Sections): Add add_memory_region,
9012         find_memory_region, find_memory_region_origin,
9013         find_memory_region_length and set_memory_region methods.
9014         Have set_section_addresses method walk the list of set memory
9015         regions.
9016         Extend the print methos to display memory regions.
9017         * script-sections.h: Add prototypes for new methods.
9018         Add enum for MEMORY region attributes.
9019         * yyscript.y: Add support for parsing MEMORY regions.
9020         * script-c.h: Add prototypes for new functions.
9021         * testsuite/Makefile.am: Add test of MEMORY region functionality.
9022         * testsuite/Makefile.in: Regenerate.
9023         * testsuite/memory_test.sh: New script.
9024         * testsuite/memory_test.s: New assembler source file.
9025         * testsuite/memory_test.t: New linker script.
9026
9027 2010-08-27  Doug Kwan  <dougkwan@google.com>
9028
9029         * gold/resolve.cc (Symbol_table::should_override): Let a weak
9030         reference override an existing dynamic weak reference.
9031         * testsuite/Makefile.am: Add new test dyn_weak_ref.
9032         * testsuite/Makefile.in: Regenerate.
9033         * testsuite/dyn_weak_ref.sh: New file.
9034         * testsuite/dyn_weak_ref_1.c: Ditto.
9035         * testsuite/dyn_weak_ref_2.c: Ditto.
9036
9037 2010-08-27  Ian Lance Taylor  <iant@google.com>
9038
9039         * incremental.h (class Incremental_input_entry): Add virtual
9040         destructor.
9041
9042 2010-08-27  Ian Lance Taylor  <iant@google.com>
9043
9044         * testsuite/start_lib_test_3.c: Mark t3 as used.
9045
9046 2010-08-27  Nick Clifton  <nickc@redhat.com>
9047
9048         * options.cc (version_script): Fix small typo in previous
9049         whitespace tidyup.
9050
9051 2010-08-25  Nick Clifton  <nickc@redhat.com>
9052
9053         * archive.cc: Formatting fixes: Remove whitespace between
9054         typename and following asterisk.  Remove whitespace between
9055         function name and opening parenthesis.
9056         * archive.h: Likewise.
9057         * arm.cc: Likewise.
9058         * attributes.cc: Likewise.
9059         * attributes.h: Likewise.
9060         * common.cc: Likewise.
9061         * copy-relocs.cc: Likewise.
9062         * dirsearch.h: Likewise.
9063         * dynobj.cc: Likewise.
9064         * ehframe.cc: Likewise.
9065         * ehframe.h: Likewise.
9066         * expression.cc: Likewise.
9067         * fileread.cc: Likewise.
9068         * fileread.h: Likewise.
9069         * gc.h: Likewise.
9070         * gold-threads.cc: Likewise.
9071         * gold.cc: Likewise.
9072         * i386.cc: Likewise.
9073         * icf.h: Likewise.
9074         * incremental-dump.cc: Likewise.
9075         * incremental.cc: Likewise.
9076         * layout.cc: Likewise.
9077         * layout.h: Likewise.
9078         * main.cc: Likewise.
9079         * merge.cc: Likewise.
9080         * merge.h: Likewise.
9081         * object.cc: Likewise.
9082         * object.h: Likewise.
9083         * options.cc: Likewise.
9084         * options.h: Likewise.
9085         * output.cc: Likewise.
9086         * output.h: Likewise.
9087         * plugin.cc: Likewise.
9088         * plugin.h: Likewise.
9089         * powerpc.cc: Likewise.
9090         * reloc.cc: Likewise.
9091         * script-c.h: Likewise.
9092         * script-sections.cc: Likewise.
9093         * script.cc: Likewise.
9094         * stringpool.cc: Likewise.
9095         * symtab.cc: Likewise.
9096         * symtab.h: Likewise.
9097         * target.cc: Likewise.
9098         * timer.cc: Likewise.
9099         * timer.h: Likewise.
9100         * version.cc: Likewise.
9101         * x86_64.cc: Likewise.
9102
9103 2010-08-24  Nick Clifton  <nickc@redhat.com>
9104
9105         PR 11899
9106         * layout.cc (segment_precedes): Sort segments by their physical
9107         addresses, if they have been set.
9108
9109 2010-08-23  Cary Coutant  <ccoutant@google.com>
9110
9111         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
9112         symbols data.
9113         (Lib_group::include_member): Unlock object after deleting its
9114         symbols data.
9115         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
9116         the bug fixed here.
9117
9118 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
9119             Cary Coutant  <ccoutant@google.com>
9120
9121         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
9122         constructor, and set_blocker.
9123         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
9124         readsyms_blocker_.
9125         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
9126         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
9127         * testsuite/Makefile.am (start_lib_test): New test case.
9128         * testsuite/Makefile.in: Regenerate.
9129         * testsuite/start_lib_test_main.c: New file.
9130         * testsuite/start_lib_test_1.c: New file.
9131         * testsuite/start_lib_test_2.c: New file.
9132         * testsuite/start_lib_test_3.c: New file.
9133
9134 2010-08-19  Ian Lance Taylor  <iant@google.com>
9135
9136         * Makefile.in: Rebuild with automake 1.11.1.
9137         * aclocal.m4: Likewise.
9138         * testsuite/Makefile.in: Likewise.
9139
9140 2010-08-19  Ian Lance Taylor  <iant@google.com>
9141
9142         PR 10893
9143         * i386.cc (class Output_data_plt_i386): Update declarations.
9144         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
9145         local_ifuncs_ fields.
9146         (Target_i386::do_plt_section_for_global): New function.
9147         (Target_i386::do_plt_section_for_local): New function.
9148         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
9149         parameter; change all callers.  Initialize global_ifuncs_ and
9150         local_ifuncs_.  If doing a static link define __rel_iplt_start and
9151         __rel_iplt_end.
9152         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
9153         (Output_data_plt_i386::add_local_ifunc_entry): New function.
9154         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
9155         symbols.
9156         (Target_i386::make_plt_section): New function, broken out of
9157         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
9158         (Target_i386::make_plt_entry): Call make_plt_section.
9159         (Target_i386::make_local_ifunc_plt_entry): New function.
9160         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
9161         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
9162         R_386_IRELATIVE to switch.
9163         (Target_i386::Scan::global): Likewise.
9164         (Target_i386::Relocate::relocate): Likewise.
9165         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
9166         switch.
9167         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
9168         (Target_x86_64::do_plt_section_for_global): New function.
9169         (Target_x86_64::do_plt_section_for_local): New function.
9170         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
9171         parameter; change all callers.  If doing a static link define
9172         __rela_iplt_start and __rela_iplt_end.
9173         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
9174         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
9175         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
9176         to point to .plt.
9177         (Target_x86_64::make_local_ifunc_plt_entry): New function.
9178         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
9179         switch.
9180         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
9181         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
9182         R_X86_64_IRELATIVE to switch.
9183         (Target_x86_64::Scan::global): Likewise.
9184         (Target_x86_64::Relocate::relocate): Likewise.
9185         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
9186         switch.
9187         * target.h (class Target): Add plt_section_for_global and
9188         plt_section_for_local functions.  Add do_plt_section_for_global
9189         and do_plt_section_for_local virtual functions.
9190         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
9191         clarifying comments.
9192         (Symbol::use_plt_offset): Handle IFUNC symbol.
9193         * object.cc (Sized_relobj::Sized_relobj): Initialize
9194         local_plt_offsets_.
9195         (Sized_relobj::local_has_plt_offset): New function.
9196         (Sized_relobj::local_plt_offset): New function.
9197         (Sized_relobj::set_local_plt_offset): New function.
9198         (Sized_relobj::do_count): Handle IFUNC symbol.
9199         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
9200         a bit away from input_shndx_ field.  Add set_is_func_symbol and
9201         is_ifunc_symbol functions.
9202         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
9203         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
9204         local_plt_offsets_ field.
9205         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
9206         * output.h (class Output_section_data): Add non-const
9207         output_section function.
9208         (class Output_data_got): Update declarations.
9209         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
9210         Add use_plt_offset parameter to global and local constructors.
9211         Change all callers.  Change local_sym_index_ field to 31 bits.
9212         Change GSYM_CODE and CONSTANT_CODE accordingly.
9213         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
9214         doing a static link don't set sh_link field.
9215         (Output_data_got::Got_entry::write): Use PLT offset if
9216         appropriate.
9217         (Output_data_got::add_global_plt): New function.
9218         (Output_data_got::add_local_plt): New function.
9219         * target-reloc.h (relocate_section): Handle IFUNC symbol.
9220         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
9221         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
9222         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
9223         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
9224         IFUNC conditional.
9225         * testsuite/ifunc-sel.h: New file.
9226         * testsuite/ifuncmain1.c: New file.
9227         * testsuite/ifuncmain1vis.c: New file.
9228         * testsuite/ifuncmod1.c: New file.
9229         * testsuite/ifuncdep2.c: New file.
9230         * testsuite/ifuncmain2.c: New file.
9231         * testsuite/ifuncmain3.c: New file.
9232         * testsuite/ifuncmod3.c: New file.
9233         * testsuite/ifuncmain4.c: New file.
9234         * testsuite/ifuncmain5.c: New file.
9235         * testsuite/ifuncmod5.c: New file.
9236         * testsuite/ifuncmain6pie.c: New file.
9237         * testsuite/ifuncmod6.c: New file.
9238         * testsuite/ifuncmain7.c: New file.
9239         * configure, testsuite/Makefile.in: Rebuild.
9240
9241 2010-08-18  Ian Lance Taylor  <iant@google.com>
9242
9243         * incremental.cc
9244         (Output_section_incremental_inputs::write_input_files): Add cast
9245         to avoid signed/unsigned comparison warning.
9246         (Output_section_incremental_inputs::write_info_blocks): Likewise.
9247
9248 2010-08-12  Cary Coutant  <ccoutant@google.com>
9249
9250         * common.cc (Sort_commons::operator()): Remove unnecessary code.
9251
9252 2010-08-13  Ian Lance Taylor  <iant@google.com>
9253
9254         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
9255
9256 2010-08-12  Cary Coutant  <ccoutant@google.com>
9257             Doug Kwan  <dougkwan@google.com>
9258
9259         * resolve.cc (Symbol_table::should_override): When a weak dynamic
9260         defintion overrides non-weak undef, remember that the original undef
9261         is not weak.
9262         * symtab.cc (Symbol_table::sized_write_global): For undef without
9263         an original weak binding, set binding to global in output.
9264         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
9265         * testsuite/Makefile.in: Regenerate.
9266         * testsuite/strong_ref_weak_def.sh: New file.
9267         * testsuite/strong_ref_weak_def_1.c: Ditto.
9268         * testsuite/strong_ref_weak_def_2.c: Ditto.
9269
9270 2010-08-12  Cary Coutant  <ccoutant@google.com>
9271
9272         * testsuite/incremental_test.sh: Rewrite.
9273         * testsuite/incremental_test_1.c: Rewrite.
9274         * testsuite/incremental_test_2.c: Rewrite.
9275
9276 2010-08-12  Cary Coutant  <ccoutant@google.com>
9277
9278         * arm.cc (Target_arm::got_size): Add const.
9279         (Target_arm::got_entry_count): New function.
9280         (Target_arm::plt_entry_count): New function.
9281         (Target_arm::first_plt_entry_offset): New function.
9282         (Target_arm::plt_entry_size): New function.
9283         (Output_data_plt_arm::entry_count): New function.
9284         (Output_data_plt_arm::first_plt_entry_offset): New function.
9285         (Output_data_plt_arm::get_plt_entry_size): New function.
9286         * i386.cc (Target_i386::got_size): Add const.
9287         (Target_i386::got_entry_count): New function.
9288         (Target_i386::plt_entry_count): New function.
9289         (Target_i386::first_plt_entry_offset): New function.
9290         (Target_i386::plt_entry_size): New function.
9291         (Output_data_plt_i386::entry_count): New function.
9292         (Output_data_plt_i386::first_plt_entry_offset): New function.
9293         (Output_data_plt_i386::get_plt_entry_size): New function.
9294         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
9295         find_incremental_inputs_sections.  Dump incremental_got_plt section.
9296         * incremental.cc: Include target.h.
9297         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
9298         parameter.  Adjust all callers.  Find incremental_got_plt section.
9299         (Incremental_inputs::create_data_sections): Create incremental_got_plt
9300         section.
9301         (Output_section_incremental_inputs::set_final_data_size): Calculate
9302         size of incremental_got_plt section.
9303         (Output_section_incremental_inputs::do_write): Write the
9304         incremental_got_plt section.
9305         (Got_plt_view_info): New struct.
9306         (Local_got_offset_visitor): New class.
9307         (Global_got_offset_visitor): New class.
9308         (Global_symbol_visitor_got_plt): New class.
9309         (Output_section_incremental_inputs::write_got_plt): New function.
9310         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
9311         Add parameter.  Adjust all callers.
9312         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9313         (Incremental_inputs::got_plt_section): New function.
9314         (Incremental_inputs::got_plt_section_): New data member.
9315         (Incremental_got_plt_reader): New class.
9316         * layout.cc (Layout::create_incremental_info_sections): Add the
9317         incremental_got_plt section.
9318         * object.h (Got_offset_list::get_list): New function.
9319         (Got offset_list::for_all_got_offsets): New function.
9320         (Sized_relobj::local_got_offset_list): New function.
9321         * powerpc.cc (Target_powerpc::got_size): Add const.
9322         (Target_powerpc::got_entry_count): New function.
9323         (Target_powerpc::plt_entry_count): New function.
9324         (Target_powerpc::first_plt_entry_offset): New function.
9325         (Target_powerpc::plt_entry_size): New function.
9326         (Output_data_plt_powerpc::entry_count): New function.
9327         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
9328         (Output_data_plt_powerpc::get_plt_entry_size): New function.
9329         * sparc.cc (Target_sparc::got_size): Add const.
9330         (Target_sparc::got_entry_count): New function.
9331         (Target_sparc::plt_entry_count): New function.
9332         (Target_sparc::first_plt_entry_offset): New function.
9333         (Target_sparc::plt_entry_size): New function.
9334         (Output_data_plt_sparc::entry_count): New function.
9335         (Output_data_plt_sparc::first_plt_entry_offset): New function.
9336         (Output_data_plt_sparc::get_plt_entry_size): New function.
9337         * symtab.h (Symbol::got_offset_list): New function.
9338         (Symbol_table::for_all_symbols): New function.
9339         * target.h (Sized_target::got_entry_count): New function.
9340         (Sized_target::plt_entry_count): New function.
9341         (Sized_target::plt_entry_size): New function.
9342         * x86_64.cc (Target_x86_64::got_size): Add const.
9343         (Target_x86_64::got_entry_count): New function.
9344         (Target_x86_64::plt_entry_count): New function.
9345         (Target_x86_64::first_plt_entry_offset): New function.
9346         (Target_x86_64::plt_entry_size): New function.
9347         (Output_data_plt_x86_64::entry_count): New function.
9348         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
9349         (Output_data_plt_x86_64::get_plt_entry_size): New function.
9350
9351 2010-08-12  Cary Coutant  <ccoutant@google.com>
9352
9353         * archive.cc: Include incremental.h.
9354         (Archive::Archive): Initialize incremental_info_.
9355         (Archive::include_member): Record archive members in incremental info.
9356         (Add_archive_symbols::run): Record begin and end of an archive in
9357         incremental info.
9358         (Lib_group::include_member): Record objects in incremental info.
9359         * archive.h (Incremental_archive_entry): Forward declaration.
9360         (Archive::set_incremental_info): New member function.
9361         (Archive::incremental_info): New member function.
9362         (Archive::Unused_symbol_iterator): New class.
9363         (Archive::unused_symbols_begin): New member function.
9364         (Archive::unused_symbols_end): New member function.
9365         (Archive::incremental_info_): New data member.
9366         * incremental-dump.cc (find_input_containing_global): New function.
9367         (dump_incremental_inputs): Dump new incremental info sections.
9368         * incremental.cc: Include symtab.h.
9369         (Output_section_incremental_inputs): New class.
9370         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
9371         new incremental info sections.
9372         (Sized_incremental_binary::do_check_inputs): Likewise.
9373         (Incremental_inputs::report_archive): Remove.
9374         (Incremental_inputs::report_archive_begin): New function.
9375         (Incremental_inputs::report_archive_end): New function.
9376         (Incremental_inputs::report_object): New function.
9377         (Incremental_inputs::finalize_inputs): Remove.
9378         (Incremental_inputs::report_input_section): New function.
9379         (Incremental_inputs::report_script): Rewrite.
9380         (Incremental_inputs::finalize): Do nothing but finalize string table.
9381         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9382         (Incremental_inputs::sized_create_inputs_section_data): Remove.
9383         (Incremental_inputs::create_data_sections): New function.
9384         (Incremental_inputs::relocs_entsize): New function.
9385         (Output_section_incremental_inputs::set_final_data_size): New function.
9386         (Output_section_incremental_inputs::do_write): New function.
9387         (Output_section_incremental_inputs::write_header): New function.
9388         (Output_section_incremental_inputs::write_input_files): New function.
9389         (Output_section_incremental_inputs::write_info_blocks): New function.
9390         (Output_section_incremental_inputs::write_symtab): New function.
9391         * incremental.h (Incremental_script_entry): Forward declaration.
9392         (Incremental_object_entry): Forward declaration.
9393         (Incremental_archive_entry): Forward declaration.
9394         (Incremental_inputs): Forward declaration.
9395         (Incremental_inputs_header_data): Remove.
9396         (Incremental_inputs_header): Remove.
9397         (Incremental_inputs_header_write): Remove.
9398         (Incremental_inputs_entry_data): Remove.
9399         (Incremental_inputs_entry): Remove.
9400         (Incremental_inputs_entry_write): Remove.
9401         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
9402         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
9403         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9404         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
9405         Likewise.
9406         (Incremental_input_entry): New class.
9407         (Incremental_script_entry): New class.
9408         (Incremental_object_entry): New class.
9409         (Incremental_archive_entry): New class.
9410         (Incremental_inputs::Incremental_inputs): Initialize new data members.
9411         (Incremental_inputs::report_inputs): Remove.
9412         (Incremental_inputs::report_archive): Remove.
9413         (Incremental_inputs::report_archive_begin): New function.
9414         (Incremental_inputs::report_archive_end): New function.
9415         (Incremental_inputs::report_object): Change prototype.
9416         (Incremental_inputs::report_input_section): New function.
9417         (Incremental_inputs::report_script): Change prototype.
9418         (Incremental_inputs::get_reloc_count): New function.
9419         (Incremental_inputs::set_reloc_count): New function.
9420         (Incremental_inputs::create_data_sections): New function.
9421         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9422         (Incremental_inputs::inputs_section): New function.
9423         (Incremental_inputs::symtab_section): New function.
9424         (Incremental_inputs::relocs_section): New function.
9425         (Incremental_inputs::get_stringpool): Add const.
9426         (Incremental_inputs::command_line): Add const.
9427         (Incremental_inputs::inputs): Remove.
9428         (Incremental_inputs::command_line_key): New function.
9429         (Incremental_inputs::input_file_count): New function.
9430         (Incremental_inputs::input_files): New function.
9431         (Incremental_inputs::relocs_entsize): New function.
9432         (Incremental_inputs::sized_create_inputs_section_data): Remove.
9433         (Incremental_inputs::finalize_inputs): Remove.
9434         (Incremental_inputs::Input_info): Remove.
9435         (Incremental_inputs::lock_): Remove.
9436         (Incremental_inputs::inputs_): Change type.
9437         (Incremental_inputs::inputs_map_): Remove.
9438         (Incremental_inputs::current_object_entry_): New data member.
9439         (Incremental_inputs::inputs_section_): New data member.
9440         (Incremental_inputs::symtab_section_): New data member.
9441         (Incremental_inputs::relocs_section_): New data member.
9442         (Incremental_inputs::reloc_count_): New data member.
9443         (Incremental_inputs_reader): New class.
9444         (Incremental_symtab_reader): New class.
9445         (Incremental_relocs_reader): New class.
9446         * layout.cc (Layout::finalize): Move finalization of incremental info
9447         and creation of incremental info sections to follow finalization of
9448         symbol table.  Set offsets for postprocessing sections.
9449         (Layout::create_incremental_info_sections): Call
9450         Incremental_inputs::create_data_sections.  Add incremental symtab
9451         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
9452         sections to layout after input sections.
9453         * layout.h (struct Timespec): Forward declaration.
9454         (Layout::incremental_inputs): Add const.
9455         (Layout::create_incremental_info_sections): Add parameter.
9456         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
9457         * object.cc: Include incremental.h.
9458         (Relobj::finalize_incremental_relocs): New function.
9459         (Sized_relobj::do_layout): Record input sections in incremental info.
9460         * object.h (Object::output_section): New function.
9461         (Object::output_section_offset): Moved from Relobj.
9462         (Object::get_incremental_reloc_base): New function.
9463         (Object::get_incremental_reloc_count): New function.
9464         (Object::do_output_section): New function.
9465         (Object::do_output_section_offset): Moved from Relobj.
9466         (Object::do_get_incremental_reloc_base): New function.
9467         (Object::do_get_incremental_reloc_count): New function.
9468         (Object::Object): Initialize new data members.
9469         (Relobj::output_section): Renamed do_output_section and moved to
9470         protected.
9471         (Relobj::output_section_offset): Moved to Object.
9472         (Relobj::do_get_incremental_reloc_base): New function.
9473         (Relobj::do_get_incremental_reloc_count): New function.
9474         (Relobj::allocate_incremental_reloc_counts): New function.
9475         (Relobj::count_incremental_reloc): New function.
9476         (Relobj::finalize_incremental_relocs): New function.
9477         (Relobj::next_incremental_reloc_index): New function.
9478         (Relobj::reloc_counts_): New data member.
9479         (Relobj::reloc_bases_): New data member.
9480         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
9481         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
9482         (Sized_relobj::incremental_relocs_scan): New function.
9483         (Sized_relobj::incremental_relocs_scan_reltype): New function.
9484         (Sized_relobj::incremental_relocs_write): New function.
9485         (Sized_relobj::incremental_relocs_write_reltype): New function.
9486         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
9487         incremental link.
9488         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
9489         archives and object files elsewhere.
9490         (Add_symbols::run): Report object files here.
9491         (Finish_group::run): Report end of archive at end of group.
9492         * reloc.cc: Include layout.h, incremental.h.
9493         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
9494         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
9495         (Sized_relobj::incremental_relocs_scan): New function.
9496         (Sized_relobj::incremental_relocs_scan_reltype): New function.
9497         (Sized_relobj::do_relocate_sections): Write incremental relocations.
9498         (Sized_relobj::incremental_relocs_write): New function.
9499         (Sized_relobj::incremental_relocs_write_reltype): New function.
9500         * script.cc (read_input_script): Rewrite test for incremental link.
9501         Change call to Incremental_inputs::report_script.
9502         * symtab.h (Symbol_table::first_global_index): New function.
9503         (Symbol_table::output_count): New function.
9504
9505 2010-08-12  Doug Kwan  <dougkwan@google.com>
9506
9507         * arm.cc (Target_arm::merge_object_attributes): Check command line
9508         options --no-wchar-size-warning and --no-enum-size-warning.
9509         * options.h (General_options): Add ld-compatible options
9510         --no-enum-size-warning and --no-wchar-size-warning.
9511
9512 2010-08-04  Ian Lance Taylor  <iant@google.com>
9513
9514         * x86_64.cc (Target_x86_64::Scan::local): Use
9515         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
9516         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
9517         (Target_x86_64::Scan::global): Likewise.
9518         (Target_x86_64::Relocate::relocate): Likewise.
9519         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
9520         Likewise.
9521
9522 2010-08-03  Cary Coutant  <ccoutant@google.com>
9523
9524         * merge.cc (Output_merge_string::do_add_input_section): Count strings
9525         to reserve space in merged_strings vector. Keep total input size
9526         for stats.
9527         (Output_merge_string::do_print_merge_stats): Print total input size.
9528         * merge.h (Output_merge_string): Add input_size_ field.
9529         * stringpool.cc (Stringpool_template::string_length): Move
9530         implementations out of Stringpool_template class and place in
9531         stringpool.h.
9532         * stringpool.h (string_length): Move out of Stringpool_template.
9533
9534 2010-08-03  Ian Lance Taylor  <iant@google.com>
9535
9536         PR 11712
9537         * layout.cc (relaxation_loop_body): If address of load segment is
9538         set, adjust address to include headers if possible.
9539
9540 2010-08-03  Ian Lance Taylor  <iant@google.com>
9541
9542         * version.cc (version_string): Bump to 1.10.
9543
9544 2010-08-03  Ian Lance Taylor  <iant@google.com>
9545
9546         PR 11805
9547         * layout.h (enum Output_section_order): Define.
9548         (class Layout): Update declarations.
9549         * layout.cc (Layout::get_output_section): Add order parameter.
9550         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
9551         is_first_non_relro parameters.  Change all callers.
9552         (Layout::choose_output_section): Likewise.
9553         (Layout::add_output_section_data): Likewise.
9554         (Layout::make_output_section): Likewise.  Set order.
9555         (Layout::default_section_order): New function.
9556         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
9557         * output.cc (Output_section::Output_section): Initialize order_.
9558         Don't initialize deleted fields.
9559         (Output_segment::Output_segment): Don't initialize deleted
9560         fields.
9561         (Output_segment::add_output_section_to_load): New function
9562         replacing add_output_section.  Change all callers to call this or
9563         add_output_section_to_nonload.
9564         (Output_segment::add_output_section_to_nonload): New function.
9565         (Output_segment::remove_output_section): Rewrite.
9566         (Output_segment::add_initial_output_data): Likewise.
9567         (Output_segment::has_any_data_sections): Likewise.
9568         (Output_segment::is_first_section_relro): Likewise.
9569         (Output_segment::maximum_alignment): Likewise.
9570         (Output_segment::has_dynamic_reloc): New function replacing
9571         dynamic_reloc_count.  Change all callers.
9572         (Output_segment::has_dynamic_reloc_list): New function replacing
9573         dynamic_reloc_count_list.  Change all callers.
9574         (Output_segment::set_section_addresses): Rewrite.
9575         (Output_segment::set_offset): Rewrite.
9576         (Output_segment::find_first_and_last_list): Remove.
9577         (Output_segment::set_tls_offsets): Rewrite.
9578         (Output_segment::first_section_load_address): Likewise.
9579         (Output_segment::output_section_count): Likewise.
9580         (Output_segment::section_with_lowest_load_address): Likewise.
9581         (Output_segment::write_section_headers): Likewise.
9582         (Output_segment::print_sections_to_map): Likewise.
9583         * output.h (class Output_data): Remove dynamic_reloc_count_
9584         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
9585         (Output_data::add_dynamic_reloc): Rewrite.
9586         (Output_data::has_dynamic_reloc): New function.
9587         (Output_data::dynamic_reloc_count): Remove.
9588         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
9589         is_last_relro_, is_first_non_relro_, is_interp_,
9590         is_dynamic_linker_section_ fields.  Add order and set_order
9591         functions.  Remove is_relro_local, set_is_relro_local,
9592         is_last_relro, set_is_last_relro, is_first_non_relro,
9593         set_is_first_non_relro functions, is_interp, set_is_interp,
9594         is_dynamic_linker_section, and set_is_dynamic_linker_section
9595         functions.
9596         (class Output_segment): Change Output_data_list from std::list to
9597         std:;vector.  Add output_lists_ field.  Remove output_data_ and
9598         output_bss_ fields.  Update declarations.
9599
9600 2010-08-02  Ian Lance Taylor  <iant@google.com>
9601
9602         * arm.cc (Target_arm::gc_process_relocs): Use typename.
9603         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
9604         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
9605
9606 2010-08-02  Ian Lance Taylor  <iant@google.com>
9607
9608         PR 11855
9609         * script.cc (Script_options::Script_options): Initialize
9610         symbol_definitions_ and symbol_references_.
9611         (Script_options::add_symbol_assignment): Update
9612         symbol_definitions_ and symbol_references_.
9613         (Script_options::add_symbol_reference): New function.
9614         (script_symbol): New function.
9615         * script.h (class Script_options): Add symbol_definitions_ and
9616         symbol_references_ fields.
9617         (Script_options::referenced_const_iterator): New type.
9618         (Script_options::referenced_begin): New function.
9619         (Script_options::referenced_end): New function.
9620         (Script_options::is_referenced): New function.
9621         (Script_options::any_unreferenced): New function.
9622         * script-c.h (script_symbol): Declare.
9623         * yyscript.y (exp): Call script_symbol.
9624         * symtab.cc: Include "script.h".
9625         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
9626         Change all callers.  Check symbols referenced by scripts.
9627         (Symbol_table::add_undefined_symbols_from_command_line): Add
9628         layout parameter.  Change all callers.
9629         (Symbol_table::do_add_undefined_symbols_from_command_line):
9630         Likewise.  Break out loop body.  Check symbols referenced by
9631         scripts.
9632         (Symbol_table::add_undefined_symbol_from_command_line): New
9633         function broken out of
9634         do_add_undefined_symbols_from_command_line.
9635         * symtab.h (class Symbol_table): Update declarations.
9636         * archive.cc: Include "layout.h".
9637         (Archive::should_include_member): Add layout parameter.  Change
9638         all callers.  Check for symbol mentioned in expression.
9639         * archive.h (class Archive): Update declaration.
9640         * object.cc (Sized_relobj::do_should_include_member): Add layout
9641         parameter.
9642         * object.h (Object::should_include_member): Add layout parameter.
9643         Change all callers.
9644         (Object::do_should_include_member): Add layout parameter.
9645         (class Sized_relobj): Update declaration.
9646         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
9647         parameter.
9648         * dynobj.h (class Sized_dynobj): Update declaration.
9649         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
9650         layout parameter.
9651         * plugin.h (class Sized_pluginobj): Update declaration.
9652
9653 2010-08-02  Ian Lance Taylor  <iant@google.com>
9654
9655         PR 11866
9656         * output.cc (Output_segment::set_offset): Search for the first and
9657         last sections rather than assuming that the list is in order.
9658         (Output_segment::find_first_and_last_list): New function.
9659         * output.h (class Output_segment): Update declarations.
9660         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
9661         (relro_strip_test_SOURCES): New variable.
9662         (relro_strip_test_DEPENDENCIES): New variable.
9663         (relro_strip_test_LDFLAGS): New variable.
9664         (relro_strip_test_LDADD): New variable.
9665         (relro_strip_test.so): New target.
9666
9667 2010-08-02  Ian Lance Taylor  <iant@google.com>
9668
9669         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
9670         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
9671         (Target_i386::got_tlsdesc_section): New function.
9672         (Target_i386::got_section): Create space for GOT entries for
9673         TLSDESC relocations.
9674         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
9675         R_386_TLS_GOTDESC.
9676         (Target_i386::Scan::global): Likewise.
9677         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
9678         using TLSDESC GOT.
9679         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
9680         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
9681         (Target_x86_64::got_tlsdesc_section): New function.
9682         (Target_x86_64::got_section): Create space for GOT entries for
9683         TLSDESC relocations.
9684         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
9685         R_386_TLS_GOTDESC.
9686         (Target_x86_64::Scan::global): Likewise.
9687         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
9688         using TLSDESC GOT.
9689
9690 2010-08-02  Ian Lance Taylor  <iant@google.com>
9691
9692         * testsuite/final_layout.sh: Use dc to convert from hex to
9693         decimal.
9694
9695 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
9696
9697         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
9698         paramter to the call to gold::gc_process_relocs.
9699         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
9700         paramter to the call to gold::gc_process_relocs.
9701         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
9702         parameter to the call to gold::gc_process_relocs.
9703         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
9704         template parameter to the call to gold::gc_process_relocs.
9705         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
9706         paramter to the call to gold::gc_process_relocs.
9707         * gc.h (get_embedded_addend_size): New function.
9708         (gc_process_relocs): Save the size of the reloc for use by ICF.
9709         * icf.cc (get_section_contents): Get the addend from the text section
9710         for SHT_REL relocation sections.
9711         * icf.h (Icf::Reloc_addend_size_info): New typedef.
9712         (Icf::Reloc_info): Add new member reloc_addend_size_info.
9713         * int_encoding.h (read_from_pointer): New overloaded function.
9714         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
9715         * testsuite/icf_sht_rel_addend_test.sh: New file.
9716         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
9717         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
9718
9719 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9720
9721         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
9722         * Makefile.in: Regenerate.
9723         * testsuite/Makefile.in: Regenerate.
9724
9725 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
9726
9727         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
9728         * gold/testsuite/debug_msg.cc: Likewise.
9729         * gold/testsuite/odr_violation1.cc
9730         * gold/testsuite/odr_violation2.cc
9731
9732 2010-07-21  Cary Coutant  <ccoutant@google.com>
9733
9734         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
9735         string, and length fields.
9736         (Output_merge_string::Merged_strings_list): New type.
9737         (Output_merge_string::Merged_strings_lists): New typedef.
9738         (Output_merge_string): Replace merged_strings_ with
9739         merged_strings_lists_.
9740         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
9741         Merged_strings_list per input object and section.  Don't store pointer
9742         to the string.  Don't store length with each merged string entry.
9743         (Output_merge_string::finalize_merged_data): Loop over list of merged
9744         strings lists.  Recompute length of each merged string.
9745
9746 2010-07-15  Cary Coutant  <ccoutant@google.com>
9747
9748         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
9749         here.
9750
9751 2010-07-14  Ian Lance Taylor  <iant@google.com>
9752
9753         * descriptors.cc (Descriptors::open): Report correct name in error
9754         message.
9755
9756 2010-07-13  Doug Kwan  <dougkwan@google.com>
9757
9758         * arm.cc (Arm_input_section::Arm_input_section): For a
9759         SHT_ARM_EXIDX section, always keeps the input sections.
9760         (Arm_input_section::set_exidx_section_link): New method.
9761         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
9762         has_errors_ to false.
9763         (Arm_exidx_input_section::has_errors,
9764         Arm_exidx_input_section::set_has_errors): New methods.
9765         (Arm_exidx_input_section::has_errors_): New data member.
9766         (Arm_relobj::get_exidx_shndx_list): New method.
9767         (Arm_output_section::append_text_sections_to_list): Do not skip
9768         section without SHF_EXECINSTR.
9769         (Arm_output_section::fix_exidx_coverage): Skip input sections with
9770         errors.
9771         (Arm_relobj::make_exidx_input_section): Add new parameter for text
9772         section header.  Make error messages more verbose.  Check for
9773         a non-executable section linked to an EXIDX section.
9774         (Arm_relobj::do_read_symbols): Remove error checking, which has been
9775         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
9776         check that there is no deferred EXIDX section if we exit early.
9777         Instead of not making an EXIDX section in case of an error, make one
9778         and set the has_errors flag of it.
9779         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
9780         in a relocatable link.
9781         (Target_arm::do_relax): Look for the EXIDX output section instead of
9782         assuming that it is called .ARM.exidx.
9783         (Target_arm::fix_exidx_coverage): Add a new parameter for input
9784         section list.  Do not check for SHF_EXECINSTR section flags but
9785         skip any input section with errors.
9786         * output.cc (Output_section::Output_section): Initialize
9787         always_keeps_input_sections_ to false.
9788         (Output_section::add_input_section): Check for
9789         always_keeps_input_sections_.
9790         *  output.h (Output_section::always_keeps_input_sections,
9791         Output_section::set_always_keeps_input_sections): New methods.
9792         (Output_section::always_keeps_input_sections): New data member.
9793
9794 2010-07-13  Rafael Espindola  <espindola@google.com>
9795
9796         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
9797         * fileread.h (Input_file): Add try_extra_search_path and find_file.
9798
9799 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
9800             Ian Lance Taylor  <iant@google.com>
9801
9802         * output.h (Output_section_lookup_maps::add_merge_section):
9803         Correct check of whether value was inserted.
9804         (Output_section_lookup_maps::add_merge_input_section): Likewise.
9805         (Output_section_lookup_maps::add_relaxed_input_section):
9806         Likewise.
9807         * arm.cc (Target_arm::got_section): Remove used local os.
9808         * i386.cc (Target_i386::got_section): Likewise.
9809         * x86_64.cc (Target_x86_64::got_section): Likewise.
9810         * sparc.cc (Target_sparc::got_section): Likewise.
9811         (Target_sparc::relocate): Remove unused local have_got_offset.
9812         * powerpc.cc (Target_powerpc::relocate): Likewise.
9813
9814 2010-07-13  Ian Lance Taylor  <iant@google.com>
9815
9816         * compressed_output.cc (zlib_decompress): Fix signature in
9817         !HAVE_ZLIB_H case.
9818
9819         * archive.cc (Archive::include_member): Unlock an external member
9820         of a thin archive.  Don't bother to delete an object we know is
9821         NULL.
9822
9823 2010-07-12  Cary Coutant  <ccoutant@google.com>
9824
9825         * compressed_output.cc (zlib_decompress): New function.
9826         (get_uncompressed_size): New function.
9827         (decompress_input_section): New function.
9828         * compressed_output.h (get_uncompressed_size): New function.
9829         (decompress_input_section): New function.
9830         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
9831         Handle compressed debug sections.
9832         * layout.cc (is_compressed_debug_section): New function.
9833         (Layout::output_section_name): Map compressed section names to
9834         canonical names.
9835         * layout.h (is_compressed_debug_section): New function.
9836         (is_debug_info_section): Recognize compressed debug sections.
9837         * merge.cc: Include compressed_output.h.
9838         (Output_merge_data::do_add_input_section): Handle compressed
9839         debug sections.
9840         (Output_merge_string::do_add_input_section): Handle compressed
9841         debug sections.
9842         * object.cc: Include compressed_output.h.
9843         (Sized_relobj::Sized_relobj): Initialize new data members.
9844         (build_compressed_section_map): New function.
9845         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
9846         * object.h (Object::section_is_compressed): New method.
9847         (Object::do_section_is_compressed): New method.
9848         (Sized_relobj::Compressed_section_map): New type.
9849         (Sized_relobj::do_section_is_compressed): New method.
9850         (Sized_relobj::compressed_sections_): New data member.
9851         * output.cc (Output_section::add_input_section): Handle compressed
9852         debug sections.
9853         * reloc.cc: Include compressed_output.h.
9854         (Sized_relobj::write_sections): Handle compressed debug sections.
9855
9856 2010-07-08  Cary Coutant  <ccoutant@google.com>
9857
9858         * resolve.cc (Symbol_table::resolve): Remember whether undef was
9859         weak when resolving to a dynamic def.
9860         (Symbol_table::should_override): Add adjust_dyndef flag; set it
9861         for weak undef/dynamic def cases. Adjust callers.
9862         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
9863         undef_binding_weak_.
9864         (Symbol_table::sized_write_globals): Adjust symbol binding.
9865         (Symbol_table::sized_write_symbol): Add binding parameter.
9866         * symtab.h (Symbol::set_undef_binding): New method.
9867         (Symbol::is_undef_binding_weak): New method.
9868         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
9869         (Symbol_table::should_override): Add new parameter.
9870         (Symbol_table::sized_write_symbol): Add new parameter.
9871
9872         * testsuite/weak_undef_file1.cc: Add new test case.
9873         * testsuite/weak_undef_file2.cc: Fix header comment.
9874         * testsuite/weak_undef_test.cc: Add new test case.
9875
9876 2010-06-29  Doug Kwan  <dougkwan@google.com>
9877
9878         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
9879         Initialize USE_SYMBOL_.
9880         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
9881         definition.
9882         (Arm_reloc_property::uses_symbol_): New data member declaration.
9883         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
9884         uses symbol value and symbol is undefined but not weakly undefined.
9885
9886 2010-06-28  Rafael Espindola  <espindola@google.com>
9887
9888         * plugin.cc (Plugin::load): Use dlerror.
9889
9890 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
9891
9892         * symtab.cc (detect_odr_violations): When reporting an ODR
9893         violation, report an object where the symbol is defined.
9894
9895 2010-06-25  Doug Kwan  <dougkwan@google.com>
9896
9897         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
9898         (Target_arm::section_may_have_icf_unsafe_pointers): New method
9899         definition.
9900         (Target_arm::Scan::local_reloc_may_be_function_pointer,
9901         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
9902         target hook to detect function points.
9903         (Target_arm::Scan::possible_function_pointer_reloc): New method.
9904         * icf.h (Icf::check_section_for_function_pointers): Change type of
9905         parameter SECTION_NAME to const reference to std::string.  Use
9906         target hook to determine if section may have unsafe pointers.
9907         * target.h (Target::section_may_have_icf_unsafe_pointers): New
9908         method definition.
9909
9910 2010-06-21  Rafael Espindola  <espindola@google.com>
9911
9912         * fileread.cc (Input_file::find_fie): New
9913         (Input_file::open): Use Input_file::find_fie.
9914         * fileread.h (Input_file::find_fie): New
9915         * plugin.cc (set_extra_library_path): New.
9916         (Plugin::load): Add set_extra_library_path to the transfer vector.
9917         (Plugin_manager::set_extra_library_path): New.
9918         (Plugin_manager::add_input_file): Use the extra search path if set.
9919         (set_extra_library_path(): New.
9920         * plugin.h (Plugin_manager): Add set_extra_library_path and
9921         extra_search_path_.
9922
9923 2010-06-19  Cary Coutant  <ccoutant@google.com>
9924
9925         * layout.cc (gdb_sections): Add .debug_types.
9926         (lines_only_debug_sections): Likewise.
9927
9928 2010-06-18  Rafael Espindola  <espindola@google.com>
9929
9930         * plugin.cc (add_input_file,add_input_library)
9931         (Plugin_manager::add_input_file): Make filename arguments const.
9932         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
9933         const.
9934
9935 2010-06-16  Doug Kwan  <dougkwan@google.com>
9936
9937         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
9938         .ARM.attributes section if we have not merged any input
9939         attributes sections.
9940
9941 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9942
9943         * arm.cc: Allow combining objects with no EABI version
9944         information.
9945
9946 2010-06-15  Rafael Espindola  <espindola@google.com>
9947
9948         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
9949
9950 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9951
9952         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
9953         (struct iovec): Correct !HAVE_READV definition.
9954
9955 2010-06-10  Cary Coutant  <ccoutant@google.com>
9956
9957         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
9958         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
9959         reloc sections.
9960         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
9961
9962         PR 11683
9963         * symtab.h (Symbol::is_placeholder): New member function.
9964         * target-reloc.h (relocate_section): Check for placeholder symbols.
9965
9966         * testsuite/Makefile.am (plugin_test_8): New test.
9967         (plugin_test_9): New test.
9968         * testsuite/Makefile.in: Regenerate.
9969
9970 2010-06-09  Nick Clifton  <nickc@redhat.com>
9971
9972         * yyscript.y (input_list_element): Allow strings prefixed with
9973         the '-' character.  Treat these as libraries.
9974         * script.cc (script_add_library): New function.  Adds a library
9975         specified by "-l<name>" found in an input script.
9976         * script-c.h: Add prototype for script_add_library.
9977
9978 2010-06-07  Doug Kwan  <dougkwan@google.com>
9979
9980         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
9981         Restrict stub-group size to be within long conditional branch
9982         range when working around cortex-A8 erratum.
9983
9984 2010-06-07  Damien Diederen  <dd@crosstwine.com>
9985
9986         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
9987         #ifdef typo.
9988
9989 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
9990
9991         PR gold/11658
9992         * output.cc
9993         (Output_section::Input_section_sort_entry::compare_section_ordering):
9994         Change to return non-zero correctly.
9995         (Output_section::Input_section_sort_section_order_index_compare
9996         ::operator()): Change to fix ambiguity in comparisons.
9997
9998 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
9999
10000         * gold.h (is_wildcard_string): New function.
10001         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
10002         (Layout::layout_eh_frame): Ditto.
10003         (Layout::find_section_order_index): New method.
10004         (Layout::read_layout_from_file): New method.
10005         * layout.h (Layout::find_section_order_index): New method.
10006         (Layout::read_layout_from_file): New method.
10007         (Layout::input_section_position_): New private member.
10008         (Layout::input_section_glob_): New private member.
10009         * main.cc (main): Call read_layout_from_file here.
10010         * options.h (--section-ordering-file): New option.
10011         * output.cc (Output_section::input_section_order_specified_): New
10012         member.
10013         (Output_section::Output_section): Initialize new member.
10014         (Output_section::add_input_section): Add new parameter.
10015         Keep input sections when --section-ordering-file is used.
10016         (Output_section::set_final_data_size): Sort input sections when
10017         section ordering file is specified.
10018         (Output_section::Input_section_sort_entry): Add new parameter.
10019         Check sorting type.
10020         (Output_section::Input_section_sort_entry::compare_section_ordering):
10021         New method.
10022         (Output_section::Input_section_sort_compare::operator()): Change to
10023         consider section_order_index.
10024         (Output_section::Input_section_sort_init_fini_compare::operator()):
10025         Change to consider section_order_index.
10026         (Output_section::Input_section_sort_section_order_index_compare
10027         ::operator()): New method.
10028         (Output_section::sort_attached_input_sections): Change to sort
10029         according to section order when specified.
10030         (Output_section::add_input_section<32, true>): Add new parameter.
10031         (Output_section::add_input_section<64, true>): Add new parameter.
10032         (Output_section::add_input_section<32, false>): Add new parameter.
10033         (Output_section::add_input_section<64, false>): Add new parameter.
10034         * output.h (Output_section::add_input_section): Add new parameter.
10035         (Output_section::input_section_order_specified): New
10036         method.
10037         (Output_section::set_input_section_order_specified): New method.
10038         (Input_section::Input_section): Initialize section_order_index_.
10039         (Input_section::section_order_index): New method.
10040         (Input_section::set_section_order_index): New method.
10041         (Input_section::section_order_index_): New member.
10042         (Input_section::Input_section_sort_section_order_index_compare): New
10043         struct.
10044         (Output_section::input_section_order_specified_): New member.
10045         * script-sections.cc (is_wildcard_string): Delete and move modified
10046         method to gold.h.
10047         (Output_section_element_input::Output_section_element_input): Modify
10048         call to is_wildcard_string.
10049         (Output_section_element_input::Input_section_pattern
10050         ::Input_section_pattern): Ditto.
10051         (Output_section_element_input::Output_section_element_input): Ditto.
10052         * testsuite/Makefile.am (final_layout): New test case.
10053         * testsuite/Makefile.in: Regenerate.
10054         * testsuite/final_layout.cc: New file.
10055         * testsuite/final_layout.sh: New file.
10056
10057 2010-06-01  Rafael Espindola  <espindola@google.com>
10058
10059         * plugin.cc (Plugin::load): Pass the output name to the plugin.
10060
10061 2010-06-01  Rafael Espindola  <espindola@google.com>
10062
10063         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
10064         visibility of symbols.
10065
10066 2010-05-27  Doug Kwan  <dougkwan@google.com>
10067
10068         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
10069         from start of output section instead of address for a local symbol
10070         in a merged or relaxed section when doing a relocatable link.
10071
10072 2010-05-26  Rafael Espindola  <espindola@google.com>
10073
10074         PR 11604
10075         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
10076         adding sections the garbage collector removed.
10077         * gold/testsuite/Makefile.am: Add test.
10078         * gold/testsuite/Makefile.in: Regenerate.
10079         * gold/testsuite/plugin_test_7.sh: New.
10080         * gold/testsuite/plugin_test_7_1.c: New.
10081         * gold/testsuite/plugin_test_7_2.c: New.
10082
10083 2010-05-26  Rafael Espindola  <espindola@google.com>
10084
10085         * script-sections.cc (Output_section_definition::set_section_addresses):
10086         Check for --section-start.
10087
10088 2010-05-26  Doug Kwan  <dougkwan@google.com>
10089
10090         * arm.cc (Arm_scan_relocatable_relocs): New class.
10091         (Target_arm::relocate_special_relocatable): New method.
10092         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
10093         (Arm_relocate_functions::thumb_branch_common): Same.
10094         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
10095         instead of Default_scan_relocatable_relocs.
10096         * target-reloc.h (relocate_for_relocatable): Let target handle
10097         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
10098         * target.h (Sized_target::relocate_special_relocatable): New method.
10099
10100 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10101
10102         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
10103
10104 2010-05-23  Doug Kwan  <dougkwan@google.com>
10105
10106         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
10107         instead of a cast.
10108         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
10109         with a direct branch, not a conditional branch, to a stub.
10110         * merge.cc (Output_merge_base::record_input_section): New method
10111         defintion.
10112         (Output_merge_data::do_add_input_section): Record input section if
10113         keeps-input-sections flag is set.
10114         (Output_merge_string::do_add_input_section): Ditto.
10115         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
10116         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
10117         INPUT_SECTIONS_.
10118         (Output_merge_base::keeps_input_sections,
10119         Output_merge_base::set_keeps_input_sections,
10120         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
10121         method definitions.
10122         (Output_merge_base::Input_sections): New type declaration.
10123         (Output_merge_base::input_sections_begin,
10124         Output_merge_base::input_sections_end,
10125         Output_merge_base::do_set_keeps_input_sections): New method definitions.
10126         (Output_merge_base::bool keeps_input_sections_,
10127         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
10128         Output_merge_base::input_sections_): New data members.
10129         (Output_merge_data::do_set_keeps_input_sections): New method
10130         defintion.
10131         (Output_merge_string::do_set_keeps_input_sections): Ditto.
10132         * output.cc (Output_section::Input_section::relobj): Move method
10133         defintion from class declaration to here and handle merge sections.
10134         (Output_section::Input_section::shndx): Ditto.
10135         (Output_section::Output_section): Remove initializations of removed
10136         data members and initialize new data member LOOKUP_MAPS_.
10137         (Output_section::add_input_section): Set keeps-input-sections flag
10138         for a newly created merge output section as appropriate.  Adjust code
10139         to use Output_section_lookup_maps class.
10140         (Output_section::add_relaxed_input_section): Adjst code for lookup
10141         maps code refactoring.
10142         (Output_section::add_merge_input_section): Add a new parameter
10143         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
10144         class.  If adding input section to a newly created merge output
10145         section fails, remove the new merge section.
10146         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
10147         Adjust code for use of the Output_section_lookup_maps class.
10148         (Output_section::find_merge_section): Ditto.
10149         (Output_section::build_lookup_maps): New method defintion.
10150         (Output_section::find_relaxed_input_section): Adjust code to use
10151         Output_section_lookup_maps class.
10152         (Output_section::get_input_sections): Export merge sections.  Adjust
10153         code to use Output_section_lookup_maps class.
10154         (Output_section:::add_script_input_section): Adjust code to use
10155         Output_section_lookup_maps class.  Update lookup maps for merge
10156         sections also.
10157         (Output_section::discard_states): Use Output_section_lookup_maps.
10158         (Output_section::restore_states): Same.
10159         * output.h (Merge_section_properties): Move class defintion out of
10160         Output_section.
10161         (Output_section_lookup_maps): New class.
10162         (Output_section::Input_section::is_merge_section): New method
10163         defintion.
10164         (Output_section::Input_section::relobj): Move defintion out of class
10165         defintion.  Declare method only.
10166         (Output_section::Input_section::shndx): Ditto.
10167         (Output_section::Input_section::output_merge_base): New method defintion.
10168         (Output_section::Input_section::u2_.pomb): New union field.
10169         (Output_section::Merge_section_by_properties_map,
10170         Output_section::Output_section_data_by_input_section_map,
10171         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
10172         Remove types.
10173         (Output_section::add_merge_input_section): Add new parameter
10174         KEEPS_INPUT_SECTIONS.
10175         (Output_section::build_lookup_maps): New method declaration.
10176         (Output_section::merge_section_map_,
10177         Output_section::merge_section_by_properties_map_,
10178         Output_section::relaxed_input_section_map_,
10179         Output_section::is_relaxed_input_section_map_valid_): Remove data
10180         members.
10181         (Output_section::lookup_maps_): New data member.
10182
10183 2010-05-21  Doug Kwan  <dougkwan@google.com>
10184
10185         PR gold/11619
10186         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
10187         avoid a compilation error.
10188
10189 2010-05-19  Rafael Espindola  <espindola@google.com>
10190
10191         * script-sections.cc (Output_section_definition::allocate_to_segment):
10192         Update the phdrs_list even when the output section is NULL.
10193         * testsuite/Makefile.am: Add test.
10194         * testsuite/Makefile.in: Regenerate.
10195         * testsuite/script_test_9.cc: New.
10196         * testsuite/script_test_9.sh: New.
10197         * testsuite/script_test_9.t: New.
10198
10199 2010-05-19  Doug Kwan  <dougkwan@google.com>
10200
10201         * arm.cc (Arm_input_section::original_size): New method.
10202         (Arm_input_section::do_addralign): Add a cast.
10203         (Arm_input_section::do_output_offset): Remove static cast.
10204         (Arm_input_section::original_addralign,
10205          Arm_input_section::original_size_): Change type to uint32_t.
10206         (Arm_input_section::init): Add safe casts for section alignment
10207         and size.
10208         (Arm_input_section::set_final_data_size): Do not set address and
10209         offset of stub table.
10210         (Arm_output_section::fix_exidx_coverage): Change use of of
10211         Output_section::Simple_input_section to that of
10212         Output_section::Input_section.
10213         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
10214         except for the first pass.
10215         * output.cc (Output_section::get_input_sections): Change type of
10216         input_sections to std::list<Input_section>.
10217         (Output_section::add_script_input_section): Rename from
10218         Output_section::add_simple_input_section.  Change type of SIS
10219         parameter from Simple_input_section to Input_section.
10220         * output.h (Output_section::Simple_input_section): Remove class.
10221         (Output_section::Input_section): Change class visibility to public.
10222         (Output_section::Input_section::addralign): Use stored alignments
10223         for special input sections if set.
10224         (Output_section::Input_section::set_addralign): New method.
10225         (Output_section::get_input_sections): Change parameter type from
10226         list of Simple_input_section to list of Input_section.
10227         (Output_section::add_script_input_section): Rename from
10228         Output_section::add_simple_input_section. Change first parameter's
10229         type from Simple_input_section to Input_section and remove the
10230         second and third parameters.
10231         * script-sections.cc (Input_section::Input_section_list): Change
10232         type to list of Output_section::Input_section/
10233         (Input_section_info::Input_section_info): Change parameter type of
10234         INPUT_SECTION to Output_section::Input_section.
10235         (Input_section_info::input_section): Change return type.
10236         (Input_section_info::input_section_): Change type to
10237         Output_section::Input_section.
10238         (Output_section_element_input::set_section_addresses): Adjust code
10239         to use Output_section::Input_section instead of
10240         Output_section::Simple_input_section.  Adjust code for renaming
10241         of Output_section::add_simple_input_section.
10242         (Orphan_output_section::set_section_addresses): Ditto.
10243
10244 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10245
10246         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
10247         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
10248
10249 2010-05-18  Rafael Espindola  <espindola@google.com>
10250
10251         * options.cc (General_options::finalize): Handle -nostdlib.
10252         * options.h (nostdlib): New option.
10253         * script.cc (script_add_search_dir): Handle -nostdlib.
10254
10255 2010-05-12  Doug Kwan  <dougkwan@google.com>
10256
10257         * arm.cc (Target_arm::do_finalize_sections): Create an empty
10258         attributes section only if there no attributes section after merging.
10259         (Target_arm::merge_object_attributes): Move value of
10260         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
10261         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
10262         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
10263         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
10264         and arm_attr_merge_7.stdout.
10265         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
10266         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
10267         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
10268         arm_attr_merge_7b.o): New rules.
10269         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
10270         arm_attr_merge_7
10271         * testsuite/Makefile.in: Regenerate.
10272         * testsuite/arm_attr_merge.sh: New file.
10273         * testsuite/arm_attr_merge_[67][ab].s: Same.
10274
10275 2010-05-05  Nick Clifton  <nickc@redhat.com>
10276
10277         * po/es.po: Updated Spanish translation.
10278
10279 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
10280
10281         * Makefile.am (install-exec-local): Properly install gold as
10282         default cross linker.
10283         * Makefile.in: Regenerated.
10284
10285 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
10286             Nick Clifton  <nickc@redhat.com>
10287
10288         * configure.ac (install_as_default): Define and set to false
10289         unless --enable-gold or --enable-gold=both/gold has been
10290         specified.
10291         * configure: Regenerate.
10292
10293         * Makefile.am (install-exec-local): Install the executable as
10294         'ld.gold'.  If install_as_default is true then also install it as
10295         'ld'.
10296         * Makefile.in: Regenerated.
10297
10298 2010-04-24  Ian Lance Taylor  <iant@google.com>
10299
10300         * layout.cc (Layout::layout_reloc): In relocatable link don't
10301         combine reloc sections for grouped sections.
10302
10303 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
10304
10305         * gc.h (gc_process_relocs): Pass information on relocs pointing to
10306         sections that are not ordinary to icf.
10307         * icf.cc (get_section_contents): Handle relocation pointing to section
10308         with no object or shndx information.
10309         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
10310         * testsuite/Makefile.in: Regenerate.
10311         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
10312         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
10313
10314 2010-04-22  Ian Lance Taylor  <iant@google.com>
10315
10316         * expression.cc (Expression::Expression_eval_info): Add
10317         result_alignment_pointer field.
10318         (Expression::eval_with_dot): Add result_alignment_pointer
10319         parameter.  Change all callers.
10320         (Expression::eval_maybe_dot): Likewise.
10321         (class Binary_expression): Add alignment_pointer parameter to
10322         left_value and right_value.  Change all callers.
10323         (BINARY_EXPRESSION): Set result alignment.
10324         (class Trinary_expression): Add alignment_pointer parameter to
10325         arg2_value and arg3_value.  Change all callers.
10326         (Trinary_cond::value): Set result alignment.
10327         (Max_expression::value, Min_expression::value): Likewise.
10328         (Align_expression::value): Likewise.
10329         * script-sections.cc (class Sections_element): Add dot_alignment
10330         parameter to set_section_addresses virtual function.  Update
10331         instantiations.
10332         (class Output_section_element): Likewise.
10333         (Script_sections::create_segments): Add dot_alignment parameter.
10334         Change all callers.
10335         (Script_sections::create_segments_from_phdrs_clause): Likewise.
10336         (Script_sections::set_phdrs_clause_addresses): Likewise.
10337         * script-sections.h: Update declarations.
10338         * script.h: Update declarations.
10339         * output.h (Output_segment::set_minimum_p_align): Don't decrease
10340         min_p_align.
10341         * testsuite/script_test_3.t: Set large alignment.
10342         * testsuite/script_test_3.sh: Make sure that at least one LOAD
10343         segment has expected alignment.
10344
10345 2010-04-22  Nick Clifton  <nickc@redhat.com>
10346
10347         * po/gold.pot: Updated by the Translation project.
10348         * po/vi.po: Updated Vietnamese translation.
10349
10350 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
10351
10352         * testsuite/Makefile.am (check_PROGRAMS): Add
10353         icf_virtual_function_folding_test.
10354         * testsuite/Makefile.in: Regenerated.
10355
10356 2010-04-15  Andrew Haley  <aph@redhat.com>
10357
10358         * options.h (merge_exidx_entries): New option.
10359         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
10360         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
10361         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
10362         (Target_arm::merge_exidx_entries): New function.
10363         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
10364         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
10365         to Arm_exidx_fixup constructor.
10366         Add new arg, merge_exidx_entries.
10367         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
10368         Arm_output_section::fix_exidx_coverage.
10369
10370 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
10371
10372         * icf.cc (get_section_contents): Check for preemptible functions.
10373         Ignore addend when appropriate.
10374         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
10375         section folded.
10376         (add_from_relobj): Check for section folded.
10377         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
10378         * symtab.h (should_add_dynsym_entry): Add new parameter.
10379         * target-reloc.h (scan_relocs): Check for section folded.
10380         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
10381         Check reloc types for function pointers in shared objects.
10382         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
10383         case.
10384         (icf_preemptible_functions_test): New test case.
10385         (icf_string_merge_test): New test case.
10386         * testsuite.Makefile.in: Regenerate.
10387         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
10388         bar_glob.  Refactor code.
10389         * testsuite/icf_preemptible_functions_test.cc: New file.
10390         * testsuite/icf_preemptible_functions_test.sh: New file.
10391         * testsuite/icf_string_merge_test.cc: New file.
10392         * testsuite/icf_string_merge_test.sh: New file.
10393         * testsuite/icf_virtual_function_folding_test.cc: New file.
10394         * testsuite/icf_virtual_function_folding_test.sh: New file.
10395
10396 2010-04-14  Doug Kwan  <dougkwan@google.com>
10397
10398         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
10399         for local symbol recounting if we remove a section due to ICF.
10400         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
10401         there are no regular objects in input.
10402
10403 2010-04-13  Doug Kwan  <dougkwan@google.com>
10404
10405         * arm.cc (Arm_input_section::set_final_data_size): Compute
10406         accurate final data size instead of using current data size.
10407
10408 2010-04-09  Doug Kwan  <dougkwan@google.com>
10409
10410         * layout.cc (Layout::choose_output_section): Handle script section
10411         types.
10412         (Layout::make_output_section_for_script): Add section type parameter.
10413         Handle script section types.
10414         * layout.h (Layout::make_output_section_for_script): Add section
10415         type parameter.
10416         * output.cc (Output_section::Output_section): Initialize data member
10417         is_noload_.
10418         (Output_section::do_reset_address_and_file_offset): Do not set address
10419         to 0 if section is a NOLOAD section.
10420         * output.h (Output_section::is_noload): New method.
10421         (Output_section::set_is_noload): Ditto.
10422         (Output_section::is_noload_): New data member.
10423         * script-c.h (Script_section_type): New enum type.
10424         (struct Parser_output_section_header): Add new file section_type.
10425         * script-sections.cc (Sections_element::output_section_name): Add
10426         parameter for returning script section type.
10427         (Output_section_definition::output_section_name): Ditto.
10428         (Output_section_definition::section_type)P; New method.
10429         (Output_section_definiton::script_section_type_name): Ditto.
10430         (Output_section_definition::script_section_type_): New data member.
10431         (Output_section_definition::Output_section_definition): Initialize
10432         data member Output_section_definition::script_section_type_.
10433         (Output_section_definition::create_sections): Pass script section type
10434         to Layout::make_output_section_for_script.
10435         (Output_section_definition::output_section_name): Return script
10436         section type to caller.
10437         (Output_section_definition::set_section_address): Do not advance
10438         dot value and load address if section type is NOLOAD.  Set address
10439         of NOLOAD sections regardless of section flags.
10440         (Output_section_definition::print): Print section type if it is
10441         not SCRIPT_SECTION_TYPE_NONE.
10442         (Output_section_definition::section_type): New method.
10443         (Output_section_definition::script_section_type_name): Ditto.
10444         (Script_sections::output_section_name): Add new parameter
10445         PSECTION_TYPE for returning script section type.  Pass it to
10446         section elements.  Handle discard sections.
10447         (Sort_output_sections::operator()): Handle NOLOAD sections.
10448         * script-sections.h (Script_sections::Section_type): New enum type.
10449         (Script_sections::output_section_name): Add a new parameter for
10450         returning script section type.
10451         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
10452         INFO and NOLOAD.
10453         * yyscript.y (union): Add new field SECTION_TYPE.
10454         (COPY, DSECT, INFO, NOLOAD): New tokens.
10455         (opt_address_and_section_type): Change type to output_section_header.
10456         (section_type): New non-terminal
10457         (section_header): Handle section type.
10458         (opt_address_and_section_type): Return section type value.
10459
10460 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
10461
10462         * testsuite/plugin_common_test_1.c (foo): Add prototype.
10463         * testsuite/plugin_common_test_2.c (foo): Likewise.
10464
10465 2010-04-08  Doug Kwan  <dougkwan@google.com>
10466
10467         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
10468         Output_merge_data.
10469         * output.cc (Output_section::add_merge_input_section): Simplify
10470         code and return status of Output_merge_base::add_input_section.
10471         Update merge section map only if Output_merge_base::add_input_section
10472         returns true.
10473
10474 2010-04-07  Doug Kwan  <dougkwan@google.com>
10475
10476         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
10477         if section is marked as containing instructions but has no mapping
10478         symbols.
10479         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
10480         correct section index.
10481         (Arm_relobj::find_linked_text_section): Ditto.
10482
10483 2010-04-07  Cary Coutant  <ccoutant@google.com>
10484
10485         * archive.cc (include_member): Destroy Read_symbols_data object before
10486         releasing file.
10487         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
10488         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
10489         (Read_symbols_data::~Read_symbols_data) New destructor.
10490         (Section_relocs::Section_relocs) New constructor.
10491         (Section_relocs::~Section_relocs) New destructor.
10492         (Read_relocs_data::Read_relocs_data) New constructor.
10493         (Read_relocs_data::~Read_relocs_data) New destructor.
10494         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
10495         pointers to NULL after deleting.
10496
10497 2010-04-07  Doug Kwan  <dougkwan@google.com>
10498
10499         * arm.cc: Replace "endianity" with "endianness" in comments.
10500         (Arm_exidx_cantunwind): Ditto.
10501         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
10502         (Arm_relobj::merge_flags_and_attributes): New method.
10503         (Arm_relobj::merge_flags_and_attributes_): New data member.
10504         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
10505         (Arm_relobj::scan_sections_for_stubs): Ditto.
10506         (Arm_relobj::do_read_symbols): Check to see if we really want to
10507         merge processor-specific flags and attributes.  Exit early if
10508         an object is empty except for section names and the undefined symbol.
10509         (Target_arm::do_finalize_sections): Move check for ELF format to
10510         Arm_relobj::do_read_symbols.  Merge processor specific flags and
10511         attributes from a regular object only when we have determined that
10512         it is aapropriate.  Do not create an .ARM.attributes section in
10513         output if there is no regular input object.
10514         (Target_arm::merge_processor_specific_flags): Check
10515         --warn-mismatch before printing any error.
10516         (Target_arm::merge_object_attributes): Ditto.
10517         * gold.cc (queue_middle_tasks): Handle the case in which there is
10518         no regular object in input.
10519         * options.cc (General_options::parse_EB): New method.
10520         (General_options::parse_EL): Same.
10521         (General_options::General_options): Initialize endianness_.
10522         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
10523         New options.
10524         (General_options::Endianness): New enum.
10525         (General_options::endianness): New method.
10526         (General_options::endianness_): New data member.
10527         * parameters.cc (Parameters::set_options): Check target endianness.
10528         (Parameters::set_target_once): Ditto.
10529         (Parameters::check_target_endianness): New method.
10530         (parameters_force_valid_target): If either -EL or -EB is specified,
10531         use it to define endianness of default target.
10532         * parameters.h (Parameters::check_target_endianness): New method
10533         declaration.
10534         * target.h (class Target): Change "endianity" to "endianness"
10535         in comments.
10536
10537 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10538
10539         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
10540         * configure: Regenerate.
10541         * Makefile.in: Regenerate.
10542         * testsuite/Makefile.in: Regenerate.
10543
10544 2010-04-06  Cary Coutant  <ccoutant@google.com>
10545
10546         gcc PR lto/42757
10547         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
10548         prevailing definitions of common symbols.
10549         * testsuite/plugin_test_6.sh: New test case.
10550         * testsuite/plugin_common_test_1.c: New test case.
10551         * testsuite/plugin_common_test_2.c: New test case.
10552         * testsuite/Makefile.am (plugin_test_6): New test case.
10553         * testsuite/Makefile.in: Regenerate.
10554
10555 2010-04-06  Nick Clifton  <nickc@redhat.com>
10556
10557         * po/vi.po: New Vietnamese translation.
10558
10559 2010-03-30  Doug Kwan  <dougkwan@google.com>
10560
10561         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
10562
10563 2010-03-25  Doug Kwan  <dougkwan@google.com>
10564
10565         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
10566         to avoid a conversion warning on a 32-bit host.
10567
10568 2010-03-24  Ian Lance Taylor  <iant@google.com>
10569
10570         * testsuite/script_test_3.t: Add a TLS segment.
10571         * testsuite/Makefile.am (check_PROGRAMS): Add
10572         tls_phdrs_script_test.
10573         (tls_phdrs_script_test_SOURCES): Define.
10574         (tls_phdrs_script_test_DEPENDENCIES): Define.
10575         (tls_phdrs_script_test_LDFLAGS): Define.
10576         (tls_phdrs_script_test_LDADD): Define.
10577         * testsuite/Makefile.in: Rebuild.
10578
10579 2010-03-23  Cary Coutant  <ccoutant@google.com>
10580
10581         * fileread.cc (find_or_make_view): Fix comment.
10582
10583 2010-03-23  Ian Lance Taylor  <iant@google.com>
10584
10585         * script-sections.cc (class Orphan_section_placement): Define
10586         PLACE_TLS and PLACE_TLS_BSS.
10587         (Orphan_section_placement::Orphan_section_placement): Initialize
10588         new places.
10589         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
10590         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
10591         (tls_script_test_SOURCES): Define.
10592         (tls_script_test_DEPENDENCIES): Define.
10593         (tls_script_test_LDFLAGS): Define.
10594         (tls_script_test_LDADD): Define.
10595         * testsuite/Makefile.in: Rebuild.
10596
10597 2010-03-22  Doug Kwan  <dougkwan@google.com>
10598
10599         * arm.cc (Arm_relocate_functions::abs8,
10600         Arm_relocate_functions::abs16): Use correct check for overflow
10601         specified in the ARM ELF specs.
10602         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
10603         target of a BLX instruction specially.
10604         (Reloc_stub::stub_type_for_reloc): Ditto.
10605         (Relocate::relocate): Use symbolic names instead of numeric relocation
10606         codes to report error.
10607         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
10608         workaround.
10609         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
10610         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
10611         thumb2_blx_out_of_range.stdout
10612         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
10613         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
10614         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
10615         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
10616         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
10617         thumb2_blx_in_range, thumb2_blx_in_range.o,
10618         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
10619         thumb2_blx_out_of_range.o): New rules.
10620         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
10621         thumb2_blx_in_range and thumb2_blx_out_of_range.
10622         * testsuite/Makefile.in: Regenerate.
10623         * arm_branch_in_range.sh: Add tests for THUMB BLX.
10624         * testsuite/thumb_blx_in_range.s: New file.
10625         * testsuite/thumb_blx_out_of_range.s: New file.
10626
10627 2010-03-22  Rafael Espindola  <espindola@google.com>
10628
10629         * archive.cc (Should_include): Move to archive.h.
10630         (should_include_member): Make it a member of Archive.
10631         (Lib_group): New.
10632         (Add_lib_group_symbols): New.
10633         * archive.h: Include options.h.
10634         (Archive_member): Moved from Archive.
10635         (Should_include): Moved from archive.cc.
10636         (Lib_group): New.
10637         (Add_lib_group_symbols): New.
10638         * dynobj.cc (do_should_include_member): New.
10639         * dynobj.h (do_should_include_member): New.
10640         * gold.cc (queue_initial_tasks): Update call to queue.
10641         * main.cc (main): Print lib group stats.
10642         * object.cc (do_should_include_member): New.
10643         * object.h: Include archive.h.
10644         (Object::should_include_member): New.
10645         (Object::do_should_include_member): New.
10646         (Sized_relobj::do_should_include_member): New.
10647         * options.cc (General_options::parse_start_lib): New.
10648         (General_options::parse_end_lib): New.
10649         (Input_arguments::add_file): Handle lib groups.
10650         (Input_arguments::start_group): Check we are not in a lib.
10651         (Input_arguments::start_lib): New.
10652         (Input_arguments::end_lib): New.
10653         * options.h (General_options): Add start_lib and end_lib.
10654         (Input_argument::lib_): New.
10655         (Input_argument::lib): New.
10656         (Input_argument::is_lib): New.
10657         (Input_file_lib): New.
10658         (Input_arguments::in_lib_): New.
10659         (Input_arguments::in_lib): New.
10660         (Input_arguments::start_lib): New.
10661         (Input_arguments::end_lib_): New.
10662         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
10663         in unused members as preempted.
10664         (Sized_pluginobj::do_should_include_member): New.
10665         * plugin.h (Sized_pluginobj::do_should_include_member): New.
10666         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
10667         return the blocker.
10668         (Read_symbols::do_whole_lib_group): New.
10669         (Read_symbols::do_lib_group): New.
10670         (Read_symbols::do_read_symbols): Handle lib groups.
10671         (Read_symbols::get_name): Handle lib groups.
10672         * readsyms.h (Read_symbols): Add an archive member pointer.
10673         (Read_symbols::do_whole_lib_group): New.
10674         (Read_symbols::do_lib_group): New.
10675         (Read_symbols::member_): New.
10676         * script.cc (read_input_script): Update call to queue_soon.
10677
10678 2010-03-19  Doug Kwan  <dougkwan@google.com>
10679
10680         * arm.cc (Stub_table::Stub_table): Initialize new data members
10681         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10682         (Stub_table::add_reloc_stub): Assign stub offset and update
10683         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10684         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
10685         New data members.
10686         (Stub_table::update_data_size_and_addralign): Use
10687         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
10688         instead of going over all reloc stubs.
10689         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
10690         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10691         Stringpool_template::offset_ to size of Stringpool_char.
10692         (Stringpool_template::new_key_offset): Remove code to initialize
10693         Stringpool_template::offset_.
10694         * stringpool.h (Stringpool_template::set_no_zero_null): Set
10695         Stringpool_template::offset_ to zero.
10696
10697 2010-03-15  Doug Kwan  <dougkwan@google.com>
10698
10699         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10700         offset_.
10701         (Stringpool_template::new_key_offset): New method.
10702         (Stringpool_template::add_string): Assign offsets when adding new
10703         strings.
10704         (Stringpool_template::set_string_offsets): Do not set string offsets
10705         when not optimizing.
10706         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
10707         member size_.
10708         (Chunked_vector::clear): Clear size_.
10709         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
10710         (Chunked_vector::size): Return size_.
10711         (Chunked_vector::push_back): Use size_ to find insert position.
10712         (Chunked_vector::size_): New data member.
10713         (Stringpool_template::set_no_zero_null): Assert string set is empty.
10714         (Stringpool_template::new_key_offset): New method declaration.
10715         (Stringpool_template::offset_): New data member.
10716
10717 2010-03-15   Rafael Espindola  <espindola@google.com>
10718
10719         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
10720         Add_symbols' constructor.
10721         * readsyms.h (Add_symbols): Remove the input_group member.
10722
10723 2010-03-10  Ian Lance Taylor  <iant@google.com>
10724
10725         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
10726         target to ask whether a reference to a symbol requires a stack
10727         split.
10728         * target.h (Target::is_call_to_non_split): New function.
10729         (Target::do_is_call_to_non_split): Declare virtual function.
10730         * target.cc: Include "symtab.h".
10731         (Target::do_is_call_to_non_split): New function.
10732         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
10733
10734 2010-03-10  Cary Coutant  <ccoutant@google.com>
10735
10736         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
10737         (File_read::open[1]): Remove initial mapping of whole_file_view_.
10738         (File_read::open[2]): Add whole_file_view_ to list of views.
10739         (File_read::make_view): Remove test of whole_file_view_.
10740         (File_read::find_or_make_view): Create whole_file_view_ if
10741         necessary.
10742         (File_read::clear_views): Replace bool parameter with enum;
10743         adjust all callers.  Don't delete views with permanent data;
10744         do delete cached views and views from archives if
10745         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
10746         if clearing the corresponding view.
10747         * fileread.h (File_read::Clear_views_mode): New enum.
10748         (File_read::View::is_permanent_view): New method.
10749         (File_read::clear_views): Replace bool parameter
10750         with enum; adjust all callers.
10751         * options.h (General_options): Change keep_files_mapped option;
10752         add map_whole_files.
10753         * readsyms.cc (Add_symbols::run): Delete sd_ object before
10754         releasing the file.
10755         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
10756         the file.
10757
10758 2010-03-10  David S. Miller  <davem@davemloft.net>
10759
10760         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
10761
10762 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
10763
10764         * icf.cc (get_section_contents): Add '@' marker after processing the
10765         merge reloc.
10766
10767 2010-03-08  Doug Kwan  <dougkwan@google.com>
10768
10769         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
10770         due to a conversion warning.
10771         (Arm_relobj::update_output_local_symbol_count): Check for local
10772         symbol with unset output index.
10773
10774 2010-03-05  Ian Lance Taylor  <iant@google.com>
10775
10776         * options.h (class General_options): Add --spare-dynamic-tags.
10777         * output.cc (Output_data_dynamic::set_final_data_size): Implement
10778         --spare-dynamic-tags.
10779
10780 2010-03-05  Ian Lance Taylor  <iant@google.com>
10781
10782         * incremental.cc: Include "libiberty.h".
10783
10784 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
10785
10786         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
10787         function, is_info_ member.
10788         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
10789         (Versions::Versions): Update caller.
10790         (Versions::define_base_version): Likewise.
10791         (Versions::add_def): Likewise.
10792
10793 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
10794
10795         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
10796         (Scan::possible_function_pointer_reloc): New function.
10797         (Scan::local_reloc_may_be_function_pointer): Change to call
10798         possible_function_pointer_reloc.
10799         (Scan::global_reloc_may_be_function_pointer): Ditto.
10800         * icf.h (Icf::check_section_for_function_pointers): Change to reject
10801         relocations in ".data.rel.ro._ZTV" section.
10802         * testsuite/icf_safe_so_test.sh: Change to pass i386.
10803         * testsuite/icf_safe_so_test.cc: Ditto.
10804         * testsuite/icf_safe_test.cc: Ditto.
10805         * testsuite/icf_safe_test.sh: Ditto.
10806
10807 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10808             Ian Lance Taylor  <iant@google.com>
10809
10810         * target-reloc.h (relocate_section): Check the symbol table index
10811         for -1U before setting the local symbol index.
10812         (scan_relocatable_relocs): If copying the relocation, record that
10813         the local symbol is required.
10814         * object.h (Symbol_value::is_output_symtab_index_set): New
10815         function.
10816         (Symbol_value::may_be_discarded_from_output_symtab): New
10817         function.
10818         (Symbol_value::has_output_symtab_entry): New function.
10819         (Symbol_value::needs_output_symtab_entry): Remove.
10820         (Symbol_value::output_symtab_index): Make sure the symbol index is
10821         set.
10822         (Symbol_value::set_output_symtab_index): Make sure the symbol
10823         index is not set.  Make sure the new index is valid.
10824         (Symbol_value::set_must_have_output_symtab_entry): New function.
10825         (Symbol_value::has_output_dynsym_entry): New function.
10826         (Symbol_value::set_output_dynsym_index): Make sure the new index
10827         is valid.
10828         (Sized_relobj::set_must_have_output_symtab_entry): New function.
10829         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
10830         local symbol if permitted.
10831         (Sized_relobj::do_finalize_local_symbols): Call
10832         is_output_symtab_index_set rather than needs_output_symtab_entry.
10833         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
10834         rather than needs_output_symtab_entry.  Call
10835         has_output_dynsym_entry rather than needs_output_dynsym_entry.
10836         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
10837         is_output_symtab_index_set rather than needs_output_symtab_entry.
10838         * testsuite/discard_locals_relocatable_test.c: New file.
10839         * testsuite/discard_locals_test.sh: Test -r.
10840         * testsuite/Makefile.am (check_DATA): Add
10841         discard_locals_relocatable_test1.syms,
10842         discard_local_relocatable_test2.syms.
10843         (MOSTLYCLEANFILES): Likewise.  Also add
10844         discard_locals_relocatable_test1.lout and
10845         discard_locals_relocatable_test2.out.
10846         (discard_locals_relocatable_test1.syms): New target.
10847         (discard_locals_relocatable_test.o): New target.
10848         (discard_locals_relocatable_test1.out): New target.
10849         (discard_locals_relocatable_test2.syms): New target.
10850         (discard_locals_relocatable_test2.out): New target.
10851         (various): Add missing ../ld-new dependencies.
10852         * testsuite/Makefile.in: Rebuild.
10853
10854 2010-03-03  Nick Clifton  <nickc@redhat.com>
10855
10856         * po/fi.po: New Finnish translation.
10857
10858 2010-03-01  Doug Kwan  <dougkwan@google.com>
10859
10860         * layout.cc (Layout::Layout): Force section types of .init_array*,
10861         .preinit_array* and .fini_array* sections.
10862         * output.cc (Output_section::Input_section_sort_entry::has_priority):
10863         Fix check of return value of std::string::find.().
10864         (Output_section::Input_section_sort_compare::operator()): Remove
10865         comment about .init_array.
10866         (Output_section::Input_section_sort_init_fini_compare::operator()):
10867         New method.
10868         (Output_section::sort_attached_input_sections): Handle .init_array
10869         and .fini_array specially.
10870         * output.h (Output_section::Inut_section_sort_compare): Update
10871         comment.
10872         (Output_section::Input_section_sort_init_fini_compare): New struct.
10873
10874 2010-02-26  Doug Kwan  <dougkwan@google.com>
10875
10876         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
10877         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
10878         * testsuite/debug_msg.sh: Avoid matching source line number for
10879         use of global variable undef_int.
10880
10881 2010-02-26  Doug Kwan  <dougkwan@google.com>
10882
10883         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
10884         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
10885         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
10886         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
10887         * options.cc (General_options::General_options): Initialize member
10888         fix_v4bx_.
10889         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
10890         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
10891         and rm_no_fix_v4bx.stdout
10892         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
10893         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
10894         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
10895         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
10896         and arm_no_fix_v4bx.
10897         * Makefile.in: Regenerate.
10898         * testsuite/arm_fix_v4bx.s: New file.
10899         * testsuite/arm_fix_v4bx.sh: Ditto.
10900
10901 2010-02-24  Doug Kwan  <dougkwan@google.com>
10902
10903         * arm.cc (Target_arm::got_section): Make the .got section the first
10904         non RELRO section in the data segment.
10905         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
10906         suffixes of section names.
10907
10908 2010-02-24  Doug Kwan  <dougkwan@google.com>
10909
10910         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
10911         flags and attributes merging if an input file is a binary file.
10912         * fileread.cc (Input_file::open): Record format of original file.
10913         * fileread.h (Input_file::Format): New enum type.
10914         (Input_file::Input_file): Initialize data member format_.
10915         (Input_file::format): New method definition.
10916         (Input_file::format_):: New data member.
10917
10918 2010-02-24  Doug Kwan  <dougkwan@google.com>
10919
10920         * arm.cc (Arm_output_data_got): New class.
10921         (ARM_TCB_SIZE): New constant
10922         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
10923         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10924         If user uses a script with a SECTIONS clause, issue only a warning
10925         for a misplaced EXIDX input section.  Otherwise, issue an error.
10926         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
10927         garbage collection.
10928         (Target_arm::got_mode_index_entry): Handle static linking.
10929         (Target_arm::Scan::local): Ditto.
10930         (Target_arm::Scan::global): Ditto.
10931         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
10932         all incorrectly implemented relocations.
10933         (Target_arm::fix_exidx_coverage): Pass layout to
10934         Arm_output_section::fix_exidx_coverage.
10935         * layout.cc (Layout::section_name_mapping): Remove trailing dots
10936         from ".ARM.exidx." and ".ARM.extab.".
10937
10938 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10939
10940         * arm.cc (Target_arm::do_finalize_sections): Create attribute
10941         section if it does not already exist.
10942         * attributes.cc (Attributes_section_data::Attributes_section_data):
10943         Don't crash if size is zero.
10944
10945 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10946             Ian Lance Taylor  <iant@google.com>
10947
10948         * gold.cc (queue_middle_tasks): If no input files were opened,
10949         exit.
10950         * workqueue.h (Task_function::Task_function): Assert that there is
10951         a blocker.
10952
10953 2010-02-22  Doug Kwan  <dougkwan@google.com>
10954
10955         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
10956         * icf.cc (get_section_contents): Cast snprintf arguments to long long
10957         types to avoid warnings due to different uint64_t implementations
10958         on different hosts.
10959
10960 2010-02-21  Doug Kwan  <dougkwan@google.com>
10961
10962         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
10963         handling of the maximum backward branch offset.
10964         (Arm_relocate_functions::thumb_branch_common): Ditto.
10965         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
10966         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
10967         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
10968         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
10969         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
10970         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
10971         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
10972         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
10973         thumb_bl_out_of_range thumb_bl_out_of_range.o,
10974         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
10975         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
10976         thumb2_bl_out_of_range.o): New rules.
10977         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
10978         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
10979         thumb2_bl_out_of_range
10980         * testsuite/Makefile.in: Regenerate.
10981         * testsuite/arm_bl_in_range.s: New file.
10982         * testsuite/arm_bl_out_of_range.s: Ditto.
10983         * testsuite/arm_branch_in_range.sh: Ditto.
10984         * testsuite/arm_branch_range.t: Ditto.
10985         * testsuite/thumb2_branch_range.t: Ditto.
10986         * testsuite/thumb_bl_in_range.s: Ditto.
10987         * testsuite/thumb_bl_out_of_range.s: Ditto.
10988         * testsuite/thumb_branch_range.t: Ditto.
10989
10990 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
10991
10992         * gc.h (gc_process_relocs): Change vectors to point to the new list.
10993         Add reloc offset information.
10994         * icf.cc (get_section_contents): Change iterators to point to the new
10995         vectors. Add reloc offset information to the contents.
10996         * icf.h (Icf::Sections_reachable_info): New typedef.
10997         (Icf::Sections_reachable_list): New typedef.
10998         (Icf::Offset_info): New typedef.
10999         (Icf::Reloc_info): New struct typedef.
11000         (Icf::Reloc_info_list): New typedef.
11001         (Icf::symbol_reloc_list): Delete method.
11002         (Icf::addend_reloc_list): Delete method.
11003         (Icf::section_reloc_list): Delete method.
11004         (Icf::reloc_info_list): New method.
11005         (Icf::reloc_info_list_): New member.
11006
11007 2010-02-19  Doug Kwan  <dougkwan@google.com>
11008
11009         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
11010         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
11011         * arm.cc (Arm_relocation_functions): New forward declaration.
11012         (Target_arm::Target_arm): Initialize new data members
11013         got_mod_index_offset_ and tls_base_symbol_defined_.
11014         (Target_arm::Relocate::relocate_tls): New method.
11015         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
11016          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
11017         New methods.
11018         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
11019         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
11020         (Target_arm::got_mod_index_offset_,
11021         Target_arm::tls_base_symbol_defined_): New data members.
11022         (Target_arm::Scan::local, Target::Scan::global,
11023         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
11024         relocations.
11025
11026 2010-02-18  Doug Kwan  <dougkwan@google.com>
11027
11028         * arm.cc (Arm_relobj::find_linked_text_section): New method.
11029         (Arm_relobj::make_exidx_input_section): Pass section index of linked
11030         text section as a parameter becuase some broken tools may not set
11031         the link in section header.
11032         (Target_arm::has_got_section): New method.
11033         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
11034         without any mapping symbol as data only.  Remove warning.
11035         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
11036         link in its section header, try to discover the link by inspecting the
11037         REL31 relocation at the beginning of the section.
11038         (Target_arm::Scan::check_non_pic): Report name of offending relocation
11039         in error message.
11040         (Target_arm::Scan::global): Treat any reference to the symbol
11041         _GLOBAL_OFFSET_TABLE_ as a GOT access.
11042
11043 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
11044
11045         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
11046         (Scan::global_reloc_may_be_function_pointer): New function.
11047         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
11048         (Scan::global_reloc_may_be_function_pointer): New function.
11049         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
11050         (Scan::global_reloc_may_be_function_pointer): New function.
11051         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
11052         (Scan::global_reloc_may_be_function_pointer): New function.
11053         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
11054         (Scan::global_reloc_may_be_function_pointer): New function.
11055         (Scan::possible_function_pointer_reloc): New function.
11056         (Target_x86_64::can_check_for_function_pointers): New function.
11057         * gc.h (gc_process_relocs): Scan relocation types to determine if
11058         function pointers were taken for targets that support it.
11059         * icf.cc (Icf::find_identical_sections): Include functions for
11060         folding in safe ICF whose pointer is not taken.
11061         * icf.h (Secn_fptr_taken_set): New typedef.
11062         (fptr_section_id_): New member.
11063         (section_has_function_pointers): New function.
11064         (set_section_has_function_pointers): New function.
11065         (check_section_for_function_pointers): New function.
11066         * options.h: Fix comment for safe ICF option.
11067         * target.h (can_check_for_function_pointers): New function.
11068         * testsuite/Makefile.am: Add icf_safe_so_test test case.
11069         Modify icf_safe_test for X86-64.
11070         * testsuite/Makefile.in: Regenerate.
11071         * testsuite/icf_safe_so_test.cc: New file.
11072         * testsuite/icf_safe_so_test.sh: New file.
11073         * testsuite/icf_safe_test.cc (kept_func_3): New function.
11074         (main): Change to take pointer to function kept_func_3.
11075         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
11076         folding is done correctly for X86-64.
11077
11078 2010-02-12  David S. Miller  <davem@davemloft.net>
11079
11080         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
11081         is_symbolless parameter.
11082         (Output_reloc<SHT_REL>::is_symbolless): New.
11083         (Output_reloc<SHT_REL>::is_symbolless_): New.
11084         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
11085         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
11086         (Output_reloc<SHT_RELA>::is_symbolless): New.
11087         (Output_data_reloc::add_global): Handle is_symbolless.
11088         (Output_data_reloc::add_global_relative): Likewise.
11089         (Output_data_reloc::add_local): Likewise.
11090         (Output_data_reloc::add_local_relative): Likewise.
11091         (Output_data_reloc::add_symbolless_global_addend): New.
11092         (Output_data_reloc::add_symbolless_local_addend): New.
11093         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
11094         is_symbolless.
11095         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
11096         instead of ->is_relative_
11097         (Output_reloc::write): Likewise.
11098         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
11099         (Output_reloc::write_rel): Simplify.
11100
11101         * sparc.cc (Target_sparc::Scan::local): Use
11102         ->add_symbolless_local_addend as needed.
11103         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
11104         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
11105         based upon relocation offset.
11106
11107 2010-02-11  Doug Kwan  <dougkwan@google.com>
11108
11109         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
11110         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
11111         beginning of function.
11112         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
11113         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
11114         parameter is_32bit in calls to should_apply_static_reloc.
11115         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
11116         (check_DATA): Add arm_abs_global.stdout.
11117         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
11118         arm_abs_global.stdout): New rules.
11119         (MOSTLLYCLEANFILES): Add arm_abs_global
11120         * Makefile.in: Regenerate.
11121         * testsuite/arm_abs_global.s: New file.
11122         * testsuite/arm_abs_global.sh: Ditto.
11123         * testsuite/arm_abs_lib.s: Ditto.
11124
11125 2010-02-11  Ian Lance Taylor  <iant@google.com>
11126
11127         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
11128         Read_relocs task.
11129         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
11130         Allocate_commons_task first.
11131         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
11132         task, rather than symtab_lock_.
11133         (Gc_process_relocs::~Gc_process_relocs): New function.
11134         (Gc_process_relocs::is_runnable): Check this_blocker_.
11135         (Gc_process_relocs::locks): Use next_blocker_ rather than
11136         blocker_.
11137         (Scan_relocs::~Scan_relocs): New function.
11138         (Scan_relocs::is_runnable): Check this_blocker_ rather than
11139         symtab_lock_.
11140         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
11141         next_blocker_.
11142         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
11143         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
11144         constructor accordingly.
11145         (class Gc_process_relocs): Likewise.
11146         (class Scan_relocs): Likewise.
11147         * common.h (class Allocate_commons_task): Remove symtab_lock_
11148         field, and corresponding constructor parameter.
11149         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
11150         symtab_lock_.
11151         (Allocate_commons_task::locks): Likewise.
11152
11153 2010-02-11  Ian Lance Taylor  <iant@google.com>
11154
11155         * gold-threads.h (class Once): Define.
11156         (class Initialize_lock): Rewrite as child of Once.
11157         * gold-threads.cc (class Once_initialize): Define.
11158         (once_pointer_control): New static variable.
11159         (once_pointer, once_arg): New static variables.
11160         (c_run_once): New static function.
11161         (Once::Once, Once::run_once, Once::internal_run): New functions.
11162         (class Initialize_lock_once): Remove.
11163         (initialize_lock_control): Remove.
11164         (initialize_lock_pointer): Remove.
11165         (initialize_lock_once): Remove.
11166         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
11167         (Initialize_lock::initialize): Rewrite.
11168         (Initialize_lock::do_run_once): New function.
11169         * archive.cc (Archive::interpret_header): Only clear name if it is
11170         not already empty.
11171         * fileread.cc: Include "gold-threads.h"
11172         (file_counts_lock): New static variable.
11173         (file_counts_initialize_lock): Likewise.
11174         (File_read::release): Only increment counts when using --stats.
11175         Use a lock around the increment.
11176         * parameters.cc (class Set_parameters_target_once): Define.
11177         (set_parameters_target_once): New static variable.
11178         (Parameters::Parameters): Move here from parameters.h.
11179         (Parameters::set_target): Rewrite.
11180         (Parameters::set_target_once): New function.
11181         (Parameters::clear_target): Move here and rewrite.
11182         * parameters.h (class Parameters): Update declarations.  Add
11183         set_parameters_target_once_ field.
11184         (Parameters::Parameters): Move to parameters.cc.
11185         (Parameters::clear_target): Likewise.
11186         * readsyms.cc (Read_symbols::do_group): Create a Start_group
11187         task.
11188         (Start_group::~Start_group): New function.
11189         (Start_group::is_runnable): New function.
11190         (Start_group::locks, Start_group::run): New functions.
11191         (Finish_group::run): Change saw_undefined to size_t.
11192         * readsyms.h (class Start_group): Define.
11193         (class Finish_group): Change saw_undefined_ field to size_t.
11194         (Finish_group::Finish_group): Remove saw_undefined and
11195         this_blocker parameters.  Change all callers.
11196         (Finish_group::set_saw_undefined): New function.
11197         (Finish_group::set_blocker): New function.
11198         * symtab.h (class Symbol_table): Change saw_undefined to return
11199         size_t.  Change saw_undefined_ field to size_t.
11200         * target-select.cc (Set_target_once::do_run_once): New function.
11201         (Target_selector::Target_selector): Initialize set_target_once_
11202         field.  Don't initialize lock_ and initialize_lock_ fields.
11203         (Target_selector::instantiate_target): Rewrite.
11204         (Target_selector::set_target): New function.
11205         * target-select.h (class Set_target_once): Define.
11206         (class Target_selector): Update declarations.  Make
11207         Set_target_once a friend.  Remove lock_ and initialize_lock_
11208         fields.  Add set_target_once_ field.
11209
11210 2010-02-10  Ian Lance Taylor  <iant@google.com>
11211
11212         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
11213         queueing any tasks.
11214         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
11215         (queue_middle_tasks): Add all blockers before queueing any tasks.
11216         (queue_final_tasks): Likewise.
11217         * token.h (Task_token::add_blockers): New function.
11218         * object.h (Input_objects::number_of_relobjs): New function.
11219
11220 2010-02-10  Ian Lance Taylor  <iant@google.com>
11221
11222         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
11223         shared, not if not position independent.
11224         * x86_64.cc (Relocate::relocate_tls): Likewise.
11225         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
11226         (tls_pie_pic_test): New target.
11227         * testsuite/Makefile.in: Rebuild.
11228
11229         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
11230         (tls_test_main_pie.o, tls_test_pie.o): New targets.
11231         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
11232         * testsuite/Makefile.in: Rebuild.
11233
11234 2010-02-09  David S. Miller  <davem@davemloft.net>
11235
11236         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
11237         R_SPARC_RELATIVE using ->add_local_relative().
11238         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
11239
11240         * output.h (Output_data_dynamic::add_section_size): New method
11241         that takes two Output_data objects.
11242         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
11243         entry param.  Handle it in initializers.
11244         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
11245         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
11246         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
11247         arg.
11248         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
11249         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
11250         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
11251         for dynrel_includes_plt.
11252         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11253         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11254         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
11255         before .rela.plt
11256         (Target_sparc::do_finalize_sections): Update to pass true for
11257         dynrel_includes_plt.
11258         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
11259         output before .rela.plt
11260         (Target_powerpc::do_finalize_sections): Update to pass true for
11261         dynrel_includes_plt when 32-bit.
11262
11263 2010-02-08  Doug Kwan  <dougkwan@google.com>
11264
11265         * arm.cc (Arm_relobj::simple_input_section_output_address): New
11266         method.
11267         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
11268         Arm_relobj::scan_section_for_cortex_a8_stubs,
11269         Arm_relobj::do_relocation_section): Instead of calling
11270         Output_section::output_address, use faster
11271         Arm_relobj::simple_input_section_output_address.
11272
11273 2010-02-08  David S. Miller  <davem@davemloft.net>
11274
11275         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
11276         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
11277         relocation helper function.
11278
11279         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
11280         just like R_SPARC_GOT{10,13,22}.
11281         (Target_sparc::Scan::local): Likewise.
11282         (Target_sparc::Relocate:relocate): Likewise.
11283
11284 2010-02-06  Ian Lance Taylor  <iant@google.com>
11285
11286         * configure.ac: Rewrite targetobjs duplicate removal code to use
11287         only shell constructs.
11288         * configure: Rebuild.
11289
11290 2010-02-05  Doug Kwan  <dougkwan@google.com>
11291
11292         PR 11247
11293         * arm.cc (Arm_relobj::section_is_scannable): New method.
11294         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
11295         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
11296
11297 2010-02-04  Doug Kwan  <dougkwan@google.com>
11298
11299         PR 11247
11300         * arm-reloc-property.cc (cstdio): Include.
11301         * configure.ac (targetobjs): Remove duplicates.
11302         * configure: Regenerate.
11303         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
11304         big and little endian version for a given address size.
11305
11306 2010-02-03  Doug Kwan  <dougkwan@google.com>
11307
11308         * arm-reloc-property.cc
11309         (Arm_reloc_property_table::reloc_name_in_error_message): New method
11310         definition.
11311         * arm-reloc-property.h
11312         (Arm_reloc_property_table::get_implemented_static_reloc_property):
11313         New method definition.
11314         (Arm_reloc_property_table::reloc_name_in_error_message): New method
11315         declaration.
11316         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
11317         overflow to N.
11318         (GOT_PREL): Change implemented to Y.
11319         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
11320         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
11321         (Arm_relocate_functions::movw_abs_nc): Remove method.
11322         (Arm_relocate_functions::movt_abs): Ditto.
11323         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
11324         (Arm_relocate_functions::thm_movt_abs): Ditto.
11325         (Arm_relocate_functions::movw_rel_nc): Ditto.
11326         (Arm_relocate_functions::movw_rel): Ditto.
11327         (Arm_relocate_functions::movt_rel): Ditto.
11328         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
11329         (Arm_relocate_functions:thm_movw_rel): Ditto.
11330         (Arm_relocate_functions:thm_movt_rel): Ditto.
11331         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
11332         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
11333         New method definitions.
11334         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
11335         (Arm_relocation_functions::arm_grp_ldr): Ditto.
11336         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
11337         (Arm_relocation_functions::arm_grp_ldc): Ditto.
11338         (Target_arm::Relocate::relocate): Check for non-static or
11339         unimplemented relocation code and exit early.  Change calls to
11340         Target_arm::reloc_uses_thumb_bit and
11341         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
11342         instead.  Refactor code to handle similar relocations to increase
11343         code sharing.  Remove check for unsupported relocation code in switch
11344         statement.
11345         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
11346         relocation property table to find out size.  Change error message to
11347         print out the name of a relocation code instead of the numeric value.
11348         (Target_arm::scan_reloc_for_stub): Use relocation property table
11349         instead of calling Target_arm::reloc_uses_thumb_bit().
11350
11351 2010-02-02  Doug Kwan  <dougkwan@google.com>
11352
11353         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
11354         types of relaxed input section.
11355
11356 2010-02-02  Doug Kwan  <dougkwan@google.com>
11357
11358         * Makefile.am (HFILES): Add arm-reloc-property.h.
11359         (DEFFILES): New.
11360         (TARGETSOURCES): Add arm-reloc-property.cc
11361         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
11362         (libgold_a_SOURCES): $(DEFFILES)
11363         * Makefile.in: Regenerate.
11364         * arm-reloc-property.cc: New file.
11365         * arm-reloc-property.h: New file.
11366         * arm-reloc.def: New file.
11367         * arm.cc: Update comments.
11368         (arm-reloc-property.h): New included header.
11369         (arm_reloc_property_table): New global variable.
11370         (Target_arm::do_select_as_default_target): New method definition.
11371         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
11372         arm-reloc-property to targ_extra_obj.
11373         * parameters.cc (set_parameters_target): Call
11374         Target::select_as_default_target().
11375         * target.h (Target::select_as_default_target): New method definition.
11376         (Target::do_select_as_default_target): Same.
11377
11378 2010-02-01  Doug Kwan  <dougkwan@google.com>
11379
11380         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
11381         first_output_text_section_.
11382         (Arm_exidx_fixup::first_output_text_section): New method definition.
11383         (Arm_exidx_fixup::first_output_text_section_): New data member.
11384         (Arm_exidx_fixup::process_exidx_section): Record the first text
11385         output section seen.
11386         (Arm_output_section::fix_exidx_coverage): Set correct linked section
11387         and entsize in output section header.
11388
11389 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11390
11391         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
11392         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
11393         (Arm_relocate_functions::thm_alu11): New Method.
11394         (Arm_relocate_functions::thm_pc8): New Method.
11395         (Arm_relocate_functions::thm_pc12): New Method.
11396         (Target_arm::Scan::local): Handle the relocations.
11397         (Target_arm::Scan::global): Likewise.
11398         (Target_arm::Relocate::relocate): Likewise.
11399         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11400
11401 2010-01-29  Doug Kwan  <dougkwan@google.com>
11402
11403         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
11404         of relocation types as ld.
11405
11406 2010-01-29  Doug Kwan  <dougkwan@google.com>
11407
11408         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
11409         to public.
11410         (Arm_relocate_functions::thumb_branch_common): Ditto.
11411         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
11412         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
11413         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
11414         Arm_relocate_functions::jump24): Remove.
11415         (Target_arm::Relocate::relocate): Adjust code to call
11416         Arm_relocation_functions::arm_branch_common and
11417         Arm_relocation_functions::thumb_branch_common instead of their removed
11418         wrappers.  Merge switch-cases together to reduce source code size.
11419
11420 2010-01-29  Doug Kwan  <dougkwan@google.com>
11421
11422         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
11423         output_local_symbol_count_needs_update_.
11424         (Arm_relobj::output_local_symbol_count_needs_update,
11425          Arm_relobj::set_output_local_symbol_count_needs_update,
11426          Arm_relobj::update_output_local_symbol_count): New methods.
11427         (Arm_relobj::output_local_symbol_count_needs_update_): New data
11428         member.
11429         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
11430         of pointed function as in a R_ARM_PREL31 relocation.
11431         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
11432         for output local symbol count updating.
11433         (Target_arm::do_relax): Update output local symbol counts in objects
11434         if necessary.
11435         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
11436
11437 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11438
11439         * arm.cc: Added support for the ARM relocations:
11440         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
11441         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
11442         (Arm_relocate_functions::movw_rel_nc): Renamed (was
11443         movw_prel_nc).
11444         (Arm_relocate_functions::movw_rel): New method.
11445         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
11446         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
11447         thm_movw_prel_nc).
11448         (Arm_relocate_functions::thm_movw_rel): New method.
11449         (Arm_relocate_functions::thm_movt_rel): Renamed (was
11450         thm_movt_prel).
11451         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
11452         relocations.
11453         (Target_arm::Scan::global): Likewise.
11454         (Target_arm::Relocate::relocate): Likewise.
11455         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11456         Likewise.
11457
11458 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11459
11460         * arm.cc: Added support for ARM group relocations.
11461         (Target_arm::reloc_needs_sym_origin): New method.
11462         (Arm_relocate_functions::calc_grp_kn): New method.
11463         (Arm_relocate_functions::calc_grp_residual): New method.
11464         (Arm_relocate_functions::calc_grp_gn): New method.
11465         (Arm_relocate_functions::arm_grp_alu): New Method.
11466         (Arm_relocate_functions::arm_grp_ldr): New Method.
11467         (Arm_relocate_functions::arm_grp_ldrs): New Method.
11468         (Arm_relocate_functions::arm_grp_ldc): New Method.
11469         (Target_arm::Scan::local): Handle the ARM group relocations.
11470         (Target_arm::Scan::global): Likewise.
11471         (Target_arm::Relocate::relocate): Likewise.
11472         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11473         Likewise.
11474
11475 2010-01-26  Doug Kwan  <dougkwan@google.com>
11476
11477         * arm.cc (set): Include.
11478         (class Arm_exidx_fixup): Change type of last_input_section_ to const
11479         pointer type.
11480         (Arm_output_section::Text_section_list): New type.
11481         (Arm_output_section::append_text_sections_to_list): New method.
11482         (Arm_output_section::fix_exidx_coverage): Ditto.
11483         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
11484         (Arm_relobj::convert_input_section_to_relaxed_section): Use
11485         Relobj::set_section_offset() instead of
11486         Sized_relobj::invalidate_section_offset().
11487         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
11488         parameter for section headers. Ignore relocation sections for
11489         unallocated sections and EXIDX sections.
11490         (Target_arm::fix_exidx_coverage): New method.
11491         (Target_arm::output_section_address_less_than): New type.
11492         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
11493         linked text section instead of the EXIDX section.
11494         (Arm_output_section::create_stub_group): Add an assertion to check
11495         that this is not an EXIDX output section.
11496         (Arm_output_section::append_text_sections_to_list): New method.
11497         (Arm_output_section::fix_exidx_coverage): Ditto.
11498         (Arm_relobj::scan_sections_for_stubs): Adjust call to
11499         Arm_relobj::section_needs_reloc_stub_scanning.
11500         (Target_arm::do_relax): Fix EXIDX output section coverage in the
11501         first pass.
11502         (Target_arm::fix_exidx_coverage): New method.
11503         * object.h (Relobj::set_output_section): New method.
11504         (Sized_relobj::invalidate_section_offset): Remove method.
11505         (Sized_relobj::do_invalidate_section_offset): Remove method.
11506         (Sized_relobj::do_set_section_offset): Handle offset value -1.
11507
11508 2010-01-25  Doug Kwan  <dougkwan@google.com>
11509
11510         * arm.cc (Arm_exidx_merged_section::do_output_offset):
11511         Fix warning due to signed and unsigned comparison on a 32-bit host.
11512
11513 2010-01-22  Doug Kwan  <dougkwan@google.com>
11514
11515         * arm.cc (Target_arm::do_relax): Record an output section for section
11516         offset adjustment it contains any stub table that has changed.
11517         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
11518         offsets in an output section if necessary.
11519         * output.cc (Output_section::Output_section): Initialize
11520         section_offsets_need_adjustments_.
11521         (Output_section::add_input_section_for_script): Renamed to
11522         Output_section::add_simple_input_section.
11523         (Output_section::save_states): Add a comment.
11524         (Output_section::discard_states): New method defintion.
11525         (Output_section::adjust_section_offsets): Same.
11526         * output.h (Output_section::add_input_section_for_script): Renamed to
11527         Output_section::add_simple_input_section.
11528         (Output_section::discard_states): New method declaration.
11529         (Output_section::adjust_section_offsets): Same.
11530         (Output_section::section_offsets_need_adjustment,
11531         Output_section::set_section_offsets_need_adjustment): New method
11532         definitions.
11533         (Output_section::section_offsets_need_adjustment_): New data member.
11534         * script-sections.cc
11535         (Output_section_element_input::set_section_address): Adjust code for
11536         renaming of Output_section::add_input_section_for_script.
11537         (Orphan_output_section::set_section_address): Same.
11538
11539 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11540
11541         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
11542         Fix_v4bx enum values .
11543         * gold/options.h (General_options): New option definitions.
11544         (General_options::fix_v4bx): New method.
11545         (General_options::Fix_v4bx): New enum.
11546         * gold/options.cc (General_options::parse_fix_v4bx): New method.
11547         (General_options::parse_fix_v4bx_interworking): New method.
11548
11549 2010-01-22  Doug Kwan  <dougkwan@google.com>
11550
11551         * arm.cc (Arm_exidx_fixup): New class.
11552
11553 2010-01-21  Doug Kwan  <dougkwan@google.com>
11554
11555         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
11556         classes.
11557         (Arm_exidx_section_offset_map): New type.
11558
11559 2010-01-21  Doug Kwan  <dougkwan@google.com>
11560
11561         * arm.cc (Arm_exidx_input_section): New class.
11562         (Arm_relobj::exidx_input_section_by_link,
11563         Arm_relobj::exidx_input_section_by_shndx,
11564         Arm_relobj::make_exidx_input_section): New methods.
11565         (read_arm_attributes_section): Remove.
11566         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
11567         information about them.
11568         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
11569         to here.
11570
11571 2010-01-20  Doug Kwan  <dougkwan@google.com>
11572
11573         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
11574         Input_section_specifier to Section_id.
11575         (Target_arm::new_arm_input_section: Adjust code for change of key
11576         type.
11577         (Target_arm::find_arm_input_section): Ditto.
11578         * gc.h (object.h): Include for Section_id nand Section_id_hash.
11579         (Section_id): Remove.
11580         (Garbage_collection::Section_id_hash): Remove.
11581         * icf.h (object.h): Include for Section_id nand Section_id_hash.
11582         (Section_id): Remove.
11583         (Icf::Section_id_hash): Remove.
11584         * object.h (Section_id, Const_section_id, Section_id_hash,
11585         Const_section_id_hash): New type definitions.
11586         * output.cc (Output_section::add_relaxed_input_section): Change to
11587         use Const_section_id instead of Input_section_specifier as key type.
11588         (Output_section::add_merge_input_section): Ditto.
11589         (Output_section::build_relaxation_map): Change to use Section_id
11590         instead of Input_section_specifier as key type.
11591         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11592         Ditto.
11593         (Output_section::convert_input_sections_to_relaxed_sections): Change
11594         to use Const_section_id instead of Input_section_specifier as key type.
11595         (Output_section::find_merge_section): Ditto.
11596         (Output_section::find_relaxed_input_section): Ditto.
11597         * output.h (Input_section_specifier): Remove class.
11598         (Output_section::Output_section_data_by_input_section_map): Change
11599         key type to Const_section_id.
11600         (Output_section::Output_relaxed_input_section_by_input_section_map):
11601         Ditto.
11602         (Output_section::Relaxation_map): Change key type to Section_id.
11603
11604 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11605
11606         * gold/arm.cc: Added support for R_ARM_V4BX relocation
11607         (class Arm_v4bx_stub): New class.
11608         (DEF_STUBS): Updated definition to support v4_veneer_bx.
11609         (Stub_factory::make_arm_v4bx_stub): New method.
11610         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
11611         (Stub_table::empty): Handle v4bx stubs.
11612         (Stub_table::add_arm_v4bx_stub): New method.
11613         (Stub_table::find_arm_v4bx_stub): New method.
11614         (Arm_relocate_functions::v4bx): New method.
11615         (Target_arm::fix_v4bx): New method.
11616         (Target_arm::Target_arm): Handle R_ARM_V4BX.
11617         (Stub_table::relocate_stubs): Likewise.
11618         (Stub_table::do_write): Likewise.
11619         (Stub_table::update_data_size_and_addralign): Likewise.
11620         (Stub_table::finalize_stubs):  Likewise.
11621         (Target_arm::Scan::local): Likewise.
11622         (Target_arm::Scan::global): Likewise.
11623         (Target_arm::do_finalize_sections): Likewise.
11624         (Target_arm::Relocate::relocate): Likewise.
11625         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11626         Likewise.
11627         (Target_arm::scan_reloc_for_stub): Likewise.
11628         (Target_arm::scan_reloc_section_for_stubs): Likewise.
11629
11630 2010-01-19  Ian Lance Taylor  <iant@google.com>
11631
11632         * output.cc (Output_section_headers::do_sized_write): Write large
11633         segment count to sh_info field.
11634         (Output_file_header::do_sized_write): For large segment count,
11635         write PN_XNUM to e_phnum field.
11636
11637 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11638
11639         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
11640         (Arm_relocate_functions::thm_jump8): New function.
11641         (Arm_relocate_functions::thm_jump11): New function.
11642         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
11643         R_ARM_THM_JUMP11.
11644         (Target_arm::Scan::global): Likewise.
11645         (Target_arm::Relocate::relocate): Likewise.
11646         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11647         Likewise.
11648
11649 2010-01-14  Doug Kwan  <dougkwan@google.com>
11650
11651         * arm.cc (map, utility): Include headers.
11652         (Target_arm::apply_cortex_a8_workaround): New method.
11653         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
11654         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
11655         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
11656         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
11657         the --[no-]fix-cortex-a8 command line options.
11658         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
11659         (Target_arm::relocate_stub): Use addend in instruction template.
11660         * options.h (DEFINE_bool): Set the user-set flag.
11661         (General_options): Add --[no-]-fix-cortex options.
11662         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
11663         : Update fast look-up map after conversion.
11664
11665 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
11666
11667         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
11668         in the first pass of do_layout.
11669
11670 2010-01-13  Doug Kwan  <dougkwan@google.com>
11671
11672         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11673         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
11674         apparent compiler problem of not folding static constant integral
11675         data members of elfcpp::Elf_sizes<32>.
11676
11677 2010-01-13  Doug Kwan  <dougkwan@google.com>
11678
11679         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11680         Arm_relobj::section_needs_cortex_a8_stub_scanning,
11681         Arm_relobj::scan_section_for_cortex_a8_erratum,
11682         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
11683         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
11684         sections to scan for relocation stubs into a new method
11685         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
11686         relocation and Cortex-A8 stub scanning.
11687         (Target_arm::do_relax): Force stubs to be after stubbed sections
11688         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
11689         the beginning of a new relaxation pass.  Update a comment.
11690         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
11691
11692 2010-01-12  Ian Lance Taylor  <iant@google.com>
11693
11694         * target-reloc.h (visibility_error): New inline function.
11695         (relocate_section): Call visibility_error.
11696         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
11697         (MOSTLYCLEANFILES): Likewise.
11698         (protected_4_pic.o, protected_3.err): New targets.
11699         * testsuite/protected_4.cc: New file.
11700
11701 2010-01-12  Doug Kwan  <dougkwan@google.com>
11702
11703         * arm.cc (Cortex_a8_reloc): New class.
11704         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
11705         and cortex_a8_relocs_info_.
11706         (Target_arm::fix_cortex_a8): New method definition.
11707         (Target_arm::Cortex_a8_relocs_info): New type.
11708         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
11709         New data member declarations.
11710         (Target_arm::scan_reloc_for_stub): Record information about
11711         relocations for THUMB branches that might be exempted from the
11712         Cortex-A8 workaround.
11713         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
11714         at the beginning of a relaxation pass.
11715
11716 2010-01-12  Doug Kwan  <dougkwan@google.com>
11717
11718         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
11719         (Arm_relobj::Mapping_symbol_position,
11720          Arm_reloj::Mapping_symbol_position_less,
11721          Arm_relobj::Mapping_symbols_info): New types.
11722         (Target_arm::is_mapping_symbol_name): New method definition.
11723         (Arm_relobj::do_count_local_symbols): Save information about mapping
11724         symbols.
11725
11726 2010-01-11  Doug Kwan  <dougkwan@google.com>
11727
11728         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
11729         Arm_relocate_functions::thumb32_branch_upper,
11730         Arm_relocate_functions::thumb32_branch_lower,
11731         Arm_relocate_functions::thumb32_cond_branch_offset,
11732         Arm_relocate_functions::thumb32_cond_branch_upper,
11733         Arm_relocate_functions::thumb32_cond_branch_lower,
11734         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
11735         branch offset encoding.
11736         (Arm_relocate_functions::thumb_branch_common): Use new branch
11737         offset encoding methods to avoid code duplication.
11738         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
11739         (Stub_addend_reader::operator()): Use new branch encoding method
11740         to avoid code duplication.
11741
11742 2010-01-11  Doug Kwan  <dougkwan@google.com>
11743
11744         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
11745         (Target_arm::do_finalize_sections): Define special EXIDX section
11746         symbols only if referenced.
11747         * gc.h (Garbage_collection::add_reference): New method.
11748         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
11749         code duplication.
11750
11751 2010-01-11  Ian Lance Taylor  <iant@google.com>
11752
11753         * script.cc (Version_script_info::build_expression_list_lookup):
11754         Change complaing about duplicate wildcard match from error to
11755         warning.
11756
11757         * script.cc (class Lazy_demangler): Recreate--revert part of patch
11758         of 2009-12-30.
11759         (Version_script_info::Version_script_info): Initialize globs_,
11760         default_version_, default_is_global_, and exact_.  Don't
11761         initialize globals_ or locals_.
11762         (Version_script_info::build_lookup_tables): Build local symbols
11763         first.
11764         (Version_script_info::unquote): New function.
11765         (Version_script_info::add_exact_match): New function.
11766         (Version_script_info::build_expression_list_lookup): Remove lookup
11767         parameter.  Add is_global parameter.  Change all callers.  Handle
11768         wildcard pattern specially.  Unquote pattern.  Call
11769         add_exact_match.
11770         (Version_script_info::get_name_to_match): New function.
11771         (Version_script_info::get_symbol_version): New function.
11772         (Version_script_info::get_symbol_version_helper): Remove.
11773         (Version_script_info::check_unmatched_names): Call unquote.
11774         * script.h (class Version_script_info): Change get_symbol_version
11775         to be non-inline and add is_global parameter; change all callers.
11776         Rewrite symbol_is_local.  Update declarations.  Define struct
11777         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
11778         Remove globals_ and locals_ members.  Add exact_, globs_,
11779         default_version_, is_global_.
11780         (Version_script_info::Glob): Remove pattern, add expression and
11781         is_global.  Update constructor.  Change all callers.
11782         * dynobj.cc (Versions::finalize): Mark the version symbol as the
11783         default version.
11784         (Versions::symbol_section_contents): If a symbol is undefined, or
11785         defined in a dynamic object, set the version index to
11786         VER_NDX_LOCAL.
11787         * symtab.cc (Symbol_table::add_from_relobj): Don't call
11788         symbol_is_local.
11789         (Symbol_table::add_from_pluginobj): Likewise.
11790         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
11791
11792 2010-01-11  Doug Kwan  <dougkwan@google.com>
11793
11794         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
11795         (incremental_dump_LDADD): Add linking option for libintl.
11796         * Makefile.in: Regenerate.
11797
11798 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
11799
11800         PR gold/11144
11801         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
11802         instead of -Ds.
11803         * testsuite/Makefile.in: Regenerated.
11804
11805 2010-01-10  Doug Kwan  <dougkwan@google.com>
11806
11807         * options.h (DEFINE_var): Use parentheses around argument varname__
11808         in macro body to avoid any unintended subsequent substitutions.
11809
11810 2010-01-10  Ian Lance Taylor  <iant@google.com>
11811
11812         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
11813         candidates before doing symbol resolution.
11814
11815         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
11816         ODR candidates if only one is weak.
11817
11818 2010-01-08  Ian Lance Taylor  <iant@google.com>
11819
11820         * script.cc (Version_script_info::build_expression_list_lookup):
11821         Don't warn about ambiguous version, just record the ambiguity.
11822         (Version_script_info::get_symbol_version_helper): Give error if
11823         version is ambiguous.
11824
11825 2010-01-08  Doug Kwan  <dougkwan@google.com>
11826
11827         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
11828         prev_data_size_ and prev_addralign_.  Remove initializer for
11829         deleted data member has_been_changed_.
11830         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
11831         to determine if the table is empty.
11832         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
11833         Remove.
11834         (Stub_table::add_reloc_stub): Define method in class definition
11835         instead of just declaring it there.
11836         (Stub_table::add_cortex_a8_stub): New method definition.
11837         (Stub_table::update_data_size_and_addralign): Ditto.
11838         (Stub_table::finalize_stubs): Ditto.
11839         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
11840         (Stub_table::do_addralign_): Return address alignment in the
11841         (Stub_table::do_reset_address_and_file_offset): Define method in
11842         class definition instead of declaring it there.  Set current data
11843         size to be the data size of the previous pass.
11844         (Stub_table::set_final_data_size): Use current data size as the
11845         final data size.
11846         (Stub_table::relocate_stub): Change parameter type of stub from
11847         Reloc_stub pointer to Stub pointer.
11848         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
11849         (Stub_table::Cortex_a8_stub_list): New typedef.
11850         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
11851          Stub_table::prev_addralign_): New data member.
11852         (Arm_relobj::Arm_relobj): Initialize data member
11853         section_has_cortex_a8_workaround_.
11854         (Arm_relobj::section_has_cortex_a8_workaround,
11855          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
11856          definitions.
11857         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
11858         declarations.
11859         (Target_arm::relocate_stub): Change parameter type of stub from
11860         Reloc_stub pointer to Stub pointer.
11861         (Insn_template::size, Insn_template::alignment): Handle
11862         THUMB16_SPECIAL_TYPE.
11863         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
11864          Stub_table::update_data_size_and_addralign,
11865          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
11866         definitions.
11867         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
11868         (Stub_table::do_write): Ditto.
11869         (Target_arm::do_relax): Adjust code for changes in Stub_table.
11870
11871 2010-01-08  Ian Lance Taylor  <iant@google.com>
11872
11873         PR 11108
11874         * symtab.h (class Symbol): Remove fields is_target_special_ and
11875         has_plt_offset_.  Add field is_defined_in_discarded_section_.
11876         (Symbol::is_defined_in_discarded_section): New function.
11877         (Symbol::set_is_defined_in_discarded_section): New function.
11878         (Symbol::has_plt_offset): Rewrite.
11879         (Symbol::set_plt_offset): Verify that new offset is not -1U.
11880         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
11881         Don't initialize is_target_special_ or has_plt_offset_.
11882         Initialize is_defined_in_discarded_section_.
11883         (Symbol_table::add_from_relobj): If appropriate, set
11884         is_defined_in_discarded_section.
11885         * resolve.cc (Symbol::override_base_with_special): Don't test
11886         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
11887         * target-reloc.h (relocate_section): Do special handling for
11888         symbols defined in discarded sections for global symbols as well
11889         as local symbols.
11890
11891 2010-01-08  Ian Lance Taylor  <iant@google.com>
11892
11893         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
11894         the SHT_SYMTAB case.
11895
11896 2010-01-08  Ian Lance Taylor  <iant@google.com>
11897
11898         * object.cc (Sized_relobj::do_layout): Don't get confused if
11899         layout_eh_frame returns NULL.
11900
11901 2010-01-08  Ian Lance Taylor  <iant@google.com>
11902
11903         PR 11084
11904         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
11905         dynamic symbol table, use the normal symbol table.
11906         (Sized_dynobj::do_read_symbols): Remove assertion about type of
11907         symbol table.
11908
11909 2010-01-08  Ian Lance Taylor  <iant@google.com>
11910
11911         PR 11072
11912         * layout.cc (Layout::include_section): Remove .gnu_debuglink
11913         sections.
11914
11915 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
11916
11917         * version.cc (print_version): Change to "Copyright 2010".
11918
11919 2010-01-08  Ian Lance Taylor  <iant@google.com>
11920
11921         PR 10287
11922         PR 11063
11923         * i386.cc (class Target_i386): Change return type of plt_section
11924         to be non-const.
11925         (class Output_data_plt_i386): Add tls_desc_rel_ field.
11926         (Output_data_plt_i386::Output_data_plt_i386): Initialize
11927         tls_desc_rel_ field.
11928         (Output_data_plt_i386::rel_tls_desc): New function.
11929         (Target_i386::rel_tls_desc_section): New function.
11930         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
11931         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
11932         R_386_TLS_DESC reloc in rel_tls_desc_section.
11933         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
11934         Define struct Tlsdesc_info.
11935         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
11936         (Target_x86_64::do_reloc_symbol_index): New function.
11937         (Target_x86_64::add_tlsdesc_info): New function.
11938         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
11939         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
11940         tlsdesc_rel_ field.
11941         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
11942         all callers.
11943         (Output_data_plt_x86_64::rela_tlsdesc): New function.
11944         (Target_x86_64::rela_tlsdesc_section): New function.
11945         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
11946         handling.
11947         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
11948         (Target_x86_64::do_reloc_addend): New function.
11949         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
11950         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
11951         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
11952         (Output_reloc::type): New function.
11953         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
11954         (Output_reloc::is_target_specific): New function.
11955         (Output_reloc::target_arg): New function.
11956         (class Output_reloc) [SHT_RELA]: Add four new constructors for
11957         absolute relocs and target specific relocs.
11958         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
11959         add_target_specific.
11960         (class Output_data_reloc) [SHT_RELA]: Likewise.
11961         * output.cc (Output_reloc::Output_reloc): Add four new versions
11962         for absolute relocs and target specific relocs.
11963         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
11964         (Output_reloc::get_symbol_index): Likewise.
11965         (Output_reloc::local_section_offset): Check that local_sym_index_
11966         is not TARGET_CODE or 0.
11967         (Output_reloc::symbol_value): Likewise.
11968         (Output_reloc::write) [SHT_RELA]: Call target for target specific
11969         reloc.
11970         * target.h (class Target): Add reloc_symbol_index and reloc_addend
11971         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
11972         functions.
11973         * layout.cc (add_target_dynamic_tags): Use output section for
11974         DT_PLTRELSZ and DT_JMPREL.
11975
11976 2010-01-07  Ian Lance Taylor  <iant@google.com>
11977
11978         PR 11061
11979         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
11980         function.
11981         (class Output_data_reloc_generic): Define.
11982         (class Output_data_reloc_base): Change base class to
11983         Output_data_reloc_generic.  Change add() method to call
11984         bump_relative_reloc_count for a relative reloc.  Remove
11985         sort_relocs_ field.
11986         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
11987         to sort_relocs().
11988         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
11989         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
11990         appropriate.
11991         * layout.h (class Layout): Update declaration.
11992
11993 2010-01-07  Ian Lance Taylor  <iant@google.com>
11994
11995         * output.h (class Output_data): Add const version of
11996         output_section and do_output_section.
11997         (class Output_section_data): Add const version of
11998         do_output_section.
11999         (class Output_section): Likewise.
12000         * layout.cc (Layout::add_target_dynamic_tags): New function.
12001         * layout.h (class Layout): Update declarations.
12002         * arm.cc (Target_arm::do_finalize_sections): Use
12003         add_target_dynamic_tags.
12004         * i386.cc (Target_i386::do_finalize_sections): Likewise.
12005         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12006         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12007         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12008
12009 2010-01-07  Ian Lance Taylor  <iant@google.com>
12010
12011         PR 11042
12012         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
12013         object as needed.
12014
12015 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
12016             Ian Lance Taylor  <iant@google.com>
12017
12018         PR 11019
12019         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
12020         Xindex::read_symtab_xindex.
12021
12022 2010-01-07  Doug Kwan  <dougkwan@google.com>
12023
12024         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
12025         (Insn_template::thumb16_bcond_insn): New method declaration.
12026         (Insn_template): Fix spelling.
12027         (Stub::thumb16_special): New method declaration.
12028         (Stub::do_write): Define virtual method which was previously pure
12029         virtual.
12030         (Stub::do_thumb16_special): New method declaration.
12031         (Stub::do_fixed_endian_write): New template member.
12032         (Reloc_stub::do_write): Remove.
12033         (Reloc_stub::do_fixed_endian_write): Remove.
12034         (Cortex_a8_stub): New class definition.
12035         (Stub_factory::make_cortex_a8_stub): New method definition.
12036         (Stub_factory::Stub_factory): Add missing static storage class
12037         qualifier for elf32_arm_stub_a8_veneer_blx.
12038
12039 2010-01-07  Ian Lance Taylor  <iant@google.com>
12040
12041         PR 10980
12042         * options.h (class General_options): Add --warn-unresolved-symbols
12043         and --error-unresolved-symbols.
12044         * errors.cc (Errors::undefined_symbol): Implement
12045         --warn-unresolved-symbols.
12046
12047         * options.h (class General_options): Add -z text and -z textoff.
12048         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
12049
12050 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
12051
12052         * gc.h (Garbage_collection::Cident_section_map): New typedef.
12053         (Garbage_collection::cident_sections): New function.
12054         (Garbage_collection::add_cident_section): New function.
12055         (Garbage_collection::cident_sections_): New member.
12056         (gc_process_relocs): Add references to sections whose names are C
12057         identifiers.
12058         * gold.h (cident_section_start_prefix): New constant.
12059         (cident_section_stop_prefix): New constant.
12060         (is_cident): New function.
12061         * layout.cc (Layout::define_section_symbols): Replace string constants
12062         with the newly defined constants.
12063         * object.cc (Sized_relobj::do_layout): Track sections whose names are
12064         C identifiers.
12065         * testsuite/Makefile.am: Add gc_orphan_section_test.
12066         * testsuite/Makefile.in: Regenerate.
12067         * testsuite/gc_orphan_section_test.cc: New file.
12068         * testsuite/gc_orphan_section_test.sh: New file.
12069
12070 2010-01-06  Ian Lance Taylor  <iant@google.com>
12071
12072         PR 10980
12073         * options.h (class General_options): Add --warn-shared-textrel.
12074         * layout.cc (Layout::finish_dynamic_section): Implement
12075         --warn-shared-textrel.
12076
12077         PR 10980
12078         * options.h (class General_options): Add --warn-multiple-gp.
12079
12080 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12081
12082         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
12083         $(THREADSLIB) and $(LIBDL).
12084         * Makefile.in: Rebuild.
12085
12086 2010-01-06  Ian Lance Taylor  <iant@google.com>
12087
12088         PR 10980
12089         * options.cc (General_options::parse_section_start): New function.
12090         (General_options::section_start): New function.
12091         (General_options::General_options): Initialize all members.
12092         * options.h: Include <map>
12093         (class General_options): Add --section-start.  Add section_starts_
12094         member.
12095         * layout.cc (Layout::attach_allocated_section_to_segment): If
12096         --section-start was used, set the address of the segment.  Remove
12097         local sort_sections.
12098         (Layout::relaxation_loop_body): If the address of the load segment
12099         has been set by --section-start, don't use it.
12100         * output.h (Output_segment::update_flags_for_output_section): New
12101         function.
12102         * output.cc (Output_segment::add_output_section): Call
12103         update_flags_for_output_section.
12104
12105 2010-01-05  Ian Lance Taylor  <iant@google.com>
12106
12107         PR 10980
12108         * options.h (class General_options): Add --undefined-version.
12109         * script.cc (struct Version_expression): Add was_matched_by_symbol
12110         field.
12111         (Version_script_info::matched_symbol): New function.
12112         (Version_script_info::get_symbol_version_helper): Call
12113         matched_symbol.
12114         (Version_script_info::check_unmatched_names): New function.
12115         * script.h (class Version_script_info): Update declarations.
12116         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
12117
12118         * options.h (class General_options): Use DEFINE_bool_alias for
12119         allow_multiple_definition.
12120         * resolve.cc (Symbol_table::should_override): Don't test
12121         allow_multiple_definition.
12122
12123         PR 10980
12124         * options.h (class General_options): Add --cref.
12125         * main.cc (main): Print cref table if --cref.  Don't close mapfile
12126         until after printing cref table.
12127         * cref.cc: Include "symtab.h".
12128         (class Cref_inputs): Define Cref_table_compare and Cref_table.
12129         (Cref_table_compare::operator()): New function.
12130         (Cref_inputs::gather_cref): New function.
12131         (filecol): New static const.
12132         (Cref_inputs::print_cref): New function.
12133         (Cref::print_cref): New function.
12134         * cref.h: Include <cstdio>.
12135         (class Cref): Update declarations.
12136         * mapfile.h (Mapfile::file): New function.
12137         * object.h (class Object): Define Symbols.  Declare virtual
12138         do_get_global_symbols.
12139         (Object::get_global_symbols): New function.
12140         * object.cc (Input_objects::add_object): Pass object to cref_ if
12141         --cref.
12142         (Input_objects::archive_start): Likewise.
12143         (Input_objects::archive_stop): Likewise.
12144         (Input_objects::print_cref): New function.
12145         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
12146         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
12147         --cref.
12148         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
12149         function.
12150         * plugin.h (class Sized_pluginobj): Update declarations.
12151
12152 2010-01-05  Ian Lance Taylor  <iant@google.com>
12153
12154         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
12155         to is_default_version.  Rename insdef to insdefault.
12156         (Symbol_table::add_from_relobj): Rename def to is_default_version
12157         and local to is_forced_local.
12158         (Symbol_table::add_from_pluginobj): Likewise.
12159         (Symbol_table::add_from_dynobj): Likewise.
12160         (Symbol_table::define_special_symbol): Rename insdef to
12161         insdefault.
12162
12163 2010-01-04  Ian Lance Taylor  <iant@google.com>
12164
12165         PR 10980
12166         * options.h (class General_options): Add
12167         --allow-multiple-definition and -z muldefs.
12168         * resolve.cc (Symbol_table::should_override): Don't warn about a
12169         multiple symbol definition if --allow-multiple-definition or -z
12170         muldefs.
12171
12172         PR 10980
12173         * options.h (class General_options): Add --add-needed and
12174         --copy-dt-needed-entries.  Tweak --as-needed help entry.
12175         * object.cc (Input_objects::check_dynamic_dependencies): Give an
12176         error if --copy-dt-needed-entries aka --add-needed is used and
12177         would cause a change in behaviour.
12178
12179         PR 10980
12180         * options.h (class General_options): Add -G as a short version of
12181         --shared.  Add no-op options -assert, -g, and -i.
12182
12183 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
12184
12185         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
12186         check for .text or .gnu.linkonce.t sections.
12187         * icf.cc (Icf::find_identical_sections): Ditto.
12188         Change the detection for mangled function name within the section
12189         name.
12190         * icf.h (is_section_foldable_candidate): New function.
12191
12192 2009-12-30  Ian Lance Taylor  <iant@google.com>
12193
12194         PR 10980
12195         * options.h (class General_options): Permit two dashes with
12196         --retain-symbols-file.
12197
12198 2009-12-30  Ian Lance Taylor  <iant@google.com>
12199
12200         PR 10979
12201         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
12202         don't put the file header and segment headers in the text
12203         segment.
12204
12205         PR 10979
12206         * common.cc (Sort_commons::operator()): Stabilize sort when both
12207         entries are NULL.
12208         (Symbol_table::do_allocate_commons_list): When allocating common
12209         symbols, skip a symbol which is no longer common.
12210         * symtab.h (Symbol::is_common): Test whether the symbol comes from
12211         an object before checking its type.
12212         * testsuite/common_test_2.c: New file.
12213         * testsuite/common_test_3.c: New file.
12214         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
12215         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
12216         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
12217         (common_test_2_pic.o, common_test_2.so): New targets.
12218         (common_test_3_pic.o, common_test_3.so): New targets.
12219         * testsuite/Makefile.in: Rebuild.
12220
12221         PR 10979
12222         * script.cc (read_input_script): If we see a new SECTIONS clause,
12223         and we have added an input section, give an error.
12224         * layout.h (class Layout): Add have_added_input_section function.
12225         Add have_added_input_section_ field.
12226         * layout.cc (Layout::Layout): Initialize
12227         have_added_input_section_.
12228         (Layout::layout): Set have_added_input_section_.
12229         (Layout::layout_eh_frame): Likewise.
12230
12231 2009-12-30  Ian Lance Taylor  <iant@google.com>
12232
12233         PR 10931
12234         * options.h (class General_options): Add --sort-common option.
12235         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
12236         * common.cc (Sort_common): Add sort_order parameter to
12237         constructor.  Add sort_order_ field.
12238         (Sort_commons::operator): Check sort_order_.
12239         (Symbol_table::allocate_commons): Determine the sort order.
12240         (Symbol_table::do_allocate_commons): Add sort_order parameter.
12241         Change all callers.
12242         (Symbol_table::do_allocate_commons_list): Likewise.
12243
12244 2009-12-30  Ian Lance Taylor  <iant@google.com>
12245
12246         PR 10916
12247         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
12248         symbols from this object, don't change the visibility of an
12249         undefined symbol.
12250         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
12251
12252 2009-12-30  Ian Lance Taylor  <iant@google.com>
12253
12254         PR 10861
12255         * script.h (class Version_script_info): Define Language enum.
12256         Update declarations.  Define Glob, Exact, and Lookup types.  Add
12257         new fields globals_, locals_, and is_finalized_.
12258         * script.cc: Various formatting fixes.
12259         (class Parser_closure): Change language_stack_ from a vector of
12260         std::string to one of Version_script_info::Language.  Adjust all
12261         uses accordingly.
12262         (class Lazy_demangler): Remove.
12263         (struct Version_expression): Change language from std::string to
12264         Version_script_info::Language.
12265         (Version_script_info::Version_script_info): New function.
12266         (Version_script_info::~Version_script_info): Don't call clear.
12267         (Version_script_info::finalize): New function.
12268         (Version_script_info::build_lookup_tables): New function.
12269         (Version_script_info::build_expression_list_lookup): New
12270         function.
12271         (Version_script_info::get_symbol_version_helper): Rewrite to use
12272         lookup tables.
12273         (Version_script_info::print_expression_list): Adjust to use
12274         Version_script_info::Language.
12275         (script_push_lex_into_version_mode): Check that the version script
12276         has not been finalized.
12277         (version_script_push_lang): Change language string to
12278         Version_script_info::Language.
12279         * options.cc (Command_line::version_script): New function.
12280         * options.h (class General_options): Add finalize_dynamic_list
12281         function.  Change version_script from declaration to definition.
12282         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
12283         * testsuite/version_script.map: Remove duplicate def of foo.
12284         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
12285         version_script.map.
12286         * testsuite/Makefile.in: Rebuild.
12287
12288 2009-12-30  Ian Lance Taylor  <iant@google.com>
12289
12290         PR 10843
12291         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
12292         if the input symbol index is 0, make the output symbol index 0.
12293
12294 2009-12-30  Ian Lance Taylor  <iant@google.com>
12295
12296         PR 10670
12297         * options.h (class General_options): Add -x/--discard-all.
12298         * object.cc (Sized_relobj::do_count_local_symbols): Handle
12299         --discard-all.  If the local symbol needs a dynamic entry, check
12300         that before handling --discard-locals.
12301
12302 2009-12-30  Ian Lance Taylor  <iant@google.com>
12303
12304         PR 10450
12305         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
12306         flags to PF_R.
12307         (Output_segment::add_output_section): Don't change the flags if
12308         the type is PT_TLS.
12309
12310         PR 10450
12311         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
12312         GNU hash table if they need a dynamic value.  Otherwise, don't add
12313         them if they are defined in a dynamic object or are forced local.
12314
12315 2009-12-29  Ian Lance Taylor  <iant@google.com>
12316
12317         PR 10450
12318         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
12319         .gnu.hash table for a 32-bit target.
12320
12321         PR 10450
12322         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
12323         regular and a dynamic object only needs a dynamic symbol table
12324         entry if it is externally visible.
12325
12326         PR 10450
12327         * i386.cc (class Target_i386): Initialize global_offset_table_ in
12328         constructor.  Add global_offset_table_ field.
12329         (Target_i386::got_section): Set global_offset_table_.
12330         (Target_i386::do_finalize_sections): Set global_offset_table_
12331         size.
12332         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
12333         in constructor.  Add global_offset_table_ field.
12334         (Target_x86_64::got_section): Set global_offset_table_.
12335         (Target_x86_64::do_finalize_sections): Set global_offset_table_
12336         size.
12337
12338         * layout.cc (Layout::Layout): Initialize increase_relro_.
12339         (Layout::get_output_section): Add is_relro, is_last_relro, and
12340         is_first_non_relro parameters.  Change all callers.
12341         (Layout::choose_output_section): Likewise.
12342         (Layout::add_output_section_data): Likewise.
12343         (Layout::make_output_section): Likewise.
12344         (Layout::set_segment_offsets): Clear increase_relro when using a
12345         linker script.
12346         * layout.h (class Layout): Add increase_relro method.  Add
12347         increase_relro_ field.  Update declarations.
12348         * output.cc (Output_section::Output_section): Initialize
12349         is_last_relro_ and is_first_non_relro_.
12350         (Output_segment::add_output_section): Group relro sections is
12351         do_sort is true.  Handle is_last_relro and is_first_non_relro.
12352         (Output_segment::maximum_alignment): Remove relro handling.
12353         (Output_segment::set_section_addresses): Add increase_relro
12354         parameter.  Change all callers.  Add initial alignment to align
12355         relro sections on separate page.  Remove old relro handling.
12356         (Output_segment::set_section_list_addresses): Remove in_relro
12357         parameter.  Change all callers.
12358         (Output_segment::set_offset): Add increase parameter.  Change all
12359         callers.  Remove old relro handling.
12360         * output.h (class Output_section): Add new methods: is_last_relro,
12361         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
12362         Add is_last_relro_ and is_first_non_relro_ fields.
12363         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
12364         Create separate .got.plt section.  Call increase_relro.
12365         * x86_64.cc (Target_x86_64::got_section): Likewise.
12366         * testsuite/relro_script_test.t: Add .got.plt.
12367
12368         PR 10450
12369         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
12370         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
12371         (Layout::finalize): Call set_dynamic_symbol_size.
12372         (Layout::set_dynamic_symbol_size): New function.
12373         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
12374         set_dynamic_symbol_size.
12375
12376         PR 10450
12377         * output.h (class Output_section): Add is_entsize_zero_ field.
12378         * output.cc (Output_section::Output_section): Initialize
12379         is_entsize_zero_.
12380         (Output_section::set_entsize): If two different entsizes are
12381         requested, force it to zero.
12382         (Output_section::add_input_section): Set flags for .debug_str
12383         before updating section flags.  Set entsize.
12384         (Output_section::update_flags_for_input_section): Set SHF_MERGE
12385         and SHF_STRING if all input sections have those flags.
12386
12387 2009-12-29   Rafael Espindola  <espindola@google.com>
12388
12389         * main.cc (main): Fix the sys time reporting.
12390         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
12391         reporting.
12392
12393 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
12394
12395         * options.cc (General_options::parse_version): Allow -v to exit
12396         without an error if there is nothing to link.
12397
12398 2009-12-29  Ian Lance Taylor  <iant@google.com>
12399
12400         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
12401         using a version of gcc before 4.1.
12402         * configure: Rebuild.
12403
12404 2009-12-28  Chris Demetriou  <cgd@google.com>
12405
12406         * attributes.cc (Output_attributes_section_data::do_write): Use
12407         std::vector::front rather than std::vector::data.
12408
12409 2009-12-28  Ian Lance Taylor  <iant@google.com>
12410
12411         * symtab.h (class Symbol_table): Add enum Defined.
12412         * resolve.cc (Symbol_table::should_override): Add defined
12413         parameter.  Change all callers.  Test whether object is NULL
12414         before calling a method on it.
12415         (Symbol_table::report_resolve_problem): Add defined parameter.
12416         Change all callers.
12417         (Symbol_table::should_override_with_special): Likewise.
12418         * symtab.cc (Symbol_table::define_in_output_data): Add defined
12419         parameter.  Change all callers.
12420         (Symbol_table::do_define_in_output_data): Likewise.
12421         (Symbol_table::define_in_output_segment): Likewise.
12422         (Symbol_table::do_define_in_output_segment): Likewise.
12423         (Symbol_table::define_as_constant): Likewise.
12424         (Symbol_table::do_define_as_constant): Likewise.
12425         * script.h (class Symbol_assignment): Add is_defsym parameter to
12426         constructor; change all callers.
12427         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
12428         parameter.  Change all callers.  Add is_defsym_ field.
12429         (class Parser_closure): Add parsing_defsym parameter to
12430         constructor; change all callers.  Add parsing_defsym accessor
12431         function.  Add parsing_defsym_ field.
12432
12433 2009-12-28  Ian Lance Taylor  <iant@google.com>
12434
12435         * gold.cc (queue_middle_tasks): Fix formatting.
12436         * object.cc (Relobj::is_section_name_included): Likewise.
12437
12438 2009-12-23  Ian Lance Taylor  <iant@google.com>
12439
12440         * i386.cc (Target_i386::do_calls_non_split): Recognize
12441         -fsplit-stack prologue for a function with a static chain.
12442         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
12443         -fsplit-stack prologue when using %r11.
12444
12445 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
12446
12447         * options.cc (General_options::parse_version): Make -v continue and do
12448         the link like GNU ld does.
12449
12450 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
12451
12452         * Makefile.am (CCFILES): Add timer.cc.
12453         (HFILES): Add timer.h.
12454         * configure.ac: Check for sysconf and times.
12455         * main.cc: include timer.h.
12456         (main): Use Timer instead of get_run_time.
12457         * timer.cc: New.
12458         * timer.h: New.
12459         * workqueue.cc: include timer.h.
12460         (Workqueue::find_and_run_task):
12461         Report user, sys and wall time.
12462         * Makefile.in: Regenerate.
12463         * config.in: Regenerate.
12464         * configure: Regenerate.
12465
12466 2009-12-16  Doug Kwan  <dougkwan@google.com>
12467
12468         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
12469         sections.
12470         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
12471         relaxed input sections.
12472         * output.cc (Output_section::find_relaxed_input_section): Change
12473         return type to Output_relaxed_input_section pointer.  Adjust code
12474         for new type of relaxed_input_section_map_.
12475         * output.h (Output_section::find_relaxed_input_section): Change
12476         return type to Output_relaxed_input_section pointer.
12477         (Output_section::Output_relaxed_input_section_by_input_section_map):
12478         New type.
12479         (Output_section::relaxed_input_section_map_): Change type to
12480         Output_section::Output_relaxed_input_section_by_input_section_map.
12481         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
12482         input section.
12483
12484 2009-12-15  Ian Lance Taylor  <iant@google.com>
12485
12486         * layout.cc (Layout::create_shstrtab): Only write out after input
12487         sections if we are compressing debug sections.
12488
12489 2009-12-15  Ian Lance Taylor  <iant@google.com>
12490
12491         * archive.cc (Archive::add_symbols): Only look up a symbol without
12492         a version if there is, in fact, a version.
12493
12494 2009-12-14  Ian Lance Taylor  <iant@google.com>
12495
12496         Revert -Wshadow changes, all changes from:
12497         2009-12-11  Doug Kwan  <dougkwan@google.com>
12498         2009-12-11  Nick Clifton  <nickc@redhat.com>
12499         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
12500
12501 2009-12-11  Doug Kwan  <dougkwan@google.com>
12502
12503         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
12504         due to -Wshadow.
12505         * attributes.cc (Object_attribute::size): Ditto.
12506         (Attributes_section_data::size): Ditto.
12507         (Attributes_section_data::Attributes_section_data): Ditto.
12508         (Output_attributes_section_data::do_write): Ditto.
12509         * attributes.h (Object_attribute::set_type): Ditto.
12510         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
12511
12512 2009-12-11  Nick Clifton  <nickc@redhat.com>
12513
12514         * archive.cc: Fix shadowed variable warnings.
12515         * arm.cc: Likewise.
12516         * compressed_output.cc: Likewise.
12517         * compressed_output.h: Likewise.
12518         * configure: Likewise.
12519         * dwarf_reader.cc: Likewise.
12520         * dynobj.cc: Likewise.
12521         * dynobj.h: Likewise.
12522         * ehframe.cc: Likewise.
12523         * ehframe.h: Likewise.
12524         * errors.cc: Likewise.
12525         * expression.cc: Likewise.
12526         * fileread.cc: Likewise.
12527         * fileread.h: Likewise.
12528         * freebsd.h: Likewise.
12529         * i386.cc: Likewise.
12530         * icf.cc: Likewise.
12531         * incremental.h: Likewise.
12532         * layout.cc: Likewise.
12533         * layout.h: Likewise.
12534         * mapfile.cc: Likewise.
12535         * merge.cc: Likewise.
12536         * merge.h: Likewise.
12537         * object.cc: Likewise.
12538         * object.h: Likewise.
12539         * options.h: Likewise.
12540         * output.cc: Likewise.
12541         * output.h: Likewise.
12542         * parameters.cc: Likewise.
12543         * plugin.cc: Likewise.
12544         * powerpc.cc: Likewise.
12545         * reduced_debug_output.cc: Likewise.
12546         * reduced_debug_output.h: Likewise.
12547         * reloc.cc: Likewise.
12548         * reloc.h: Likewise.
12549         * resolve.cc: Likewise.
12550         * script-sections.cc: Likewise.
12551         * script.cc: Likewise.
12552         * script.h: Likewise.
12553         * sparc.cc: Likewise.
12554         * symtab.cc: Likewise.
12555         * symtab.h: Likewise.
12556         * target-select.cc: Likewise.
12557         * target-select.h: Likewise.
12558         * token.h: Likewise.
12559         * workqueue.cc: Likewise.
12560         * workqueue.h: Likewise.
12561         * x86_64.cc: Likewise.
12562
12563 2009-12-10  Doug Kwan  <dougkwan@google.com>
12564
12565         * arm.cc (attributes.h): New include.
12566         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
12567         (Arm_relobj::~Arm_relobj): Delete object pointed by
12568         attributes_section_data_.
12569         (Arm_relobj::attributes_section_data): New method definition.
12570         (Arm_relobj::attributes_section_data_): New data member declaration.
12571         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
12572         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
12573         attributes_section_data_.
12574         (Arm_dynobj::attributes_section_data): New method definition.
12575         (Arm_dynobj::attributes_section_data_): New data member declaration.
12576         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
12577         initialization value of may_use_blx_ to false.
12578         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
12579         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
12580         object attributes to compute results instead of hard-coding.
12581         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
12582         Target_arm::get_secondary_compatible_arch,
12583         Target_arm::set_secondary_compatible_arch
12584         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12585         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
12586         New method declarations.
12587         (Target_arm::get_aeabi_object_attribute): New method definition.
12588         (Target_arm::attributes_section_data_): New data member declaration.
12589         (read_arm_attributes_section): New template definition.
12590         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
12591         (Arm_dynobj::do_read_symbols): Ditto.
12592         (Target_arm::do_finalize_sections): Merge attributes sections from
12593         input.  Check for BLX use after attributes section merging.
12594         Fix __exidx_start and __exidx_end visibility.  Create an
12595         .ARM.attributes section if necessary.
12596         (Target_arm::get_secondary_compatible_arch,
12597         Target_arm::set_secondary_compatible_arch,
12598         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12599         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
12600         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
12601         New method definitions.
12602
12603 2009-12-09  Ian Lance Taylor  <iant@google.com>
12604
12605         * plugin.cc (Plugin::load): Don't cast from void* to a function
12606         pointer.
12607
12608 2009-12-09  Ian Lance Taylor  <iant@google.com>
12609
12610         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
12611         information fields.
12612
12613 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
12614
12615         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
12616         Replace two_file_shared_1.so with two_file_shared_2.so.
12617         * testsuite/Makefile.in: Regenerated.
12618
12619 2009-12-08  Doug Kwan  <dougkwan@google.com>
12620
12621         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
12622         (HFILES): Add attributes.h and int_encoding.h.
12623         * Makefile.in: Regenerate.
12624         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
12625         function definitions to int_encoding.cc
12626         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
12627         prototypes to int_encoding.h
12628         * reduced_debug_output.cc (int_encoding.h): New include.
12629         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
12630         function definitions to int_encoding.cc
12631         (insert_into_vector, read_from_pointer): Move template definitions to
12632         int_encoding.h
12633         * attributes.cc: New file.
12634         * attributes.h: New file.
12635         * int_encoding.cc: New file.
12636         * int_encoding.h: New file.
12637
12638 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
12639
12640         PR gold/11055
12641         * incremental-dump.cc (dump_incremental_inputs): New.
12642         (main): Use dump_incremental_inputs.
12643
12644 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
12645
12646         PR gold/10893
12647         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
12648         checking elfcpp::STT_FUNC.
12649         (Target_i386::Relocate::relocate): Likewise.
12650         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
12651
12652         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
12653         symbols from shared libraries into normal FUNC symbols.
12654
12655         * symtab.h (Symbol): Add is_func and use it.
12656
12657 2009-12-05  Doug Kwan  <dougkwan@google.com>
12658
12659         * arm.cc (Target_arm::arm_info): Initialize new fields
12660         attributes_section and attributes_vendor.
12661         * i386.cc (Target_i386::i386_info): Same.
12662         * object.cc (Sized_relobj::do_layout): Skip attribute section.
12663         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
12664         fields attributes_section and attributes_vendor.
12665         * sparc.cc (Target_sparc::sparc_info): Same.
12666         * target.h (Target::attributes_section, Target::attributes_vendor,
12667         Target::is_attributes_section, Target::attribute_arg_type,
12668         Target::attributes_order): New method definitions.
12669         (Target::Target_info::attributes_section,
12670         Target::Target_info::attributes_vendor): New fields.
12671         (Target::do_attribute_arg_type, Target::do_attributes_order): New
12672         virtual method definitions.
12673         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
12674         attributes_section and attributes_vendor.
12675         * testsuite/testfile.cc (Target_test::test_target_info): Same.
12676
12677 2009-12-05  Doug Kwan  <dougkwan@google.com>
12678
12679         * arm.cc: Update comments about interworking and stub generation.
12680         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
12681         considered as non-PIC.
12682         (Arm_relocate_functions::base_abs): Fix formatting.
12683         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
12684         of function to use GOT entry address instead of offset.
12685         (Target_arm::Scan::global): Issue an error if a symbol would need a
12686         PLT does not get one because it is untyped.  Remove code to create
12687         dynamic symbols for relative branches.
12688         (Target_arm::Relocate::relocate: Use 0 instead of false since function
12689         takes unsigned integer instead of boolean.
12690
12691 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
12692
12693         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
12694         (two_file_test_LDADD): Likewise.
12695         (common_test_1_LDADD): Likewise.
12696         (exception_test_LDADD) Likewise.
12697         (weak_test_LDADD): Likewise.
12698         (many_sections_test_LDADD): Likewise.
12699         (initpri1_LDADD): Likewise.
12700         (script_test_1_LDADD): Likewise.
12701         (script_test_2_LDADD): Likewise.
12702         (justsyms_LDADD): Likewise.
12703         (binary_test_LDADD): Likewise.
12704         (large_LDADD): Likewise.
12705         * testsuite/Makefile.in: Regenerated.
12706
12707 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
12708
12709         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
12710         (Symbol_table::override_with_special): Likewise.
12711         (Symbol_table::add_from_object): Likewise.
12712
12713 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12714
12715         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12716         Don't set the data_offset twice.
12717
12718 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12719
12720         * testsuite/Makefile.in: Regenerate.
12721
12722 2009-12-03  Doug Kwan  <dougkwan@google.com>
12723
12724         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
12725         (Target_arm::do_finalize_sections): Add parameter for symbol table
12726         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
12727         * i386.cc (Target_i386::do_finalize_sections): Add an additional
12728         parameter for symbol table pointer.
12729         * layout.cc (Layout::finalize): Call Target::finalize_sections with
12730         an additional parameter for a pointer to symbol table.
12731         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
12732         parameter for a symbol table pointer.
12733         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
12734         * target.h (Target::finalize_sections, Target::do_finalize_sections):
12735         Ditto.
12736         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
12737         parameter for a symbol table pointer.
12738
12739 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
12740
12741         * incremental.cc (Incremental_inputs_header)
12742         (Incremental_inputs_header_write, Incremental_inputs_entry)
12743         (Incremental_inputs_entry_write): Move ...
12744         * incremental.h (Incremental_inputs_header)
12745         (Incremental_inputs_header_write, Incremental_inputs_entry)
12746         (Incremental_inputs_entry_write): here.
12747
12748 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12749
12750         * incremental.cc (make_sized_incremental_binary): Set the target.
12751         Error if it is incompatible.
12752         * output.h (Output_file): Add filename method.
12753
12754 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12755
12756         * incremental.cc (Incremental_inputs_entry): Remove unused argument
12757         from the get_* methods.
12758
12759 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12760
12761         * incremental-dump.cc (main): Check that the offeset of a script is 0.
12762         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12763         Write 0 for the data_offset of scripts.
12764
12765 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12766
12767         * testsuite/Makefile.am: Add the incremental_test.sh test.
12768         * testsuite/incremental_test.sh: New.
12769         * testsuite/incremental_test_1.c: New.
12770         * testsuite/incremental_test_2.c: New.
12771
12772 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
12773
12774         * incremental-dump.cc (main): Fix typos.
12775
12776 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
12777
12778         PR gold/11025
12779         * incremental-dump.cc (main): Use llu to print 64 bit values.
12780
12781 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
12782             H.J. Lu  <hongjiu.lu@intel.com>
12783
12784         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
12785         $(LIBDL).
12786         (incremental_dump_LDADD): Likewise.
12787         * Makefile.in: Regenerated.
12788
12789 2009-11-25  Doug Kwan  <dougkwan@google.com>
12790
12791         Revert:
12792
12793         2009-11-25  Doug Kwan  <dougkwan@google.com>
12794
12795                 * arm.cc (Target_arm::Target_arm): Move method definition
12796                 outside of class definition.  Add code to handle
12797                 --target1-rel, --target1-abs and --target2= options.
12798                 (Target_arm::get_reloc_reloc_type): Change method to be
12799                 non-static and const.
12800                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
12801                 New data member declaration.
12802                 (Target_arm::Scan::local, Target_arm::Scan::global,
12803                 Target_arm::Relocate::relocate,
12804                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12805                 Adjust call to Target_arm::get_real_reloc_type.
12806                 (Target_arm::get_real_reloc_type): Use command line options
12807                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12808                 * options.h (--target1-rel, --target1-abs, --target2): New
12809                 ARM-only options.
12810
12811 2009-11-25  Doug Kwan  <dougkwan@google.com>
12812
12813         * arm.cc (Target_arm::Target_arm): Move method definition outside of
12814         class definition.  Add code to handle --target1-rel, --target1-abs
12815         and --target2= options.
12816         (Target_arm::get_reloc_reloc_type): Change method to be non-static
12817         and const.
12818         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
12819         member declaration.
12820         (Target_arm::Scan::local, Target_arm::Scan::global,
12821         Target_arm::Relocate::relocate,
12822         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
12823         call to Target_arm::get_real_reloc_type.
12824         (Target_arm::get_real_reloc_type): Use command line options to
12825         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12826         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
12827         options.
12828
12829 2009-11-25  Doug Kwan  <dougkwan@google.com>
12830
12831         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
12832         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
12833         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
12834         formatting.
12835         (Arm_relocate_functions::thm_call): Replace body with a call to
12836         Arm_relocate_functions::thumb_branch_common.
12837         (Arm_relocate_functions::thm_jump24,
12838         Arm_relocate_functions::thm_xpc22): New method definitions.
12839         (Arm_relocate_functions::thumb_branch_common): New method definition.
12840         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
12841         operator.
12842         (Target_arm::Relocate::relocate): Adjust call to thm_call.
12843         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
12844
12845 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12846
12847         * Makefile.am: Build incremental-dump
12848         * Makefile.in: Regenerate.
12849         * incremental-dump.cc: New.
12850         * incremental.cc (Incremental_inputs_header_data,
12851         Incremental_inputs_entry_data): Move to incremental.h
12852         * incremental.h: (Incremental_inputs_header_data,
12853         Incremental_inputs_entry_data): Move from incremental.cc
12854
12855 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12856
12857         * incremental.cc (Incremental_inputs_header,
12858         Incremental_inputs_header_write, Incremental_inputs_entry,
12859         Incremental_inputs_entry_write): Add a typedef with the data type.
12860
12861 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12862
12863         * incremental.cc (Incremental_inputs_header,
12864         Incremental_inputs_header_write, Incremental_inputs_entry,
12865         Incremental_inputs_entry_write): Update comment about which
12866         type has the filed descriptions.
12867
12868 2009-11-15  Doug Kwan  <dougkwan@google.com>
12869
12870         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
12871         (Arm_relocate_functions::arm_branch_common): Change method defintion
12872         in class definition to a method declaration and update list of formal
12873         parameters.
12874         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
12875         Arm_relocation_functions::jump24): Adjust call to
12876         Arm_relocate_functions::arm_branch_common.  Update list of formal
12877         parameters.
12878         (Arm_relocate_functions::xpc25): New method definition.
12879         (Arm_relocate_functions::arm_branch_common): Move method defintion
12880         out from class definition.  Use stubs for mode-switching and extending
12881         branch ranges.
12882         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
12883         specially.  Change code to enable use of stubs in ARM branches.
12884
12885 2009-11-10  Doug Kwan  <dougkwan@google.com>
12886
12887         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
12888         in method declaration.
12889         (Target_arm::relocate_stub): New method declaration.
12890         (Target_arm::default_target): Change to return a pointer instead of
12891         a const reference.
12892         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
12893         Target_arm::default_target.
12894         (Arm_Relobj::do_relocate_sections): Remove options paramater in
12895         method definition.
12896         (Target_arm::relocate_section): Adjust view.
12897         (Target_arm::relocate_stub): New method definition.
12898
12899 2009-11-10  Doug Kwan  <dougkwan@google.com>
12900
12901         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
12902         a format warning.
12903         * incremental.cc (open_incremental_binary): Initialized local
12904         variables to avoid warnings.
12905         * object.cc (make_elf_object): Ditto.
12906         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
12907         a format warning.
12908
12909 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
12910
12911         PR gold/10930
12912         * testsuite/plugin_test.c: Include "config.h".
12913
12914 2009-11-09  Doug Kwan  <dougkwan@google.com>
12915
12916         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
12917         (arm_symbol_value): Remove.
12918         (Arm_relocate_functions::arm_branch_common,
12919         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
12920         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
12921         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
12922         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
12923         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12924         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12925         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12926         Arm_relocate_functions::thm_mobw_abs_nc,
12927         Arm_relocate_functions::thm_mov_abs,
12928         Arm_relocate_functions::movw_prel_nc,
12929         Arm_relocate_functions::thm_movt_abs,
12930         Arm_relocate_functions::movt_prel,
12931         Arm_relocate_functions::thm_movw_prel_nc,
12932         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
12933         (Target_arm::Relocate::relocate): Only decompose address into two
12934         parts if relocation type uses the thumb-bit and pass the actual
12935         bit instead of a flag indicating that the thumb-bit is used.  Adjust
12936         calls to methods in Arm_relocate_functions for this change.
12937
12938 2009-11-08  Ian Lance Taylor  <iant@google.com>
12939
12940         PR 10925
12941         * reloc.cc: Instantiate
12942         Sized_relobj::initialize_input_to_output_maps and
12943         Sized_relobj:free_input_to_output_maps.
12944
12945 2009-11-06  Ian Lance Taylor  <iant@google.com>
12946
12947         PR 10876
12948         * defstd.cc (in_segment): Set only_if_ref true for "end".
12949
12950 2009-11-06  Doug Kwan  <dougkwan@google.com>
12951
12952         * arm.cc (class Reloc_stub): Correct a comment.
12953         (Target_arm::Target_arm): Initialize arm_input_section_map_.
12954         (Target_arm::scan_section_for_stubs): New method declaration.
12955         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
12956         Change methods from private to protected.
12957         (Target_arm::do_may_relax): New method definition.
12958         (Target_arm::do_relax, Target_arm::group_sections,
12959         Target_arm::scan_reloc_for_stub,
12960         Target_arm::scan_reloc_section_for_stubs): New method declarations.
12961         (Target_arm::arm_input_section_map_): New data member declaration.
12962         (Target_arm::scan_reloc_for_stub,
12963         Target_arm::scan_reloc_section_for_stubs,
12964         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
12965         Target_arm::do_relax): New method definitions.
12966
12967 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
12968
12969         * configure.ac: Check for (struct stat)::st_mtim
12970         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
12971         * config.in: Regenerate.
12972         * configure: Regenerate.
12973
12974 2009-11-05  Ian Lance Taylor  <iant@google.com>
12975
12976         PR 10910
12977         * output.cc (Output_segment::add_output_section): Add missing
12978         return statement.
12979
12980 2009-11-04  Ian Lance Taylor  <iant@google.com>
12981
12982         PR 10880
12983         * object.h (class Object): Add is_needed and set_is_needed
12984         methods.  Add is_needed_ field.  Make bool fields into bitfields.
12985         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
12986         defined in a dynamic object and referenced by a regular object,
12987         set is_needed for the dynamic object.
12988         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
12989         if the file is marked with as_needed and it is not needed.
12990
12991 2009-11-04  Ian Lance Taylor  <iant@google.com>
12992
12993         PR 10887
12994         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
12995         tags if data is discarded by linker script.
12996         * i386.cc (Target_i386::do_finalize_sections): Likewise.
12997         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12998         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12999         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
13000
13001 2009-11-04  Ian Lance Taylor  <iant@google.com>
13002
13003         * layout.cc (Layout::get_output_section): Add is_interp and
13004         is_dynamic_linker_section parameters.  Change all callers.
13005         (Layout::choose_output_section): Likewise.
13006         (Layout::make_output_section): Likewise.
13007         (Layout::add_output_section_data): Add is_dynamic_linker_section
13008         parameter.  Change all callers.
13009         * layout.h (class Layout): Update declarations.
13010         * output.h (class Output_section): Add is_interp, set_is_interp,
13011         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
13012         Add is_interp_, is_dynamic_linker_section_ fields.  Change
13013         generate_code_fills_at_write_ to a bitfield.
13014         * output.cc (Output_section::Output_sections): Initialize new
13015         fields.
13016         (Output_segment::add_output_section): Add do_sort parameter.
13017         Change all callers.
13018
13019 2009-11-03  Ian Lance Taylor  <iant@google.com>
13020
13021         PR 10860
13022         * options.h (class General_options): Add --warn-common.
13023         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
13024         merging two common symbols.
13025         (Symbol_table::should_override): Handle --warn-common when merging
13026         a common symbol with a defined symbol.  Use report_resolve_problem
13027         for multiple definitions.
13028         (Symbol_table::report_resolve_problem): New function.
13029         * symtab.h (class Symbol_table): Declare report_resolve_problem.
13030
13031 2009-11-03  Doug Kwan  <dougkwan@google.com>
13032
13033         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
13034         stub_factory_.
13035         (Target_arm::stub_factory): New method definition.
13036         (Target_arm::new_arm_input_section,
13037         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
13038         Target_arm::reloc_uses_thumb_bit): New method declarations.
13039         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
13040         New type definitions.
13041         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
13042         member declarations.
13043         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
13044         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
13045         New method definitions.
13046
13047 2009-11-03  Ian Lance Taylor  <iant@google.com>
13048
13049         * options.h (class General_options): Add --warn_constructors.
13050
13051 2009-11-03  Ian Lance Taylor  <iant@google.com>
13052
13053         PR 10893
13054         * defstd.cc (in_section): Add entries for __rel_iplt_start,
13055         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
13056
13057 2009-11-03  Ian Lance Taylor  <iant@google.com>
13058
13059         PR 10895
13060         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
13061         --msgid-bugs-address.
13062         (install-pdf): New target.
13063         (install-data_yes): Look up one directory to find mkinstalldirs.
13064
13065 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
13066
13067         * po/Make-in (.po.gmo): Don't generate .gmo files in source
13068         tree.
13069
13070 2009-10-30  Doug Kwan  <dougkwan@google.com>
13071
13072         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
13073
13074 2009-10-30  Doug Kwan  <dougkwan@google.com>
13075
13076         * arm.cc (Stub_addend_reader): New struct template definition
13077         and partial specializations.
13078         (Stub_addend_reader::operator()): New method definition for a
13079         partially specialized template.
13080
13081 2009-10-30  Doug Kwan  <dougkwan@google.com>
13082
13083         * arm.cc (Arm_relobj::processor_specific_flags): New method
13084         definition.
13085         (Arm_relobj::do_read_symbols): New method declaration.
13086         (Arm_relobj::processor_specific_flags_): New data member declaration.
13087         (Arm_dynobj): New class definition.
13088         (Target_arm::do_finalize_sections): Add input_objects parameter.
13089         (Target_arm::do_adjust_elf_header): New method declaration.
13090         (Target_arm::are_eabi_versions_compatible,
13091         (Target_arm::merge_processor_specific_flags): New method declaration.
13092         (Target_arm::do_make_elf_object): New overloaded method definitions
13093         and declaration.
13094         (Arm_relobj::do_read_symbols): New method definition.
13095         (Arm_dynobj::do_read_symbols): Ditto.
13096         (Target_arm::do_finalize_sections): Add input_objects parameters.
13097         Merge processor-specific flags from all input objects.
13098         (Target_arm::are_eabi_versions_compatible,
13099         Target_arm::merge_processor_specific_flags,
13100         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
13101         New method definitions.
13102         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
13103         Input_objects pointer type parameter.
13104         * layout.cc (Layout::finalize): Pass input objects to target's.
13105         finalize_sections function.
13106         * output.cc (Output_file_header::do_sized_write): Set ELF file
13107         header's processor-specific flags.
13108         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
13109         Input_objects pointer type parameter.
13110         * sparc.cc (Target_sparc::do_finalize_sections): Same.
13111         * target.h (Input_objects): New forward class declaration.
13112         (Target::processor_specific_flags,
13113         Target::are_processor_specific_flags_sect): New method definitions.
13114         (Target::finalize_sections): Add input_objects parameter.
13115         (Target::Target): Initialize processor_specific_flags_ and
13116         are_processor_specific_flags_set_.
13117         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
13118         parameter.
13119         (Target::set_processor_specific_flags): New method definition.
13120         (Target::processor_specific_flags_,
13121         Target::are_processor_specific_flags_set_): New data member
13122         declarations.
13123         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
13124         Input_objects pointer type parameter.
13125
13126 2009-10-30  Doug Kwan  <dougkwan@google.com>
13127
13128         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
13129
13130 2009-10-28  Ian Lance Taylor  <iant@google.com>
13131
13132         * object.h (class Relobj): Drop options parameter from
13133         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
13134         do_scan_relocs, do_relocate.  Change all callers.
13135         (class Sized_relobj): Drop options parameters from
13136         do_gc_process_relocs, do_scan_relocs, do_relocate,
13137         do_relocate_sections, relocate_sections, emit_relocs_scan,
13138         emit_relocs_scan_reltype.  Change all callers.
13139         (struct Relocate_info): Remove options field and all references to
13140         it.
13141         * reloc.h (class Read_relocs): Remove options constructor
13142         parameter and options_ field.  Change all callers.
13143         (class Gc_process_relocs, class Scan_relocs): Likewise.
13144         (class Relocate_task): Likewise.
13145         * target-reloc.h (scan_relocs): Remove options parameter.  Change
13146         all callers.
13147         (scan_relocatable_relocs): Likewise.
13148         * target.h (class Sized_target): Remove options parameter from
13149         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
13150         all callers.
13151         * gc.h (gc_process_relocs): Remove options parameter.  Change all
13152         callers.
13153         * arm.cc: Update functions to remove options parameters.
13154         * i386.cc: Likewise.
13155         * powerpc.cc: Likewise.
13156         * sparc.cc: Likewise.
13157         * x86_64.cc: Likewise.
13158         * testsuite/testfile.cc: Likewise.
13159
13160 2009-10-28  Doug Kwan  <dougkwan@google.com>
13161
13162         * arm.cc (Arm_relobj): New class definition.
13163         (Arm_relobj::scan_sections_for_stubs,
13164         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
13165         New method definitions.
13166
13167 2009-10-28  Cary Coutant  <ccoutant@google.com>
13168
13169         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
13170         (Plugin::cleanup_done_): New member.
13171         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
13172         (Plugin_manager::cleanup_done_): Remove.
13173         (Plugin_manager::add_input_file): Edit error message.
13174         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
13175         (Plugin_manager::cleanup): Remove use of cleanup_done_.
13176
13177 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
13178
13179         * fileread.cc: (File_read::View::~View): Use the new
13180         data_ownership_ filed.
13181         (File_read::~File_read): Dispose the new whole_file_view_.
13182         (File_read::open): Mmap the whole file if needed.
13183         (File_read::open): Use whole_file_view_ instead of contents_.
13184         (File_read::find_view): Use whole_file_view_ if applicable.
13185         (File_read::do_read): Use whole_file_view_ instead of contents_.
13186         (File_read::make_view): Use whole_file_view_ instead of contents_,
13187         update File_read::View::View call.
13188         (File_read::find_or_make_view): Update File_read::View::View
13189         call.
13190         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
13191         remove contents_
13192         (File_read::View::Data_ownership): New enum.
13193         (File_read::View::View): Replace bool mapped_ with Data_ownership
13194         argument.
13195         (File_read::View::mapped_): Remove (replaced by data_ownership_).
13196         (File_read::View::data_ownership_): New field.
13197         (File_read::contents_): Remove (replaced by whole_file_view_).
13198         (File_read::whole_file_view_): New field.
13199         * options.h (class General_options): Add --keep-files-mapped.
13200
13201 2009-10-27  Cary Coutant  <ccoutant@google.com>
13202
13203         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
13204         * testsuite/Makefile.am (plugin_test_5): New test case.
13205         * testsuite/Makefile.in: Regenerate.
13206
13207 2009-10-25  Doug Kwan  <dougkwan@google.com>
13208
13209         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
13210         from private to protected to allow access by child class.
13211         (Sized_relobj::do_relocate_sections): New method declaration.
13212         (Sized_relobj::relocate_sections): Virtualize.
13213         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
13214         Sized_relobj::relocate_sections.  Instantiate template explicitly
13215         for different target sizes and endianity.
13216
13217 2009-10-24  Doug Kwan  <dougkwan@google.com>
13218
13219         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
13220         (Arm_input_section::as_arm_input_section): New method.
13221         (Arm_output_section): New class definition.
13222         (Arm_output_section::create_stub_group,
13223         Arm_output_section::group_sections): New method definitions.
13224
13225 2009-10-22  Doug Kwan  <dougkwan@google.com>
13226
13227         * arm.cc (Arm_input_section): New class definition.
13228         (Arm_input_section::init, Arm_input_section:do_write,
13229         Arm_input_section::set_final_data_size,
13230         Arm_input_section::do_reset_address_and_file_offset): New method
13231         definitions.
13232
13233 2009-10-21  Doug Kwan  <dougkwan@google.com>
13234
13235         * arm.cc (Stub_table, Arm_input_section): New forward class
13236         declarations.
13237         (Stub_table): New class defintion.
13238         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
13239         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
13240         New method definition.
13241
13242 2009-10-21  Doug Kwan  <dougkwan@google.com>
13243
13244         * arm.cc: Update copyright comments.
13245         (Target_arm): New forward class template declaration.
13246         (Arm_address): New type.
13247         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
13248         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
13249         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
13250         constants.
13251         (Insn_template): Same.
13252         (DEF_STUBS): New macro.
13253         (Stub_type): New enum type.
13254         (Stub_template): New class definition.
13255         (Stub): Same.
13256         (Reloc_stub): Same.
13257         (Stub_factory): Same.
13258         (Target_arm::Target_arm): Initialize may_use_blx_ and
13259         should_force_pic_veneer_.
13260         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
13261         Target_arm::should_force_pic_veneer,
13262         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
13263         Target_arm::using_thumb_only, Target_arm:;default_target): New
13264         method defintions.
13265         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
13266         New data member declarations.
13267         (Insn_template::size, Insn_template::alignment): New method defintions.
13268         (Stub_template::Stub_template): New method definition.
13269         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
13270         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
13271         (Stub_factory::Stub_factory): New method definition.
13272         * gold.h (string_hash): New template.
13273         * output.h (Input_section_specifier::hash_value): Use
13274         gold::string_hash.
13275         (Input_section_specifier::string_hash): Remove.
13276         * stringpool.cc (Stringpool_template::string_hash): Use
13277         gold::string_hash.
13278
13279 2009-10-20  Doug Kwan  <dougkwan@google.com>
13280
13281         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
13282         symbols of relaxed input sections.
13283         * output.h (Output_section::find_relaxed_input_section): Make
13284         method public.
13285
13286 2009-10-16  Doug Kwan  <dougkwan@google.com>
13287
13288         * dynobj.cc (Versions::Versions): Initialize version_script_.
13289         Only insert base version symbol definition for a shared object
13290         if version script defines any version versions.
13291         (Versions::define_base_version): New method definition.
13292         (Versions::add_def): Check that base version is not needed.
13293         (Versions::add_need): Define base version lazily.
13294         * dynobj.h (Versions::define_base_version): New method declaration.
13295         (Versions::needs_base_version_): New data member declaration.
13296         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
13297         (check_DATA): Add no_version_test.stdout.
13298         (libno_version_test.so, no_version_test.o no_version_test.stdout):
13299         New make rules.
13300         * testsuite/Makefile.in: Regenerate.
13301         * testsuite/no_version_test.c: New file.
13302         * testsuite/no_version_test.sh: Ditto.
13303
13304 2009-10-16  Doug Kwan  <dougkwan@google.com>
13305
13306         * expression.cc (class Segment_start_expression): New class definition.
13307         (Segment_start_expression::value): New method definition.
13308         (script_exp_function_segment_start): Return a new
13309         Segment_start_expression.
13310         * gold/script-c.h (script_saw_segment_start_expression): New function
13311         prototype.
13312         * script-sections.cc (Script_sections::Script_sections): Initialize
13313         SAW_SEGMENT_START_EXPRESSION_ to false.
13314         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
13315         and -Tbbs options to specify section addresses if given in
13316         command line and no SEGMENT_START expression is seen in a script.
13317         * script-sections.h (Script_sections::saw_segment_start_expression,
13318         Script_sections::set_saw_segment_start_expression): New method
13319         definition.
13320         (Script_sections::saw_segment_start_expression_): New data member
13321         declaration.
13322         * script.cc (script_saw_segment_start_expression): New function.
13323         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
13324         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
13325         script_test_7.sh and script_test_8.sh.
13326         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
13327         script_test_8.stdout.
13328         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
13329         (script_test_6, script_test_6.stdout, script_test_7,
13330         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
13331         * Makefile.in: Regenerate.
13332         * testsuite/script_test_6.sh: New file.
13333         * testsuite/script_test_6.t: Same.
13334         * testsuite/script_test_7.sh: Same.
13335         * testsuite/script_test_7.t: Same.
13336         * testsuite/script_test_8.sh: Same.
13337
13338 2009-10-16  Doug Kwan  <dougkwan@google.com>
13339
13340         * output.cc (Output_segment::set_section_list_address): Cast
13341         expressions to unsigned long long type to avoid format warnings.
13342
13343 2009-10-15  Ian Lance Taylor  <iant@google.com>
13344
13345         * script.cc (Script_options::add_symbol_assignment): Always add a
13346         dot assignment to script_sections_.
13347         * script-sections.cc (Script_sections::add_dot_assignment):
13348         Initialize if necessary.
13349
13350         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
13351         program headers with no load segment if there is a linker script.
13352
13353         * layout.cc (Layout::set_segment_offsets): Align the file offset
13354         to the segment aligment for -N or -n with no load segment.
13355         * output.cc (Output_segment::add_output_section): Don't crash if
13356         the first section is a TLS section.
13357         (Output_segment::set_section_list_addresses): Print an error
13358         message if the address moves backward in a linker script.
13359         * script-sections.cc
13360         (Output_section_element_input::set_section_addresses): Don't
13361         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
13362         (Orphan_output_section::set_section_addresses): Likewise.
13363
13364 2009-10-15  Doug Kwan  <dougkwan@google.com>
13365
13366         * layout.cc (Layout::finish_dynamic_section): Generate tags
13367         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
13368         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
13369         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
13370
13371 2009-10-14  Ian Lance Taylor  <iant@google.com>
13372
13373         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
13374         fields.
13375         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
13376         data_shdr fields of relinfo.
13377         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
13378         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
13379         R_386_TLS_LDO_32, adjust based on section flags.
13380         (Target_i386::Relocate::fix_up_ldo): Remove.
13381
13382 2009-10-13  Ian Lance Taylor  <iant@google.com>
13383
13384         Add support for -pie.
13385         * options.h (class General_options): Add -pie and
13386         --pic-executable.
13387         (General_options::output_is_position_independent): Test -pie.
13388         (General_options::output_is_executable): Return true if not shared
13389         and not relocatable.
13390         (General_options::output_is_pie): Remove.
13391         * options.cc (General_options::finalize): Reject incompatible uses
13392         of -pie.
13393         * gold.cc (queue_middle_tasks): A -pie link is not static.
13394         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
13395         * symtab.cc (Symbol::final_value_is_known): Return false if
13396         output_is_position_independent.
13397         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
13398         output_is_position_independent.
13399         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
13400         output_is_position_independent.
13401         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
13402         output_is_position_independent.
13403         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
13404         two_file_pie_test.
13405         (basic_pie_test.o, basic_pie_test): New targets.
13406         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
13407         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
13408         (two_file_pie_test): New target.
13409         * testsuite/Makefile.in: Rebuild.
13410         * README: Remove note saying that -pie is not supported.
13411
13412 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
13413
13414         * options.h (class General_options): Add -init and -fini.
13415         * layout.cc (Layout::finish_dynamic_section): Emit
13416         given init and fini functions.
13417
13418 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
13419
13420         * gc.h (gc_process_relocs): Check if icf is enabled using new
13421         function.
13422         * gold.cc (queue_initial_tasks): Likewise.
13423         (queue_middle_tasks): Likewise.
13424         * object.cc (do_layout): Likewise.
13425         * symtab.cc (is_section_folded): Likewise.
13426         * main.cc (main): Likewise.
13427         * reloc.cc (Read_relocs::run): Likewise.
13428         (Sized_relobj::do_scan_relocs): Likewise.
13429         * icf.cc (is_function_ctor_or_dtor): New function.
13430         (Icf::find_identical_sections): Check if function is ctor or dtor when
13431         safe icf is chosen.
13432         * options.h (General_options::icf): Change option to be an enum.
13433         (Icf_status): New enum.
13434         (icf_enabled): New method.
13435         (icf_safe_folding): New method.
13436         (set_icf_status): New method.
13437         (icf_status_): New variable.
13438         * (options.cc) (General_options::finalize): Set icf_status_.
13439         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
13440         icf_test and icf_keep_unique_test to use the --icf enum flag.
13441         * testsuite/icf_safe_test.sh: New file.
13442         * testsuite/icf_safe_test.cc: New file.
13443
13444 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
13445
13446         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
13447         includes to gc.h and icf.h.
13448         * arm.cc: Include gc.h.
13449         * gold.cc: Likewise.
13450         * i386.cc: Likewise.
13451         * powerpc.cc: Likewise.
13452         * sparc.cc: Likewise.
13453         * x86_64.cc: Likewise.
13454         * gc.h: Include icf.h.
13455
13456 2009-10-11  Ian Lance Taylor  <iant@google.com>
13457
13458         * plugin.cc: Include "gold.h" before other header files.
13459
13460 2009-10-10  Chris Demetriou  <cgd@google.com>
13461
13462         * options.h (Input_file_argument::Input_file_type): New enum.
13463         (Input_file_argument::is_lib_): Replace with...
13464         (Input_file_argument::type_): New member.
13465         (Input_file_argument::Input_file_argument): Take Input_file_type
13466         'type' rather than boolean 'is_lib' as second argument.
13467         (Input_file_argument::is_lib): Use type_.
13468         (Input_file_argument::is_searched_file): New function.
13469         (Input_file_argument::may_need_search): Handle is_searched_file.
13470         * options.cc (General_options::parse_library): Support -l:filename.
13471         (General_options::parse_just_symbols): Update for Input_file_argument
13472         changes.
13473         (Command_line::process): Likewise.
13474         * archive.cc (Archive::get_file_and_offset): Likewise.
13475         * plugin.cc (Plugin_manager::release_input_file): Likewise.
13476         * script.cc (read_script_file, script_add_file): Likewise.
13477         * fileread.cc (Input_file::Input_file): Likewise.
13478         (Input_file::will_search_for): Handle is_searched_file.
13479         (Input_file::open): Likewise.
13480         * readsyms.cc (Read_symbols::get_name): Likewise.
13481         * testsuite/Makefile.am (searched_file_test): New test.
13482         * testsuite/Makefile.in: Regenerate.
13483         * testsuite/searched_file_test.cc: New file.
13484         * testsuite/searched_file_test_lib.cc: New file.
13485
13486 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13487             Ian Lance Taylor  <iant@google.com>
13488
13489         * descriptor.cc: Include <cstdio> and "binary-io.h".
13490         (Descriptors::open): Open the files in binary mode always.
13491         * script.cc (Lex::get_token): Treat \r as whitespace.
13492
13493 2009-10-09  Ian Lance Taylor  <iant@google.com>
13494
13495         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
13496
13497 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13498             Ian Lance Taylor  <iant@google.com>
13499
13500         * configure.ac: Check for readv function also.
13501         * fileread.cc (readv): Define if not HAVE_READV.
13502         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
13503         does not exist.
13504         * config.in: Regenerate.
13505         * configure: Regenerate.
13506
13507 2009-10-09  Doug Kwan  <dougkwan@google.com>
13508
13509         * layout.cc (Layout::make_output_section): Call target hook to make
13510         ordinary output section.
13511         (Layout::finalize): Adjust parameter list of call the
13512         Target::may_relax().
13513         * layout.h (class Layout::section_list): New method.
13514         * merge.h (Output_merge_base::entsize): Change visibility to public.
13515         (Output_merge_base::is_string, Output_merge_base::do_is_string):
13516         New methods.
13517         (Output_merge_string::do_is_string): New method.
13518         * object.cc (Sized_relobj::do_setup): renamed from
13519         Sized_relobj::set_up.
13520         * object.h (Sized_relobj::adjust_shndx,
13521         Sized_relobj::initializ_input_to_output_maps,
13522         Sized_relobj::free_input_to_output_maps): Change visibilities to
13523         protected.
13524         (Sized_relobj::setup): Virtualize.
13525         (Sized_relobj::do_setup): New method declaration.
13526         (Sized_relobj::invalidate_section_offset,
13527         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
13528         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
13529         * options.cc (parse_int): New function.
13530         * options.h (parse_int): New declaration.
13531         (DEFINE_int): New macro.
13532         (stub_group_size): New option.
13533         * output.cc (Output_section::Output_section): Initialize memebers
13534         merge_section_map_, merge_section_by_properties_map_,
13535         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
13536         (Output_section::add_input_section): Handled deferred code-fill
13537         generation and remove an old comment.
13538         (Output_section::add_relaxed_input_section): New method definition.
13539         (Output_section::add_merge_input_section): Use merge section by
13540         properties map to speed to search.  Update merge section maps
13541         as appropriate.
13542         (Output_section::build_relaxation_map): New method definition.
13543         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
13544         Same.
13545         (Output_section::relax_input_section): Renamed to
13546         Output_section::convert_input_sections_to_relaxed_sections and change
13547         interface to take a vector of pointers to relaxed sections.
13548         (Output_section::find_merge_section,
13549         Output_section::find_relaxed_input_section): New method definitions.
13550         (Output_section::is_input_address_mapped,
13551         Output_section::output_offset, Output_section::output_address):
13552         Use output section data maps to speed up searching.
13553         (Output_section::find_starting_output_address): Add comments.
13554         (Output_section::do_write,
13555         Output_section::write_to_postprocessing_buffer): Do code-fill
13556         generation as appropriate.
13557         (Output_section::get_input_sections): Invalidate relaxed input section
13558         map.
13559         (Output_section::restore_states): Adjust type of checkpoint .
13560         Invalidate relaxed input section map.
13561         * output.h (Output_merge_base): New class declaration.
13562         (Input_section_specifier): New class defintion.
13563         (class Output_relaxed_input_section) Change base class to
13564         Output_section_data_build.
13565         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
13566         base class initializer.
13567         (Output_section::add_relaxed_input_section): New method declaration.
13568         (Output_section::Input_section): Change visibility to protected.
13569         (Output_section::Input_section::relobj,
13570         Output_section::Input_section::shndx): Handle relaxed input sections.
13571         Output_section::input_sections) Change visibility to protected.  Also
13572         define overload to return a non-const pointer.
13573         (Output_section::Merge_section_properties): New class defintion.
13574         (Output_section::Merge_section_by_properties_map,
13575         Output_section::Output_section_data_by_input_section_map,
13576         Output_section::Relaxation_map): New types.
13577         (Output_section::relax_input_section): Rename method to
13578         Output_section::convert_input_sections_to_relaxed_sections and change
13579         interface to take a vector of relaxed section pointers.
13580         (Output_section::find_merge_section,
13581         Output_section::find_relaxed_input_section,
13582         Output_section::build_relaxation_map,
13583         Output_section::convert_input_sections_in_list_to_relaxed_sections):
13584         New method declarations.
13585         (Output_section::merge_section_map_
13586         Output_section::merge_section_by_properties_map_,
13587         Output_section::relaxed_input_section_map_,
13588         Output_section::is_relaxed_input_section_map_valid_,
13589         Output_section::generate_code_fills_at_write_): New data members.
13590         * script-sections.cc
13591         (Output_section_element_input::set_section_addresses): Call
13592         current_data_size and addralign methods of relaxed input sections.
13593         (Orphan_output_section::set_section_addresses): Call current_data_size
13594         and addralign methods of relaxed input sections.
13595         * symtab.cc (Symbol_table::compute_final_value): Extract template
13596         from the body of Symbol_table::sized_finalize_symbol.
13597         (Symbol_table::sized_finalized_symbol): Call
13598         Symbol_table::compute_final_value.
13599         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
13600         (Symbol_table::compute_final_value): New templated method declaration.
13601         * target.cc (Target::do_make_output_section): New method defintion.
13602         * target.h (Target::make_output_section): New method declaration.
13603         (Target::relax): Add more parameters for input objects, symbol table
13604         and layout.  Adjust call to do_relax.
13605         (Target::do_make_output_section): New method declaration.
13606         (Target::do_relax): Add parameters for input objects, symbol table
13607         and layout.
13608
13609 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13610
13611         * pread.c: Include stdio.h.
13612
13613 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13614
13615         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
13616         defined.
13617
13618 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13619
13620         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
13621         Change read_shndx type to unsigned int.
13622         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13623         int.
13624         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13625         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
13626         Change read_shndx type to unsigned int.
13627         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13628         int.
13629         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13630         * layout.cc (Layout::create_symtab_sections): Cast the result of
13631         local_symcount * symsize to off_t in the gold_assert.
13632
13633 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13634
13635         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
13636         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
13637         R_ARM_BASE_ABS.
13638         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
13639         (Arm_relocate_functions::thm_abs5): New function.
13640         (Arm_relocate_functions::abs12): New function.
13641         (Arm_relocate_functions::abs16): New function.
13642         (Arm_relocate_functions::base_abs): New function.
13643         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
13644         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
13645         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
13646         R_ARM_BASE_ABS.
13647         (Scan::global): Likewise.
13648         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
13649         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
13650         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
13651         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
13652         R_ARM_BASE_ABS.
13653
13654 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13655
13656         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
13657         (Arm_relocate_functions::movt_prel): New function.
13658         (Arm_relocate_functions::thm_movw_prel_nc): New function.
13659         (Arm_relocate_functions::thm_movt_prel): New function.
13660         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
13661         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
13662         (Scan::global, Relocate::relocate): Likewise.
13663         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13664
13665 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13666
13667         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
13668         Incremental_checker.
13669         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
13670         unsigned int.
13671         (class Incremental_inputs_header): New class.
13672         (Incremental_inputs_header_writer): Edit comment.
13673         (Incremental_inputs_entry): New class.
13674         (Incremental_inputs_entry_writer): Edit comment.
13675         (Sized_incremental_binary::do_find_incremental_inputs_section):
13676         Add *strtab_shndx parameter, fill it.
13677         (Sized_incremental_binary::do_check_inputs): New method.
13678         (Incremental_checker::can_incrementally_link_output_file): Use
13679         Sized_incremental_binary::check_inputs.
13680         (Incremental_inputs::report_command_line): Save command line in
13681         command_line_.
13682         * incremental.h:
13683         (Incremental_binary::find_incremental_inputs_section): New
13684         method.
13685         (Incremental_binary::do_find_incremental_inputs_section): Add
13686         strtab_shndx parameter.
13687         (Incremental_binary::do_check_inputs): New pure virtual method.
13688         (Sized_incremental_binary::do_check_inputs): Declare.
13689         (Incremental_checker::Incremental_checker): Add incremental_inputs
13690         parameter, use it to initialize incremental_inputs_.
13691         (Incremental_checker::incremental_inputs_): New field.
13692         (Incremental_checker::command_line): New method.
13693         (Incremental_checker::inputs): New method.
13694         (Incremental_checker::command_line_): New field.
13695
13696 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13697
13698         * incremental.cc: Include <cstdarg> and "target-select.h".
13699         (vexplain_no_incremental): New function.
13700         (explain_no_incremental): New function.
13701         (Incremental_binary::error): New method.
13702         (Sized_incremental_binary::do_find_incremental_inputs_section): New
13703         method.
13704         (make_sized_incremental_binary): New function.
13705         (open_incremental_binary): New function.
13706         (can_incrementally_link_file): Add checks if output is ELF and has
13707         inputs section.
13708         * incremental.h: Include "elfcpp_file.h" and "output.h".
13709         (Incremental_binary): New class.
13710         (Sized_incremental_binary): New class.
13711         (open_incremental_binary): Declare.
13712         * object.cc (is_elf_object): Use
13713         elfcpp::Elf_recognizer::is_elf_file.
13714         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
13715         * output.h (Output_file::filesize): New method.
13716
13717 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13718
13719         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
13720         New function.
13721         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
13722         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
13723         function.
13724         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
13725         function.
13726         (Arm_relocate_functions::movw_abs_nc): New function.
13727         (Arm_relocate_functions::movt_abs): New function.
13728         (Arm_relocate_functions::thm_movw_abs_nc): New function.
13729         (Arm_relocate_functions::thm_movt_abs): New function.
13730         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
13731         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
13732         (Scan::global): Likewise.
13733         (Relocate::relocate): Likewise.
13734         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13735
13736 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13737
13738         * arm.cc (Arm_relocate_functions::got_prel) New function.
13739         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
13740         (Relocate::relocate): Likewise.
13741         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13742
13743 2009-10-06  Ian Lance Taylor  <iant@google.com>
13744
13745         * options.h (class General_options): Define
13746         split_stack_adjust_size parameter.
13747         * object.h (class Object): Add uses_split_stack_ and
13748         has_no_split_stack_ fields.  Add uses_split_stack and
13749         has_no_split_stack accessor functions.  Declare
13750         handle_split_stack_section.
13751         (class Reloc_symbol_changes): Define.
13752         (class Sized_relobj): Define Function_offsets.  Declare
13753         split_stack_adjust, split_stack_adjust_reltype, and
13754         find_functions.
13755         * object.cc (Object::handle_split_stack_section): New function.
13756         (Sized_relobj::do_layout): Call handle_split_stack_section.
13757         * dynobj.cc (Sized_dynobj::do_layout): Call
13758         handle_split_stack_section.
13759         * reloc.cc (Sized_relobj::relocate_sections): Call
13760         split_stack_adjust for executable sections in split_stack
13761         objects.  Pass reloc_map to relocate_section.
13762         (Sized_relobj::split_stack_adjust): New function.
13763         (Sized_relobj::split_stack_adjust_reltype): New function.
13764         (Sized_relobj::find_functions): New function.
13765         * target-reloc.h: Include "object.h".
13766         (relocate_section): Add reloc_symbol_changes parameter.  Change
13767         all callers.
13768         * target.h (class Target): Add calls_non_split method.  Declare
13769         do_calls_non_split virtual method.  Declare match_view and
13770         set_view_to_nop.
13771         * target.cc: Include "elfcpp.h".
13772         (Target::do_calls_non_split): New function.
13773         (Target::match_view): New function.
13774         (Target::set_view_to_nop): New function.
13775         * gold.cc (queue_middle_tasks): Give an error if mixing
13776         split-stack and non-split-stack objects with -r.
13777         * i386.cc (Target_i386::relocate_section): Add
13778         reloc_symbol_changes parameter.
13779         (Target_i386::do_calls_non_split): New function.
13780         * x86_64.cc (Target_x86_64::relocate_section): Add
13781         reloc_symbol_changes parameter.
13782         (Target_x86_64::do_calls_non_split): New function.
13783         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
13784         parameter.
13785         * powerpc.cc (Target_powerpc::relocate_section): Add
13786         reloc_symbol_changes parameter.
13787         * sparc.cc (Target_sparc::relocate_section): Add
13788         reloc_symbol_changes parameter.
13789         * configure.ac: Call AM_CONDITIONAL for the default target.
13790         * configure: Rebuild.
13791         * testsuite/Makefile.am (TEST_AS): New variable.
13792         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
13793         (check_DATA): Add split_i386 and split_x86_64 files.
13794         (SPLIT_DEFSYMS): Define.
13795         (split_i386_[1234n].o): New targets.
13796         (split_i386_[124]): New targets.
13797         (split_i386_[1234r].stdout): New targets.
13798         (split_x86_64_[1234n].o): New targets.
13799         (split_x86_64_[124]): New targets.
13800         (split_x86_64_[1234r].stdout): New targets.
13801         (MOSTLYCLEANFILES): Add new executables.
13802         * testsuite/split_i386.sh: New file.
13803         * testsuite/split_x86_64.sh: New file.
13804         * testsuite/split_i386_1.s: New file.
13805         * testsuite/split_i386_2.s: New file.
13806         * testsuite/split_i386_3.s: New file.
13807         * testsuite/split_i386_4.s: New file.
13808         * testsuite/split_i386_n.s: New file.
13809         * testsuite/split_x86_64_1.s: New file.
13810         * testsuite/split_x86_64_2.s: New file.
13811         * testsuite/split_x86_64_3.s: New file.
13812         * testsuite/split_x86_64_4.s: New file.
13813         * testsuite/split_x86_64_n.s: New file.
13814         * testsuite/testfile.cc (Target_test): Update relocation_section
13815         function.
13816         * testsuite/Makefile.in: Rebuild.
13817
13818 2009-10-06  Ian Lance Taylor  <iant@google.com>
13819
13820         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
13821         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
13822         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
13823         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
13824         the address on ldo_addrs_.
13825         (Target_i386::Relocate::fix_up_ldo): New function.
13826
13827 2009-10-06   Rafael Espindola  <espindola@google.com>
13828
13829         * plugin.cc (add_input_library): New.
13830         (Plugin::load): Add add_input_library to tv.
13831         (Plugin_manager::add_input_file): Add the is_lib argument.
13832         (add_input_file): Update call to Plugin_manager::add_input_file.
13833         (add_input_library): New.
13834         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
13835
13836 2009-09-30  Doug Kwan  <dougkwan@google.com>
13837
13838         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
13839         symbol and call Symbol::may_need_copy_reloc to determine if
13840         a copy reloc is needed.
13841         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
13842         nocopyreloc is given in command line.
13843         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
13844         given in command line.
13845         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
13846         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
13847         of the removed Target_i386::may_need_copy_reloc.
13848         * options.h (copyreloc): New option with default value false.
13849         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13850         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
13851         instead of the removed Target_powerpc::may_need_copy_reloc.
13852         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13853         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
13854         instead of the removed Target_sparc::may_need_copy_reloc.
13855         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
13856         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
13857         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
13858         instead of the removed Target_x86_64::may_need_copy_reloc.
13859
13860 2009-09-30  Ian Lance Taylor  <iant@google.com>
13861
13862         * object.h (class Object): Remove target_ field, and target,
13863         sized_target, and set_target methods.
13864         (Object::sized_target): Remove.
13865         (class Sized_relobj): Update declarations.  Remove sized_target.
13866         * object.cc (Sized_relobj::setup): Remove target parameter.
13867         Change all callers.
13868         (Input_objects::add_object): Don't do anything with the target.
13869         (make_elf_sized_object): Add punconfigured parameter.  Change all
13870         callers.  Set or test parameter target.
13871         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
13872         Change all callers.
13873         * parameters.cc (Parameters::set_target): Change parameter type to
13874         be non-const.
13875         (Parameters::default_target): Remove.
13876         (set_parameters_target): Change parameter type to be non-const.
13877         (parameters_force_valid_target): New function.
13878         (parameters_clear_target): New function.
13879         * parameters.h (class Parameters): Update declarations.  Remove
13880         default_target method.  Add sized_target and clear_target
13881         methods.  Change target_ to be non-const.
13882         (set_parameters_target): Update declaration.
13883         (parameters_force_valid_target): Declare.
13884         (parameters_clear_target): Declare.
13885         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
13886         as NULL if we aren't searching.
13887         (Add_symbols::run): Don't check for compatible target.
13888         * fileread.cc (Input_file::open_binary): Call
13889         parameters_force_valid_target.
13890         * gold.cc (queue_middle_tasks): Likewise.
13891         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
13892         set_target on object.
13893         * dynobj.h (class Sized_dynobj): Update declarations.
13894         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
13895         make_elf_object returns NULL.
13896         (Archive::include_member): Don't check whether object target is
13897         compatible.
13898         * output.cc (Output_section::add_input_section): Get target from
13899         parameters.
13900         (Output_section::relax_input_section): Likewise.
13901         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
13902         parameters.
13903         (Sized_relobj::do_scan_relocs): Likewise.
13904         (Sized_relobj::relocate_sections): Likewise.
13905         * resolve.cc (Symbol_table::resolve): Likewise.
13906         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
13907         parameter.  Change all callers.
13908         (Symbol_table::add_from_object): Get target from parameters.
13909         (Symbol_table::add_from_relobj): Don't check object target.
13910         (Symbol_table::add_from_dynobj): Likewise.
13911         (Symbol_table::define_special_symbol): Get target from
13912         parameters.
13913         * symtab.h (class Symbol_table): Update declaration.
13914         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
13915         parameter.  Change all callers.  Clear parameter target.
13916         (Binary_test): Test target here.
13917         * testsuite/object_unittest.cc (gold_testsuite): Remove
13918         target_test_pointer parameter.  Change all callers.
13919         (Object_test): Test target here.
13920
13921 2009-09-26  Ian Lance Taylor  <iant@google.com>
13922
13923         * testsuite/initpri1.c: Don't try to use constructor priorities if
13924         compiling with gcc before 4.3.
13925
13926 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
13927
13928         * testsuite/retain_symbols_file_test.sh (check_present): Change
13929         output file name to retain_symbols_file_test.stdout.
13930         (check_absent): Likewise.
13931
13932 2009-09-18  Craig Silverstein  <csilvers@google.com>
13933
13934         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
13935         * options.cc: Include <cerrno> and <fstream>.
13936         (General_options::finalize): Parse -retain-symbols-file tag.
13937         * options.h: New flag.
13938         (General_options): New method should_retain_symbol, new
13939         variable symbols_to_retain.
13940         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
13941         should_retain_symbol map.
13942         * testsuite/Makefile.am (retain_symbols_file_test): New test.
13943         * testsuite/Makefile.in: Regenerate.
13944         * testsuite/retain_symbols_file_test.sh: New file.
13945
13946 2009-09-18  Nick Clifton  <nickc@redhat.com>
13947
13948         * po/es.po: Updated Spanish translation.
13949
13950 2009-09-17  Doug Kwan  <dougkwan@google.com>
13951
13952         * debug.h (DEBUG_RELAXATION): New constant.
13953         (DEBUG_ALL): Add DEBUG_RELAXATION.
13954         (debug_string_to_enum): Add relaxation debug option.
13955         * layout.cc
13956         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
13957         Layout::Relaxation_debug_check::read_sections,
13958         Layout::Relaxation_debug_check::read_sections): New method definitions.
13959         (Layout::Layout): Initialize data members
13960         record_output_section_data_from_scrips_,
13961         script_output_section_data_list_ and relaxation_debug_check_.
13962         (Layout::save_segments, Layout::restore_segments,
13963         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13964         Layout::relaxation_loop_body): New method definitions.
13965         (Layout::finalize): Support relaxation.  Move section layout code to
13966         Layout::relaxation_loop_body.
13967         (Layout::set_asection_address_from_script): Move code for orphan
13968         section placement out.
13969         (Layout::place_orphan_sections_in_script): New method definition.
13970         * layout.h (Output_segment_headers, Output_file_header):
13971         New forward class declarations.
13972         (Layout::~Layout): Define.
13973         (Layout::new_output_section_data_from_script): New method definition.
13974         (Layout::place_orphan_sections_in_script): New method declaration.
13975         (Layout::Segment_states): New type declaration.
13976         (Layout::save_segments, Layout::restore_segments,
13977         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13978         Layout::relaxation_loop_body): New method declarations.
13979         (Layout::Output_section_data_list): New type declaration.
13980         (Layout::Relaxation_debug_check): New class definition.
13981         (Layout::record_output_section_data_from_script_,
13982         Layout::script_output_section_data_list_, Layout::segment_states_,
13983         Layout::relaxation_debug_check_): New data members.
13984         * output.cc: (Output_section_headers::do_size): New method definition.
13985         (Output_section_headers::Output_section_headers): Move size
13986         computation to Output_section_headers::do_size.
13987         (Output_segment_headers::do_size): New method definition.
13988         (Output_file_header::Output_file_header): Move size computation to
13989         Output_file_header::do_size and call it.
13990         (Output_file_header::do_size): New method definition.
13991         (Output_data_group::Output_data_group): Adjust call to
13992         Output_section_data.
13993         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
13994         (Output_symtab_xindex::do_write): Add array bound check.
13995         (Output_section::Input_section::print_to_mapfile): Handle
13996         RELAXED_INPUT_SECTION_CODE.
13997         (Output_section::Output_section): Initialize data member checkpoint_.
13998         (Output_section::~Output_section): Delete checkpoint object pointed
13999         by checkpoint_.
14000         (Output_section::add_input_section): Always add an Input_section if
14001         relaxing.
14002         (Output_section::add_merge_input_section): Add assert.
14003         (Output_section::relax_input_section): New method definition.
14004         (Output_section::set_final_data_size): Set load address to zero for
14005         an unallocated section.
14006         (Output_section::do_address_and_file_offset_have_reset_values):
14007         New method definition.
14008         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
14009         Handle relaxed input section.
14010         (Output_section::sort_attached_input_sections): Checkpoint input
14011         section list lazily.
14012         (Output_section::get_input_sections): Change type of input_sections to
14013         list of Simple_input_section pointers.  Checkpoint input section list
14014         lazily.  Also handle relaxed input sections.
14015         (Output_section::add_input_section_for_script): Take a reference to
14016         a Simple_input_section object instead of Relobj pointer and section
14017         index as parameter.  Handle relaxed input sections.
14018         (Output_section::save_states, Output_section::restore_states): New
14019         method definitions.
14020         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
14021         (Output_data::is_data_size_fixed): New method definition.
14022         (Output_data::reset_addresss_and_file_offset): Do not reset data size
14023         if it is fixed.
14024         (Output_data::address_and_file_offset_have_reset_values): New method
14025         definition.
14026         (Output_data::do_address_and_file_offset_have_reset_values): New method
14027         definition.
14028         (Output_data::set_data_size): Check that data size is not fixed.
14029         (Output_data::fix_data_size): New method definition.
14030         (Output_data::is_data_size_fixed_): New data member.
14031         (Output_section_headers::set_final_data_size): New method definition.
14032         (Output_section_headers::do_size): New method declaration.
14033         (Output_segment_headers::set_final_data_size): New method definition.
14034         (Output_segment_headers::do_size): New method declaration.
14035         (Output_file_header::set_final_data_size)::New method definition.
14036         (Output_file_header::do_size)::New method declaration.
14037         (Output_section_data::Output_section_data): Add new parameter
14038         is_data_size_fixed and use it to fix data size.
14039         (Output_data_const::Output_data_const): Adjust call to base class
14040         constructor and fix data size.
14041         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
14042         base class constructor and fix data size.
14043         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
14044         base class constructor and fix data size.
14045         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
14046         class constructor and fix data size.
14047         (Output_data_group::set_final_data_size): New method definition.
14048         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
14049         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
14050         class constructor and fix data size.
14051         (Output_relaxed_input_section): New class definition.
14052         (Output_section::Simple_input_section): New class definition.
14053         (Output_section::get_input_sections): Adjust parameter list.
14054         (Output_section::add_input_section_for_script): Same.
14055         (Output_section::save_states, Output_section::restore_states,
14056         Output_section::do_address_and_file_offset_have_reset_values,
14057         (Output_section::Input_section::Input_section): Handle
14058         RELAXED_INPUT_SECTION_CODE.  Add new overload for
14059         Output_relaxed_input_section.
14060         (Output_section::Input_section::is_input_section,
14061         Output_section::Input_section::set_output_section): Handle relaxed
14062         input section.
14063         (Output_section::Input_section::is_relaxed_input_section,
14064         Output_section::Input_section::output_section_data,
14065         Output_section::Input_section::relaxed_input_section): New method
14066         definitions.
14067         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
14068         value.
14069         (Output_section::Input_section::u1_): Update comments.
14070         (Output_section::Input_section::u2_): Add new union member poris.
14071         (Output_section::Checkpoint_output_section): New classs definition.
14072         (Output_section::relax_input_section): New method declaration.
14073         (Output_section::checkpoint_): New data member.
14074         (Output_segment): Update comments.
14075         (Output_segment::Output_segment): Un-privatize copy constructor.
14076         (Output_segment::operator=): Un-privatize.
14077         * script-sections.cc (Output_section_element::Input_section_list):
14078         Change element type to Output_section::Simple_input_section.
14079         (Output_section_element_dot_assignment::set_section_addresses):
14080         Register output section data for relaxation clean up.
14081         (Output_data_exression::Output_data_expression): Adjust call to base
14082         constructor to fix data size.
14083         (Output_section_element_data::set_section_addresses): Register
14084         Output_data_expression object for relaxation clean up.
14085         (struct Input_section_info): Replace Relobj pointer and section index
14086         pair with Output_section::Simple_input_section and Convert struct to a
14087         class.
14088         (Input_section_sorter::operator()): Adjust access to
14089         Input_section_info data member to use accessors.
14090         (Output_section_element_input::set_section_addresses): Use layout
14091         parameter.  Adjust code to use Output_section::Simple_input_section
14092         and Input_secction_info classes.  Register filler for relaxation
14093         clean up.
14094         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
14095         and section index pair with Output_section::Simple_input_section
14096         class.  Adjust code accordingly.
14097         (Phdrs_element::release_segment): New method definition.
14098         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
14099         segment list.
14100         (Script_sections::release_segments): New method definition.
14101         * gold/script-sections.h (Script_sections::release_segments): New
14102         method declaration.
14103         * gold/target.h (Target::may_relax, Target::relax,
14104         Target::do_may_relax, Target::do_relax): New method definitions.
14105
14106 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
14107
14108         * arm.cc (has_signed_unsigned_overflow): New function.
14109         (Arm_relocate_functions::abs8): New function.
14110         (Target_arm::Scan::local): Handle R_ARM_ABS8.
14111         (Target_arm::Scan::global): Likewise.
14112         (Target_arm::relocate::relocate): Likewise.
14113         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
14114         Likewise.
14115
14116 2009-09-16  Cary Coutant  <ccoutant@google.com>
14117
14118         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
14119         * testsuite/Makefile.in: Regenerate.
14120
14121 2009-09-11  Nick Clifton  <nickc@redhat.com>
14122
14123         * po/gold.pot: Updated by the Translation project.
14124
14125 2009-09-08  Cary Coutant  <ccoutant@google.com>
14126
14127         * output.cc (Output_file::open): Add execute permission to empty file.
14128         * testsuite/Makefile.am (permission_test): New test.
14129         * testsuite/Makefile.in: Regenerate.
14130
14131 2009-09-02  Ian Lance Taylor  <iant@google.com>
14132
14133         * output.cc (Output_file::resize): Call map_no_anonymous rather
14134         than map.
14135
14136 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
14137
14138         * gold.cc: Include "incremental.h".
14139         (queue_initial_tasks): Call Incremental_checker methods.
14140         * incremental.cc: Include "output.h".
14141         (Incremental_checker::can_incrementally_link_output_file): New
14142         method.
14143         * incremental.h (Incremental_checker): New class.
14144
14145         * output.cc (Output_file::open_for_modification): New method.
14146         (Output_file::map_anonymous): Changed return type to bool.  Record
14147         map in base_ field.
14148         (Output_file::map_no_anonymous): New method, broken out of map.
14149         (Output_file::map): Use map_no_anonymous and map_anonymous.
14150         * output.h (class Output_file): Update declarations.
14151
14152 2009-08-24  Cary Coutant  <ccoutant@google.com>
14153
14154         * options.h (Command_line::Pre_options): New class.
14155         (Command_line::pre_options): New member.
14156         * options.cc (gold::options::ready_to_register): New variable.
14157         (One_option::register_option): Do nothing if not registering options.
14158         Assert if same short option registered twice.
14159         (General_options::General_options): Turn off option registration when
14160         done constructing.
14161         (Command_line::Pre_options::Pre_options): New constructor.
14162
14163 2009-08-24  Cary Coutant  <ccoutant@google.com>
14164
14165         * options.h (General_options::no_keep_memory): Remove incorrect
14166         short option.
14167
14168 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
14169
14170         * Makefile.am (am__skiplex, am__skipyacc): New.
14171         * Makefile.in: Regenerate.
14172
14173 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
14174
14175         * Makefile.am (AM_CPPFLAGS): Renamed from ...
14176         (INCLUDES): ... this.
14177         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
14178         (AM_CPPFLAGS): Renamed from ...
14179         (INCLUDE): ... this.
14180         * Makefile.in, testsuite/Makefile.in: Regenerate.
14181
14182         * Makefile.in: Regenerate.
14183         * aclocal.m4: Likewise.
14184         * config.in: Likewise.
14185         * configure: Likewise.
14186         * testsuite/Makefile.in: Likewise.
14187
14188         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
14189         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
14190         * Makefile.in: Regenerate.
14191         * testsuite/Makefile.in: Regenerate.
14192
14193 2009-08-19  Cary Coutant  <ccoutant@google.com>
14194
14195         * resolve.cc (Symbol_table::resolve): Don't complain about defined
14196         symbols in shared libraries overridden by hidden or internal symbols
14197         in the main program.
14198
14199 2009-08-19  Chris Demetriou  <cgd@google.com>
14200
14201         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
14202         checking source file names in error messages.
14203
14204 2009-08-18  Doug Kwan  <dougkwan@google.com>
14205
14206         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
14207         an elcpp::Ehdr as parameter.  Adjust call to set_target.
14208         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
14209         an elfcpp::Ehdr as parameter.
14210         * object.cc (Object::set_target): Remove the version that looks up
14211         a target and sets it.
14212         (Sized_relobj::setup): Take a Target object instead of
14213         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
14214         (make_elf_sized_object): Find target and ask target to
14215         make an ELF object.
14216         * object.h: (Object::set_target): Remove the version that looks up
14217         a target and sets it.
14218         (Sized_relobj::setup): Take a Target object instead of
14219         an elfcpp:Ehdr as parameter.
14220         * target.cc: Include dynobj.h.
14221         (Target::do_make_elf_object_implementation): New.
14222         (Target::do_make_elf_object): New.
14223         * target.h (Target::make_elf_object): New template declaration.
14224         (Target::do_make_elf_object): New method declarations.
14225         (Target::do_make_elf_object_implementation): New template declaration.
14226
14227 2009-08-14  Ian Lance Taylor  <iant@google.com>
14228
14229         * gold.h (FUNCTION_NAME): Define.
14230         (gold_unreachable): Use FUNCTION_NAME.
14231
14232 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
14233
14234         * icf.cc (Icf::find_identical_sections): Issue a warning when a
14235         symbol in the --keep-unique list is not found.
14236
14237 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
14238
14239         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
14240         been maked as --keep-unique.
14241         (Icf::unfold_section): New function.
14242         * icf.h (Icf::unfold_section): New function.
14243         * options.h (General_options::keep_unique): New option.
14244         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
14245         * testsuite/Makefile.in: Regenerate.
14246         * testsuite/icf_keep_unique_test.sh: New file.
14247         * testsuite/icf_keep_unique_test.cc: New file.
14248
14249 2009-08-12  Cary Coutant  <ccoutant@google.com>
14250
14251         PR 10471
14252         * resolve.cc (Symbol_table::resolve): Check for references from
14253         dynamic objects to hidden and internal symbols.
14254         * testsuite/Makefile.am (hidden_test.sh): New test.
14255         * testsuite/Makefile.in: Regenerate.
14256         * testsuite/hidden_test.sh: New script.
14257         * testsuite/hidden_test_1.c: New test source.
14258         * testsuite/hidden_test_main.c: New test source.
14259
14260 2009-08-11  Doug Kwan  <dougkwan@google.com>
14261
14262         * arm.cc: Update comments.
14263         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
14264         segment to locate the .ARM.exidx section if present.
14265
14266 2009-08-09  Doug Kwan  <dougkwan@google.com>
14267
14268         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
14269         patch.
14270
14271 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
14272         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
14273         compiler warnings.
14274
14275 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
14276
14277         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
14278         valid tls_segment only for non-debug-section relocations.
14279         * testsuite/Makefile.am: Add gc_tls_test.
14280         * testsuite/Makefile.in: Regenerate.
14281         * testsuite/gc_tls_test.cc: New file.
14282         * testsuite/gc_tls_test.sh: New file.
14283
14284 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
14285
14286         * icf.cc: New file.
14287         * icf.h: New file.
14288         * Makefile.am (CCFILES): Add icf.cc.
14289         (HFILES): Add icf.h
14290         * Makefile.in: Regenerate.
14291         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
14292         * gc.h (gc_process_relocs): Populate lists used by icf to contain
14293         section, symbol and addend information for the relocs.
14294         * gold.cc (queue_middle_tasks): Call identical code folding.
14295         * gold.h: Add defines for multimap.
14296         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
14297         to the call of finalize_local_symbols.
14298         * main.cc (main): Create object of class Icf.
14299         * object.cc (Sized_relobj::do_layout): Allow this function to be
14300         called twice during icf.
14301         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
14302         to sections marked as identical by icf.
14303         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
14304         when available.
14305         (Sized_relobj::do_section_entsize): New function.
14306         * object.h (Object::section_entsize): New function.
14307         (Object::do_section_entsize): New pure virtual function.
14308         (Relobj::finalize_local_symbols): Add new parameter.
14309         (Relobj::do_section_entsize): New function.
14310         * options.h (General_options::icf): New option.
14311         (General_options::icf_iterations): New option.
14312         (General_options::print_icf_sections): New option.
14313         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
14314         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
14315         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
14316         icf.
14317         * symtab.cc (Symbol_table::is_section_folded): New function.
14318         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
14319         to sections marked as identical by icf.
14320         * symtab.h (Symbol_table::set_icf): New function.
14321         (Symbol_table::icf): New function.
14322         (Symbol_table::is_section_folded): New function.
14323         (Symbol_table::icf_): New data member.
14324         * target-reloc.h (relocate_section): Ignore sections folded by icf.
14325         * testsuite/Makefile.am: Add commands to build icf_test.
14326         * testsuite/Makefile.in: Regenerate.
14327         * testsuite/icf_test.sh: New file.
14328         * testsuite/icf_test.cc: New file.
14329
14330 2009-07-24  Chris Demetriou  <cgd@google.com>
14331
14332         * layout.cc (is_compressible_debug_section): Fix incorrect
14333         comment about compressed section names.
14334
14335 2009-07-20  Ian Lance Taylor  <ian@airs.com>
14336
14337         PR 10419
14338         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
14339
14340 2009-07-16  Ian Lance Taylor  <iant@google.com>
14341
14342         PR 10400
14343         * layout.h: #include <map>.
14344         (class Kept_section): Change from struct to class.  Add accessors
14345         and setters.  Add section size to Comdat_group mapping.  Change
14346         Comdat_group to std::map.  Add is_comdat_ field.  Add
14347         linkonce_size field in union.
14348         (class Layout): Update declaration of find_or_add_kept_section.
14349         Don't declare find_kept_object.
14350         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
14351         parameter.  Add object, shndx, is_comdat, and is_group_name
14352         parameters.  Change all callers.  Adjust for new Kept_section.
14353         (Layout::find_kept_object): Remove.
14354         * object.cc (Sized_relobj::include_section_group): Update use of
14355         Kept_section.  Rename secnum to shndx.  Only record
14356         Kept_comdat_section if sections are the same size.
14357         (Sized_relobj::include_linkonce_section): Update use of
14358         Kept_section.  Only record Kept_comdat_section if sections are the
14359         same size.  Set size of linkonce section.
14360         (Sized_relobj::map_to_kept_section): Update call to
14361         get_kept_comdat_section.
14362         * object.h (class Sized_relobj): Rename fields in
14363         Kept_comdat_section to drop trailing underscores; change object
14364         field to Relobj*.  Change Kept_comdat_section_table to store
14365         struct rather than pointer.
14366         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
14367         Add kept_object and kept_shndx parameters.  Change all callers.
14368         (Sized_relobj::get_kept_comdat_section): Change return type to
14369         bool.  Add kept_object and kept_shndx parameters.  Change all
14370         callers.
14371         * plugin.cc (Pluginobj::include_comdat_group): Update call to
14372         Layout::find_or_add_kept_section.
14373
14374 2009-07-09  Ian Lance Taylor  <iant@google.com>
14375
14376         * merge.cc (Object_merge_map::initialize_input_to_output_map):
14377         Reserve space in the hash table.
14378
14379 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
14380
14381         * fileread.cc (File_read::get_mtime): New method.
14382         * fileread.h (Timespec): New structure.
14383         (File_read::get_mtime): New method.
14384         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
14385         Renamed from timestamp_nsec.
14386         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
14387         Elf_Xword.
14388         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
14389         timestamp_nsec.
14390         (Incremental_inputs::report_archive): Save mtime; style fix.
14391         (Incremental_inputs::report_obejct): Save mtime; style fix.
14392         (Incremental_inputs::report_script): Save mtime; style fix.
14393         (Incremental_inputs::finalize_inputs): Style fix.
14394         (Incremental_inputs::finalize): Style fix.
14395         (Incremental_inputs::create_input_section_data): Store inputs
14396         mtime.
14397         * incremental.h (Incremental_inputs::report_script): Add mtime
14398         argument.
14399         (Incremental_inputs::Input_info::Input_info): Intialize only one
14400         union member.
14401         (Incremental_inputs::Input_info::archive): Move to nameless
14402         union.
14403         (Incremental_inputs::Input_info::obejct): Move to nameless union.
14404         (Incremental_inputs::Input_info::script): Move to nameless union.
14405         (Incremental_inputs::mtime): New field.
14406         * script.cc (read_input_script): Pass file mtime to
14407         Incremental_input.
14408         * script.h (Script_info::inputs): Style fix.
14409
14410 2009-07-01  Ian Lance Taylor  <ian@airs.com>
14411
14412         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
14413         instead of 32.
14414
14415 2009-06-24  Ian Lance Taylor  <iant@google.com>
14416
14417         PR 10156
14418         * layout.cc (Layout::choose_output_section): If we find an
14419         existing section, update the flags.
14420         (Layout::create_notes): New function, broken out of
14421         Layout::finalize.
14422         (Layout::finalize): Don't create note sections.
14423         (Layout::create_note): Don't crash if linker script discards
14424         section.
14425         (Layout::create_gold_note): Likewise.
14426         (Layout::create_build_id): Likewise.  Don't set
14427         after_input_sections on the section.
14428         (Layout::create_executable_stack_info): Remove target parameter.
14429         Change caller.
14430         * layout.h (class Layout): Declare create_notes.  Update
14431         declaration of create_executable_stack_info.
14432         * gold.cc (queue_middle_tasks): Call create_notes.
14433         * output.cc (Output_section::update_flags_for_input_section): Move
14434         here from output.h.  If SHF_ALLOC flag is newly set, mark address
14435         invalid.
14436         * output.h (Output_data::mark_address_invalid): New function.
14437         (class Output_section): Only declare, not define,
14438         update_flags_for_input_section.  Remove set_flags.
14439
14440 2009-06-24  Ian Lance Taylor  <iant@google.com>
14441
14442         * script-sections.cc (Output_section_definition::
14443         set_section_addresses): Rename shadowing local load_address to
14444         laddr.
14445
14446 2009-06-24  Ian Lance Taylor  <iant@google.com>
14447
14448         PR 10244
14449         * reloc.cc (relocate_sections): Skip empty relocation sections.
14450
14451 2009-06-23  Ian Lance Taylor  <iant@google.com>
14452
14453         PR 10156
14454         * layout.cc (Layout::create_note): Use choose_output_section
14455         rather than make_output_section.
14456
14457 2009-06-23  Ian Lance Taylor  <iant@google.com>
14458
14459         PR 10237
14460         * options.cc (General_options::parse_V): Set printed_version_.
14461         (General_options::General_options): Initialize printed_version_.
14462         * options.h (class General_options): Add printed_version_ field.
14463         * gold.cc (queue_initial_tasks): If there are no input files,
14464         don't give a fatal error if we printed the version information.
14465         (queue_middle_tasks): If using -r with a shared object, give a
14466         fatal error rather than an ordinary error.
14467
14468 2009-06-23  Ian Lance Taylor  <iant@google.com>
14469
14470         PR 10219
14471         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
14472         (Layout::make_output_section): Set have_stabstr_section_ if we see
14473         a .stab*str section.
14474         (Layout::finalize): Call link_stabs_sections.
14475         (Layout::link_stabs_sections): New file.
14476         * layout.h (class Layout): Add have_stabstr_section_ field.
14477         Declare link_stabs_sections.
14478
14479 2009-06-23  Doug Kwan  <dougkwan@google.com>
14480
14481         * Makefile.am (libgold_a_LIBADD): New.
14482         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
14483         * Makefile.in: Regenerate.
14484         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
14485         * configure: Regenerate.
14486         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
14487         * fileread.cc: Include sys/state.h
14488         * gold.h: Declare memmem and strndup if found missing.
14489         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
14490
14491 2009-06-23  Ian Lance Taylor  <iant@google.com>
14492
14493         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
14494         * configure: Rebuild.
14495
14496 2009-06-23  Ian Lance Taylor  <iant@google.com>
14497
14498         PR 10147
14499         * object.cc (Object::section_contents): Don't try to get a view if
14500         the section has length zero.
14501         (Object::handle_gnu_warning_section): If the section is empty, use
14502         the name of the section as the warning.
14503
14504 2009-06-23  Ian Lance Taylor  <iant@google.com>
14505
14506         PR 10133
14507         * stringpool.h (class Stringpool_template): Add optimize_ field.
14508         (Stringpool_template::set_optimize): New function.
14509         * stringpool.cc (Stringpool_template::Stringpool_template):
14510         Initialize optimize_ field.
14511         (Stringpool_template::set_string_offsets): Test local optimize
14512         fild rather than parameter.
14513         * layout.cc (Layout::Layout): Call set_optimize on the section
14514         name stringpool.
14515
14516 2009-06-22  Ian Lance Taylor  <iant@google.com>
14517
14518         PR 10030
14519         * yyscript.y: Parse TARGET.
14520         * script.cc (script_set_target): New function.
14521         * script-c.h (script_set_target): Declare.
14522         * options.cc (General_options::string_to_object_format): Rename
14523         from string_to_object_format in anonymous namespace.  Change
14524         callers.
14525         * options.h (class General_options): Declare
14526         string_to_object_format.
14527
14528 2009-06-22  Ian Lance Taylor  <iant@google.com>
14529
14530         * script-sections.cc (Script_sections::create_segments): Don't put
14531         program headers in a PT_LOAD segment if -n or -N.
14532
14533 2009-06-22  Ian Lance Taylor  <iant@google.com>
14534
14535         PR 10141
14536         * options.h (class General_options): Add -z lazy and -z now.  Sort
14537         -z options into alphabetical order.
14538         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
14539
14540 2009-06-21  Ian Lance Taylor  <iant@google.com>
14541
14542         * layout.cc (Layout::make_output_section): Call
14543         Target::new_output_section.
14544         (Layout::attach_allocated_section_to_segment): Put large section
14545         sections in a separate load segment with the large segment flag
14546         set.
14547         (Layout::segment_precedes): Sort large data segments after other
14548         load segments.
14549         (align_file_offset): New static function.
14550         (Layout::set_segment_offsets): Use align_file_offset.
14551         * output.h (class Output_section): Add is_small_section_ and
14552         is_large_section_ fields.
14553         (Output_section::is_small_section): New function.
14554         (Output_section::set_is_small_section):  New function.
14555         (Output_section::is_large_section): New function.
14556         (Output_section::set_is_large_section): New function.
14557         (Output_section::is_large_data_section): New function.
14558         (class Output_segment): Add is_large_data_segment_ field.
14559         (Output_segment::is_large_data_segment): New function.
14560         (Output_segment::set_is_large_data_segment): New function.
14561         * output.cc (Output_section::Output_section): Initialize new
14562         fields.
14563         (Output_segment::Output_segment): Likewise.
14564         (Output_segment::add_output_section): Add assertion that large
14565         data sections always go in large data segments.  Force small data
14566         sections to the end of the list of data sections.  Force small BSS
14567         sections to the start of the list of BSS sections.  For large BSS
14568         sections to the end of the list of BSS sections.
14569         * symtab.h (class Symbol): Declare is_common_shndx.
14570         (Symbol::is_defined): Check Symbol::is_common_shndx.
14571         (Symbol::is_common): Likewise.
14572         (class Symbol_table): Define enum Commons_section_type.  Update
14573         declarations.  Add small_commons_ and large_commons_ fields.
14574         * symtab.cc (Symbol::is_common_shndx): New function.
14575         (Symbol_table::Symbol_table): Initialize new fields.
14576         (Symbol_table::add_from_object): Put small and large common
14577         symbols in the right list.
14578         (Symbol_table::sized_finalized_symbol): Check
14579         Symbol::is_common_shndx.
14580         (Symbol_table::sized_write_globals): Likewise.
14581         * common.cc (Symbol_table::do_allocate_commons): Allocate new
14582         common symbol lists.  Don't call do_allocate_commons_list if the
14583         list is empty.
14584         (Symbol_table::do_allocate_commons_list): Remove is_tls
14585         parameter.  Add comons_section_type parameter.  Change all
14586         callers.  Handle small and large common symbols.
14587         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
14588         Symbol::is_common_shndx.
14589         * resolve.cc (symbol_to_bits): Likewise.
14590         * target.h (Target::small_common_shndx): New function.
14591         (Target::small_common_section_flags): New function.
14592         (Target::large_common_shndx): New function.
14593         (Target::large_common_section_flags): New function.
14594         (Target::new_output_section): New function.
14595         (Target::Target_info): Add small_common_shndx, large_common_shndx,
14596         small_common_section_flags, and large_common_section_flags
14597         fields.
14598         (Target::do_new_output_section): New virtual function.
14599         * arm.cc (Target_arm::arm_info): Initialize new fields.
14600         * i386.cc (Target_i386::i386_info): Likewise.
14601         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
14602         Likewise.
14603         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
14604         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14605         (Target_x86_64::do_new_output_section): New function.
14606         * configure.ac: Define conditional MCMODEL_MEDIUM.
14607         * testsuite/Makefile.am (check_PROGRAMS): Add large.
14608         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
14609         (large_LDFLAGS): Define.
14610         * testsuite/large.c: New file.
14611         * testsuite/testfile.cc (Target_test::test_target_info):
14612         Initialize new fields.
14613         * configure, testsuite/Makefile.in: Rebuild.
14614
14615 2009-06-05  Doug Kwan  <dougkwan@google.com>
14616
14617         * Makefile.am (CCFILES): Add target.cc.
14618         * Makefile.in: Regenerate.
14619         * i386.cc (class Target_i386): Define new virtual method to
14620         override do_is_local_label_name in parent.
14621         * object.cc (Sized_relobj::do_count_local_symbols): Discard
14622         local symbols if --discard-locals or -X is given.
14623         * options.h (class General_options): Declare new options
14624         '--discard-locals' and '-X' for discarding locals.
14625         * target.h (class Target): Define new methods is_local_label_name.
14626         Declare new virtual method do_is_local_label_name.
14627         * target.cc: New file.
14628         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
14629         (check_SCRIPTS): Add discard_locals_test.sh.
14630         (check_DATA): Add discard_local_tests.syms.
14631         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
14632         (discard_local_tests.syms, discard_locals_test.o): New make rules.
14633         * testsuite/Makefile.in: Regenerate.
14634         * testsuite/discard_locals_test.c: New file.
14635         * testsuite/discard_locals_test.sh: Same.
14636
14637 2009-06-05  Doug Kwan  <dougkwan@google.com>
14638
14639         * object.cc (Sized_relobj::Sized_relobj): Initialize
14640         discarded_eh_frame_shndx_ to -1U.
14641         (Sized_relobj::do_layout): Record index of a discard .eh_frame
14642         section.
14643         (Sized_relobj::do_count_local_symbols): Skip local symbols in
14644         a discarded .eh_frame section.
14645         (Sized_relobj::do_finalize_local_symbols): Ditto.
14646         * object.h (class Sized_relobj): Declare new member
14647         discarded_eh_frame_shndx_.
14648         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
14649         (local_labels_test.o, local_labels_test): New rules.
14650         * testsuite/Makefile.in: Regenerate.
14651
14652 2009-06-04  Doug Kwan  <dougkwan@google.com>
14653
14654         * layout.cc (Layout::section_name_mapping): Add mapping for
14655         special ARM sections.
14656
14657 2009-06-03  Doug Kwan  <dougkwan@google.com>
14658
14659         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
14660         (utils::has_overflow): Same.
14661
14662 2009-06-03  Ian Lance Taylor  <iant@google.com>
14663
14664         * layout.cc (Layout::section_name_mapping): New array, replacing
14665         Layout::linkonce_mapping.
14666         (Layout::section_name_mapping_count): New variable, replacing
14667         Layout::linkonce_mapping_count.
14668         (Layout::linkonce_output_name): Remove.
14669         (Layout::output_section_name): Rewrite.
14670         * layout.h (class Layout): Rename Linkonce_mapping to
14671         Section_name_mapping, linkonce_mapping to section_name_mapping,
14672         linkonce_mapping_count to section_name_mapping_count.  Don't
14673         declare linkonce_output_name.
14674
14675 2009-06-03  Doug Kwan  <dougkwan@google.com>
14676
14677         * gold/arm.cc (namespace utils): New.
14678         (Target_arm::reloc_is_non_pic): Define new method.
14679         (class Arm_relocate_functions): New.
14680         (Target_arm::Relocate::relocate): Handle relocation types used by
14681         Android.
14682
14683 2009-06-03  Ian Lance Taylor  <iant@google.com>
14684
14685         * arm.cc (Target_arm::scan::global): Use || instead of |.
14686
14687 2009-06-02  Doug Kwan  <dougkwan@google.com>
14688
14689         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
14690         issued_non_pic_error_.
14691         (class Target_arm::Scan): Declare new method check_non_pic.
14692         Define new method symbol_needs_plt_entry.
14693         Declare new data member issued_non_pic_error_.
14694         (class Target_arm::Relocate): Declare new method
14695         should_apply_static_reloc.
14696         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
14697         (Target_arm::Scan::check_non_pic): Define new method.
14698         (Target_arm::Scan::local): Handle a small subset of reloc types used
14699         by Android.
14700         (Target_arm::Scan::local): Same.
14701         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
14702
14703 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
14704
14705         * incremental.cc (Incremental_inputs::report_command_line): Filter
14706         out --incremental-* options.
14707
14708 2009-05-29  Doug Kwan  <dougkwan@google.com>
14709
14710         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
14711         template class.
14712         (class Target_arm): Update comment.
14713         (Target_arm::Target_arm): Initialize new data members GOT_,
14714         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
14715         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
14716         and Target_arm::rel_dyn_section.
14717         Declare new_enum Target_arm::Got_type.
14718         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
14719         and DYNBSS_.
14720         Update commments for member do_dynsym_value.
14721         (Target_arm::got_size, Target_arm::plt_section,
14722         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
14723         new methods inside class defintion.
14724         (Target_arm::got_section): Define new method.
14725         (Target_arm::rel_dyn_section): Same.
14726         (Output_data_plt_arm): New template class.
14727         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
14728         (Output_data_plt_arm:do_adjust_output_section): Define new method.
14729         (Output_data_plt_arm::add_entry): Same.
14730         (Output_data_plt_arm::first_plt_entry): Define new
14731         static data member for PLT instruction template.
14732         (Output_data_plt_arm::plt_entry): Same.
14733         (Output_data_plt_arm::do_write): Define new method.
14734         (Target_arm::make_plt_entry): Same.
14735         (Target_arm::do_finalize_sections): Same.
14736         (Target_arm::do_dynsym_value): Same.
14737
14738 2009-05-28  Doug Kwan  <dougkwan@google.com>
14739
14740         * Makefile.am (TARGETSOURCES): Add arm.cc.
14741         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
14742         * Makefile.in: Regenerate.
14743         * arm.cc: New file.
14744         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
14745
14746 2009-05-26  Doug Kwan  <dougkwan@google.com>
14747
14748         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
14749         (General_options::check_excluded_libs): Strip off directories in
14750         archive name before matching like GNU ld does.
14751         * testsuite/Makefile.am (MOSTLYCLEANFILES,
14752         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
14753         (exclude_libs_test_LDFLAGS): Add linker option
14754         -Wl,--exclude-libs,libexclude_libs_test_3
14755         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
14756         an explicit archive without using -l.
14757         (alt/libexclude_libs_test_3.a): New make rule.
14758         * testsuite/Makefile.in: Regenerate.
14759         * testsuite/exclude_libs_test.c : Declare lib3_default().
14760         (main): Call it.
14761         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
14762         * exclude_libs_test_3.c: New file.
14763
14764 2009-05-26  Nick Clifton  <nickc@redhat.com>
14765
14766         * po/id.po: New Indonesian translation.
14767         * po/gold.pot: Updated template file.
14768
14769 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
14770
14771         * testsuite/Makefile.am: Add -ffunction-sections to compile
14772         gc_comdat_test files.  Add -Wl,--gc-sections to build
14773         gc_comdat_test.
14774         * testsuite/Makefile.in: Regenerate.
14775         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
14776
14777 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
14778
14779         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
14780         kept comdat section was garbage collected.
14781         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
14782         * testsuite/Makefile.in: Regenerate.
14783         * testsuite/gc_comdat_test.sh: New file.
14784         * testsuite/gc_comdat_test_1.cc: New file.
14785         * testsuite/gc_comdat_test_2.cc: New file.
14786
14787 2009-05-19  Doug Kwan  <dougkwan@google.com>
14788
14789         * archive.cc (Archive::Archive): Move constructor from archive.h
14790         to here.  Initialize no_export_.
14791         (Archive::get_elf_object_for_member): Set no_export flag of object.
14792         * archive.h (Archive::Archive): Move constructor body to
14793         archive.cc.
14794         (Archive::no_export): New method.
14795         (Archive::no_export_): New field.
14796         * object.h (Object::Object): Initialize no_export_ to false.
14797         (Object::no_export, Object::set_no_export): New methods.
14798         (Object::no_export_): New field.
14799         * options.cc (General_options::parse_exclude_libs): New method.
14800         (General_options::check_excluded_libs) Same.
14801         * options.h (exclude_libs): New option.
14802         (General_options::check_excluded_libs): New method declaration.
14803         (General_options::excluded_libs_): New field.
14804         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
14805         default or protected visibility if an object has no-export flag set.
14806         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
14807         (check_SCRIPTS): Add exclude_libs_test.sh.
14808         (check_DATA): Add exclude_libs_test.syms.
14809         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
14810         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
14811         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
14812         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
14813         (exclude_libs_test.syms, libexclude_libs_test_1.a,
14814         libexclude_libs_test_2.a): New rules.
14815         * testsuite/Makefile.in: Regenerate.
14816         * testsuite/exclude_libs_test.c: New file.
14817         * testsuite/exclude_libs_test.sh: Ditto.
14818         * testsuite/exclude_libs_test_1.c: Ditto.
14819         * testsuite/exclude_libs_test_2.c: Ditto.
14820
14821 2009-05-15  Ian Lance Taylor  <iant@google.com>
14822
14823         * configure.ac: Check for declarations for cases where libiberty.h
14824         checks HAVE_DECL_xxx.
14825         * configure, config.in: Rebuild.
14826
14827 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
14828
14829         * gold.h (Incremental_argument_list): Remove (invalid) forward
14830         declaration.
14831         * incremental.cc (Incremental_inputs::report_achive): New method.
14832         (Incremental_inputs::report_object): New method.
14833         (Incremental_inputs::report_script): New method.
14834         (Incremental_inputs::finalize_inputs): New method.
14835         (Incremental_inputs::finalize): Call finalize_inputs().
14836         (Incremental_inputs::sized_create_incremental_inputs_section_data):
14837         Create inputs entries.
14838         * incremental.h (Incremental_input_type): New enum.
14839         (Incremental_inputs::Incremental_input): Initialize new fields.
14840         (Incremental_inputs::report_inputs): New method.
14841         (Incremental_inputs::report_achive): New method.
14842         (Incremental_inputs::report_object): New method.
14843         (Incremental_inputs::report_script): New method.
14844         (Incremental_inputs::finalize_inputs): New method.
14845         (Incremental_inputs::Input_info): New struct.
14846         (Incremental_inputs::Input_info_map): New typedef.
14847         (Incremental_inputs::lock_): New field.
14848         (Incremental_inputs::Inputs_): New field.
14849         (Incremental_inputs::Inputs_map): New field.
14850         * main.cc (main): Call Incremental_input::report_inputs.
14851         * options.h (Input_argument_list): Typedef moved from
14852         Input_arguments.
14853         (Input_file_group::Files): Remove, use ::Input_argument_list.
14854         (Input_file_group::Input_argument_list): Remove, use
14855         ::Input_argument_list.
14856         * plugin.cc (Plugin_manager::add_input_file): Add error in
14857         incremental build.
14858         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
14859         functions.
14860         * script.cc (read_input_script): Call
14861         Incremental_input::report_script.
14862         * script.h (Script_info): New class.
14863
14864 2009-04-27  Ian Lance Taylor  <iant@google.com>
14865
14866         * x86_64.cc (do_adjust_output_section): Set entsize to
14867         plt_entry_size.
14868
14869 2009-04-23  Elliott Hughes  <enh@google.com>
14870
14871         * output.cc (Output_file::close): After short writes, continue
14872         writing from the correct offset in the buffer being written.
14873
14874 2009-04-23  Chris Demetriou  <cgd@google.com>
14875
14876         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
14877         * configure: Regenerate.
14878         * config.in: Regenerate.
14879         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
14880         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
14881
14882 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
14883
14884         * incremental.cc (Incremental_inputs_header_data): Renamed from
14885         Incremental_input_header_data.
14886         (Incremental_inputs_header_data::data_size): New field.
14887         (Incremental_inputs_header_data::put_input_file_count): Renamed
14888         from input_file_count.
14889         (Incremental_inputs_header_data::put_command_line_offset): Renamed
14890         from command_line_offset.
14891         (Incremental_inputs_header_data::put_reserved): Renamed from
14892         put_reserved.
14893         (Incremental_inputs_entry_data): Renamed from
14894         Incremental_input_entry_data.
14895         (Incremental_inputs_entry_data::data_size): New field.
14896         (Incremental_inputs::report_command_line): New method.
14897         (Incremental_inputs::finalize): New method.
14898         (Incremental_inputs::create_incremental_inputs_data): New method.
14899         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
14900         * incremental.h: New file.
14901         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
14902         (Layout::finalize): Create incremental inputs section in
14903         incremental builds.
14904         (Layout::create_incremental_info_sections): New method.
14905         * layout.h (Layout::incremental_inputs): New method.
14906         (Layout::create_incremental_info_sections): New method.
14907         (Layout::incremental_inputs_): New field.
14908         * main.cc (main): Notify Incremental_input of the command line.
14909
14910 2009-04-01  Ian Lance Taylor  <iant@google.com>
14911             Mikolaj Zalewski  <mikolajz@google.com>
14912
14913         * gold.h (reserve_unordered_map): Define, three versions, one for
14914         each version of Unordered_map.
14915         * layout.cc (Layout::Layout): Remove options parameter.  Add
14916         number_of_input_files parameter.  Don't initialize options_.
14917         Initialize number_of_input_files_ and resized_signatures_.  Move
14918         sections_are_attached_.
14919         (Layout::layout_group): Reserve space for group_signatures_.
14920         (Layout::find_or_add_kept_section): Change name parameter to be a
14921         reference.  Resize signatures_ map when it gets large enough.
14922         (Layout::layout_eh_frame): Use parameters->options() instead of
14923         this->options_.
14924         (Layout::make_output_section): Likewise.
14925         (Layout::attach_allocated_section_to_segment): Likewise.
14926         (Layout::finalize, Layout::create_executable_stack): Likewise.
14927         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
14928         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
14929         * layout.h (class Layout): Update declarations.  Remove options_
14930         field.  Add number_of_input_files_ and resized_signatures_
14931         fields.  Move sections_are_attached_ field.
14932         * main.cc (main): Pass number of input files to Layout
14933         constructor.  Don't pass options.
14934
14935 2009-03-30  Ian Lance Taylor  <iant@google.com>
14936
14937         * ffsll.c (ffsll): Correct implementation.
14938
14939 2009-03-27  Ian Lance Taylor  <iant@google.com>
14940
14941         * ffsll.c: New file.
14942         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
14943         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
14944         * ftruncate.c (ftruncate): Declare before definition.
14945         * mremap.c (mremap): Likewise.
14946         * pread.c (pread): Likewise.
14947         * configure, Makefile.in, config.in: Rebuild.
14948
14949         * mremap.c: New file.
14950         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
14951         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
14952         (mremap): Declare if HAVE_MREMAP is not defined.
14953         * configure, Makefile.in, config.in: Rebuild.
14954
14955 2009-03-27  Cary Coutant  <ccoutant@google.com>
14956
14957         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
14958         position independent.
14959         * sparc.cc (Target_sparc::check_non_pic): Likewise.
14960         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
14961
14962 2009-03-24  Cary Coutant  <ccoutant@google.com>
14963
14964         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
14965         an executable.
14966         (needs_dynamic_reloc): Likewise.
14967
14968 2009-03-24  Ian Lance Taylor  <iant@google.com>
14969
14970         * yyscript.y (file_cmd): Recognize EXTERN.
14971         (extern_name_list, extern_name_list_body): New nonterminals.
14972         * script.cc (script_add_extern): Define.
14973         * script-c.h (script_add_extern): Declare.
14974
14975 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
14976
14977         * object.cc (is_elf_object): Define.
14978         * object.h (is_elf_object): Declare.
14979         * archive.cc (Archive::get_elf_object_for_member): Call
14980         is_elf_object.
14981         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
14982
14983 2009-03-24  Elliott Hughes  <enh@google.com>
14984
14985         * output.cc (Output_file::map_anonymous): Define.
14986         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
14987         try an anonymous one.  Report the size if the mmap fails.
14988         * output.h (class Output_file): Declare map_anonymous.
14989
14990 2009-03-24  Ian Lance Taylor  <iant@google.com>
14991
14992         * target-select.cc (instantiate_target): Don't acquire the lock if
14993         the instantiated_target_ field has already been set.
14994
14995 2009-03-23  Ian Lance Taylor  <iant@google.com>
14996
14997         * gold-threads.h (class Initialize_lock): Define.
14998         * gold-threads.cc (class Initialize_lock_once): Define.
14999         (initialize_lock_control): New static variable.
15000         (initialize_lock_pointer): New static variable.
15001         (initialize_lock_once): New static function.
15002         (Initialize_lock::Initialize_lock): Define.
15003         (Initialize_lock::initialize): Define.
15004         * target-select.h: Include "gold-threads.h".
15005         (class Target_selector): Add lock_ and initialize_lock_ fields.
15006         Don't define instantiate_target, just declare it.
15007         * target-select.cc (Target_selector::Target_selector): Initialize
15008         new fields.
15009         (Target_selector::instantiate_target): Define.
15010         * descriptors.h: Include "gold-threads.h".
15011         (class Descriptors): Add initialize_lock_ field.
15012         * descriptors.cc (Descriptors::Descriptors): Initialize new
15013         field.
15014         (Descriptors::open): Use initialize_lock_ field
15015         * errors.h (class Errors): Add initialize_lock_ field.
15016         * errors.cc (Errors::Errors): Initialize new field.
15017         (Errors::initialize_lock): Use initialize_lock_ field.
15018         * powerpc.cc (class Target_selector_powerpc): Remove
15019         instantiated_target_ field.  In do_recognize call
15020         instantiate_target rather than do_instantiate_target.  In
15021         do_instantiate_target just allocate a new target.
15022         * sparc.cc (class Target_selector_sparc): Likewise.
15023
15024         * freebsd.h: New file.
15025         * i386.cc: Include "freebsd.h".
15026         (Target_i386): Derive from Target_freebsd rather than
15027         Sized_target.
15028         (Target_selector_i386): Derive from Target_selector_freebsd rather
15029         than Target_selector.
15030         * x86_64.cc: Include "freebsd.h".
15031         (Target_x86_64): Derive from Target_freebsd rather than
15032         Sized_target.
15033         (Target_selector_x86_64): Derive from Target_selector_freebsd
15034         rather than Target_selector.
15035         * target.h (class Target): Add adjust_elf_header and
15036         do_adjust_elf_header.
15037         * output.cc (Output_file_header:: do_sized_write): Call target
15038         adjust_elf_header routine.
15039         * configure.tgt: Set targ_osabi.
15040         * configure.ac: Define GOLD_DEFAULT_OSABI.
15041         * parameters.cc (Parameters::default_target): Pass
15042         GOLD_DEFAULT_OSABI to select_target.
15043         * target-select.h (class Target_selector): Make instantiate_target
15044         protected rather than private.
15045         * Makefile.am (HFILES): Add freebsd.h.
15046         * configure, Makefile.in, config.in: Rebuild.
15047
15048         * merge.cc (do_add_input_section): Correct pend value.  Change
15049         message about last entry not being null terminated from error to
15050         warning.
15051
15052 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
15053
15054         * incremental.cc: New file.
15055         * Makefile.am (CCFILES): Add incremental.cc.
15056         * Makefile.in: Rebuild.
15057
15058 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
15059
15060         * layout.cc (Layout::output_section_name): Preserve names
15061         of '.note.' sections.
15062
15063 2009-03-19  Ian Lance Taylor  <iant@google.com>
15064
15065         * descriptors.cc (Descriptors::open): Check that the options are
15066         valid before using them.
15067
15068 2009-03-18  Ian Lance Taylor  <iant@google.com>
15069
15070         * script-sections.h: Include <list>.
15071         (class Script_sections): Change Sections_elements from std::vector
15072         to std::list.  Typedef public Elements_iterator.  Add
15073         orphan_section_placement_, data_segment_align_start_, and
15074         saw_data_segment_align_ fields.  Remove data_segment_align_index_
15075         field.
15076         * script-sections.cc (class Orphan_section_placement): New class.
15077         (class Sections_element): Add virtual functions is_relro and
15078         orphan_section_init.  Remove virtual function place_orphan_here.
15079         (class Output_section_definition): Add is_relro and
15080         orphan_section_init.  Remove place_orphan_here.
15081         (class Orphan_output_section): Likewise.
15082         (Script_sections::Script_sections): Update for field changes.
15083         (Script_sections::data_segment_align): Set saw_data_segment_align_
15084         and data_segment_align_start_, not data_segment_align_index.
15085         (Script_sections::data_segment_relro_end): Check
15086         saw_data_segment_align_.  Use data_segment_align_start_ rather
15087         than data_segment_align_index_.
15088         (Script_sections::place_orphan): Rewrite to use
15089         Orphan_section_placement.
15090
15091 2009-03-17  Ian Lance Taylor  <iant@google.com>
15092
15093         * archive.cc (Archive::add_symbols): Check for a version attached
15094         to the symbol name in the archive map.
15095         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
15096         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
15097         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
15098         (ver_test_11.a): New target.
15099         * testsuite/Makefile.in: Rebuild.
15100
15101         * configure.ac: Check for chsize and posix_fallocate.  Replace
15102         ftruncate.
15103         * ftruncate.c: New file, from gnulib.
15104         * output.cc (posix_fallocate): Define dummy version if not
15105         HAVE_POSIX_FALLOCATE.
15106         (Output_file::map): Call posix_fallocate rather than lseek and
15107         write.
15108         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
15109         * configure, Makefile.in, config.in: Rebuild.
15110
15111 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
15112
15113         * layout.h (Layout::create_note): Add section_name parameter.
15114         * layout.cc (Layout::create_note): Likewise.
15115         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
15116
15117 2009-03-17  Ian Lance Taylor  <iant@google.com>
15118
15119         * descriptors.cc: Include "options.h".
15120         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
15121         (Descriptors::open): Always use O_CLOEXEC when opening a new
15122         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
15123         then set FD_CLOEXEC.
15124
15125         * sparc.cc (class Target_sparc): Add has_got_section.
15126         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
15127         make sure we have a GOT section.
15128
15129         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
15130         (Target_sparc::Scan::local): Likewise.
15131         (Target_sparc::Scan::global): Likewise.
15132         (Target_sparc::Relocate::relocate): Likewise.
15133         (Target_sparc::Relocate::relocate_tls): Likewise.
15134
15135         * symtab.cc (Symbol_table::define_default_version): New function,
15136         broken out of add_from_object.
15137         (Symbol_table::add_from_object): Call define_default_version.
15138         (Symbol_table::define_special_symbol): Add resolve_oldsym
15139         parameter.  Change all callers.  If the version for a symbol comes
15140         from a version script, resolve it with the symbol with the same
15141         name with no version.  Also add the symbol without a version if
15142         appropriate.
15143         (do_define_in_output_data): If resolving with oldsym, don't delete
15144         sym.
15145         (do_define_in_output_segment): Likewise.
15146         (do_define_as_constant): Likewise.
15147         * symtab.h (class Symbol_table): Update declarations.
15148
15149 2009-03-13  Ian Lance Taylor  <iant@google.com>
15150
15151         * readsyms.cc (Read_symbols::incompatible_warning): New function.
15152         (Read_symbols::requeue): New function.
15153         (Read_symbols::do_read_symbols): If make_elf_object fails because
15154         the target type is not configured, and the file was searched for,
15155         issue a warning and retry with the next directory.
15156         (Add_symbols::run): If the file has an incompatible format, and
15157         it was searched for, requeue the Read_symbols task.  On error,
15158         release the object.
15159         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
15160         dirindex parameter to constructor.  Change all callers.  Declare
15161         incompatible_warning and requeue.
15162         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
15163         input_argument_ and input_group_ fields.  Add them to
15164         constructor.  Change all callers.
15165         (class Read_script): Add dirindex_ field.  Add it to constructor.
15166         Change all callers.
15167         * archive.cc (Archive::setup): Remove input_objects parameter.
15168         Change all callers.
15169         (Archive::get_file_and_offset): Likewise.
15170         (Archive::read_all_symbols): Likewise.
15171         (Archive::read_symbols): Likewise.
15172         (Archive::get_elf_object_for_member): Remove input_objects
15173         parameter.  Add punconfigured parameter.  Change all callers.
15174         (Archive::add_symbols): Change return type to bool.  Check return
15175         value of include_member.
15176         (Archive::include_all_members): Likewise.
15177         (Archive::include_member): Change return type to bool.  Return
15178         false if first included object has incompatible target.  Set
15179         included_member_ field.
15180         (Add_archive_symbols::run): If add_symbols returns false, requeue
15181         Read_symbols task.
15182         * archive.h (class Archive): Add included_member_ field.
15183         Initialize it in constructor.  Add input_file and searched_for
15184         methods.  Update declarations.
15185         (class Add_archive_symbols): Add dirpath_, dirindex_, and
15186         input_argument_ fields.  Add them to constructor.  Change all
15187         callers.
15188         * script.cc: Include "target-select.h".
15189         (class Parser_closure): Add skip_on_incompatible_target_ and
15190         found_incompatible_target_ fields.  Add
15191         skip_on_incompatible_target parameter to constructor.  Change all
15192         callers.  Add methods skip_on_incompatible_target,
15193         clear_skip_on_incompatible_target, found_incompatible_target, and
15194         set_found_incompatible_target.
15195         (read_input_script): Add dirindex parameter.  Change all callers.
15196         If parser finds an incompatible target, requeue Read_symbols
15197         task.
15198         (script_set_symbol): Clear skip_on_incompatible_target in
15199         closure.
15200         (script_add_assertion, script_parse_option): Likewise.
15201         (script_start_sections, script_add_phdr): Likewise.
15202         (script_check_output_format): New function.
15203         * script.h (read_input_script): Update declaration.
15204         * script-c.h (script_check_output_format): Declare.
15205         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
15206         (ignore_cmd): Remove OUTPUT_FORMAT.
15207         * fileread.cc (Input_file::Input_file): Add explicit this.
15208         (Input_file::will_search_for): New function.
15209         (Input_file::open): Add pindex parameter.  Change all callers.
15210         * fileread.h (class Input_file): Add input_file_argument method.
15211         Declare will_search_for.  Update declarations.
15212         * object.cc (make_elf_object): Add punconfigured parameter.
15213         Change all callers.
15214         * object.h (class Object): Make input_file public.  Add
15215         searched_for method.
15216         (make_elf_object): Update declaration.
15217         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
15218         restart search.
15219         * dirsearch.h (class Dirsearch): Update declaration.
15220         * options.h (class General_options): Add --warn-search-mismatch.
15221         * parameters.cc (Parameters::is_compatible_target): New function.
15222         * parameters.h (class Parameters): Declare is_compatible_target.
15223         * workqueue.cc (Workqueue::add_blocker): New function.
15224         * workqueue.h (class Workqueue): Declare add_blocker.
15225
15226         * fileread.cc (Input_file::open): Remove options parameter.
15227         Change all callers.
15228         (Input_file::open_binary): Likewise.
15229         * script.cc (read_input_script): Likewise.
15230         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
15231         options parameter from constructor.  Change all callers.
15232         (class Read_script): Likewise.
15233         * fileread.h (class Input_file): Update declarations.
15234         * script.h (read_input_script): Update declaration.
15235
15236 2009-03-10  Nick Clifton  <nickc@redhat.com>
15237
15238         * po/es.po: New Spanish translation.
15239
15240 2009-03-06  Cary Coutant  <ccoutant@google.com>
15241
15242         * options.cc (parse_short_option): Keep dash_z from registering itself.
15243
15244 2009-03-03  Ian Lance Taylor  <iant@google.com>
15245
15246         PR 9918
15247         * target-reloc.h (relocate_section): Pass output_section to
15248         relocate.
15249         * i386.cc (Target_i386::should_apply_static_reloc): Add
15250         output_section parameter.  Change all callers.
15251         (Target_i386::Relocate::relocate): Add output_section parameter.
15252         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15253         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
15254         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
15255         * testsuite/two_file_shared.sh: New script.
15256         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
15257         (check_DATA): Add two_file_shared.dbg.
15258         (two_file_shared.dbg): New target.
15259         * testsuite/Makefile.in: Rebuild.
15260
15261 2009-03-01  Ian Lance Taylor  <iant@google.com>
15262
15263         * configure.ac: Check for byteswap.h.
15264         * configure: Rebuild.
15265         * config.in: Rebuild.
15266
15267 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
15268
15269         * layout.cc (Layout::find_or_add_kept_section): New function.
15270         (Layout::add_comdat): Removed.
15271         * layout.h (struct Kept_section): Move out of class Layout.
15272         Remove trailing underscores from field names.  Add group_sections
15273         field.  Rename group_ field to is_group.  Change all uses.
15274         (class Layout): Declare find_or_add_kept_section, not add_comdat.
15275         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
15276         comdat_groups_ field.
15277         (Sized_relobj::include_section_group): Use
15278         find_or_add_kept_section and Kept_section::group_sections.
15279         (Sized_relobj::include_linkonce_section): Likewise.
15280         * object.cc (class Sized_relobj): Don't define Comdat_group or
15281         Comdat_group_table.  Remove find_comdat_group and
15282         add_comdat_group.  Remove comdat_groups_ field.
15283         * plugin.cc (include_comdat_group): Use
15284         Layout::find_or_add_kept_section.
15285
15286 2009-02-28  Ian Lance Taylor  <iant@google.com>
15287
15288         * README: --gc-sections and map files are now supported.  Document
15289         some build requirements.
15290
15291         PR 6992
15292         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
15293         relocatable link set the value of the section symbol to zero.
15294         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
15295         relocatable link don't include the section address in the local
15296         symbol value.
15297
15298 2009-02-27  Ian Lance Taylor  <iant@google.com>
15299
15300         PR 6811
15301         * options.h (class Search_directory): Add is_system_directory.
15302         (class General_options): Declare is_in_system_directory.
15303         * options.cc (get_relative_sysroot): Make static.
15304         (get_default_sysroot): Make static.
15305         (General_optoins::is_in_system_directory): New function.
15306         * fileread.cc (Input_file::is_in_system_directory): New function.
15307         * fileread.h (class Input_file): Declare is_in_system_directory.
15308         * object.h (class Object): Add is_in_system_directory.
15309         (class Input_objects): Remove system_library_directory_ field.
15310         * object.cc (Input_objects::add_object): Don't set
15311         system_library_directory_.
15312         (input_objects::found_in_system_library_directory): Remove.
15313         * symtab.cc (Symbol_table::write_globals): Remove input_objects
15314         parameter.  Change all callers.
15315         (Symbol_table::sized_write_globals): Likewise.
15316         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
15317         Call Object::is_in_system_directory.
15318         * symtab.h (class Symbol_table): Update declarations.
15319
15320         PR 5990
15321         * descriptors.h (Open_descriptor): Add is_on_stack field.
15322         * descriptors.cc (Descriptors::open): If the descriptor is on the
15323         top of the stack, remove it.  Initialize is_on_stack field.
15324         (Descriptors::release): Only add pod to stack if it is not on the
15325         stack already.
15326         (Descriptors::close_some_descriptor): Clear stack_next and
15327         is_on_stack fields.
15328
15329         PR 7091
15330         * output.cc (Output_section::find_starting_output_address): Rename
15331         from starting_output_address; add PADDR parameter; change return
15332         type.
15333         * output.h (class Output_section): Declare
15334         find_starting_output_address instead of starting_output_address.
15335         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
15336         section symbol for which we can't find a merge section.
15337
15338         PR 9836
15339         * symtab.cc (Symbol_table::add_from_object): If the visibility is
15340         hidden or internal, force the symbol to be local.
15341         * resolve.cc (Symbol::override_visibility): Define.
15342         (Symbol::override_base): Use override_visibility.
15343         (Symbol_table::resolve): Likewise.
15344         (Symbol::override_base_with_special): Likewise.
15345         (Symbol_table::override_with_special): If the visibility is hidden
15346         or internal, force the symbol to be local.
15347         * symtab.h (class Symbol): Add set_visibility and
15348         override_visibility.
15349         * testsuite/ver_test_1.sh: New file.
15350         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
15351         (check_DATA): Add ver_test_1.syms.
15352         (ver_test_1.syms): New target.
15353         * testsuite/Makefile.in: Rebuild.
15354
15355 2009-02-25  Cary Coutant  <ccoutant@google.com>
15356
15357         * layout.cc (Layout::choose_output_section): Don't rename sections
15358         when using a linker script that has a SECTIONS clause.
15359         * Makefile.in: Regenerate.
15360
15361         * testsuite/Makefile.am (script_test_5.sh): New test case.
15362         * testsuite/Makefile.in: Regenerate.
15363         * testsuite/script_test_5.cc: New file.
15364         * testsuite/script_test_5.sh: New file.
15365         * testsuite/script_test_5.t: New file.
15366
15367 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
15368
15369         * archive.cc (Archive::include_member): Update calls to add_symbols.
15370         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
15371         the Layout argument.
15372         * dynobj.h (do_add_symbols): Add the Layout argument.
15373         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
15374         Layout argument.
15375         * object.h (Object::add_symbols): Add the Layout argument.
15376         (Object::do_add_symbols): Add the Layout argument.
15377         (Sized_relobj::do_add_symbols): Add the Layout argument.
15378         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
15379         Unify the two versions.
15380         (Add_plugin_symbols): Remove.
15381         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
15382         (Sized_pluginobj::do_add_symbols): Unify the two versions.
15383         (Add_plugin_symbols): Remove.
15384         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
15385         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
15386         (Add_symbols::run): Make it work with Pulginobj.
15387
15388 2009-02-06  Ian Lance Taylor  <iant@google.com>
15389
15390         * object.cc (Sized_relobj::do_layout): Make info message start
15391         with lower case letter.
15392
15393 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
15394
15395         * binary.cc: Fix file comment.
15396
15397         * options.h (enum Incremental_disposition): Define.
15398         (class General_options): Add new options: --incremental,
15399         --incremental_changed, --incremental_unchanged,
15400         --incremental_unknown.  Add incremental_disposition_ and
15401         implicit_incremental_ fields.
15402         (General_options::incremental_disposition): New function.
15403         (class Position_dependent_options): Add incremental_disposition
15404         option.
15405         (Position_dependent_options::copy_from_options): Set incremental
15406         dispositions.
15407         * options.cc (General_options::parse_incremental_changed): New
15408         function.
15409         (General_options::parse_incremental_unchanged): New function.
15410         (General_options::parse_incremental_unknown): New function.
15411         (General_options::General_options): Initialize new fields
15412         incremental_disposition_ and implicit_incremental_.
15413         (General_options::finalize): Check for uasge of --incremental-*
15414         without --incremental.
15415
15416 2009-02-06  Chris Demetriou  <cgd@google.com>
15417
15418         * gold.h (gold_undefined_symbol): Change to take only a Symbol
15419         pointer and to report location as the file name associated with
15420         the symbol.
15421         (gold_undefined_symbol_at_location): New function to replace the
15422         old gold_undefined_symbol functionality.
15423         * target-reloc.h (relocate_section): Update to use
15424         gold_undefined_symbol_at_location.
15425         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15426         Call gold_undefined_symbol function rather than gold_error.
15427         * errors.h (Errors::undefined_symbol): Take location as a
15428         string, rather than calculating it from a relocation.
15429         * errors.cc (Errors::fatal): Print "fatal error:" before the
15430         formatted message.
15431         (Errors::error, Errors::error_at_location): Print "error: "
15432         before the formatted message.
15433         (Errors::undefined_symbol): Take location as a string, rather
15434         than calculating it from a relocation.
15435         (gold_undefined_symbol_at_location): New function akin to
15436         old gold_undefined_symbol, calculates location from relocation.
15437         (gold_undefined_symbol): Change to take only a Symbol pointer
15438         and to report location as the file name associated with the symbol.
15439         * testsuite/debug_msg.sh: Update for changed error messages.
15440         * testsuite/undef_symbol.sh: Likewise.
15441
15442 2009-02-04  Duncan Sands  <baldrick@free.fr>
15443
15444         PR 9812
15445         * reduced_debug_output.h
15446         (Output_reduced_debug_abbrev_section::failed): Use format for
15447         gold_warning.
15448         (Output_reduced_debug_info_section::faild): Likewise.
15449
15450 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
15451
15452         * script.cc (Lazy_demangler): New class.
15453         (Version_script_info::get_symbol_version_helper): Demangle a
15454         symbol only once.
15455
15456 2009-01-29  Cary Coutant  <ccoutant@google.com>
15457
15458         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
15459         to __tls_get_addr.
15460         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15461
15462 2009-01-28  Ian Lance Taylor  <iant@google.com>
15463
15464         * version.cc (version_string): Bump to 1.9.
15465
15466         * gold.h: Include <cstring> and <stdint.h>.
15467         * version.cc: Include <cstdio>.
15468         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
15469         warning.
15470         * reduced_debug_output.cc (insert_into_vector): Rename from
15471         Insert_into_vector; change all callers.  Use Swap_unaligned to
15472         avoid aliasing issue; remove union since it is unnecessary.
15473
15474 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
15475
15476         * Makefile.am (CCFILES): Add gc.cc.
15477         (HFILES): Add gc.h.
15478         * Makefile.in: Regenerate.
15479         * gold.cc (Gc_runner): New class.
15480         (queue_initial_tasks): Call garbage collection related tasks
15481         when corresponding options are invoked.
15482         (queue_middle_gc_tasks): New function.
15483         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
15484         processed early before laying out sections during garbage collection.
15485         * gold.h (queue_middle_gc_tasks): New function.
15486         (is_prefix_of): Move from "layout.cc".
15487         * i386.cc (Target_i386::gc_process_relocs): New function.
15488         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
15489         * main.cc (main): Create object of class "Garbage_collection".
15490         * object.cc (Relobj::copy_symbols_data): New function.
15491         (Relobj::is_section_name_included): New function.
15492         (Sized_relobj::do_layout): Allow this function to be called twice
15493         during garbage collection and defer layout of section during the
15494         first call.
15495         * object.h (Relobj::get_symbols_data): New function.
15496         (Relobj::is_section_name_included): New function.
15497         (Relobj::copy_symbols_data): New function.
15498         (Relobj::set_symbols_data): New function.
15499         (Relobj::get_relocs_data): New function.
15500         (Relobj::set_relocs_data): New function.
15501         (Relobj::is_output_section_offset_invalid): New pure virtual function.
15502         (Relobj::gc_process_relocs): New function.
15503         (Relobj::do_gc_process_relocs): New pure virtual function.
15504         (Relobj::sd_): New data member.
15505         (Sized_relobj::is_output_section_offset_invalid): New function.
15506         (Sized_relobj::do_gc_process_relocs): New function.
15507         * options.h (General_options::gc_sections): Modify to not be a no-op.
15508         (General_options::print_gc_sections): New option.
15509         * plugin.cc (Plugin_finish::run): Remove function call to
15510         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
15511         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
15512         * reloc.cc (Read_relocs::run): Add task to process relocs and
15513         determine unreferenced sections when doing garbage collection.
15514         (Gc_process_relocs): New class.
15515         (Sized_relobj::do_gc_process_relocs): New function.
15516         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
15517         sections that are garbage collected.
15518         * reloc.h (Gc_process_relocs): New class.
15519         * sparc.cc (Target_sparc::gc_process_relocs): New function.
15520         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
15521         symbols whose corresponding sections are garbage collected.
15522         (Symbol_table::Symbol_table): Add new parameter for the garbage
15523         collection object.
15524         (Symbol_table::gc_mark_undef_symbols): New function.
15525         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15526         (Symbol_table::gc_mark_dyn_syms): New function.
15527         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
15528         as garbage.
15529         (Symbol_table::add_from_object): Likewise.
15530         (Symbol_table::add_from_relobj): When building shared objects, do not
15531         treat externally visible symbols as garbage.
15532         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
15533         table information for static and relocatable links.
15534         * symtab.h (Symbol_table::set_gc): New function.
15535         (Symbol_table::gc): New function.
15536         (Symbol_table::gc_mark_undef_symbols): New function.
15537         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15538         (Symbol_table::gc_mark_dyn_syms): New function.
15539         (Symbol_table::gc_): New data member.
15540         * target.h (Sized_target::gc_process_relocs): New pure virtual
15541         function.
15542         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
15543         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
15544
15545 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
15546
15547         * options.h (General_options::gc_sections): Define as a no-op for now.
15548         (General_options::no_keep_memory): Ditto.
15549         (General_options::Bshareable): Define.
15550         * options.cc (General_options::finalize): Honor -Bshareable.
15551
15552 2009-01-20  Andreas Schwab  <schwab@suse.de>
15553
15554         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
15555         read the value in the contents, since we don't use it.  Use the
15556         template endianness when writing.
15557         (Relocate::relocate): Use it for R_PPC_REL16_HA.
15558
15559 2009-01-19  Andreas Schwab  <schwab@suse.de>
15560
15561         * configure.tgt (powerpc64-*): Fix targ_obj.
15562
15563 2009-01-15  Ian Lance Taylor  <iant@google.com>
15564
15565         * object.cc (Sized_relobj::write_local_symbols): Don't write out
15566         local symbols when stripping all symbols.
15567
15568 2009-01-14  Cary Coutant  <ccoutant@google.com>
15569
15570         * output.cc (Output_reloc): Add explicit instantiations.
15571
15572 2009-01-14  Cary Coutant  <ccoutant@google.com>
15573
15574         * archive.cc (Archive::get_elf_object_for_member): Remove call
15575         to File_read::claim_for_plugin.
15576         * descriptors.cc (Descriptors::open): Remove reference to
15577         is_claimed.
15578         (Descriptors::claim_for_plugin): Remove.
15579         * descriptors.h (Descriptors::claim_for_plugin): Remove.
15580         (Descriptors::is_claimed): Remove.
15581         (claim_descriptor_for_plugin): Remove.
15582         * fileread.cc (File_read::claim_for_plugin): Remove.
15583         * fileread.h (File_read::claim_for_plugin): Remove.
15584         (File_read::descriptor): Reopen descriptor if necessary.
15585         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
15586         (Plugin_manager::all_symbols_read): Add task parameter. Change
15587         all callers.
15588         (Plugin_manager::get_input_file): New function.
15589         (Plugin_manager::release_input_file): New function.
15590         (Pluginobj::Pluginobj): Add filesize parameter and initialize
15591         corresponding data member.
15592         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
15593         and pass to base constructor. Change all callers.
15594         (get_input_file, release_input_file): New functions.
15595         (make_sized_plugin_object): Add filesize parameter. Change all callers.
15596         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
15597         (Plugin_manager::all_symbols_read): Add task parameter.
15598         (Plugin_manager::get_input_file): New function.
15599         (Plugin_manager::release_input_file): New function.
15600         (Plugin_manager::task_): New data member.
15601         (Pluginobj::Pluginobj): Add filesize parameter.
15602         (Pluginobj::filename): New function.
15603         (Pluginobj::descriptor): New function.
15604         (Pluginobj::filesize): New function.
15605         (Pluginobj::filesize_): New data member.
15606         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
15607         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
15608         File_read::claim_for_plugin; use Object::unlock to unlock the file.
15609
15610         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
15611         with archive libraries.
15612         * testsuite/Makefile.in: Regenerate.
15613         * testsuite/plugin_test.c (struct sym_info): New type.
15614         (get_input_file, release_input_file): New static variables.
15615         (onload): Capture new transfer vector entries.
15616         (claim_file_hook): Stop reading at end of file according to filesize.
15617         Factor out parsing of readelf output into separate function.
15618         (all_symbols_read_hook): Exercise get_input_file and release_input_file
15619         APIs and get the source file name from the symbol table.  Convert
15620         source file name to corresponding object file name.  Print info
15621         message when adding new input files.
15622         (parse_readelf_line): New function.
15623         * testsuite/plugin_test_1.sh: Add checks for new info messages.
15624         * testsuite/plugin_test_2.sh: Likewise.
15625         * testsuite/plugin_test_3.sh: Likewise.
15626         * testsuite/plugin_test_4.sh: New test case.
15627
15628 2009-01-07  Ian Lance Taylor  <iant@google.com>
15629
15630         * version.cc (version_string): Bump to 1.8.
15631
15632 2008-12-23  Cary Coutant  <ccoutant@google.com>
15633
15634         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
15635         * plugin.cc (Plugin_manager::finish): Rename as
15636         layout_deferred_objects.  Move cleanup to separate function.
15637         (Plugin_manager::cleanup): New function.
15638         (Plugin_finish::run): Call layout_deferred_objects and cleanup
15639         separately.
15640         * plugin.h (Plugin_manager::finish): Rename as
15641         layout_deferred_objects.
15642         (Plugin_manager::cleanup): New function.
15643         (Plugin_manager::cleanup_done): New field.
15644
15645 2008-12-23  Cary Coutant  <ccoutant@google.com>
15646
15647         * plugin.cc (is_visible_from_outside): New function.
15648         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
15649         so we don't return "IR only" status for exported symbols or -r links.
15650
15651         * testsuite/Makefile.am (plugin_test_3): New test case.
15652         * testsuite/Makefile.in: Regenerate.
15653         * testsuite/plugin_test_3.sh: New file.
15654
15655 2008-12-22  Cary Coutant  <ccoutant@google.com>
15656
15657         * object.cc (Sized_relobj::layout_section): New function.
15658         (Sized_relobj::do_layout): Defer layout of input sections until after
15659         plugin has provided replacement files.
15660         (Sized_relobj::do_layout_deferred_sections): New function.
15661         * object.h (Relobj::set_section_offset): Remove virtual keyword.
15662         (Relobj::layout_deferred_sections): New function.
15663         (Relobj::do_layout_deferred_sections): New function.
15664         (Sized_relobj::do_layout_deferred_sections): New function.
15665         (Sized_relobj::layout_section): New function.
15666         (Sized_relobj::Deferred_layout): New structure.
15667         (Sized_relobj::deferred_layout_): New field.
15668         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
15669         Change all callers.  Layout deferred sections.
15670         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
15671         references.
15672         (Plugin_hook::run): Move code from do_plugin_hook inline.
15673         (Plugin_hook::do_plugin_hook): Remove.
15674         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
15675         (Plugin_manager::finish): Renamed, was cleanup.
15676         (Plugin_manager::should_defer_layout): New function.
15677         (Plugin_manager::add_deferred_layout_object): New function.
15678         (Plugin_manager::Deferred_layout_list): New type.
15679         (Plugin_manager::deferred_layout_objects_): New field.
15680         (Plugin_hook::do_plugin_hook): Remove.
15681
15682 2008-12-17  Ian Lance Taylor  <iant@google.com>
15683
15684         * options.h (class General_options): Add --no case for
15685         --export-dynamic.
15686
15687 2008-12-16  Cary Coutant  <ccoutant@google.com>
15688
15689         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
15690         vector.
15691         (Plugin_manager::claim_file): Create plugin object even if
15692         plugin did not call the add_symbols callback.
15693         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
15694         asking for more symbols than were added.
15695         * testsuite/Makefile.am (plugin_test_1): Add test case with
15696         no global symbols.
15697         (empty.syms): New target.
15698         * testsuite/Makefile.in: Regenerate.
15699         * testsuite/plugin_test.c (claim_file_hook): Add new debug
15700         message. Don't call add_symbols if no globals.
15701         (all_symbols_read_hook): Don't provide replacement for empty
15702         claimed file.
15703
15704 2008-12-12  Ian Lance Taylor  <iant@google.com>
15705
15706         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
15707         r_type == 0 for a local symbol with r_sym == 0.
15708         (scan_relocatable_relocs): Pass r_sym to
15709         local_non_section_strategy.
15710         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
15711         r_sym parameter.
15712
15713         * configure.ac: Update test for TLS descriptors: they are
15714         supported as of glibc 2.9.
15715         * configure: Rebuild.
15716
15717 2008-12-11  Ian Lance Taylor  <iant@google.com>
15718
15719         PR 7091
15720         * target-reloc.h (Default_scan_relocatable_relocs): For each
15721         function, map r_type == 0 to RELOC_DISCARD.
15722
15723 2008-12-10  Cary Coutant  <ccoutant@google.com>
15724
15725         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
15726         object to override a kept COMDAT group from a plugin object.
15727
15728 2008-12-09  Ian Lance Taylor  <iant@google.com>
15729
15730         PR 7088
15731         * yyscript.y (file_cmd): Handle INPUT.
15732
15733         * testsuite/initpri1.c: Change all declarations to be full
15734         prototypes by adding void, to avoid compiler warnings.
15735
15736 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
15737
15738         * options.cc (General_options::parse_plugin_opt): New.
15739         (General_options::add_plugin): The argument now is just the filename.
15740         (General_options::add_plugin_option): New.
15741         * options.h (plugin_opt): New.
15742         (add_plugin): Change argument name.
15743         (add_plugin_option): New.
15744         * plugin.cc (Plugin::load): Don't parse the plugin option.
15745         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
15746         (Plugin::add_option): New.
15747         (Plugin::args_): Change type.
15748         (Plugin::filename_): New.
15749         (Plugin_manager::add_plugin_option): New.
15750         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
15751         * testsuite/Makefile.in: Regenerate.
15752
15753 2008-12-05  Cary Coutant  <ccoutant@google.com>
15754
15755         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
15756         Handle --strip-lto-sections option.
15757         * options.h (strip_lto_sections): New option.
15758
15759 2008-12-01  Cary Coutant  <ccoutant@google.com>
15760
15761         * plugin.cc (ld_plugin_message): Change format parameter to const.
15762         Fix mismatch between new[] and delete.
15763
15764 2008-11-14  Cary Coutant  <ccoutant@google.com>
15765
15766         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
15767         instead of -1U.
15768
15769 2008-11-05  Craig Silverstein  <csilvers@google.com>
15770
15771         * options.cc (General_options::parse_dynamic_list): New function.
15772         * options.h (General_options): New flags dynamic_list,
15773         dynamic_list_data, dynamic_list_cpp_new, and
15774         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
15775         (General_options::in_dynamic_list): New function.
15776         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
15777         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
15778         (Lex::can_continue_name): Likewise.
15779         (yylex): Likewise.
15780         (read_script_file): New parameter script_options.
15781         (read_dynamic_list): New function.
15782         (Script_options::define_dynamic_list): New function.
15783         (dynamic_list_keyword_parsecodes): New variable.
15784         (dynamic_list_keywords): New variable.
15785         * script.h (Script_options::define_dynamic_list): New function
15786         prototype.
15787         (read_dynamic_list): New function prototype.
15788         * symtab.cc (strprefix): New macro.
15789         (Symbol::should_add_dynsym_entry): Support dynamic_list,
15790         dynamic_list_data, dynamic_list_cpp_new, and
15791         dynamic_list_cpp_typeinfo.
15792         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
15793         (dynamic_list_expr): New rule.
15794         (dynamic_list_nodes): Likewise.
15795         (dynamic_list_node): Likewise.
15796         * testsuite/Makefile.am (dynamic_list): New test.
15797         * testsuite/Makefile.in: Regenerated.
15798         * testsuite/dynamic_list.t: New file.
15799         * testsuite/dynamic_list.sh: New file.
15800
15801 2008-11-05  Craig Silverstein  <csilvers@google.com>
15802
15803         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
15804         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
15805         (t11_last): Likewise.
15806         * testsuite/ver_test_6.c (main): Likewise.
15807
15808 2008-10-07  Cary Coutant  <ccoutant@google.com>
15809
15810         * options.c (General_options::finalize): Add check for -static and
15811         -shared.
15812         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
15813         is not empty.
15814
15815 2008-10-02  Cary Coutant  <ccoutant@google.com>
15816
15817         * plugin.cc (make_sized_plugin_object): Fix conditional
15818         compilation to work when not all targets are enabled.
15819
15820 2008-09-29  Cary Coutant  <ccoutant@google.com>
15821
15822         * archive.cc (Archive::get_file_and_offset): Use filename instead
15823         of name to get library path.
15824         (Archive::include_member): Unlock external member of a thin archive.
15825
15826         * testsuite/Makefile.am (TEST_AR): New variable.
15827         (thin_archive_test_1): New test.
15828         (thin_archive_test_2): New test.
15829         * testsuite/Makefile.in: Regenerate.
15830         * testsuite/thin_archive_main.cc: New file.
15831         * testsuite/thin_archive_test_1.cc: New file.
15832         * testsuite/thin_archive_test_2.cc: New file.
15833         * testsuite/thin_archive_test_3.cc: New file.
15834         * testsuite/thin_archive_test_4.cc: New file.
15835
15836 2008-09-29  Cary Coutant  <ccoutant@google.com>
15837
15838         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
15839         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
15840         instead of -1U.
15841         (Sized_relobj::do_finalize_local_symbols): Likewise.
15842         (Sized_relobj::map_to_kept_section): Likewise.
15843         * object.h (Sized_relobj::invalid_address): New constant.
15844         (Sized_relobj::do_output_section_offset): Check for invalid_address
15845         and return -1ULL.
15846         * output.cc (Output_reloc::local_section_offset): Use constant
15847         invalid_address instead of -1U.
15848         (Output_reloc::get_address): Likewise.
15849         (Output_section::output_address): Change -1U to -1ULL.
15850         * output.h (Output_reloc::invalid_address): New constant.
15851         * reloc.cc (Sized_relobj::write_sections): Use constant
15852         invalid_address instead of -1U.
15853         (Sized_relobj::relocate_sections): Likewise.
15854         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
15855         values for merge sections.
15856         * target-reloc.h (relocate_for_relocatable): Use constant
15857         invalid_address instead of -1U.
15858
15859 2008-09-19  Cary Coutant  <ccoutant@google.com>
15860
15861         Add plugin functionality for link-time optimization (LTO).
15862         * configure.ac (plugins): Add --enable-plugins option.
15863         * configure: Regenerate.
15864         * config.in: Regenerate.
15865         * Makefile.am (LIBDL): New variable.
15866         (CCFILES): Add plugin.cc.
15867         (HFILES): Add plugin.h.
15868         (ldadd_var): Add LIBDL.
15869         * Makefile.in: Regenerate.
15870
15871         * archive.cc: Include "plugin.h".
15872         (Archive::setup): Don't preread archive symbols when using a plugin.
15873         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
15874         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
15875         files.
15876         (Archive::include_member): Add symbols from plugin objects.
15877         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
15878         * descriptors.cc (Descriptors::open): Check for file descriptors
15879         abandoned by plugins.
15880         (Descriptors::claim_for_plugin): New function.
15881         * descriptors.h (Descriptors::claim_for_plugin): New function.
15882         (Open_descriptor::is_claimed): New field.
15883         (claim_descriptor_for_plugin): New function.
15884         * fileread.cc (File_read::claim_for_plugin): New function.
15885         * fileread.h (File_read::claim_for_plugin): New function.
15886         (File_read::descriptor): New function.
15887         * gold.cc: Include "plugin.h".
15888         (queue_initial_tasks): Add task to call plugin hooks for generating
15889         new object files.
15890         * main.cc: Include "plugin.h".
15891         (main): Load plugin libraries.
15892         * object.h (Pluginobj): Declare.
15893         (Object::pluginobj): New function.
15894         (Object::do_pluginobj): New function.
15895         (Object::set_target): New function.
15896         * options.cc: Include "plugin.h".
15897         (General_options::parse_plugin): New function.
15898         (General_options::General_options): Initialize plugins_ field.
15899         (General_options::add_plugin): New function.
15900         * options.h (Plugin_manager): Declare.
15901         (General_options): Add --plugin option.
15902         (General_options::has_plugins): New function.
15903         (General_options::plugins): New function.
15904         (General_options::add_plugin): New function.
15905         (General_options::plugins_): New field.
15906         * plugin.cc: New file.
15907         * plugin.h: New file.
15908         * readsyms.cc: Include "plugin.h".
15909         (Read_symbols::do_read_symbols): Check for archive before checking
15910         for ELF file.  Call plugin hooks to claim files.
15911         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
15912         from a real object file; force override when processing replacement
15913         files.
15914         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
15915         (Symbol::init_base_object): Likewise.
15916         (Symbol::init_base_output_data): Likewise.
15917         (Symbol::init_base_output_segment): Likewise.
15918         (Symbol::init_base_constant): Likewise.
15919         (Symbol::init_base_undefined): Likewise.
15920         (Symbol::output_section): Assert that object is not a plugin.
15921         (Symbol_table::add_from_pluginobj): New function.
15922         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15923         undefined.
15924         (Symbol_table::sized_write_globals): Likewise.
15925         (Symbol_table::add_from_pluginobj): Instantiate template.
15926         * symtab.h (Sized_pluginobj): Declare.
15927         (Symbol::in_real_elf): New function.
15928         (Symbol::set_in_real_elf): New function.
15929         (Symbol::in_real_elf_): New field.
15930         (Symbol_table::add_from_pluginobj): New function.
15931
15932         * testsuite/Makefile.am (AM_CFLAGS): New variable.
15933         (LIBDL): New variable.
15934         (LDADD): Add LIBDL.
15935         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
15936         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
15937         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
15938         (MOSTLYCLEANFILES): Likewise.
15939         * testsuite/Makefile.in: Regenerate.
15940         * testsuite/plugin_test.c: New file.
15941         * testsuite/plugin_test_1.sh: New file.
15942         * testsuite/plugin_test_2.sh: New file.
15943
15944 2008-09-16  Ian Lance Taylor  <iant@google.com>
15945
15946         * target-reloc.h (relocate_section): Check whether a symbol is
15947         defined by the ABI before reporting an undefined symbol error.
15948         * target.h (Target::is_defined_by_abi): Make parameter const.
15949         (Target::do_is_defined_by_abi): Likewise.
15950         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
15951         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
15952         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
15953         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
15954         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
15955         * testsuite/Makefile.in: Rebuild.
15956
15957         * fileread.cc (make_view): Add casts to avoid warning.
15958
15959 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15960
15961         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
15962         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15963
15964 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15965
15966         * options.h (General_options::output_is_executable): New.
15967         (General_options::output_is_pie): New.
15968         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
15969         for shared libraries.
15970         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15971
15972 2008-09-11  Chris Demetriou  <cgd@google.com>
15973
15974         * options.h (origin): New -z option.
15975         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
15976         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
15977         in DT_FLAGS_1.
15978
15979 2008-09-05  Cary Coutant  <ccoutant@google.com>
15980
15981         * fileread.cc (File_read::make_view): Add check for attempt to map
15982         beyond end of file.
15983
15984 2008-09-05  Cary Coutant  <ccoutant@google.com>
15985
15986         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
15987         explicit instantiations.
15988
15989 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
15990
15991         PR gold/6858
15992         * options.cc (General_options::finalize): Allow undefined symbols
15993         in shlibs if linking -shared.
15994
15995         PR gold/6859
15996         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
15997         symbols as not needing a dynsym entry.
15998
15999 2008-08-20  Craig Silverstein  <csilvers@google.com>
16000
16001         * fileread.cc (File_read::open): Do not lock the file unless it
16002         was successfully opened.
16003
16004 2008-08-14  Cary Coutant  <ccoutant@google.com>
16005
16006         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
16007         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
16008         * testsuite/tls_test.cc (struct int128): 128-bit struct
16009         for testing TLS relocs with non-zero addend.
16010         (v12): New TLS variable.
16011         (t12): New test.
16012         (t_last): Add check for v12.
16013         * testsuite/tls_test.h (t12): New function.
16014         * testsuite/tls_test_main.cc (thread_routine): Call new test.
16015
16016 2008-08-13  Ian Lance Taylor  <iant@google.com>
16017
16018         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
16019         set tls_segment_ or relro_segment_.
16020         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
16021         when appropriate.
16022         * output.h (Output_section::clear_is_relro): New function.
16023         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
16024         sections specially even when output_data_ is empty.
16025         (Output_segment::maximum_alignment): When first section is relro,
16026         only force alignment for PT_LOAD segments.
16027         * script.cc (script_data_segment_align): New function.
16028         (script_data_segment_relro_end): New function.
16029         * script-c.h (script_data_segment_align): Declare.
16030         (script_data_segment_relro_end): Declare.
16031         * script-sections.h (class Script_sections): Declare
16032         data_segment_align and data_segment_relro_end.  Add fields
16033         segment_align_index_ and saw_relro_end_.
16034         * script-sections.cc (class Sections_element): Add set_is_relro
16035         virtual function.  Add new bool* parameter to place_orphan_here.
16036         Add get_output_section virtual function.
16037         (class Output_section_definition): Add set_is_relro.  Add new
16038         bool* parameter to place_orphan_here.  Add get_output_section.
16039         Add is_relro_ field.
16040         (Output_section_definition::Output_section_definition): Initialize
16041         evaluated_address_, evaluated_load_address, evaluated_addralign_,
16042         and is_relro_ fields.
16043         (Output_section_definition::place_orphan_here): Add is_relro
16044         parameter.
16045         (Output_section_definition::set_section_addresses): Set relro for
16046         output section.
16047         (Output_section_definition::alternate_constraint): Likewise.
16048         (class Orphan_output_section): Add new bool* parameter to
16049         place_orphan_here.  Add get_output_section.
16050         (Orphan_output_section::place_orphan_here): Add is_relro
16051         parameter.
16052         (Script_sections::Script_sections): Initialize
16053         data_segment_align_index_ and saw_relro_end_.
16054         (Script_sections::data_segment_align): New function.
16055         (Script_sections::data_segment_relro_end): New function.
16056         (Script_sections::place_orphan): Set or clear is_relro.
16057         (Script_sections::set_section_addresses): Force alignment of first
16058         TLS section.
16059         * yyscript.y (exp): Call script_data_segment_align and
16060         script_data_segment_relro_end.
16061         * testsuite/relro_script_test.t: New file.
16062         * testsuite/relro_test.cc (using_script): Declare.
16063         (t1, t2): Test using_script.
16064         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
16065         (relro_script_test_SOURCES): Define.
16066         (relro_script_test_DEPENDENCIES): Define.
16067         (relro_script_test_LDFLAGS): Define.
16068         (relro_script_test_LDADD): Define.
16069         (relro_script_test.so): New target.
16070         * testsuite/Makefile.in: Rebuild.
16071
16072 2008-08-06  Cary Coutant <ccoutant@google.com>
16073
16074         * archive.cc (Archive::total_archives, Archive::total_members)
16075         (Archive::total_members_loaded): New variables.
16076         (Archive::setup): Add parameter.  Add option to preread
16077         archive symbols.
16078         (Archive::read_armap): Add counter.
16079         (Archive::get_file_and_offset): New function.
16080         (Archive::get_elf_object_for_member): New function.
16081         (Archive::read_all_symbols): New function.
16082         (Archive::read_symbols): New function.
16083         (Archive::add_symbols): Add counters.
16084         (Archive::include_all_members): Use armap to find members if it's
16085         already built.
16086         (Archive::include_member): Skip reading symbols if already read.
16087         Factored code into Archive::get_file_and_offset and
16088         Archive::get_elf_object_for_member.  Changed call to
16089         Mapfile::report_include_archive_member.
16090         (Archive::print_stats): New function.
16091         * archive.h: Declare Object and Read_symbols_data classes.
16092         (Archive::Archive): Add initializers for new members.
16093         (Archive::setup): Add parameter.
16094         (Archive::print_stats): New function.
16095         (Archive::total_archives, Archive::total_members)
16096         (Archive::total_members_loaded): New variables.
16097         (Archive::get_file_and_offset): New function.
16098         (Archive::get_elf_object_for_member): New function.
16099         (Archive::read_all_symbols): New function.
16100         (Archive::read_symbols): New function.
16101         (Archive::Archive_member): New class.
16102         (Archive::members_): New member.
16103         (Archive::num_members_): New member.
16104         * main.cc: Include archive.h.
16105         (main): Call Archive::print_stats.
16106         * mapfile.cc (Mapfile::report_include_archive_member): Delete
16107         archive parameter; member_name is now the fully-decorated name.
16108         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
16109         * options.h: (General_options): Add --preread-archive-symbols option.
16110         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
16111         Archive::setup.
16112
16113 2008-08-04  Ian Lance Taylor  <iant@google.com>
16114
16115         * symtab.h (Symbol::use_plt_offset): New function.
16116         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
16117         * powerpc.cc (Relocate::relocate): Likewise.
16118         * sparc.cc (Relocate::relocate): Likewise.
16119         * x86_64.cc (Relocate::relocate): Likewise.
16120         * testsuite/weak_plt.sh: New test.
16121         * testsuite/weak_plt_main.cc: New test.
16122         * testsuite/weak_plt_shared.cc: New test.
16123         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
16124         (check_PROGRAMS): Add weak_plt.
16125         (check_DATA): Add weak_plt_shared.so.
16126         (weak_plt_main_pic.o, weak_plt): New targets.
16127         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
16128         * testsuite/Makefile.in: Rebuild.
16129
16130         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
16131         gcctestdir/ld.
16132         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
16133         * testsuite/Makefile.in: Rebuild.
16134
16135 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
16136
16137         * Makefile.am (POTFILES.in): Set LC_ALL=C.
16138         * Makefile.in: Regenerate.
16139         * po/POTFILES.in: Regenerate.
16140
16141 2008-07-29  Ian Lance Taylor  <iant@google.com>
16142
16143         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
16144         symbols before other symbols.
16145         * testsuite/script_test_2.cc (test_addr): Declare.
16146         (test_addr_alias): Declare.
16147         (main): Check that test_addr and test_addr_alias have the right
16148         values.
16149         * testsuite/script_test_2.t: Define test_addr_alias and
16150         test_addr.
16151
16152 2008-07-24  Ian Lance Taylor  <iant@google.com>
16153
16154         PR 5990
16155         * descriptors.cc: New file.
16156         * descriptors.h: New file.
16157         * gold-threads.h (class Hold_optional_lock): New class.
16158         * fileread.cc: Include "descriptors.h".
16159         (File_read::~File_read): Release descriptor rather than closing
16160         it.
16161         (File_read::open) [file]: Call open_descriptor rather than open.
16162         Set is_descriptor_opened_.
16163         (File_read::open) [memory]: Assert that descriptor is not open.
16164         (File_read::reopen_descriptor): New function.
16165         (File_read::release): Release descriptor.
16166         (File_read::do_read): Make non-const.  Reopen descriptor.
16167         (File_read::read): Make non-const.
16168         (File_read::make_view): Reopen descriptor.
16169         (File_read::do_readv): Likewise.
16170         * fileread.h (class File_read): Add is_descriptor_opened_ field.
16171         Update declarations.
16172         * layout.cc: Include "descriptors.h".
16173         (Layout::create_build_id): Use open_descriptor rather than open.
16174         * output.cc: Include "descriptors.h".
16175         (Output_file::open): Use open_descriptor rather than open.
16176         * archive.cc (Archive::const_iterator): Change Archive to be
16177         non-const.
16178         (Archive::begin, Archive::end): Make non-const.
16179         (Archive::count_members): Likewise.
16180         * archive.h (class Archive): Update declarations.
16181         * object.h (Object::read): Make non-const.
16182         * Makefile.am (CCFILES): Add descriptors.cc.
16183         (HFILES): Add descriptors.h.
16184         * Makefile.in: Rebuild.
16185
16186         PR 6716
16187         * gold.h: Always include <clocale>.  Add Solaris workarounds
16188         following code in binutils/sysdep.h.
16189
16190         PR 6048
16191         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
16192         this->eh_frame_hdr_ is NULL before using it.
16193
16194         * dynobj.cc (Versions::Versions): Update comment.
16195
16196         * dynobj.cc (Versions::Versions): If there is an soname, use it as
16197         the base version name.
16198
16199         * stringpool.cc (Stringpool_template::add_with_length): Set key to
16200         array size plus one.
16201         (Stringpool_template::set_string_offsets): Subtract one from key
16202         before using it as an array index.
16203         (Stringpool_template::get_offset_with_length): Likewise.
16204         (Stringpool_template::write_to_buffer): Likewise.
16205         * stringpool.h (Stringpool_template::get_offset_from_key):
16206         Likewise.
16207
16208 2008-07-23  Ian Lance Taylor  <iant@google.com>
16209
16210         PR 6658
16211         * object.h (Merged_symbol_value::value): Do our best to handle a
16212         negative addend.
16213
16214         PR 6647
16215         * script.cc (Version_script_info::get_versions): Don't add empty
16216         version tag to return value.
16217         (Version_script_info::get_symbol_version_helper): Change return
16218         type to bool.  Add pversion parameter.  Change all callers.
16219         (script_register_vers_node): Don't require a non-NULL tag.
16220         * script.h (class Version_script_info): Update declarations.
16221         (Version_script_info::get_symbol_version): Change return type to
16222         bool.  Add version parameter.  Change all callers.
16223         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
16224         handling.  Handle an empty version from a version script.
16225         (Symbol_table::define_special_symbol): Likewise.
16226         * testsuite/ver_test_10.script: New file.
16227         * testsuite/ver_test_10.sh: New file.
16228         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
16229         (check_DATA): Add ver_test_10.syms.
16230         (ver_test_10.syms, ver_test_10.so): New target.
16231         * testsuite/Makefile.in: Rebuild.
16232
16233 2008-07-23  Simon Baldwin  <simonb@google.com>
16234
16235         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
16236         to zero for undefined symbols from dynamic libraries.
16237
16238 2008-07-23  Ian Lance Taylor  <iant@google.com>
16239
16240         * symtab.cc (Symbol_table::resolve): Remove version parameter.
16241         Change all callers.
16242         * symtab.h (class Symbol_table): Update declaration.
16243         * testsuite/ver_test_9.cc: New file.
16244         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
16245         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
16246         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
16247         (ver_test_9.so, ver_test_9.o): New targets.
16248         * testsuite/Makefile.in: Rebuild.
16249
16250 2008-07-22  Ian Lance Taylor  <iant@google.com>
16251
16252         * options.h (class General_options): Define --check-sections.
16253         * layout.cc (Layout::set_segment_offsets): Handle
16254         --check-sections.
16255
16256         * options.h (class General_options): Define -n/--nmagic and
16257         -N/--omagic.
16258         * options.cc (General_options::finalize): For -n/--nmagic or
16259         -N/--omagic, set -static.
16260         * layout.cc (Layout::attach_allocated_section_to_segment): If
16261         -N/--omagic, don't put read-only and read-write sections in
16262         different segments.
16263         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
16264         finding a read-only segment.
16265         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
16266         don't set the minimum segment alignment to the common page size,
16267         and don't set the file offset to the address modulo the page size.
16268         * script-sections.cc (Script_sections::create_segments): If
16269         -n/--omagic, don't put read-only and read-write sections in
16270         different segments.
16271
16272         * cref.cc: New file.
16273         * cref.h: New file.
16274         * options.h (class General_options): Add --print-symbol-counts.
16275         * main.cc (main): Issue defined symbol report if requested.
16276         * archive.cc (Archive::interpret_header): Make into a const member
16277         function.
16278         (Archive::add_symbols): Call Input_objects::archive_start and
16279         archive_stop.
16280         (Archive::const_iterator): Define new class.
16281         (Archive::begin, Archive::end): New functions.
16282         (Archive::include_all_members): Rewrite to use iterator.
16283         (Archive::count_members): New function.
16284         * archive.h (class Archive): Update declarations.
16285         (Archive::filename): New function.
16286         * object.cc: Include "cref.h".
16287         (Sized_relobj::Sized_relobj): Initialize defined_count_.
16288         (Sized_relobj::do_get_global_symbol_counts): New function.
16289         (Input_objects::add_object): Add object to cross-referencer.
16290         (Input_objects::archive_start): New function.
16291         (Input_objects::archive_stop): New function.
16292         (Input_objects::print_symbol_counts): New function.
16293         * object.h: Declare Cref and Archive.
16294         (Object::get_global_symbol_counts): New function.
16295         (Object::do_get_global_symbol_counts): New pure virtual function.
16296         (class Sized_relobj): Add defined_count_ field.  Update
16297         declarations.
16298         (class Input_objects): Add cref_ field.  Update constructor.
16299         Update declarations.
16300         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
16301         defined_count_.
16302         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
16303         symbol counts.
16304         (Sized_dynobj::do_get_global_symbol_counts): New function.
16305         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
16306         defined_count_.  Update declarations.  Define Symbols typedef.
16307         * symtab.cc (Symbol_table::add_from_relobj): Add defined
16308         parameter.  Change all callers.
16309         (Symbol_table::add_from_dynobj): Add sympointers and defined
16310         parameters.  Change all callers.
16311         * symtab.h (class Symbol_table): Update declarations.
16312         * Makefile.am (CCFILES): Add cref.cc.
16313         (HFILES): Add cref.h.
16314         * Makefile.in: Rebuild.
16315
16316 2008-07-22  Simon Baldwin  <simonb@google.com>
16317
16318         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
16319         to zero when writing undefined symbols.
16320
16321 2008-07-22  Ian Lance Taylor  <iant@google.com>
16322
16323         * output.cc (Output_section::add_input_section): Don't try to
16324         merge empty merge sections.
16325
16326 2008-07-21  Craig Silverstein  <csilvers@google.com>
16327
16328         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
16329         Include symbol version in error message.
16330
16331 2008-07-20  Chris Demetriou  <cgd@google.com>
16332
16333         * configure.ac (gold_cv_c_random_seed): New configured variable.
16334         (RANDOM_SEED_CFLAGS): New substituted variable.
16335         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
16336         * configure: Rebuild.
16337         * Makefile.in: Likewise.
16338         * testsuite/Makefile.in: Likewise.
16339
16340 2008-07-18  Ian Lance Taylor  <iant@google.com>
16341
16342         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
16343         where we see NAME/NULL and NAME/VERSION  as separate symbols.
16344         * testsuite/ver_test_main.cc (main): Call t4.
16345         (t4, t4_2a): Define.
16346         * testsuite/ver_test_2.cc (t4_2): Define.
16347         * testsuite/ver_test_2.script: Put t4_2a in VER2.
16348         * testsuite/ver_test_4.cc (t4_2a): Define.
16349         * testsuite/ver_test_4.script: Put t4_2a in VER2.
16350         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
16351
16352 2008-07-17  Ian Lance Taylor  <iant@google.com>
16353
16354         * dynobj.cc (Versions::add_def): If we give an error about a
16355         missing version, go ahead and create the version anyhow.
16356
16357 2008-07-10  Ian Lance Taylor  <iant@google.com>
16358
16359         Handle output sections with more than 0x7fffffff bytes.
16360         * object.h (class Relobj): Change map_to_output_ to
16361         output_sections_, and just keep a section pointer.  Change all
16362         uses.  Move comdat group support to Sized_relobj.
16363         (Relobj::is_section_specially_mapped): Remove.
16364         (Relobj::output_section): Remove poff parameter.  Change all
16365         callers.
16366         (Relobj::output_section_offset): New function.
16367         (Relobj::set_section_offset): Rewrite.
16368         (Relobj::map_to_output): Remove.
16369         (Relobj::output_sections): New function.
16370         (Relobj::do_output_section_offset): New pure virtual function.
16371         (Relobj::do_set_section_offset): Likewise.
16372         (class Sized_relobj): Add section_offsets_ field.  Add comdat
16373         group support from Relobj.  Update declarations.
16374         (Sized_relobj::get_output_section_offset): New function.
16375         (Sized_relobj::do_output_section_offset): New function.
16376         (Sized_relobj::do_set_section_offset): New function.
16377         * object.cc (Relobj::output_section_address): Remove.
16378         (Sized_relobj::Sized_relobj): Initialize new fields.
16379         (Sized_relobj::include_section_group): Cast find_kept_object to
16380         Sized_relobj.
16381         (Sized_relobj::include_linkonce_section): Likewise.
16382         (Sized_relobj::do_layout): Use separate arrays for output section
16383         and output offset.
16384         (Sized_relobj::do_count_local_symbols): Change map_to_output to
16385         output_sections.
16386         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
16387         output_sections and section_offsets.
16388         (Sized_relobj::write_local_symbols): Likewise.
16389         (map_to_kept_section): Compute output address directly.
16390         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
16391         output_sections and section_offsets.
16392         (Sized_relobj::write_sections): Likewise.
16393         (Sized_relobj::relocate_sections): Likewise.
16394         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
16395         * output.h (class Output_reloc): Update declarations.  Change
16396         u2_.relobj to Sized_relobj*.
16397         (class Output_data_reloc): Change add functions to use
16398         Sized_relobj*.
16399         * output.cc (Output_reloc::Output_reloc): Change relobj to
16400         Sized_relobj*.
16401         (Output_reloc::local_section_offset): Change return type to
16402         Elf_Addr.  Use get_output_section_offset.
16403         (Output_reloc::get_address): Likewise.
16404         (Output_section::is_input_address_mapped): Don't call
16405         is_section_specially_mapped.
16406         (Output_section::output_offset): Likewise.
16407         (Output_section::output_address): Likewise.
16408         (Output_section::starting_output_address): Likewise.
16409         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
16410         parameter to Sized_relobj*.
16411         (Copy_relocs::need_copy_reloc): Likewise.
16412         (Copy_relocs::save): Likewise.
16413         * copy-relocs.h (class Copy_relocs): Update declarations.
16414         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
16415         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
16416         * target-reloc.h (relocate_for_relocatable): Change
16417         offset_in_output_section type to Elf_Addr.  Change code that uses
16418         it as well.
16419         * layout.cc (Layout::layout): Always set *off.
16420         * mapfile.cc (Mapfile::print_input_section): Use
16421         output_section_offset.
16422         * i386.cc (Target_i386::copy_reloc): Change object parameter to
16423         Sized_relobj*.
16424         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
16425         * sparc.cc (Target_sparc::copy_reloc): Likewise.
16426         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
16427
16428 2008-07-03  Ian Lance Taylor  <iant@google.com>
16429
16430         * layout.cc (Layout::include_section): Do not discard unrecognized
16431         SHT_STRTAB sections.
16432
16433 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
16434
16435         * script.cc (Lex::can_continue_name): Make '?' allowable in
16436         version-script names.
16437         * testsuite/version_script.map: Change glob pattern to use '?'
16438
16439 2008-06-30  Manish Singh  <yosh@gimp.org>
16440
16441         PR 6585
16442         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
16443         Correct typo.
16444
16445 2008-06-30  Ian Lance Taylor  <iant@google.com>
16446
16447         PR 6660
16448         PR 6682
16449         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
16450         versions]: Don't try to read the value in the contents, since we
16451         don't use it.  Use the template endianness when writing.
16452
16453 2008-06-25  Cary Coutant  <ccoutant@google.com>
16454
16455         * fileread.cc (File_read::make_view): Assert on zero-length view.
16456         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
16457         symbol table when there are no symbols to read.
16458
16459 2008-06-23  Craig Silverstein  <csilvers@google.com>
16460
16461         * version.cc (version_string): Bump to 1.7
16462
16463 2008-06-18  Craig Silverstein  <csilvers@google.com>
16464
16465         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
16466         constant 0xFFFF to type Valtype.
16467         (Powerpc_relocate_functions::rel16_ha): Likewise.
16468
16469 2008-06-17  Ian Lance Taylor  <iant@google.com>
16470
16471         * output.h (Output_section::Input_section): Initialize p2align_ to
16472         zero for Output_section_data constructors.
16473         (Output_section::Input_section::addralign): If not an input
16474         section, return the alignment of the Output_section_data.
16475         * testsuite/copy_test.cc: New file.
16476         * testsuite/copy_test_1.cc: New file.
16477         * testsuite/copy_test_2.cc: New file.
16478         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
16479         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
16480         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
16481         (copy_test_1_pic.o, copy_test_1.so): New targets.
16482         (copy_test_2_pic.o, copy_test_2.so): New targets.
16483         * testsuite/Makefile.in: Rebuild.
16484
16485         * script-sections.cc (Script_sections::place_orphan): Initialize
16486         local variable exact.
16487
16488 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
16489
16490         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
16491
16492 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
16493             David S. Miller  <davem@davemloft.net>
16494
16495         * powerpc.cc: New file.
16496         * Makefile.am (TARGETSOURCES): Add powerpc.cc
16497         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
16498         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
16499         * Makefile.in: Rebuild.
16500
16501 2008-06-09  Ian Lance Taylor  <iant@google.com>
16502
16503         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
16504         <exception>.
16505         (throwing, orig_terminate): New static variables.
16506         (terminate_handler): New static function.
16507         (t2): Set terminate handler.
16508
16509 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
16510
16511         PR 6584
16512         * binary.cc (Binary_to_elf::sized_convert): Fix .data
16513         alignment.
16514
16515 2008-05-30  Cary Coutant  <ccoutant@google.com>
16516
16517         * archive.cc (Archive::include_all_members) Correct to step
16518         over symbol table and extended name table in thin archives.
16519
16520 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
16521
16522         PR 6407
16523         * target-reloc.h (relocate_for_relocatable): Fix new_offset
16524         calculation.
16525
16526 2008-05-28  Caleb Howe  <cshowe@google.com>
16527
16528         * reduced_debug_output.cc: New file.
16529         * reduced_debug_output.h: New file.
16530         * options.h (class General_options): Add --strip-debug-non-line.
16531         * options.cc (General_options::finalize): Add strip_debug_non_line
16532         to the strip heirarchy.
16533         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
16534         fields.
16535         * layout.cc: Include "reduced_debug_output.h".
16536         (Layout::Layout): Initialize new fields.
16537         (line_only_debug_sections): New static array.
16538         (is_lines_only_debug_sections): New static inline function.
16539         (Layout::include_section): Handle --strip-debug-non-line.
16540         (Layout::make_output_section): If --strip-debug-non-line, build
16541         new output sections for .debug_abbrev and .debug_info.
16542         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
16543         gold.  Warn about possible overflow.
16544         (read_signed_LEB_128): Likewise.
16545         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
16546         (read_signed_LEB_128): Declare.
16547         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
16548         (HFILES): Add reduced_debug_output.h.
16549         * Makefile.in: Rebuild.
16550
16551 2008-05-21  Ian Lance Taylor  <iant@google.com>
16552
16553         * mapfile.cc: New file.
16554         * mapfile.h: New file.
16555         * options.h (class General_options): Add -M/--print-map and -Map.
16556         * options.cc (General_options::finalize): Make -M equivalent to
16557         -Map -.
16558         * main.cc: Include <cstdio> and "mapfile.h".
16559         (main): Open mapfile if requested.
16560         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
16561         constructor.  Change caller.
16562         (queue_initial_tasks): Add mapfile parameter.  Change caller.
16563         (queue_middle_tasks): Likewise.
16564         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
16565         declarations.
16566         * archive.cc: Include "mapfile.h".
16567         (Archive::add_symbols): Add mapfile parameter.  Change all
16568         callers.  Pass mapfile, symbol, and reason to include_member.
16569         (Archive::include_all_members): Add mapfile parameter.  Change all
16570         callers.
16571         (Archive::include_member): Add mapfile, sym, and why parameters.
16572         Change all callers.  Report inclusion to map file.
16573         * archive.h: Include "fileread.h".
16574         (class Archive): Update declarations.
16575         (Archive::file): New const method.
16576         (class Add_archive_symbols): Add mapfile_ field.  Update
16577         constructor.  Change all callers.
16578         * readsyms.h (class Read_symbols): Likewise.
16579         (class Finish_group): Likewise.
16580         (class Read_script): Likewise.
16581         * common.cc: Include "mapfile.h".
16582         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
16583         all callers.
16584         (Symbol_table::do_allocate_commons): Likewise.
16585         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
16586         symbol allocation to mapfile.
16587         * common.h (class Allocate_commons_task): Add mapfile_ field.
16588         Update constructor.  Change all callers.
16589         * symtab.h (class Symbol_table): Update declarations.
16590         * layout.cc: Include "mapfile.h".
16591         (Layout_task_runner::run): Print information to mapfile.
16592         (Layout::create_gold_note): Change Output_data_fixed_space to
16593         Output_data_zero_fill.
16594         (Layout::create_build_id): Likewise.
16595         (Layout::print_to_mapfile): New function.
16596         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
16597         constructor.  Change caller.
16598         (class Layout): Declare print_to_mapfile.
16599         * output.cc (Output_section::Input_section::print_to_mapfile): New
16600         function.
16601         (Output_section::add_input_section): If producing a map, always
16602         add to input_sections_ list.
16603         (Output_section::do_print_to_mapfile): New function.
16604         (Output_segment::print_sections_to_mapfile): New function.
16605         (Output_segment::print_section_list_to_mapfile): New function.
16606         * output.h: Include "mapfile.h".
16607         (Output_data::print_to_mapfile): New function.
16608         (Output_data::do_print_to_mapfile): New virtual function.
16609         (Output_segment_headers::do_print_to_mapfile): New function.
16610         (Output_file_header::do_print_to_mapfile): New function.
16611         (Output_data_const::do_print_to_mapfile): New function.
16612         (class Output_data_const_buffer): Add map_name_ field.  Update
16613         constructor.  Change all callers.  Add do_print_to_mapfile
16614         function.
16615         (class Output_data_fixed_space): Likewise.
16616         (class Output_data_space): Likewise.
16617         (class Output_data_zero_fill): New class.
16618         (Output_data_strtab::do_print_to_mapfile): New function.
16619         (Output_data_reloc_base::do_print_to_mapfile): New function.
16620         (Output_relocatable_relocs::do_print_to_mapfile): New function.
16621         (Output_data_group::do_print_to_mapfile): New function.
16622         (Output_data_got::do_print_to_mapfile): New function.
16623         (Output_data_dynamic::do_print_to_mapfile): New function.
16624         (Output_symtab_xindex::do_print_to_mapfile): New function.
16625         (class Output_section): Declare do_print_to_mapflie.  Declare
16626         print_to_mapfile in Input_section.
16627         (class Output_segment): Declare new functions.
16628         * object.h (Sized_relobj::symbol_count): New function.
16629         * script-sections.cc
16630         (Output_section_element_dot_assignment::set_section_addresses):
16631         Change Output_data_fixed_space to Output_data_zero_fill.
16632         (Output_data_expression::do_print_to_mapfile): New function.
16633         * script.cc (read_input_script): Add mapfile parameter.  Change
16634         all callers.
16635         * script.h (read_input_script): Update declaration.
16636         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
16637         (Eh_frame::do_print_to_mapfile): New function.
16638         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
16639         (Output_merge_string::do_print_to_mapfile): New function.
16640         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
16641         function.
16642         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
16643         function.
16644         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
16645         function.
16646         * Makefile.am (CCFILES): Add mapfile.cc.
16647         (HFILES): Add mapfile.h.
16648         * Makefile.in: Rebuild.
16649
16650 2008-05-19  Ian Lance Taylor  <iant@google.com>
16651
16652         * options.h (class General_options): Add -z relro.
16653         * layout.cc (Layout::Layout): Initialize relro_segment_.
16654         (Layout::add_output_section_data): Return the output section.
16655         (Layout::make_output_section): Rcognize relro sections and mark
16656         them appropriately.
16657         (Layout::attach_allocated_section_to_segment): Put relro sections
16658         in a PT_GNU_RELRO segment.
16659         (Layout::create_initial_dynamic_sections): Mark the .dynamic
16660         section as relro.
16661         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
16662         PT_TLS segments.
16663         (Layout::linkonce_mapping): Map d.rel.ro.local to
16664         .data.rel.ro.local.
16665         (Layout::output_section_name): Us .data.rel.ro.local for any
16666         section which begins with that.
16667         * layout.h (class Layout): Update add_output_section_data
16668         declaration.  Add relro_segment_ field.
16669         * output.cc (Output_section::Output_section): Initialize is_relro_
16670         and is_relro_local_ fields.
16671         (Output_segment::add_output_section): Group relro sections.
16672         (Output_segment::is_first_section_relro): New function.
16673         (Output_segment::maximum_alignment): If there is a relro section,
16674         align the segment to the common page size.
16675         (Output_segment::set_section_addresses): Track whether we are
16676         looking at relro sections.  If the last section is a relro
16677         section, align to the common page size.
16678         (Output_segment::set_section_list_addresses): Add in_relro
16679         parameter.  Change all callers.  Align to the page size when
16680         moving from relro to non-relro section.
16681         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
16682         segment.
16683         * output.h (class Output_section): Add is_relro_ and
16684         is_relro_local_ fields.
16685         (Output_section::is_relro): New function.
16686         (Output_section::set_is_relro): New function.
16687         (Output_section::is_relro_local): New function.
16688         (Output_section::set_is_relro_local): New function.
16689         (class Output_segment): Update declarations.
16690         * i386.cc (Target_i386::got_section): Mark .got section as relro.
16691         * sparc.cc (Target_sparc::got_section): Likewise.
16692         * x86_64.cc (Target_x86_64::got_section): Likewise.
16693         * testsuite/relro_test_main.cc: New file.
16694         * testsuite/relro_test.cc: New file.
16695         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
16696         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
16697         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
16698         (relro_test.so, relro_test_pic.o): New targets.
16699         * testsuite/Makefile.in: Rebuild.
16700
16701 2008-05-16  Ian Lance Taylor  <iant@google.com>
16702
16703         * output.cc (Output_segment::add_output_section): Remove front
16704         parameter.
16705         * output.h (class Output_segment): Remove
16706         add_initial_output_section and overloaded add_output_section.
16707         Update declaration of remaining add_output_section.
16708         * layout.cc (Layout::create_interp): Call add_output_section
16709         rather than add_initial_output_section.
16710         (Layout::finish_dynamic_section): Likewise.
16711
16712         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
16713         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
16714         know the dynamic type.
16715         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
16716         field.  Initialize it in constructor.
16717         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
16718         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
16719         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
16720         reloc.
16721
16722         * output.cc (Output_reloc::get_address): Change return type to
16723         Elf_Addr.
16724         * output.h (class Output_reloc): Update get_address declaration.
16725         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
16726         for section addresses.
16727
16728 2008-05-09  Ian Lance Taylor  <iant@google.com>
16729
16730         PR 6493
16731         * gold.cc (gold_nomem): Use return value of write.
16732
16733 2008-05-08  Ian Lance Taylor  <iant@google.com>
16734
16735         * symtab.c (Symbol::init_base_output_data): Add version
16736         parameter.  Change all callers.
16737         (Symbol::init_base_output_segment): Likewise.
16738         (Symbol::init_base_constant): Likewise.
16739         (Symbol::init_base_undefined): Likewise.
16740         (Sized_symbol::init_output_data): Likewise.
16741         (Sized_symbol::init_output_segment): Likewise.
16742         (Sized_symbol::init_constant): Likewise.
16743         (Sized_symbol::init_undefined): Likewise.
16744         (Symbol_table::do_define_in_output_data): If the new symbol has a
16745         version, mark it as the default.
16746         (Symbol_table::do_define_in_output_segment): Likewise.
16747         (Symbol_table::do_define_as_constant): Likewise.
16748         * symtab.h (class Symbol): Update declarations.
16749         (class Sized_symbol): Likewise.
16750         * resolve.cc (Symbol::override_version): New function.
16751         (Symbol::override_base): Call override_version.
16752         (Symbol::override_base_with_special): Likewise.
16753         * testsuite/ver_script_8.script: New file.
16754         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
16755         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
16756         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
16757         (ver_test_8_1.so, ver_test_8_2.so): New targets.
16758
16759 2008-05-06  Ian Lance Taylor  <iant@google.com>
16760
16761         PR 6049
16762         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
16763         functions.
16764         (class General_options): Remove existing --undefined, and add
16765         --no-undefined instead.  Add new --undefined as synonym for -u.
16766         * archive.cc (Archive::add_symbols): Check whether symbol was
16767         named with -u.
16768         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
16769         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
16770         all uses.  Add IS_UNDEFINED.  Update declarations to split
16771         different versions of init_base.  Declare init_base_undefined.
16772         (Symbol::is_defined): Handle IS_UNDEFINED.
16773         (Symbol::is_undefined): Likewise.
16774         (Symbol::is_weak_undefined): Call is_undefined.
16775         (Symbol::is_absolute): Handle IS_CONSTANT.
16776         (class Sized_symbol): Update declarations to split different
16777         versions of init.  Declare init_undefined.
16778         (class Symbol_table): Declare new functions.
16779         * symtab.cc (Symbol::init_base_object): Rename from init_base.
16780         Change all callers.
16781         (Symbol::init_base_output_data): Likewise.
16782         (Symbol::init_base_output_segment): Likewise.
16783         (Symbol::init_base_constant): Likewise.
16784         (Symbol::init_base_undefined): New function.
16785         (Sized_symbol::init_object): Rename from init.  Change all
16786         callers.
16787         (Sized_symbol::init_output_data): Likewise.
16788         (Sized_symbol::init_output_segment): Likewise.
16789         (Sized_symbol::init_constant): Likewise.
16790         (Sized_symbol::init_undefined): New function.
16791         (Symbol_table::add_undefined_symbols_from_command_line): New
16792         function.
16793         (Symbol_table::do_add_undefined_symbols_from_command_line): New
16794         function.
16795         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
16796         (Symbol::output_section): Likewise.
16797         (Symbol::set_output_section): Likewise.
16798         (Symbol_table::sized_finalize_symbol): Likewise.
16799         (Symbol_table::sized_write_globals): Likewise.
16800         * resolve.cc (Symbol_table::should_override): Likewise.
16801         (Symbol::override_base_with_special): Likewise.
16802
16803         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
16804         symbol, change it to have default visibility.
16805         * testsuite/protected_1.cc: New file.
16806         * testsuite/protected_2.cc: New file.
16807         * testsuite/protected_3.cc: New file.
16808         * testsuite/protected_main_1.cc: New file.
16809         * testsuite/protected_main_2.cc: New file.
16810         * testsuite/protected_main_3.cc: New file.
16811         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
16812         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
16813         (protected_1_LDFLAGS, protected_1_LDADD): Define.
16814         (protected_1.so): New target.
16815         (protected_1_pic.o, protected_2_pic.o): New targets.
16816         (protected_3_pic.o): New target.
16817         (check_PROGRAMS): Add protected_2.
16818         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
16819         (protected_2_LDFLAGS, protected_2_LDADD): Define.
16820         * testsuite/Makefile.in: Rebuild.
16821
16822         * options.h (DEFINE_var): Add set_user_set_##varname__.
16823         (DEFINE_bool_alias): New macro.
16824         (class General_options): Define -Bstatic using DEFINE_bool_alias
16825         rather than DEFINE_special.  Add --undefined as an alias for -z
16826         defs.
16827         * options.cc (General_options::parse_Bstatic): Remove.
16828
16829         * options.h (class General_options): Add --fatal-warnings.
16830         * main.cc (main): Implement --fatal-warnings.
16831         * errors.h (Errors::warning_count): New function.
16832
16833         * options.h (class General_options): Add -Bsymbolic-functions.
16834         * symtab.h (Symbol::is_preemptible): Check for
16835         -Bsymbolic-functions.
16836
16837 2008-05-05  Ian Lance Taylor  <iant@google.com>
16838
16839         * options.h (DEFINE_bool): For DASH_Z, create the negative option
16840         as noVARNAME rather than no-VARNAME.
16841         (class General_options): Add option -z combreloc.
16842         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
16843         get_address.
16844         (Output_reloc::sort_before) [SHT_REL]: New function.
16845         (Output_reloc::sort_before) [SHT_RELA]: New function.
16846         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
16847         Sort_relocs_comparison.
16848         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
16849         parameter.  Change all callers.
16850         (Output_data_reloc::Output_data_reloc) [both versions]: Add
16851         sort_relocs parameter.  Change all callers.
16852         * output.cc (Output_reloc::get_address): New function, broken out
16853         of write_rel.
16854         (Output_reloc::write_rel): Call it.
16855         (Output_reloc::compare): New function.
16856         (Output_data_reloc_base::do_write): Optionally sort relocs.
16857
16858         * configure.ac: If targ_extra_obj is set, link it in.
16859         * configure.tgt: Initialize all variables.
16860         (x86_64*): Set targ_extra_obj and targ_extra_size.
16861         * configure: Rebuild.
16862
16863         * object.cc (Sized_relobj::include_section_group): Adjust section
16864         indexes read from group data.  Build vector to pass to
16865         layout_group.
16866         * layout.cc (Layout::layout_group): Add flags and shndxes
16867         parameters.  Remove contents parameter.  Change caller.  Update
16868         explicit instantiations.
16869         * layout.h (class Layout): Update layout_group declaration.
16870         * output.cc (Output_data_group::Output_data_group): Add flags and
16871         input_shndxes parameters.  Remove contents parameter.  Change
16872         caller.
16873         (Output_data_group::do_write): Change input_sections_ to
16874         input_shndxes_.
16875         * output.h (class Output_data_group): Update constructor
16876         declaration.  Rename input_sections_ to input_shndxes_.
16877         * testsuite/many_sections_test.cc: Add template.
16878
16879 2008-04-30  Cary Coutant  <ccoutant@google.com>
16880
16881         * target-reloc.h (relocate_section): Fix dead-pointer bug.
16882
16883         * layout.cc (Layout::include_section): Refactored check for debug
16884         info section.
16885         (Layout::add_comdat): Add new parameters.  Change type
16886         of signature parameter.  Add object and shndx to signatures table.
16887         (Layout::find_kept_object): New function.
16888         * layout.h: Include <cstring>.
16889         (Layout::is_debug_info_section): New function.
16890         (Layout::add_comdat): Add new parameters.
16891         (Layout::find_kept_object): New function.
16892         (Layout::Kept_section): New struct.
16893         (Layout::Signatures): Change type of map range.
16894         * object.cc (Relobj::output_section_address): New function.
16895         (Sized_relobj::include_section_group): Add new parameters.  Change
16896         calls to Layout::add_comdat.  Change to build table of kept comdat
16897         groups and table mapping discarded sections to kept sections.
16898         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
16899         (Sized_relobj::do_layout): Change calls to include_section_group and
16900         include_linkonce_section.
16901         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
16902         value to zero when section is discarded.
16903         (Sized_relobj::map_to_kept_section): New function.
16904         * object.h (Relobj::output_section_address): New function.
16905         (Relobj::Comdat_group): New type.
16906         (Relobj::find_comdat_group): New function.
16907         (Relobj::Comdat_group_table): New type.
16908         (Relobj::Kept_comdat_section): New type.
16909         (Relobj::Kept_comdat_section_table): New type.
16910         (Relobj::add_comdat_group): New function.
16911         (Relobj::set_kept_comdat_section): New function.
16912         (Relobj::get_kept_comdat_section): New function.
16913         (Relobj::comdat_groups_): New field.
16914         (Relobj::kept_comdat_sections_): New field.
16915         (Symbol_value::input_value): Update comment.
16916         (Sized_relobj::map_to_kept_section) New function.
16917         (Sized_relobj::include_linkonce_section): Add new parameter.
16918         * target-reloc.h (Comdat_behavior): New type.
16919         (get_comdat_behavior): New function.
16920         (relocate_section): Add code to map a discarded section to the
16921         corresponding kept section when applying a relocation.
16922
16923 2008-04-30  Craig Silverstein  <csilvers@google.com>
16924
16925         * dwarf_reader.cc (next_generation_count): New static var.
16926         (Addr2line_cache_entry): New struct.
16927         (addr2line_cache): New static var.
16928         (Dwarf_line_info::one_addr2line): Added caching.
16929         (Dwarf_line_info::clear_addr2line_cache): New function.
16930         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
16931         cache-size parameter.
16932         (Dwarf_line_info::one_addr2line_cache): New function.
16933         * symtab.cc (Symbol_table::detect_odr_violations): Pass
16934         new cache-size argument to one_addr2line(), and clear cache.
16935
16936 2008-04-28  Cary Coutant  <ccoutant@google.com>
16937
16938         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
16939         R_386_PC8 relocations.
16940
16941 2008-04-23  Ian Lance Taylor  <iant@google.com>
16942
16943         * object.cc (Sized_relobj::include_section_group): Check for
16944         invalid section group.
16945
16946         * object.cc (make_elf_object): Correct test for 64-bit ELF file
16947         header size.
16948
16949         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
16950         than read for file header.
16951         * archive.cc (Archive::include_member): Likewise.
16952
16953 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
16954
16955         * aclocal.m4: Regenerate.
16956         * configure: Regenerate.
16957
16958 2008-04-19  Ian Lance Taylor  <iant@google.com>
16959
16960         * version.cc (version_string): Bump to 1.6.
16961
16962         * testsuite/Makefile.am (many_sections_r_test): New target.
16963         (many_sections_r_test_SOURCES): Remove.
16964         (many_sections_r_test_DEPENDENCIES): Remove.
16965         (many_sections_r_test_LDFLAGS): Remove.
16966         (many_sections_r_test_LDADD): Remove.
16967
16968         * object.cc (Sized_relobj::do_add_symbols): Always pass
16969         local_symbol_count_ to add_from_relobj.
16970
16971         * testsuite/Makefile.am (many_sections_check.h): Only check one in
16972         every thousand variables.
16973         * testsuite/Makefile.in: Rebuild.
16974
16975         * object.cc (Xindex::initialize_symtab_xindex): New function.
16976         (Xindex::read_symtab_xindex): New function.
16977         (Xindex::sym_xindex_to_shndx): New function.
16978         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
16979         available.
16980         (Sized_relobj::do_initialize_xindex): New function.
16981         (Sized_relobj::do_read_symbols): Adjust section links.
16982         (Sized_relobj::symbol_section_and_value): Add is_ordinary
16983         parameter.  Change all callers.
16984         (Sized_relobj::include_section_group): Adjust section links and
16985         symbol section indexes.
16986         (Sized_relobj::do_layout): Adjust section links.
16987         (Sized_relobj::do_count_local_symbols): Adjust section links and
16988         symbol section indexes.
16989         (Sized_relobj::do_finalize_local_symbols): Distinguish between
16990         ordinary and special symbols.
16991         (Sized_relobj::write_local_symbols): Add symtab_xindex and
16992         dynsym_xindex parameters.  Change all callers.  Adjust section
16993         links.  Use SHN_XINDEX when needed.
16994         (Sized_relobj::get_symbol_location_info): Adjust section links.
16995         Don't get fooled by special symbols.
16996         * object.h (class Xindex): Define.
16997         (class Object): Add xindex_ parameter.  Declare virtual functoin
16998         do_initialize_xindex.
16999         (Object::adjust_sym_shndx): New function.
17000         (Object::set_xindex): New protected function.
17001         (class Symbol_value): Add is_ordinary_shndx_ field.
17002         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
17003         (Symbol_value::value): Assert ordinary section.
17004         (Symbol_value::initialize_input_to_output_map): Likewise.
17005         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
17006         Change all callers.
17007         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
17008         all callers.
17009         (class Sized_relobj): Update declarations.
17010         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
17011         parameter.  Change all callers.
17012         (Sized_relobj::adjust_shndx): New function.
17013         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
17014         field.
17015         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
17016         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
17017         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
17018         (Sized_dynobj::read_dynsym_section): Adjust section links.
17019         (Sized_dynobj::read_dynamic): Likewise.
17020         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
17021         section links.
17022         (Sized_dynobj::do_initialize_xindex): New function.
17023         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
17024         do_initialize_xindex.
17025         (Sized_dynobj::adjust_shndx): New function.
17026         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
17027         dynsym_xindex_ fields.
17028         (Layout::finalize): Add a call to set_section_indexes before
17029         creating the symtab sections.
17030         (Layout::set_section_indexes): Don't do anything if the section
17031         already has a section index.
17032         (Layout::create_symtab_sections): Add shnum parameter.  Change
17033         caller.  Create .symtab_shndx section if needed.
17034         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
17035         caller.
17036         (Layout::allocated_output_section_count): New function.
17037         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
17038         needed.
17039         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
17040         fields.  Update declarations.
17041         (Layout::symtab_xindex): New function.
17042         (Layout::dynsym_xindex): New function.
17043         (class Write_symbols_task): Add layout_ field.
17044         (Write_symbols_task::Write_symbols_task): Add layout parameter.
17045         Change caller.
17046         * output.cc (Output_section_headers::Output_section_headers): Add
17047         shstrtab_section parameter.  Change all callers.
17048         (Output_section_headers::do_sized_write): Store overflow values
17049         for section count and section string table section index in
17050         section header zero.
17051         (Output_file_header::do_sized_write): Check for overflow of
17052         section count and section string table section index.
17053         (Output_symtab_xindex::do_write): New function.
17054         (Output_symtab_xindex::endian_do_write): New function.
17055         * output.h (class Output_section_headers): Add shstrtab_section_.
17056         Update declarations.
17057         (class Output_symtab_xindex): Define.
17058         (Output_section::has_out_shndx): New function.
17059         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
17060         field.
17061         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
17062         Change all callers.
17063         (Sized_symbol::init): Likewise.
17064         (Symbol::output_section): Check for ordinary symbol.
17065         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
17066         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
17067         callers.
17068         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
17069         Change all callers.  Simplify handling of symbols from sections
17070         not included in the link.
17071         (Symbol_table::add_from_dynobj): Handle ordinary symbol
17072         distinction.
17073         (Weak_alias_sorter::operator()): Assert that symbols are
17074         ordinary.
17075         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
17076         distinction.
17077         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
17078         parameters.  Change all callers.
17079         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
17080         symbol distinction.  Use SHN_XINDEX when needed.
17081         (Symbol_table::write_section_symbol): Add symtab_xindex
17082         parameter.  Change all callers.
17083         (Symbol_table::sized_write_section_symbol): Likewise.  Use
17084         SHN_XINDEX when needed.
17085         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
17086         declarations.
17087         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
17088         (Symbol::is_defined): Check is_ordinary.
17089         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
17090         (Symbol::is_absolute, Symbol::is_common): Likewise.
17091         (class Sized_symbol): Update declarations.
17092         (class Symbol_table): Update declarations.
17093         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
17094         parameters.  Change all callers.
17095         (Sized_symbol::override): Likewise.
17096         (Symbol_table::override): Likewise.
17097         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
17098         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
17099         is_ordinary, and orig_st_shndx parameters.  Change all callers.
17100         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
17101         to be in an ordinary section.
17102         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
17103         object and is_ordinary parameters.  Change all callers.
17104         (Sized_dwarf_line_info::read_relocs): Add object parameter.
17105         Change all callers.  Don't add undefined or non-ordinary symbols
17106         to reloc_map_.
17107         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
17108         Change all callers.
17109         * dwarf_reader.h (class Sized_dwarf_line_info): Update
17110         declarations.
17111         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
17112         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
17113         (Sized_relobj::relocate_sections): Likewise.
17114         * target-reloc.h (scan_relocs): Adjust section symbol index.
17115         (scan_relocatable_relocs): Likewise.
17116         * i386.cc (Scan::local): Check for ordinary symbols.
17117         * sparc.cc (Scan::local): Likewise.
17118         * x86_64.cc (Scan::local): Likewise.
17119         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
17120         to symbol_section_and_value.
17121         * testsuite/many_sections_test.cc: New file.
17122         * testsuite/Makefile.am (BUILT_SOURCES): Define.
17123         (check_PROGRAMS): Add many_sections_test.
17124         (many_sections_test_SOURCES): Define.
17125         (many_sections_test_DEPENDENCIES): Define.
17126         (many_sections_test_LDFLAGS): Define.
17127         (BUILT_SOURCES): Add many_sections_define.h.
17128         (many_sections_define.h): New target.
17129         (BUILT_SOURCES): Add many_sections_check.h.
17130         (many_sections_check.h): New target.
17131         (check_PROGRAMS): Add many_sections_r_test.
17132         (many_sections_r_test_SOURCES): Define.
17133         (many_sections_r_test_DEPENDENCIES): Define.
17134         (many_sections_r_test_LDFLAGS): Define.
17135         (many_sections_r_test_LDADD): Define.
17136         (many_sections_r_test.o): New target.
17137         * testsuite/Makefile.in: Rebuild.
17138
17139 2008-04-17  Cary Coutant  <ccoutant@google.com>
17140
17141         * errors.cc (Errors::info): New function.
17142         (gold_info): New function.
17143         * errors.h (Errors::info): New function.
17144         * gold.h (gold_info): New function.
17145         * object.cc (Input_objects::add_object): Print trace output.
17146         * options.cc (options::parse_set): New function.
17147         (General_options::parse_wrap): Deleted.
17148         (General_options::General_options): Deleted initializer.
17149         * options.h (options::String_set): New typedef.
17150         (options::parse_set): New function.
17151         (DEFINE_set): New macro.
17152         (General_options::wrap): Changed to use DEFINE_set. Changed
17153         callers of any_wrap_symbols and is_wrap_symbol.
17154         (General_options::trace, General_options::trace_symbol):
17155         New options.
17156         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
17157         (General_options::wrap_symbols_): Deleted.
17158         * symtab.cc (Symbol_table::add_from_object): Print trace output.
17159
17160 2008-04-17  David S. Miller  <davem@davemloft.net>
17161
17162         * options.cc (General_options::parse_V): New function.
17163         * options.h: Add entries for -V and -Qy.
17164
17165 2008-04-17  Ian Lance Taylor  <iant@google.com>
17166
17167         * common.cc (Symbol_table::allocate_commons): Remove options
17168         parameter.  Change caller.
17169         (Symbol_table::do_allocate_commons): Remove options parameter.
17170         Change caller.  Just call do_allocate_commons_list twice.
17171         (Symbol_table::do_allocate_commons_list): New function, broken out
17172         of do_allocate_commons.
17173         * common.h (class Allocate_commons_task): Remove options_ field.
17174         Update constructor.
17175         * symtab.cc (Symbol_table::Symbol_table): Initialize
17176         tls_commons_.
17177         (Symbol_table::add_from_object): Put TLS common symbols on
17178         tls_commons_ list.
17179         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
17180         which are IN_OUTPUT_DATA.
17181         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
17182         allocate_commons and do_allocate_commons declarations.  Declare
17183         do_allocate_commons_list.
17184         * gold.cc (queue_middle_tasks): Update creation of
17185         Allocate_commons_task to not pass options.
17186         * testsuite/Makefile.am (INCLUDES): Add -I.. .
17187         (TLS_TEST_C_FLAGS): New variable.
17188         (tls_test_c_pic.o): New target.
17189         (tls_test_shared.so): Link in tls_test_c_pic.o.
17190         (tls_test_c_pic_ie.o): New target.
17191         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
17192         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
17193         (tls_test_c.o): New target.
17194         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
17195         (tls_pic_test_LDADD): Likewise.
17196         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
17197         (tls_shared_gd_to_ie_test_LDADD): Likewise.
17198         (tls_test_c_gnu2.o): New target.
17199         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
17200         tls_test_c_gnu2.o.
17201         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
17202         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
17203         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
17204         * testsuite/tls_test.cc: Include "config.h".
17205         (t_last): Call t11_last.
17206         * testsuite/tls_test.h (t11, t11_last): Declare.
17207         * testsuite/tls_test_c.c: New file.
17208         * testsuite/tls_test_main.cc (thread_routine): Call t11.
17209         * configure.ac: Check for OpenMP support.
17210         * configure, config.in, Makefile.in: Rebuild.
17211         * testsuite/Makefile.in: Rebuild.
17212
17213 2008-04-16  Cary Coutant  <ccoutant@google.com>
17214
17215         * i386.cc (Target_i386::define_tls_base_symbol): New function.
17216         (Target_i386::tls_base_symbol_defined_): New field.
17217         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
17218         (Target_i386::Scan::global): Likewise.
17219         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
17220         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
17221         (Target_x86_64::tls_base_symbol_defined_): New field.
17222         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
17223         (Target_x86_64::Scan::global): Likewise.
17224
17225 2008-04-16  Cary Coutant  <ccoutant@google.com>
17226
17227         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
17228         (Symbol::needs_plt_entry): Allow weak undefined symbols.
17229         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
17230         building shared libraries.
17231         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
17232         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
17233         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
17234         * testsuite/Makefile.in: Rebuild.
17235         * testsuite/weak_undef.h: New file.
17236         * testsuite/weak_undef_file1.cc: Add extra test cases.
17237         * testsuite/weak_undef_file2.cc: Likewise.
17238         * testsuite/weak_undef_test.cc: Likewise.
17239
17240 2008-04-16  David S. Miller  <davem@davemloft.net>
17241
17242         * sparc.cc (Target_sparc::Scan): Change from struct to class.
17243         Add issued_non_pic_error_ field.  Declare check_non_pic.
17244         (Target_sparc::Scan::check_non_pic): New function.
17245         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
17246         (Target_sparc::Scan::global): Likewise.
17247
17248         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
17249         * configure: Rebuild.
17250
17251         * options.h (DEFINE_enable): New macro.
17252         (new_dtags): New enable option.
17253         (initfirst, interpose, loadfltr, nodefaultlib,
17254         nodelete, nodlopen, nodump): New -z options.
17255         * layout.cc (Layout:finish_dynamic_section): If new
17256         dtags enabled, emit DT_RUNPATH.  Also, emit a
17257         DT_FLAGS_1 containing any specified -z flags.
17258
17259 2008-04-16  Ian Lance Taylor  <iant@google.com>
17260
17261         * copy-relocs.cc: New file.
17262         * copy-relocs.h: New file.
17263         * reloc.cc: Remove Copy_relocs code.
17264         * reloc.h: Likewise.
17265         * reloc-types.h (struct Reloc_types) [both versions]: Add
17266         get_reloc_addend_noerror.
17267         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
17268         variants of add_global which take an addend which must be zero.
17269         * i386.cc: Include "copy-relocs.h".
17270         (class Target_i386): Change type of copy_relocs_ to variable,
17271         update initializer.
17272         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
17273         Change all callers.
17274         (Target_i386::do_finalize_sections): Change handling of
17275         copy_relocs_.
17276         * sparc.cc: Include "copy-relocs.h".
17277         (class Target_sparc): Change type of copy_relocs_ to variable,
17278         update initializer.
17279         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
17280         Change all callers.
17281         (Target_sparc::do_finalize_sections): Change handling of
17282         copy_relocs_.
17283         * x86_64.cc: Include "copy-relocs.h".
17284         (class Target_x86_64): Change type of copy_relocs_ to variable,
17285         update initializer.
17286         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
17287         class.  Change all callers.
17288         (Target_x86_64::do_finalize_sections): Change handling of
17289         copy_relocs_.
17290         * Makefile.am (CCFILES): Add copy-relocs.cc.
17291         (HFILES): Add copy-relocs.h.
17292
17293         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
17294
17295         * testsuite/script_test_4.sh: Permit leading zeroes.
17296
17297 2008-04-15  Ian Lance Taylor  <iant@google.com>
17298
17299         * script-sections.cc (Script_sections::create_segments): Use
17300         header_size_adjustment even when there is enough room for the
17301         headers.
17302         * testsuite/script_test_4.sh: New file.
17303         * testsuite/script_test_4.t: New file.
17304         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
17305         (check_DATA): Add script_test_4.stdout.
17306         (MOSTLYCLEANFILES): Likewise.
17307         (script_test_4): New target.
17308         (script_test_4.stdout): New target.
17309         * testsuite/Makefile.in: Rebuild.
17310
17311         * sparc.cc: Add definitions for Output_data_plt_sparc class
17312         constants.
17313
17314 2008-04-14  David S. Miller  <davem@davemloft.net>
17315
17316         * sparc.cc: New file.
17317         * Makefile.am (TARGETSOURCES): Add sparc.cc
17318         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
17319         * configure.tgt: Document targ_extra_size and
17320         targ_extra_big_endian.  Add entries for sparc-* and
17321         sparc64-*.
17322         * configure.ac: Handle targ_extra_size and
17323         targ_extra_big_endian.
17324         * Makefile.in: Rebuild.
17325         * configure: Likewise.
17326         * po/POTFILES.in: Likewise.
17327         * po/gold.pot: Likewise.
17328
17329 2008-04-14  Ian Lance Taylor  <iant@google.com>
17330
17331         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
17332         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
17333         in the name/type/flags to section mapping.  Don't call
17334         allocate_output_section.
17335         (Layout::choose_output_section): Change parameter from adjust_name
17336         to is_input_section.  Don't permit input sections after sections
17337         are attached to segments.  Don't call allocate_output_section.
17338         (Layout::layout_eh_frame): Call update_flags_for_input_section,
17339         not write_enable_output_section.
17340         (Layout::make_output_section): Don't push to
17341         unattached_section_list_ nor call attach_to_segment.  Call
17342         attach_section_to_segment if sections are attached.
17343         (Layout::attach_sections_to_segments): New function.
17344         (Layout::attach_section_to_segment): New function.
17345         (Layout::attach_allocated_section_to_segment): Rename from
17346         attach_to_segment.  Remove flags parameter.
17347         (Layout::allocate_output_section): Remove function.
17348         (Layout::write_enable_output_section): Remove function.
17349         * layout.h (class Layout): Update for above changes.  Add new
17350         field sections_are_attached_.
17351         * output.h (Output_section::update_flags_for_input_section): New
17352         function.
17353         * output.cc (Output_section::add_input_section): Call
17354         update_flags_for_input_section.
17355         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
17356
17357 2008-04-11  Cary Coutant  <ccoutant@google.com>
17358
17359         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
17360         thought unnecessary.
17361         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
17362
17363 2008-04-11  Ian Lance Taylor  <iant@google.com>
17364
17365         * output.h (class Output_section_data): Remove inline definition
17366         of set_addralign.
17367         * output.cc (Output_section_data::set_addralign): New function.
17368
17369 2008-04-11  Cary Coutant  <ccoutant@google.com>
17370
17371         Add support for TLS descriptors for i386 and x86_64.
17372         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
17373         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
17374         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
17375         GOT_TYPE_TLS_DESC.
17376         (Target_i386::got_mod_index_entry): Remove unnecessary code.
17377         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
17378         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
17379         relocations.
17380         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
17381         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
17382         Fix problem with initial-exec relocations.
17383         (Target_i386::Relocate::relocate_tls): Likewise.
17384         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
17385         relaxation.
17386         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
17387         support for section-plus-offset dynamic table entries.
17388         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
17389         (Output_data_dynamic::Dynamic_entry): Add support for
17390         section-plus-offset dynamic table entries.
17391         (Output_data_dynamic::Classification): Likewise.
17392         (Output_data_dynamic::classification_): Renamed offset_.
17393         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
17394         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
17395         (Target_x86_64::make_plt_section): New function.
17396         (Target_x86_64::reserve_tlsdesc_entries): New function.
17397         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
17398         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
17399         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
17400         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
17401         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
17402         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
17403         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
17404         add extra PLT entry for TLS descriptors.
17405         (Output_data_plt_x86_64::got_): New field.
17406         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
17407         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
17408         fields.
17409         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
17410         descriptors.
17411         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
17412         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
17413         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
17414         R_386_TLS_DESC_CALL relocations.
17415         (Target_x86_64::Scan::global): Likewise.
17416         (Target_x86_64::do_finalize_sections): Add dynamic table entries
17417         for TLS descriptors.
17418         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
17419         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
17420         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
17421         GD-to-IE relaxation.
17422         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
17423         and TLS_DESCRIPTORS.
17424         * Makefile.in: Rebuild.
17425         * configure: Rebuild.
17426         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
17427         (tls_test_shared2.so): New target.
17428         (tls_shared_gd_to_ie_test_SOURCES): New variable.
17429         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
17430         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
17431         (tls_shared_gd_to_ie_test_LDADD): New variable.
17432         (tls_shared_gnu2_gd_to_ie_test): New target.
17433         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
17434         New targets.
17435         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
17436         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
17437         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
17438         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
17439         (tls_shared_gnu2_test): New target.
17440         (tls_test_gnu2_shared.so): New target.
17441         (tls_shared_gnu2_test_SOURCES): New variable.
17442         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
17443         (tls_shared_gnu2_test_LDFLAGS): New variable.
17444         (tls_shared_gnu2_test_LDADD): New variable.
17445         * testsuite/Makefile.in: Rebuild.
17446         * testsuite/Makefile.
17447
17448 2008-04-11  Ian Lance Taylor  <iant@google.com>
17449
17450         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
17451         justsyms.t.
17452         * testsuite/Makefile.in: Rebuild.
17453
17454         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
17455         long.
17456         * testsuite/script_test_2.cc (main): Adjust test.
17457
17458 2008-04-11  David S. Miller  <davem@davemloft.net>
17459             Ian Lance Taylor  <iant@google.com>
17460
17461         * options.h (General_options): Add entries for '-Y' and
17462         '-relax'.
17463         * options.cc (General_options:finalize): If -Y was used, add those
17464         entries to the library path instead of the default "/lib" and
17465         "/usr/lib".
17466
17467 2008-04-11  David S. Miller  <davem@davemloft.net>
17468
17469         * testsuite/justsyms.t: Start at 0x100.
17470         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
17471         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
17472         long.
17473         * testsuite/script_test_2.cc: Adjust string and section length
17474         checks.
17475
17476 2008-04-09  Ian Lance Taylor  <iant@google.com>
17477
17478         PR gold/5996
17479         * script-sections.cc (Sections_element::allocate_to_segment): Add
17480         orphan parameter.
17481         (Output_section_definition::allocate_to_segment): Likewise.
17482         (Orphan_output_section::allocate_to_segment): Likewise.
17483         (Script_sections::attach_sections_using_phdrs_clause): Don't
17484         propagate non-PT_LOAD segments to orphan sections.
17485         * testsuite/Makefile.am (script_test_3.stdout): Generate using
17486         readelf rather than objdump.
17487         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
17488         .interp section and PT_INTERP segment are the same size.
17489         * testsuite/Makefile.in: Rebuild.
17490
17491         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
17492         aliases for symbols defined in the same object.
17493         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
17494         (weak_alias_test_SOURCES): New variable.
17495         (weak_alias_test_DEPENDENCIES): New variable.
17496         (weak_alias_test_LDFLAGS): New variable.
17497         (weak_alias_test_LDADD): New variable.
17498         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
17499         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
17500         (weak_alias_test_3.o): New target.
17501         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
17502         * testsuite/weak_alias_test_main.cc: New file.
17503         * testsuite/weak_alias_test_1.cc: New file.
17504         * testsuite/weak_alias_test_2.cc: New file.
17505         * testsuite/weak_alias_test_3.cc: New file.
17506
17507 2008-04-08  Ian Lance Taylor  <iant@google.com>
17508
17509         * options.h (class General_options): Add --noinhibit-exec option.
17510         * main.cc (main): Check --noinhibit-exec.
17511
17512         * options.h (class General_options): Define --wrap as a special
17513         option.  Add wrap_symbols_ field.
17514         (General_options::any_wrap_symbols): New function.
17515         (General_options::is_wrap_symbol): New function.
17516         * options.cc (General_options::parse_wrap): New function.
17517         (General_options::General_options): Initialize wrap_symbols_.
17518         * symtab.cc (Symbol_table::wrap_symbol): New function.
17519         (Symbol_table::add_from_object): Handle --wrap.
17520         * symtab.h (class Symbol_table): Declare wrap_symbol.
17521         * target.h (Target::wrap_char): New function.
17522         (Target::Target_info): Add wrap_char field.
17523         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
17524         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
17525         * testsuite/testfile.cc (Target_test::test_target_info):
17526         Likewise.
17527
17528         * errors.cc (Errors::undefined_symbol): Mention symbol version if
17529         there is one.
17530
17531         * layout.h (class Layout): Add added_eh_frame_data_ field.
17532         * layout.cc (Layout::Layout): Initialize new field.
17533         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
17534         output section until we find a section we merged successfully.
17535         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
17536         that the size be non-zero.
17537
17538         * merge.cc (Object_merge_map::get_output_offset): Remove inline
17539         qualifier.
17540
17541 2008-04-08  Craig Silverstein  <csilvers@google.com>
17542
17543         * configure.ac: Export new conditional variable HAVE_ZLIB.
17544         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
17545         on HAVE_ZLIB.
17546         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
17547         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17548
17549 2008-04-07  Ian Lance Taylor  <iant@google.com>
17550
17551         * version.cc (version_string): Set to "1.5".
17552
17553         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
17554         Add issued_non_pic_error_ field.  Declare check_non_pic.
17555         (Target_x86_64::Scan::check_non_pic): New function.
17556         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
17557         (Target_x86_64::Scan::global): Likewise.
17558
17559         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
17560         addend parameter.  Change caller.  Handle merge sections.
17561         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
17562         Address to Addend.  Don't add in the result of
17563         local_section_offset, pass down the addend and use the returned
17564         value.
17565         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
17566         Update declarations of local_section_offset and symbol_value.
17567         * testsuite/two_file_test_1.cc (t18): New function.
17568         * testsuite/two_file_test_2.cc (f18): New function.
17569         * testsuite/two_file_test_main.cc (main): Call t18.
17570         * testsuite/two_file_test.h (t18, f18): Declare.
17571
17572         * configure.ac: Don't test for objdump, c++filt, or readelf.
17573         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
17574         conditionals.
17575         (TEST_READELF): New variable.
17576         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
17577         (check_PROGRAMS): Add two_file_strip_test.
17578         (two_file_strip_test): New target.
17579         (check_PROGRAMS): Add two_file_same_shared_strip_test.
17580         (two_file_same_shared_strip_test_SOURCES): New variable.
17581         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
17582         (two_file_same_shared_strip_test_LDFLAGS): New variable.
17583         (two_file_same_shared_strip_test_LDADD): New variable.
17584         (two_file_shared_strip.so): New target.
17585         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
17586         (ver_test_5.syms, ver_test_7.syms): Likewise.
17587         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
17588         (strip_test_3.stdout): Use TEST_OBJDUMP.
17589         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17590
17591 2008-04-04  Cary Coutant  <ccoutant@google.com>
17592
17593         * symtab.h (Symbol::is_weak_undefined): New function.
17594         (Symbol::is_strong_undefined): New function.
17595         (Symbol::is_absolute): New function.
17596         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
17597         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
17598         absolute symbols.
17599         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
17600         (weak_undef_test): New target.
17601         * testsuite/Makefile.in: Rebuild.
17602         * testsuite/weak_undef_file1.cc: New file.
17603         * testsuite/weak_undef_file2.cc: New file.
17604         * testsuite/weak_undef_test.cc: New file.
17605
17606 2008-04-03  Craig Silverstein  <csilvers@google.com>
17607
17608         * compressed_output.h (class Output_compressed_section): Use
17609         unsigned buffer.
17610         * compressed_output.cc (zlib_compress): Use unsigned buffers,
17611         add zlib header.
17612         (zlib_compressed_suffix): Removed.
17613         (Output_compressed_section::set_final_data_size): Use unsigned
17614         buffers.
17615         * testsuite/Makefile.am (flagstest_compress_debug_sections):
17616         Fix linker invocation.
17617         (flagstest_o_specialfile_and_compress_debug_sections):
17618         Likewise.
17619         * testsuite/Makefile.in: Regenerated.
17620
17621 2008-04-02  David S. Miller  <davem@davemloft.net>
17622
17623         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
17624         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
17625
17626 2008-04-02  Craig Silverstein  <csilvers@google.com>
17627
17628         * TODO: New file.
17629
17630 2008-04-02  Ian Lance Taylor  <iant@google.com>
17631
17632         * fileread.cc (File_read::find_view): Add byteshift and vshifted
17633         parameters.  Update for new key type to views_.  Change all
17634         callers.
17635         (File_read::read): Adjust for byteshift in returned view.
17636         (File_read::add_view): New function, broken out of
17637         find_and_make_view.
17638         (File_read::make_view): New function, broken out of
17639         find_and_make_view.
17640         (File_read::find_or_make_view): Add offset and aligned
17641         parameters.  Rewrite accordingly.  Change all callers.
17642         (File_read::get_view): Add offset and aligned parameters.  Adjust
17643         for byteshift in return value.
17644         (File_read::get_lasting_view): Likewise.
17645         * fileread.h (class File_read): Update declarations.
17646         (class File_read::View): Add byteshift_ field.  Add byteshift to
17647         constructor.  Add byteshift method.
17648         * archive.h (Archive::clear_uncached_views): New function.
17649         (Archive::get_view): Add aligned parameter.  Change all callers.
17650         * object.h (Object::get_view): Add aligned parameter.  Change all
17651         callers.
17652         (Object::get_lasting_view): Likewise.
17653
17654         * fileread.cc (File_read::release): Don't call clear_views if
17655         there are multiple objects.
17656         * fileread.h (File_read::clear_uncached_views): New function.
17657         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
17658         on the archive.
17659
17660 2008-03-31  Cary Coutant  <ccoutant@google.com>
17661
17662         Add thin archive support.
17663         * archive.cc (Archive::armagt): New const.
17664         (Archive::setup): Remove task parameter and calls to unlock.
17665         (Archive::unlock_nested_archives): New function.
17666         (Archive::read_header): Add nested_off parameter. Change
17667         all callers.
17668         (Archive::interpret_header): Likewise.
17669         (Archive::include_all_members): Change to handle thin
17670         archives.
17671         (Archive::include_member): Likewise.
17672         * archive.h (Archive::Archive): Add new parameters and
17673         initializers.
17674         (Archive::armagt): New const.
17675         (Archive::setup): Remove task parameter.
17676         (Archive::unlock_nested_archives): New function.
17677         (Archive::read_header): Add nested_off parameter.
17678         (Archive::interpret_header): Likewise.
17679         (Archive::Nested_archive_table): New typedef.
17680         (Archive::is_thin_archive_): New field.
17681         (Archive::nested_archives_): New field.
17682         (Archive::options_): New field.
17683         (Archive::dirpath_): New field.
17684         (Archive::task_): New field.
17685         * readsyms.cc (Read_symbols::do_read_symbols): Add check
17686         for thin archives.  Pass additional parameters to
17687         Archive::Archive.  Unlock the archive file after calling
17688         Archive::setup.
17689
17690 2008-03-29  Ian Lance Taylor  <iant@google.com>
17691
17692         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
17693         version symbol to be local.
17694         * testsuite/ver_test_4.sh: New file.
17695         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
17696         (check_DATA): Add ver_test_4.syms.
17697         (ver_test_4.syms): New target.
17698         * testsuite/Makefile.in: Rebuild.
17699
17700         * output.cc
17701         (Output_section::Input_section_sort_entry::has_priority): New
17702         function.
17703         (Output_section::Input_section_sort_entry::match_file_name): New
17704         function.
17705         (Output_section::Input_section_sort_entry::match_section_name):
17706         Remove.
17707         (Output_section::Input_section_sort_entry::match_section_name_prefix):
17708         Remove.
17709         (Output_section::Input_section_sort_entry::match_section_file):
17710         Remove.
17711         (Output_section::Input_section_sort_compare::operator()): Rewrite
17712         using new Input_section_sort_entry functions.  Sort crtbegin and
17713         crtend first.  Sort sections with no priority before sections with
17714         a priority.
17715         * testsuite/initpri1.c (d3): Check j != 4.
17716         (cd5): New constructor/destructor function.
17717         (main): Check j != 2.
17718
17719         * symtab.cc (Symbol_table::add_from_object): If we don't use the
17720         new symbol when resolving, don't call set_is_default.
17721         * testsuite/ver_test_7.cc: New file.
17722         * testsuite/ver_test_7.sh: New file.
17723         * testsuite/Makefile.am (ver_test_7.so): New target.
17724         (ver_test_7.o): New target.
17725         (check_SCRIPTS): Add ver_test_7.sh.
17726         (check_DATA): Add ver_test_7.syms.
17727         (ver_test_7.syms): New target.
17728
17729 2008-03-28  Ian Lance Taylor  <iant@google.com>
17730
17731         * layout.cc (Layout::layout): If we see an input section with a
17732         name that needs sorting, set the must_sort flag for the output
17733         section.
17734         (Layout::make_output_section): If the name of the output section
17735         indicates that it might require sorting, set the may_sort flag.
17736         * output.h (Output_section::may_sort_attached_input_sections): New
17737         function.
17738         (Output_section::set_may_sort_attached_input_sections): New
17739         function.
17740         (Output_section::must_sort_attached_input_sections): New
17741         function.
17742         (Output_section::set_must_sort_attached_input_sections): New
17743         function.
17744         (class Output_section): Declare Input_section_sort_entry.  Define
17745         Input_section_sort_compare.  Declare
17746         sort_attached_input_sections.  Add new fields:
17747         may_sort_attached_input_sections_,
17748         must_sort_attached_input_sections_,
17749         attached_input_sections_are_sorted_.
17750         * output.cc (Output_section::Output_section): Initialize new
17751         fields.
17752         (Output_section::add_input_section): Add an entry to
17753         input_sections_ if may_sort or must_sort are true.
17754         (Output_section::set_final_data_size): Call
17755         sort_attached_input_sections if necessary.
17756         (Output_section::Input_section_sort_entry): Define new class.
17757         (Output_section::Input_section_sort_compare::operator()): New
17758         function.
17759         (Output_section::sort_attached_input_sections): New function.
17760         * configure.ac: Check whether the compiler supports constructor
17761         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
17762         * testsuite/initpri1.c: New file.
17763         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
17764         CONSTRUCTOR_PRIORITY.
17765         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
17766         (initpri1_LDFLAGS): New variable.
17767         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17768
17769 2008-03-27  Ian Lance Taylor  <iant@google.com>
17770
17771         * common.cc (Sort_commons::operator): Correct sorting algorithm.
17772         * testsuite/common_test_1.c: New file.
17773         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
17774         (common_test_1_SOURCES): New variable.
17775         (common_test_1_DEPENDENCIES): New variable.
17776         (common_test_1_LDFLAGS): New variable.
17777
17778         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
17779         and commons_ correctly when NAME/VERSION does not override
17780         NAME/NULL.
17781         * testsuite/ver_test_6.c: New file.
17782         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
17783         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
17784         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
17785
17786 2008-03-26  Ian Lance Taylor  <iant@google.com>
17787
17788         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
17789         of an undefined symbol from a version script.
17790         * testsuite/Makefile.am (ver_test_5.so): New target.
17791         (ver_test_5.o): New target.
17792         (check_SCRIPTS): Add ver_test_5.sh.
17793         (check_DATA): Add ver_test_5.syms.
17794         (ver_test_5.syms): New target.
17795         * testsuite/ver_test_5.cc: New file.
17796         * testsuite/ver_test_5.script: New file.
17797         * testsuite/ver_test_5.sh: New file.
17798         * Makefile.in, testsuite/Makefile.in: Rebuild.
17799
17800         PR gold/5986
17801         Fix problems building gold with gcc 4.3.0.
17802         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
17803         (gold_error_at_location, gold_warning_at_location): Use it.
17804         * configure.ac: Check whether we can compile and use a template
17805         function with a printf attribute.
17806         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
17807         when jumping over bytes.
17808         * object.cc: Instantiate Object::read_section_data.
17809         * debug.h: Include <cstring>
17810         * dwarf_reader.cc: Include <algorithm>
17811         * main.cc: Include <cstring>.
17812         * options.cc: Include <cstring>.
17813         * output.cc: Include <cstring>.
17814         * script.cc: Include <cstring>.
17815         * script.h: Include <string>.
17816         * symtab.cc: Include <cstring> and <algorithm>.
17817         * target-select.cc: Include <cstring>.
17818         * version.cc: Include <string>.
17819         * testsuite/testmain.cc: Include <cstdlib>.
17820         * configure, config.in: Rebuild.
17821
17822 2008-03-25  Ian Lance Taylor  <iant@google.com>
17823
17824         * options.cc: Include "../bfd/bfdver.h".
17825         (options::help): Print bug reporting address.
17826
17827         * version.cc (print_version): Adjust output for current value of
17828         BFD_VERSION_STRING.
17829
17830         * NEWS: New file.
17831
17832         * options.cc (options::help): Print list of supported targets.
17833         * target-select.h: Include <vector>.
17834         (class Target_selector): Make machine_, size_, and is_big_endian_
17835         fields const.  Add bfd_name_ and instantiated_target_ fields.
17836         (Target_selector::Target_selector): Add bfd_name parameter.
17837         (Target_selector::recognize): Make non-virtual, call
17838         do_recognize.
17839         (Target_selector::recognize_by_name): Make non-virtual, call
17840         do_recognize_by_name.
17841         (Target_selector::supported_names): New function.
17842         (Target_selector::bfd_name): New function.
17843         (Target_selector::do_instantiate_target): New pure virtual
17844         function.
17845         (Target_selector::do_recognize): New virtual function.
17846         (Target_selector::do_recognize_by_name): New virtual function.
17847         (Target_selector::instantiate_target): New private function.
17848         (supported_target_names): Declare.
17849         * target-select.cc (Target_selector::Target_selector): Update for
17850         new parameter and fields.
17851         (select_target_by_name): Check that the name matches before
17852         calling recognize_by_name.
17853         (supported_target_names): New function.
17854         * i386.cc (class Target_selector_i386): Update Target_selector
17855         constructor call.  Remove recognize and recognize_by_name.  Add
17856         do_instantiate_target.
17857         * x86_64.cc (class Target_selector_x86_64): Likewise.
17858         * testsuite/testfile.cc (class Target_selector_test): Update for
17859         changes to Target_selector.
17860
17861         * README: Rewrite, with some notes on unsupported features.
17862
17863 2008-03-24  Cary Coutant  <ccoutant@google.com>
17864
17865         * i386.cc (Target_i386::Got_type): New enum declaration.
17866         (Target_i386::Scan::local): Updated callers of Output_data_got
17867         member functions.
17868         (Target_i386::Scan::global): Likewise.
17869         (Target_i386::Relocate::relocate): Likewise.
17870         (Target_i386::Relocate::relocate_tls): Likewise.
17871         * object.h (Got_offset_list): New class.
17872         (Sized_relobj::local_has_got_offset): Added got_type parameter.
17873         (Sized_relobj::local_got_offset): Likewise.
17874         (Sized_relobj::set_local_got_offset): Likewise.
17875         (Sized_relobj::local_has_tls_got_offset): Removed.
17876         (Sized_relobj::local_tls_got_offset): Removed.
17877         (Sized_relobj::set_local_tls_got_offset): Removed.
17878         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
17879         * output.cc (Output_data_got::add_global): Added got_type parameter.
17880         (Output_data_got::add_global_with_rel): Likewise.
17881         (Output_data_got::add_global_with_rela): Likewise.
17882         (Output_data_got::add_global_pair_with_rel): New function.
17883         (Output_data_got::add_global_pair_with_rela): New function.
17884         (Output_data_got::add_local): Added got_type parameter.
17885         (Output_data_got::add_local_with_rel): Likewise.
17886         (Output_data_got::add_local_with_rela): Likewise.
17887         (Output_data_got::add_local_pair_with_rel): New function.
17888         (Output_data_got::add_local_pair_with_rela): New function.
17889         (Output_data_got::add_global_tls): Removed.
17890         (Output_data_got::add_global_tls_with_rel): Removed.
17891         (Output_data_got::add_global_tls_with_rela): Removed.
17892         (Output_data_got::add_local_tls): Removed.
17893         (Output_data_got::add_local_tls_with_rel): Removed.
17894         (Output_data_got::add_local_tls_with_rela): Removed.
17895         * output.h (Output_data_got::add_global): Added got_type parameter.
17896         (Output_data_got::add_global_with_rel): Likewise.
17897         (Output_data_got::add_global_with_rela): Likewise.
17898         (Output_data_got::add_global_pair_with_rel): New function.
17899         (Output_data_got::add_global_pair_with_rela): New function.
17900         (Output_data_got::add_local): Added got_type parameter.
17901         (Output_data_got::add_local_with_rel): Likewise.
17902         (Output_data_got::add_local_with_rela): Likewise.
17903         (Output_data_got::add_local_pair_with_rel): New function.
17904         (Output_data_got::add_local_pair_with_rela): New function.
17905         (Output_data_got::add_global_tls): Removed.
17906         (Output_data_got::add_global_tls_with_rel): Removed.
17907         (Output_data_got::add_global_tls_with_rela): Removed.
17908         (Output_data_got::add_local_tls): Removed.
17909         (Output_data_got::add_local_tls_with_rel): Removed.
17910         (Output_data_got::add_local_tls_with_rela): Removed.
17911         * resolve.cc (Symbol::override_base_with_special): Removed
17912         reference to has_got_offset_ field.
17913         * symtab.cc (Symbol::init_fields): Replaced initialization
17914         of got_offset_ with got_offsets_.  Removed initialization
17915         of has_got_offset_
17916         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
17917         (Symbol::got_offset): Likewise.
17918         (Symbol::set_got_offset): Likewise.
17919         (Symbol::has_tls_got_offset): Removed.
17920         (Symbol::tls_got_offset): Removed.
17921         (Symbol::set_tls_got_offset): Removed.
17922         (Symbol::got_offset_): Removed.
17923         (Symbol::tls_mod_got_offset_): Removed.
17924         (Symbol::tls_pair_got_offset_): Removed.
17925         (Symbol::got_offsets_): New field.
17926         (Symbol::has_got_offset): Removed.
17927         (Symbol::has_tls_mod_got_offset): Removed.
17928         (Symbol::has_tls_pair_got_offset): Removed.
17929         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
17930         (Target_x86_64::Scan::local): Updated callers of Output_data_got
17931         member functions.
17932         (Target_x86_64::Scan::global): Likewise.
17933         (Target_x86_64::Relocate::relocate): Likewise.
17934         (Target_x86_64::Relocate::relocate_tls): Likewise.
17935
17936 2008-03-25  Ben Elliston  <bje@au.ibm.com>
17937
17938         * yyscript.y: Fix spelling error in comment.
17939
17940 2008-03-24  Ian Lance Taylor  <iant@google.com>
17941
17942         * options.h (class General_options): Define build_id option.
17943         * layout.h (class Layout): Declare write_build_id, create_note,
17944         create_build_id.  Add build_id_note_ member.
17945         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
17946         "libiberty.h", "md5.h", "sha1.h".
17947         (Layout::Layout): Initialize eh_frame_data_,
17948         eh_frame_hdr_section_, and build_id_note_.
17949         (Layout::finalize): Call create_build_id.
17950         (Layout::create_note): New function, broken out of
17951         Layout::create_gold_note.
17952         (Layout::create_gold_note): Call create_note.
17953         (Layout::create_build_id): New function.
17954         (Layout::write_build_id): New function.
17955         (Close_task_runner::run): Call write_build_id.
17956
17957         * x86_64.cc: Correct license to GPLv3.
17958
17959 2008-03-23  Ian Lance Taylor  <iant@google.com>
17960
17961         * options.cc: Include "demangle.h".
17962         (parse_optional_string): New function.
17963         (parse_long_option): Handle takes_optional_argument.
17964         (parse_short_option): Update dash_z initializer.  Handle
17965         takes_optional_argument.
17966         (General_options::General_options): Initialize do_demangle_.
17967         (General_options::finalize): Set do_demangle_.  Handle demangling
17968         style.
17969         * options.h (parse_optional_string): Declare.
17970         (struct One_option): Add optional_arg field.  Update constructor.
17971         Update call constructor calls.  Add takes_optional_argument
17972         function.
17973         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
17974         (DEFINE_optional_string): Define.
17975         (General_options::demangle): Change from DEFINE_bool to
17976         DEFINE_optional_string.
17977         (General_options::no_demangle): New function.
17978         (General_options::do_demangle): New function.
17979         (General_options::set_do_demangle): New function.
17980         (General_options::execstack_status_): Move definition to end of
17981         class definition.
17982         (General_options::static_): Likewise.
17983         (General_options::do_demangle_): New field.
17984         * object.cc (big_endian>::get_symbol_location_info): Call
17985         Options::do_demangle, not Options::demangle.
17986         * symtab.cc (demangle): Likewise.
17987
17988 2008-03-22  Ian Lance Taylor  <iant@google.com>
17989
17990         * gold.h: Include <cstddef> and <sys/types.h>
17991         * options.h: Include <cstring>.
17992
17993 2008-03-21  Ian Lance Taylor  <iant@google.com>
17994
17995         * Added source code to GNU binutils.
17996 \f
17997 Copyright (C) 2008-2015 Free Software Foundation, Inc.
17998
17999 Copying and distribution of this file, with or without modification,
18000 are permitted in any medium without royalty provided the copyright
18001 notice and this notice are preserved.
18002
18003 Local Variables:
18004 mode: change-log
18005 left-margin: 8
18006 fill-column: 74
18007 version-control: never
18008 End: