b283a8843285e1ec82d4b63734c98b9642bf81a9
[external/binutils.git] / gold / ChangeLog
1 2015-12-16  Roland McGrath  <mcgrathr@google.com>
2
3         PR ld/17473
4         * binary.cc: Move #include "safe-ctype.h" to be last #include.
5
6 2015-12-10  Alan Modra  <amodra@gmail.com>
7
8         Apply from master.
9         2015-12-07  Alan Modra  <amodra@gmail.com>
10         * powerpc.cc (add_2_2_12, ld_2_12, lis_2): Define.
11         (Target_powerpc::Scan::local, global): Handle R_PPC64_ENTRY.
12         (Target_powerpc::Relocate::relocate): Edit code at R_PPC64_ENTRY.
13
14         2015-11-25  Cary Coutant  <ccoutant@gmail.com>
15         PR gold/19291
16         * object.cc (Sized_relobj_file::write_local_symbols): If relocatable,
17         subtract section address from symbol value.
18
19         2015-11-25  Alan Modra  <amodra@gmail.com>
20         * powerpc.cc (Output_data_got_powerpc::Output_data_got_powerpc): Align
21         to 256 byte boundary.
22
23         2015-11-19  Alan Modra  <amodra@gmail.com>
24         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): Correct
25         GOT16 and TOC16 relocs to RELATIVE_REF.
26
27         2015-11-14  Cary Coutant  <ccoutant@gmail.com>
28         PR gold/19244
29         PR gold/18548
30         * symtab.cc (Symbol_table::do_define_in_output_data): Check for forced
31         local symbols only for predefined symbols.
32
33 2015-11-11  Alan Modra  <amodra@gmail.com>
34             Peter Bergner <bergner@vnet.ibm.com>
35
36         * gold/powerpc.cc (Powerpc_relocate_functions::addr16_dq): New function.
37         (Powerpc_relocate_functions::addr16dx_ha): Likewise.
38         (Target_powerpc::Scan::local): Handle R_POWERPC_REL16DX_HA.
39         (Target_powerpc::Scan::global): Likewise.
40         (Target_powerpc::Relocate::relocate): Likewise.
41
42 2015-11-09  Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
43
44         * layout.h (Layout::is_debug_info_section): Recognize .pdr debug
45         sections.
46
47 2015-11-09  Cary Coutant  <ccoutant@gmail.com>
48             Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
49
50         * copy-relocs.h (Copy_relocs::copy_reloc): Replace reloc parameter
51         with type, offset, addend.
52         (Copy_relocs::save): Likewise.
53         * copy-relocs.cc (Copy_relocs::copy_reloc): Likewise.
54         (Copy_relocs::save): Likewise.
55         * aarch64.cc (Target_aarch64::copy_reloc): Pass r_type, r_offset,
56         and r_addend to Copy_relocs::copy_reloc.
57         * arm.cc (Target_arm::copy_reloc): Likewise.
58         * i386.cc (Target_i386::copy_reloc): Likewise.
59         * mips.cc (Target_mips::copy_reloc): Likewise.
60         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
61         * s390.cc (Target_s390::copy_reloc): Likewise.
62         * sparc.cc (Target_sparc::copy_reloc): Likewise.
63         * tilegx.cc (Target_tilegx::copy_reloc): Likewise.
64         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
65
66 2015-11-05  Cary Coutant  <ccoutant@gmail.com>
67
68         PR gold/19119
69         PR gold/19172
70         PR gold/19197
71         Revert commit 6457197210144f50a696097c0d308d81d46d5510:
72         2015-10-16  H.J. Lu  <hongjiu.lu@intel.com>
73                 * options.h (General_options): Remove "obsolete" from -m.
74                 * parameters.cc (set_parameters_target): Check if input target
75                 is compatible with output emulation set by "-m emulation".
76
77 2015-11-05  Cary Coutant  <ccoutant@gmail.com>
78
79         PR gold/19163
80         * aarch64.cc (Target_aarch64::Relocate::relocate): Don't apply
81         certain relocations if --no-apply-dynamic-relocs is set.
82         * options.h (--apply-dynamic-relocs): New aarch64-specific option.
83
84 2015-11-03  Alan Modra  <amodra@gmail.com>
85
86         * po/POTFILES.in: Regenerate.
87
88 2015-10-30  Nick Clifton  <nickc@redhat.com>
89
90         * po/zh_CN.po: New (simplified) Chinese translation.
91
92 2015-10-29  H.J. Lu  <hongjiu.lu@intel.com>
93
94         PR gold/19184
95         * incremental.cc (Got_plt_view_info): Add got_entry_size.
96         (Local_got_offset_visitor::visit): Replace got_entry_size_
97         with info_.got_entry_size.
98         (Local_got_offset_visitor::got_entry_size_): Removed.
99         (Global_got_offset_visitor::visit): Replace got_entry_size_
100         with info_.got_entry_size.
101         (Global_got_offset_visitor::got_entry_size_): Removed.
102         (Output_section_incremental_inputs::write_got_plt): Initialize
103         view_info.got_entry_size.
104         * target.h (Sized_target::got_entry_size): New virtual function.
105         * x86_64.cc (Target_x86_64::got_entry_size): New function.
106
107 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
108
109         * testsuite/binary_test.cc: Add __attribute__((aligned(1))).
110         * testsuite/script_test_12a.c: Likewise.
111         * testsuite/script_test_1a.cc: Likewise.
112         * testsuite/script_test_2.cc: Likewise.
113
114 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
115
116         * testsuite/debug_msg.sh: Accept more fuzz in line numbers.
117
118 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
119
120         PR gold/18959
121         * stringpool.cc (Stringpool_template::new_key_offset): Align all
122         strings, even zero-length.
123         (Stringpool_template::set_string_offsets): Likewise.
124
125 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
126
127         * s390.cc: New file.
128         * Makefile.am (TARGETSOURCES): Add s390.cc.
129         (ALL_TARGETOBJS): Add s390.o.
130         * Makefile.in: Regenerate.
131         * configure.ac: Add s390 support.
132         * configure: Regenerate.
133         * configure.tgt: Add s390-*-* and s390x-*-*.
134         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Add s390
135         support.
136
137 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
138
139         * archive.cc (Archive::sym64name): New const.
140         (Archive::setup): Add support for SYM64 armap.
141         (Archive::read_armap): Likewise.
142         (Archive::interpret_header): Likewise.
143         (Archive::const_iterator::read_next_header): Likewise.
144         * archive.h (Archive::sym64name): New const.
145         (Archive::read_armap): Add mapsize template parameter.
146
147 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
148
149         * dynobj.cc (Dynobj::create_elf_hash_table): Create hash table with
150         target-specific entry size.
151         (Dynobj::sized_create_elf_hash_table): Add size template parameter.
152         * dynobj.h (Dynobj::sized_create_elf_hash_table): Likewise.
153         * layout.cc (Layout::create_dynamic_symtab): Set entsize to
154         hash_entry_size.
155         * target.h (Target::hash_entry_size): New method.
156         (Target::Target_info::hash_entry_size): New data member.
157
158         * aarch64.cc (Target_aarch64::aarch64_info): Add hash_entry_size.
159         * arm.cc (Target_arm::arm_info): Likewise.
160         (Target_arm_nacl::arm_nacl_info): Likewise.
161         * i386.cc (Target_i386::i386_info): Likewise.
162         (Target_i386_nacl::i386_nacl_info): Likewise.
163         (Target_iamcu::iamcu_info): Likewise.
164         * mips.cc (Target_mips::mips_info): Likewise.
165         (Target_mips_nacl::mips_nacl_info): Likewise.
166         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
167         * sparc.cc (Target_sparc::sparc_info): Likewise.
168         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
169         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
170         (Target_x86_64_nacl::x86_64_nacl_info): Likewise.
171         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
172
173 2015-10-28  H.J. Lu  <hongjiu.lu@intel.com>
174
175         PR gold/19177
176         * i386.cc (Target_i386::Relocate::relocate): Check R_386_GOT32
177         and R_386_GOT32X relocations without base register.
178
179 2015-10.27  Han Shen  <shenhan@google.com>
180
181         PR gold/19042 - unsupported reloc 311/312.
182
183         * aarch64.cc (Target_aarch64::Scan::local): Add support for
184         reloc 311/312.
185
186 2015-10-22  H.J. Lu  <hongjiu.lu@intel.com>
187
188         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
189         Treat R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX the same
190         as R_X86_64_GOTPCREL.
191         (Target_x86_64<size>::Scan::local): Likewise.
192         (Target_x86_64<size>::Scan::possible_function_pointer_reloc):
193         Likewise.
194         (Target_x86_64<size>::Scan::global): Likewise.
195         (Target_x86_64<size>::Relocate::relocate): Likewise.
196         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
197         Likewise.
198
199 2015-10-22  H.J. Lu  <hongjiu.lu@intel.com>
200
201         * i386.cc (Target_i386::Scan::get_reference_flags(): Treat
202         R_386_GOT32X the same as R_386_GOT32.
203         (Target_i386::Scan::local): Likewise.
204         (Target_i386::Scan::possible_function_pointer_reloc): Likewise.
205         (Target_i386::Scan::global): Likewise.
206         (Target_i386::Relocate::relocate): Likewise.
207         (Target_i386::Relocatable_size_for_reloc::get_size_for_reloc):
208         Likewise.
209
210 2015-10-20  H.J. Lu  <hongjiu.lu@intel.com>
211
212         * testsuite/Makefile.am (x86_64_mov_to_lea11): Replace
213         x86_64_mov_to_lea1.o with x86_64_mov_to_lea2.o.
214         (x86_64_mov_to_lea12): Replace x86_64_mov_to_lea2.o with
215         x86_64_mov_to_lea1.o.
216         * testsuite/Makefile.in: Regenerated.
217
218 2015-10-16  H.J. Lu  <hongjiu.lu@intel.com>
219
220         PR gold/19119
221         * options.h (General_options): Remove "obsolete" from -m.
222         * parameters.cc (set_parameters_target): Check if input target
223         is compatible with output emulation set by "-m emulation".
224
225 2015-10-13  H.J. Lu  <hongjiu.lu@intel.com>
226
227         PR gold/19118
228         * i386.cc (Target_iamcu): New class.
229         (Target_selector_iamcu): Likewise.
230         (Target_iamcu::iamcu_info): New variable.
231         (target_selector_iamcu): Likewise.
232
233 2015-10-07  Andreas Schwab  <schwab@suse.de>
234
235         * aarch64.cc (aarch64_info): Set abi_pagesize to 64K.
236
237 2015-10-06  Cary Coutant  <ccoutant@gmail.com>
238
239         PR gold/18855
240         * sparc.cc (Sparc_relocate_functions::gdop_hix22): Remove addend
241         parameter.
242         (Sparc_relocate_functions::gdop_lox10): Likewise.
243         (Target_sparc::Relocate::relocate): Use addend when computing
244         symbol value for R_SPARC_GOTDATA_OP*.
245
246 2015-09-07  Cary Coutant  <ccoutant@gmail.com>
247
248         PR gold/18930
249         PR gold/18886
250         * resolve.cc (Symbol::override_base): Don't convert IFUNC symbols here.
251         * symtab.cc (Symbol_table::add_from_dynobj): Convert them here instead.
252
253 2015-09-02  H.J. Lu  <hongjiu.lu@intel.com>
254
255         PR gold/18886
256         * resolve.cc (Symbol::override_base): Turn IFUNC symbols from
257         shared libraries into normal FUNC symbols.
258         * symtab.cc (Symbol_table::sized_write_symbol): Assert IFUNC
259         symbols aren't from shared libraries.
260
261 2015-09-02  Alan Modra  <amodra@gmail.com>
262
263         PR 18878
264         * powerpc.cc (Target_powerpc): Add savres_section_ and accessor.
265         (Target_powerpc::Branch_info::make_stub): Determine whether long
266         branch stub is for save/restore function.
267         (Branch_stub_ent): Add save_res_, and extra parm to constructor.
268         (Stub_table): Add need_save_res_.
269         (Stub_table:clear_stubs): Clear need_save_res_.
270         (Stub_table:set_address_and_size): Add save/restore section size.
271         (Stub_table::add_long_branch_entry): Add save_res param.  Set
272         need_save_res_, but don't add space for save/restore stubs.
273         (Stub_table::find_long_branch_entry): Return offset to local copy
274         of save/restore func.
275         (Stub_table::do_write): Don't output save/restore stubs.  Instead
276         copy the save/restore functions.
277         (Output_data_save_res:contents): New accessor.
278         (Target_powerpc::define_save_restore_funcs): Set savres_section_.
279
280 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
281
282         PR gold/18847
283         * script-sections.cc (Memory_region::set_address): New method.
284         (Script_sections::find_memory_region): Add explicit_only parameter.
285         (Output_section_definition::set_section_addresses): Handle case where
286         script specifies both address and vma region.
287         * script-sections.h (Script_sections::find_memory_region): Add
288         explicit_only parameter.
289
290 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
291
292         PR gold/18859
293         * object.cc (Input_objects::add_object): Store objects in a map,
294         indexed by soname; update as-needed flag when necessary.
295         * object.h (Object::clear_as_needed): New method.
296         (Input_objects::so_names_): Change from set to map.
297
298 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
299
300         PR gold/14746
301         * expression.cc (Expression::Expression_eval_info): Add
302         is_valid_pointer field.
303         (Expression::eval_maybe_dot): Add is_valid_pointer parameter.
304         Adjust all callers.
305         (Addr_expression::value_from_output_section): Check whether address
306         is valid.
307         * script.cc (Symbol_assignment::set_if_absolute): Defer assignment
308         if evaluation failed due to address that is not yet valid.
309         * script.h: (Expression::eval_maybe_dot): Add is_valid_pointer
310         parameter.
311
312 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
313
314         PR gold/18866
315         PR gold/18703
316         * symtab.cc (Symbol_table): Reorder conditions to avoid internal error.
317
318 2015-08-20  Alan Modra  <amodra@gmail.com>
319
320         PR gold/18846
321         * target-reloc.h (relocate_relocs <RELOC_ADJUST_FOR_SECTION_RELA>):
322         Subtract os->address() from addend.
323         * powerpc.cc (relocate_relocs): Likewise.
324
325 2015-08-12  Simon Dardis  <simon.dardis@imgtec.com>
326
327         * mips.cc (plt0_entry_o32, plt0_entry_n32, plt0_entry_n64,
328         lazy_stub_normal_1, lazy_stub_normal_1_n64,
329         lazy_stub_normal_2, lazy_stub_normal_2_n64, lazy_stub_big,
330         lazy_stub_big_n64, lazy_stub_micromips32_normal_1_n64,
331         lazy_stub_micromips32_normal_2_n64, lazy_stub_micromips32_big,
332         lazy_stub_micromips32_big_n64): Update to use 'or' for move instead
333         of 'addu/daddu'.
334
335 2015-07-27  H.J. Lu  <hongjiu.lu@intel.com>
336
337         * configure: Regenerated.
338
339 2015-07-26  Doug Kwan  <dougkwan@google.com>
340
341         * testsuite/arm_unaligned_reloc.{s,sh}: Make test less sensitive to
342           disassembler output format.
343
344 2015-07-23  Ian Coolidge  <icoolidge@google.com>
345         Plumb --pic-veneer option for gold.
346
347         * arm.cc (Reloc_stub::stub_type_for_reloc): Plumb to stub
348         generation.
349         * options.h (General_options): Add --pic-veneer option.
350
351 2015-07-22  H.J. Lu  <hongjiu.lu@intel.com>
352
353         PR gold/18663
354         * testsuite/Makefile.am (script_test_1_SOURCES): Set to
355         script_test_1a.cc script_test_1b.cc.
356         (script_test_11_r.o): Replace script_test_11.o with
357         script_test_11a.o script_test_11b.o.
358         (script_test_11.o): Removed.
359         (script_test_11a.o): New.
360         (script_test_11b.o): Likewise.
361         * testsuite/Makefile.in: Regenerated.
362         * testsuite/script_test_1.h: New file.
363         * testsuite/script_test_1b.cc: Likewise.
364         * testsuite/script_test_11.h: Likewise.
365         * testsuite/script_test_11b.c: Likewise.
366         * testsuite/script_test_1.cc: Renamed to ...
367         * testsuite/script_test_1a.cc: This.
368         Include "script_test_1.h".
369         (main): Call check_int and check_ptr.
370         * testsuite/script_test_11.c: Renamed to ...
371         * testsuite/script_test_11a.c: This.
372         Include "script_test_11.h".
373         (main): Call ptr_equal.
374
375 2015-07-22  H.J. Lu  <hongjiu.lu@intel.com>
376
377         PR gold/18628
378         * testsuite/ifuncdep2.c (global): Change protected to hidden.
379         * testsuite/ifuncmod1.c (global): Likewise.
380         * testsuite/ifuncmod5.c (global): Likewise.
381
382 2015-07-22  Alan Modra  <amodra@gmail.com>
383
384         * aarch64.cc (try_fix_erratum_843419_optimized): Warning fix.
385
386 2015-07-21  Cary Coutant  <ccoutant@gmail.com>
387
388         PR gold/18548
389         * symtab.cc (Symbol_table::do_define_in_output_data): Check for
390         forced local symbol even when oldsym != NULL.
391         (Symbol_table::do_define_in_output_segment): Likewise.
392         (Symbol_table::do_define_as_constant): Likewise.
393
394 2015-07-21  Cary Coutant  <ccoutant@gmail.com>
395
396         PR gold/18698
397         * archive.cc (Library_base::should_include_member): Don't use entry
398         point for relocatable links, or if target is not yet valid.
399         * parameters.cc (Parameters::entry): Check target_valid().
400
401 2015-07-20  Han Shen  <shenhan@google.com>
402
403         Optimize erratum 843419 fix.
404
405         * aarch64.cc (AArch64_insn_utilities::is_adr): New method.
406         (AArch64_insn_utilities::aarch64_adr_encode_imm): New method.
407         (AArch64_insn_utilities::aarch64_adrp_decode_imm): New method.
408         (E843419_stub): New sub-class of Erratum_stub.
409         (AArch64_relobj::try_fix_erratum_843419_optimized): New method.
410         (AArch64_relobj::section_needs_reloc_stub_scanning): Try optimized fix.
411         (AArch64_relobj::create_erratum_stub): Add 1 argument.
412         (Target_aarch64::scan_erratum_843419_span): Pass in adrp insn offset.
413
414 2015-07-20  Han Shen  <shenhan@google.com>
415
416         Fix arm elf header flags wrt hardfp bit.
417
418         * arm.cc (Target_arm::do_adjust_elf_header): Set flags into view.
419
420 2015-07-20  H.J. Lu  <hongjiu.lu@intel.com>
421
422         PR gold/18689
423         * layout.cc (Layout::layout): Clear the SHF_COMPRESSED flag bit
424         from input group section for relocatable link.
425         * testsuite/Makefile.am (check_SCRIPTS): Add pr18689.sh.
426         (check_DATA): Add pr18689.stdout.
427         (MOSTLYCLEANFILES): Add pr18689a.o pr18689b.o.
428         (pr18689.stdout): New rule.
429         (pr18689a.o): Likewise.
430         (pr18689b.o): Likewise.
431         (pr18689.o): Likewise.
432         * testsuite/pr18689.c: New file.
433         * testsuite/pr18689.sh: Likewise.
434         * testsuite/Makefile.in: Regenerated.
435
436 2015-07-20  Yiran Wang  <yiran@google.com>
437         Cary Coutant  <ccoutant@gmail.com>
438
439         PR gold/15574
440         * resolve.cc (Symbol_table): Remove warning about references
441         from shared objects to hidden symbols.
442         * testsuite/Makefile.am (hidden_test): Add hidden_test.syms.
443         * testsuite/Makefile.in: Regenerate.
444         * testsuite/hidden_test.sh: Check dynamic symbol table; update
445         expected error messages.
446
447 2015-07-14  H.J. Lu  <hongjiu.lu@intel.com>
448
449         * compressed_output.cc (Output_compressed_section::set_final_data_size):
450         Make --compress-debug-sections=zlib the same as
451         --compress-debug-sections=zlib-gabi.
452         * testsuite/Makefile.am (flagstest_compress_debug_sections.check):
453         Expect ".debug_.*" with the SHF_COMPRESSED bit, instead of
454         ".zdebug_".
455         * testsuite/Makefile.in: Regenerated.
456
457 2015-07-12  H.J. Lu  <hongjiu.lu@intel.com>
458
459         PR gold/18322
460         * compressed_output.cc (zlib_compress): Add argument for
461         compression header size.  Set header size to compression header
462         size if it isn't 0.  Don't write out the zlib header here.
463         (Output_compressed_section::set_final_data_size): Support
464         zlib-gnu and zlib-gabi compressions.  Pass compression header
465         size to zlib_compress and write out compression header.  Set
466         the SHF_COMPRESSED bit for zlib-gabi compression.  Otherwise
467         clear the SHF_COMPRESSED bit
468         * options.h (compress_debug_sections): Add zlib-gnu and
469         zlib-gabi.
470         * output.h (Output_section::set_flags): New.
471         * testsuite/Makefile.am (check_PROGRAMS): Add
472         flagstest_compress_debug_sections_none,
473         flagstest_compress_debug_sections_gnu and
474         flagstest_compress_debug_sections_gabi.
475         (check_DATA): Add flagstest_compress_debug_sections_none.stdout.
476         flagstest_compress_debug_sections.stdout,
477         flagstest_compress_debug_sections.cmp,
478         flagstest_compress_debug_sections.check,
479         flagstest_compress_debug_sections_gnu.stdout,
480         flagstest_compress_debug_sections_gnu.cmp,
481         flagstest_compress_debug_sections_gnu.check,
482         flagstest_compress_debug_sections_gabi.stdout,
483         flagstest_compress_debug_sections_gabi.cmp and
484         flagstest_compress_debug_sections_gabi.check.
485         (flagstest_compress_debug_sections_none): New.
486         (flagstest_compress_debug_sections_none.stdout): Likewise.
487         (flagstest_compress_debug_sections.stdout): Likewise.
488         (flagstest_compress_debug_sections.check): Likewise.
489         (flagstest_compress_debug_sections.cmp): Likewise.
490         (flagstest_compress_debug_sections_gnu): Likewise.
491         (flagstest_compress_debug_sections_gnu.stdout): Likewise.
492         (flagstest_compress_debug_sections_gnu.check): Likewise.
493         (flagstest_compress_debug_sections_gnu.cmp): Likewise.
494         (flagstest_compress_debug_sections_gabi): Likewise.
495         (flagstest_compress_debug_sections_gabi.stdout): Likewise.
496         (flagstest_compress_debug_sections_gnu.check): Likewise.
497         (flagstest_compress_debug_sections_gnu.cmp): Likewise.
498         * testsuite/Makefile.in: Regenerated.
499
500 2015-07-12  H.J. Lu  <hongjiu.lu@intel.com>
501
502         PR gold/18321
503         * compressed_output.h (decompress_input_section): Add arguments
504         for ELF class, big endian and sh_flags.
505         * compressed_output.cc (decompress_input_section): Likewise.
506         Support the SHF_COMPRESSED section.
507         * dynobj.h (Dynobj): Add elfsize and is_big_endian member
508         functions.
509         * plugin.h (Pluginobj): Likewise.
510         * layout.cc (Layout::get_output_section_flags): Also clear the
511         SHF_COMPRESSED bit.
512         * object.h (Compressed_section_info): Add flag to store sh_flags.
513         (Object): Add pure virtual elfsize and is_big_endian member
514         functions.
515         * object.cc (need_decompressed_section): Don't skip the ".zdebug"
516         prefix here.
517         (build_compressed_section_map): Check SHF_COMPRESSED for
518         uncompressed size.  Store sh_flags in Compressed_section_info.
519         Pass size, big_endian and sh_flags to decompress_input_section.
520         Skip the ".debug"/".zdebug" prefix when passing section name to
521         need_decompressed_section.
522         (Sized_relobj_file<size, big_endian>::do_find_special_section):
523         Don't check ".zdebug_*" sections.
524         (Object::decompressed_section_contents): Pass ELF class, big
525         endian and sh_flags to decompress_input_section.
526         * reloc.cc (Sized_relobj_file<size, big_endian>::write_sections):
527         Likewise.
528         * testsuite/Makefile.am (check_DATA): Add
529         debug_msg_cdebug_gabi.err and gdb_index_test_2_gabi.stdout.
530         (MOSTLYCLEANFILES): Add debug_msg_cdebug_gabi.err and
531         gdb_index_test_2_gabi.stdout.
532         (debug_msg_cdebug_gabi.o): New.
533         (odr_violation1_cdebug_gabi.o): Likewise.
534         (odr_violation2_cdebug_gabi.o): Likewise.
535         (debug_msg_cdebug_gabi.err): Likewise.
536         (check_SCRIPTS): Add gdb_index_test_2_gabi.sh.
537         (gdb_index_test_cdebug_gabi.o): Likewise.
538         (gdb_index_test_2_gabi): Likewise.
539         (gdb_index_test_2_gabi.stdout): Likewise.
540         * testsuite/gdb_index_test_2_gabi.sh: New file.
541         * testsuite/Makefile.in: Regenerated.
542
543 2015-07-09  Han Shen  <shenhan@google.com>
544
545         Use "gold_info" instead of "gold_warning" for erratum fix.
546
547         * aarch64.cc (Target_aarch64::scan_erratum_843419_span): Use
548         'gold_info'.
549         (Target_aarch64::scan_erratum_835769_span): USe 'gold_info'.
550
551 2015-07-09  Han Shen  <shenhan@google.com>
552
553         Drop missing symbol warning for arm/aarch64.
554
555         * aarch64.cc (AArch64_relobj::scan_errata): Drop missing symbol warning.
556         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Drop missing
557         symbol warning.
558
559 2015-07-07  Han Shen  <shenhan@google.com>
560
561         Make gold aarch64 accept long form of mapping symbols.
562
563         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Make legal
564         of mapping symbols.
565
566 2015-06-29  Doug Kwan  <dougkwan@google.com>
567
568         * testsuite/arm_bl_out_of_range.s: Align stub table so that it appears
569           at address expected by test.
570         * testsuite/arm_cortex_a8_b.s: Ditto.
571         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
572         * testsuite/arm_cortex_a8_bl.s: Ditto.
573         * testsuite/arm_cortex_a8_blx.s: Ditto.
574         * testsuite/arm_cortex_a8_local.s: Ditto.
575         * testsuite/arm_fix_v4bx.s: Ditto.
576         * testsuite/arm_unaligned_reloc.s: Ditto.
577         * testsuite/thumb_bl_out_of_range.s: Ditto.
578         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
579         * testsuite/thumb_blx_out_of_range.s: Ditto.
580
581 2015-06-29  Han Shen  <shenhan@google.com>
582
583         Patch for erratum 843419 internal error.
584
585         * aarch64.cc (Erratum_stub::Insn_utilities): New typedef.
586         (Erratum_stub::update_erratum_insn): New method.
587         (Stub_table::relocate_stubs): Modified to place relocated insn.
588         (AArch64_relobj::fix_errata): Modified gold_assert.
589
590 2015-06-12  Han Shen  <shenhan@google.com>
591
592         Fix erratum 835769.
593
594         * aarch64.cc (AArch64_insn_utilities::BYTES_PER_INSN): Move
595         defintion outside class definition.
596         (AArch64_insn_utilities::AARCH64_ZR): New static constant.
597         (AArch64_insn_utilities::aarch64_op31): New member.
598         (AArch64_insn_utilities::aarch64_ra): New member.
599         (AArch64_insn_utilities::aarch64_mac): New member.
600         (AArch64_insn_utilities::aarch64_mlxl): New member.
601         (ST_E_835769): New global enum member.
602         (Stub_table::relocate_stubs): Add 835769 handler.
603         (Stub_template_repertoire::Stub_template_repertoire): Install new
604         stub type.
605         (AArch64_relobj::scan_errata): This func is renamed from
606         scan_erratum_843419.
607         (AArch64_relobj::do_count_local_symbols): Add 835769 handler.
608         (AArch64_relobj::do_relocate_sections): Add 835769 handler.
609         (AArch64_relobj::scan_sections_for_stubs): Add 835769 handler.
610         (Target_aarch64::scan_erratum_835769_span): New method.
611         (Target_aarch64::create_erratum_stub): New method.
612         (Target_aarch64::is_erratum_835769_sequence): New method.
613         (Target_aarch64::scan_erratum_843419_sequence): Move part of the
614         code into create_erratum_stub.
615         * options.h (fix_cortex_a53_835769): New option.
616
617 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
618
619         * aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
620         outside class body.
621         (Reloc_stub::STUB_ADDR_ALIGN): Likewise.
622
623 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
624
625         PR gold/17731
626         * layout.cc (corresponding_uncompressed_section_name): New function.
627         (Layout::choose_output_section): Call it.
628         * layout.h (corresponding_uncompressed_section_name): New function.
629         * script-sections.cc (Input_section_info::set_section_name): Check
630         for compressed debug section (.zdebug style).
631
632 2015-06-11  Jing Yu  <jingyu@google.com>
633
634         * testsuite/Makefile.am: Add -O0 for script_test_12 test.
635         * testsuite/Makefile.in: Regenerate.
636
637 2015-06-11  Davide Italiano  <dccitaliano@gmail.com>
638
639         * gold.h (is_cident): Correct typo.
640
641 2015-06-10  Han Shen  <shenhan@google.com>
642         Patch for erratum-843419 (2 of 2 - fix erratum occurrences).
643
644         Now fixing for 843419 is fully functional.
645
646         The first part of the erratum fix CL is here -
647         https://sourceware.org/ml/binutils/2015-04/msg00229.html
648
649         * aarch64.cc(global enum): New constants representing stub types.
650         (Stub_template): New POD struct.
651         (Stub_template_repertoire): New class.
652         (Stub_base): New class.
653         (Erratum_stub): New class.
654         (Reloc_stub): Refactored to be a subclass of Stub_base.
655         (Reloc_stub::Stub_type): Removed.
656         (Reloc_stub::offset): Moved to Stub_base.
657         (Reloc_stub::set_offset): Moved to Stub_base.
658         (Reloc_stub::destination_address): Moved to Stub_base.
659         (Reloc_stub::set_destination_address): Moved to Stub_base.
660         (Reloc_stub::reset_destination_address): Moved to Stub_base.
661         (Reloc_stub::stub_type): Renamed and moved to Stub_base.
662         (Reloc_stub::stub_size): Renamed and moved to Stub_base.
663         (Reloc_stub::stub_insns): Renamed and moved to Stub_base.
664         (Reloc_stub::write): Moved to Stub_base.
665         (Reloc_stub::invalid_offset): Moved to Stub_base.
666         (Reloc_stub::invalid_address): Moved to Stub_base.
667         (Reloc_stub::stub_type_): Renamed and moved to Stub_base.
668         (Reloc_stub::stub_insns_): Moved to Stub_base.
669         (Reloc_stub::offset_): Moved to Stub_base.
670         (Reloc_stub::destination_address_): Moved to Stub_base.
671         (Stub_table::The_aarch64_relobj): New typedef.
672         (Stub_table::The_erratum_stub): New typedef.
673         (Stub_table::The_erratum_stub_less): New typedef.
674         (Stub_table::The_erratum_stub_set): New typedef.
675         (Stub_table::The_erratum_stub_set_iter): New typedef.
676         (Stub_table::empty): Added emptiness testing for erratum stubs.
677         (Stub_table::add_erratum_stub): New method to add an erratum stub.
678         (Stub_table::find_erratum_stub): New method.
679         (Stub_table::find_erratum_stubs_for_input_section): New method.
680         (Stub_table::erratum_stub_address): New method.
681         (Stub_table::update_date_size_changed_p): Modified to handle erratum stubs.
682         (Stub_table::do_addralign): Modified to handle erratum stubs.
683         (Stub_table::erratum_stubs_): New member.
684         (Stub_table::erratum_stub_size_): New member.
685         (Stub_table::relocate_stubs): Modified to handle erratum stubs.
686         (Stub_table::do_write): Modified to handle erratum stubs.
687         (AArch64_relobj::The_erratum_stub): New typedef.
688         (AArch64_relobj::Erratum_stub_set_iter): New typedef.
689         (AArch64_relobj::fix_errata): New method.
690         (Target_aarch64::The_reloc_stub_type): Removed.
691         (Target_aarch64::The_erratum_stub): New typede.
692         (AArch64_relocate_functions::construct_b): New method.
693
694 2015-06-08  Nick Clifton  <nickc@redhat.com>
695
696         * po/fr.po: New French Translation.
697
698 2015-06-07  Cary Coutant  <ccoutant@gmail.com>
699
700         PR gold/18288
701         * resolve.cc (symbol_to_bits): Remove type parameter; adjust all
702         callers. Don't use STT_COMMON to check for common symbols.
703         (Symbol_table::resolve): Warn if relocatable object has STT_COMMON
704         symbol that's not in a common section.
705         * symtab.h (Symbol::is_common): Don't use STT_COMMON to check for
706         common symbols.
707
708 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
709
710         PR gold/18200
711         * Makefile.am (diststuff): Add target.
712         * Makefile.in: Regenerate.
713
714 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
715
716         PR gold/17498
717         * object.cc (Sized_relobj_file::do_count_local_symbols): Discard
718         temporary locals in merge sections.
719         * options.cc (General_options::parse_discard_all): New method.
720         (General_options::parse_discard_locals): New method.
721         (General_options::parse_discard_none): New method.
722         (General_options::General_options): Initialize discard_locals_.
723         * options.h (--discard-all): Convert to special option.
724         (--discard-locals): Likewise.
725         (--discard-none): New option.
726         (General_options::discard_all): New method.
727         (General_options::discard_locals): New method.
728         (General_options::discard_sec_merge): New method.
729         (General_options::Discard_locals): New enum.
730         (General_options::discard_locals_): New data member.
731
732 2015-06-03  Cary Coutant  <cary@google.com>
733
734         * script-sections.cc (Script_sections::Script_sections): Initialize
735         segments_created_.
736         (Script_sections::create_note_and_tls_segments): Set flag when
737         segments are created.
738         (Script_sections::expected_segment_count): Count PT_INTERP.
739         (Script_sections::attach_sections_using_phdrs_clause): Set flag when
740         segments are created.
741         * script-sections.h (Script_sections::segments_created_): New data
742         member.
743
744 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
745
746         PR gold/15370
747         * script-sections.cc
748         (Output_section_element_input::set_section_addresses): When there
749         are several patterns with no sort spec, put all sections in the same
750         bin.
751         * testsuite/Makefile.am (script_test_12): New testcase.
752         (script_test_12i): New testcase.
753         * testsuite/Makefile.in: Regenerate.
754         * testsuite/script_test_12.t: New test linker script.
755         * testsuite/script_test_12i.t: New test linker script.
756         * testsuite/script_test_12a.c: New test source file.
757         * testsuite/script_test_12b.c: New test source file.
758
759 2015-06-02  Cary Coutant  <ccoutant@gmail.com>
760
761         * nacl.h (Sniff_file): Switch parameters to get_view to get an
762         aligned view.
763
764 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
765
766         PR gold/17819
767         * gold.cc (queue_final_tasks): When --build-id=tree, queue a
768         separate task to schedule the build id computation.
769         * layout.cc (Hash_task::Hash_task): Remove build_id_blocker,
770         add Output_file and offset.
771         (Hash_task::run): Get and release the input views.
772         (Hash_task::is_runnable): Always return NULL (always runnable).
773         (Layout::queue_build_id_tasks): Remove.
774         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
775         parameters; use them instead of class members.
776         (Build_id_task_runner::run): New function.
777         (Close_task_runner::run): Pass array_of_hashes and size_of_hashes
778         to write_build_id.
779         * layout.h (Layout::queue_build_id_tasks): Remove.
780         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
781         parameters.
782         (Layout::array_of_hashes_): Remove.
783         (Layout::size_of_array_of_hashes_): Remove.
784         (Layout::input_view_): Remove.
785         (Build_id_task_runner): New class.
786         (Close_task_runner::Close_task_runner): Add array_of_hashes and
787         size_of_hashes parameters.
788         (Close_task_runner::array_of_hashes_): New data member.
789         (Close_task_runner::size_of_hashes_): New data member.
790         * testsuite/Makefile.am
791         (flagstest_compress_debug_sections_and_build_id_tree): New test.
792         * testsuite/Makefile.in: Regenerate.
793
794 2015-06-01  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
795
796         * merge.cc (get_input_merge_map): Update for data structure change.
797         (get_or_make_input_merge_map): Update for data structure change.
798         * merge.h (Object_merge_map): Use a std::vector<std::pair>> instead of
799         a std::map. Remove first_shnum_, first_map_, second_shnum_, second_map_.
800
801 2015-05-16  Alan Modra  <amodra@gmail.com>
802
803         * reloc.cc (Sized_relobj_file::find_functions): Use function_location.
804         * powerpc.cc (Target_powerpc::do_calls_non_split): New function.
805         (addi_12_1, addis_2_12, addis_12_1, cmpld_7_12_0): New constants.
806         (lis_0): Rename from lis_0_0.
807
808 2015-04-29  Cary Coutant  <cary@google.com>
809             Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
810
811         * gc.h (Garbage_collection::is_section_garbage): Change Object*
812         to Relobj*.
813         (Garbage_collection::add_reference): Likewise.
814         (Garbage_collection::gc_process_relocs): Likewise. Don't push
815         object/shndx pair onto *secvec for dynamic objects. Don't follow
816         relocations pointing to dynamic objects for GC.
817         * icf.cc (Icf::find_identical_sections): Change Object* to Relobj*.
818         (Icf::unfold_section): Likewise.
819         (Icf::is_section_folded): Likewise.
820         (Icf::get_folded_section): Likewise.
821         * icf.h: (Icf::get_folded_section): Likewise.
822         (Icf::unfold_section): Likewise.
823         (Icf::is_section_folded): Likewise.
824         (Icf::section_has_function_pointers): Likewise.
825         (Icf::set_section_has_function_pointers): Likewise.
826         * object.h (Section_id): Likewise.
827         (Const_section_id): Likewise.
828         * output.cc (Output_section::update_section_layout): Likewise.
829         * output.h: (Output_section_lookup_maps::find_relaxed_input_section):
830         Likewise.
831         * plugin.cc (update_section_order): Likewise.
832         (unique_segment_for_sections): Likewise.
833         * powerpc.cc (Powerpc_relobj::add_reference): Likewise.
834         (Target_powerpc::do_gc_add_reference): Likewise.
835         (Target_powerpc::gc_process_relocs): Likewise.
836         (Target_powerpc::do_gc_add_reference): Likewise.
837         * symtab.cc (Symbol_table::is_section_folded): Likewise.
838         (Symbol_table::gc_mark_symbol): Likewise.
839         * symtab.h: (Symbol_table::is_section_folded): Likewise.
840         * target.h: (Sized_target::gc_add_reference): Likewise.
841         (Sized_target::do_gc_add_reference): Likewise.
842
843 2015-04-29  Nick Clifton  <nickc@redhat.com>
844
845         * po/fi.po: Updated Finnish translation.
846
847 2015-04-28  Alan Modra  <amodra@gmail.com>
848
849         * powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather
850         than unsigned int for find_global_entry result temp.  Compare
851         against invalid_address.
852         (Target_powerpc::do_plt_address_for_global): Likewise.
853         (Target_powerpc::Relocate::relocate): Likewise.  Don't assert
854         on plt call stub existence for debug info.  Do assert for plt
855         and global entry stub existence if an alloc section.
856
857 2015-04-28  Alan Modra  <amodra@gmail.com>
858
859         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert
860         on missing global entry stub due to bogus debug info.
861
862 2015-04-27  Han Shen  <shenhan@google.com>
863
864         * options.h (--fix-cortex-a53-843419): Rename option.
865         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Use renamed
866         option.
867         (AArch64_relobj::scan_sections_for_stubs): Use renamed option.
868
869 2015-04-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
870
871         PR gold/18327
872         * output.cc (Output_section::is_input_address_mapped): Assume a missing
873         entry is mapped.
874         * testsuite/Makefile.am: Add the eh_test test.
875         * testsuite/Makefile.in: Regenerate.
876         * testsuite/eh_test_a.cc: New test.
877         * testsuite/eh_test_b.cc: New test.
878
879 2015-04-23  Sriraman Tallam  <tmsriram@google.com>
880
881         * options.h (--weak-unresolved-symbols): New option.
882         * symtab.cc (Symbol_table::sized_write_globals): Change symbol
883         binding to weak with new option.
884         * symtab.h (is_weak_undefined): Check for new option.
885         (is_strong_undefined): Check for new option.
886         * testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
887         * testsuite/Makefile.in: Regenerate.
888         * testsuite/weak_unresolved_symbols_test.cc: New file.
889
890 2015-04-20  Ian Coolidge  <icoolidge@google.com>
891
892         * symtab.cc (Symbol::should_add_dynsym_entry): Return true for
893         GNU_UNIQUE.
894
895 2015-04-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
896
897         * gc.cc (Garbage_collection::do_transitive_closure): Use back and
898         push_back.
899         * gc.h (Garbage_collection): Use a std::vector instead of a std::queue.
900         * object.cc (Sized_relobj_file::do_layout): Use push_back.
901         * powerpc.cc (process_gc_mark): Use push_back.
902         (Target_powerpc::do_gc_mark_symbol): Use push_back.
903         * symtab.cc (Symbol_table::gc_mark_symbol): Use push_back.
904
905 2015-04-16  Han Shen  <shenhan@google.com>
906
907         * aarch64.cc (AArch64_insn_utilities): New utility class.
908         (AArch64_relobj::Mapping_symbol_position): New struct.
909         (AArch64_relobj::Mapping_symbol_info): New typedef.
910         (AArch64_relobj::do_count_local_symbols): New function overriding
911         parent's implementation.
912         (AArch64_relobj::mapping_symbol_info_): New member
913         (AArch64_relobj::scan_erratum_843419): New method.
914         (Target_aarch64::scan_erratum_843419_span): New method.
915         (Target_aarch64::is_erratum_843419_sequence): New method.
916         * options.h (fix_cortex_a53): New option.
917
918 2015-04-09  Cary Coutant  <ccoutant@google.com>
919
920         * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
921         in a PIE link.
922         * testsuite/Makefile.am (tls_pie_test.sh): New test.
923         * testsuite/Makefile.in: Regenerate.
924         * testsuite/tls_pie_test.sh: New.
925
926 2015-04-09  Cary Coutant  <ccoutant@google.com>
927
928         * debug.h (DEBUG_LOCATION): New.
929         (DEBUG_ALL): Include DEBUG_LOCATION.
930         (debug_string_to_enum): Add DEBUG_LOCATION.
931         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
932         output to print correct context.
933         (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
934         up to 4 more locations at the beginning of the function.
935         * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
936         result before sorting list of line numbers.
937         * testsuite/debug_msg.sh: Allow range of line numbers for
938         canonical results on optimized code.
939
940 2015-04-07  HC Yen <hc.yen@mediatek.com>
941
942         Add AArch32 support for gold linker.
943         gold/
944         * arm.cc: Add V8 arch combine table.
945
946 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
947
948         * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
949
950 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
951
952         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
953         to find by using the return value of insert.
954
955 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
956
957         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
958         constructor call.
959
960 2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>
961
962         PR gold/17641
963         * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
964         (Target_x86_64::Scan::local): Don't create GOT entry, when we
965         can convert mov to lea.
966         (Target_x86_64::Scan::global): Ditto.
967         (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
968         %reg to lea foo(%rip), %reg if possible.
969         * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
970         * testsuite/x86_64_mov_to_lea1.s: New.
971         * testsuite/x86_64_mov_to_lea2.s: Ditto.
972         * testsuite/x86_64_mov_to_lea3.s: Ditto.
973         * testsuite/x86_64_mov_to_lea4.s: Ditto.
974         * testsuite/x86_64_mov_to_lea.sh: Ditto.
975
976 2015-04-02  H.J. Lu  <hongjiu.lu@intel.com>
977
978         * configure: Regenerated.
979
980 2015-04-01  Ilya Tocar  <ilya.tocar@intel.com>
981
982         PR gold/17640
983         * i386.cc (Target_i386::can_convert_mov_to_lea): New.
984         (Target_i386::Scan::local): Don't create GOT entry, when we
985         can convert GOT to GOTOFF.
986         (Target_i386::Scan::global): Ditto.
987         (Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
988         lea foo@GOTOFF(%reg), %reg if possible.
989         * testsuite/Makefile.am (i386_mov_to_lea): New test.
990         * testsuite/i386_mov_to_lea1.s: New.
991         * testsuite/i386_mov_to_lea2.s: Ditto.
992         * testsuite/i386_mov_to_lea3.s: Ditto.
993         * testsuite/i386_mov_to_lea4.s: Ditto.
994         * testsuite/i386_mov_to_lea5.s: Ditto.
995         * testsuite/i386_mov_to_lea.sh: Ditto.
996
997 2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>
998
999         * Makefile.am (ZLIB): New.
1000         (ZLIBINC): Likewise.
1001         (AM_CFLAGS): Add $(ZLIBINC).
1002         (AM_CXXFLAGS): Likewise.
1003         (ldadd_varldadd_var): Add $(ZLIB).
1004         (incremental_dump_LDADD): Likewise.
1005         (dwp_LDADD): Likewise.
1006         * compressed_output.cc: Don't check HAVE_ZLIB_H to include
1007         <zlib.h>.
1008         (zlib_compress): Don't check HAVE_ZLIB_H.
1009         (zlib_decompress): Likewise.
1010         * options.h (compress_debug_sections): Likewise.
1011         * configure.ac (AM_CONDITIONAL): Removed.
1012         * testsuite/Makefile.am (ZLIB): New.
1013         (LDADD): Add $(ZLIB).
1014         Don't check HAVE_ZLIB.
1015         * Makefile.in: Regenerated.
1016         * config.in: Likewise.
1017         * configure: Likewise.
1018         * testsuite/Makefile.in: Likewise.
1019
1020 2015-03-30  Jing Yu  <jingyu@google.com>
1021
1022         * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
1023         TLSLD_ADD_DTPREL_LO12_NC.
1024         * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
1025         _TLS_MODULE_BASE_ point to the start of tls segment.
1026         (Target_aarch64::optimize_tls_reloc): Add cases for
1027         R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
1028         R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
1029         (Target_aarch64::Scan::local): Likewise.
1030         (Target_aarch64::Scan::global): Likewise.
1031         (Target_aarch64::Relocate::relocate): Likewise.
1032         (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
1033         subtracting tls segment size from symbol value for TLSLD_*_DTPREL
1034         relocations.
1035
1036 2015-03-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1037
1038         * merge.cc (Object_merge_map::add_mapping): call
1039         Object_merge_map::Input_merge_map::add_mapping.
1040         (Object_merge_map::Input_merge_map::add_mapping): New.
1041         (Output_merge_data::do_add_input_section): Call
1042         get_or_make_input_merge_map before a loop.
1043         (Output_merge_string<Char_type>::finalize_merged_data): Call
1044         get_or_make_input_merge_map before a loop.
1045         * merge.h (Object_merge_map): Make Input_merge_map public.
1046         * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
1047         (Relobj::get_or_create_merge_map): New.
1048         * object.h (Relobj::get_or_create_merge_map): New.
1049
1050 2015-03-24  Alan Modra  <amodra@gmail.com>
1051
1052         PR 18147
1053         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
1054         relocation errors for branches to strong undefined symbols.
1055
1056 2015-03-23  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1057
1058         * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
1059         (Object_merge_map::is_merge_section_for): Remove.
1060         (Object_merge_map::find_merge_section): New.
1061         * merge.h (Object_merge_map::is_merge_section_for): Remove.
1062         (Object_merge_map::find_merge_section): New.
1063         (Object_merge_map::get_input_merge_map): Add a const version.
1064         * object.cc (Relobj::is_merge_section_for): Remove.
1065         (Relobj::find_merge_section): New.
1066         * object.h (Relobj::is_merge_section_for): Remove.
1067         (Relobj::find_merge_section): New.
1068         * output.cc
1069         (Output_section::Input_section::is_merge_section_for): Remove.
1070         (Output_section::add_merge_input_section): Don't call
1071         add_merge_input_section.
1072         (Output_section::find_merge_section): Return const. Use
1073         object->find_merge_section.
1074         (Output_section::build_lookup_maps): Don't build a map for
1075         merge sections.
1076         (Output_section::is_input_address_mapped): Return false if
1077         section is not found.
1078         (Output_section::find_starting_output_address): Use
1079         find_merge_section instead of is_merge_section_for.
1080         (Output_section::add_script_input_section):  Don't build a map for
1081         merge sections.
1082         * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
1083         (Output_section_lookup_maps::find_merge_section): Remove.
1084         (Output_section_lookup_maps::add_merge_input_section) Remove.
1085         (Output_section::find_merge_section): Return const.
1086
1087 2015-03-22  Cary Coutant  <cary@google.com>
1088
1089         PR gold/18106
1090         * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
1091         non-SIB form of lea, with nop after the call.
1092
1093 2015-03-21  Cary Coutant  <cary@google.com>
1094
1095         PR gold/14217
1096         * output.cc (Output_segment::is_first_section_relro): Don't ignore
1097         .tdata section.
1098         (Output_segment::set_section_addresses): Don't align size of relro
1099         segment for .tbss.
1100
1101 2015-03-21  Cary Coutant  <cary@google.com>
1102
1103         PR gold/18010
1104         * stringpool.cc (Stringpool_template): Don't optimize if section
1105         alignment is greater than sizeof(char).
1106
1107 2015-03-21  Cary Coutant  <cary@google.com>
1108
1109         PR gold/18048
1110         * script-c.h (script_include_directive): Add first_token parameter.
1111         * script.cc (script_include_directive): Add first_token parameter, and
1112         pass it to read_script_file.
1113         * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
1114         (PARSING_MEMORY_DEF): New tokens.
1115         (top): Add new productions for INCLUDE files.
1116         (file_cmd): Replace file_or_sections_cmd with copy of its productions.
1117         Pass PARSING_LINKER_SCRIPT to script_include_directive.
1118         (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
1119         (section_cmd): Pass PARSING_SECTION_CMDS.
1120         (file_or_sections_cmd): Remove.
1121         (memory_def): Pass PARSING_MEMORY_DEF.
1122         * testsuite/Makefile.am (memory_test_2): New test.
1123         * testsuite/Makefile.in: Regenerate.
1124         * testsuite/memory_test_inc.t: New script file.
1125         * testsuite/memory_test_inc_1.t.src: New script file.
1126         * testsuite/memory_test_inc_2.t.src: New script file.
1127         * testsuite/memory_test_inc_3.t.src: New script file.
1128
1129 2015-03-21  Cary Coutant  <cary@google.com>
1130
1131         * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
1132         (Sized_relobj_dwo::setup): Build compressed section map.
1133         (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
1134         * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
1135         section map.
1136         * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
1137         compressed_sections_ field.
1138         (build_compressed_section_map): Take Object instead of
1139         Sized_relobj_file parameter; add decompress_if_needed parameter.
1140         (Sized_relobj_file::do_find_special_sections): Store compressed
1141         section map in parent Object.
1142         (Sized_relobj_file::do_decompressed_section_contents): Move
1143         implementation to Object::decompressed_section_contents.
1144         (Sized_relobj_file::do_discard_decompressed_sections): Move
1145         implementation to Object::discard_decompressed_sections.
1146         * object.h (build_compressed_section_map): Declare.
1147         (Object::Object): Add compressed_sections_ field.
1148         (Object::section_is_compressed): Move implementation here.
1149         (Object::decompressed_section_contents): De-virtualize.
1150         (Object::discard_decompressed_sections): De-virtualize.
1151         (Object::do_section_is_compressed): Delete.
1152         (Object::do_decompressed_section_contents): Delete.
1153         (Object::set_compressed_sections): New method.
1154         (Object::compressed_sections): New method.
1155         (Object::compressed_sections_): New data member.
1156         (Compressed_section_info, Compressed_section_map): Move to top of file.
1157         (Sized_relobj_file::do_section_is_compressed): Delete.
1158         (Sized_relobj_file::do_decompressed_section_contents): Delete.
1159         (Sized_relobj_file::do_discard_decompressed_sections): Delete.
1160         (Sized_relobj_file::compressed_sections_): Move to Object class.
1161
1162 2015-03-21  Cary Coutant  <ccoutant@google.com>
1163
1164         PR gold/18152
1165         * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
1166         deferred objects.
1167
1168 2015-03-11  Cary Coutant  <ccoutant@google.com>
1169
1170         * options.cc (General_options::finalize): Don't allow -z relro
1171         with incremental linking.
1172         * testsuite/Makefile.am (incremental_test): Add -z norelro.
1173         (incremental_test_2): Likewise.
1174         (incremental_test_3): Likewise.
1175         (incremental_test_4): Likewise.
1176         (incremental_test_5): Likewise.
1177         (incremental_test_6): Likewise.
1178         (incremental_copy_test): Likewise.
1179         (incremental_common_test_1): Likewise.
1180         (incremental_comdat_test_1): Likewise.
1181         * testsuite/Makefile.in: Regenerate.
1182
1183 2015-03-09  Cary Coutant  <ccoutant@google.com>
1184
1185         PR gold/14675
1186         * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
1187         return enum indicating whether .eh_frame section is empty, optimizable,
1188         unrecognized, or an end marker. Adjust explicit instantiations.
1189         * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
1190         (Eh_frame::add_ehframe_input_section): Change return type.
1191         * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
1192         * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
1193         to the .eh_frame output section until we see the end marker.
1194         (Layout::finalize_eh_frame_section): New.
1195         * layout.h: (Layout::finalize_eh_frame_section): New.
1196
1197 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
1198
1199         * output.cc (Relobj::initialize_input_to_output_map<size>):
1200         Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
1201
1202 2015-03-04  Cary Coutant  <ccoutant@google.com>
1203
1204         * parameters.cc (Parameters::set_target_once): Call
1205         Target::select_as_default_target just once from here...
1206         (set_parameters_target): ...instead of from here.
1207
1208 2015-03-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1209
1210         * ehframe.cc (Cie::set_output_offset): Pass in and use a
1211         Output_section_data instead of a Merge_map.
1212         (Eh_frame::Eh_frame): Don't initialize merge_map_.
1213         (Eh_frame::read_cie): Use add_merge_mapping instead of
1214         Merge_map::add_mapping.
1215         (Eh_frame::read_fde): Ditto.
1216         (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
1217         (Eh_frame::do_output_offset): Use merge_output_offset istead of
1218         merge_map_->get_output_offset.
1219         (Eh_frame::do_is_merge_section_for): Delete.
1220         * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
1221         instead of a Merge_map.
1222         (Cie::set_output_offset): Pass in a Output_section_data instead of a
1223         Merge_map.
1224         (Eh_frame::do_is_merge_section_for): Delete.
1225         (Eh_frame::merge_map_): Delete.
1226         * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
1227         and use a Output_section_data instead of a Merge_map.
1228         (Object_merge_map::add_mapping): Ditto.
1229         (Object_merge_map::get_output_offset): Remove the merge_map argument.
1230         (Object_merge_map::is_merge_section_for): Pass in and use a
1231         Output_section_data instead of a Merge_map.
1232         (Merge_map): Delete.
1233         (Output_merge_base::do_output_offset): Use merge_output_offset instead
1234         of merge_map_.get_output_offset.
1235         (Output_merge_base::do_is_merge_section_for): Delete.
1236         (Output_merge_data::do_add_input_section): Use
1237         object->add_merge_mapping instead of add_mapping.
1238         (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
1239         * merge.h (Merge_map): Delete forward declaration.
1240         (Object_merge_map::add_mapping): Pass in and use a Output_section_data
1241         instead of a Merge_map.
1242         (Object_merge_map::get_output_offset): Remove the merge_map argument.
1243         (Object_merge_map::is_merge_section_for): Pass in and use a
1244         Output_section_data instead of a Merge_map.
1245         (Input_merge_map::Object_merge_map::merge_map): Replace with
1246         output_data.
1247         (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
1248         Output_section_data instead of a Merge_map.
1249         (Merge_map): Delete.
1250         (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
1251         (Output_merge_base::do_is_merge_section_for): Delete.
1252         (Output_merge_base::add_mapping): Delete.
1253         (Output_merge_base::merge_map_): Delete.
1254         * object.cc (Relobj::initialize_input_to_output_map): New.
1255         (Relobj::initialize_input_to_output_map): New.
1256         (Relobj::merge_output_offset): New.
1257         (Relobj::is_merge_section_for): New.
1258         (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
1259         bits.
1260         * object.h (Relobj::merge_map): Delete.
1261         (initialize_input_to_output_map): New.
1262         (set_merge_map): Delete.
1263         (add_merge_mapping): New.
1264         (merge_output_offset): New.
1265         (is_merge_section_for): New.
1266         * output.cc (Output_section::Input_section::is_merge_section_for):
1267         Use object->is_merge_section_for.
1268         * output.h (Output_section_data::is_merge_section_for): Delete.
1269         (Output_section_data::do_is_merge_section_for): Delete.
1270         * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
1271         Use object->initialize_input_to_output_map.
1272         (Merged_symbol_value<size>::value_from_output_section): Use
1273         object->merge_output_offset.
1274
1275 2015-03-02  Peter Collingbourne  <pcc@google.com>
1276             Cary Coutant  <ccoutant@google.com>
1277
1278         * output.cc (Output_section::add_merge_input_section): Do not
1279         attempt to merge sections with an entsize of 0.
1280
1281 2015-03-02  Khem Raj  <raj.khem@gmail.com>
1282
1283         * attributes.h (class Output_attributes_section_data ): Add
1284         do_print_to_mapfile function.
1285
1286 2015-02-24  Alan Modra  <amodra@gmail.com>
1287
1288         PR 18010
1289         * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
1290         complain if value is not a multiple of four.
1291         (Target_powerpc::Relocate::relocate): Correct handling of
1292         R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
1293
1294 2015-02-21  H.J. Lu  <hongjiu.lu@intel.com>
1295
1296         * configure.ac (default_size): Set to 32 for x32.
1297         * configure: Regenerated.
1298
1299 2015-02-18  Alan Modra  <amodra@gmail.com>
1300
1301         PR 17954
1302         * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
1303         visibility.
1304
1305 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1306
1307         * gc.h (Garbage_collection::add_reference): Don't use find.
1308
1309 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1310
1311         * object.cc (write_local_symbols): avoid std::vector copy.
1312
1313 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1314
1315         * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
1316
1317 2015-02-09  Mark Wielaard  <mjw@redhat.com>
1318
1319         * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
1320         DW_LANG_Fortran03 and DW_LANG_Fortran08.
1321
1322 2015-02-16  Cary Coutant  <ccoutant@google.com>
1323
1324         PR gold/13577
1325         PR gold/16992
1326         * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
1327         DF_SYMBOLIC if --dynamic-list option is used.
1328         * options.cc (General_options::finalize): --dynamic-list is not
1329         mutually exclusive with -Bsymbolic.
1330         * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
1331         listed in --dynamic-list.
1332         * testsuite/Makefile.am (dynamic_list_lib2.so): Add
1333         -Bsymbolic-functions.
1334         * testsuite/Makefile.in: Regenerate.
1335
1336 2015-02-16  Cary Coutant  <ccoutant@google.com>
1337
1338         PR gold/17971
1339         * incremental.cc: Remove redundant include of "output.h".
1340
1341 2015-02-12  Jing Yu  <jingyu@google.com>
1342
1343         * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
1344         TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
1345         New relocation.
1346         * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
1347         TLSLE_MOVW_* relocations.
1348         (Target_aarch64::Scan::global): Likewise.
1349         (Target_aarch64::Relocate::relocate): Likewise.
1350         (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
1351         for new TLSLE_MOVW_* relocations.
1352
1353 2015-02-11  Will Newton  <will.newton@linaro.org>
1354
1355         PR gold/13321
1356         * arm.cc (Target_arm::make_plt_section): Create an ARM
1357         state mapping symbol at the start of the PLT.
1358
1359 2015-02-09  H.J. Lu  <hongjiu.lu@intel.com>
1360
1361         * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
1362         Replace two_file_shared_2.so with two_file_shared_1.so.
1363         * testsuite/Makefile.in: Regenerated.
1364
1365 2015-02-09  Alan Modra  <amodra@gmail.com>
1366
1367         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
1368         plugin_test_thin.a and defsym_test.
1369         * testsuite/Makefile.in: Regenerate.
1370
1371 2015-02-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1372
1373         * merge.cc (do_add_input_section): Combine loop epilogue into main loop
1374         body.
1375
1376 2015-02-04  Peter Collingbourne  <pcc@google.com>
1377
1378         * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
1379         forwarding symbols when computing symbol resolution info for plugins.
1380         * plugin.h (Plugin_manager::symtab): New method.
1381         (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
1382
1383 2015-02-03  Cary Coutant  <ccoutant@google.com>
1384             Peter Collingbourne  <pcc@google.com>
1385
1386         PR gold/15660
1387         * archive.cc (Thin_archive_object_unlocker): New class.
1388         (Archive::include_member): Unlock external members of thin archives.
1389         * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
1390         (plugin_test_2): Likewise.
1391         (plugin_test_3): Likewise.
1392         (plugin_test_4): Likewise.
1393         (plugin_test_5): Likewise.
1394         (plugin_test_6): Likewise.
1395         (plugin_test_7): Likewise.
1396         (plugin_test_8): Likewise.
1397         (plugin_test_9): Likewise.
1398         (plugin_test_10): Likewise.
1399         (plugin_test_11): New test case.
1400         * testsuite/Makefile.in: Regenerate.
1401         * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
1402         file to decide whether to claim file.
1403         (all_symbols_read_hook): Likewise.
1404         * testsuite/plugin_test_1.sh: Adjust expected output.
1405         * testsuite/plugin_test_2.sh: Likewise.
1406         * testsuite/plugin_test_3.sh: Likewise.
1407         * testsuite/plugin_test_6.sh: Likewise.
1408         * testsuite/plugin_test_tls.sh: Likewise.
1409         * testsuite/plugin_test_11.sh: New testcase.
1410
1411 2015-02-03  Cary Coutant  <ccoutant@google.com>
1412
1413         * descriptors.cc (Descriptors::open): Set artificially-low limit for
1414         file descriptors when debugging enabled. Add debug output.
1415         (Descriptors::release): Add debug output.
1416         (Descriptors::close_some_descriptor): Likewise.
1417         (Descriptors::close_all): Likewise.
1418         * fileread.cc (File_read::lock): Likewise.
1419         (File_read::unlock): Likewise.
1420
1421 2015-02-02  Cary Coutant  <ccoutant@google.com>
1422
1423         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
1424         executable output file.
1425
1426 2015-01-22  Han Shen  <shenhan@google.com>
1427
1428         * arm.cc (Target_arm::Target_arm): Add initialization for new members.
1429         (Target_arm::do_plt_address_for_global): New method.
1430         (Target_arm::do_plt_address_for_local): New method.
1431         (Target_arm::rel_irelative_section): New method.
1432         (Target_arm::make_data_plt): Add more parameters for plt ctor.
1433         (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
1434         (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
1435         (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
1436         (Target_arm::Scan::check_non_pic): Add ifunc support.
1437         (Target_arm::Scan::local): Add ifunc support.
1438         (Target_arm::Scan::global): Add ifunc support.
1439         (Target_arm::make_plt_section): New method.
1440         (Target_arm::make_plt_entry): Change to call to make_plt_section.
1441         (Target_arm::make_local_ifunc_plt_entry): New method.
1442         (Target_arm::got_irelative_): New member.
1443         (Target_arm::rel_irelative_): New member.
1444         (Target_arm::got_section): Add creation for got_irelative_.
1445         (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
1446         (Target_arm::Relocate::relocate): Properly set local ifunc address.
1447         (Target_arm::do_dynsym_value): Properly set global ifunc address.
1448         (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
1449         (Output_data_plt_arm::IRelative_data): New type.
1450         (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
1451         (Output_data_plt_arm::add_entry): Add more parameters.
1452         (Output_data_plt_arm::add_relocation): New method.
1453         (Output_data_plt_arm::add_local_ifunc_entry): New method.
1454         (Output_data_plt_arm::rel_irelative): New method.
1455         (Output_data_plt_arm::entry_count): Modified.
1456         (Output_data_plt_arm::address_for_global): New method.
1457         (Output_data_plt_arm::address_for_local): New method.
1458 gold/
1459         (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
1460         (Output_data_plt_arm::insert_irelative_data): New method.
1461         (Output_data_plt_arm::irelative_rel_): New member.
1462         (Output_data_plt_arm::got_): New member.
1463         (Output_data_plt_arm::got_irelative_): New member.
1464         (Output_data_plt_arm::irelative_count_): New member.
1465         (Output_data_plt_arm::IRelative_data_vec): New typedef.
1466         (Output_data_plt_arm::irelative_data_vec_): New member.
1467         (Output_data_plt_arm::do_write): Write out irelative entries.
1468         (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
1469         more parameters to ctor.
1470         (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
1471         more parameters to ctor.
1472         * output.h (Output_data_reloc::add_local_relative): New method.
1473         * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
1474
1475 2015-01-29  Alan Modra  <amodra@gmail.com>
1476
1477         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
1478         and GOT_TLSGD to LE optimization.
1479
1480 2015-01-28  Cary Coutant  <ccoutant@google.com>
1481
1482         * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
1483         for undef TLS symbols.
1484         (Target_x86_64::Relocate::relocate_tls): Likewise.
1485         (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
1486
1487 2015-01-25  Cary Coutant  <ccoutant@google.com>
1488
1489         * output.cc (Output_segment::set_section_addresses): Fix calculation
1490         of size of relro segment.
1491
1492 2015-01-22  Alan Modra  <amodra@gmail.com>
1493
1494         * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
1495         condition for need of ifunc plt entry.
1496         (Target_powerpc::Scan::global <got relocs>): Likewise.
1497
1498 2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1499
1500         * mips.cc (reloc_high): Add r_sym.
1501         (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
1502         reloc_high constructor.
1503         (Mips_relocate_functions::relgot16_local): Likewise.
1504         (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
1505         r_type to decide whether LO16 matches HI16.
1506         (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
1507         rello16 and relgot16_local.
1508
1509 2015-01-09  Cary Coutant  <ccoutant@google.com>
1510
1511         * layout.cc (Layout::set_segment_offsets): Don't align start of segment
1512         unless alignment is larger than page size.
1513
1514 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1515             Cary Coutant  <ccoutant@google.com>
1516
1517         PR gold/17729
1518         * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
1519         (DEFAULT_TARGET_X32): Set for x32.
1520         * x86_64.cc (cmp_insn_32): New.
1521         (lea_r10_insn_32): Likewise.
1522         (lea_r11_insn_32): Likewise.
1523         (cmp_insn_64): Likewise.
1524         (lea_r10_insn_64): Likewise.
1525         (lea_r11_insn_64): Likewise.
1526         (Target_x86_64<size>::do_calls_non_split): Handle x32.
1527         * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
1528         (check_DATA): Add split_x32 files.
1529         (split_x32_[1234n].o): New targets.
1530         (split_x32_[124]): New targets.
1531         (split_x32_[1234r].stdout): New targets.
1532         * testsuite/split_x32.sh: New file.
1533         * testsuite/split_x32_1.s: Likewise.
1534         * testsuite/split_x32_2.s: Likewise.
1535         * testsuite/split_x32_3.s: Likewise.
1536         * testsuite/split_x32_4.s: Likewise.
1537         * testsuite/split_x32_n.s: Likewise.
1538         * configure: Regenerated.
1539         * testsuite/Makefile.in: Likewise.
1540
1541 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1542
1543         PR gold/17809
1544         * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
1545         x32.
1546
1547 2015-01-02  Alan Modra  <amodra@gmail.com>
1548
1549         * version.cc (print_version): Just print current year.
1550         * dwp.cc (print_version): Likewise.
1551
1552 2015-01-01  Alan Modra  <amodra@gmail.com>
1553
1554         Update year range in copyright notice of all files.
1555
1556 2014-12-25  Alan Modra  <amodra@gmail.com>
1557
1558         * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
1559         new enums.
1560         (Target_arm::merge_object_attributes, ): Likewise.
1561
1562 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
1563
1564         * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
1565         as hard float only when Tag_ABI_VFP_args is 1, using new enum value
1566         AEABI_VFP_args_vfp to check that.
1567         (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
1568         value and replace hardcoded values by enum values.
1569
1570 2014-12-22  Cary Coutant  <ccoutant@google.com>
1571
1572         * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
1573
1574 2014-12-20  H.J. Lu  <hongjiu.lu@intel.com>
1575
1576         PR gold/14608
1577         * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
1578         to "return i * i * 3;".
1579
1580 2014-12-16  Cary Coutant  <ccoutant@google.com>
1581
1582         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
1583         (Mapfile::print_output_data): Use current_data_size() to avoid
1584         assert for sections requiring postprocessing; if address is not valid,
1585         print 0.
1586         (Mapfile::print_output_section): Use current_data_size(); print note
1587         that addresses and sizes are before compression.
1588
1589 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
1590
1591         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1592         Cast current_group_size to unsigned long when reporting error.
1593
1594 2014-12-10  Jing Yu  <jingyu@google.com>
1595
1596         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
1597         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
1598         Update error message.
1599         (Target_aarch64::do_relax): Use absolute value of option
1600         stub_group_size. Replace local variable with class member
1601         stub_group_size_.
1602
1603 2014-12-04  Alan Modra  <amodra@gmail.com>
1604
1605         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
1606         addend of PLTREL24 reloc when not generating a plt stub.  Make
1607         max_branch_offset an "Address".
1608         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
1609         (Target_powerpc::Relocate::relocate): Likewise.
1610
1611 2014-12-04  Alan Modra  <amodra@gmail.com>
1612
1613         PR 17670
1614         * symtab.cc (Symbol::set_undefined): Remove assertion.
1615         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1616         on symbols defined in discarded sections, instead return false.
1617         Rearrange params, update all callers.
1618         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
1619         branches to syms in discarded sections.
1620         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
1621         undefined and flag as discarded.
1622         (Target_powerpc::Relocate::relocate): Localize variable.
1623
1624 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
1625
1626         PR gold/17675
1627         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
1628         * testsuite/Makefile.in: Regenerated.
1629
1630 2014-12-03  Alan Modra  <amodra@gmail.com>
1631
1632         PR 17566
1633         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
1634         when adding dynamic relocations against section symbols.
1635
1636 2014-12-01  Dimitry Ivanov <dimitry@google.com>
1637
1638         * layout.cc (Layout::finish_dynamic_section): When '-z global'
1639         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
1640         * options.h (General_options): New -z option (global).
1641
1642 2014-12-01  Cary Coutant  <ccoutant@google.com>
1643
1644         PR gold/17578
1645         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
1646         is given.
1647         (Layout::create_executable_stack_info): Warn when -z noexecstack is
1648         given but some inputs require executable stack.
1649
1650 2014-11-26  Cary Coutant  <ccoutant@google.com>
1651
1652         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
1653         .debug_str_offsets; strip .debug_gnu_pubnames and
1654         .debug_gnu_pubtypes.
1655         (lines_only_debug_sections): Strip all four new sections.
1656
1657 2014-11-26  Jing Yu  <jingyu@google.com>
1658
1659         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
1660         register to be x0 when to relax TLSDESC_LD64_LO12.
1661
1662 2014-11-26  Alan Modra  <amodra@gmail.com>
1663
1664         * powerpc.cc (struct Stub_table_owner): New.
1665         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
1666         unsigned int vector.  Update all references.
1667         (powerpc_relobj::set_stub_table): Take an unsigned int param
1668         rather than a Stub_table.  Update callers.
1669         (Powerpc_relobj::clear_stub_table): New function.
1670         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
1671         stub_group_size_ vars.
1672         (Target_powerpc::new_stub_table): Delete.
1673         (max_branch_delta): New function, extracted from..
1674         (Target_powerpc::Relocate::relocate): ..here..
1675         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
1676         status on whether stub created successfully.
1677         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
1678         default sizing to..
1679         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
1680         reduce on relax failure.
1681         (Target_powerpc::group_sections): Add "no_size_errors" param.
1682         Use stub_group_size_.  Set up group info in a temp vector,
1683         before building Stub_table vector.  Account for input sections
1684         possibly already converted to relaxed sections.
1685         (Stub_table::init): Delete.  Merge into..
1686         (Stub_table::Stub_table): ..here.
1687         (Stub_table::can_reach_stub): New function.
1688         (Stub_table::add_plt_call_entry): Add "from" parameter and
1689         return true iff stub could be reached.
1690         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
1691         param too.
1692         (Stub_table::clear_stubs): Add "all" param.
1693
1694 2014-11-26  Alan Modra  <amodra@gmail.com>
1695
1696         * powerpc.cc (Stub_control::set_output_and_owner): New function.
1697         (Target_powerpc::group_sections): Use it.
1698
1699 2014-11-25  Cary Coutant  <ccoutant@google.com>
1700
1701         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
1702         (Binary_to_elf::write_symbol): Add st_size parameter.
1703         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
1704
1705 2014-11-25  Cary Coutant  <ccoutant@google.com>
1706
1707         PR gold/17639
1708         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
1709         (Sized_relobj_file::do_layout): Handle deferred sections properly
1710         during GC pass 1. Don't add reloc sections to deferred list twice.
1711         * object.h (Sized_relobj_file::is_deferred_layout): New function.
1712         (Sized_relobj_file::is_deferred_layout_): New data member.
1713
1714 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
1715
1716         PR gold/17619
1717         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
1718         Check PC-relative offset overflow in PLT entry.
1719
1720 2014-11-21  Alan Modra  <amodra@gmail.com>
1721
1722         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
1723         for undefined weaks.
1724
1725 2014-11-20  Alan Modra  <amodra@gmail.com>
1726
1727         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
1728         from --stub-group-size parameter divided by 1024.
1729         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
1730         template parameter.  Update all uses.
1731         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
1732         has_stub_value.  Set for long branches.  Don't report overflow for
1733         branch to undefined weak symbols.  Print info message on
1734         overflowing branch to stub.
1735
1736 2014-11-20  Alan Modra  <amodra@gmail.com>
1737
1738         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
1739
1740 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
1741
1742         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
1743         entry for R_X86_64_GOTPLT64.
1744         (Target_x86_64<size>::Relocate::relocate): Update comments for
1745         R_X86_64_GOTPLT64.
1746
1747 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
1748
1749         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
1750         * plugin.h: add lock definition
1751
1752 2014-10-29  Han Shen  <shenhan@google.com>
1753             Jing Yu   <jingyu@google.com>
1754
1755         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
1756         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1757         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
1758         Symbol::TLS_REF.
1759         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
1760         method.
1761         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
1762         (Target_aarch64::tls_ld_to_le): New method.
1763         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
1764         for 64bit targets.
1765         (Output_data_plt_aarch64::irelative_rel_): New data member.
1766         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
1767         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
1768         (Output_data_plt_aarch64::add_relocation): New method.
1769         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
1770         offset. Add got_irelative size to got size.
1771         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
1772         type string with the new typename.
1773         (AArch64_relocate_functions::update_adr): Replace parameter x with
1774         immed.
1775         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
1776         (AArch64_relocate_functions::reloc_common): New method.
1777         (AArch64_relocate_funcsions::rela_general): Extract common part out
1778         into reloc_common method.
1779         (AArch64_relocate_functions::rela_general): Likewise.
1780         (AArch64_relocate_functions::pcrela_general): Likewise.
1781         (AArch64_relocate_functions::adr): New method.
1782         (AArch64_relocate_functions::adrp): Calculate immed before calling
1783         update_adr.
1784         (AArch64_relocate_functions::adrp): Likewise.
1785         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
1786         comparing x to 0. Calculate immed from ~x when x < 0.
1787         (Target_aarch64::optimize_tls_reloc): Add new cases for
1788         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1789         TLSLD_MOVW_DTPREL_G0_NC.
1790         (Target_aarch64::possible_function_pointer_reloc): Implement this
1791         method.
1792         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
1793         comment.
1794         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
1795         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1796         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1797         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
1798         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1799         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1800         (Target_aarch64::make_plt_entry): Call add_entry with two more
1801         parameters.
1802         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1803         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
1804         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1805         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1806         (Target_aarch64::Relocate::relocate_tls): Add cases for
1807         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1808         TLSLD_MOVW_DTPREL_G0_NC.
1809         * testsuite/icf_safe_so_test.cc: Correct test comment.
1810         * testsuite/icf_safe_test.sh: Add AArch64 arch.
1811
1812 2014-10-22  Alan Modra  <amodra@gmail.com>
1813
1814         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
1815         thread_starter.
1816
1817 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
1818
1819         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
1820
1821 2014-10-17  Cary Coutant  <ccoutant@google.com>
1822
1823         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1824         Add "typename" keyword.
1825
1826 2014-10-15  Han Shen  <shenhan@google.com>
1827             Jing Yu   <jingyu@google.com>
1828
1829         Patch for gold aarch64 backend to support relaxation.
1830         * aarch64-reloc.def: Change format.
1831         * aarch64.cc (class Reloc_stub): New class.
1832         (class Stub_table): New class.
1833         (class AArch64_relobj): New class.
1834         (class AArch64_input_section): New class.
1835         (class AArch64_output_section): New class.
1836         (Target_aarch64::new_stub_table): New method.
1837         (Target_aarch64::new_aarch64_input_section): New method.
1838         (Target_aarch64::find_aarch64_input_section): New method.
1839         (Target_aarch64::scan_section_for_stubs): New method.
1840         (Target_aarch64::scan_reloc_section_for_stubs): New method.
1841         (Target_aarch64::relocate_stub): New method.
1842         (Target_aarch64::current_target): New method.
1843         (Target_aarch64::do_make_elf_object): New method.
1844         (Target_aarch64::do_may_relax): New method.
1845         (Target_aarch64::do_relax): New method.
1846         (Target_aarch64::group_sections): New method.
1847         (Target_aarch64::scan_reloc_for_stub): New method.
1848         (Target_aarch64::do_make_output_section): New method.
1849         (Target_aarch64::stub_tables_): New data member.
1850         (Target_aarch64::aarch64_input_section_map_): New data member.
1851         (AArch64_relocate_functions::maybe_apply_stub): New method.
1852
1853 2014-09-30  Cary Coutant  <ccoutant@google.com>
1854
1855         PR gold/17432
1856         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
1857
1858 2014-09-30  Kito Cheng  <kito@0xlab.org>
1859
1860         PR gold/13597
1861         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
1862         hash table before sysv-style hash table.
1863
1864 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
1865
1866         * options.h (--pic-executable): Add negative to alias to -no-pie.
1867
1868 2014-09-26  Cary Coutant  <ccoutant@google.com>
1869
1870         PR gold/16773
1871         * object.cc (Sized_relobj_file): Compute value of section symbols
1872         for TLS sections the same as TLS symbols.
1873
1874 2014-09-25  Cary Coutant  <ccoutant@google.com>
1875
1876         PR gold/17432
1877         * resolve.cc (Symbol_table::resolve): Override common placeholder
1878         symbols, but adjust sizes.
1879         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
1880         symbols to common lists.
1881
1882 2014-09-24  Alan Modra  <amodra@gmail.com>
1883
1884         * po/POTFILES.in: Regenerate.
1885
1886 2014-09-23  Taiju Tsuiki  <tzik@google.com>
1887             Cary Coutant  <ccoutant@google.com>
1888
1889         PR gold/14860
1890         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
1891         on input_sections_blocker.
1892         * layout.cc (Write_sections_task::locks): Unblock
1893         input_sections_blocker_.
1894         * layout.h (Write_sections_task::Write_sections_task): Add
1895         input_sections_blocker.
1896         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
1897         to DEPENDENCIES.
1898         * testsuite/Makefile.in: Regenerate.
1899
1900 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1901
1902         * testsuite/Makefile.am (plugin_test_10): New test.
1903         * testsuite/Makefile.in: Regenerate
1904         * testsuite/plugin_common_test_2.c (c1): Align to 8.
1905         * testsuite/plugin_test_10.sh: New file.
1906
1907 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1908
1909         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
1910         * resolve.cc (Symbol_table::resolve): Don't override common symbols
1911         during the replacement phase.
1912
1913 2014-09-17  Han Shen  <shenhan@google.com>
1914             Jing Yu  <jingyu@google.com>
1915
1916         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
1917         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
1918         * aarch64.cc (Target_aarch64): Add data members
1919         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
1920         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
1921         constructor.
1922         (Target_aarch64::do_reloc_symbol_index): New method.
1923         (Target_aarch64::do_reloc_addend): New method.
1924         (Target_aarch64::add_tlsdesc_info): New method.
1925         (Target_aarch64::do_dynsym_value): New method.
1926         (Target_aarch64::do_make_data_plt): Add new parameters: got,
1927         got_irelative. Pass them to Output_data_plt_aarch64_standard.
1928         (Target_aarch64::make_data_plt): Add new parameters: got,
1929         got_irelative. Pass them to do_make_data_plt.
1930         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
1931         (Target_aarch64::Relocate:tls_gd_to_le): New method.
1932         (Target_aarch64::Relocate:tls_ie_to_le): New method.
1933         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
1934         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
1935         (Target_aarch64::got_tlsdesc_section): New method.
1936         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1937         (Target_aarch64::define_tls_base_symbol): New method.
1938         (Target_aarch64::reserve_tlsdesc_entries): New method.
1939         (Target_aarch64::got_mod_index_entry): New method.
1940         (Target_aarch64::rela_tlsdesc_section): New method.
1941         (Target_aarch64::rela_irelative_section): New method.
1942         (Target_aarch64::Tlsdesc_info): New struct.
1943         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
1944         relocations and tlsdesc relocations.
1945         (Target_aarch64::optimize_tls_reloc): Implement method.
1946         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
1947         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
1948         in constructor.
1949         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
1950         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
1951         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
1952         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
1953         (Output_data_plt_aarch64::rela_tlsdesc): New method.
1954         (Output_data_plt_aarch64::rela_irelative): New method.
1955         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
1956         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
1957         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
1958         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
1959         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
1960         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
1961         (Output_data_plt_aarch64_standard): New member variables:
1962         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
1963         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
1964         New parameter: got, got_irelative.
1965         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
1966         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
1967         (Output_data_plt_aarch64::do_write): Replace got_address with
1968         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
1969         (AArch64_relocate_functions::update_movnz): New method.
1970         (AArch64_relocate_functions): Correct format.
1971         (AArch64_relocate_functions::movnz): New method.
1972         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
1973         before the switch. Add new cases to switch.
1974         Check ie_to_le relaxation on tlsie relocations. Add code handling
1975         tlsgd tlsdesc cases.
1976         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
1977         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
1978         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
1979         Call reloc_name_in_error_message to print unsupported reloc.
1980         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
1981         make_data_plt.
1982         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
1983         relocs. Fill in some more dynamic tags.
1984         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
1985         Skip call tls_get_addr when tlsgd is relaxed.
1986         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
1987         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
1988         tlsdesc->ie relaxation.
1989
1990 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1991
1992         * mips.cc (Target_mips_nacl): New class.
1993         (Target_selector_mips_nacl): New class.
1994         (target_selector_mips32): Rename from target_selector_mips32be and use
1995         Target_selector_mips_nacl instead of Target_selector_mips.
1996         (target_selector_mips32el): Rename from target_selector_mips32 and use
1997         Target_selector_mips_nacl instead of Target_selector_mips.
1998         (target_selector_mips64): Rename from target_selector_mips64be and use
1999         Target_selector_mips_nacl instead of Target_selector_mips.
2000         (target_selector_mips64el): Rename from target_selector_mips64 and use
2001         Target_selector_mips_nacl instead of Target_selector_mips.
2002         (Target_mips::mips_info): Add const attribute.
2003
2004 2014-09-02  Cary Coutant  <ccoutant@google.com>
2005
2006         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
2007         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
2008         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
2009         (Sized_incr_dynobj::do_section_name): Likewise.
2010         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
2011         (Sized_incr_dynobj::do_section_name): Likewise.
2012         * object.h (Object::section_name): Likewise.
2013         (Object::do_section_name): Likewise.
2014         (Sized_relobj_file::do_section_name): Likewise.
2015         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
2016         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
2017
2018 2014-09-02  Cary Coutant  <ccoutant@google.com>
2019
2020         PR gold/17005
2021         * ehframe.cc (Fde::write): Add output_offset parameter.
2022         (Cie::write): Likewise.
2023         (Eh_frame::set_final_data_size): Account for offset within output
2024         section.
2025         (Eh_frame::do_sized_write): Likewise.
2026         * ehframe.h (Fde::write): Add output_offset parameter.
2027         (Cie::write): Likewise.
2028         * output.cc (Output_section::Input_section_sort_entry): Remove
2029         section_has_name_; add output_section_name parameter. Use
2030         output section name for non-input sections.
2031         (Output_section::Input_section_sort_entry::section_has_name): Remove.
2032         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
2033         (Output_section::Input_section_sort_compare): Remove logic for
2034         sections without names.
2035         (Output_section::Input_section_sort_init_fini_compare): Likewise.
2036         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
2037         Likewise.
2038         (Output_section::Input_section_sort_section_name_compare): Likewise.
2039
2040 2014-08-29 Han Shen <shenhan@google.com>
2041            Jing Yu <jingyu@google.com>
2042
2043         * aarch64-reloc-property.cc
2044         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
2045         reference reloc property in the table.
2046         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
2047         3 other entries.
2048         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
2049         2 new overloaded methods.
2050         (Output_data_got_aarch64::do_write): Add code to write out
2051         static relocs.
2052         (class Output_data_got_aarch64::Static_reloc): New class to wrap
2053         static relocs.
2054         (Output_data_got_aarch64::static_relocs): New vector to
2055         hold static relocs.
2056         (Target_aarch64::TCB_SIZE): New const static memeber.
2057         (Target_aarch64::tcb_size): New method.
2058         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
2059         (Target_aarch64::Relocate::relocate_tls): New method.
2060         (Target_aarch64::Scan::local): Add code handling new reloc types.
2061         (Target_aarch64::Scan::global): Add code handling new reloc types.
2062
2063 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
2064
2065         * options.h (-no-pie): Add option.
2066
2067 2014-08-08  Jing Yu  <jingyu@google.com>
2068             Han Shen  <shenhan@google.com>
2069
2070         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
2071         (DEFFILES): add aarch64-reloc.def.
2072         (TARGETSOURCES): Add aarch64-reloc-property.cc.
2073         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
2074         * Makefile.in: Regenerate.
2075         * aarch64-reloc-property.cc: New file.
2076         * aarch64-reloc-property.h: New file.
2077         * aarch64-reloc.def: New file.
2078         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
2079         with tab to make the format consistent.
2080         (Output_data_got_aarch64::symbol_table_): New method.
2081         (Target_aarch64::do_plt_address_for_global): New method.
2082         (Target_aarch64::do_plt_address_for_local): New method.
2083         (Target_aarch64::do_select_as_default_target): New method.
2084         (Target_aarch64::do_make_data_plt): New method.
2085         (Target_aarch64::make_data_plt): New method.
2086         (Output_data_plt_aarch64::has_irelative_section): New method.
2087         (Output_data_plt_aarch64::address_for_global): New method.
2088         (Output_data_plt_aarch64::address_for_local): New method.
2089         (Output_data_plt_aarch64::irelative_rel_): New parameter.
2090         (Output_data_plt_aarch64::add_entry): Implement contents.
2091         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
2092         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
2093         the got_pov entry to plt0.
2094         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
2095         Implement contents.
2096         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
2097         (AArch64_howto): New struct.
2098         (aarch64_howto[]): New static const array.
2099         (AArch64_relocate_functions): New class.
2100         (Target_aarch64::Scan::get_reference_flags): Remove method.
2101         (Target_aarch64::Scan::local): Implement to support a few relocations.
2102         (Target_aarch64::Scan::global): Implement to support a few relocations.
2103         (Target_aarch64::make_plt_section): Implement contents.
2104         (Target_aarch64::make_plt_entry): Implement contents.
2105         (Target_aarch64::do_finalize_sections): Implement contents.
2106         (Target_aarch64::Relocate::relocate): Implement a few relocations.
2107         (Target_aarch64::relocate_section): Implement contents.
2108
2109 2014-08-06  Alan Modra  <amodra@gmail.com>
2110
2111         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
2112
2113 2014-08-06  Alan Modra  <amodra@gmail.com>
2114
2115         PR 13227
2116         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
2117
2118 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
2119
2120         * object.cc (Relobj::is_section_name_included): Add
2121         ".rodata.nptl_version" to not garbage collect this section.
2122
2123 2014-07-08  Cary Coutant  <ccoutant@google.com>
2124
2125         * expression.cc (struct Expression::Expression_eval_info): Add
2126         new fields type_pointer, vis_pointer, and nonvis_pointer.
2127         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
2128         nonvis_pointer parameters. Adjust all calls.
2129         (Symbol_expression::value): Update type, visibility, and nonvis bits
2130         in caller.
2131         * script.cc (Symbol_assignment::sized_finalize): Update type,
2132         visibility, and remaining st_other bits for new symbol.
2133         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
2134         vis_pointer, and nonvis_pointer parameters.
2135         * symtab.h (Symbol::set_type): New method.
2136
2137         * testsuite/Makefile.am (defsym_test): New test.
2138         * testsuite/Makefile.in: Regenerate.
2139         * testsuite/defsym_test.c: New file.
2140         * testsuite/defsym_test.sh: New file.
2141
2142 2014-07-08  Cary Coutant  <ccoutant@google.com>
2143
2144         PR gold/15639
2145         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
2146         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
2147         (Sized_dynobj::base_read_symbols): ...new method.
2148         * object.h (Sized_relobj_file::base_read_symbols): New method.
2149         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
2150         (Sized_relobj_file::base_read_symbols): ...new method.
2151         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
2152         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
2153         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
2154
2155 2014-07-04  Alan Modra  <amodra@gmail.com>
2156
2157         * po/POTFILES.in: Regenerate.
2158
2159 2014-07-02  Jing Yu  <jingyu@google.com>
2160
2161         * aarch64.cc: New file
2162         * Makefile.am (TARGETSOURCES): Add aarch64.cc
2163         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
2164         * Makefile.in: Regenerate.
2165         * configure.tgt: Add entries for aarch64*.
2166         * configure.ac:  Likewise.
2167         * configure: Likewise.
2168
2169 2014-06-27  Alan Modra  <amodra@gmail.com>
2170
2171         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
2172
2173 2014-06-24  Cary Coutant  <ccoutant@google.com>
2174
2175         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
2176         sections.
2177         (Dwo_file::sized_read_unit_index): Likewise.
2178
2179 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2180
2181         * mips.cc: New file.
2182         * Makefile.am (TARGETSOURCES): Add mips.cc
2183         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
2184         * configure.tgt: Add entries for mips*.
2185         * configure.ac: Likewise.
2186         * Makefile.in: Regenerate.
2187         * configure: Likewise.
2188
2189 2014-06-09  Cary Coutant  <ccoutant@google.com>
2190
2191         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
2192         unit_length is within section bounds.
2193
2194 2014-06-09  Cary Coutant  <ccoutant@google.com>
2195
2196         PR gold/16980
2197         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
2198         map.
2199
2200 2014-06-07  Alan Modra  <amodra@gmail.com>
2201
2202         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
2203
2204 2014-06-06  Cary Coutant  <ccoutant@google.com>
2205
2206         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
2207         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
2208         (Dwarf_pubnames_table::read_header): Likewise.
2209         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
2210         .debug_gnu_pubtypes.
2211
2212 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
2213
2214         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
2215         * Makefile.in, configure: Regenerate.
2216
2217 2014-06-03  Alan Modra  <amodra@gmail.com>
2218
2219         * powerpc.cc (addis_12_2): Define.
2220         (Stub_table::do_write): Support fusion on ELFv2 stubs.
2221
2222 2014-06-03  Alan Modra  <amodra@gmail.com>
2223
2224         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
2225         st_other output.
2226
2227 2014-06-02  Alan Modra  <amodra@gmail.com>
2228
2229         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
2230         Only ignore relocs on ELFv1.
2231         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
2232
2233 2014-05-30  Cary Coutant  <ccoutant@google.com>
2234
2235         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
2236         * testsuite/Makefile.in: Regenerate.
2237         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
2238
2239 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
2240
2241         PR gold/16945
2242         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
2243         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
2244
2245 2014-05-15  Alan Modra  <amodra@gmail.com>
2246
2247         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
2248         Compare FDE contents with DW_CFA_nop rather than 0.
2249
2250 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
2251
2252         * symtab.h (may_need_copy_reloc): Remove check for position independent
2253         code.
2254         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
2255         position independence before pc absolute may_need_copy_reloc call.
2256         Add check for executable output befor pc relative may_need_copy_reloc
2257         call.
2258         * i386.cc: Ditto.
2259         * arm.cc: Ditto.
2260         * sparc.cc: Ditto.
2261         * tilegx.cc: Ditto.
2262         * powerpc.cc: Add check for no position independence before
2263         may_need_copy_reloc calls.
2264         * testsuite/pie_copyrelocs_test.cc: New file.
2265         * testsuite/pie_copyrelocs_shared_test.cc: New file.
2266         * Makefile.am (pie_copyrelocs_test): New test.
2267         * Makefile.in: Regenerate.
2268
2269 2014-05-08  Martin Liška  <mliska@suse.cz>
2270
2271         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
2272
2273 2014-05-06  Cary Coutant  <ccoutant@google.com>
2274
2275         PR gold/16900
2276         * i386.cc (Output_data_got_plt_i386): New class.
2277         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
2278         parameter. Change all callers.
2279         (Output_data_plt_i386::layout_): Remove.
2280         (Output_data_plt_i386::got_plt_): Change type.
2281         (Target_i386::got_plt_): Change type. Change all references.
2282         (Target_i386::got_section): Create instance of new class.
2283         (Output_data_got_plt_i386::do_write): New function.
2284         * x86_64.cc (Output_data_got_plt_x86_64): New class.
2285         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
2286         parameter. Change all callers.
2287         (Output_data_plt_x86_64::layout_): Remove.
2288         (Output_data_plt_x86_64::got_plt_): Change type.
2289         (Target_x86_64::got_plt_): Change type. Change all references.
2290         (Target_x86_64::got_section): Create instance of new class.
2291         (Output_data_got_plt_x86_64::do_write): New function.
2292         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
2293         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
2294         class.
2295
2296 2014-05-05  Cary Coutant  <ccoutant@google.com>
2297
2298         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
2299         if we have pubnames/pubtypes.
2300
2301 2014-05-02  Cary Coutant  <ccoutant@google.com>
2302
2303         * defstd.cc (in_segment): Define __ehdr_start here...
2304         * layout.cc (Layout::finalize): ...Instead of here.  Set the
2305         output segment when known.
2306         * resolve.cc (Symbol::override_base_with_special): Remember
2307         the original binding.
2308         * symtab.cc (Symbol::set_output_segment): New function.
2309         (Symbol::set_undefined): New function.
2310         * symtab.h (Symbol::is_weak_undefined): Check original undef
2311         binding.
2312         (Symbol::is_strong_undefined): New function.
2313         (Symbol::set_output_segment): New function.
2314         (Symbol::set_undefined): New function.
2315         * target-reloc.h (is_strong_undefined): Remove.
2316         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
2317         Check for hidden undefs.
2318         (relocate_section): Call Symbol::is_strong_undefined.
2319
2320         * testsuite/Makefile.am (ehdr_start_test_1)
2321         (ehdr_start_test_2, ehdr_start_test_3)
2322         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
2323         * testsuite/Makefile.in: Regenerate.
2324         * testsuite/ehdr_start_def.cc: New source file.
2325         * testsuite/ehdr_start_test.cc: New source file.
2326         * testsuite/ehdr_start_test.t: New linker script.
2327         * testsuite/ehdr_start_test_4.sh: New shell script.
2328
2329 2014-04-23  Cary Coutant  <ccoutant@google.com>
2330
2331         PR gold/16870
2332         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
2333
2334 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2335
2336         * layout.cc (Layout::include_section): Allow a target to decide
2337         whether to include a section.
2338         * target.h (Target::should_include_section): New function.
2339         (Target::do_should_include_section): New function.
2340
2341 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2342
2343         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
2344         inline into ...
2345         (Copy_relocs::emit): ... here.
2346         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
2347         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
2348         (Copy_reloc_entry::entries_): Change from private to protected.
2349
2350 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
2351
2352         * icf.cc (get_section_contents): Replace copies of reloc
2353         vectors with const references.
2354
2355 2014-04-02  Cary Coutant  <ccoutant@google.com>
2356
2357         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
2358         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
2359         * configure: Regenerate.
2360         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
2361         -fno-use-linker-plugin.
2362         (LINK1, CXXLINK1): Add it to the link command.
2363         * testsuite/Makefile.in: Regenerate.
2364
2365 2014-03-12  Alan Modra  <amodra@gmail.com>
2366
2367         * Makefile.in: Regenerate.
2368
2369 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2370
2371         * symtab.h (Symbol::set_nonvis): New function.
2372
2373 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2374
2375         * symtab.cc (Sized_symbol<32>::init_output_data):
2376         Instantiate the template.
2377         (Sized_symbol<64>::init_output_data): Likewise.
2378
2379 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2380
2381         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
2382         adjust dynamic symbol value.
2383         * target.h (Target::adjust_dyn_symbol): New function.
2384         (Target::do_adjust_dyn_symbol): New function.
2385
2386 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2387
2388         * output.cc (Output_data_dynamic::Dynamic_entry::write):
2389         Get the value of DYNAMIC_CUSTOM dynamic entry.
2390         * output.h (Output_data_dynamic::add_custom): New function.
2391         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
2392         dynamic entry.
2393         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
2394         * target.h (Target::dynamic_tag_custom_value): New function.
2395         (Target::do_dynamic_tag_custom_value): New function.
2396
2397 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2398
2399         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
2400         dynsym indexes.
2401         * target.h (Target::has_custom_set_dynsym_indexes): New function.
2402         (Target::do_has_custom_set_dynsym_indexes): New function.
2403         (Target::set_dynsym_indexes): New function.
2404         (Target::do_set_dynsym_indexes): New function.
2405
2406 2014-03-07  Alan Modra  <amodra@gmail.com>
2407
2408         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
2409         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
2410         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
2411         (Powerpc_relocate_functions::has_overflow_bitfield,
2412         overflowed): Use the above.
2413         (Target_powerpc::Relocate::relocate): Correct overflow checking
2414         for a number of relocations.  Modify overflow test for 16-bit
2415         fields in instructions to signed/unsigned according to whether
2416         the field takes a signed or unsigned value.
2417
2418 2014-03-05  Alan Modra  <amodra@gmail.com>
2419
2420         Update copyright years.
2421
2422 2014-03-05  Alan Modra  <amodra@gmail.com>
2423
2424         * powerpc.cc (Target_powerpc::Scan::local, global): Support
2425         R_PPC64_ADDR64_LOCAL.
2426         (Target_powerpc::Relocate::relocate): Likewise.
2427
2428 2014-03-03  Alan Modra  <amodra@gmail.com>
2429
2430         * dwp.cc (print_version): Update copyright year to current.
2431
2432 2014-02-10  Alan Modra  <amodra@gmail.com>
2433
2434         * po/gold.pot: Regenerate.
2435
2436 2014-02-06  Cary Coutant  <ccoutant@google.com>
2437
2438         Fix problem where -u is ignored when a weak undef is seen.
2439
2440         * archive.cc (Library_base::should_include_member): Reorder
2441         code to check for -u option if a weak undef has already been seen.
2442         * testsuite/Makefile.am (weak_undef_test_2): New test case.
2443         * testsuite/Makefile.in: Regenerate.
2444         * testsuite/weak_undef_file3.cc: New file.
2445         * testsuite/weak_undef_file4.cc: New file.
2446         * testsuite/weak_undef_test_2.cc: New file.
2447
2448 2014-02-05  Cary Coutant  <ccoutant@google.com>
2449
2450         Fix issues with gold undefined symbol diagnostics.
2451
2452         PR binutils/15435
2453         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
2454         check to here.
2455         * target-reloc.h (is_strong_undefined): New function.
2456         (relocate_section): Move undef vtable symbol check from here.
2457         Check for is_strong_undefined.
2458
2459 2014-02-05  Cary Coutant  <ccoutant@google.com>
2460
2461         Fix problems with the --dynamic-list option.
2462
2463         PR gold/13577
2464         * options.cc (General_options::parse_dynamic_list):
2465         Set have_dynamic_list_.
2466         (General_options::General_options): Initialize have_dynamic_list_.
2467         (General_options::finalize): Turn off -Bsymbolic and
2468         -Bsymbolic-functions if --dynamic-list provided.
2469         * options.h (General_options::have_dynamic_list): New function.
2470         (General_options::have_dynamic_list_): New data member.
2471         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
2472         correctly.
2473
2474         PR gold/16530
2475         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
2476         in --dynamic-list, mark it.
2477
2478         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
2479         (dynamic_list_2): New test case.
2480         * testsuite/Makefile.in: Regenerate.
2481         * testsuite/dynamic_list_2.cc: New file.
2482         * testsuite/dynamic_list_2.t: New file.
2483         * testsuite/dynamic_list_lib1.cc: New file.
2484         * testsuite/dynamic_list_lib2.cc: New file.
2485         * testsuite/gc_dynamic_list_test.c: New file.
2486         * testsuite/gc_dynamic_list_test.sh: New file.
2487         * testsuite/gc_dynamic_list_test.t: New file.
2488
2489 2014-01-28  Cary Coutant  <ccoutant@google.com>
2490
2491         Add .gdb_index version 7 support.
2492
2493         * gold/dwarf_reader.cc: include <utility> (for make_pair).
2494         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
2495         debug sections.
2496         (Dwarf_ranges_table::read_ranges_table): Likewise.
2497         (Dwarf_pubnames_table::read_section): Check for GNU-style
2498         sections, and for compressed debug sections.
2499         (Dwarf_pubnames_table::read_header): Compute end address of table.
2500         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
2501         for end of list by offset, not by offset == 0.
2502         (Dwarf_info_reader::do_read_string_table): Check for compressed
2503         debug sections.
2504         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2505         Initialize new data members.
2506         (Dwarf_pubnames_table::next_name): return flag_byte.
2507         (Dwarf_pubnames_table::end_of_table_): New data member.
2508         (Dwarf_pubnames_table::is_gnu_style_): New data member.
2509         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
2510         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
2511         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
2512         read skeleton type unit DIEs.
2513         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
2514         (Gdb_index::do_write): Write flag_byte.
2515         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
2516         (Gdb_index::Cu_vector): Store flags along with cu indexes.
2517         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
2518         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
2519
2520 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
2521
2522         * version.cc (print_version): Update copyright year to 2014.
2523
2524 2013-12-19  Dimitry Andric  <dimitry@andric.com>
2525
2526         * stringpool.cc (Stringpool_template::reserve): Add
2527         HAVE_UNORDERED_MAP case.
2528         * stringpool.cc (Stringpool_template::print_stats): Likewise.
2529
2530 2013-12-18  Cary Coutant  <ccoutant@google.com>
2531
2532         * configure.ac: Check for <unordered_set> and <unordered_map>.
2533         * config.in: Regenerate.
2534         * configure: Regenerate.
2535         * system.h: Use <unordered_set> and <unordered_map> if available.
2536
2537 2013-12-10  Roland McGrath  <mcgrathr@google.com>
2538
2539         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
2540         with $(INSTALL_PROGRAM_ENV).
2541         * Makefile.in: Regenerate.
2542
2543 2013-11-22  Cary Coutant  <ccoutant@google.com>
2544
2545         * configure.ac: Add check for which library is needed for
2546         dlopen.
2547         * configure: Regenerate.
2548
2549 2013-11-22  Cary Coutant  <ccoutant@google.com>
2550
2551         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
2552         assembler.
2553         * testsuite/Makefile.in: Regenerate.
2554
2555 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
2556
2557         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
2558         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
2559         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
2560         (Target_x86_64<size>::Scan::local): Likewise.
2561         (Target_x86_64<size>::Scan::global): Likewise.
2562         (Target_x86_64<size>::Relocate::relocate): Likewise.
2563         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
2564         Likewise.
2565         (Target_x86_64<size>::Scan::check_non_pic(): Handle
2566         R_X86_64_PC32_BND.
2567
2568         * testsuite/Makefile.am (check_PROGRAMS): Add
2569         exception_x86_64_bnd_test.
2570         (exception_x86_64_bnd_test_SOURCES): New macro.
2571         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
2572         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
2573         (exception_x86_64_bnd_test_LDADD): Likewise.
2574         (exception_x86_64_bnd_1.o): New rule.
2575         (exception_x86_64_bnd_2.o): Likewise.
2576         * testsuite/Makefile.in: Regenerated.
2577
2578 2013-11-15  Alan Modra  <amodra@gmail.com>
2579
2580         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
2581         accessor.
2582         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
2583         Only call ppc64_local_entry_offset for 64-bit.  Restrict
2584         symval_for_branch lookup to ELFv1.
2585         (Stub_table::add_plt_call_entry): Use unsigned int off.
2586         (Output_data_glink::Address, invalid_address): New.
2587         (Output_data_glink::add_eh_frame): Move out of line.  Add
2588         support for ELFv2.
2589         (Output_data_glink::add_global_entry, find_global_entry,
2590         global_entry_address): New functions.
2591         (Output_data_glink::global_entry_stubs_, end_branch_table_,
2592         ge_size): New variables.
2593         (Output_data_glink::set_final_data_size): Add global entry
2594         stub sizing.
2595         (Output_data_glink::do_write): Write global entry stubs.
2596         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
2597         parameter.  Return true for ELFv2.  Adjust callers.
2598         (Target_powerpc::Scan::local, global): Restrict opd lookup to
2599         ELFv1.  Similarly for ifunc and dynamic relocation processing
2600         specific to ELFv1.  Recognize that symbols are defined on
2601         their plt entries for ELFv2.
2602         (Target_powerpc::symval_for_branch): Assert if called for
2603         ELFv2 or ppc32.
2604         (Target_powerpc::Relocate::relocate): Use global entry plt
2605         stub for symbol value if such exists on ELFv2.
2606         (Target_powerpc::Relocate::relocate): Don't call
2607         symval_for_branch when ELFv2.  Do adjust for local entry
2608         offset when ELFv2.
2609         (Target_powerpc::do_dynsym_value): Set symbols to global entry
2610         plt stub for ELFv2.
2611         (Target_powerpc::do_plt_address_for_global): Similarly.
2612
2613 2013-11-14  Cary Coutant  <ccoutant@google.com>
2614
2615         Revert patch -- this did not fix the problem, and there is
2616         no race there.
2617
2618         2013-11-14  Cary Coutant  <ccoutant@google.com>
2619
2620             PR gold/14860
2621             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2622             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2623             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2624             updating fde_offsets_.
2625             (Eh_frame_hdr::lock_): New data member.
2626
2627 2013-11-14  Cary Coutant  <ccoutant@google.com>
2628
2629         * dwp.cc (Dwo_file_entry): New type.
2630         (File_list): Use Dwo_file_entry.
2631         (Dwo_file::verify): New function.
2632         (Dwo_file::verify_dwo_list): New function.
2633         (Dwo_file::sized_verify_dwo_list): New function.
2634         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
2635         list.
2636         (Dwp_options): New enum type.
2637         (dwp_options): Add --verify-only.
2638         (usage): Likewise.
2639         (main): Likewise.
2640         * dwp.h (gold_info): Add declaration.
2641
2642 2013-11-14  Cary Coutant  <ccoutant@google.com>
2643
2644         PR gold/14860
2645         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2646         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2647         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2648         updating fde_offsets_.
2649         (Eh_frame_hdr::lock_): New data member.
2650
2651 2013-11-06  Cary Coutant  <ccoutant@google.com>
2652
2653         PR gold/15758
2654         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
2655         before reloc sections.
2656
2657 2013-11-04  Alan Modra  <amodra@gmail.com>
2658
2659         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
2660         (Symbol::needs_dynamic_reloc): Test new flag.
2661         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
2662         (Target_powerpc::Scan::get_reference_flags): Add target param.
2663         Return FUNC_DESC_ABI for 64-bit ELFv1.
2664         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
2665         call.
2666         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
2667         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
2668
2669 2013-10-31  Cary Coutant  <ccoutant@google.com>
2670
2671         Restore support for dwp v2 DWARF package file format.
2672
2673         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2674         tu_length parameter.  Adjust all callers.
2675         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2676         * dwp.cc: Include dwarf.h.
2677         (Section_bounds): New struct type.
2678         (Unit_set): New struct type.
2679         (Dwo_file::Dwo_file): Initialize new data member.
2680         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2681         Combine and rename to...
2682         (Dwo_file::read_unit_index): ...this.
2683         (Dwo_file::sized_read_compunit_index)
2684         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2685         (Dwo_file::sized_read_unit_index): ...this.
2686         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2687         parameters; add section_id parameter.
2688         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2689         (Dwo_file::add_unit_set): ...this.
2690         (Dwo_file::shndx_map_): Remove.
2691         (Dwo_file::sect_offsets_): New data member.
2692         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2693         (Dwp_output_file::add_section): Rename to...
2694         (Dwp_output_file::add_contribution): ...this.
2695         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2696         (Dwp_output_file::add_tu_set): Likewise.
2697         (Dwp_output_file::Contribution): New type.
2698         (Dwp_output_file::Section::contributions): New data member.
2699         (Dwp_output_file::Cu_or_tu_set): Remove.
2700         (Dwp_output_file::Section::Section): New ctor.
2701         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2702         (Dwp_output_file::Dwp_index::Section_table): New type.
2703         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2704         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2705         parameter.
2706         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2707         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2708         (Dwp_output_file::Dwp_index::section_table): New member function.
2709         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2710         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2711         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2712         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2713         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2714         (Dwp_output_file::Dwp_index::section_table_): New data member.
2715         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2716         (Dwp_output_file::add_output_section): New member function.
2717         (Dwp_output_file::write_new_section): New member function.
2718         (Dwp_output_file::write_contributions): New member function.
2719         (Dwp_output_file::section_id_map_): New data member.
2720         (class Dwo_id_info_reader): Remove.
2721         (class Unit_reader): New class.
2722         (get_dwarf_section_name): New function.
2723         (Dwo_file::read_executable): Adjust initializations of class data.
2724         (Dwo_file::read): Add support for v2 package file format.
2725         (Dwo_file::read_unit_index): Likewise.
2726         (Dwo_file::sized_read_unit_index): Likewise.
2727         (Dwo_file::copy_section): Likewise.
2728         (Dwo_file::add_unit_set): Likewise.
2729         (Dwp_output_file::add_output_section): Likewise.
2730         (Dwp_output_file::add_contribution): Likewise.
2731         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2732         for empty slot.
2733         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2734         file format.
2735         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2736         slot.
2737         (Dwp_output_file::initialize): Remove unused function.
2738         (Dwp_output_file::finalize): Add support for v2 package file format.
2739         (Dwp_output_file::write_index): Likewise.
2740         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2741         function prototype.
2742
2743 2013-10-31  Cary Coutant  <ccoutant@google.com>
2744
2745         * configure.ac: Fix check for -fmerge-constants.
2746         * configure.ac: Regenerate.
2747
2748 2013-10-30  Roland McGrath  <mcgrathr@google.com>
2749
2750         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
2751         Correct 9-byte nop sequence to match what the assembler generates.
2752
2753 2013-10-30  Alan Modra  <amodra@gmail.com>
2754
2755         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
2756         ppc64_local_entry_offset, ppc64_local_entry_offset,
2757         do_read_symbols): New functions.
2758         (Powerpc_relobj::e_flags_, st_other_): New vars.
2759         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
2760         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
2761         (Powerpc_relobj::e_flags_): New var.
2762         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
2763         and adjust for ELFv2.
2764         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
2765         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
2766         (Powerpc_dynobj::do_find_special_sections): Likewise.
2767         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
2768         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
2769         to ELFv2 local entry.
2770         (Target_powerpc::do_relax): No thread safe barriers needed for
2771         ELFv2.
2772         (Output_data_plt_powerpc::initial_plt_entry_size_,
2773         plt_entry_size): Delete.  Replace all uses with
2774         first_plt_entry_offset() and plt_entry_size().
2775         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
2776         reserved_size parm.  Update callers.
2777         (Output_data_plt_powerpc::entry_count): Update.
2778         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
2779         and use Target_powerpc::first_plt_entry_offset().
2780         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
2781         rename to plt_entry_size.
2782         (Output_data_plt_powerpc::add_ifunc_entry,
2783         add_local_ifunc_entry): Adjust reloc for ELFv2.
2784         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
2785         (glink_eh_frame_fde_64v2): New.
2786         (Stub_table::plt_call_size): Support ELFv2 sizing.
2787         (Output_data_glink::add_eh_frame): Use the new FDE.
2788         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
2789         (Stub_table::do_write): Write ELFv2 stubs and glink.
2790         (Target_powerpc::Relocate::relocate): Replaces nop after call
2791         with ld 2,24(1) and adjust local offset destination for ELFv2.
2792
2793 2013-10-30  Alan Modra  <amodra@gmail.com>
2794
2795         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
2796         (Target_powerpc::Scan::global, local): Likewise.
2797         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
2798         on all ppc64 @h and @ha relocs.
2799
2800 2013-10-14  Alan Modra  <amodra@gmail.com>
2801
2802         * output.h (Output_data_got::add_constant): Tidy.
2803         (Output_data_got::add_constant_pair): New function.
2804         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
2805         methods used so as to first call reserve_ent().
2806
2807 2013-10-11  Roland McGrath  <mcgrathr@google.com>
2808
2809         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
2810         add_got_entry and add_got_entry_pair.
2811
2812         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
2813         (HAVE_PUBNAMES): Likewise.
2814         * configure: Regenerate.
2815
2816         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
2817         * testsuite/Makefile.in: Regenerate.
2818
2819         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
2820         Remove const from declaration.
2821         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
2822         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
2823         * output.h (Output_file_header): Remove const from member target_
2824         and corresponding constructor argument.
2825         * output.cc (Output_file_header::Output_file_header): Update prototype.
2826         (Output_file_header::do_sized_write): Use this->target_ in place
2827         of parameters()->target().
2828
2829         * testsuite/undef_symbol.cc (Foo::get_a): New method.
2830
2831         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
2832         * configure: Regenerate.
2833         * Makefile.in: Regenerate.
2834         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
2835         * testsuite/merge_string_literals_2.c: Likewise.
2836         * testsuite/Makefile.am
2837         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
2838         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
2839         literal -fmerge-constants.
2840         * testsuite/Makefile.in: Regenerate.
2841
2842         * i386.cc (Target_i386): Remove unused member dynbss_.
2843         * arm.cc (Target_arm): Likewise.
2844         * powerpc.cc (Target_powerpc): Likewise.
2845         * sparc.cc (Target_sparc): Likewise.
2846         * tilegx.cc (Target_tilegx): Likewise.
2847         * x86_64.cc (Target_x86_64): Likewise.
2848         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
2849         type_signature_, type_offset_.
2850         * plugin.h (Plugin_hook): Remove unused member layout_.
2851         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
2852         mapfile_.
2853         (Read_member): Remove unused members input_objects_, symtab_,
2854         mapfile_, layout_.
2855         (Check_library): Remove unused member symtab_.
2856         * archive.h (Lib_group): Remove unused member lib_.
2857         * archive.cc (Lib_group::Lib_group): Update initializer.
2858         * incremental.h (Incremental_binary): Remove unused member target_.
2859         (Incremental_script_entry): Removed unused member script_.
2860         * layout.h (Write_symbols_task): Remove unused member input_objects_.
2861         * icf.h (Icf): Remove unused member num_tracked_relocs.
2862
2863         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
2864         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
2865         its only use.
2866         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
2867
2868         * archive.h: Use struct rather than class for forward declaration
2869         of Read_symbols_data.
2870
2871 2013-10-07  Cary Coutant  <ccoutant@google.com>
2872
2873         PR gold/16010
2874         * testsuite/Makefile.am (icf_test): Fix dependencies.
2875         (icf_safe_test): Likewise.
2876         (icf_safe_so_test): Likewise.
2877         (large_symbol_alignment): Add empty _LDADD rule.
2878         * testsuite/Makefile.in: Regenerate.
2879
2880 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
2881
2882         PR gold/15927
2883         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
2884         relocation for R_X86_64_32 on x32.
2885
2886 2013-08-27  Roland McGrath  <mcgrathr@google.com>
2887
2888         * output.cc (Output_segment::set_section_addresses): Take new
2889         Target* argument.  If target->isolate_execinstr() and the segment
2890         is executable and starts at a target->abi_pagesize() boundary,
2891         pad its end out to a target->abi_pagesize() boundary with code fill.
2892         * output.h (Output_segment::set_section_addresses): Update decl.
2893         * layout.h (Layout::check_output_data_for_reset_values): Take new
2894         argument RELAX_OUTPUTS.
2895         (Layout): New member relax_output_list_.
2896         (Layout::add_relax_output): New method.
2897         * layout.cc (Layout::Layout): Update constructor.
2898         (Layout::reset_relax_output): New method.
2899         (Layout::clean_up_after_relaxation): Call it.
2900         (Layout::prepare_for_relaxation): Update caller.
2901         (Layout::set_segment_offsets): Update callers of set_section_addresses.
2902         Call reset_relax_output before re-processing segments for
2903         isolate_execinstr case.
2904         (Layout::write_data): Handle relax_output_list_.
2905         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
2906         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
2907
2908 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
2909
2910         PR binutils/15834
2911         * object.h: Fix typos.
2912
2913 2013-08-16  Roland McGrath  <mcgrathr@google.com>
2914
2915         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
2916         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
2917
2918 2013-08-07  Cary Coutant  <ccoutant@google.com>
2919
2920         Revert support for v2 DWP files:
2921
2922         2013-03-01  Cary Coutant  <ccoutant@google.com>
2923
2924             Add dwp support for v2 DWARF package file format.
2925             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2926             tu_length parameter.  Adjust all callers.
2927             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2928             * dwp.cc: Include dwarf.h.
2929             (Section_bounds): New struct type.
2930             (Unit_set): New struct type.
2931             (Dwo_file::Dwo_file): Initialize new data member.
2932             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2933             Combine and rename to...
2934             (Dwo_file::read_unit_index): ...this.
2935             (Dwo_file::sized_read_compunit_index)
2936             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2937             (Dwo_file::sized_read_unit_index): ...this.
2938             (Dwo_file::copy_section): Remove section_name, is_str_offsets
2939             parameters; add section_id parameter.
2940             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2941             (Dwo_file::add_unit_set): ...this.
2942             (Dwo_file::shndx_map_): Remove.
2943             (Dwo_file::sect_offsets_): New data member.
2944             (Dwp_output_file::Dwp_output_file): Initialize new data members.
2945             (Dwp_output_file::add_section): Rename to...
2946             (Dwp_output_file::add_contribution): ...this.
2947             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2948             (Dwp_output_file::add_tu_set): Likewise.
2949             (Dwp_output_file::Contribution): New type.
2950             (Dwp_output_file::Section::contributions): New data member.
2951             (Dwp_output_file::Cu_or_tu_set): Remove.
2952             (Dwp_output_file::Section::Section): New ctor.
2953             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2954             (Dwp_output_file::Dwp_index::Section_table): New type.
2955             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2956             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2957             parameter.
2958             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2959             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2960             (Dwp_output_file::Dwp_index::section_table): New member function.
2961             (Dwp_output_file::Dwp_index::section_table_end): New member function.
2962             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2963             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2964             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2965             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2966             (Dwp_output_file::Dwp_index::section_table_): New data member.
2967             (Dwp_output_file::Dwp_index::section_mask_): New data member.
2968             (Dwp_output_file::add_output_section): New member function.
2969             (Dwp_output_file::write_new_section): New member function.
2970             (Dwp_output_file::write_contributions): New member function.
2971             (Dwp_output_file::section_id_map_): New data member.
2972             (class Dwo_id_info_reader): Remove.
2973             (class Unit_reader): New class.
2974             (get_dwarf_section_name): New function.
2975             (Dwo_file::read_executable): Adjust initializations of class data.
2976             (Dwo_file::read): Add support for v2 package file format.
2977             (Dwo_file::read_unit_index): Likewise.
2978             (Dwo_file::sized_read_unit_index): Likewise.
2979             (Dwo_file::copy_section): Likewise.
2980             (Dwo_file::add_unit_set): Likewise.
2981             (Dwp_output_file::add_output_section): Likewise.
2982             (Dwp_output_file::add_contribution): Likewise.
2983             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2984             for empty slot.
2985             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2986             file format.
2987             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2988             slot.
2989             (Dwp_output_file::initialize): Remove unused function.
2990             (Dwp_output_file::finalize): Add support for v2 package file format.
2991             (Dwp_output_file::write_index): Likewise.
2992             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2993             function prototype.
2994
2995 2013-07-31  Cary Coutant  <ccoutant@google.com>
2996
2997         * object.cc (Sized_relobj::do_output_section_address): New function.
2998         (Sized_relobj): Instantiate explicitly.
2999         * object.h (Object::output_section_address): New function.
3000         (Object::do_output_section_address): New function.
3001         (Sized_relobj::do_output_section_address): New function.
3002         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
3003
3004 2013-07-30  Cary Coutant  <ccoutant@google.com>
3005             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
3006
3007         * parameters.cc (Parameters::entry): Return target-specific entry
3008         symbol name.
3009         * target.h (Target::entry_symbol_name): New function.
3010         (Target_info::entry_symbol_name): New data member.
3011
3012         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
3013         * i386.cc (Target_i386::i386_info): Likewise.
3014         (Target_i386_nacl::i386_nacl_info): Likewise.
3015         * sparc.cc (Target_sparc::sparc_info): Likewise.
3016         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
3017         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
3018         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
3019         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3020
3021 2013-07-22  Sterling Augustine  <saugustine@google.com>
3022
3023         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
3024         Convert parameter shndx to local variable. Add parameters symtab
3025         and symtab_size.  Scan over section names.  Find relocation
3026         section corresponding to current section.  Create and initialize
3027         reloc_mapper_ and reloc_type_.
3028         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
3029         unit_length to off_t.  Initialize member unit_length_.  Fill in field
3030         cu_offset_.
3031         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
3032         Initialize new fields unit_length_ and cu_offset_.
3033         (Dwarf_pubnames_table::read_section): Update prototype.
3034         (Dwarf_pubnames_table::cu_offset): New member function.
3035         (Dwarf_pubnames_table::subsection_size): Likewise.
3036         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
3037         New fields.
3038         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
3039         member functions public.
3040         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
3041         Update comment.  Rework logic.  Move repeated parts to...
3042         (Gdb_index_info_reader::read_pubtable): ...here. New function.
3043         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
3044         pubtypes_table_, and stmt_list_offset.
3045         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
3046         Gdb_index::find_pubtype_offset,
3047         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
3048         (Gdb_index::pubnames_read): Update prototype and rework logic.
3049         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
3050         Forward declare.
3051         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
3052         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
3053         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
3054         Gdb_index::map_pubtable_to_dies):
3055         Declare functions.
3056         (Gdb_index::pubnames_read): Update declaration.
3057         (Gdb_index::Pubname_offset_map): New type.
3058         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
3059         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
3060         Gdb_index::stmt_list_offset): Declare.
3061         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
3062         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
3063         Gdb_index::pubtypes_offset_): Remove.
3064
3065 2013-07-19  Roland McGrath  <mcgrathr@google.com>
3066
3067         * options.h (General_options): Add -Trodata-segment option.
3068         * parameters.cc (Parameters::check_rodata_segment): New function.
3069         (Parameters::set_target_once): Call it.
3070         * parameters.h (Parameters): Declare it (private member function).
3071         * layout.cc (load_seg_unusable_for_headers): New function, broken
3072         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
3073         then validate rodata segment rather than text segment.
3074         (relaxation_loop_body): Call that.
3075         (is_text_segment): New function.  Don't admit a non-executable
3076         segment if TARGET->isolate_execinstr().
3077         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
3078
3079 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
3080
3081         PR gold/15070
3082         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
3083         * nacl.h (Sniff_file::View::View): Request aligned view.
3084
3085 2013-07-11  Cary Coutant  <ccoutant@google.com>
3086
3087         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
3088         correct BRLT entry size.
3089
3090 2013-07-03  Alan Modra  <amodra@gmail.com>
3091
3092         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
3093         comment.
3094
3095 2013-07-01  Cary Coutant  <ccoutant@google.com>
3096
3097         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
3098         reloc_type_.
3099         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
3100         (Dwarf_ranges_table::lookup_reloc): New function.
3101         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
3102         reloc_type_.
3103         (Dwarf_ranges_table::lookup_reloc): New function.
3104         (Dwarf_ranges_table::reloc_type_): New data member.
3105
3106 2013-06-27  Jing Yu  <jingyu@google.com>
3107
3108         PR gold/15662
3109         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
3110         function.
3111         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
3112         (Target_powerpc::do_relax): Call the above.
3113
3114 2013-06-27  Cary Coutant  <ccoutant@google.com>
3115
3116         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
3117         on garbage collected .opd section.
3118
3119 2013-06-27  Alan Modra  <amodra@gmail.com>
3120
3121         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
3122         is non-zero.
3123         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
3124         (Target_powerpc::do_function_location): Likewise for loc->shndx.
3125
3126 2013-06-14  Cary Coutant  <ccoutant@google.com>
3127
3128         * resolve.cc (Symbol::override_base): Don't override st_type
3129         from plugin placeholder symbols.
3130         (Symbol_table::resolve): Likewise.
3131         (Symbol_table::should_override): Don't complain about TLS mismatch
3132         if the TO symbol is a plugin placeholder.
3133         * testsuite/Makefile.am (plugin_test_tls): New test.
3134         * testsuite/Makefile.in: Regenerate.
3135         * testsuite/plugin_test_tls.sh: New test script.
3136         * testsuite/two_file_test_2_tls.cc: New test source.
3137         * testsuite/two_file_test_tls.cc: New test source.
3138
3139 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3140
3141         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
3142         the maximum segment alignment is larger than the page size.
3143         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
3144         correctly aligns the symbols with large alignemnt.
3145         * testsuite/Makefile.in: Regenerate.
3146         * testsuite/large_symbol_alignment.cc: New file.
3147
3148 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3149             Sriraman Tallam  <tmsriram@google.com>
3150
3151         * options.h (sort_section): New option.
3152         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
3153         Rename from Input_section_sort_section_name_special_ordering_compare.
3154         (Input_section_sort_section_name_compare): New struct.
3155         * output.cc (Output_section::Input_section_sort_section_name_compare::
3156         operator()): New function.
3157         (Output_section::sort_attached_input_sections): Use new sort function
3158         for .text if --sort-section=name is specified.
3159         * layout.cc (Layout::make_output_section):
3160         Add sorting by name when --sort-section=name is specified.
3161         * testsuite/Makefile.am (text_section_grouping): Test option
3162         --sort-section=name.
3163         * testsuite/Makefile.in: Regenerate.
3164         * testsuite/section_sorting_name.cc: New file.
3165         * testsuite/section_sorting_name.sh: New file.
3166
3167 2013-05-21  Cary Coutant  <ccoutant@google.com>
3168
3169         * symtab.h (Symbol::is_cxx_vtable): New function.
3170         * target-reloc.h (relocate_section): Check for vtable symbol.
3171         * testsuite/Makefile.am (missing_key_func.sh): New test case.
3172         * testsuite/Makefile.in: Regenerate.
3173         * testsuite/missing_key_func.cc: New test source.
3174         * testsuite/missing_key_func.sh: New test script.
3175
3176 2013-05-21  Cary Coutant  <ccoutant@google.com>
3177
3178         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
3179         type of enclosing symbol.
3180         (Relocate_info::location): Check symbol type when describing symbol.
3181         * object.h (Symbol_location_info): Remove unused line_number;
3182         add enclosing_symbol_type.
3183         * testsuite/debug_msg.sh: Adjust expected output.
3184
3185 2013-05-13  Cary Coutant  <ccoutant@google.com>
3186
3187         * configure.ac: Export DEFAULT_TARGET.
3188         * configure: Regenerate.
3189         * Makefile.in: Regenerate.
3190         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
3191         * testsuite/Makefile.in: Regenerate.
3192         * testsuite/debug_msg.sh: Delete duplicate tests.
3193         Don't check undef_int error message match for powerpc where the
3194         source file and line number aren't available.
3195
3196 2013-05-10  Roland McGrath  <mcgrathr@google.com>
3197
3198         * options.h (General_options): Add --rosegment-gap option.
3199         * options.cc (finalize): --rosegment-gap implies --rosegment.
3200         * layout.cc (set_segment_offsets): Let user option override
3201         target->rosegment_gap().
3202
3203 2013-05-10  Roland McGrath  <mcgrathr@google.com>
3204
3205         * options.h (General_options): Remove leading space from help
3206         messages for -nostdlib and --rosegment.
3207
3208 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
3209
3210         PR ld/15365
3211         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
3212
3213 2013-05-03  Alan Modra  <amodra@gmail.com>
3214
3215         * merge.cc (Output_merge_string::do_add_input_section): Correct
3216         scan for number of strings.  Rename vars to avoid shadowing.
3217         Include missing terminator in input_size_.
3218
3219 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
3220
3221         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
3222         Restore empty string handling.
3223
3224 2013-05-01  Cary Coutant  <ccoutant@google.com>
3225
3226         * stringpool.cc (Stringpool_template::new_key_offset): Fix
3227         uninitialized warning.
3228
3229 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3230
3231         * output.cc (Output_section::add_merge_input_section): Allow
3232         to merge sections if the alignment is more than character size.
3233         * merge.h (Output_merge_string::Output_merge_string): Remove
3234         assert.
3235         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
3236         only not-null strings. Check the alignment of strings.
3237         * stringpool.h
3238         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
3239         alignment as the argument.
3240         (Stringpool_template<Stringpool_char>::addralign_): New class member.
3241         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
3242         Align non-zero length strings according to the addralign_.
3243         (Stringpool_template<Stringpool_char>::set_string_offsets):
3244         Updating offsets according to the given alignment.
3245         * testsuite/Makefile.am (text_section_grouping): Test if string
3246         literals are getting merged.
3247         * testsuite/Makefile.in: Regenerate.
3248         * testsuite/merge_string_literals_1.c: New file.
3249         * testsuite/merge_string_literals_2.c: Ditto.
3250         * testsuite/merge_string_literals.sh: Ditto.
3251
3252 2013-04-26  Ian Lance Taylor  <iant@google.com>
3253
3254         * target-reloc.h (relocate_section): If the reloc offset is out of
3255         range, pass VIEW as NULL to relocate.relocate.
3256         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
3257         * i386.cc (Target_i386::Relocate::relocate): Likewise.
3258         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
3259         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
3260         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
3261         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3262
3263 2013-04-26  Geoff Pike  <gpike@chromium.org>
3264
3265         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
3266         * layout.cc (Hash_task): New class.
3267         (Layout::queue_build_id_tasks): New function.
3268         (Layout::write_build_id): Handle single-thread portion of build ID
3269         computation.  (In some cases, all of it is single-threaded.)  Replace
3270         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
3271         functionality in fewer lines of code.
3272         * layout.h (Layout::queue_build_id_tasks): New function declaration.
3273         * options.h (General_options): make "--build-id" default to tree
3274         rather than sha1.  Add two new options related to --build-id=tree:
3275         --build-id-chunk-size-for-treehash and
3276         --build-id-min-file-size-for-treehash.
3277         * Makefile.am: add testing of --build-id=tree and related new options
3278         (these tests will be invoked by "make check").
3279         * Makefile.in: Regenerate.
3280
3281 2013-04-25  Alan Modra  <amodra@gmail.com>
3282
3283         * configure.tgt: Add powerpcle and powerpc64le.
3284
3285 2013-04-22  Alan Modra  <amodra@gmail.com>
3286
3287         PR gold/15355
3288         * layout.cc (Layout::segment_precedes): Allow more than one
3289         segment with the same type and flags.
3290
3291 2013-04-15  Cary Coutant  <ccoutant@google.com>
3292
3293         * layout.cc (Layout::set_relocatable_section_offsets): Don't
3294         allocate space in file for BSS sections.
3295
3296 2013-04-15  Cary Coutant  <ccoutant@google.com>
3297
3298         * script-sections.cc (Orphan_output_section): Reset address
3299         to zero after each orphaned section for relocatable links.
3300
3301 2013-04-15  Cary Coutant  <ccoutant@google.com>
3302
3303         * symtab.cc (Symbol_table::sized_write_globals): Subtract
3304         section starting address for relocatable link.
3305         * testsuite/Makefile.am (script_test_11): New test.
3306         * testsuite/Makefile.in: Regenerate.
3307         * testsuite/script_test_11.c: New source file.
3308         * testsuite/script_test_11.t: New linker script.
3309
3310 2013-04-13  Alan Modra  <amodra@gmail.com>
3311
3312         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
3313         owner when sections are not adjacent and exceed group size.
3314         (Target_powerpc::group_sections): Handle corner case.
3315         (Target_powerpc::Branch_info::make_stub): Handle case where
3316         stub table doesn't exist due to branches in non-exec sections.
3317         (Target_powerpc::Relocate::relocate): Likewise.
3318
3319 2013-04-11  Alan Modra  <amodra@gmail.com>
3320
3321         PR gold/15354
3322         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
3323         .branch_lt to match bfd ld.  Adjust comments throughout file.
3324
3325 2013-04-04  Ian Lance Taylor  <iant@google.com>
3326
3327         GCC PR c++/56840
3328         * object.cc (do_layout_deferred_sections): Handle .eh_frame
3329         sections before checking whether they are included in the link.
3330
3331 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
3332
3333         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
3334         object before calling the plugin claim_file handler.  Pass the elf
3335         object of the archive to the plugin. Delete the elf object if the
3336         plugin claims the file.
3337
3338 2013-03-21  Alan Modra  <amodra@gmail.com>
3339
3340         * layout.cc (Layout::set_segment_offsets): Accept writable .text
3341         segment when omagic.
3342
3343 2013-03-21  Alan Modra  <amodra@gmail.com>
3344
3345         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
3346         comparison warning.
3347         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
3348         uninitialized" warning.
3349
3350 2013-03-20  Alan Modra  <amodra@gmail.com>
3351
3352         * symtab.h (Symbol::clear_version): New function.
3353         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
3354         is_needed by weak references.  Clear version for symbols defined
3355         in as-needed objects that are not needed.
3356
3357 2013-03-15  Alan Modra  <amodra@gmail.com>
3358
3359         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
3360         static and public.  Add report_err param.  Return false for data refs.
3361         (Target_powerpc::rela_dyn_section): New overloaded function.
3362         (Target_powerpc::plt_, iplt_): Elucidate.
3363         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
3364         (Output_data_plt_powerpc::do_write): Don't write .iplt.
3365         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
3366         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
3367         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
3368         push_branch and make_plt_entry for ifunc syms when
3369         reloc_needs_plt_for_ifunc.
3370         (Target_powerpc::Relocate::relocate): Don't use plt entry value
3371         for ifunc unless reloc_needs_plt_for_ifunc.
3372
3373 2013-03-15  Alan Modra  <amodra@gmail.com>
3374
3375         * gc.h (gc_process_relocs): Don't look through function descriptors.
3376         * icf.cc (get_section_contents): Do so here instead.
3377
3378 2013-03-13  Alan Modra  <amodra@gmail.com>
3379
3380         * powerpc.cc (is_branch_reloc): Forward declare.
3381         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
3382         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
3383         false for 64-bit, true for 32-bit non-branch relocs.
3384         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
3385         * testsuite/Makefile.am (icf_test): Use linker map file instead of
3386         nm output.
3387         (icf_safe_test): Generate linker map file as well as nm output.
3388         (icf_safe_so_test): Likewise.
3389         * testsuite/Makefile.in: Regenerate.
3390         * testsuite/icf_test.sh: Parse linker map file to determine
3391         section folding.
3392         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
3393         * testsuite/icf_safe_so_test.sh: Likewise.
3394         (X86_32_or_ARM_specific_safe_fold): Merge into..
3395         (arch_specific_safe_fold): ..this.
3396         (X86_64_specific_safe_fold): Delete unused function.
3397
3398 2013-03-12  Alan Modra  <amodra@gmail.com>
3399
3400         * gc.h (gc_process_relocs): Look through function descriptors
3401         to determine shndx, symvalue and addend used by ICF.  Tidy
3402         variable duplication.
3403
3404 2013-03-11  Alan Modra  <amodra@gmail.com>
3405
3406         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
3407         * layout.cc (Layout_task_runner::run): ..to here.
3408         * symtab.h (struct Symbol_location): Extract from..
3409         (class Symbol_table): ..here.
3410         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
3411         * target.h (class Target): Add function_location and
3412         do_function_location functions.
3413         (class Sized_target): Add do_function_location.
3414         * object.h (class Sized_relobj_file): Move find_shdr..
3415         (class Object): ..to here.
3416         * object.cc: Likewise.  Update to suit.  Instantiate.
3417         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
3418         * powerpc.cc (class Powerpc_dynobj): New.
3419         (Target_powerpc::do_function_location): New function.
3420         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
3421         (Powerpc_dynobj::do_read_symbols): New function.
3422         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
3423
3424 2013-03-08  Ian Lance Taylor  <iant@google.com>
3425
3426         * options.cc (General_options::string_to_object_format): Accept
3427         "default".
3428
3429 2013-03-08  Alan Modra  <amodra@gmail.com>
3430
3431         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
3432         pointer to Post_fde.
3433         (struct Post_fde): Move definition to here..
3434         * ehframe.cc (struct Post_fde): ..from here.
3435         (Cie::write): Don't alloc Post_fde.
3436         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
3437
3438 2013-03-07  Alan Modra  <amodra@gmail.com>
3439
3440         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
3441         relocation referencing .LC0.
3442         * testsuite/discard_locals_test.sh: Remove FIXMEs.
3443
3444 2013-03-07  Alan Modra  <amodra@gmail.com>
3445
3446         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
3447         always_inline.  Add assembly for powerpc to avoid GOT.
3448
3449 2013-03-07  Alan Modra  <amodra@gmail.com>
3450
3451         * testsuite/script_test_10.sh: Don't test .bss section
3452         header number.
3453
3454 2013-03-06  Alan Modra  <amodra@gmail.com>
3455
3456         * powerpc.cc (class Powerpc_relobj): Move some member functions.
3457         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
3458         all callers.  Handle folded sections.
3459         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
3460         to Powerpc_relobj.
3461         (Global_symbol_visitor_opd::operator()): Likewise.
3462
3463 2013-03-04  Alan Modra  <amodra@gmail.com>
3464
3465         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
3466         * testsuite/Makefile.in: Regenerate.
3467
3468 2013-03-01  Cary Coutant  <ccoutant@google.com>
3469
3470         Add dwp support for v2 DWARF package file format.
3471         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
3472         tu_length parameter.  Adjust all callers.
3473         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
3474         * dwp.cc: Include dwarf.h.
3475         (Section_bounds): New struct type.
3476         (Unit_set): New struct type.
3477         (Dwo_file::Dwo_file): Initialize new data member.
3478         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
3479         Combine and rename to...
3480         (Dwo_file::read_unit_index): ...this.
3481         (Dwo_file::sized_read_compunit_index)
3482         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
3483         (Dwo_file::sized_read_unit_index): ...this.
3484         (Dwo_file::copy_section): Remove section_name, is_str_offsets
3485         parameters; add section_id parameter.
3486         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
3487         (Dwo_file::add_unit_set): ...this.
3488         (Dwo_file::shndx_map_): Remove.
3489         (Dwo_file::sect_offsets_): New data member.
3490         (Dwp_output_file::Dwp_output_file): Initialize new data members.
3491         (Dwp_output_file::add_section): Rename to...
3492         (Dwp_output_file::add_contribution): ...this.
3493         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
3494         (Dwp_output_file::add_tu_set): Likewise.
3495         (Dwp_output_file::Contribution): New type.
3496         (Dwp_output_file::Section::contributions): New data member.
3497         (Dwp_output_file::Cu_or_tu_set): Remove.
3498         (Dwp_output_file::Section::Section): New ctor.
3499         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
3500         (Dwp_output_file::Dwp_index::Section_table): New type.
3501         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
3502         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
3503         parameter.
3504         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
3505         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
3506         (Dwp_output_file::Dwp_index::section_table): New member function.
3507         (Dwp_output_file::Dwp_index::section_table_end): New member function.
3508         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
3509         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
3510         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
3511         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
3512         (Dwp_output_file::Dwp_index::section_table_): New data member.
3513         (Dwp_output_file::Dwp_index::section_mask_): New data member.
3514         (Dwp_output_file::add_output_section): New member function.
3515         (Dwp_output_file::write_new_section): New member function.
3516         (Dwp_output_file::write_contributions): New member function.
3517         (Dwp_output_file::section_id_map_): New data member.
3518         (class Dwo_id_info_reader): Remove.
3519         (class Unit_reader): New class.
3520         (get_dwarf_section_name): New function.
3521         (Dwo_file::read_executable): Adjust initializations of class data.
3522         (Dwo_file::read): Add support for v2 package file format.
3523         (Dwo_file::read_unit_index): Likewise.
3524         (Dwo_file::sized_read_unit_index): Likewise.
3525         (Dwo_file::copy_section): Likewise.
3526         (Dwo_file::add_unit_set): Likewise.
3527         (Dwp_output_file::add_output_section): Likewise.
3528         (Dwp_output_file::add_contribution): Likewise.
3529         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
3530         for empty slot.
3531         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
3532         file format.
3533         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
3534         slot.
3535         (Dwp_output_file::initialize): Remove unused function.
3536         (Dwp_output_file::finalize): Add support for v2 package file format.
3537         (Dwp_output_file::write_index): Likewise.
3538         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
3539         function prototype.
3540
3541 2013-03-01  Cary Coutant  <ccoutant@google.com>
3542
3543         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
3544         function into class definition in header file.
3545         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
3546         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
3547         New function.
3548         (Dwarf_info_reader::check_buffer): Move here from .cc file.
3549
3550 2013-02-28  Alan Modra  <amodra@gmail.com>
3551
3552         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
3553         * target.cc (Target::do_plt_fde_location): New function.
3554         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
3555         accessor function, and constructor param.
3556         (struct Post_fde, Post_fdes): Declare.
3557         (Cie::write): Add post_fdes param.
3558         * ehframe.cc (Fde::write): Use plt_fde_location.
3559         (struct Post_fde): Define.
3560         (Cie::write): Stash FDEs added post merge mapping.
3561         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
3562         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
3563         (Eh_frame::do_sized_write): Arrange to write post map FDES after
3564         other FDEs.
3565         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
3566         (Target_powerpc::has_glink): New function.
3567         (Target_powerpc::do_relax): Add eh_frame info for stubs.
3568         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
3569         glink_eh_frame_fde_32, default_fde): New data.
3570         (Stub_table::eh_frame_added_): New var.
3571         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
3572         Make const.
3573         (Stub_table::add_eh_frame): New function.
3574         (Output_data_glink::add_eh_frame): New function.
3575         (Target_powerpc::make_glink_section): Call add_eh_frame.
3576
3577 2013-02-15  Ian Lance Taylor  <iant@google.com>
3578
3579         * options.h (DEFINE_uint64_alias): Define.
3580         (class General_options): Add -Ttext-segment as an alias for
3581         -Ttext.
3582
3583 2013-02-15  Alan Modra  <amodra@gmail.com>
3584
3585         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
3586         (Stub_table::do_write): ..here, two places.
3587         (Stub_table::plt_call_size): Use it here too.
3588
3589 2013-02-11  Ian Lance Taylor  <iant@google.com>
3590
3591         * descriptors.cc (Descriptors::close_all): New function.
3592         * descriptors.h (class Descriptors): Declare close_all.
3593         (close_all_descriptors): New inline function.
3594         * plugin.cc: Include "descriptors.h".
3595         (Plugin_manager::cleanup): Call close_all_descriptors.
3596
3597 2013-02-06  Alan Modra  <amodra@gmail.com>
3598
3599         * README: Update coding style link.
3600
3601 2013-01-28  Cary Coutant  <ccoutant@google.com>
3602
3603         * dwp.cc (File_list): New typedef.
3604         (Dwo_name_info_reader): New class.
3605         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
3606         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
3607         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
3608         (Dwo_file::read_executable): New function.
3609         (Dwo_file::read): Move common setup code to ...
3610         (Dwo_file::make_object): ... here.
3611         (dwp_options): Add --exec/-e.
3612         (usage): Likewise.
3613         (main): Likewise.
3614
3615 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
3616
3617         * layout.cc (Layout::layout): Check for option text_reorder.
3618         (Layout::make_output_section): Ditto.
3619         * options.h (text_reorder): New option.
3620         * output.cc (Input_section_sort_compare): Remove special ordering
3621         of section names.
3622         (Output_section::
3623          Input_section_sort_section_name_special_ordering_compare::
3624          operator()): New function.
3625         (Output_section::sort_attached_input_sections): Use new sort function
3626         for .text.
3627         * output.h (Input_section_sort_section_name_special_ordering_compare):
3628         New struct.
3629         * testsuite/Makefile.am (text_section_grouping): Test option
3630         --no-text-reorder
3631         * testsuite/Makefile.in: Regenerate.
3632         * testsuite/text_section_grouping.sh: Check order of functions without
3633         default text reordering.
3634
3635 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3636
3637         * options.h (General_options): Change default to true for new_dtags.
3638
3639 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3640
3641         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
3642         when enable_new_dtags is false.  Only add DT_RUNPATH when
3643         enable_new_dtags is true.
3644
3645 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
3646
3647         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
3648         used in declaration and definition consistent.
3649         (Target_powerpc::symval_for_branch): Ditto.
3650
3651 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3652
3653         * testsuite/plugin_final_layout.cc: Fix comment.
3654
3655 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3656
3657         * layout.cc (Layout::layout): Do not do default sorting for
3658         text sections when section ordering is specified.
3659         (make_output_section): Ditto.
3660         * testsuite/plugin_final_layout.cc: Name the function sections
3661         to catch reordering issues.
3662
3663 2013-01-15  Alan Modra  <amodra@gmail.com>
3664
3665         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
3666         plt-thread-safe.
3667
3668 2013-01-15  Alan Modra  <amodra@gmail.com>
3669
3670         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
3671         * testsuite/Makefile.in: Regenerate.
3672
3673 2013-01-14  Alan Modra  <amodra@gmail.com>
3674
3675         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
3676         * testsuite/Makefile.in: Regenerate.
3677
3678 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
3679
3680         PR bfd/14430
3681         Fix mingw gold build with plugins enabled
3682         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
3683         * configure.ac: Export DLOPEN_LIBS and add headers check.
3684         * plugin.cc: Handle non-dlfcn case.
3685         * Makefile.in: Regenerate.
3686         * config.in: Regenerate.
3687         * configure: Regenerate.
3688         * testsuite/Makefile.in: Regenerate.
3689
3690 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
3691
3692         * output.h (sort_attached_input_sections): Change to be public.
3693         * script-sections.cc
3694         (Output_section_definition::set_section_addresses): Sort
3695         attached input sections according to section order before linker
3696         script assigns section addresses.
3697         (Orphan_output_section::set_section_addresses): Sort
3698         attached input sections according to section order before linker
3699         script assigns section addresses.
3700         * Makefile.am (final_layout.sh): Use a simple linker script to
3701         check if section ordering still works.
3702         * Makefile.in: Regenerate.
3703
3704 2013-01-09  Ben Cheng  <bccheng@google.com>
3705
3706         * arm.cc (Target_arm::attributes_accept_div): New function.
3707         (Target_arm::attributes_forbid_div): New function.
3708         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
3709         attribute using the same new functions as what bfd/elf32_arm.c
3710         does.
3711
3712 2013-01-07  Cary Coutant  <ccoutant@google.com>
3713
3714         PR gold/14993
3715         * output.cc (Output_section::add_input_section): For incremental
3716         updates, don't track input sections that are allocated from patch
3717         space.
3718
3719 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3720             Ian Lance Taylor  <iant@google.com>
3721
3722         PR gold/14897
3723         * configure.ac (--enable-ld): Removed.
3724         (install_as_default): Set to yes only for --enable-gold=default
3725         or --disable-ld.
3726         * configure: Regenerated.
3727
3728 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3729
3730         * options.h (General_options): Add -fuse-ld= for GCC linker
3731         option compatibility.
3732
3733 2013-01-04  Cary Coutant  <ccoutant@google.com>
3734
3735         * configure.ac: Fix typo restoring CXXFLAGS.
3736         * configure: Regenerate.
3737
3738 2013-01-04  Cary Coutant  <ccoutant@google.com>
3739
3740         * testsuite/Makefile.am (CXXLINK_S): New macro.
3741         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
3742         * testsuite/Makefile.in: Regenerate.
3743
3744 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
3745
3746         * version.cc (print_version): Update copyright year to 2013.
3747
3748 2012-12-20  Ian Lance Taylor  <iant@google.com>
3749
3750         * layout.cc (Layout::special_ordering_of_input_section): New
3751         function.
3752         (Layout::layout): If input section requires special ordering, must
3753         sort input sections.
3754         (Layout::make_output_section): May sort .text input sections.
3755         (Layout::is_section_name_prefix_grouped): Remove.
3756         * layout.h (class Layout): Declare
3757         special_ordering_of_input_section.  Don't declare
3758         is_section_name_prefix_grouped.
3759         * output.cc (Output_section::add_input_section): Revert last
3760         change.
3761         (Output_section::Input_section_sort::match_file_name): Don't crash
3762         if called on output section data.
3763         (Output_section::Input_section_sort_compare): Sort based on
3764         special ordering.
3765         (Output_section::Input_section_sort_section_order_index_compare):
3766         Revert last patch.
3767         (Output_section::sort_attached_input_sections): Likewise.
3768
3769 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
3770
3771         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
3772         * layout.h (Layout::is_section_name_prefix_grouped): New function.
3773         * output.cc (Output_section::add_input_section): Check if section
3774         name contains special prefix.  Keep input sections to sort such
3775         sections.
3776         (Output_section::Input_section_sort_section_order_index_compare
3777          ::operator()): Group sections according to prefixes.
3778         (Output_section::sort_attached_input_sections): Add condition to
3779         Input_section_entry constructor call.
3780         * testsuite/Makefile.am (text_section_grouping): New test.
3781         * testsuite/Makefile.in: Regenerate.
3782         * testsuite/text_section_grouping.cc: New file.
3783         * testsuite/text_section_grouping.sh: New file.
3784
3785 2012-12-17  Nick Clifton  <nickc@redhat.com>
3786
3787         * Makefile.am: Add copyright notice.
3788         * NEWS: Likewise.
3789         * README: Likewise.
3790         * configure.ac: Likewise.
3791         * ftruncate.c: Likewise.
3792         * Makefile.in: Regenerate.
3793
3794 2012-12-14  Cary Coutant  <ccoutant@google.com>
3795
3796         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
3797         --no-as-needed flag.
3798         (exception_separate_shared_12_test): Likewise.
3799         (incremental_copy_test): Likewise.
3800         * testsuite/Makefile.in: Regenerate.
3801
3802 2012-12-14  Cary Coutant  <ccoutant@google.com>
3803
3804         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
3805         (Dwp_output_file::Dwp_index::enter_set): Add assert.
3806
3807 2012-12-12  Alan Modra  <amodra@gmail.com>
3808
3809         * powerpc.cc (class Track_tls): New.
3810         (class Relocate, class Scan): Inherit Track_tls.
3811         (Target_powerpc::Scan::local, global): Track tls optimization
3812         and avoid creating plt entry for __tls_get_addr if all uses
3813         are optimized away.
3814         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
3815
3816 2012-12-12  Alan Modra  <amodra@gmail.com>
3817
3818         * options.h (General_options): Add --toc-sort/--no-toc-sort.
3819         Replace no_toc_optimize with toc_optimize.
3820         * output.h (Output_section::input_sections): Provide non-const variant.
3821         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
3822         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
3823         accessors.
3824         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
3825         (class Sort_toc_sections): New.
3826         (Target_powerpc::do_finalize_sections): Sort toc sections.
3827         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
3828
3829 2012-12-10  Roland McGrath  <mcgrathr@google.com>
3830
3831         * testsuite/binary_unittest.cc (read_all): New function.
3832         (Sized_binary_test): Use it instead of ::read.
3833         * fileread.cc (do_read): Don't assume pread always reads the whole
3834         amount in a single call.
3835
3836 2012-12-10  Alan Modra  <amodra@gmail.com>
3837
3838         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
3839         Set EM_PPC64 or EM_PPC here.
3840         (Target_selector_powerpc::do_recognize): Delete.
3841
3842 2012-12-10  Alan Modra  <amodra@gmail.com>
3843
3844         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
3845         stub_table_.
3846         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
3847
3848 2012-12-07  Roland McGrath  <mcgrathr@google.com>
3849
3850         * testsuite/binary_unittest.cc (Sized_binary_test):
3851         Use open_descriptor rather than ::open.
3852
3853 2012-12-07  Alan Modra  <amodra@gmail.com>
3854
3855         * powerpc.cc (Stub_table::do_write): Delete redundant Address
3856         typedef and invalid_address constant.
3857         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
3858         instantiate constants.
3859
3860 2012-12-06  Roland McGrath  <mcgrathr@google.com>
3861
3862         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
3863         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
3864         * aclocal.m4: Regenerate.
3865         * configure: Regenerate.
3866         * Makefile.in: Regenerate.
3867         * testsuite/Makefile.in: Regenerate.
3868
3869 2012-12-07  Alan Modra  <amodra@gmail.com>
3870
3871         * options.h (General_options): Add no_toc_optimize.
3872         * powerpc.cc (ok_lo_toc_insn): New function.
3873         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
3874
3875 2012-12-06  Alan Modra  <amodra@gmail.com>
3876
3877         * options.h (General_options): Add plt_align, plt_static_chain,
3878         plt_thread_safe.  Update stub_group_size help text.
3879         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
3880         for new plt_thread_safe_ var.
3881         (use_plt_offset): Correct comments.
3882         (Target_powerpc::do_relax): Look for thread creation symbols to
3883         determine default plt_thread_safe value.  Clear plt call stubs
3884         as well as branch stubs each iteration.
3885         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
3886         insn constants.
3887         (l, hi, ha, write_insn): Move earlier.
3888         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
3889         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
3890         plt stubs too.
3891         (Stub_table::update_size): Adjust.
3892         (Stub_table::prev_size, set_prev_size): Delete.
3893         (Stub_table::stub_align): Let --plt-align affect result.
3894         (Stub_table::plt_call_size): Calculate sizes for various stubs.
3895         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
3896         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
3897         (Stub_table::do_write): Support more stub variants.
3898
3899 2012-12-04  Alan Modra  <amodra@gmail.com>
3900
3901         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
3902         (Target_powerpc::do_define_standard_symbols): New function.
3903
3904 2012-12-03  Alan Modra  <amodra@gmail.com>
3905
3906         * output.h: Formatting, whitespace.
3907
3908 2012-12-03  Alan Modra  <amodra@gmail.com>
3909
3910         * layout.h (Layout::get_executable_sections): Declare.
3911         * layout.cc (Layout::get_executable_sections): New function.
3912         * arm.cc (Target_arm::group_sections): Use it.
3913         (Arm_output_section::group_sections): Delete now redundant test.
3914         * output.cc (Output_reloc::Output_reloc): Add is_relative.
3915         param to handle relative relocs.
3916         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
3917         (Output_data_reloc::add_absolute): Adjust.
3918         (Output_data_reloc::add_relative): New function.
3919         (Output_data::reset_data_size): New function.
3920         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
3921         (Output_section::set_addralign): New function.
3922         (Output_section::checkpoint_set_addralign): New function.
3923         (Output_section::clear_section_offsets_need_adjustment): New function.
3924         (Output_section::input_sections): Make public.
3925         * powerpc.cc (class Output_data_brlt_powerpc): New.
3926         (class Stub_table, class Stub_control): New.
3927         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
3928         stub_table_, set_stub_table, stub_table): New vectors and accessor
3929         functions.
3930         (Target_powerpc::do_may_relax, do_relax, push_branch,
3931         new_stub_table, stub_tables, brlt_section, group_sections,
3932         add_branch_lookup_table, find_branch_lookup_table,
3933         write_branch_lookup_table, make_brlt_section): New functions.
3934         (Target_powerpc::struct Sort_sections, class Branch_info): New.
3935         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
3936         branch_info_): New vars.
3937         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
3938         make call stubs here.
3939         (Output_data_glink): Remove all call stub handling from this class.
3940         (Target_powerpc::Scan::local, global): Save interesting branch
3941         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
3942         (Target_powerpc::do_finalize_sections): Only make reg save/restore
3943         functions on final link.
3944         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
3945         Handle long branch destinations too.
3946         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
3947         do_plt_address_for_local): Adjust lookup of plt call stubs.
3948
3949 2012-11-30  Alan Modra  <amodra@gmail.com>
3950
3951         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
3952         relocs against protected symbols when building 32-bit shared libs.
3953
3954 2012-11-30  Alan Modra  <amodra@gmail.com>
3955
3956         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
3957         param.  Call got_section() to make .got.  Update all callers
3958         and their callers and so on.
3959
3960 2012-11-30  Alan Modra  <amodra@gmail.com>
3961
3962         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
3963         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
3964         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
3965         value if it already exists.
3966
3967 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
3968
3969         PR gold/14858
3970         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
3971
3972 2012-11-14  Roland McGrath  <mcgrathr@google.com>
3973
3974         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
3975         than bfc instruction for data sandboxing.
3976
3977 2012-11-08  Alan Modra  <amodra@gmail.com>
3978
3979         * po/POTFILES.in: Regenerate.
3980
3981 2012-11-05  Alan Modra  <amodra@gmail.com>
3982
3983         * configure.ac: Apply 2012-09-10 change to config.in here.
3984         * configure: Regenerate.
3985
3986 2012-11-05  Alan Modra  <amodra@gmail.com>
3987
3988         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
3989         (struct Opd_ent): Use "Address" rather than "Offset".
3990         (Output_data_got_powerpc::got_base_offset): Return Valtype.
3991         (Target_powerpc::got_section): Make public.
3992         (Target_powerpc::scan_relocs): Move code setting symbols..
3993         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
3994         Create _SDA_BASE_ only when referenced.
3995
3996 2012-11-02  Roland McGrath  <mcgrathr@google.com>
3997
3998         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
3999         from last change.
4000
4001 2012-11-01  Roland McGrath  <mcgrathr@google.com>
4002
4003         * target.h (Sized_target::relocate_relocs): Use Elf_Off
4004         for offset_in_output_section parameter.
4005         (Sized_target::relocate_special_relocatable): Likewise.
4006         * arm.cc (Target_arm::relocate_relocs): Likewise.
4007         (Target_arm::relocate_special_relocatable): Likewise.
4008         * i386.cc (Target_i386::relocate_relocs): Likewise.
4009         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
4010         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
4011         * target-reloc.h (relocate_relocs): Likewise.
4012         * testsuite/testfile.cc (Target_test): Likewise.
4013         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
4014         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
4015
4016         * system.h: Move inclusion of <clocale> to after <libintl.h> in
4017         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
4018
4019         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
4020         parameter, which is unused in the [!F_SETFD] case.
4021
4022         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
4023         SYMNDX to off_t before comparing it to this->data_size().
4024         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
4025         * incremental.cc (Output_section_incremental_inputs::do_write):
4026         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
4027
4028         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
4029
4030 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
4031
4032         * gold.cc (Target_arm::do_adjust_elf_header): Add the
4033         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
4034         in EABI_VER5.
4035
4036 2012-10-29  Cary Coutant  <ccoutant@google.com>
4037
4038         * dwp.cc (usage): Add file and exit status parameters;
4039         add --help and --version options.
4040         (print_version): New function.
4041         (main): Add --help and --version options.
4042
4043 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4044
4045         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
4046         final_layout_sequence.txt.
4047         * testsuite/Makefile.in: Regenerated.
4048
4049 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4050
4051         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
4052         COMPILE generated by automake.
4053         (LINK1): Likewise.
4054         (CXXCOMPILE1): Likewise.
4055         (CXXLINK1): Likewise.
4056         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
4057         (LINK): Likewise.
4058         (CXXCOMPILE): Likewise.
4059         (CXXLINK): Likewise.
4060         * testsuite/Makefile.in: Regenerated.
4061
4062 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4063
4064         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
4065         on bad fwrite return.
4066
4067 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4068
4069         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
4070         on val.
4071
4072 2012-10-23  Cary Coutant  <ccoutant@google.com>
4073
4074         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
4075         * testsuite/Makefile.in: Regenerate.
4076         * testsuite/dwp_test.h: New source file.
4077         * testsuite/dwp_test_1.cc: New source file.
4078         * testsuite/dwp_test_1.s: New source file.
4079         * testsuite/dwp_test_1.sh: New source file.
4080         * testsuite/dwp_test_1b.cc: New source file.
4081         * testsuite/dwp_test_1b.s: New source file.
4082         * testsuite/dwp_test_2.cc: New source file.
4083         * testsuite/dwp_test_2.s: New source file.
4084         * testsuite/dwp_test_2.sh: New source file.
4085         * testsuite/dwp_test_main.cc: New source file.
4086         * testsuite/dwp_test_main.s: New source file.
4087
4088 2012-10-23  Cary Coutant  <ccoutant@google.com>
4089
4090         * dwp.h: New header file.
4091         * dwp.cc: New source file.
4092         * gold.h: Move shared declarations to system.h.
4093         * system.h: New header file.
4094         * Makefile.am: Add dwp.
4095         * Makefile.in: Regenerate.
4096
4097 2012-10-23  Cary Coutant  <ccoutant@google.com>
4098
4099         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
4100         Dwarf_info_reader::read_from_pointer.
4101         (Dwarf_pubnames_table::read_header): Likewise.
4102         (Dwarf_pubnames_table::next_name): Likewise.
4103         (Dwarf_die::read_attributes): Likewise.
4104         (Dwarf_die::skip_attributes): Likewise.
4105         (Dwarf_info_reader::read_from_pointer): New function template.
4106         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
4107         (Dwarf_pubnames_table): Likewise.
4108         (Dwarf_info_reader::read_from_pointer): New function template.
4109         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
4110         Dwarf_pubnames_table ctor.
4111
4112 2012-10-23  Cary Coutant  <ccoutant@google.com>
4113
4114         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
4115         abbrev_shndx.
4116         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
4117         abbrev_shndx_.
4118         (Dwarf_info_reader::set_abbrev_shndx): New method.
4119         (Dwarf_info_reader::abbrev_shndx_): New data member.
4120
4121 2012-10-23  Cary Coutant  <ccoutant@google.com>
4122
4123         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
4124         from object, not parameters.
4125         (Dwarf_info_reader::parse): Likewise.
4126         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
4127         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
4128         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
4129         methods.
4130
4131 2012-10-23  Cary Coutant  <ccoutant@google.com>
4132
4133         * fileread.cc (Input_file::Input_file): New constructor.
4134         * fileread.h (class Input_file): Add new constructor.
4135
4136 2012-10-18  Alan Modra  <amodra@gmail.com>
4137
4138         PR gold/14727
4139         * object.cc (Relobj::is_section_name_included): Also match
4140         .sdata personality section.
4141
4142 2012-10-18  Alan Modra  <amodra@gmail.com>
4143
4144         * target-reloc.h (class Default_comdat_behavior): New, package up..
4145         (get_comdat_behaviour): ..this.
4146         (relocate_section): Add Relocate_comdat_behavior template arg,
4147         adjust code to suit.
4148         * arm.cc (Target_arm::relocate_section): Adjust to suit.
4149         (Target_arm::scan_reloc_section): Likewise.
4150         * i386.cc (Target_i386::relocate_section): Likewise.
4151         * sparc.cc (Target_sparc::relocate_section): Likewise.
4152         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
4153         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
4154         * powerpc.cc (class Relocate_comdat_behavior): New.
4155         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
4156         gold::relocate_section with new template arg.
4157
4158 2012-10-18  Alan Modra  <amodra@gmail.com>
4159
4160         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
4161         dynamic relocs for GOT_TPREL got entries, without symbol if
4162         resolving locally.
4163         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
4164         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
4165         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
4166
4167 2012-10-17  Alan Modra  <amodra@gmail.com>
4168
4169         PR gold/14726
4170         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
4171
4172 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
4173
4174         * layout.cc (Layout::include_section): Keep sections marked
4175         SHF_EXCLUDE when doing relocatable links.
4176
4177 2012-10-16  Alan Modra  <amodra@gmail.com>
4178
4179         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
4180         (Target_powerpc::do_finalize_sections): Call it.
4181         (Output_data_save_res): New class and supporting functions.
4182         (Target_powerpc::symval_for_branch): Only look up .opd entry for
4183         normal symbols defined in object files.
4184
4185 2012-10-12  Alan Modra  <amodra@gmail.com>
4186
4187         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
4188         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
4189         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
4190         section if scan_opd_relocs not yet called.
4191         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
4192
4193 2012-10-12  Alan Modra  <amodra@gmail.com>
4194
4195         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
4196         add_local_ifunc_entry): Revert last change.
4197         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
4198
4199 2012-10-05  Alan Modra  <amodra@gmail.com>
4200
4201         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
4202         do_plt_address_for_global): New functions.
4203         (Output_data_got_powerpc::do_write): Don't segfault when linking
4204         statically.
4205         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
4206         add_local_ifunc_entry): Return true on adding entry..
4207         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
4208         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
4209         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
4210         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
4211         set up symbols here.
4212         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
4213         syms here.  Do so even when no .iplt.  Don't segfault when linking
4214         statically.
4215         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
4216         new variants without reloc param.
4217         (Glink_sym_ent::Glink_sym_ent): Likewise.
4218         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
4219         reloc when refs will resolve to plt call stub.
4220         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
4221         R_PPC_PLTREL24 to resolve locally.
4222         (Target_powerpc::Scan::global): Correct ifunc handling.
4223         (Target_powerpc::Relocate::relocate): Correct local sym glink
4224         lookup.  Don't destroy "value" when we have a plt call stub,
4225         and when checking plt call validity.
4226         (Target_powerpc::do_dynsym_value): Simplify.
4227
4228 2012-10-05  Alan Modra  <amodra@gmail.com>
4229
4230         * i386.cc (Output_data_plt_i386::address_for_global,
4231         address_for_local): Add plt offset to returned value.  Adjust uses.
4232         * sparc.cc (Output_data_plt_sparc::address_for_global,
4233         address_for_local): Likewise.
4234         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
4235         address_for_local): Likewise.
4236         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
4237         address_for_local): Likewise.
4238         * target.h (Target::plt_address_for_global, plt_address_for_local):
4239         Update comment.
4240         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
4241         (Output_data_got::Got_entry::write): Nor here.
4242         * output.h: Comment fix.
4243
4244 2012-10-02  Jiong Wang  <jiwang@tilera.com>
4245
4246         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
4247         global_offset_table_ value for larget got.
4248         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
4249
4250 2012-09-29  Alan Modra  <amodra@gmail.com>
4251
4252         * powerpc.cc (Target_powerpc::iplt_): New output section.
4253         (Target_powerpc::iplt_section, make_iplt_section,
4254         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
4255         (Target_powerpc::make_plt_entry): Handle ifunc syms.
4256         Target_powerpc::plt_entry_count): Count iplt entries too.
4257         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
4258         reloc section in constructor.  New params.
4259         (Target_powerpc::make_plt_section): Create reloc section here instead.
4260         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
4261         functions.
4262         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
4263         (Output_data_glink::add_entry, find_entry): New functions to
4264         deal with local syms.
4265         (Glink_sym_ent): Add support for local syms.
4266         (Output_data_glink::do_write): Handle ifunc plt entries.
4267         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4268         (Target_powerpc::Scan::local, global): Handle ifunc syms.
4269         (Target_powerpc::Relocate::relocate): Likewise.
4270         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
4271
4272 2012-09-25  Alan Modra  <amodra@gmail.com>
4273
4274         * object.h (Sized_relobj_file::adjust_local_symbol,
4275         do_adjust_local_symbol): New functions.
4276         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
4277         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
4278         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
4279         and irregular opd entry spacing.
4280         (Powerpc_relobj::do_read_relocs): Add opd size checks.
4281         (Global_symbol_visitor_opd): New functor.
4282         (Target_powerpc::do_finalize_sections): Omit global symbols defined
4283         on deleted opd entries.
4284
4285 2012-09-15  Jiong Wang  <jiwang@tilera.com>
4286
4287         * tilegx.cc: New file.
4288         * Makefile.am (TARGETSOURCES): Add tilegx.cc
4289         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
4290         * configure.tgt: Add entries for tilegx*.
4291         * configure.ac: Likewise.
4292         * Makefile.in: Rebuild.
4293         * configure: Likewise.
4294         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
4295         tilegx.
4296
4297 2012-09-13  Alan Modra  <amodra@gmail.com>
4298
4299         * target-reloc.h (scan_relocs): Call scan.local for relocs
4300         against symbols in discarded sections.  Pass is_discarded
4301         param.
4302         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
4303         Add is_discarded param.
4304         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
4305         is_discarded to flag opd entry as discarded.  Don't emit dyn
4306         relocs on such entries.
4307         (Target_powerpc::Scan::global): Similarly detect and handle
4308         such opd entries.
4309         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
4310         opd_ent_.  Update all uses.
4311         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
4312         (Target_powerpc::relocate_section): Zero out discarded opd
4313         entry relocs.
4314
4315 2012-09-12  Ian Lance Taylor  <iant@google.com>
4316
4317         PR gold/14570
4318         * output.cc: Rename Output_data_got template parameter from size
4319         to got_size for all functions.  Compile all variants of
4320         Output_data_got.
4321         (Output_data_got::Got_entry::write): Correct use of size for
4322         symbol value.  Use local_is_tls rather than casting to
4323         Sized_relobj_file.
4324         * object.h (class Object): Add local_is_tls and do_local_is_tls.
4325         (class Sized_relobj_file): Add do_local_is_tls.
4326         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
4327
4328 2012-09-11  Alan Modra  <amodra@gmail.com>
4329
4330         PR gold/14566
4331         * layout.cc (Layout::set_segment_offsets): When using
4332         common-page-size alignment, ensure we are on a new max-page-size
4333         page.
4334         * output.cc (Output_segment::set_section_addresses): Use
4335         abi_pagesize, not common_pagesize for relro boundary.
4336         (Output_segment::set_offset): Likewise.
4337
4338 2012-09-11  Alan Modra  <amodra@gmail.com>
4339
4340         * output.h (Output_data_got::add_global_tls, add_local_tls,
4341         add_local_tls_pair): New functions.
4342         (Output_data_got::add_local_pair_with_rel): Remove second
4343         reloc param.  Expand comment.
4344         (Output_data_got::Got_entry): Rename use_plt_offset_ to
4345         use_plt_or_tls_offset_, similarly for constructor param.
4346         (Output_data_got::Got_entry::write): Add got_index param.
4347         * output.cc (Output_data_got::add_global_tls, add_local_tls,
4348         add_local_tls_pair): New functions.
4349         (Output_data_got::Got_entry::write): Handle tls symbols
4350         with use_plt_or_tls_offset_ set specially.
4351         (Output_data_got::add_local_pair_with_rel): Only one reloc.
4352         (Output_data_got::do_write): Replace iterator with index, pass
4353         index to entry write function.
4354         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
4355         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
4356         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
4357         call.
4358         * i386.cc (Target_i386::Scan::local): Likewise.
4359         * sparc.cc (Target_sparc::Scan::local): Likewise.
4360         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
4361         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
4362         do_tls_offset_for_global): New functions.
4363         (Target_powerpc::Scan::local): Correct TLS relocations and got
4364         entry values.
4365         (Target_powerpc::Scan::global): Don't emit unnecessary
4366         dynamic relocations on TLS GOT entries.
4367
4368 2012-09-10  Matthias Klose  <doko@ubuntu.com>
4369
4370         * config.in: Disable sanity check for kfreebsd.
4371
4372 2012-09-10  Sterling Augustine  <saugustine@google.com>
4373
4374         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
4375         (Gdb_index::pubtypes_read): New parameter.
4376         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
4377         to calls.
4378         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
4379         pubtypes_object_.
4380
4381 2012-09-09  Alan Modra  <amodra@gmail.com>
4382
4383         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
4384         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
4385         * gc.h (gc_process_relocs): Call target gc_add_reference.
4386         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
4387         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
4388         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
4389         unnecessary cast.
4390         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
4391         to cater for when we don't need code offset.  Update use.
4392         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
4393         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
4394         set_opd_valid): New functions.
4395         (Target_powerpc::do_gc_add_reference): New function.
4396         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
4397         stashed refs.
4398         (Target_powerpc::do_gc_mark_symbol): New function.
4399
4400 2012-09-06  Cary Coutant  <ccoutant@google.com>
4401
4402         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
4403         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
4404         (Dwarf_die::skip_attributes): Likewise.
4405         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
4406         * testsuite/gdb_index_test.cc (inline_func_1): New function.
4407         (main): Call it.
4408         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
4409
4410 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
4411
4412         * testsuite/script_test_3.t: Add .got.plt output section
4413         statement.
4414         * testsuite/script_test_4.t: Likewise.
4415
4416 2012-09-05  Alan Modra  <amodra@gmail.com>
4417
4418         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
4419         update all uses and lose "enum" when using type.
4420
4421 2012-09-05  Alan Modra  <amodra@gmail.com>
4422
4423         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
4424         * configure: Regenerate.
4425         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
4426         (plugin_final_layout.stdout): Likewise.
4427         (memory_test): Set page sizes to 0x1000.
4428         * testsuite/Makefile.in: Regenerate.
4429         * testsuite/discard_locals_test.sh: Add FIXME comment.
4430         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
4431         * testsuite/pr14265.t: Add .got output section statement.
4432         * testsuite/script_test_2.t: Likewise.
4433         * testsuite/script_test_3.t: Likewise.
4434         * testsuite/script_test_4.t: Likewise.
4435         * testsuite/script_test_5.t: Likewise.
4436         * testsuite/script_test_6.t: Likewise.
4437         * testsuite/script_test_7.t: Likewise.
4438         * testsuite/script_test_9.t: Likewise.
4439
4440 2012-09-05  Alan Modra  <amodra@gmail.com>
4441
4442         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
4443         (Powerpc_relocate_functions::Status): New typedef.
4444         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4445         (Target_powerpc::Scan::local): Handle REL64.
4446         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
4447         for REL32 and REL64.
4448         (Target_powerpc::symval_for_branch): New function, extracted from..
4449         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
4450         checks.  Report overflow errors.
4451
4452 2012-09-05  Alan Modra  <amodra@gmail.com>
4453
4454         * object.h (Sized_relobj_file::emit_relocs): Delete.
4455         (Sized_relobj_file::emit_relocs_reltype): Delete.
4456         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
4457         relocate_relocs for --emit-relocs.
4458         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
4459         * output.h: Update comment.
4460         (Output_segment::first_section): New function.
4461         (Output_segment::first_section_load_address): Use first_section.
4462         * output.cc (Output_segment::first_section): New function extracted..
4463         (Output_segment::first_section_load_address): ..from here.  Delete.
4464         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
4465         * target.h (Sized_target::relocate_for_relocatable): Likewise.
4466         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
4467         adjust call to target.h function.
4468         * i386.cc (Target_i386): Likewise.
4469         * sparc.cc (Target_sparc): Likewise.
4470         * x86_64.cc (Target_x86_64): Likewise.
4471         * powerpc.cc (Target_powerpc): Likewise.
4472         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
4473         first tls section has section symbol for optimised local dynamic
4474         output relocs.
4475         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
4476         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
4477         optimised tls code.
4478         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
4479         Rename to relocate_relocs.  Update error message.
4480
4481 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
4482
4483         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
4484         --just-symbols.
4485
4486 2012-08-31  Alan Modra  <amodra@gmail.com>
4487
4488         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
4489         (Powerpc_relobj::toc_base_offset): New stub function.
4490         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
4491         got_mod_index_offset to tlsld_got_offset.  Update all refs.
4492         (Target_powerpc::Relocate::enum skip_tls): New.
4493         (Target_powerpc::call_tls_get_addr_): New var.
4494         (Target_powerpc::is_branch_reloc): Move to file scope.
4495         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
4496         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
4497         New functions.
4498         (Target_powerpc::enum Got_type): Delete old values, add new ones.
4499         (powerpc_info): Correct common_pagesize for ppc64.
4500         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
4501         (Powerpc_relocate_functions): Add overflow check enums and functions.
4502         Add non-shift version of rela, rela_ua.  Delete all rel public
4503         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
4504         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
4505         addr16_ha3, addr14 functions.
4506         (Output_data_got_powerpc::add_constant_pair): New function.
4507         (Output_data_got_powerpc::got_base_offset): Likewise.
4508         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
4509         (instruction constants): Sort, add some more.
4510         (Output_data_glink::do_write): Add and use Address typedef.  Use
4511         object->toc_base_offset() stub for 64-bit.
4512         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
4513         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4514         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
4515         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
4516         Always treat .opd relocs as against locally defined symbol.
4517         Correct condition for RELATIVE relocs.
4518         (Target_powerpc::do_finalize_sections): Test for NULL sections.
4519         (Target_powerpc::Relocate::relocate): Use plt call stub as value
4520         for 32-bit syms with a plt entry.  Correct ppc64 toc base
4521         calculations.  Handle TLS relocs, and more.  Add overflow
4522         checking and adjust for Powerpc_relocate_functions changes.
4523         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
4524         Reinstate --emit-relocs code with FIXME.
4525
4526 2012-08-30  Alan Modra  <amodra@gmail.com>
4527
4528         * layout.cc (Layout::set_segment_offsets): Set p_align to
4529         abi_pagesize, not common_pagesize.
4530         (Layout::relaxation_loop_body): Similarly use abi_pagesize
4531         to determine whether file header can go in segment.
4532
4533 2012-08-30  Alan Modra  <amodra@gmail.com>
4534
4535         * output.h (Output_reloc::Output_reloc <output section>): Add
4536         is_relative param.  Adjust calls.
4537         (Output_reloc::add_output_section_relative): New functions.
4538         * output.cc (Output_reloc::Output_reloc <output section>): Handle
4539         is_relative.
4540         (Output_reloc::symbol_value): Handle SECTION_CODE.
4541
4542 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
4543
4544         * gold.cc (queue_middle_tasks): Call layout again when unique
4545         segments for sections is desired.
4546         * layout.cc (Layout::Layout): Initialize new members.
4547         (Layout::get_output_section_flags): New function.
4548         (Layout::choose_output_section): Call get_output_section_flags.
4549         (Layout::layout): Make output section for mapping to a unique segment.
4550         (Layout::insert_section_segment_map): New function.
4551         (Layout::attach_allocated_section_to_segment): Make unique segment for
4552         output sections marked so.
4553         (Layout::segment_precedes): Check for unique segments when sorting.
4554         * layout.h (Layout::Unique_segment_info): New struct.
4555         (Layout::Section_segment_map): New typedef.
4556         (Layout::insert_section_segment_map): New function.
4557         (Layout::get_output_section_flags): New function.
4558         (Layout::is_unique_segment_for_sections_specified): New function.
4559         (Layout::set_unique_segment_for_sections_specified): New function.
4560         (Layout::unique_segment_for_sections_specified_): New member.
4561         (Layout::section_segment_map_): New member.
4562         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
4563         Rename is_gc_pass_one to is_pass_one.
4564         Rename is_gc_pass_two to is_pass_two.
4565         Rename is_gc_or_icf to is_two_pass.
4566         Check for which pass based on whether symbols data is present.
4567         Make it two pass when unique segments for sections is desired.
4568         * output.cc (Output_section::Output_section): Initialize new
4569         members.
4570         * output.h (Output_section::is_unique_segment): New function.
4571         (Output_section::set_is_unique_segment): New function.
4572         (Output_section::is_unique_segment_): New member.
4573         (Output_section::extra_segment_flags): New function.
4574         (Output_section::set_extra_segment_flags): New function.
4575         (Output_section::extra_segment_flags_): New member.
4576         (Output_section::segment_alignment): New function.
4577         (Output_section::set_segment_alignment): New function.
4578         (Output_section::segment_alignment_): New member.
4579         (Output_segment::Output_segment): Initialize is_unique_segment_.
4580         (Output_segment::is_unique_segment): New function.
4581         (Output_segment::set_is_unique_segment): New function.
4582         (Output_segment::is_unique_segment_): New member.
4583         * plugin.cc (allow_unique_segment_for_sections): New function.
4584         (unique_segment_for_sections): New function.
4585         (Plugin::load): Add new functions to transfer vector.
4586         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
4587         * Makefile.in: Regenerate.
4588         * testsuite/plugin_final_layout.sh: Check if unique segment
4589         functionality works.
4590         * testsuite/plugin_section_order.c (onload): Check if new interfaces
4591         are available.
4592         (allow_unique_segment_for_sections): New global.
4593         (unique_segment_for_sections): New global.
4594         (claim_file_hook): Call allow_unique_segment_for_sections.
4595         (all_symbols_read_hook): Call unique_segment_for_sections.
4596
4597 2012-08-22  Cary Coutant  <ccoutant@google.com>
4598
4599         * layout.cc (Layout::include_section): Don't assert on GROUP
4600         sections with --emit-relocs.
4601
4602 2012-08-21  Cary Coutant  <ccoutant@google.com>
4603
4604         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
4605         if --export-dynamic-symbol names an undef symbol.
4606
4607 2012-08-18  Alan Modra  <amodra@gmail.com>
4608
4609         * powerpc.cc: Formatting and white space.
4610         (Powerpc_relobj): Rename got2_section_ to special_.
4611         Add opd_ent_shndx_ and opd_ent_off_ vectors.
4612         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
4613         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
4614         (Target_powerpc): Add Address typedef and invalid_address.  Use
4615         throughout.
4616         (Target_powerpc::is_branch_reloc): New function.
4617         (Powerpc_relocate_functions): Add Address typedef, use throughout.
4618         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
4619         for dst_mask, value and addend.
4620         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
4621         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
4622         (Output_data_glink::do_write): Correct toc base.  Don't try to use
4623         uint16_t for 24-bit offset.  Use get_output_section_offset and
4624         check return.
4625         (Target_powerpc::Scan::local): Handle more relocs.
4626         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
4627         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
4628         Plug in toc restoring insn after plt calls.  Translate branches
4629         to function descriptor symbols to corresponding entry point.
4630         (Target_powerpc::relocate_for_relocatable): Check return from
4631         get_output_section_offset.
4632         * symtab.h: Comment typo.
4633
4634 2012-08-14  Ian Lance Taylor  <iant@google.com>
4635
4636         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
4637         unsupported_relocal_local to call unsupported_reloc_global.
4638
4639 2012-08-14  Nick Clifton  <nickc@redhat.com>
4640
4641         PR ld/14265
4642         * script-sections.cc (Sections_element::output_section_name): Add
4643         keep return parameter.
4644         (Output_section_element::match_name): Add keep return parameter.
4645         Return the value of the keep_ member.
4646         * script-sections.h (class Output_section): Update
4647         output_section_name prototype.
4648         * layout.cc (Layout::keep_input_section): New public member
4649         function.
4650         (Layout::choose_output_section): Pass keep parameter to
4651         output_section_name.
4652         * layout.h (class Layout): Add keep_input_section.
4653         * object.cc (Sized_relobj_file::do_layout): Check for kept input
4654         sections.
4655         * testsuite/Makefile.am: Add a test.
4656         * testsuite/Makefile.in: Regenerate.
4657         * testsuite/pr14265.c: Source file for the test.
4658         * testsuite/pr14265.t: Linker script for the test.
4659         * testsuite/pr14265.sh: Shell script for the test.
4660
4661 2012-08-14  Alan Modra  <amodra@gmail.com>
4662
4663         * target.h (Target::output_section_name): New function.
4664         (Target::do_output_section_name): New function.
4665         * layout.cc (Layout::choose_output_section): Call the above.
4666         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
4667
4668 2012-08-14  Alan Modra  <amodra@gmail.com>
4669
4670         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
4671         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
4672         for replace_constant call.
4673         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
4674         (Output_data_glink::do_print_to_mapfile): New function.
4675         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
4676         (Target_powerpc::Relocate::relocate): Likewise.
4677
4678 2012-08-14  Alan Modra  <amodra@gmail.com>
4679
4680         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
4681         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
4682         (Output_data_glink::add_entry,find_entry): Remove shndx param.
4683         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
4684         all references to shndx_.  Handle special case for R_PPC_PLTREL24
4685         here.
4686         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
4687         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
4688         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
4689         here.
4690         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
4691         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
4692
4693 2012-08-12  Alan Modra  <amodra@gmail.com>
4694
4695         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
4696         (glink insn constants): Use uint32_t.
4697         (Output_data_glink::add_entry): Use insert, not [] operator.
4698
4699 2012-08-11  Alan Modra  <amodra@gmail.com>
4700
4701         * object.h (Sized_relobj_file::find_shdr): New function.
4702         (Sized_relobj_file::find_special_sections): New function.
4703         * object.cc (Sized_relobj_file::find_shdr): New function.
4704         (Sized_relobj_file::find_eh_frame): Use find_shdr.
4705         (Sized_relobj_file::find_special_sections): New function, split out..
4706         (Sized_relobj_file::do_read_symbols): ..from here.
4707         * output.h (Output_data_got::replace_constant): New function.
4708         (Output_data_got::num_entries): New function.
4709         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
4710         (Output_data_got::got_offset): Protected rather than private.
4711         (Output_data_got::replace_got_entry): New function.
4712         * output.cc (Output_data_got::replace_got_entry): New function.
4713         * powerpc.cc (class Powerpc_relobj): New.
4714         (class Powerpc_relocate_functions): Delete all psymval variants or
4715         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
4716         Implement _ha functions using corresponding _hi function.
4717         (Powerpc_relobj::find_special_sections): New function.
4718         (Target_powerpc::do_make_elf_object): New function.
4719         (class Output_data_got_powerpc): New.
4720         (class Output_data_glink): New.
4721         (class Powerpc_scan_relocatable_reloc): New.
4722         Many more changes througout file.
4723
4724 2012-08-09  Nick Clifton  <nickc@redhat.com>
4725
4726         * po/vi.po: Updated Vietnamese translation.
4727
4728 2012-08-07  Ian Lance Taylor  <iant@google.com>
4729
4730         * layout.cc (Layout::add_target_dynamic_tags): If
4731         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
4732         plt_rel.
4733
4734 2012-07-30  Nick Clifton  <nickc@redhat.com>
4735
4736         * po/gold.pot: Updated template.
4737         * po/es.po: Updated Spanish translation.
4738
4739 2012-07-18  Cary Coutant  <ccoutant@google.com>
4740
4741         PR gold/14344
4742         * configure.ac: Add check for -gpubnames support.
4743         * configure: Regenerate.
4744         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
4745         support; force -gno-pubnames.
4746         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
4747         support.
4748         (gdb_index_test_4): New test.
4749         * testsuite/Makefile.in: Regenerate.
4750         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
4751         * testsuite/gdb_index_test_2.sh: Likewise.
4752         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
4753         * testsuite/gdb_index_test_4.sh: New script.
4754         * testsuite/gdb_index_test_comm.sh: New script with common code;
4755         don't look for space after colon.
4756
4757 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
4758
4759         * gold.cc (queue_middle_tasks): Update function order only after
4760         deferred objects due to plugins are processed.
4761
4762 2012-07-11  Ian Lance Taylor  <iant@google.com>
4763
4764         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
4765         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
4766         (Target_arm::scan_reloc_for_stub): Likewise.
4767         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
4768         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
4769         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
4770         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
4771         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
4772
4773 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
4774             Ian Lance Taylor  <iant@google.com>
4775
4776         PR gold/14309
4777         * configure.ac: Test whether std::tr1::hash<off_t> works.
4778         * gold.h: Add a specialization for std::tr1::hash<off_t> if
4779         needed.
4780         * output.h (class Output_fill): Add virtual destructor.
4781         * configure, config.in: Rebuild.
4782
4783 2012-06-22  Roland McGrath  <mcgrathr@google.com>
4784
4785         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
4786
4787 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
4788
4789         * plugin.cc (Plugin::load): Handle position independent executables.
4790
4791 2012-06-06  Cary Coutant  <ccoutant@google.com>
4792
4793         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
4794         add .debug_macro.
4795         (lines_only_debug_sections): Likewise.
4796         (gdb_fast_lookup_sections): New static array.
4797         (is_gdb_debug_section): Rename formal parameter.
4798         (is_lines_only_debug_section): Likewise.
4799         (is_gdb_fast_lookup_section): New function.
4800         (Layout::include_section): Check for ".zdebug_" prefix; pass
4801         section name suffix to is_gdb_debug_section, et al.; check for
4802         fast-lookup sections when building .gdb_index.
4803         * options.h (--strip-debug-gdb): Update GDB version number.
4804
4805 2012-06-06  Cary Coutant  <ccoutant@google.com>
4806
4807         * configure.ac: Add check for fallocate.
4808         * configure: Regenerate.
4809         * config.in: Regenerate.
4810
4811         * options.h (class General_options): Add --mmap-output-file and
4812         --posix-fallocate options.
4813         * output.cc: (posix_fallocate): Remove; replace with...
4814         (gold_fallocate): New function.
4815         (Output_file::map_no_anonymous): Call gold_fallocate.
4816         (Output_file::map): Check --mmap-output-file option.
4817
4818 2012-06-05  Jing Yu  <jingyu@google.com>
4819
4820         * gold.h (textdomain): Add do {} to empty while(0).
4821         (bindtextdomain): Likewise.
4822
4823 2012-06-04  Cary Coutant  <ccoutant@google.com>
4824
4825         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
4826         has_dynsym_index.
4827
4828 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
4829
4830         * symtab.cc (Symbol_table::define_special_symbol):
4831         Initialize *poldsym to prevent uninitialized variable errors.
4832
4833 2012-05-23  Cary Coutant  <ccoutant@google.com>
4834
4835         * layout.cc (Layout::section_name_mapping): Add rules to handle
4836         exact match on .data.rel.ro.local or .data.rel.ro.
4837         (Layout::output_section_name): Check for exact matches.
4838
4839 2012-05-23  Cary Coutant  <ccoutant@google.com>
4840
4841         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
4842         more carefully.
4843
4844 2012-05-22  Cary Coutant  <ccoutant@google.com>
4845
4846         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
4847         object before exporting symbol.
4848
4849 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
4850
4851         * testsuite/tls_test.cc: Include "config.h" first.
4852         * testsuite/tls_test_c.c: Likewise.
4853
4854 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
4855             Nick Clifton  <nickc@redhat.com>
4856
4857         PR 14072
4858         * configure.in: Add check that sysdep.h has been included before
4859         any system header files.
4860         * configure: Regenerate.
4861         * config.in: Regenerate.
4862
4863 2012-05-14  Cary Coutant  <ccoutant@google.com>
4864
4865         * layout.cc (Layout::make_output_section): Mark .tdata section
4866         as RELRO.
4867         * testsuite/relro_test.cc: Add a TLS variable.
4868
4869 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
4870
4871         PR gold/14091
4872         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
4873         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
4874         R_X86_64_64.
4875
4876 2012-05-08  Cary Coutant  <ccoutant@google.com>
4877
4878         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
4879         (lines_only_debug_sections): Likewise.
4880
4881 2012-05-02  Roland McGrath  <mcgrathr@google.com>
4882
4883         * nacl.cc: New file.
4884         * nacl.h: New file.
4885         * Makefile.am (CCFILES, HFILES): Add them.
4886         * Makefile.in: Regenerate.
4887         * i386.cc (Output_data_plt_i386_nacl): New class.
4888         (Output_data_plt_i386_nacl_exec): New class.
4889         (Output_data_plt_i386_nacl_dyn): New class.
4890         (Target_i386_nacl): New class.
4891         (Target_selector_i386_nacl): New class.
4892         (target_selector_i386): Use it instead of Target_selector_i386.
4893         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
4894         (Target_x86_64_nacl): New class.
4895         (Target_selector_x86_64_nacl): New class.
4896         (target_selector_x86_64, target_selector_x32): Use it instead of
4897         Target_selector_x86_64.
4898         * arm.cc (Output_data_plt_arm_nacl): New class.
4899         (Target_arm_nacl): New class.
4900         (Target_selector_arm_nacl): New class.
4901         (target_selector_arm, target_selector_armbe): Use it instead of
4902         Target_selector_arm.
4903
4904         * target-select.cc (select_target): Take new Input_file* and off_t
4905         arguments, pass them on to recognize method of selector.
4906         * object.cc (make_elf_sized_object): Update caller.
4907         * parameters.cc (parameters_force_valid_target): Likewise.
4908         * incremental.cc (make_sized_incremental_binary): Likewise.
4909         * target-select.h: Update decl.
4910         (Target_selector::recognize): Take new Input_file* argument,
4911         pass it on to do_recognize.
4912         (Target_selector::do_recognize): Take new Input_file* argument.
4913         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
4914         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
4915         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
4916         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
4917
4918         * target.h (Target::Target_info): New members isolate_execinstr
4919         and rosegment_gap.
4920         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
4921         * arm.cc (Target_arm::arm_info): Update initializer.
4922         * i386.cc (Target_i386::i386_info): Likewise.
4923         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
4924         * sparc.cc (Target_sparc::sparc_info): Likewise.
4925         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4926         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
4927         * layout.cc (Layout::attach_allocated_section_to_segment):
4928         Take new const Target* argument.  If target->isolate_execinstr(), act
4929         like --rosegment.
4930         (Layout::find_first_load_seg): Take new const Target* argument;
4931         if target->isolate_execinstr(), reject PF_X segments.
4932         (Layout::relaxation_loop_body): Update caller.
4933         (Layout::set_segment_offsets): If target->isolate_execinstr(),
4934         reset file offset to zero when we hit LOAD_SEG, and then do a second
4935         loop over the segments before LOAD_SEG to reassign offsets after
4936         addresses have been determined.  Handle target->rosegment_gap().
4937         (Layout::attach_section_to_segment): Take new const Target* argument;
4938         pass it to attach_allocated_section_to_segment.
4939         (Layout::make_output_section): Update caller.
4940         (Layout::attach_sections_to_segments): Take new const Target* argument;
4941         pass it to attach_section_to_segment.
4942         * gold.cc (queue_middle_tasks): Update caller.
4943         * layout.h (Layout): Update method decls with new arguments.
4944
4945         * arm.cc (Target_arm::Target_arm): Take optional argument for the
4946         Target_info pointer to use.
4947         (Target_arm::do_make_data_plt): New virtual method.
4948         (Target_arm::make_data_plt): New method that calls it.
4949         (Target_arm::make_plt_entry): Use it.
4950         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
4951         for the section alignment.
4952         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
4953         method.
4954         (Output_data_plt_arm::first_plt_entry_offset): Call it.
4955         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
4956         method.
4957         (Output_data_plt_arm::get_plt_entry_size): Call it.
4958         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
4959         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
4960         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
4961         method.
4962         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
4963         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
4964         method instead of sizeof(plt_entry).
4965         (Output_data_plt_arm::add_entry): Likewise.
4966         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
4967         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
4968         than static method.
4969         (Target_arm::plt_entry_size): Likewise.
4970         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
4971         Move to ...
4972         (Output_data_plt_arm_standard): ... here, new class.
4973         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
4974         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
4975         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
4976
4977         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4978         Take additional argument for the PLT entry size.
4979         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
4980         Use get_plt_entry_size method rather than plt_entry_size variable.
4981         (Output_data_plt_x86_64::reserve_slot): Likewise.
4982         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
4983         (Output_data_plt_x86_64::add_entry): Likewise.
4984         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
4985         (Output_data_plt_x86_64::address_for_global): Likewise.
4986         (Output_data_plt_x86_64::address_for_local): Likewise.
4987         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4988         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
4989         Make method non-static.
4990         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
4991         method.
4992         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
4993         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
4994         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
4995         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
4996         virtual method.
4997         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
4998         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
4999         virtual method.
5000         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
5001         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
5002         virtual method.
5003         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
5004         (Output_data_plt_x86_64::plt_entry_size)
5005         (Output_data_plt_x86_64::first_plt_entry)
5006         (Output_data_plt_x86_64::plt_entry)
5007         (Output_data_plt_x86_64::tlsdesc_plt_entry)
5008         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
5009         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
5010         (Output_data_plt_x86_64_standard): ... here, new class.
5011         (Target_x86_64::Target_x86_64): Take optional argument for the
5012         Target_info pointer to use.
5013         (Target_x86_64::do_make_data_plt): New virtual method.
5014         (Target_x86_64::make_data_plt): New method to call it.
5015         (Target_x86_64::init_got_plt_for_update): Use that.
5016         Call this->plt_->add_eh_frame method here.
5017         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
5018         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
5019         rather than static method.
5020         (Target_x86_64::plt_entry_size): Likewise.
5021         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
5022         rather than plt_entry_size variable.  Move guts of PLT filling to...
5023         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
5024         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
5025         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
5026
5027         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
5028         additional argument for the section alignment.
5029         Don't do add_eh_frame_for_plt here.
5030         (Output_data_plt_i386::first_plt_entry_offset): Make the method
5031         non-static.  Use get_plt_entry_size method rather than plt_entry_size
5032         variable.
5033         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
5034         method.
5035         (Output_data_plt_i386::get_plt_entry_size): Call it.
5036         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
5037         (Output_data_plt_i386::add_eh_frame): New method to call it.
5038         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
5039         method.
5040         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
5041         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
5042         method.
5043         (Output_data_plt_i386::fill_plt_entry): New method to call it.
5044         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
5045         method instead of plt_entry_size.
5046         (Output_data_plt_i386::plt_entry_size)
5047         (Output_data_plt_i386::plt_eh_frame_fde_size)
5048         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
5049         (Output_data_plt_i386_standard): ... here, new class.
5050         (Output_data_plt_i386_exec): New class.
5051         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
5052         (Output_data_plt_i386_exec::first_plt_entry): ... here.
5053         (Output_data_plt_i386::exec_plt_entry): Move to ...
5054         (Output_data_plt_i386_exec::plt_entry): ... here.
5055         (Output_data_plt_i386_dyn): New class.
5056         (Output_data_plt_i386::first_plt_entry): Move to ...
5057         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
5058         (Output_data_plt_i386::dyn_plt_entry): Move to ...
5059         (Output_data_plt_i386_dyn::plt_entry): ... here.
5060         (Target_i386::Target_i386): Take optional argument for the Target_info
5061         pointer to use.
5062         (Target_i386::do_make_data_plt): New virtual method.
5063         (Target_i386::make_data_plt): New method to call it.
5064         (Target_i386::make_plt_section): Use that.
5065         Call this->plt_->add_eh_frame method here.
5066         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
5067         rather than plt_entry_size variable.
5068         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
5069         (Output_data_plt_i386::address_for_local): Likewise.
5070         (Output_data_plt_i386::do_write): Likewise.
5071         Move guts of PLT filling to...
5072         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
5073         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
5074         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
5075         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
5076
5077 2012-05-01  Cary Coutant  <ccoutant@google.com>
5078
5079         * dwarf_reader.cc (Dwarf_die::read_attributes)
5080         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
5081         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
5082         * reduced_debug_output.cc
5083         (Output_reduced_debug_info_section::get_die_end): Remove
5084         DW_FORM_GNU_ref_index.  Add default case.
5085
5086 2012-04-26  Mark Wielaard  <mjw@redhat.com>
5087
5088         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
5089         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
5090         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
5091         DW_AT_high_pc as offset from DW_AT_low_pc.
5092
5093         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
5094         * testsuite/Makefile.in: Regenerate.
5095         * testsuite/gdb_index_test_3.c: New test source file.
5096         * testsuite/gdb_index_test_3.sh: New test source file.
5097
5098 2012-04-25  Ian Lance Taylor  <iant@google.com>
5099
5100         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
5101         pointer.
5102         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
5103         as a class, not a struct.
5104         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
5105         (Target_arm::apply_cortex_a8_workaround): Likewise.
5106         * gc.h: Declare Reloc_types as a struct, not a class.
5107         * object.h: Declare Symbols_data as a struct.
5108         * reloc.h: Declare Read_relocs_data as a struct.
5109         * target.h: Declare Relocate_info as a struct.
5110
5111 2012-04-24  David S. Miller  <davem@davemloft.net>
5112
5113         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
5114         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
5115         and R_SPARC_WPLT30.
5116
5117 2012-04-24  Cary Coutant  <ccoutant@google.com>
5118
5119         * incremental-dump.cc (find_input_containing_global): Replace
5120         magic number with symbolic constant.
5121         (dump_incremental_inputs): Update version number.
5122         * incremental.cc (Output_section_incremental_inputs): Update version
5123         number; import symbolic constants from Incremental_inputs_reader.
5124         (Incremental_inputs::create_data_sections): Align relocations
5125         section correctly for 64-bit targets.
5126         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
5127         constants; add padding.
5128         (Output_section_incremental_inputs::write_header): Add assert for
5129         header_size.
5130         (Output_section_incremental_inputs::write_input_files): Add assert
5131         for input_entry_size.
5132         (Output_section_incremental_inputs::write_info_blocks): Add padding;
5133         add assert for object_info_size, input_section_entry_size,
5134         global_sym_entry_size.
5135         * incremental.h (Incremental_inputs_reader): Add symbolic constants
5136         for data structure sizes; use them.
5137         (Incremental_input_entry_reader): Import symbolic constants from
5138         Incremental_inputs_reader; use them.
5139
5140 2012-04-23  David S. Miller  <davem@davemloft.net>
5141
5142         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
5143         and elf_flags_set_.
5144         (Target_sparc::Target_sparc): Initialize new fields.
5145         (Target_sparc::do_make_elf_object): New function.
5146         (Target_sparc::do_adjust_elf_header): New function.
5147
5148 2012-04-23  Cary Coutant  <ccoutant@google.com>
5149
5150         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
5151         CU range table of gdb index.
5152
5153 2012-04-20  David S. Miller  <davem@davemloft.net>
5154
5155         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
5156         instead of false.
5157
5158 2012-04-16  David S. Miller  <davem@davemloft.net>
5159
5160         * sparc.cc (Target_sparc::got_address): New function.
5161         (Sparc_relocate_functions::gdop_hix22): New function.
5162         (Sparc_relocate_functions::gdop_lox10): New function.
5163         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
5164         relocs.
5165         (Target_sparc::Scan::local): Likewise if the global symbol is not
5166         preemptible and is not IFUNC.
5167         (Target_sparc::Relocate::relocate): Perform GOTDATA code
5168         transformations for local and non-preemptible non-IFUNC global
5169         symbols.
5170
5171         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
5172         writing out 64-bit part of ranges.
5173
5174         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
5175         -fpic and -fpie respectively.
5176         * Makefile.in: Regenerate.
5177
5178         * sparc.cc (class Target_sparc): Add rela_ifunc_.
5179         (Target_sparc::Target_sparc): Initialize new field.
5180         (Target_sparc::do_plt_section_for_global): New function.
5181         (Target_sparc::do_plt_section_for_local): New function.
5182         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
5183         (Target_sparc::make_plt_section): New function, broken out of
5184         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
5185         (Target_sparc::make_plt_entry): Call make_plt_section.
5186         (Target_sparc::make_local_ifunc_plt_entry): New function.
5187         (Target_sparc::rela_ifunc_section): New function.
5188         (Target_sparc::plt_section): Remove const.
5189         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
5190         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
5191         and ifunc_count_ fields.
5192         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
5193         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
5194         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
5195         (Output_data_plt_sparc::rela_ifunc): New function.
5196         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
5197         (Output_data_plt_sparc::has_ifunc_section): New function.
5198         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
5199         (Output_data_plt_sparc::address_for_global): New function.
5200         (Output_data_plt_sparc::address_for_local): New function.
5201         (Output_data_plt_sparc::plt_index_to_offset): New function.
5202         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
5203         and entry_count.
5204         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
5205         entry_count.
5206         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
5207         R_SPARC_JMP_IREL to switch.
5208         (Target_sparc::Scan::check_non_pic): Likewise.
5209         (Target_sparc::Scan::local): Handle IFUNC symbols.
5210         (Target_sparc::Scan::local): Likewise.
5211         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
5212         and plt_address_for_local.
5213         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
5214         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
5215
5216         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
5217         (class Output_data_reloc): Adjust calls to Output_reloc_type.
5218         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
5219         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
5220         global relocs too.
5221         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
5222         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
5223         calls.
5224         * sparc.cc (Target_sparc::Scan::global): Likewise.
5225         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5226
5227 2012-04-16  Cary Coutant  <ccoutant@google.com>
5228
5229         * archive.cc (Library_base::should_include_member): Check for
5230         --export-dynamic-symbol.
5231         * options.h (class General_options): Add --export-dynamic-symbol.
5232         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
5233         --export-dynamic-symbol.
5234         (Symbol_table::gc_mark_undef_symbols): Likewise.
5235         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
5236
5237 2012-04-12  David S. Miller  <davem@davemloft.net>
5238
5239         * sparc.cc (Reloc::wdisp10): New relocation method.
5240         (Reloc::h34): Likewise.
5241         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
5242         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
5243         R_SPARC_WDISP10.
5244         (Target_sparc::Scan::local): Likewise.
5245         (Target_sparc::Scan::global): Likewise.
5246         (Target_sparc::Relocate::relocate): Likewise.
5247
5248 2012-04-09  Cary Coutant  <ccoutant@google.com>
5249
5250         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
5251         low_pc == 0.
5252
5253 2012-04-06  Ian Lance Taylor  <iant@google.com>
5254
5255         * timer.cc: #include <unistd.h>.
5256
5257 2012-04-06  Roland McGrath  <mcgrathr@google.com>
5258
5259         * configure.in (AC_CHECK_HEADERS): Add locale.h.
5260         * config.in: Regenerate.
5261         * configure: Regenerate.
5262
5263 2012-04-05  Nick Clifton  <nickc@redhat.com>
5264
5265         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
5266         (AM_LC_MESSAGES): Add.
5267         * aclocal.m4: Regenerate.
5268         * config.in: Regenerate.
5269         * configure: Regenerate.
5270
5271 2012-03-21  Cary Coutant  <ccoutant@google.com>
5272
5273         * Makefile.am: Add gdb-index.cc, gdb-index.h.
5274         * Makefile.in: Regenerate.
5275         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
5276         (Sized_elf_reloc_mapper::symbol_section): New function.
5277         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
5278         (make_elf_reloc_mapper): New function.
5279         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
5280         (Dwarf_abbrev_table::do_read_abbrevs): New function.
5281         (Dwarf_abbrev_table::do_get_abbrev): New function.
5282         (Dwarf_ranges_table::read_ranges_table): New function.
5283         (Dwarf_ranges_table::read_range_list): New function.
5284         (Dwarf_pubnames_table::read_section): New function.
5285         (Dwarf_pubnames_table::read_header): New function.
5286         (Dwarf_pubnames_table::next_name): New function.
5287         (Dwarf_die::Dwarf_die): New function.
5288         (Dwarf_die::read_attributes): New function.
5289         (Dwarf_die::skip_attributes): New function.
5290         (Dwarf_die::set_name): New function.
5291         (Dwarf_die::set_linkage_name): New function.
5292         (Dwarf_die::attribute): New function.
5293         (Dwarf_die::string_attribute): New function.
5294         (Dwarf_die::int_attribute): New function.
5295         (Dwarf_die::uint_attribute): New function.
5296         (Dwarf_die::ref_attribute): New function.
5297         (Dwarf_die::child_offset): New function.
5298         (Dwarf_die::sibling_offset): New function.
5299         (Dwarf_info_reader::check_buffer): New function.
5300         (Dwarf_info_reader::parse): New function.
5301         (Dwarf_info_reader::do_parse): New function.
5302         (Dwarf_info_reader::do_read_string_table): New function.
5303         (Dwarf_info_reader::lookup_reloc): New function.
5304         (Dwarf_info_reader::get_string): New function.
5305         (Dwarf_info_reader::visit_compilation_unit): New function.
5306         (Dwarf_info_reader::visit_type_unit): New function.
5307         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
5308         Sized_elf_reloc_mapper.
5309         (Sized_dwarf_line_info::symbol_section): Remove function.
5310         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
5311         (Sized_dwarf_line_info::read_line_mappings): Remove object
5312         parameter, adjust callers.
5313         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
5314         * dwarf_reader.h: Include <sys/types.h>.
5315         (class Track_relocs): Remove forward declaration.
5316         (class Elf_reloc_mapper): New class.
5317         (class Sized_elf_reloc_mapper): New class.
5318         (class Dwarf_abbrev_table): New class.
5319         (class Dwarf_range_list): New class.
5320         (class Dwarf_ranges_table): New class.
5321         (class Dwarf_pubnames_table): New class.
5322         (class Dwarf_die): New class.
5323         (class Dwarf_info_reader): New class.
5324         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
5325         (Sized_dwarf_line_info::symbol_section): Remove member function.
5326         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
5327         base class.
5328         * gdb-index.cc: New source file.
5329         * gdb-index.h: New source file.
5330         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
5331         and .debug_types sections, call Layout::add_to_gdb_index.
5332         (Sized_relobj_incr::do_section_name): Implement.
5333         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
5334         return type; Implement.
5335         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
5336         return type.
5337         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
5338         parameter list and return type.
5339         (Sized_incr_dynobj::do_section_contents): Likewise.
5340         * layout.cc: Include gdb-index.h.
5341         (Layout::Layout): Initialize gdb_index_data_.
5342         (Layout::init_fixed_output_section): Check for .gdb_index section.
5343         (Layout::add_to_gdb_index): New function. Instantiate.
5344         * layout.h: Add forward declaration for class Gdb_index.
5345         (Layout::add_to_gdb_index): New member function.
5346         (Layout::gdb_index_data_): New data member.
5347         * main.cc: Include gdb-index.h.
5348         (main): Print statistics for gdb index.
5349         * object.cc (Object::section_contents): Move code into
5350         do_section_contents.
5351         (need_decompressed_section): Check for sections needed when building
5352         gdb index.
5353         (build_compressed_section_map): Likewise.
5354         (Sized_relobj_file::do_read_symbols): Need local symbols when building
5355         gdb index.
5356         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
5357         sections; call Layout::add_to_gdb_index.
5358         (Sized_relobj_file::do_decompressed_section_contents): Call
5359         do_section_contents directly.
5360         * object.h (Object::do_section_contents): Adjust parameter list and
5361         return type.
5362         (Object::do_decompressed_section_contents): Call do_section_contents
5363         directly.
5364         (Sized_relobj_file::do_section_contents): Adjust parameter list and
5365         return type.
5366         * options.h (class General_options): Add --gdb-index option.
5367         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
5368         list and return type.
5369         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
5370         * reloc.h (Track_relocs::checkpoint): New function.
5371         (Track_relocs::reset): New function.
5372
5373         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
5374         New test cases.
5375         * testsuite/Makefile.in: Regenerate.
5376         * testsuite/gdb_index_test.cc: New test source file.
5377         * testsuite/gdb_index_test_1.sh: New test source file.
5378         * testsuite/gdb_index_test_2.sh: New test source file.
5379
5380 2012-03-19  Doug Kwan  <dougkwan@google.com>
5381
5382         * arm.cc (Target_arm::do_define_standard_symbols): New method.
5383         (Target_arm::do_finalize_sections): Remove code which defines
5384         __exidx_start and __exidx_end.  Make symbol table parameter
5385         anonymous as it is not used.
5386         * gold.cc (queue_middle_tasks): Call target hook to define any
5387         target-specific symbols.
5388         * target.h (Target::define_standard_symbols): New method.
5389         (Target::do_define_standard_symbols): Same.
5390         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
5391         * testsuite/Makefile.in: Regenerate.
5392         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
5393         and __exidx_end.
5394         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
5395         relocations are generated for __exidx_start and __exidx_end.
5396
5397 2012-03-16  Doug Kwan  <dougkwan@google.com>
5398
5399         * testsuite/Makefile.am: Disable test initpri3b.
5400         * testsuite/Makefile.in: Regenerate.
5401
5402 2012-03-15  Doug Kwan  <dougkwan@google.com>
5403
5404         * arm.cc (Target_arm::got_section): Make .got section read-only
5405         if -z now is given.
5406
5407 2012-03-15  Ian Lance Taylor  <iant@google.com>
5408
5409         PR gold/13850
5410         * layout.cc (Layout::make_output_section): Correctly mark
5411         SHT_INIT_ARRAY, et. al., as relro.
5412
5413 2012-03-14  Doug Kwan  <dougkwan@google.com>
5414
5415         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
5416         dynamic relocations for protected symbols in shared objects.
5417
5418 2012-03-13  Ian Lance Taylor  <iant@google.com>
5419
5420         * resolve.cc (Symbol_table::resolve): When merging common symbols,
5421         keep the larger alignment.
5422
5423 2012-03-12  Cary Coutant  <ccoutant@google.com>
5424
5425         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
5426         handling of DW_LNE_define_file.
5427
5428 2012-03-12  Cary Coutant  <ccoutant@google.com>
5429
5430         * reduced_debug_output.cc
5431         (Output_reduced_debug_info_section::get_die_end): Add new FORM
5432         codes to switch.
5433
5434 2012-02-29  Cary Coutant  <ccoutant@google.com>
5435
5436         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
5437
5438 2012-02-29  Cary Coutant  <ccoutant@google.com>
5439
5440         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5441         Call Object::decompressed_section_contents.
5442         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
5443         New dtor.
5444         (Sized_dwarf_line_info::buffer_start_): New data member.
5445         * merge.cc (Output_merge_data::do_add_input_section): Call
5446         Object::decompressed_section_contents.
5447         (Output_merge_string::do_add_input_section): Likewise.
5448         * object.cc (need_decompressed_section): New function.
5449         (build_compressed_section_map): Decompress sections needed later.
5450         (Sized_relobj_file::do_decompressed_section_contents): New function.
5451         (Sized_relobj_file::do_discard_decompressed_sections): New function.
5452         * object.h (Object::decompressed_section_contents): New function.
5453         (Object::discard_decompressed_sections): New function.
5454         (Object::do_decompressed_section_contents): New function.
5455         (Object::do_discard_decompressed_sections): New function.
5456         (Compressed_section_info): New type.
5457         (Compressed_section_map): Include decompressed section contents.
5458         (Sized_relobj_file::do_decompressed_section_contents): New function.
5459         (Sized_relobj_file::do_discard_decompressed_sections): New function.
5460
5461 2012-02-16  Cary Coutant  <ccoutant@google.com>
5462
5463         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
5464         * testsuite/Makefile.in: Regenerate.
5465
5466 2012-02-14  Cary Coutant  <ccoutant@google.com>
5467
5468         * options.cc (General_options::finalize): Disallow -pie and -static.
5469
5470 2012-02-03  Doug Kwan  <dougkwan@google.com>
5471
5472         * arm.cc (Arm_relocate_functions::abs8,
5473         Arm_relocate_functions::abs16): Use
5474         Bits::has_signed_unsigned_overflow32.
5475         (Arm_relocate_functions::thm_abs8): Correct range of
5476         overflow check.
5477         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
5478         in assertions.
5479
5480 2012-02-02  Doug Kwan  <dougkwan@google.com>
5481
5482         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
5483         position independent outputs, not just shared objects.
5484
5485 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
5486
5487         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
5488         * configure: Regenerated.
5489
5490 2012-01-27  Ian Lance Taylor  <iant@google.com>
5491
5492         * reloc.h (Bits): New class with static functions, copied from
5493         namespace utils in arm.cc.
5494         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
5495         instead.
5496
5497 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5498
5499         * incremental.cc (write_info_blocks): Correct relocation offset.
5500
5501 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5502
5503         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
5504         (Relocate::tls_gd_to_le): Likewise.
5505
5506 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5507
5508         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
5509
5510 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5511
5512         * configure.ac: Check if -mcmodel=medium works.
5513         * configure: Regenerated.
5514
5515 2012-01-24  Cary Coutant  <ccoutant@google.com>
5516
5517         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
5518         definition and ...
5519         (read_unsigned_LEB_128_x): ... this new function.
5520         (read_signed_LEB_128): Replaced with inline definition and ...
5521         (read_signed_LEB_128_x): ... this new function.
5522         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
5523         (read_unsigned_LEB_128): Add inline definition.
5524         (read_signed_LEB_128_x): New function.
5525         (read_signed_LEB_128): Add inline definition.
5526         * testsuite/Makefile.am (leb128_unittest): New unit test.
5527         * testsuite/Makefile.in: Regenerate.
5528         * testsuite/leb128_unittest.cc: New unit test.
5529
5530 2012-01-23  Ian Lance Taylor  <iant@google.com>
5531
5532         PR gold/13617
5533         * i386.cc (Target_i386::do_code_fill): When using a jmp
5534         instruction, pad with nop instructions.
5535         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5536
5537 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
5538
5539         * x86_64.cc (gc_process_relocs): Add typename on types used in
5540         template.
5541         (scan_relocs): Likewise.
5542         (relocate_section): Likewise.
5543         (apply_relocation): Likewise.
5544
5545 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
5546
5547         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
5548         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
5549         under x32.
5550
5551 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
5552
5553         * x86_64.cc: Initial support for x32.
5554
5555 2012-01-03  Cary Coutant  <ccoutant@google.com>
5556
5557         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
5558         Use abstract base class for GOT.
5559         * gold/output.h (class Output_data_got_base): New abstract base class.
5560         (class Output_data_got): Derive from new base class, adjust ctors.
5561         (Output_data_got::reserve_slot): Make virtual; rename to
5562         do_reserve_slot; Adjust callers.
5563         * gold/target.h (Sized_target::init_got_plt_for_update): Return
5564         pointer to abstract base class.
5565         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
5566
5567 2011-12-18  Ian Lance Taylor  <iant@google.com>
5568
5569         * object.h (Relobj::local_symbol_value): New function.
5570         (Relobj::local_plt_offset): New function.
5571         (Relobj::local_has_got_offset): New function.
5572         (Relobj::local_got_offset): New function.
5573         (Relobj::set_local_got_offset): New function.
5574         (Relobj::do_local_symbol_value): New pure virtual function.
5575         (Relobj::do_local_plt_offset): Likewise.
5576         (Relobj::do_local_has_got_offset): Likewise.
5577         (Relobj::do_local_got_offset): Likewise.
5578         (Relobj::do_set_local_got_offset): Likewise.
5579         (Sized_relobj::do_local_has_got_offset): Rename from
5580         local_has_got_offset.
5581         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
5582         (Sized_relobj::do_set_local_got_offset): Rename from
5583         set_local_got_offset.
5584         (Sized_relobj_file::do_local_plt_offset): Rename from
5585         local_plt_offset.
5586         (Sized_relobj_file::do_local_symbol_value): New function.
5587         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
5588         local_plt_offset.
5589         * output.cc (Output_data_got::Got_entry::write): Change object to
5590         Relobj.  Use local_symbol_value.
5591         (Output_data_got::add_global_with_rel): Change rel_dyn to
5592         Output_data_reloc_generic*.  Use add_global_generic.
5593         (Output_data_got::add_global_with_rela): Remove.  Change all
5594         callers to use add_global_with_rel.
5595         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
5596         Output_data_reloc_generic*.  Use add_global_generic.
5597         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
5598         callers to use add_global_pair_with_rel.
5599         (Output_data_got::add_local): Change object to Relobj*.
5600         (Output_data_got::add_local_plt): Likewise.
5601         (Output_data_got::add_local_with_rel): Change object to Relobj*,
5602         change rel_dyn to Output_data_reloc_generic*.  Use
5603         add_local_generic.
5604         (Output_data_got::add_local_with_rela): Remove.  Change all
5605         callers to use all_local_with_rel.
5606         (Output_data_got::add_local_pair_with_rel): Change object to
5607         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
5608         add_output_section_generic.
5609         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
5610         callers to use add_local_pair_with_rel.
5611         (Output_data_got::reserve_local): Change object to Relobj*.
5612         * output.h: (class Output_data_reloc_generic): Add pure virtual
5613         declarations for add_global_generic, add_local_generic,
5614         add_output_section_generic.
5615         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
5616         functions for Output_data_reloc_generic.  Update declarations for
5617         changes listed in output.cc.
5618         (class Output_data_got): Change template parameter to got_size.
5619         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
5620         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
5621         function.
5622         (Sized_relobj_incr::do_local_plt_offset): New function.
5623         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
5624         add_global_generic.
5625
5626 2011-12-17  Cary Coutant  <ccoutant@google.com>
5627
5628         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
5629         * resolve.cc (Symbol_table::resolve): Likewise.
5630         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
5631         arrays.
5632         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5633
5634 2011-12-16  Ian Lance Taylor  <iant@google.com>
5635
5636         * output.h (Output_data_reloc_generic::add): Only call
5637         add_dynamic_reloc if this is a dynamic reloc section.
5638
5639 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
5640
5641         PR gold/13505
5642         * target-reloc.h (apply_relocation): Replace <64, false> with
5643         <size, big_endian>.
5644
5645 2011-11-25  Nick Clifton  <nickc@redhat.com>
5646
5647         * po/it.po: New Italian translation.
5648
5649 2011-11-17  Sterling Augustine  <saugustine@google.com>
5650
5651         * script.cc (script_include_directive): Implement.
5652         (read_script_file): New local variables name and search_path. Update
5653         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
5654         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
5655         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
5656
5657 2011-11-11  Sterling Augustine  <saugustine@google.com>
5658
5659         * yyscript.y (section_cmd): Add support for INCLUDE directive.
5660         (file_or_sections_cmd): Likewise.
5661
5662 2011-11-11  Doug Kwan  <dougkwan@google.com>
5663
5664         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
5665         if --just-symbols is given.
5666
5667 2011-11-10  Doug Kwan  <dougkwan@google.com>
5668
5669         PR gold/13362
5670         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
5671         when processing data relocs.
5672         * reloc.h (Relocate_functions::rel_unaligned): New method.
5673         (Relocate_functions::pcrel_unaligned): Ditto.
5674         (Relocate_functions::rel32_unaligned): Ditto.
5675         (Relocate_functions::pcrel32_unaligned): Ditto.
5676
5677 2011-11-09  Doug Kwan  <dougkwan@google.com>
5678
5679         PR gold/13362
5680         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
5681         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
5682         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
5683         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5684         (Relocate_functions::rel_unaligned): New.
5685         (Relocate_functions::rel32_unaligned): New.
5686         * target-reloc.h (relocate_for_relocatable): Add code to handle
5687         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5688         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
5689         arm_unaligned_reloc_r): New targets.
5690         * testsuite/Makefile.in: Regenerate.
5691         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
5692         linking.
5693
5694 2011-11-02  Ian Lance Taylor  <iant@google.com>
5695
5696         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
5697         NATIVE_LINKER.
5698         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
5699         * options.cc (General_options::finalize): Use library search path
5700         from configure script if specified.  If not native and no sysroot,
5701         only search TOOLLIBDIR.
5702         * options.h (Search_directory::Search_directory): Change name to
5703         const std::string&.
5704         (General_options::add_to_library_path_with_sysroot): Change arg to
5705         const std::string&.
5706         * configure, Makefile.in, config.in: Rebuild.
5707
5708 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5709
5710         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
5711         we are working around the ARM1176 Erratum.
5712         * options.h (General_options::fix_arm1176): Add option.
5713         * testsuite/Makefile.am: Add testcases, and keep current ones
5714         working.
5715         * testsuite/Makefile.in: Regenerate.
5716         * testsuite/arm_fix_1176.s: New file.
5717         * testsuite/arm_fix_1176.sh: Likewise.
5718
5719 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5720
5721         * arm.cc (Target_arm::Target_arm): Remove initialisation of
5722         may_use_blx_.
5723         (Target_arm::may_use_blx): Remove method.
5724         (Target_arm::set_may_use_blx): Likewise.
5725         (Target_arm::may_use_v4t_interworking): New method.
5726         (Target_arm::may_use_v5t_interworking): Likewise.
5727         (Target_arm::may_use_blx_): Remove member variable.
5728         (Arm_relocate_functions::arm_branch_common): Check for v5T
5729         interworking.
5730         (Arm_relocate_functions::thumb_branch_common): Likewise.
5731         (Reloc_stub::stub_type_for_reloc): Likewise.
5732         (Target_arm::do_finalize_sections): Correct interworking checks.
5733         * testsuite/Makefile.am: Add new tests.
5734         * testsuite/Makefile.in: Regenerate.
5735         * testsuite/arm_farcall_arm_arm.s: New test.
5736         * testsuite/arm_farcall_arm_arm.sh: Likewise.
5737         * testsuite/arm_farcall_arm_thumb.s: Likewise.
5738         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
5739         * testsuite/arm_farcall_thumb_arm.s: Likewise.
5740         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
5741         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
5742         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
5743
5744 2011-10-31  Cary Coutant  <ccoutant@google.com>
5745
5746         PR gold/13023
5747         * expression.cc (Expression::eval_with_dot): Add
5748         is_section_dot_assignment parameter.
5749         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
5750         absolute and assigning to dot within a section.
5751         * script-sections.cc
5752         (Output_section_element_assignment::set_section_addresses): Pass
5753         dot_section to set_if_absolute.
5754         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
5755         as is_section_dot_assignment flag to eval_with_dot.
5756         (Output_section_element_dot_assignment::set_section_addresses):
5757         Likewise.
5758         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
5759         parameter.  Also set value if relative to dot_section; set the
5760         symbol's output_section.
5761         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
5762         parameter.  Adjust all callers.
5763         (Expression::eval_maybe_dot): Likewise.
5764         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
5765         Adjust all callers.
5766         * testsuite/script_test_2.t: Test assignment of an absolute value
5767         to dot within an output section element.
5768
5769 2011-10-31  Cary Coutant  <ccoutant@google.com>
5770
5771         * options.h (class General_options): Add --[no-]gnu-unique options.
5772         * symtab.cc (Symbol_table::sized_write_globals): Convert
5773         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
5774
5775 2011-10-31  Cary Coutant  <ccoutant@google.com>
5776
5777         PR gold/13359
5778         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
5779         unnecessary assertion.
5780         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
5781
5782 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
5783
5784         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5785         gc_mark_symbol.
5786         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5787         gc_mark_symbol.
5788         Change to just keep the section associated with symbol.
5789         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
5790         they are externally visible and --export-dynamic is turned on.
5791         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
5792
5793 2011-10-19  Ian Lance Taylor  <iant@google.com>
5794
5795         PR gold/13163
5796         * script-sections.cc
5797         (Output_section_element_dot_assignment::needs_output_section): New
5798         function.
5799
5800 2011-10-19  Ian Lance Taylor  <iant@google.com>
5801
5802         PR gold/13204
5803         * layout.cc (Layout::segment_precedes): Don't assert failure if a
5804         --section-start option was seen.
5805         * options.h (General_options::any_section_start): New function.
5806
5807 2011-10-18  David S. Miller  <davem@davemloft.net>
5808
5809         PR binutils/13301
5810         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
5811         member to track relocation locations that have moved during TLS
5812         reloc optimizations.
5813         (Target_sparc::Relocate::Relocate): Initialize to NULL.
5814         (Target_sparc::Relocate::relocate): Adjust view down by 4
5815         bytes if it matches reloc_adjust_addr_.
5816         (Target_sparc::Relocate::relocate_tls): Always move the
5817         __tls_get_addr call delay slot instruction forward 4 bytes when
5818         performing relaxation.
5819
5820 2011-10-18  Cary Coutant  <ccoutant@google.com>
5821
5822         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
5823         (Output_file::map_no_anonymous): Check for non-zero
5824         return code from posix_fallocate.
5825
5826 2011-10-17  Cary Coutant  <ccoutant@google.com>
5827
5828         PR gold/13245
5829         * plugin.cc (is_visible_from_outside): Check for symbols
5830         referenced from dynamic objects.
5831         * resolve.cc (Symbol_table::resolve): Don't count references
5832         from dynamic objects as references from real ELF files.
5833         * testsuite/plugin_test_2.sh: Adjust expected result.
5834
5835 2011-10-17  Cary Coutant  <ccoutant@google.com>
5836
5837         * gold.cc: Include timer.h.
5838         (queue_middle_tasks): Stamp time.
5839         (queue_final_tasks): Likewise.
5840         * main.cc (main): Store timer in parameters.  Print timers
5841         for each pass.
5842         * parameters.cc (Parameters::Parameters): Initialize timer_.
5843         (Parameters::set_timer): New function.
5844         (set_parameters_timer): New function.
5845         * parameters.h (Parameters::set_timer): New function.
5846         (Parameters::timer): New function.
5847         (Parameters::timer_): New data member.
5848         (set_parameters_timer): New function.
5849         * timer.cc (Timer::stamp): New function.
5850         (Timer::get_pass_time): New function.
5851         * timer.h (Timer::stamp): New function.
5852         (Timer::get_pass_time): New function.
5853         (Timer::pass_times_): New data member.
5854
5855 2011-10-17  Cary Coutant  <ccoutant@google.com>
5856
5857         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
5858         task for members of lib groups.
5859
5860 2011-10-17  Cary Coutant  <ccoutant@google.com>
5861
5862         PR gold/13288
5863         * fileread.cc (File_read::find_view): Add assert.
5864         (File_read::make_view): Move bounds check (replace with assert)...
5865         (File_read::find_or_make_view): ... to here.
5866
5867 2011-10-12  Cary Coutant  <ccoutant@google.com>
5868
5869         * output.cc (Output_file::open_base_file): Handle case where
5870         ::read returns less than requested size.
5871
5872 2011-10-10  Cary Coutant  <ccoutant@google.com>
5873
5874         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
5875         Initialize defined_count_.
5876         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
5877         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
5878         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
5879         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
5880         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
5881         * incremental.h (Sized_relobj_incr::defined_count_): New data
5882         member.
5883         (Sized_incr_dynobj::defined_count_): New data member.
5884         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
5885         Return zeroes instead of internal error.
5886
5887 2011-10-10  Cary Coutant  <ccoutant@google.com>
5888
5889         PR gold/13249
5890         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
5891         (Output_reloc::symbol_value): Return PLT offset if flag is set.
5892         * output.h (class Output_reloc): Add use_plt_offset flag.
5893         (Output_reloc::type_): Adjust size of bit field.
5894         (Output_reloc::use_plt_offset_): New bit field.
5895         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
5896         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
5897         flag.  Adjust all callers.
5898         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
5899         creating RELATIVE relocations.
5900
5901 2011-10-10  Nick Clifton  <nickc@redhat.com>
5902
5903         * po/es.po: Updated Spanish translation.
5904         * po/fi.po: Updated Finnish translation.
5905
5906 2011-10-03   Diego Novillo  <dnovillo@google.com>
5907
5908         * options.cc (parse_uint): Fix dereference of RETVAL.
5909
5910 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
5911
5912         * layout.h (section_order_map_): New member.
5913         (get_section_order_map): New member function.
5914         * output.cc (Output_section::add_input_section): Check for patterns
5915         only when --section-ordering-file is specified.
5916         * gold.cc (queue_middle_tasks): Delay updating order of sections till
5917         output_sections have been formed.
5918         * layout.cc (Layout_Layout): Initialize section_order_map_.
5919         * plugin.cc (update_section_order): Store order in order_map. Do not
5920         update the order.
5921         * testsuite/Makefile.am: Add test case for plugin_final_layout.
5922         * testsuite/Makefile.in: Regenerate.
5923         * testsuite/plugin_section_order.c: New file.
5924         * testsuite/plugin_final_layout.cc: New file.
5925         * testsuite/plugin_final_layout.sh: New file.
5926
5927 2011-09-29  Cary Coutant  <ccoutant@google.com>
5928
5929         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5930         Check for NULL.
5931         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
5932         symbols during incremental update.
5933         (Symbol_table::add_from_dynobj): Likewise.
5934
5935 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5936             Ian Lance Taylor  <iant@google.com>
5937
5938         * symtab.cc (Symbol_table::define_special_symbol): Always
5939         canonicalize version string.
5940
5941 2011-09-26  Cary Coutant  <ccoutant@google.com>
5942
5943         * gold.cc (queue_initial_tasks): Move option checks ...
5944         * options.cc (General_options::finalize): ... to here. Disable
5945         some options; make others fatal.
5946
5947 2011-09-26  Cary Coutant  <ccoutant@google.com>
5948
5949         gcc PR lto/47247
5950         * plugin.cc (get_symbols_v2): New function.
5951         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
5952         (is_referenced_from_outside): New function.
5953         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
5954         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
5955         (get_symbols): Pass version parameter.
5956         (get_symbols_v2): New function.
5957         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
5958         parameter.
5959         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
5960         (onload): Add LDPT_GET_SYMBOLS_V2.
5961         (all_symbols_read_hook): Use get_symbols_v2; check for
5962         LDPR_PREVAILING_DEF_IRONLY_EXP.
5963         * testsuite/plugin_test_3.sh: Update expected results.
5964
5965 2011-09-23  Simon Baldwin  <simonb@google.com>
5966
5967         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5968         configuration options.
5969         * configure: Regenerate.
5970         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
5971         * Makefile.in: Regenerate.
5972         * testsuite/Makefile.in: Regenerate.
5973
5974 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
5975
5976         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
5977
5978 2011-09-19  Cary Coutant  <ccoutant@google.com>
5979
5980         * incremental.cc (can_incremental_update): Fix typo in comment.
5981         * incremental.h (can_incremental_update): Likewise.
5982
5983 2011-09-18  Cary Coutant  <ccoutant@google.com>
5984
5985         * incremental.cc (can_incremental_update): New function.
5986         * incremental.h (can_incremental_update): New function.
5987         * layout.cc (Layout::init_fixed_output_section): Call it.
5988         (Layout::make_output_section): Don't allow patch space in .eh_frame.
5989         * object.cc (Sized_relobj_file::do_layout): Call
5990         can_incremental_update.
5991
5992 2011-09-13  Cary Coutant  <ccoutant@google.com>
5993
5994         * configure.ac: Check for glibc support for gnu_indirect_function
5995         support with static linking, setting automake conditional
5996         IFUNC_STATIC.
5997         * Makefile.in: Regenerate.
5998         * configure: Regenerate.
5999
6000         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
6001         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
6002         for IFUNC_STATIC.
6003         * testsuite/Makefile.in: Regenerate.
6004
6005 2011-09-13  Cary Coutant  <ccoutant@google.com>
6006
6007         * incremental.cc (Sized_relobj_incr::do_layout): Call
6008         report_comdat_group for kept comdat sections.
6009         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
6010         * testsuite/Makefile.in: Regenerate.
6011         * testsuite/incr_comdat_test_1.cc: New source file.
6012         * testsuite/incr_comdat_test_2_v1.cc: New source file.
6013         * testsuite/incr_comdat_test_2_v2.cc: New source file.
6014         * testsuite/incr_comdat_test_2_v3.cc: New source file.
6015
6016 2011-09-13  Ian Lance Taylor  <iant@google.com>
6017
6018         * object.cc (Sized_relobj_file::do_layout): Remove unused local
6019         variable external_symbols_offset.
6020
6021 2011-09-12  Ian Lance Taylor  <iant@google.com>
6022
6023         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
6024         triggered if object has no symbols.
6025
6026 2011-09-09  David S. Miller  <davem@davemloft.net>
6027
6028         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
6029         (Output_fill_debug_line::do_write): Likewise.
6030
6031 2011-08-29  Cary Coutant  <ccoutant@google.com>
6032
6033         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
6034         casts to match formatting specs.
6035         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
6036
6037 2011-08-26  Cary Coutant  <ccoutant@google.com>
6038
6039         * layout.cc (Free_list::allocate): Provide guarantee of minimum
6040         remaining hole size when allocating.
6041         (Layout::make_output_section): Set fill methods for debug sections.
6042         * layout.h (Free_list::Free_list_node): Move from private to
6043         public.
6044         (Free_list::set_min_hole_size): New function.
6045         (Free_list::begin, Free_list::end): New functions.
6046         (Free_list::min_hole_): New data member.
6047         * output.cc: Include dwarf.h.
6048         (Output_fill_debug_info::do_minimum_hole_size): New function.
6049         (Output_fill_debug_info::do_write): New function.
6050         (Output_fill_debug_line::do_minimum_hole_size): New function.
6051         (Output_fill_debug_line::do_write): New function.
6052         (Output_section::Output_section): Initialize new data member.
6053         (Output_section::set_final_data_size): Ensure patch space is larger
6054         than minimum hole size.
6055         (Output_section::do_write): Fill holes in debug sections.
6056         * output.h (Output_fill): New class.
6057         (Output_fill_debug_info): New class.
6058         (Output_fill_debug_line): New class.
6059         (Output_section::set_free_space_fill): New function.
6060         (Output_section::free_space_fill_): New data member.
6061         * testsuite/Makefile.am (incremental_test_3): Add
6062         --incremental-patch option.
6063         (incremental_test_4): Likewise.
6064         (incremental_test_5): Likewise.
6065         (incremental_test_6): Likewise.
6066         (incremental_copy_test): Likewise.
6067         (incremental_common_test_1): Likewise.
6068         * testsuite/Makefile.in: Regenerate.
6069
6070 2011-08-26  Nick Clifton  <nickc@redhat.com>
6071
6072         * po/es.po: Updated Spanish translation.
6073
6074 2011-08-01  Cary Coutant  <ccoutant@google.com>
6075
6076         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
6077         * gold/testsuite/Makefile.in: Regenerate.
6078         * gold/testsuite/justsyms_exec.c: New source file.
6079         * gold/testsuite/justsyms_lib.c: New source file.
6080
6081 2011-08-01  Cary Coutant  <ccoutant@google.com>
6082
6083         * layout.cc (Layout::set_segment_offsets): Don't realign text
6084         segment if -Ttext was specified.
6085         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
6086         file type.
6087         * object.h (Sized_relobj_file::e_type): New function.
6088         (Sized_relobj_file::e_type_): New data member.
6089         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
6090         base address for ET_EXEC files.
6091         * target.cc (Target::do_make_elf_object_implementation): Allow
6092         ET_EXEC files with --just-symbols option.
6093
6094 2011-07-28  Cary Coutant  <ccoutant@google.com>
6095
6096         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
6097         Add thread_number parameter.
6098         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
6099         * workqueue-threads.cc
6100         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
6101         current thread if its thread number is greater than desired thread
6102         count.
6103         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
6104         Add thread_number parameter.
6105         (Workqueue::should_cancel_thread): Likewise.
6106         (Workqueue::find_runnable_or_wait): Pass thread_number to
6107         should_cancel_thread.
6108         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
6109         parameter.
6110
6111 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
6112
6113         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
6114         only after checking if it cannot be forced local.
6115         * symtab.h (is_externally_visible): Check if the symbol is not forced
6116         local.
6117
6118 2011-07-15  Ian Lance Taylor  <iant@google.com>
6119
6120         * options.h (class General_options): Add --print-output-format.
6121         Move -EL next to -EB, for  better --help output.
6122         * target-select.cc: Include <cstdio>, "options.h", and
6123         "parameters.h".
6124         (Target_selector::do_target_bfd_name): New function.
6125         (print_output_format): New function.
6126         * target-select.h (class Target_selector): Update declarations.
6127         (Target_selector::target_bfd_name): New function.
6128         (print_output_format): Declare.
6129         * main.cc: Include "target-select.h".
6130         (main): Handle --print-output-format.
6131         * gold.cc: Include "target-select.h".
6132         (queue_initial_tasks): Handle --print-output-format when there are
6133         no input files.
6134         * parameters.cc (parameters_force_valid_target): Give a better
6135         error message if -EB/-EL does not match target.
6136         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
6137         function.
6138
6139 2011-07-15  Ian Lance Taylor  <iant@google.com>
6140
6141         * i386.cc (class Output_data_plt_i386): Add layout_ field.
6142         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
6143         (Output_data_plt_i386::do_write): Write address of .dynamic
6144         section to first entry in .got.plt section.
6145         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
6146         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
6147         Initialize layout_.
6148         (Output_data_plt_x86_64::do_write): Write address of .dynamic
6149         section to first entry in .got.plt section.
6150         * layout.h (Layout::dynamic_section): New function.
6151
6152 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
6153
6154         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
6155         to claim_file call.
6156         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
6157         input_section_position_, and input_section_glob_.
6158         (read_layout_from_file): Call function section_ordering_specified.
6159         * layout.h (is_section_ordering_specified): New function.
6160         (section_ordering_specified): New function.
6161         (section_ordering_specified_): New boolean member.
6162         * main.cc(main): Call load_plugins after layout object is defined.
6163         * output.cc (Output_section::add_input_section): Use
6164         function section_ordering_specified to check if section ordering is
6165         needed.
6166         * output.cc (Output_section::add_relaxed_input_section): Use
6167         function section_ordering_specified to check if section ordering is
6168         needed.
6169         (Output_section::update_section_layout): New function.
6170         (Output_section::sort_attached_input_sections): Check if input section
6171         must be reordered.
6172         * output.h (Output_section::update_section_layout): New function.
6173         * plugin.cc (get_section_count): New function.
6174         (get_section_type): New function.
6175         (get_section_name): New function.
6176         (get_section_contents): New function.
6177         (update_section_order): New function.
6178         (allow_section_ordering): New function.
6179         (Plugin::load): Add the new interfaces to the transfer vector.
6180         (Plugin_manager::load_plugins): New parameter.
6181         (Plugin_manager::all_symbols_read): New parameter.
6182         (Plugin_manager::claim_file): New parameter. Save the elf object for
6183         unclaimed objects.
6184         (Plugin_manager::get_elf_object): New function.
6185         (Plugin_manager::get_view): Change to directly use the bool to check
6186         if get_view is called from claim_file_hook.
6187         * plugin.h (input_objects): New function
6188         (Plugin__manager::load_plugins): New parameter.
6189         (Plugin_manager::claim_file): New parameter.
6190         (Plugin_manager::get_elf_object): New function.
6191         (Plugin_manager::in_claim_file_handler): New function.
6192         (Plugin_manager::in_claim_file_handler_): New member.
6193         (layout): New function.
6194         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
6195         handler with an extra parameter. Make the elf object before calling
6196         claim_file handler.
6197         * testsuite/plugin_test.c (get_section_count): New function pointer.
6198         (get_section_type): New function pointer.
6199         (get_section_name): New function pointer.
6200         (get_section_contents): New function pointer.
6201         (update_section_order): New function pointer.
6202         (allow_section_ordering): New function pointer.
6203         (onload): Check if the new interfaces exist.
6204
6205 2011-07-13  Ian Lance Taylor  <iant@google.com>
6206
6207         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
6208         relro section.
6209         * x86_64.cc (Target_x86_64::got_section): Likewise.
6210         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
6211         (relro_now_test_SOURCES): New variable.
6212         (relro_now_test_DEPENDENCIES): New variable.
6213         (relro_now_test_LDFLAGS): New variable.
6214         (relro_now_test_LDADD): New variable.
6215         (relro_now_test.so): New target.
6216         * testsuite/Makefile.in: Rebuild.
6217
6218 2011-07-12  Ian Lance Taylor  <iant@google.com>
6219
6220         PR gold/12980
6221         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
6222         GLOB_DAT relocation rather than a RELATIVE relocation for a
6223         protected symbol when creating a shared library.
6224         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6225         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
6226         * testsuite/protected_main_1.cc (main): Test that protected
6227         function has same address.
6228
6229 2011-07-11  Ian Lance Taylor  <iant@google.com>
6230
6231         PR gold/12979
6232         * options.h (class General_options): Add -Bgroup.
6233         * options.cc (General_options::finalize): If -Bgroup is set,
6234         default to --unresolved-symbols=report-all.
6235         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
6236         * target-reloc.h (issue_undefined_symbol_error): Handle
6237         --unresolved-symbols=report-all.
6238
6239 2011-07-08  Ian Lance Taylor  <iant@google.com>
6240
6241         PR gold/11985
6242         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
6243         if linker script discards key sections.
6244         (Layout::create_dynamic_symtab): Likewise.
6245         (Layout::assign_local_dynsym_offsets): Likewise.
6246         (Layout::sized_create_version_sections): Likewise.
6247         (Layout::create_interp): Likewise.
6248         (Layout::finish_dynamic_section): Likewise.
6249         (Layout::set_dynamic_symbol_size): Likewise.
6250
6251 2011-07-08  Ian Lance Taylor  <iant@google.com>
6252
6253         PR gold/12386
6254         * options.h (class General_options): Add --unresolved-symbols.
6255         * target-reloc.h (issue_undefined_symbol_error): Check
6256         --unresolved-symbols.  Add comments.
6257
6258 2011-07-08  Ian Lance Taylor  <iant@google.com>
6259
6260         * testsuite/odr_violation2.cc (Ordering::operator()): Make
6261         expression more complex.
6262
6263 2011-07-08  Ian Lance Taylor  <iant@google.com>
6264
6265         PR gold/11317
6266         * target-reloc.h (issue_undefined_symbol_error): New inline
6267         function, broken out of relocate_section.
6268         (relocate_section): Call issue_undefined_symbol_error.
6269         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
6270         there is no TLS segment if we are about to issue an undefined
6271         symbol error.
6272         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
6273
6274 2011-07-08  Ian Lance Taylor  <iant@google.com>
6275
6276         PR gold/12279
6277         * resolve.cc (Symbol_table::should_override): Add fromtype
6278         parameter.  Change all callers.  Give error when linking together
6279         TLS and non-TLS symbol.
6280         (Symbol_table::should_override_with_special): Add fromtype
6281         parameter.  Change all callers.
6282         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
6283         there is no TLS segment if we have reported some errors.
6284         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
6285
6286 2011-07-08  Ian Lance Taylor  <iant@google.com>
6287
6288         PR gold/12372
6289         * target.h (Target::plt_address_for_global): New function.
6290         (Target::plt_address_for_local): New function.
6291         (Target::plt_section_for_global): Remove.
6292         (Target::plt_section_for_local): Remove.
6293         (Target::do_plt_address_for_global): New virtual function.
6294         (Target::do_plt_address_for_local): New virtual function.
6295         (Target::do_plt_section_for_global): Remove.
6296         (Target::do_plt_section_for_local): Remove.
6297         (Target::register_global_plt_entry): Add Symbol_table and Layout
6298         parameters.
6299         * output.cc (Output_data_got::Got_entry::write): Use
6300         plt_address_for_global and plt_address_for_local.
6301         * layout.cc (Layout::add_target_dynamic_tags): Use size and
6302         address of output section.
6303         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
6304         got_irelative_, and irelative_count_ fields.  Update
6305         declarations.
6306         (Output_data_plt_i386::has_irelative_section): New function.
6307         (Output_data_plt_i386::entry_count): Add irelative_count_.
6308         (Output_data_plt_i386::set_final_data_size): Likewise.
6309         (class Target_i386): Add got_irelative_ and rel_irelative_
6310         fields.  Update declarations.
6311         (Target_i386::Target_i386): Initialize new fields.
6312         (Target_i386::do_plt_address_for_global): New function replacing
6313         do_plt_section_for_global.
6314         (Target_i386::do_plt_address_for_local): New function replacing
6315         do_plt_section_for_local.
6316         (Target_i386::got_section): Create got_irelative_.
6317         (Target_i386::rel_irelative_section): New function.
6318         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
6319         fields.  Don't define __rel_iplt_{start,end}.
6320         (Output_data_plt_i386::add_entry): Add symtab and layout
6321         parameters.  Change all callers.  Use different PLT and GOT for
6322         IFUNC symbols.
6323         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
6324         layout parameters.  Change all callers.  Use different PLT and
6325         GOT.
6326         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
6327         (Output_data_plt_i386::rel_irelative): New function.
6328         (Output_data_plt_i386::address_for_global): New function.
6329         (Output_data_plt_i386::address_for_local): New function.
6330         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
6331         IRELATIVE GOT when changing IFUNC GOT entries.
6332         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
6333         reloc.
6334         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
6335         if we didn't create an IRELATIVE GOT.
6336         (Target_i386::Relocate::relocate): Use plt_address_for_global and
6337         plt_address_for_local.
6338         (Target_i386::do_dynsym_value): Use plt_address_for_global.
6339         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
6340         got_irelative_, and irelative_count_ fields.  Update
6341         declarations.
6342         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
6343         Initialize new fields.  Remove symtab parameter.  Change all
6344         callers.
6345         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
6346         irelative_count_.
6347         (Output_data_plt_x86_64::has_irelative_section): New function.
6348         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
6349         (class Target_x86_64): Add got_irelative_ and rel_irelative_
6350         fields.  Update declarations.
6351         (Target_x86_64::Target_x86_64): Initialize new fields.
6352         (Target_x86_64::do_plt_address_for_global): New function replacing
6353         do_plt_section_for_global.
6354         (Target_x86_64::do_plt_address_for_local): New function replacing
6355         do_plt_section_for_local.
6356         (Target_x86_64::got_section): Create got_irelative_.
6357         (Target_x86_64::rela_irelative_section): New function.
6358         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
6359         all callers.  Don't create __rel_iplt_{start,end}.
6360         (Output_data_plt_x86_64::add_entry): Add symtab and layout
6361         parameters.  Change all callers.  Use different PLT and GOT for
6362         IFUNC symbols.
6363         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
6364         layout parameters.  Change all callers.  Use different PLT and
6365         GOT.
6366         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
6367         parameters.  Change all callers.  Use different PLT and GOT for
6368         IFUNC symbols.
6369         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
6370         (Output_data_plt_x86_64::rela_irelative): New function.
6371         (Output_data_plt_x86_64::address_for_global): New function.
6372         (Output_data_plt_x86_64::address_for_local): New function.
6373         (Output_data_plt_x86_64::set_final_data_size): Likewise.
6374         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
6375         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
6376         (Target_x86_64::register_global_plt_entry): Add symtab and layout
6377         parameters.
6378         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
6379         reloc.
6380         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
6381         symbols if we didn't create an IRELATIVE GOT.
6382         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
6383         plt_address_for_local.
6384         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
6385         * testsuite/ifuncvar1.c: New test file.
6386         * testsuite/ifuncvar2.c: New test file.
6387         * testsuite/ifuncvar3.c: New test file.
6388         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
6389         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
6390         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
6391         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
6392         * testsuite/Makefile.in: Rebuild.
6393
6394 2011-07-07  Cary Coutant  <ccoutant@google.com>
6395
6396         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
6397         (two_file_test_1_ndebug.o): Likewise.
6398         (two_file_test_1b_ndebug.o): Likewise.
6399         (two_file_test_2_ndebug.o): Likewise.
6400         (two_file_test_main_ndebug.o): Likewise.
6401         (incremental_test_2): Link with no-debug versions.
6402
6403 2011-07-06  Cary Coutant  <ccoutant@google.com>
6404
6405         * gold/incremental.cc
6406         (Output_section_incremental_inputs::write_info_blocks): Check for
6407         hidden and internal symbols.
6408
6409 2011-07-06  Cary Coutant  <ccoutant@google.com>
6410
6411         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
6412         Check disposition for startup file.
6413         (Incremental_inputs::report_command_line): Ignore
6414         --incremental-startup-unchanged option.
6415         * options.cc (General_options::parse_incremental_startup_unchanged):
6416         New function.
6417         (General_options::General_options): Initialize new data member.
6418         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
6419         (General_options): Add --incremental-startup-unchanged option.
6420         (General_options::incremental_startup_disposition): New function.
6421         (General_options::incremental_startup_disposition_): New data member.
6422
6423 2011-07-06  Cary Coutant  <ccoutant@google.com>
6424
6425         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
6426         input file index to Script_info ctor.
6427         (Sized_incremental_binary::do_file_has_changed): Find the
6428         command-line argument for files named in scripts.
6429         * incremental.h (Script_info::Script_info): New ctor
6430         with input file index.
6431         (Script_info::input_file_index): New function.
6432         (Script_info::input_file_index_): New data member.
6433         (Incremental_binary::get_library): Add const.
6434         (Incremental_binary::get_script_info): Add const.
6435         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
6436         * testsuite/Makefile.am (incremental_test_5): New test case.
6437         (incremental_test_6): New test case.
6438         * testsuite/Makefile.in: Regenerate.
6439
6440 2011-07-06  Cary Coutant  <ccoutant@google.com>
6441
6442         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
6443         debug output when command lines differ.
6444
6445 2011-07-06  Cary Coutant  <ccoutant@google.com>
6446
6447         * incremental.cc (Incremental_inputs::report_command_line): Ignore
6448         --incremental-patch option.
6449         * layout.cc (Free_list::allocate): Extend allocation beyond original
6450         end if enabled.
6451         (Layout::make_output_section): Mark sections that should get
6452         patch space.
6453         * options.cc (parse_percent): New function.
6454         * options.h (parse_percent): New function.
6455         (DEFINE_percent): New macro.
6456         (General_options): Add --incremental-patch option.
6457         * output.cc (Output_section::Output_section): Initialize new data
6458         members.
6459         (Output_section::add_input_section): Print section name when out
6460         of patch space.
6461         (Output_section::add_output_section_data): Likewise.
6462         (Output_section::set_final_data_size): Add patch space when
6463         doing --incremental-full.
6464         (Output_section::do_reset_address_and_file_offset): Remove patch
6465         space.
6466         (Output_segment::set_section_list_addresses): Print debug output
6467         only if --incremental-update.
6468         * output.h (Output_section::set_is_patch_space_allowed): New function.
6469         (Output_section::is_patch_space_allowed_): New data member.
6470         (Output_section::patch_space_): New data member.
6471         * parameters.cc (Parameters::incremental_full): New function.
6472         * parameters.h (Parameters::incremental_full): New function
6473         * testsuite/Makefile.am (incremental_test_2): Add test for
6474         --incremental-patch option.
6475         * testsuite/Makefile.in: Regenerate.
6476         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
6477         (t18): Remove function body.
6478
6479 2011-07-05  Doug Kwan  <dougkwan@google.com>
6480
6481         PR gold/12771
6482         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
6483         Arm_Address type for relocation result.
6484         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
6485         overflow check.
6486         (Arm_relocate_functions::abs32): Use unaligned access.
6487         (Arm_relocate_functions::rel32): Ditto.
6488         (Arm_relocate_functions::prel31): Ditto.
6489         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
6490         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
6491         static data relocations.
6492         * testsuite/Makefile.in: Regnerate.
6493         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
6494
6495 2011-07-05  Ian Lance Taylor  <iant@google.com>
6496
6497         PR gold/12392
6498         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
6499         symbols if necessary.
6500         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6501
6502 2011-07-05  Ian Lance Taylor  <iant@google.com>
6503
6504         PR gold/12952
6505         * resolve.cc (Symbol::override_base_with_special): Simply override
6506         version with special symbol version, ignoring previous version.
6507
6508 2011-07-05  Ian Lance Taylor  <iant@google.com>
6509
6510         * object.cc (Sized_relobj_file::include_section_group): Add
6511         information to comment about signature location.
6512
6513 2011-07-02  Ian Lance Taylor  <iant@google.com>
6514
6515         PR gold/12957
6516         * options.h (class General_options): Add -f and -F.
6517         * options.cc (General_options::finalize): Fatal error if -f/-F
6518         are used without -shared.
6519         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
6520
6521 2011-07-02  Ian Lance Taylor  <iant@google.com>
6522
6523         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
6524
6525 2011-07-01  Ian Lance Taylor  <iant@google.com>
6526
6527         PR gold/12525
6528         PR gold/12952
6529         * resolve.cc (Symbol::override_base_with_special): Don't override
6530         the version if the overriding symbol has a different name.
6531         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
6532         all callers.  If we give an error about an undefined version,
6533         define the base version if necessary.
6534         * dynobj.h (class Versions): Update declaration.
6535         * testsuite/weak_alias_test_5.cc: New file.
6536         * testsuite/weak_alias_test.script: New file.
6537         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
6538         and versioned_alias have the right value, and call t2.
6539         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
6540         weak_alias_test_5.so.
6541         (weak_alias_test_LDADD): Likewise.
6542         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
6543         * testsuite/Makefile.in: Rebuild.
6544
6545 2011-07-01  Ian Lance Taylor  <iant@google.com>
6546
6547         PR gold/12525
6548         * options.h (class General_options): Support -z notext.
6549         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
6550         -Wl,-z,notext.
6551         (two_file_shared_nonpic.so): Likewise.
6552         (two_file_shared_mixed.so): Likewise.
6553         (two_file_shared_mixed_1.so): Likewise.
6554         (weak_undef_lib_nonpic.so): Likewise.
6555         (alt/weak_undef_lib_nonpic.so): Likewise.
6556         (tls_test_shared_nonpic.so): Likewise.
6557         * testsuite/Makefile.in: Rebuild.
6558
6559 2011-07-01  Ian Lance Taylor  <iant@google.com>
6560
6561         PR gold/12525
6562         * configure.ac: Test whether static linking works, setting
6563         the automake conditional HAVE_STATIC.
6564         * testsuite/Makefile.am: Disable tests using -static if
6565         HAVE_STATIC is not true.
6566         * configure, testsuite/Makefile.in: Rebuild.
6567
6568 2011-07-01  Ian Lance Taylor  <iant@google.com>
6569
6570         PR gold/12525
6571         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
6572         Assert if we see DW_EH_PE_indirect.
6573         * target.h (Target::ehframe_datarel_base): New function.
6574         (Target::do_ehframe_datarel_base): New target function.
6575         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
6576         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
6577         function.
6578
6579 2011-07-01  Ian Lance Taylor  <iant@google.com>
6580
6581         PR gold/12571
6582         * options.h (class General_options): Add
6583         --ld-generated-unwind-info.
6584         * ehframe.cc (Fde::write): Add address parameter.  Change all
6585         callers.  If associated with PLT, fill in address and size.
6586         (Cie::set_output_offset): Only add merge mapping if there is an
6587         object.
6588         (Cie::write): Add address parameter.  Change all callers.
6589         (Eh_frame::add_ehframe_for_plt): New function.
6590         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
6591         input_offset_ fields into union u_, with new plt field.
6592         (Fde::Fde): Adjust for new union field.
6593         (Fde::Fde) [Output_data version]: New constructor.
6594         (Fde::add_mapping): Only add merge mapping if there is an object.
6595         (class Cie): Update declarations.
6596         (class Eh_frame): Declare add_ehframe_for_plt.
6597         * layout.cc (Layout::layout_eh_frame): Break out code into
6598         make_eh_frame_section, and call it.
6599         (Layout::make_eh_frame_section): New function.
6600         (Layout::add_eh_frame_for_plt): New function.
6601         * layout.h (class Layout): Update declarations.
6602         * merge.cc (Merge_map::add_mapping): Add assertion.
6603         * i386.cc: Include "dwarf.h".
6604         (class Output_data_plt_i386): Make first_plt_entry,
6605         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
6606         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6607         and plt_eh_frame_fde.
6608         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
6609         boundary.  Call add_eh_frame_for_plt if appropriate.
6610         * x86_64.cc: Include "dwarf.h".
6611         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
6612         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
6613         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6614         and plt_eh_frame_fde.
6615         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
6616         appropriate.
6617
6618 2011-06-29  Ian Lance Taylor  <iant@google.com>
6619
6620         PR gold/12629
6621         * object.cc (Sized_relobj_file::layout_section): Change shdr
6622         parameter to be const.
6623         (Sized_relobj_file::layout_eh_frame_section): New function, broken
6624         out of do_layout.
6625         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
6626         appropriate.  Call layout_eh_frame_section.
6627         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
6628         sections.
6629         * object.h (class Sized_relobj_file): Update declarations.
6630
6631 2011-06-29  Ian Lance Taylor  <iant@google.com>
6632
6633         PR gold/12652
6634         * script.cc (Token::integer_value): Accept trailing M/m/K/k
6635         modifier.
6636         (Lex::gather_token): Accept trailing M/m/K/k for integers.
6637
6638 2011-06-29  Ian Lance Taylor  <iant@google.com>
6639
6640         PR gold/12675
6641         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
6642         SHT_X86_64_UNWIND.
6643         * layout.cc (Layout::layout_eh_frame): Likewise.
6644
6645 2011-06-29  Ian Lance Taylor  <iant@google.com>
6646
6647         PR gold/12695
6648         * layout.cc (Layout::symtab_section_shndx): New function.
6649         * layout.h (class Layout): Declare symtab_section_shndx.
6650         * output.cc (Output_section::write_header): Call it.
6651
6652 2011-06-29  Ian Lance Taylor  <iant@google.com>
6653
6654         PR gold/12818
6655         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
6656         symbols which are not used in a relocation.
6657
6658 2011-06-28  Ian Lance Taylor  <iant@google.com>
6659
6660         PR gold/12898
6661         * layout.cc (Layout::segment_precedes): Don't crash if a linker
6662         script create indistinguishable segments.
6663         (Layout::set_segment_offsets): Use stable_sort when sorting
6664         segments.  Pass this to Compare_segments constructor.
6665         * layout.h (class Layout): Make segment_precedes non-static.
6666         (class Compare_segments): Change from struct to class.  Add
6667         layout_ field.  Add constructor.
6668         * script-sections.cc
6669         (Script_sections::attach_sections_using_phdrs_clause): Rename
6670         local orphan to is_orphan.  Don't report failure to put empty
6671         section in segment.  On attachment failure, report name of
6672         section, and attach to first PT_LOAD segment.
6673
6674 2011-06-28  Ian Lance Taylor  <iant@google.com>
6675
6676         PR gold/12934
6677         * target-select.cc (Target_selector::Target_selector): Add
6678         emulation parameter.  Change all callers.
6679         (select_target_by_bfd_name): Rename from select_target_by_name.
6680         Change all callers.
6681         (select_target_by_emulation): New function.
6682         (supported_emulation_names): New function.
6683         * target-select.h (class Target_selector): Add emulation_ field.
6684         Update declarations.
6685         (Target_selector::recognize_by_bfd_name): Rename from
6686         recognize_by_name.  Change all callers.
6687         (Target_selector::supported_bfd_names): Rename from
6688         supported_names.  Change all callers.
6689         (Target_selector::recognize_by_emulation): New function.
6690         (Target_selector::supported_emulations): New function.
6691         (Target_selector::emulation): New function.
6692         (Target_selector::do_recognize_by_bfd_name): Rename from
6693         do_recognize_by_name.  Change all callers.
6694         (Target_selector::do_supported_bfd_names): Rename from
6695         do_supported_names.  Change all callers.
6696         (Target_selector::do_recognize_by_emulation): New function.
6697         (Target_selector::do_supported_emulations): New function.
6698         (select_target_by_bfd_name): Change name in declaration.
6699         (select_target_by_emulation): Declare.
6700         (supported_emulation_names): Declare.
6701         * parameters.cc (parameters_force_valid_target): Try to find
6702         target based on emulation from -m option.
6703         * options.h (class General_options): Change doc string for -m.
6704         * options.cc (help): Print emulations.
6705         (General_options::parse_V): Likewise.
6706         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
6707         Add emulation parameter.  Change all callers.
6708
6709 2011-06-28  Ian Lance Taylor  <iant@google.com>
6710
6711         * target.h (class Target): Add osabi_ field.
6712         (Target::osabi): New function.
6713         (Target::set_osabi): New function.
6714         (Target::Target): Initialize osabi_.
6715         (Target::do_adjust_elf_header): Make pure virtual.
6716         (Sized_target::do_adjust_elf_header): Declare.
6717         * target.cc (Sized_target::do_adjust_elf_header): New function.
6718         (class Sized_target): Instantiate all versions.
6719         * freebsd.h (class Target_freebsd): Remove.
6720         (Target_selector_freebsd::do_recognize): Call set_osabi on
6721         Target.
6722         (Target_selector_freebsd::do_recognize_by_name): Likewise.
6723         (Target_selector_freebsd::set_osabi): Remove.
6724         * i386.cc (class Target_i386): Inherit from Sized_target rather
6725         than Target_freebsd.
6726         * x86_64.cc (class Target_x86_64): Likewise.
6727
6728 2011-06-28  Ian Lance Taylor  <iant@google.com>
6729
6730         * target.h (Target::can_check_for_function_pointers): Rewrite.
6731         Make non-virtual.
6732         (Target::can_icf_inline_merge_sections): Likewise.
6733         (Target::section_may_have_icf_unsafe_poineters): Likewise.
6734         (Target::Target_info): Add can_icf_inline_merge_sections field.
6735         (Target::do_can_check_for_function_pointers): New virtual
6736         function.
6737         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
6738         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
6739         from can_check_for_function_pointers, move in file.
6740         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
6741         section_may_have_icf_unsafe_poineters, move in file.
6742         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
6743         * i386.cc (Target_i386::do_can_check_for_function_pointers):
6744         Rename from can_check_for_function_pointers, move in file.
6745         (Target_i386::can_icf_inline_merge_sections): Remove.
6746         (Target_i386::i386_info): Initialize
6747         can_icf_inline_merge_sections.
6748         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6749         Initialize can_icf_inline_merge_sections.
6750         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
6751         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
6752         Rename from can_check_for_function_pointers, move in file.
6753         (Target_x86_64::can_icf_inline_merge_sections): Remove.
6754         (Target_x86_64::x86_64_info): Initialize
6755         can_icf_inline_merge_sections.
6756         * testsuite/testfile.cc (Target_test::test_target_info):
6757         Likewise.
6758         * icf.cc (get_section_contents): Correct formatting.
6759
6760 2011-06-27  Ian Lance Taylor  <iant@google.com>
6761
6762         * symtab.cc (Symbol::versioned_name): New function.
6763         (Symbol_table::add_to_final_symtab): Use versioned_name when
6764         appropriate.
6765         (Symbol_table::sized_write_symbol): Likewise.
6766         * symtab.h (class Symbol): Declare versioned_name.
6767         * stringpool.h (class Stringpool_template): Add variant of add
6768         which takes a std::basic_string.
6769         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
6770         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
6771         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
6772         (ver_test_12.o): New target.
6773         * testsuite/Makefile.in: Rebuild.
6774
6775 2011-06-27  Doug Kwan  <dougkwan@google.com>
6776
6777         * arm.cc (Arm_relocate_functions::thm_jump8,
6778         Arm_relocate_functions::thm_jump11): Use a wider signed
6779         type to compute offset.
6780         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
6781         arm_thm_jump8.
6782         * testsuite/Makefile.in: Regenerate.
6783         * testsuite/arm_branch_in_range.sh: Check test results of
6784         arm_thm_jump11 and arm_thm_jump8.
6785         * testsuite/arm_thm_jump11.s: New test source file.
6786         * testsuite/arm_thm_jump11.t: New linker script.
6787         * testsuite/arm_thm_jump8.s: New test source file.
6788         * testsuite/arm_thm_jump8.t: New linker script.
6789
6790 2011-06-24  Ian Lance Taylor  <iant@google.com>
6791
6792         * layout.cc: Include "object.h".
6793         (ctors_sections_in_init_array): New static variable.
6794         (Layout::is_ctors_in_init_array): New function.
6795         (Layout::layout): Add entry to ctors_sections_in_init_array if
6796         appropriate.
6797         * layout.h (class Layout): Declare is_ctors_in_init_array.
6798         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
6799         is_ctors_reverse_view is set.
6800         (Sized_relobj_file::write_sections): Add layout parameter.  Change
6801         all callers.  Set is_ctors_reverse_view field of View_size.
6802         (Sized_relobj_file::reverse_words): New function.
6803         * object.h (Sized_relobj_file::View_size): Add
6804         is_ctors_reverse_view field.
6805         (class Sized_relobj_file): Update declarations.
6806         * testsuite/initpri3.c: New test.
6807         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
6808         initpri3b.
6809         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
6810         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
6811         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
6812         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
6813         * testsuite/Makefile.in: Rebuild.
6814
6815 2011-06-24  Cary Coutant  <ccoutant@google.com>
6816
6817         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
6818         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
6819         (debug_msg_cdebug.err): New targets.
6820         * testsuite/Makefile.in: Regenerate.
6821         * testsuite/debug_msg.sh: Check output of link with compressed debug.
6822         Fix checks for link with shared library.
6823
6824 2011-06-24  Doug Kwan  <dougkwan@google.com>
6825
6826         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
6827         skip empty text sections.
6828         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
6829
6830 2011-06-22  Ian Lance Taylor  <iant@google.com>
6831
6832         PR gold/12910
6833         * options.h (class General_options): Add --ctors-in-init-array.
6834         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
6835         friends as SHT_PROGBITS for merging sections.
6836         (Layout::layout): Remove special handling of .init_array and
6837         friends.  Don't sort if doing relocatable link.  Sort for .ctors
6838         and .dtors if ctors_in_init_array.
6839         (Layout::make_output_section): Force correct section types for
6840         .init_array and friends.  Don't sort if doing relocatable link,
6841         Don't sort .ctors and .dtors if ctors_in_init_array.
6842         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
6843         (Layout::output_section_name): Add relobj parameter.  Change all
6844         callers.  Handle .ctors. and .dtors. in code rather than table.
6845         Handle .ctors and .dtors if ctors_in_init_array.
6846         (Layout::match_file_name): New function, moved from output.cc.
6847         * layout.h (class Layout): Update declarations.
6848         * output.cc: Include "layout.h".
6849         (Input_section_sort_entry::get_priority): New function.
6850         (Input_section_sort_entry::match_file_name): Just call
6851         Layout::match_file_name.
6852         (Output_section::Input_section_sort_init_fini_compare::operator()):
6853         Handle .ctors and .dtors.  Sort by explicit priority rather than
6854         by name.
6855         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
6856         * testsuite/initpri2.c: New test.
6857         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
6858         (check_PROGRAMS): Add initpri2.
6859         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
6860         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
6861         * configure, testsuite/Makefile.in: Rebuild.
6862
6863 2011-06-19  Ian Lance Taylor  <iant@google.com>
6864
6865         PR gold/12880
6866         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
6867         .interp section to a PT_INTERP segment even if we have seen a
6868         --dynamic-linker option.  Don't do it if we have seen a PHDRS
6869         clause in a linker script.
6870         (Layout::finalize): Don't create a .interp section if we've
6871         already create a PT_INTERP segment.
6872         (Layout::create_interp): Always call choose_output_section (revert
6873         patch of 2011-06-17).  Don't create PT_INTERP segment.
6874         * script-sections.cc
6875         (Script_sections::create_note_and_tls_segments): Add a .interp
6876         section to a PT_INTERP segment even if we have seen a
6877         --dynamic-linker option.
6878
6879 2011-06-18  Ian Lance Taylor  <iant@google.com>
6880
6881         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
6882         merely because a non-PT_LOAD segment has a dynamic reloc.
6883
6884 2011-06-18  Ian Lance Taylor  <iant@google.com>
6885
6886         * layout.cc (Layout::finish_dynamic_section): Don't create
6887         DT_FLAGS entry if not needed.
6888
6889 2011-06-18  Ian Lance Taylor  <iant@google.com>
6890
6891         PR gold/12745
6892         * layout.cc (Layout::layout_eh_frame): Correct handling of
6893         writable .eh_frame section.
6894
6895 2011-06-17  Ian Lance Taylor  <iant@google.com>
6896
6897         PR gold/12893
6898         * resolve.cc (Symbol_table::resolve): Don't give an error if a
6899         symbol is redefined with the exact same object and value.
6900
6901 2011-06-17  Ian Lance Taylor  <iant@google.com>
6902
6903         PR gold/12880
6904         * layout.h (class Layout): Add interp_segment_ field.
6905         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
6906         (Layout::attach_allocated_section_to_segment): If making shared
6907         library, put .interp section in PT_INTERP segment.
6908         (Layout::finalize): Also call create_interp if -dynamic-linker
6909         option was used.
6910         (Layout::create_interp): Assert that there is no PT_INTERP
6911         segment.  If not using a SECTIONS clause, use make_output_section.
6912         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
6913         * script-sections.cc
6914         (Script_sections::create_note_and_tls_segments): If making shared
6915         library, put .interp section in PT_INTERP segment.
6916
6917 2011-06-17  Ian Lance Taylor  <iant@google.com>
6918
6919         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
6920         when making a shared library.
6921
6922 2011-06-17  Ian Lance Taylor  <iant@google.com>
6923
6924         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
6925         parameter.  Change all callers.  Don't issue warning about PC32
6926         against locally defined symbol.
6927
6928 2011-06-16  Ian Lance Taylor  <iant@google.com>
6929
6930         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
6931         occurs in same object.
6932
6933 2011-06-14  Alan Modra  <amodra@gmail.com>
6934
6935         * po/POTFILES.in: Regenerate.
6936
6937 2011-06-09  Ian Lance Taylor  <iant@google.com>
6938
6939         * script-sections.cc
6940         (Orphan_output_section::set_section_addresses): For a relocatable
6941         link set address to 0.
6942
6943 2011-06-09  Cary Coutant  <ccoutant@google.com>
6944
6945         PR gold/12804
6946         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
6947         used with --compress-debug-sections.
6948         * gold/object.cc (Sized_relobj_file::do_layout): Report
6949         uncompressed size of compressed input sections.
6950
6951 2011-06-08  Cary Coutant  <ccoutant@google.com>
6952
6953         PR gold/12804
6954         * testsuite/two_file_test_2_v1.cc: Change initialization of
6955         v2 to keep it in .data.
6956
6957 2011-06-07  Cary Coutant  <ccoutant@google.com>
6958
6959         * common.cc (Symbol_table::do_allocate_commons_list): Call
6960         gold_fallback.
6961         * errors.cc (Errors::fatal): Adjust call to gold_exit.
6962         (Errors::fallback): New function.
6963         (gold_fallback): New function.
6964         * errors.h (Errors::fallback): New function.
6965         * gold.cc (gold_exit): Change status parameter to enum; adjust
6966         all callers.
6967         (queue_initial_tasks): Call gold_fallback.
6968         * gold.h: Include cstdlib.
6969         (Exit_status): New enum type.
6970         (gold_exit): Change status parameter to enum.
6971         (gold_fallback): New function.
6972         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
6973         (Layout::create_symtab_sections): Likewise.
6974         (Layout::create_shdrs): Likewise.
6975         * main.cc (main): Adjust call to gold_exit.
6976         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
6977         (Output_data_got::add_got_entry_pair): Likewise.
6978         (Output_section::add_input_section): Likewise.
6979         (Output_section::add_output_section_data): Likewise.
6980         (Output_segment::set_section_list_addresses): Likewise.
6981         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
6982
6983 2011-06-07  Cary Coutant  <ccoutant@google.com>
6984
6985         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
6986         for incremental links.
6987         * output.cc (Output_segment::set_section_list_addresses): Remove
6988         FIXME and test for TLS or BSS.
6989
6990 2011-06-07  Cary Coutant  <ccoutant@google.com>
6991
6992         * testsuite/Makefile.am: Add incremental_copy_test,
6993         incremental_common_test_1.
6994         * testsuite/Makefile.in: Regenerate.
6995         * testsuite/common_test_1_v1.c: New source file.
6996         * testsuite/common_test_1_v2.c: New source file.
6997         * testsuite/copy_test_v1.cc: New source file.
6998
6999 2011-06-07  Cary Coutant  <ccoutant@google.com>
7000
7001         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
7002         update, allocate common from bss section's free list.
7003         * incremental-dump.cc (dump_incremental_inputs): Print flag for
7004         linker-defined symbols.
7005         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
7006         Skip GOT and PLT entries that are no longer referenced.
7007         (Output_section_incremental_inputs::write_info_blocks): Mark
7008         linker-defined symbols.
7009         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
7010         * output.cc (Output_section::allocate): New function.
7011         * output.h (Output_section::allocate): New function.
7012         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
7013         linker-defined symbols.
7014         (Symbol::override_base_with_special): Copy is_predefined_ flag.
7015         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
7016         (Symbol::init_base_output_data): Likewise.
7017         (Symbol::init_base_output_segment): Likewise.
7018         (Symbol::init_base_constant): Likewise.
7019         (Sized_symbol::init_output_data): Likewise.
7020         (Sized_symbol::init_output_segment): Likewise.
7021         (Sized_symbol::init_constant): Likewise.
7022         (Symbol_table::do_define_in_output_data): Likewise.
7023         (Symbol_table::do_define_in_output_segment): Likewise.
7024         (Symbol_table::do_define_as_constant): Likewise.
7025         * symtab.h (Symbol::is_predefined): New function.
7026         (Symbol::init_base_output_data): Add is_predefined parameter.
7027         (Symbol::init_base_output_segment): Likewise.
7028         (Symbol::init_base_constant): Likewise.
7029         (Symbol::is_predefined_): New data member.
7030         (Sized_symbol::init_output_data): Add is_predefined parameter.
7031         (Sized_symbol::init_output_segment): Likewise.
7032         (Sized_symbol::init_constant): Likewise.
7033         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
7034
7035 2011-06-07  Cary Coutant  <ccoutant@google.com>
7036
7037         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
7038         instead of emit_copy_reloc.
7039         (Copy_relocs::emit_copy_reloc): Refactor.
7040         (Copy_relocs::make_copy_reloc): New function.
7041         (Copy_relocs::add_copy_reloc): Remove.
7042         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
7043         section.
7044         (Copy_relocs::make_copy_reloc): New function.
7045         (Copy_relocs::add_copy_reloc): Remove.
7046         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
7047         unchanged input files.
7048         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
7049         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
7050         Reserve BSS space for COPY relocations.
7051         (Sized_incremental_binary::do_emit_copy_relocs): New function.
7052         (Output_section_incremental_inputs::write_info_blocks): Record
7053         whether a symbol is copied from a shared object.
7054         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
7055         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
7056         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
7057         (Incremental_input_entry_reader::get_output_symbol_index): Add
7058         is_copy parameter.
7059         (Incremental_binary::emit_copy_relocs): New function.
7060         (Incremental_binary::do_emit_copy_relocs): New function.
7061         (Sized_incremental_binary::Sized_incremental_binary): Initialize
7062         new data member.
7063         (Sized_incremental_binary::add_copy_reloc): New function.
7064         (Sized_incremental_binary::do_emit_copy_relocs): New function.
7065         (Sized_incremental_binary::Copy_reloc): New struct.
7066         (Sized_incremental_binary::Copy_relocs): New typedef.
7067         (Sized_incremental_binary::copy_relocs_): New data member.
7068         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
7069         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
7070         * target.h (Sized_target::emit_copy_reloc): New function.
7071         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
7072
7073 2011-06-02  Cary Coutant  <ccoutant@google.com>
7074
7075         PR gold/12163
7076         * gold/archive.cc (Archive::Archive): Initialize new data member.
7077         (Archive::include_all_members): Return if archive has already been
7078         included.
7079         * gold/archive.h (Archive::include_all_members_): New data member.
7080
7081 2011-06-02  Nick Clifton  <nickc@redhat.com>
7082
7083         * dynobj.h: Fix spelling mistake in comment.
7084         * output.cc: Likewise.
7085
7086 2011-05-31  Doug Kwan  <dougkwan@google.com>
7087             Asier Llano
7088
7089         PR gold/12826
7090         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
7091         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
7092         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
7093         redundant arm_exidx_test.so.
7094         * testsuite/Makefile.in: Regenerate.
7095         (check_SCRIPTS): Add pr12826.sh
7096         (check_DATA): Add pr12826.stdout
7097         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
7098         * testsuite/pr12826.sh: New file.
7099         * testsuite/pr12826_1.s: Ditto.
7100         * testsuite/pr12826_1.s: Ditto.
7101
7102 2011-05-30  Ian Lance Taylor  <iant@google.com>
7103
7104         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
7105         sections.
7106
7107 2011-05-29  Ian Lance Taylor  <iant@google.com>
7108
7109         PR gold/12804
7110         * testsuite/Makefile.am: Use different file name for two_file_test
7111         temporary file for each incremental test.
7112         * testsuite/Makefile.in: Rebuild.
7113
7114 2011-05-29  Ian Lance Taylor  <iant@google.com>
7115
7116         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
7117         binary input file is empty.
7118
7119 2011-05-27  Ian Lance Taylor  <iant@google.com>
7120
7121         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
7122         (ver_test_9.so): Likewise.
7123         * testsuite/Makefile.in: Rebuild.
7124
7125 2011-05-26 Cary Coutant  <ccoutant@google.com>
7126
7127         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
7128         * incremental.cc (Incremental_inputs::report_input_section): Fix
7129         comment, indentation.
7130         (Incremental_inputs::report_comdat_group): New function.
7131         (Output_section_incremental_inputs::set_final_data_size): Adjust size
7132         of data for incremental input file entry.
7133         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
7134         group count, COMDAT group signatures.
7135         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
7136         an unchanged input file.
7137         * incremental.h (Incremental_object_entry::Incremental_object_entry):
7138         Initialize new data member.
7139         (Incremental_object_entry::add_comdat_group): New function.
7140         (Incremental_object_entry::get_comdat_group_count): New function.
7141         (Incremental_object_entry::get_comdat_signature_key): New function.
7142         (Incremental_object_entry::groups_): New data member.
7143         (Incremental_inputs::report_comdat_group): New function.
7144         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
7145         data for incremental input file entry.
7146         (Incremental_input_entry_reader::get_comdat_group_count): New function.
7147         (Incremental_input_entry_reader::get_input_section): Adjust size of
7148         data for incremental input file entry.
7149         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
7150         (Incremental_input_entry_reader::get_comdat_group_signature): New
7151         function.
7152         * object.cc (Sized_relobj::include_section_group): Report kept
7153         COMDAT groups for incremental links.
7154
7155 2011-05-24  David Meyer  <pdox@google.com>
7156
7157         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
7158         with name parameter.  Add found_name parameter.
7159         * fileread.cc (Input_file::find_file): Adjust code accordingly.
7160         * dirsearch.h (class Dirsearch): Update declaration.
7161
7162 2011-05-24  Ian Lance Taylor  <iant@google.com>
7163
7164         * archive.cc (Library_base::should_include_member): Pull in object
7165         from archive if it defines the entry symbol.
7166         * parameters.cc (Parameters::entry): New function.
7167         * parameters.h (class Parameters): Declare entry.
7168         * output.h (class Output_file_header): Remove entry_ field.
7169         * output.cc (Output_file_header::Output_file_header): Remove entry
7170         parameter.  Change all callers.
7171         (Output_file_header::entry): Use parameters->entry.
7172         * gold.cc (queue_middle_tasks): Likewise.
7173         * plugin.cc (Plugin_hook::run): Likewise.
7174
7175 2011-05-24 Cary Coutant  <ccoutant@google.com>
7176
7177         * gold.cc (queue_initial_tasks): Pass incremental base filename
7178         to Output_file::open_base_file; don't print error message.
7179         * incremental-dump.cc (main): Adjust call to
7180         Output_file::open_for_modification.
7181         * incremental-dump.cc (main): Likewise.
7182         * incremental.cc (Incremental_inputs::report_command_line):
7183         Ignore --incremental-base option when comparing command lines.
7184         Ignore parameter when given as separate argument.
7185         * options.h (class General_options): Add --incremental-base.
7186         * output.cc (Output_file::Output_file):
7187         (Output_file::open_base_file): Add base_name and writable parameters;
7188         read base file into new file; print error message here.
7189         (Output_file::map_no_anonymous): Add writable parameter; adjust all
7190         callers.
7191         * output.h (Output_file::open_for_modification): Rename to...
7192         (Output_file::open_base_file): ...this; add base_name and
7193         writable parameters; adjust all callers.
7194         (Output_file::map_no_anonymous): Add writable parameter; adjust all
7195         callers.
7196         * testsuite/Makefile.am (incremental_test_4): Test
7197         --incremental-base.
7198         * testsuite/Makefile.in: Regenerate.
7199
7200 2011-05-24 Cary Coutant  <ccoutant@google.com>
7201
7202         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
7203         incremental_test_4.
7204         * testsuite/Makefile.in: Regenerate.
7205         * testsuite/two_file_test_1_v1.cc: New test source file.
7206         * testsuite/two_file_test_1b_v1.cc: New test source file.
7207         * testsuite/two_file_test_2_v1.cc: New test source file.
7208
7209 2011-05-24 Cary Coutant  <ccoutant@google.com>
7210
7211         * dynobj.h (Dynobj::do_dynobj): New function.
7212         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
7213         flag and soname for shared objects.
7214         * incremental.cc (Incremental_inputs::report_object): Make
7215         either Incremental_object_entry or Incremental_dynobj_entry; add
7216         soname to string table.
7217         (Incremental_inputs::report_input_section): Add assertion.
7218         (Output_section_incremental_inputs::set_final_data_size): Adjust
7219         type of input file entry for shared libraries; adjust size of
7220         shared library info entry.
7221         (Output_section_incremental_inputs::write_input_files): Write
7222         as_needed flag for shared libraries.
7223         (Output_section_incremental_inputs::write_info_blocks): Adjust type
7224         of input file entry for shared libraries; write soname.
7225         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
7226         soname from incremental info.
7227         * incremental.h (enum Incremental_input_flags): Add
7228         INCREMENTAL_INPUT_AS_NEEDED.
7229         (Incremental_input_entry::Incremental_input_entry): Initialize new
7230         data member.
7231         (Incremental_input_entry::set_as_needed): New function.
7232         (Incremental_input_entry::as_needed): New function.
7233         (Incremental_input_entry::do_dynobj_entry): New function.
7234         (Incremental_input_entry::as_needed_): New data member.
7235         (Incremental_object_entry::Incremental_object_entry): Don't check
7236         for shared library.
7237         (Incremental_object_entry::do_type): Likewise.
7238         (class Incremental_dynobj_entry): New class.
7239         (Incremental_input_entry_reader::as_needed): New function.
7240         (Incremental_input_entry_reader::get_soname): New function.
7241         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
7242         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
7243         size of shared library info entry.
7244         * layout.cc (Layout::finish_dynamic_section): Don't test for
7245         incremental link when adding DT_NEEDED entries.
7246         * object.h (Object::Object): Initialize new data member.
7247         (Object::dynobj): New function.
7248         (Object::set_as_needed): New function.
7249         (Object::as_needed): New function.
7250         (Object::do_dynobj): New function.
7251         (Object::as_needed_): New data member.
7252
7253 2011-05-24 Cary Coutant  <ccoutant@google.com>
7254
7255         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
7256         info; adjust display of GOT entries.
7257         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7258         vector of input objects; remove file_status_.
7259         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
7260         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
7261         got_plt reader; call target hooks to reserve GOT entries.
7262         (Output_section_incremental_inputs::set_final_data_size): Adjust size
7263         of input file info header and GOT info entry.
7264         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
7265         relocation info.
7266         (Got_plt_view_info::got_descriptor): Remove.
7267         (Got_plt_view_info::sym_index): New data member.
7268         (Got_plt_view_info::input_index): New data member.
7269         (Local_got_offset_visitor::visit): Write input file index.
7270         (Global_got_offset_visitor::visit): Write 0 for input file index.
7271         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
7272         with sym_index and input_index.
7273         (Output_section_incremental_inputs::write_got_plt): Adjust size of
7274         incremental info GOT entry; replace got_descriptor with input_index.
7275         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
7276         map from input file index to object.
7277         (Sized_relobj_incr::do_layout): Replace direct data member reference
7278         with accessor function.
7279         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
7280         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
7281         Adjust size of input file info header.
7282         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
7283         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
7284         (Incremental_input_entry_reader::get_input_section): Adjust size of
7285         input file info header.
7286         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
7287         of incremental info GOT entry.
7288         (Incremental_got_plt_reader::get_got_desc): Remove.
7289         (Incremental_got_plt_reader::get_got_symndx): New function.
7290         (Incremental_got_plt_reader::get_got_input_index): New function.
7291         (Sized_incremental_binary::Sized_incremental_binary): Remove
7292         file_status_; add input_objects_.
7293         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
7294         (Sized_incremental_binary::set_file_is_unchanged): Remove.
7295         (Sized_incremental_binary::file_is_unchanged): Remove.
7296         (Sized_incremental_binary::set_input_object): New function.
7297         (Sized_incremental_binary::input_object): New function.
7298         (Sized_incremental_binary::file_status_): Remove.
7299         (Sized_incremental_binary::input_objects_): New data member.
7300         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
7301         references.
7302         (Sized_relobj_incr::invalid_address): Move to base class.
7303         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
7304         class.
7305         (Sized_relobj_incr::do_output_section_offset): Likewise.
7306         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
7307         (Sized_relobj_incr::section_offsets_): Likewise.
7308         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
7309         function.
7310         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
7311         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
7312         with accessor function.
7313         (Sized_relobj_file::do_layout): Likewise.
7314         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
7315         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
7316         (Sized_relobj_file::compute_final_local_value): Replace refs to
7317         section_offsets_ with accessor function.
7318         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
7319         * object.h (Relobj::Relobj): Initialize new data members.
7320         (Relobj::add_dyn_reloc): New function.
7321         (Relobj::first_dyn_reloc): New function.
7322         (Relobj::dyn_reloc_count): New function.
7323         (Relobj::first_dyn_reloc_): New data member.
7324         (Relobj::dyn_reloc_count_): New data member.
7325         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
7326         references.
7327         (Sized_relobj::Address): New typedef.
7328         (Sized_relobj::invalid_address): Move here from child class.
7329         (Sized_relobj::Sized_relobj): Initialize new data members.
7330         (Sized_relobj::sized_relobj): New function.
7331         (Sized_relobj::is_output_section_offset_invalid): Move here from
7332         child class.
7333         (Sized_relobj::get_output_section_offset): Likewise.
7334         (Sized_relobj::local_has_got_offset): Likewise.
7335         (Sized_relobj::local_got_offset): Likewise.
7336         (Sized_relobj::set_local_got_offset): Likewise.
7337         (Sized_relobj::do_for_all_local_got_entries): Likewise.
7338         (Sized_relobj::clear_got_offsets): New function.
7339         (Sized_relobj::section_offsets): Move here from child class.
7340         (Sized_relobj::do_output_section_offset): Likewise.
7341         (Sized_relobj::do_set_section_offset): Likewise.
7342         (Sized_relobj::Local_got_offsets): Likewise.
7343         (Sized_relobj::local_got_offsets_): Likewise.
7344         (Sized_relobj::section_offsets_): Likewise.
7345         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
7346         references.
7347         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
7348         class.
7349         (Sized_relobj_file::sized_relobj): New function
7350         (Sized_relobj_file::local_has_got_offset): Move to base class.
7351         (Sized_relobj_file::local_got_offset): Likewise.
7352         (Sized_relobj_file::set_local_got_offset): Likewise.
7353         (Sized_relobj_file::get_output_section_offset): Likewise.
7354         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
7355         (Sized_relobj_file::do_output_section_offset): Likewise.
7356         (Sized_relobj_file::do_set_section_offset): Likewise.
7357         (Sized_relobj_file::Local_got_offsets): Likewise.
7358         (Sized_relobj_file::local_got_offsets_): Likewise.
7359         (Sized_relobj_file::section_offsets_): Likewise.
7360         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
7361         (all constructors).
7362         (set_needs_dynsym_index): Convert relobj to derived class pointer.
7363         (Output_reloc::get_symbol_index): Likewise.
7364         (Output_reloc::local_section_offset): Likewise.
7365         (Output_reloc::get_address): Likewise.
7366         (Output_reloc::symbol_value): Likewise.
7367         (Output_data_got::reserve_slot): Move to class definition.
7368         (Output_data_got::reserve_local): New function.
7369         (Output_data_got::reserve_slot_for_global): Remove.
7370         (Output_data_got::reserve_global): New function.
7371         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
7372         (all constructors, two instantiations).
7373         (Output_reloc::get_relobj): New function (two instantiations).
7374         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
7375         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
7376         (Output_data_reloc::add_global): Adjust type of relobj.
7377         (Output_data_reloc::add_global_relative): Likewise.
7378         (Output_data_reloc::add_symbolless_global_addend): Likewise.
7379         (Output_data_reloc::add_local): Likewise.
7380         (Output_data_reloc::add_local_relative): Likewise.
7381         (Output_data_reloc::add_symbolless_local_addend): Likewise.
7382         (Output_data_reloc::add_local_section): Likewise.
7383         (Output_data_reloc::add_output_section): Likewise.
7384         (Output_data_reloc::add_absolute): Likewise.
7385         (Output_data_reloc::add_target_specific): Likewise.
7386         (Output_data_got::reserve_slot): Move definition here.
7387         (Output_data_got::reserve_local): New function.
7388         (Output_data_got::reserve_global): New function.
7389         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
7390         section_offsets_ with accessor function.
7391         (Sized_relobj_file::write_sections): Likewise.
7392         (Sized_relobj_file::do_relocate_sections): Likewise.
7393         * target.h (Sized_target::reserve_local_got_entry): New function.
7394         (Sized_target::reserve_global_got_entry): New function.
7395         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
7396         (Target_x86_64::reserve_global_got_entry): New function.
7397         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
7398
7399 2011-05-23 Cary Coutant  <ccoutant@google.com>
7400
7401         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
7402         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
7403         bit when checking got_type.
7404         * incremental.cc (Sized_incremental_binary::setup_readers):
7405         Store symbol table and string table locations; initialize bit vector
7406         of file status flags.
7407         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
7408         unchanged files.
7409         (Sized_incremental_binary::do_process_got_plt): New function.
7410         (Sized_incremental_binary::get_symtab_view): Use stored locations.
7411         (Output_section_incremental_inputs::set_final_data_size): Record
7412         file index for each input file.
7413         (Output_section_incremental_inputs::write_got_plt): Store file index
7414         instead of input entry offset for each GOT entry.
7415         * incremental.h
7416         (Incremental_input_entry::Incremental_input_entry): Initialize new
7417         data member.
7418         (Incremental_input_entry::set_offset): Store file index.
7419         (Incremental_input_entry::get_file_index): New function.
7420         (Incremental_input_entry::file_index_): New data member.
7421         (Incremental_binary::process_got_plt): New function.
7422         (Incremental_binary::do_process_got_plt): New function.
7423         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7424         data members.
7425         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
7426         (Sized_incremental_binary::set_file_is_unchanged): New function.
7427         (Sized_incremental_binary::file_is_unchanged): New function.
7428         (Sized_incremental_binary::do_process_got_plt): New function.
7429         (Sized_incremental_binary::file_status_): New data member.
7430         (Sized_incremental_binary::main_symtab_loc_): New data member.
7431         (Sized_incremental_binary::main_strtab_loc_): New data member.
7432         * output.cc (Output_data_got::Got_entry::write): Add case
7433         RESERVED_CODE.
7434         (Output_data_got::add_global): Call add_got_entry.
7435         (Output_data_got::add_global_plt): Likewise.
7436         (Output_data_got::add_global_with_rel): Likewise.
7437         (Output_data_got::add_global_with_rela): Likewise.
7438         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
7439         (Output_data_got::add_global_pair_with_rela): Likewise.
7440         (Output_data_got::add_local): Call add_got_entry.
7441         (Output_data_got::add_local_plt): Likewise.
7442         (Output_data_got::add_local_with_rel): Likewise.
7443         (Output_data_got::add_local_with_rela): Likewise.
7444         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
7445         (Output_data_got::add_local_pair_with_rela): Likewise.
7446         (Output_data_got::reserve_slot): New function.
7447         (Output_data_got::reserve_slot_for_global): New function.
7448         (Output_data_got::add_got_entry): New function.
7449         (Output_data_got::add_got_entry_pair): New function.
7450         (Output_section::add_output_section_data): Edit FIXME.
7451         * output.h
7452         (Output_section_data_build::Output_section_data_build): New
7453         constructor with size parameter.
7454         (Output_data_space::Output_data_space): Likewise.
7455         (Output_data_got::Output_data_got): Initialize new data member; new
7456         constructor with size parameter.
7457         (Output_data_got::add_constant): Call add_got_entry.
7458         (Output_data_got::reserve_slot): New function.
7459         (Output_data_got::reserve_slot_for_global): New function.
7460         (class Output_data_got::Got_entry): Add RESERVED_CODE.
7461         (Output_data_got::add_got_entry): New function.
7462         (Output_data_got::add_got_entry_pair): New function.
7463         (Output_data_got::free_list_): New data member.
7464         * target.h (Sized_target::init_got_plt_for_update): New function.
7465         (Sized_target::register_global_plt_entry): New function.
7466         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
7467         Initialize new data member; call init; add constructor with PLT count.
7468         (Output_data_plt_x86_64::init): New function.
7469         (Output_data_plt_x86_64::add_relocation): New function.
7470         (Output_data_plt_x86_64::reserve_slot): New function.
7471         (Output_data_plt_x86_64::free_list_): New data member.
7472         (Target_x86_64::init_got_plt_for_update): New function.
7473         (Target_x86_64::register_global_plt_entry): New function.
7474         (Output_data_plt_x86_64::add_entry): Allocate from free list for
7475         incremental updates.
7476         (Output_data_plt_x86_64::add_relocation): New function.
7477         * testsuite/object_unittest.cc (Object_test): Set default options.
7478
7479 2011-05-16  Ian Lance Taylor  <iant@google.com>
7480
7481         * options.h (class General_options): Make -i a synonym for -r.
7482
7483 2011-05-16  Ian Lance Taylor  <iant@google.com>
7484
7485         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
7486
7487 2011-05-10 Cary Coutant  <ccoutant@google.com>
7488
7489         * object.cc (Sized_relobj::do_count_local_symbols): Check for
7490         strip_all (-s).
7491
7492 2011-05-06  Ian Lance Taylor  <iant@google.com>
7493
7494         * layout.cc (Layout::layout): If the output section flags change,
7495         update the ordering.
7496
7497 2011-04-25 Cary Coutant  <ccoutant@google.com>
7498
7499         * incremental-dump.cc (dump_incremental_inputs): Print local
7500         symbol info for each input file.
7501         * incremental.cc
7502         (Output_section_incremental_inputs::set_final_data_size): Add local
7503         symbol info to input file entries in incremental info.
7504         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7505         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
7506         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
7507         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
7508         implementation.
7509         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
7510         (Sized_incr_relobj::do_relocate): Write the local symbols.
7511         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
7512         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
7513         Adjust size of input file header.
7514         (Incremental_inputs_reader::get_local_symbol_offset): New function.
7515         (Incremental_inputs_reader::get_local_symbol_count): New function.
7516         (Incremental_inputs_reader::get_input_section): Adjust size of input
7517         file header.
7518         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
7519         (Sized_incr_relobj::This): New typedef.
7520         (Sized_incr_relobj::sym_size): New const data member.
7521         (Sized_incr_relobj::Local_symbol): New struct.
7522         (Sized_incr_relobj::do_output_local_symbol_count): New function.
7523         (Sized_incr_relobj::do_local_symbol_offset): New function.
7524         (Sized_incr_relobj::local_symbol_count_): New data member.
7525         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
7526         (Sized_incr_relobj::local_symbol_index_): New data member.
7527         (Sized_incr_relobj::local_symbol_offset_): New data member.
7528         (Sized_incr_relobj::local_dynsym_offset_): New data member.
7529         (Sized_incr_relobj::local_symbols_): New data member.
7530         * object.h (Relobj::output_local_symbol_count): New function.
7531         (Relobj::local_symbol_offset): New function.
7532         (Relobj::do_output_local_symbol_count): New function.
7533         (Relobj::do_local_symbol_offset): New function.
7534         (Sized_relobj::do_output_local_symbol_count): New function.
7535         (Sized_relobj::do_local_symbol_offset): New function.
7536
7537 2011-04-22  Vladimir Simonov  <sv@sw.ru>
7538
7539         * descriptors.cc (set_close_on_exec): New function.
7540         (Descriptors::open): Use set_close_on_exec.
7541         * output.cc (S_ISLNK): Define if not defined.
7542
7543 2011-04-22 Cary Coutant  <ccoutant@google.com>
7544
7545         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7546         global symbol map.
7547         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7548         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
7549         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
7550         relocations.
7551         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
7552         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
7553         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
7554         * incremental.h
7555         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
7556         function.
7557         (Incremental_binary::apply_incremental_relocs): New function.
7558         (Incremental_binary::do_apply_incremental_relocs): New function.
7559         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7560         data member.
7561         (Sized_incremental_binary::add_global_symbol): New function.
7562         (Sized_incremental_binary::global_symbol): New function.
7563         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7564         (Sized_incremental_binary::symbol_map_): New data member.
7565         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
7566         * target.h (Sized_target::apply_relocation): New function.
7567         * target-reloc.h (apply_relocation): New function.
7568         * x86_64.cc (Target_x86_64::apply_relocation): New function.
7569
7570 2011-04-22  Doug Kwan  <dougkwan@google.com>
7571
7572         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
7573         flag of a SHT_ARM_EXIDX section.
7574         * testsuite/Makefile.am (arm_exidx_test): New test rules.
7575         * testsuite/Makefile.in: Regenerate.
7576         * testsuite/arm_exidx_test.s: New file.
7577         * testsuite/arm_exidx_test.sh: Same.
7578
7579 2011-04-20 Cary Coutant  <ccoutant@google.com>
7580
7581         PR gold/12689
7582         * archive.h (Incremental_archive_entry::Archive_member):
7583         Initialize arg_serial_ (second constructor).
7584
7585 2011-04-17  Ian Lance Taylor  <iant@google.com>
7586
7587         * object.cc (Relocate_info::location): Simplify location string.
7588         * errors.cc (Errors::error_at_location): Don't print program
7589         name.
7590         (Errors::warning_at_location): Likewise.
7591         (Errors::undefined_symbol): Likewise.
7592         * testsuite/debug_msg.sh: Update accordingly.
7593
7594 2011-04-14 Cary Coutant  <ccoutant@google.com>
7595
7596         * gold/layout.cc (Layout::symtab_section_offset): New function.
7597         * gold/layout.h (Layout::symtab_section_offset): New function.
7598         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
7599
7600 2011-04-12  Ian Lance Taylor  <iant@google.com>
7601
7602         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
7603         with MREMAP_MAYMOVE.
7604         * output.h (class Output_file): Add map_is_allocated_ field.
7605         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
7606         not available, provide stubs.  If mremap is not available, #define
7607         it to gold_mremap.
7608         (MREMAP_MAYMOVE): Define if not defined.
7609         (Output_file::Output_file): Initialize map_is_allocated_.
7610         (Output_file::resize): Check map_is_allocated_.
7611         (Output_file::map_anonymous): If mmap fails, use malloc.
7612         (Output_file::unmap): Don't do anything for an anonymous map.
7613         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
7614         is not available, provide stubs.
7615         (File_read::View::~View): Use free rather than delete[].
7616         (File_read::make_view): Use malloc rather than new[].  If mmap
7617         fails, use malloc.
7618         (File_read::find_or_make_view): Use malloc rather than new[].
7619         * gold.h: Remove HAVE_REMAP code.
7620         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
7621         exists.  Rename mremap to gold_mremap.  If mmap is not available
7622         don't do anything.
7623         * configure, config.in: Rebuild.
7624
7625 2011-04-11  Ian Lance Taylor  <iant@google.com>
7626
7627         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
7628         initialize local variable v.
7629
7630 2011-04-11  Cary Coutant  <ccoutant@google.com>
7631
7632         * archive.cc (Archive::include_member): Adjust call to
7633         report_object.
7634         (Add_archive_symbols::run): Track argument serial numbers.
7635         (Lib_group::include_member): Likewise.
7636         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
7637         * archive.h (Incremental_archive_entry::Archive_member):
7638         Initialize arg_serial_.
7639         (Archive_member::arg_serial_): New data member.
7640         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
7641         (Sized_dynobj::do_add_symbols): Track symbols when doing an
7642         incremental link.
7643         (Sized_dynobj::do_for_all_local_got_entries): New function.
7644         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
7645         function.
7646         * fileread.cc (get_mtime): New function.
7647         * fileread.h (get_mtime): New function.
7648         * gold.cc (queue_initial_tasks): Check for incremental update.
7649         (process_incremental_input): New function.
7650         (queue_middle_tasks): Don't force valid target for incremental
7651         update.
7652         * incremental-dump.cc (find_input_containing_global): Adjust
7653         size of symbol info entry.
7654         (dump_incremental_inputs): Dump argument serial number and
7655         in_system_directory flag; bias shndx by 1; print symbol names
7656         when dumping per-file symbol lists; use new symbol info readers.
7657         * incremental.cc
7658         (Output_section_incremental_inputs:update_data_size): New function.
7659         (Sized_incremental_binary::setup_readers): Setup input readers
7660         for each input file; build maps for files added from libraries
7661         and scripts.
7662         (Sized_incremental_binary::check_input_args): New function.
7663         (Sized_incremental_binary::do_check_inputs): Build map of argument
7664         serial numbers to input arguments.
7665         (Sized_incremental_binary::do_file_has_changed): Rename
7666         do_file_is_unchanged to this; compare file modification times.
7667         (Sized_incremental_binary::do_init_layout): New function.
7668         (Sized_incremental_binary::do_reserve_layout): New function.
7669         (Sized_incremental_binary::do_get_input_reader): Remove.
7670         (Sized_incremental_binary::get_symtab_view): New function.
7671         (Incremental_checker::can_incrementally_link_output_file): Remove.
7672         (Incremental_inputs::report_command_line): Exclude --debug options.
7673         (Incremental_inputs::report_archive_begin): Add parameter; track
7674         argument serial numbers; don't put input file entry for archive
7675         before archive members.
7676         (Incremental_inputs::report_archive_end): Put input file entry
7677         for archive after archive members.
7678         (Incremental_inputs::report_object): Add parameter; track argument
7679         serial numbers and in_system_directory flag.
7680         (Incremental_inputs::report_script): Add parameter; track argument
7681         serial numbers.
7682         (Output_section_incremental_inputs::set_final_data_size): Adjust
7683         size of symbol info entry; check for forwarding symbols.
7684         (Output_section_incremental_inputs::write_input_files): Write
7685         in_system_directory flag and argument serial number.
7686         (Output_section_incremental_inputs::write_info_blocks): Map section
7687         indices between incremental info and original input file; store
7688         input section index for each symbol.
7689         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
7690         change operator() to visit().
7691         (class Global_got_offset_visitor): Likewise.
7692         (class Global_symbol_visitor_got_plt):
7693         (Output_section_incremental_inputs::write_got_plt): Use new visitor
7694         classes.
7695         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
7696         (Sized_incr_relobj::do_read_symbols): New function.
7697         (Sized_incr_relobj::do_layout): New function.
7698         (Sized_incr_relobj::do_layout_deferred_sections): New function.
7699         (Sized_incr_relobj::do_add_symbols): New function.
7700         (Sized_incr_relobj::do_should_include_member): New function.
7701         (Sized_incr_relobj::do_for_all_global_symbols): New function.
7702         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
7703         (Sized_incr_relobj::do_section_size): New function.
7704         (Sized_incr_relobj::do_section_name): New function.
7705         (Sized_incr_relobj::do_section_contents): New function.
7706         (Sized_incr_relobj::do_section_flags): New function.
7707         (Sized_incr_relobj::do_section_entsize): New function.
7708         (Sized_incr_relobj::do_section_address): New function.
7709         (Sized_incr_relobj::do_section_type): New function.
7710         (Sized_incr_relobj::do_section_link): New function.
7711         (Sized_incr_relobj::do_section_info): New function.
7712         (Sized_incr_relobj::do_section_addralign): New function.
7713         (Sized_incr_relobj::do_initialize_xindex): New function.
7714         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
7715         (Sized_incr_relobj::do_read_relocs): New function.
7716         (Sized_incr_relobj::do_gc_process_relocs): New function.
7717         (Sized_incr_relobj::do_scan_relocs): New function.
7718         (Sized_incr_relobj::do_count_local_symbols): New function.
7719         (Sized_incr_relobj::do_finalize_local_symbols): New function.
7720         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
7721         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
7722         (Sized_incr_relobj::do_relocate): New function.
7723         (Sized_incr_relobj::do_set_section_offset): New function.
7724         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
7725         (Sized_incr_dynobj::do_read_symbols): New function.
7726         (Sized_incr_dynobj::do_layout): New function.
7727         (Sized_incr_dynobj::do_add_symbols): New function.
7728         (Sized_incr_dynobj::do_should_include_member): New function.
7729         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
7730         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
7731         (Sized_incr_dynobj::do_section_size): New function.
7732         (Sized_incr_dynobj::do_section_name): New function.
7733         (Sized_incr_dynobj::do_section_contents): New function.
7734         (Sized_incr_dynobj::do_section_flags): New function.
7735         (Sized_incr_dynobj::do_section_entsize): New function.
7736         (Sized_incr_dynobj::do_section_address): New function.
7737         (Sized_incr_dynobj::do_section_type): New function.
7738         (Sized_incr_dynobj::do_section_link): New function.
7739         (Sized_incr_dynobj::do_section_info): New function.
7740         (Sized_incr_dynobj::do_section_addralign): New function.
7741         (Sized_incr_dynobj::do_initialize_xindex): New function.
7742         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
7743         (make_sized_incremental_object): New function.
7744         (Incremental_library::copy_unused_symbols): New function.
7745         (Incremental_library::do_for_all_unused_symbols): New function.
7746         * incremental.h (enum Incremental_input_flags): New type.
7747         (class Incremental_checker): Remove.
7748         (Incremental_input_entry::Incremental_input_entry): Add argument
7749         serial number.
7750         (Incremental_input_entry::arg_serial): New function.
7751         (Incremental_input_entry::set_is_in_system_directory): New function.
7752         (Incremental_input_entry::is_in_system_directory): New function.
7753         (Incremental_input_entry::arg_serial_): New data member.
7754         (Incremental_input_entry::is_in_system_directory_): New data member.
7755         (class Script_info): Move here from script.h.
7756         (Script_info::Script_info): Add filename parameter.
7757         (Script_info::filename): New function.
7758         (Script_info::filename_): New data member.
7759         (Incremental_script_entry::Incremental_script_entry): Add argument
7760         serial number.
7761         (Incremental_object_entry::Incremental_object_entry): Likewise.
7762         (Incremental_object_entry::add_input_section): Build list of input
7763         sections with map to original shndx.
7764         (Incremental_object_entry::get_input_section_index): New function.
7765         (Incremental_object_entry::shndx_): New data member.
7766         (Incremental_object_entry::name_key_): Rename; adjust all refs.
7767         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
7768         (Incremental_archive_entry::Incremental_archive_entry): Add argument
7769         serial number.
7770         (Incremental_inputs::report_archive_begin): Likewise.
7771         (Incremental_inputs::report_object): Likewise.
7772         (Incremental_inputs::report_script): Likewise.
7773         (class Incremental_global_symbol_reader): New class.
7774         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
7775         and store flags and input file type.
7776         (Incremental_input_entry_reader::arg_serial): New function.
7777         (Incremental_input_entry_reader::type): Extract type from flags.
7778         (Incremental_input_entry_reader::is_in_system_directory): New function.
7779         (Incremental_input_entry_reader::get_input_section_count): Call
7780         accessor function for type.
7781         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
7782         function for type; adjust size of global symbol entry.
7783         (Incremental_input_entry_reader::get_global_symbol_count): Call
7784         accessor function for type.
7785         (Incremental_input_entry_reader::get_object_count): Likewise.
7786         (Incremental_input_entry_reader::get_object_offset): Likewise.
7787         (Incremental_input_entry_reader::get_member_count): Likewise.
7788         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
7789         (Incremental_input_entry_reader::get_member_offset): Likewise.
7790         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
7791         (Incremental_input_entry_reader::Global_symbol_info): Remove.
7792         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
7793         (Incremental_input_entry_reader::get_global_symbol_reader): New
7794         function.
7795         (Incremental_input_entry_reader::get_output_symbol_index): New
7796         function.
7797         (Incremental_input_entry_reader::type_): Remove.
7798         (Incremental_input_entry_reader::flags_): New data member.
7799         (Incremental_inputs_reader::input_file_offset): New function.
7800         (Incremental_inputs_reader::input_file_index): New function.
7801         (Incremental_inputs_reader::input_file): Call input_file_offset.
7802         (Incremental_inputs_reader::input_file_at_offset): New function.
7803         (Incremental_relocs_reader::get_r_type): Reformat.
7804         (Incremental_relocs_reader::get_r_shndx): Reformat.
7805         (Incremental_relocs_reader::get_r_offset): Reformat.
7806         (Incremental_relocs_reader::data): New function.
7807         (Incremental_binary::Incremental_binary): Initialize new data members.
7808         (Incremental_binary::check_inputs): Add cmdline parameter.
7809         (Incremental_binary::file_is_unchanged): Remove.
7810         (Input_reader::arg_serial): New function.
7811         (Input_reader::get_unused_symbol_count): New function.
7812         (Input_reader::get_unused_symbol): New function.
7813         (Input_reader::do_arg_serial): New function.
7814         (Input_reader::do_get_unused_symbol_count): New function.
7815         (Input_reader::do_get_unused_symbol): New function.
7816         (Incremental_binary::input_file_count): New function.
7817         (Incremental_binary::get_input_reader): Change signature to use
7818         index instead of filename.
7819         (Incremental_binary::file_has_changed): New function.
7820         (Incremental_binary::get_input_argument): New function.
7821         (Incremental_binary::get_library): New function.
7822         (Incremental_binary::get_script_info): New function.
7823         (Incremental_binary::init_layout): New function.
7824         (Incremental_binary::reserve_layout): New function.
7825         (Incremental_binary::output_file): New function.
7826         (Incremental_binary::do_check_inputs): New function.
7827         (Incremental_binary::do_file_is_unchanged): Remove.
7828         (Incremental_binary::do_file_has_changed): New function.
7829         (Incremental_binary::do_init_layout): New function.
7830         (Incremental_binary::do_reserve_layout): New function.
7831         (Incremental_binary::do_input_file_count): New function.
7832         (Incremental_binary::do_get_input_reader): Change signature.
7833         (Incremental_binary::input_args_map_): New data member.
7834         (Incremental_binary::library_map_): New data member.
7835         (Incremental_binary::script_map_): New data member.
7836         (Sized_incremental_binary::Sized_incremental_binary): Initialize
7837         new data members.
7838         (Sized_incremental_binary::output_section): New function.
7839         (Sized_incremental_binary::inputs_reader): Add const.
7840         (Sized_incremental_binary::symtab_reader): Add const.
7841         (Sized_incremental_binary::relocs_reader): Add const.
7842         (Sized_incremental_binary::got_plt_reader): Add const.
7843         (Sized_incremental_binary::get_symtab_view): New function.
7844         (Sized_incremental_binary::Inputs_reader): New typedef.
7845         (Sized_incremental_binary::Input_entry_reader): New typedef.
7846         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
7847         (Sized_incremental_binary::do_file_is_unchanged): Remove.
7848         (Sized_incremental_binary::do_file_has_changed): New function.
7849         (Sized_incremental_binary::do_init_layout): New function.
7850         (Sized_incremental_binary::do_reserve_layout): New function.
7851         (Sized_input_reader::Inputs_reader): Remove.
7852         (Sized_input_reader::Input_entry_reader): Remove.
7853         (Sized_input_reader::do_arg_serial): New function.
7854         (Sized_input_reader::do_get_unused_symbol_count): New function.
7855         (Sized_input_reader::do_get_unused_symbol): New function.
7856         (Sized_incremental_binary::do_input_file_count): New function.
7857         (Sized_incremental_binary::do_get_input_reader): Change signature;
7858         use index instead of filename.
7859         (Sized_incremental_binary::section_map_): New data member.
7860         (Sized_incremental_binary::input_entry_readers_): New data member.
7861         (class Sized_incr_relobj): New class.
7862         (class Sized_incr_dynobj): New class.
7863         (make_sized_incremental_object): New function.
7864         (class Incremental_library): New class.
7865         * layout.cc (Free_list::num_lists): New static data member.
7866         (Free_list::num_nodes): New static data member.
7867         (Free_list::num_removes): New static data member.
7868         (Free_list::num_remove_visits): New static data member.
7869         (Free_list::num_allocates): New static data member.
7870         (Free_list::num_allocate_visits): New static data member.
7871         (Free_list::init): New function.
7872         (Free_list::remove): New function.
7873         (Free_list::allocate): New function.
7874         (Free_list::dump): New function.
7875         (Free_list::print_stats): New function.
7876         (Layout_task_runner::run): Resize output file for incremental updates.
7877         (Layout::Layout): Initialize new data members.
7878         (Layout::set_incremental_base): New function.
7879         (Layout::init_fixed_output_section): New function.
7880         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
7881         incremental updates.
7882         (Layout::create_gold_note): Do not create gold note section for
7883         incremental updates.
7884         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
7885         for incremental updates.
7886         (Layout::set_section_offsets): For incremental updates, allocate space
7887         from free list.
7888         (Layout::create_symtab_sections): Layout with offsets relative to
7889         start of section; for incremental updates, allocate space from free
7890         list.
7891         (Layout::create_shdrs): For incremental updates, allocate space from
7892         free list.
7893         (Layout::finish_dynamic_section): For incremental updates, do not
7894         check --as-needed (fixed in subsequent patch).
7895         * layout.h (class Free_list): New class.
7896         (Layout::set_incremental_base): New function.
7897         (Layout::incremental_base): New function.
7898         (Layout::init_fixed_output_section): New function.
7899         (Layout::allocate): New function.
7900         (Layout::incremental_base_): New data member.
7901         (Layout::free_list_): New data member.
7902         * main.cc (main): Print Free_list statistics.
7903         * object.cc (Relobj::finalize_incremental_relocs): Add
7904         clear_counts parameter; clear counts only when clear_counts is set.
7905         (Sized_relobj::Sized_relobj): Initialize new base class.
7906         (Sized_relobj::do_layout): Don't report special sections.
7907         (Sized_relobj::do_for_all_local_got_entries): New function.
7908         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
7909         symtab_off to all symbol table offsets.
7910         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
7911         * object.h (class Got_offset_list): Move to top of file.
7912         (Object::Object): Allow case where input_file == NULL.
7913         (Object::~Object): Likewise.
7914         (Object::input_file): Assert that input_file != NULL.
7915         (Object::lock): Allow case where input_file == NULL.
7916         (Object::unlock): Likewise.
7917         (Object::is_locked): Likewise.
7918         (Object::token): Likewise.
7919         (Object::release): Likewise.
7920         (Object::is_incremental): New function.
7921         (Object::get_mtime): New function.
7922         (Object::for_all_local_got_entries): New function.
7923         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
7924         (Object::set_is_in_system_directory): New function.
7925         (Object::is_in_system_directory): New function.
7926         (Object::do_is_incremental): New function.
7927         (Object::do_get_mtime): New function.
7928         (Object::do_for_all_local_got_entries): New function.
7929         (Object::is_in_system_directory_): New data member.
7930         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
7931         (class Sized_relobj_base): New class.
7932         (class Sized_relobj): Derive from Sized_relobj_base.
7933         (class Sized_relobj::Symbols): Redeclare from base class.
7934         (class Sized_relobj::local_got_offset_list): Remove.
7935         (class Sized_relobj::Output_sections): Redeclare from base class.
7936         (class Sized_relobj::do_for_all_local_got_entries): New function.
7937         (class Sized_relobj::write_local_symbols): Add offset parameter.
7938         (class Sized_relobj::local_symbol_offset_): Update comment.
7939         (class Sized_relobj::local_dynsym_offset_): Update comment.
7940         * options.cc (Input_arguments::add_file): Remove const.
7941         * options.h (Input_file_argument::Input_file_argument):
7942         Initialize arg_serial_ (all constructors).
7943         (Input_file_argument::set_arg_serial): New function.
7944         (Input_file_argument::arg_serial): New function.
7945         (Input_file_argument::arg_serial_): New data member.
7946         (Input_arguments::Input_arguments): Initialize file_count_.
7947         (Input_arguments::add_file): Remove const.
7948         (Input_arguments::number_of_input_files): New function.
7949         (Input_arguments::file_count_): New data member.
7950         (Command_line::number_of_input_files): Call
7951         Input_arguments::number_of_input_files.
7952         * output.cc (Output_segment_headers::Output_segment_headers):
7953         Set current size.
7954         (Output_section::Input_section::current_data_size): New function.
7955         (Output_section::Output_section): Initialize new data members.
7956         (Output_section::add_input_section): Don't do merge sections for
7957         an incremental link; allocate space from free list for an
7958         incremental update.
7959         (Output_section::add_output_section_data): Allocate space from
7960         free list for an incremental update.
7961         (Output_section::update_data_size): New function.
7962         (Output_section::set_fixed_layout): New function.
7963         (Output_section::reserve): New function.
7964         (Output_segment::set_section_addresses): Remove const.
7965         (Output_segment::set_section_list_addresses): Remove const; allocate
7966         space from free list for an incremental update.
7967         (Output_segment::set_offset): Adjust size of RELRO segment for an
7968         incremental update.
7969         * output.h (Output_data::current_data_size): Move here from
7970         child classes.
7971         (Output_data::pre_finalize_data_size): New function.
7972         (Output_data::update_data_size): New function.
7973         (Output_section_headers::update_data_size): new function.
7974         (Output_section_data_build::current_data_size): Move to Output_data.
7975         (Output_data_strtab::update_data_size): New function.
7976         (Output_section::current_data_size): Move to Output_data.
7977         (Output_section::set_fixed_layout): New function.
7978         (Output_section::has_fixed_layout): New function.
7979         (Output_section::reserve): New function.
7980         (Output_section::update_data_size): New function.
7981         (Output_section::has_fixed_layout_): New data member.
7982         (Output_section::free_list_): New data member.
7983         (Output_segment::set_section_addresses): Remove const.
7984         (Output_segment::set_section_list_addresses): Remove const.
7985         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
7986         New function.
7987         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
7988         New function.
7989         * readsyms.cc (Read_symbols::do_read_symbols): Add library
7990         parameter when calling Add_symbols constructor; store argument
7991         serial number for members of a lib group.
7992         (Add_symbols::locks): Allow case where token == NULL.
7993         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
7994         (Read_member::~Read_member): New function.
7995         (Read_member::is_runnable): New function.
7996         (Read_member::locks): New function.
7997         (Read_member::run): New function.
7998         (Check_script::~Check_script): New function.
7999         (Check_script::is_runnable): New function.
8000         (Check_script::locks): New function.
8001         (Check_script::run): New function.
8002         (Check_library::~Check_library): New function.
8003         (Check_library::is_runnable): New function.
8004         (Check_library::locks): New function.
8005         (Check_library::run): New function.
8006         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
8007         (Add_symbols::library_): New data member.
8008         (class Read_member): New class.
8009         (class Check_script): New class.
8010         (class Check_library): New class.
8011         * reloc.cc (Read_relocs::is_runnable): Allow case where
8012         token == NULL.
8013         (Read_relocs::locks): Likewise.
8014         (Scan_relocs::locks): Likewise.
8015         (Relocate_task::locks): Likewise.
8016         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
8017         to clear counters.
8018         (Sized_relobj::incremental_relocs_scan): Fix comment.
8019         (Sized_relobj::do_relocate): Pass output file offset to
8020         write_local_symbols.
8021         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
8022         from class declaration.
8023         * script.cc (read_input_script): Allocate Script_info; pass
8024         argument serial number to report_script.
8025         * script.h (class Script_info): Move to incremental.h.
8026         * symtab.cc (Symbol_table::add_from_incrobj): New function.
8027         * symtab.h (Symbol_table::add_from_incrobj): New function.
8028         (Symbol_table::set_file_offset): New function.
8029
8030 2011-04-05  Cary Coutant  <ccoutant@google.com>
8031
8032         * incremental-dump.cc (dump_incremental_inputs): Change signature
8033         to take a Sized_incremental_binary; change caller.  Use readers
8034         in Sized_incremental_binary.
8035         * incremental.cc
8036         (Sized_incremental_binary::find_incremental_inputs_sections):
8037         Rename do_find_incremental_inputs_sections to this.
8038         (Sized_incremental_binary::setup_readers): New function.
8039         (Sized_incremental_binary::do_check_inputs): Check
8040         has_incremental_info_ flag; move setup code to setup_readers;
8041         use input readers.
8042         (Sized_incremental_binary::do_file_is_unchanged): New function.
8043         (Sized_incremental_binary::do_get_input_reader): New function.
8044         * incremental.h (class Incremental_binary): Move to end of file.
8045         (Incremental_binary::file_is_unchanged): New function.
8046         (Incremental_binary::do_file_is_unchanged): New function.
8047         (Incremental_binary::Input_reader): New class.
8048         (Incremental_binary::get_input_reader): New function.
8049         (class Sized_incremental_binary): Move to end of file.
8050         (Sized_incremental_binary::Sized_incremental_binary): Setup the
8051         input section reader classes.
8052         (Sized_incremental_binary::has_incremental_info): New function.
8053         (Sized_incremental_binary::inputs_reader): New function.
8054         (Sized_incremental_binary::symtab_reader): New function.
8055         (Sized_incremental_binary::relocs_reader): New function.
8056         (Sized_incremental_binary::got_plt_reader): New function.
8057         (Sized_incremental_binary::do_file_is_unchanged): New function.
8058         (Sized_incremental_binary::Sized_input_reader): New class.
8059         (Sized_incremental_binary::get_input_reader): New function.
8060         (Sized_incremental_binary::find_incremental_inputs_sections):
8061         Rename do_find_incremental_inputs_sections to this.
8062         (Sized_incremental_binary::setup_readers): New function.
8063         (Sized_incremental_binary::has_incremental_info_): New data member.
8064         (Sized_incremental_binary::inputs_reader_): New data member.
8065         (Sized_incremental_binary::symtab_reader_): New data member.
8066         (Sized_incremental_binary::relocs_reader_): New data member.
8067         (Sized_incremental_binary::got_plt_reader_): New data member.
8068         (Sized_incremental_binary::current_input_file_): New data member.
8069
8070 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
8071
8072         PR gold/12640
8073         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
8074         violation.
8075
8076 2011-03-30  Cary Coutant  <ccoutant@google.com>
8077
8078         * archive.cc (Archive::include_member): Adjust call to report_object.
8079         (Add_archive_symbols::run): Add script_info to call to
8080         report_archive_begin.
8081         (Lib_group::include_member): Adjust call to report_object.
8082         (Add_lib_group_symbols::run): Adjust call to report_object.
8083         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
8084         blocks.  Add object count for script input files.
8085         * incremental.cc (Incremental_inputs::report_archive_begin): Add
8086         script_info parameter; change all callers.
8087         (Incremental_inputs::report_object): Add script_info parameter;
8088         change all callers.
8089         (Incremental_inputs::report_script): Store backpointer to
8090         incremental info entry.
8091         (Output_section_incremental_inputs::set_final_data_size): Record
8092         additional information for scripts.
8093         (Output_section_incremental_inputs::write_info_blocks): Likewise.
8094         * incremental.h (Incremental_script_entry::add_object): New function.
8095         (Incremental_script_entry::get_object_count): New function.
8096         (Incremental_script_entry::get_object): New function.
8097         (Incremental_script_entry::objects_): New data member; adjust
8098         constructor.
8099         (Incremental_inputs::report_archive_begin): Add script_info parameter.
8100         (Incremental_inputs::report_object): Add script_info parameter.
8101         (Incremental_inputs_reader::get_object_count): New function.
8102         (Incremental_inputs_reader::get_object_offset): New function.
8103         * options.cc (Input_arguments::add_file): Return reference to
8104         new input argument.
8105         * options.h (Input_argument::set_script_info): New function.
8106         (Input_argument::script_info): New function.
8107         (Input_argument::script_info_): New data member; adjust all
8108         constructors.
8109         (Input_file_group::add_file): Return reference to new input argument.
8110         (Input_file_lib::add_file): Likewise.
8111         (Input_arguments::add_file): Likewise.
8112         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
8113         * script.cc (Parser_closure::Parser_closure): Add script_info
8114         parameter; adjust all callers.
8115         (Parser_closure::script_info): New function.
8116         (Parser_closure::script_info_): New data member.
8117         (read_input_script): Report scripts earlier to incremental info.
8118         (script_add_file): Set script_info in Input_argument.
8119         (script_add_library): Likewise.
8120         * script.h (Script_options::Script_info): Rewrite class.
8121
8122 2011-03-29  Cary Coutant  <ccoutant@google.com>
8123
8124         * archive.cc (Library_base::should_include_member): Move
8125         method here from class Archive.
8126         (Archive::Archive): Initialize base class.
8127         (Archive::should_include_member): Move to base class.
8128         (Archive::do_for_all_unused_symbols): New function.
8129         (Add_archive_symbols::run): Remove redundant access to
8130         incremental_inputs.
8131         (Lib_group::Lib_group): Initialize base class.
8132         (Lib_group::do_filename): New function.
8133         (Lib_group::include_member): Pass pointer to Lib_group to
8134         report_object.
8135         (Lib_group::do_for_all_unused_symbols): New function.
8136         (Add_lib_group_symbols::run): Report archive information for
8137         incremental links.
8138         * archive.h (class Library_base): New base class.
8139         (class Archive): Derive from Library_base.
8140         (Archive::filename): Move to base class.
8141         (Archive::set_incremental_info): Likewise.
8142         (Archive::incremental_info): Likewise.
8143         (Archive::Should_include): Likewise.
8144         (Archive::should_include_member): Likewise.
8145         (Archive::Armap_entry): Remove.
8146         (Archive::Unused_symbol_iterator): Remove.
8147         (Archive::unused_symbols_begin): Remove.
8148         (Archive::unused_symbols_end): Remove.
8149         (Archive::do_filename): New function.
8150         (Archive::do_get_mtime): New function.
8151         (Archive::do_for_all_unused_symbols): New function.
8152         (Archive::task_): Move to base class.
8153         (Archive::incremental_info_): Likewise.
8154         (class Lib_group): Derive from Library_base.
8155         (Lib_group::do_filename): New function.
8156         (Lib_group::do_get_mtime): New function.
8157         (Lib_group::do_for_all_unused_symbols): New function.
8158         (Lib_group::task_): Move to base class.
8159         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
8160         function.
8161         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
8162         function.
8163         * incremental.cc (Incremental_inputs::report_archive_begin):
8164         Use Library_base; call library's get_mtime; add incremental inputs
8165         entry before members.
8166         (class Unused_symbol_visitor): New class.
8167         (Incremental_inputs::report_archive_end): Use Library_base; use
8168         visitor class to record unused symbols; don't add incremental inputs
8169         entry after members.
8170         (Incremental_inputs::report_object): Use Library_base.
8171         * incremental.h
8172         (Incremental_archive_entry::Incremental_archive_entry): Remove
8173         unused Archive parameter.
8174         (Incremental_inputs::report_archive_begin): Use Library_base.
8175         (Incremental_inputs::report_archive_end): Likewise.
8176         (Incremental_inputs::report_object): Likewise.
8177         * object.cc (Sized_relobj::do_for_all_global_symbols): New
8178         function.
8179         * object.h (Object::for_all_global_symbols): New function.
8180         (Object::do_for_all_global_symbols): New function.
8181         (Sized_relobj::do_for_all_global_symbols): New function.
8182         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
8183         function.
8184         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
8185         function.
8186
8187 2011-03-27  Ian Lance Taylor  <iant@google.com>
8188
8189         * archive.cc (Archive::interpret_header): Return -1 if something
8190         goes wrong.  Change callers accordingly.
8191
8192 2011-03-25  Cary Coutant  <ccoutant@google.com>
8193
8194         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
8195         * testsuite/Makefile.in: Regenerate.
8196
8197 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
8198
8199         * plugin.cc (get_view): New.
8200         (Plugin::load): Pass get_view to the plugin.
8201         (Plugin_manager::get_view): New.
8202
8203 2011-03-21  Ian Lance Taylor  <iant@google.com>
8204
8205         * testsuite/final_layout.sh: Rewrite to not use dc.
8206         * testsuite/relro_test.sh: Fail if dc is not present.
8207
8208 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
8209
8210         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
8211         Change == to -eq.
8212         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
8213         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
8214         Change == to -eq.
8215         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
8216         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
8217
8218 2011-03-14  Ian Lance Taylor  <iant@google.com>
8219
8220         * script-sections.cc (Sort_output_sections::script_compare):
8221         Rename from is_before, change return type.
8222         (Sort_output_sections::operator()): Adjust accordingly.
8223
8224 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
8225
8226         PR gold/12572
8227         * testsuite/odr_violation2.cc: Add comment to make all error line
8228         numbers double digits.
8229         * testsuite/debug_msg.sh: Adjust expected errors.
8230
8231 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
8232
8233         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
8234         but mark earlier ones as non-canonical
8235         (offset_to_iterator): Update search target and example
8236         (do_addr2line): Return extra lines in a vector*
8237         (format_file_lineno): Extract from do_addr2line
8238         (one_addr2line): Add vector* out-param
8239         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
8240         when a lineno entry appeared last for its instruction
8241         (Dwarf_line_info): Add vector* out-param
8242         * object.cc (Relocate_info): Pass NULL for the vector* out-param
8243         * symtab.cc (Odr_violation_compare): Include the lineno in the
8244         comparison again.
8245         (linenos_from_loc): New. Combine the canonical line for an
8246         address with its other lines.
8247         (True_if_intersect): New. Helper functor to make
8248         std::set_intersection a query.
8249         (detect_odr_violations): Compare sets of lines instead of just
8250         one line for each function. This became less deterministic, but
8251         has fewer false positives.
8252         * symtab.h: Declarations.
8253         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
8254         mix an optimized and non-optimized object in the same binary
8255         (odr_violation2.so): Same.
8256         * testsuite/Makefile.in: Regenerate from Makefile.am.
8257         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
8258         * testsuite/debug_msg.sh: Update line numbers and add
8259         assertions.
8260         * testsuite/odr_violation1.cc: Use OdrDerived, in a
8261         non-optimized context.
8262         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
8263         isn't inlined, and use OdrDerived in an optimized context.
8264         * testsuite/odr_header1.h: Defines OdrDerived, where
8265         optimization will change the
8266         first-instruction-in-the-destructor's file and line number.
8267         * testsuite/odr_header2.h: Defines OdrBase.
8268
8269 2011-03-09  Ian Lance Taylor  <iant@google.com>
8270
8271         * fileread.cc (File_read::clear_views): Don't delete the whole
8272         file view.
8273
8274 2011-03-08  Ian Lance Taylor  <iant@google.com>
8275
8276         PR gold/12525
8277         * fileread.cc: #include <climits>.
8278         (GOLD_IOV_MAX): Define.
8279         (File_read::read_multiple): Limit number of entries by iov_max.
8280         * fileread.h (class File_read): Always set max_readv_entries to
8281         128.
8282
8283 2011-03-07  Ian Lance Taylor  <iant@google.com>
8284
8285         PR gold/12525
8286         * options.h (class General_options): Add -dy and -dn.
8287
8288 2011-03-02  Cary Coutant  <ccoutant@google.com>
8289
8290         * testsuite/script_test_9.t: Add TLS segment.
8291
8292 2011-03-02  Simon Baldwin  <simonb@google.com>
8293
8294         * configure.ac: Add check for gnu_indirect_function support in
8295         the toolchain building binutils.
8296         * configure: Rebuild.
8297
8298 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
8299
8300         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
8301         plugin only symbols.
8302         (Symbol_table::sized_finalize_symbol) Mark symbol only present
8303         in plugin files as not needed in the symbol table.
8304
8305 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
8306
8307         * output.cc (Output_section::add_input_section): Delay fill
8308         generation for section ordering.
8309
8310 2011-02-09  Ian Lance Taylor  <iant@google.com>
8311
8312         PR gold/12316
8313         * object.h (class Sized_relobj): Remove clear_local_symbols.
8314         * reloc.cc (Sized_relobj::do_relocate): Don't call
8315         clear_local_symbols.
8316
8317 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
8318
8319         * plugin.cc (is_visible_from_outside): Return true for symbols
8320         in the -u option.
8321
8322 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
8323
8324         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
8325         filename.
8326
8327 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
8328
8329         * icf.h (is_section_foldable_candidate): Change type of parameter
8330         to std::string.
8331         * icf.cc (Icf::find_identical_sections): Change type of local variable
8332         section_name to be std::string.
8333         (is_function_ctor_or_dtor): Change type of parameter to std::string.
8334
8335 2011-01-25  Ian Lance Taylor  <iant@google.com>
8336
8337         * script.cc (script_add_extern): Rewrite to use
8338         add_symbol_reference.
8339
8340 2011-01-25  Doug Kwan  <dougkwan@google.com>
8341
8342         * icf.cc (get_section_contents): Always lock section's object.
8343
8344 2011-01-24  Ian Lance Taylor  <iant@google.com>
8345
8346         * options.h (class General_options): Accept
8347         --no-detect-odr-violations.
8348
8349 2011-01-24  Ian Lance Taylor  <iant@google.com>
8350
8351         * version.cc (version_string): Bump to 1.11.
8352
8353 2011-01-24  Ian Lance Taylor  <iant@google.com>
8354
8355         * plugin.cc (class Plugin_rescan): Define new class.
8356         (Plugin_manager::claim_file): Set any_claimed_.
8357         (Plugin_manager::save_archive): New function.
8358         (Plugin_manager::save_input_group): New function.
8359         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
8360         necessary.
8361         (Plugin_manager::new_undefined_symbol): New function.
8362         (Plugin_manager::rescan): New function.
8363         (Plugin_manager::rescannable_defines): New function.
8364         (Plugin_manager::add_input_file): Set any_added_.
8365         * plugin.h (class Plugin_manager): define new fields rescannable_,
8366         undefined_symbols_, any_claimed_, and any_added_.  Declare
8367         Plugin_rescan as friend.  Declare new functions.
8368         (Plugin_manager::Rescannable): Define type.
8369         (Plugin_manager::Rescannable_list): Define type.
8370         (Plugin_manager::Undefined_symbol_list): Define type.
8371         (Plugin_manager::Plugin_manager): Initialize new fields.
8372         * archive.cc (Archive::defines_symbol): New function.
8373         (Add_archive_symbols::run): Pass archive to plugins if any.
8374         * archive.h (class Archive): Declare defines_symbol.
8375         * readsyms.cc (Input_group::~Input_group): New function.
8376         (Finish_group::run): Pass input_group to plugins if any.
8377         * readsyms.h (class Input_group): Declare destructor.
8378         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
8379         any.
8380
8381 2011-01-10  Ian Lance Taylor  <iant@google.com>
8382
8383         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
8384         section as relro.
8385         (Layout::set_segment_offsets): Reset increase_relro before calling
8386         set_section_addresses a second time.
8387
8388 2011-01-04  Cary Coutant  <ccoutant@google.com>
8389
8390         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
8391         sections before NOBITS sections.
8392
8393 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
8394
8395         * version.cc (print_version): Update copyright to 2011.
8396
8397 2010-12-23  Cary Coutant  <ccoutant@google.com>
8398
8399         * output.h (Output_data_reloc::add_output_section): Pass OD instead
8400         of OS to this->add.  Add OD parameter to second form of the function.
8401
8402 2010-12-20  Ian Lance Taylor  <iant@google.com>
8403
8404         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
8405         second of two consecutive entries with same offset.
8406
8407 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8408
8409         * testsuite/Makefile.am (ifuncmain2static_LDADD)
8410         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
8411         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
8412         to avoid unneeded links against $(LDADD).
8413         * testsuite/Makefile.in: Regenerate.
8414
8415 2010-12-15  Ian Lance Taylor  <iant@google.com>
8416
8417         PR gold/12324
8418         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
8419         for R_X86_64_32 and R_X86_64_PC32.
8420         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
8421         ver_matching_def_pic.o.
8422         (ver_matching_def_pic.o): New target.
8423
8424 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8425
8426         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
8427         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
8428         Move definition before File_read::View member definitions.
8429         (File_read::View::~View): Initialize and hold lock before
8430         updating current_mapped_bytes.
8431
8432 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8433
8434         * dwarf_reader.cc: Remove outdated comment.
8435         * gold-threads.cc: Fix typo in error message.
8436         * archive.cc: Fix typos in comments.
8437         * archive.h: Likewise.
8438         * arm-reloc-property.cc: Likewise.
8439         * arm-reloc-property.h: Likewise.
8440         * arm-reloc.def: Likewise.
8441         * arm.cc: Likewise.
8442         * attributes.h: Likewise.
8443         * cref.cc: Likewise.
8444         * ehframe.cc: Likewise.
8445         * fileread.h: Likewise.
8446         * gold.h: Likewise.
8447         * i386.cc: Likewise.
8448         * icf.cc: Likewise.
8449         * incremental.h: Likewise.
8450         * int_encoding.cc: Likewise.
8451         * layout.h: Likewise.
8452         * main.cc: Likewise.
8453         * merge.h: Likewise.
8454         * object.cc: Likewise.
8455         * object.h: Likewise.
8456         * options.cc: Likewise.
8457         * readsyms.cc: Likewise.
8458         * reduced_debug_output.cc: Likewise.
8459         * reloc.cc: Likewise.
8460         * script-sections.cc: Likewise.
8461         * sparc.cc: Likewise.
8462         * symtab.h: Likewise.
8463         * target-reloc.h: Likewise.
8464         * target.cc: Likewise.
8465         * target.h: Likewise.
8466         * timer.cc: Likewise.
8467         * timer.h: Likewise.
8468         * x86_64.cc: Likewise.
8469
8470 2010-12-09  Cary Coutant  <ccoutant@google.com>
8471
8472         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
8473         stack.
8474         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
8475         parameter; change all callers.
8476         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
8477         * options.h (warn_execstack): New option.
8478
8479 2010-12-07  Doug Kwan  <dougkwan@google.com>
8480
8481         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
8482         like function call relocations.
8483
8484 2010-12-07  Ian Lance Taylor  <iant@google.com>
8485
8486         * archive.cc (Archive::get_elf_object_for_member): Permit
8487         punconfigured to be NULL.
8488         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
8489         (Archive::include_member): Pass NULL to get_elf_object_for_member
8490         if we searched for the archive and this is the first included
8491         object.
8492
8493 2010-12-01  Ian Lance Taylor  <iant@google.com>
8494
8495         * dwarf_reader.h (class Sized_dwarf_line_info): Add
8496         track_relocs_type_ field.
8497         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8498         Set track_relocs_type_.
8499         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
8500         contents when using RELA relocs.
8501         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
8502         reloc_map_.
8503         * reloc.cc (Track_relocs::next_addend): New function.
8504         * reloc.h (class Track_relocs): Declare next_addend.
8505
8506 2010-12-01  Ian Lance Taylor  <iant@google.com>
8507
8508         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
8509         virtual destructor.
8510
8511 2010-12-01  Ian Lance Taylor  <iant@google.com>
8512
8513         * README: Update compilers known to work and fail.
8514
8515 2010-11-23  Matthias Klose  <doko@ubuntu.com>
8516
8517         * configure.in: For --enable-gold, handle value `default' instead of
8518         `both*'.  Always install ld as ld.bfd, install as ld if gold is
8519         not the default.
8520         * configure: Regenerate.
8521
8522 2010-11-18  Doug Kwan  <dougkwan@google.com>
8523
8524         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
8525         and right_alignment to be zero.  Store result alignment only if it is
8526         greater than existing alignment.
8527
8528 2010-11-16  Cary Coutant  <ccoutant@google.com>
8529
8530         PR gold/12220
8531         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8532         Check for ".zdebug_line".
8533
8534 2010-11-16  Doug Kwan  <dougkwan@google.com>
8535             Cary Coutant  <ccoutant@google.com>
8536
8537         * output.h (Output_segment::set_section_addresses): Pass increase_relro
8538         by reference; adjust all callers.
8539         * output.cc (Output_segment::set_section_addresses): Adjust references
8540         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
8541         list is empty.
8542         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
8543         end at page boundary.
8544
8545 2010-11-16  Cary Coutant  <ccoutant@google.com>
8546
8547         PR gold/12220
8548         * layout.cc (Layout::choose_output_section): Transform names of
8549         compressed sections even when using a script with a SECTIONS clause.
8550         (Layout::output_section_name): Remove code to transform
8551         compressed debug section names.
8552         * output.cc (Output_section::add_input_section): Use uncompressed
8553         section size when tracking input sections.
8554
8555 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
8556
8557         * symtab.h (Symbol::NON_PIC_REF): Remove.
8558         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
8559         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
8560         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
8561         (Symbol::use_plt_offset): Take a flags argument and pass it
8562         directly to needs_dynamic_reloc.  Restrict check for undefined
8563         weak symbols to function calls.
8564         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
8565         (Target_arm::Scan::global): Use it.
8566         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
8567         (Target_arm::Relocate::relocate): Likewise.
8568         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
8569         parameter with an r_type parameter.  Use get_reference_flags
8570         to get the flags.
8571         (Target_arm::Relocate::relocate): Update accordingly.
8572         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
8573         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
8574         (Target_i386::Scan::global): Likewise.
8575         (Target_i386::Relocate::relocate): Likewise.
8576         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
8577         parameter with an r_type parameter.  Use get_reference_flags
8578         to get the flags.
8579         (Target_i386::Relocate::relocate): Update accordingly.
8580         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
8581         (Target_powerpc::Scan::global): Use it.
8582         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
8583         (Target_powerpc::Relocate::relocate): Likewise.
8584         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
8585         (Target_sparc::Scan::global): Use it.
8586         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
8587         (Target_sparc::Relocate::relocate): Likewise.
8588         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
8589         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
8590         (Target_x86_64::Scan::global): Likewise.
8591         (Target_x86_64::Relocate::relocate): Likewise.
8592
8593 2010-11-08  Doug Kwan  <dougkwan@google.com>
8594             Cary Coutant  <ccoutant@google.com>
8595
8596         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
8597         (Arm_exidx_merge_section::section_contents_): New data member.
8598         (Arm_input_section::Arm_input_section): Initialize original_contents_.
8599         (Arm_input_section::~Arm_input_section): De-allocate memory.
8600         (Arm_input_section::original_contents_): New data member.
8601         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
8602         in parameters instead of calling Object::section_contents without
8603         locking.
8604         (Arm_output_section::group_section): New parameter TASK.  Pass it
8605         to callees that need locking objects.
8606         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
8607         to lock EXIDX input sections.  Fix a formatting issue.  Call
8608         Arm_exidx_merged_section::build_contents to create merged section
8609         contents.
8610         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
8611         to lock object of stub table owner.
8612         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
8613         TEXT_SIZE to initialize data member TEXT_SIZE_.
8614         (Arm_exidx_input_section::addralign): Fix typo in comment.
8615         (Arm_exidx_input_section::text_size): New method.
8616         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
8617         that require locking objects.  Lock objects before scanning for stubs
8618         and updating local symbols.
8619         (Arm_input_section<big_endian>::init): Copy contents of original
8620         input section.
8621         (Arm_input_section<big_endian>::do_write): Use saved contents of
8622         original input section instead of calling Object::section_contents
8623         without locking.
8624         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
8625         size without calling Object::section_size().
8626         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
8627         for size.  Allocate a buffer for merged EXIDX entries.
8628         (Arm_exidx_merged_section::build_contents): New method.
8629         (Arm_exidx_merged_section::do_write): Move merge section contents
8630         building code to Arm_exidx_merged_section::build_contetns.  Write
8631         out contetns in buffer instead of building it on the fly.
8632         (Arm_relobj::make_exidx_input_section): Also pass text section size
8633         to Arm_exidx_input_section constructor.
8634         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
8635         (Arm_dynobj::do_read_symbols): Fix memory leak.
8636         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
8637         * target.h: (class Task): Add forward declaration.
8638         (Target::relax): Add new parameter TASK and pass it to
8639         Target::do_relax().
8640         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
8641
8642 2010-11-05  Cary Coutant  <ccoutant@google.com>
8643
8644         PR gold/10708
8645         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
8646         object when reading from the file.
8647         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
8648         second layout pass.
8649         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
8650         when reading section contents.
8651         (get_section_contents): Likewise.
8652         (icf::find_identical_sections): Likewise.
8653         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
8654         object when reading from the file.
8655         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
8656         the object when doing deferred section layout.
8657
8658 2010-11-03  Nick Clifton  <nickc@redhat.com>
8659
8660         PR gold/12001
8661         * script.h (class Symbol_assignment: name): New member.  Returns
8662         the name of the symbol.
8663         * scrfipt.cc (Script_options::is_pending_assignment): New member.
8664         Returns true if the given symbol name is on the list of
8665         assignments wating to be processed.
8666         * archive.cc (should_incldue_member): If the symbol is undefined,
8667         check to see if it is on the list of symbols pending assignment.
8668
8669 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
8670
8671         * script-sections.cc (Script_sections::find_memory_region): Check
8672         for a NULL output section pointer.
8673
8674 2010-10-29  Doug Kwan  <dougkwan@google.com>
8675
8676         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
8677         Output_section::add_relaxed_input_section.
8678         * output.cc (Output_section::add_relaxed_input_section): Add new
8679         arguments LAYOUT and NAME.  Set section order index.
8680         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8681         Copy section order index.
8682         * output.h (Output_section::add_relaxed_input_section): Add new
8683         arguments LAYOUT and NAME.
8684
8685 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8686
8687         * testsuite/Makefile.am: Move gcctestdir/ld rule to
8688         NATIVE_OR_CROSS_LINKER.
8689         * testsuite/Makefile.in: Regenerate.
8690
8691 2010-10-20  Doug Kwan  <dougkwan@google.com>
8692
8693         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
8694         without SHF_LINK_ORDER flags.
8695         * layout.cc (Layout::choose_output_section): Do not filter
8696         SHF_LINK_ORDER flag in a relocatable link.
8697
8698 2010-10-17  Cary Coutant  <ccoutant@google.com>
8699
8700         * output.h (Output_segment::set_section_addresses): Change function
8701         signature.  Update all callers.
8702         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
8703         sections.
8704         (Output_segment::set_section_addresses): Align after last TLS
8705         section.  Add padding before last relro section instead of after.
8706
8707 2010-10-17  Doug Kwan  <dougkwan@google.com>
8708
8709         * gold/arm.cc (Target_arm::got_section): Use correct order and set
8710         GOT output section to be writable.
8711
8712 2010-10-14  Cary Coutant  <ccoutant@google.com>
8713
8714         * debug.h (DEBUG_INCREMENTAL): New flag.
8715         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
8716         * gold.cc (queue_initial_tasks): Check parameters for incremental link
8717         mode.
8718         * incremental.cc (report_command_line): Ignore all forms of
8719         --incremental.
8720         * layout.cc (Layout::Layout): Check parameters for incremental link
8721         mode.
8722         * options.cc (General_options::parse_incremental): New function.
8723         (General_options::parse_no_incremental): New function.
8724         (General_options::parse_incremental_full): New function.
8725         (General_options::parse_incremental_update): New function.
8726         (General_options::incremental_mode_): New data member.
8727         (General_options::finalize): Check incremental_mode_.
8728         * options.h (General_options): Update help text for --incremental.
8729         Add --no-incremental, --incremental-full, --incremental-update.
8730         (General_options::Incremental_mode): New enum type.
8731         (General_options::incremental_mode): New function.
8732         (General_options::incremental_mode_): New data member.
8733         * parameters.cc (Parameters::incremental_mode_): New data member.
8734         (Parameters::set_options): Set incremental_mode_.
8735         (Parameters::set_incremental_full): New function.
8736         (Parameters::incremental): New function.
8737         (Parameters::incremental_update): New function.
8738         (set_parameters_incremental_full): New function.
8739         * parameters.h (Parameters::set_incremental_full): New function.
8740         (Parameters::incremental): New function.
8741         (Parameters::incremental_update): New function.
8742         (Parameters::incremental_mode_): New data member.
8743         (set_parameters_incremental_full): New function.
8744         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
8745         incremental link mode.
8746         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
8747         (Sized_relobj::do_relocate_sections): Likewise.
8748         * testsuite/Makefile.am (incremental_test): Use --incremental-full
8749         option.
8750         * testsuite/Makefile.in: Regenerate.
8751         * testsuite/incremental_test.sh: Filter all forms of --incremental.
8752
8753 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8754
8755         * script-sections.h (class Script_sections): Make
8756         Sections_elements typedef public.
8757         * script-sections.cc (class Sort_output_sections): Add elements_
8758         field.  Add constructor which sets it; change all callers.
8759         (Sort_output_sections::is_before): New function.
8760         (Sort_output_sections::operator()): Call is_before.
8761         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
8762         conditional.
8763         * testsuite/script_test_10.sh: New test. Test script section
8764         order.
8765         * testsuite/script_test_10.t: Likewise.
8766         * testsuite/script_test_10.s: Likewise.
8767         * testsuite/Makefile.am: Wrap the cross linker tests and the
8768         common tests into NATIVE_OR_CROSS_LINKER.
8769         (check_SCRIPTS): Add script_test_10.sh.
8770         (check_DATA): Add script_test_10.stdout.
8771         (script_test_10.o, script_test_10): New targets.
8772         (script_test_10.stdout): New target.
8773         * configure, testsuite/Makefile.in: Regenerate.
8774
8775 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8776
8777         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
8778         error for the deprecated relocations.
8779         (Target_arm::Scan::global): Likewise.
8780         (Target_arm::Relocate::relocate): Likewise.
8781
8782 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
8783
8784         * fileread.cc (Input_file::find_file): Initialize *found_name
8785         and *namep when using the fallback search for case 4.
8786
8787 2010-10-11  Cary Coutant  <ccoutant@google.com>
8788
8789         * options.h (class General_options): Redefine -z lazy as an alias for
8790         the negation of -z now.
8791
8792 2010-10-11  Ian Lance Taylor  <iant@google.com>
8793
8794         * resolve.cc (symbol_to_bits): Report the value of the unsupported
8795         binding.
8796
8797 2010-10-06  Nick Clifton  <nickc@redhat.com>
8798
8799         * script-sections.cc(class Memory_region): Remove
8800         current_lma_offset_ field.  Rename current_vma_offset_ to
8801         current_offset_.  Add last_section_ field.
8802         (Memory_region::get_current_vma_address): Rename to
8803         get_current_address.
8804         (Memory_region::get_current_lma_address): Delete.
8805         (Memory_region::increment_vma_offset): Rename to
8806         increment_offset.
8807         (Memory_region::increment_lma_offset): Delete.
8808         (Memory_region::attributes_compatible): New method.  Returns
8809         true if the provided section is compatible with the region.
8810         (Memory_region::get_last_section): New method.  Returns the last
8811         section to use the region.
8812         (Memory_region::set_last_section): New method.  Stores the last
8813         section to use the region.
8814         (Script_sections::block_in_region): New method.  Returns true if
8815         a block of memory is contained within a region.
8816         (Script_sections::find_memory_region): New method.  Locates a
8817         memory region to be used to set a VMA or LMA address.
8818         (Output_section_definition::set_section_addresses): Add code to
8819         check for addresses set by memory regions.
8820         (Output_segment::set_section_addresses): Remove memory region
8821         walking code.
8822         (Script_sections::create_segment): Add a warning if a header
8823         segment is created outside of any region.
8824         * script-sections.h (class Script_sections): Add prototypes for
8825         find_memory_region and block_in_region methods.
8826         * testsuite/memory_test.s: Use .long instead of .word.
8827         * testsuite/memory_test.t: Add some more output sections.
8828         * testsuite/memory_test.sh: Update expected output.
8829
8830 2010-10-02  Doug Kwan  <dougkwan@google.com>
8831
8832         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
8833         defintion to symtab.h
8834         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
8835         declaration to defintion.
8836
8837 2010-10-01  Nick Clifton  <nickc@redhat.com>
8838
8839         * expression.cc (eval): Replace dummy argument with NULL.
8840         (eval_maybe_dot): Check for a NULL result section pointer.
8841         (Symbol_expression::value): Likewise.
8842         (Dot_expression::value): Likewise.
8843         (BINARY_EXPRESSION): Likewise.
8844         (Max_expression::value): Likewise.
8845         (Min_expression::value): Likewise.
8846         (Absolute_expression::value): Likewise.
8847         (Addr_expression::value_from_output_section): Likewise.
8848         (Loaddddr_expression::value_from_output_section): Likewise.
8849         (Segment_start_expression::value): Likewise.
8850         * script-sections.cc
8851         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
8852         argument with NULL.
8853         (Sections_elememt_dot_assignment::set_section_addresses):
8854         Likewise.
8855         (Output_data_expression::do_write_to_buffer): Likewise.
8856         (Output_section_definition::finalize_symbols): Likewise.
8857         (Output_section_definition::set_section_addresses): Likewise.
8858
8859 2010-09-30  Doug Kwan  <dougkwan@google.com>
8860
8861         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
8862
8863 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
8864
8865         * target.h (Target::can_icf_inline_merge_sections): New virtual
8866         function.
8867         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
8868         virtual function.
8869         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
8870         virtual function.
8871         * icf.cc (get_section_contents): Inline merge sections only when
8872         target allows it.
8873
8874 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8875
8876         * configure: Regenerate.
8877
8878 2010-09-17  Ian Lance Taylor  <iant@google.com>
8879
8880         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
8881         * testsuite/Makefile.am (memory_test.o): New target.
8882         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
8883         memory_test.t.
8884         * testsuite/Makefile.in: Rebuild.
8885
8886 2010-09-17  Doug Kwan  <dougkwan@google.com>
8887
8888         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
8889         defintion if relocation uses GOT entries of the symbol.
8890         * testsuite/icf_safe_test.sh: Fix test.
8891         * testsuite/icf_safe_so_test.sh: Fix test.
8892
8893 2010-09-16  Cary Coutant  <ccoutant@google.com>
8894
8895         * script_sections.cc (class Memory_region): Remove "NULL" from
8896         vector initializations.
8897
8898 2010-09-15  Cary Coutant  <ccoutant@google.com>
8899
8900         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
8901         Resolve forwarding symbols.
8902
8903 2010-09-15  Doug Kwan  <dougkwan@google.com>
8904
8905         * gold/testsuite/script_test_3.t: Add ARM special sections.
8906         * gold/testsuite/script_test_4.t: Same.
8907         * gold/testsuite/script_test_5.t: Same.
8908         * gold/testsuite/script_test_6.t: Same.
8909         * gold/testsuite/script_test_7.t: Same.
8910         * gold/testsuite/script_test_7.t: Same.
8911         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
8912
8913 2010-09-14  Cary Coutant  <ccoutant@google.com>
8914
8915         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
8916         (Target_x86_64::Relocate::relocate_tls): Replace check for
8917         saw_tls_block_reloc_ with test for executable section.
8918
8919 2010-09-12  Cary Coutant  <ccoutant@google.com>
8920
8921         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
8922         position-independent executables to shared libraries need dynamic
8923         relocations.
8924         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
8925         position-independent executables.
8926         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
8927         * testsuite/Makefile.in: Regenerate.
8928
8929 2010-09-10  Nick Clifton  <nickc@redhat.com>
8930
8931         PR gold/11997
8932         * testsuite/memory_test.t: Discard any sections that are not
8933         needed.
8934
8935 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
8936
8937         PR gold/11996
8938         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8939         "This::" to work around a bug in gcc 4.2.
8940
8941         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
8942
8943 2010-09-09  Rafael Espindola  <espindola@google.com>
8944
8945         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
8946         sections with different PF_X flags in the same segment.
8947         (Layout::find_first_load_seg): Search all segments to find the first
8948         one.
8949         * options.h (rosegment): New.
8950
8951 2010-09-08  Rafael Espindola  <espindola@google.com>
8952
8953         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
8954
8955 2010-09-08  Doug Kwan  <dougkwan@google.com>
8956
8957         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
8958         (Arm_relobj::do_relocate_sections): Add new parameter for output
8959         file to match the parent.
8960         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
8961         of local symbols instead of input values.  Update code to track
8962         changes in gold::relocate_section.
8963         * object.cc (Sized_relobj::compute_final_local_value): New methods.
8964         (Sized_relobj::compute_final_local_value_internal): New methods.
8965         (Sized_relobj::do_finalize_local_symbols): Move code from loop
8966         body into private version of Sized_relobj::compute_final_local_value.
8967         Call the inline method.
8968         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
8969         merged symbol value if there is one.
8970         (Symbol_value::has_output_value): New method defintiion.
8971         (Sized_relobj::Compute_final_local_value_status): New enum type.
8972         (Sized_relobj::compute_final_local_value): New methods.
8973         (Sized_relobj::compute_final_local_value_internal): New methods.
8974         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
8975         and arm_cortex_a8.sh.
8976         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
8977         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
8978         New tests.
8979         * Makefile.in: Regenerate.
8980         * testsuite/arm_bl_out_of_range.s: Update test.
8981         * testsuite/thumb_bl_out_of_range.s: Ditto.
8982         * testsuite/thumb_blx_out_of_range.s: Ditto.
8983         * testsuite/arm_branch_out_of_range.sh: New file.
8984         * testsuite/arm_cortex_a8.sh: Ditto.
8985         * testsuite/arm_cortex_a8_b.s: Ditto.
8986         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
8987         * testsuite/arm_cortex_a8_b_local.s: Ditto.
8988         * testsuite/arm_cortex_a8_bl.s: Ditto.
8989         * testsuite/arm_cortex_a8_blx.s: Ditto.
8990         * testsuite/arm_cortex_a8_local.s: Ditto.
8991         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
8992         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
8993
8994 2010-09-08  Rafael Espindola  <espindola@google.com>
8995
8996         * Makefile.am (memory_test.stdout): Run readelf with -W.
8997         * Makefile.in: Regenerate.
8998         * testsuite/memory_test.sh: Make the regexps accept both 32 and
8999         64 bit output.
9000
9001 2010-09-08  Rafael Espindola  <espindola@google.com>
9002
9003         * script-sections.cc (Script_sections::add_memory_region): Convert
9004         field precision to int.
9005         * script.cc (script_set_section_region, script_set_section_region):
9006         Convert field precision to int.
9007
9008 2010-09-08  Rafael Espindola  <espindola@google.com>
9009
9010         * arm.cc (do_finalize_sections): Create the __exidx_start and
9011         __exdix_end symbols even when the section is missing.
9012
9013 2010-09-08  Nick Clifton  <nickc@redhat.com>
9014
9015         * README: Remove claim that MEMORY is not supported.
9016         * expression.cc (script_exp_function_origin)
9017         (script_exp_function_length): Move from here to ...
9018         * script.cc: ... here.
9019         (script_set_section_region, script_add_memory)
9020         (script_parse_memory_attr, script_include_directive): New
9021         functions.
9022         * script-sections.cc
9023         (class Memory_region): New class.
9024         (class Output_section_definition): Add set_memory_region,
9025         set_section_vma, set_section_lma and get_section_name methods.
9026         (class Script_Sections): Add add_memory_region,
9027         find_memory_region, find_memory_region_origin,
9028         find_memory_region_length and set_memory_region methods.
9029         Have set_section_addresses method walk the list of set memory
9030         regions.
9031         Extend the print methos to display memory regions.
9032         * script-sections.h: Add prototypes for new methods.
9033         Add enum for MEMORY region attributes.
9034         * yyscript.y: Add support for parsing MEMORY regions.
9035         * script-c.h: Add prototypes for new functions.
9036         * testsuite/Makefile.am: Add test of MEMORY region functionality.
9037         * testsuite/Makefile.in: Regenerate.
9038         * testsuite/memory_test.sh: New script.
9039         * testsuite/memory_test.s: New assembler source file.
9040         * testsuite/memory_test.t: New linker script.
9041
9042 2010-08-27  Doug Kwan  <dougkwan@google.com>
9043
9044         * gold/resolve.cc (Symbol_table::should_override): Let a weak
9045         reference override an existing dynamic weak reference.
9046         * testsuite/Makefile.am: Add new test dyn_weak_ref.
9047         * testsuite/Makefile.in: Regenerate.
9048         * testsuite/dyn_weak_ref.sh: New file.
9049         * testsuite/dyn_weak_ref_1.c: Ditto.
9050         * testsuite/dyn_weak_ref_2.c: Ditto.
9051
9052 2010-08-27  Ian Lance Taylor  <iant@google.com>
9053
9054         * incremental.h (class Incremental_input_entry): Add virtual
9055         destructor.
9056
9057 2010-08-27  Ian Lance Taylor  <iant@google.com>
9058
9059         * testsuite/start_lib_test_3.c: Mark t3 as used.
9060
9061 2010-08-27  Nick Clifton  <nickc@redhat.com>
9062
9063         * options.cc (version_script): Fix small typo in previous
9064         whitespace tidyup.
9065
9066 2010-08-25  Nick Clifton  <nickc@redhat.com>
9067
9068         * archive.cc: Formatting fixes: Remove whitespace between
9069         typename and following asterisk.  Remove whitespace between
9070         function name and opening parenthesis.
9071         * archive.h: Likewise.
9072         * arm.cc: Likewise.
9073         * attributes.cc: Likewise.
9074         * attributes.h: Likewise.
9075         * common.cc: Likewise.
9076         * copy-relocs.cc: Likewise.
9077         * dirsearch.h: Likewise.
9078         * dynobj.cc: Likewise.
9079         * ehframe.cc: Likewise.
9080         * ehframe.h: Likewise.
9081         * expression.cc: Likewise.
9082         * fileread.cc: Likewise.
9083         * fileread.h: Likewise.
9084         * gc.h: Likewise.
9085         * gold-threads.cc: Likewise.
9086         * gold.cc: Likewise.
9087         * i386.cc: Likewise.
9088         * icf.h: Likewise.
9089         * incremental-dump.cc: Likewise.
9090         * incremental.cc: Likewise.
9091         * layout.cc: Likewise.
9092         * layout.h: Likewise.
9093         * main.cc: Likewise.
9094         * merge.cc: Likewise.
9095         * merge.h: Likewise.
9096         * object.cc: Likewise.
9097         * object.h: Likewise.
9098         * options.cc: Likewise.
9099         * options.h: Likewise.
9100         * output.cc: Likewise.
9101         * output.h: Likewise.
9102         * plugin.cc: Likewise.
9103         * plugin.h: Likewise.
9104         * powerpc.cc: Likewise.
9105         * reloc.cc: Likewise.
9106         * script-c.h: Likewise.
9107         * script-sections.cc: Likewise.
9108         * script.cc: Likewise.
9109         * stringpool.cc: Likewise.
9110         * symtab.cc: Likewise.
9111         * symtab.h: Likewise.
9112         * target.cc: Likewise.
9113         * timer.cc: Likewise.
9114         * timer.h: Likewise.
9115         * version.cc: Likewise.
9116         * x86_64.cc: Likewise.
9117
9118 2010-08-24  Nick Clifton  <nickc@redhat.com>
9119
9120         PR 11899
9121         * layout.cc (segment_precedes): Sort segments by their physical
9122         addresses, if they have been set.
9123
9124 2010-08-23  Cary Coutant  <ccoutant@google.com>
9125
9126         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
9127         symbols data.
9128         (Lib_group::include_member): Unlock object after deleting its
9129         symbols data.
9130         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
9131         the bug fixed here.
9132
9133 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
9134             Cary Coutant  <ccoutant@google.com>
9135
9136         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
9137         constructor, and set_blocker.
9138         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
9139         readsyms_blocker_.
9140         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
9141         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
9142         * testsuite/Makefile.am (start_lib_test): New test case.
9143         * testsuite/Makefile.in: Regenerate.
9144         * testsuite/start_lib_test_main.c: New file.
9145         * testsuite/start_lib_test_1.c: New file.
9146         * testsuite/start_lib_test_2.c: New file.
9147         * testsuite/start_lib_test_3.c: New file.
9148
9149 2010-08-19  Ian Lance Taylor  <iant@google.com>
9150
9151         * Makefile.in: Rebuild with automake 1.11.1.
9152         * aclocal.m4: Likewise.
9153         * testsuite/Makefile.in: Likewise.
9154
9155 2010-08-19  Ian Lance Taylor  <iant@google.com>
9156
9157         PR 10893
9158         * i386.cc (class Output_data_plt_i386): Update declarations.
9159         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
9160         local_ifuncs_ fields.
9161         (Target_i386::do_plt_section_for_global): New function.
9162         (Target_i386::do_plt_section_for_local): New function.
9163         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
9164         parameter; change all callers.  Initialize global_ifuncs_ and
9165         local_ifuncs_.  If doing a static link define __rel_iplt_start and
9166         __rel_iplt_end.
9167         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
9168         (Output_data_plt_i386::add_local_ifunc_entry): New function.
9169         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
9170         symbols.
9171         (Target_i386::make_plt_section): New function, broken out of
9172         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
9173         (Target_i386::make_plt_entry): Call make_plt_section.
9174         (Target_i386::make_local_ifunc_plt_entry): New function.
9175         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
9176         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
9177         R_386_IRELATIVE to switch.
9178         (Target_i386::Scan::global): Likewise.
9179         (Target_i386::Relocate::relocate): Likewise.
9180         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
9181         switch.
9182         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
9183         (Target_x86_64::do_plt_section_for_global): New function.
9184         (Target_x86_64::do_plt_section_for_local): New function.
9185         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
9186         parameter; change all callers.  If doing a static link define
9187         __rela_iplt_start and __rela_iplt_end.
9188         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
9189         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
9190         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
9191         to point to .plt.
9192         (Target_x86_64::make_local_ifunc_plt_entry): New function.
9193         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
9194         switch.
9195         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
9196         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
9197         R_X86_64_IRELATIVE to switch.
9198         (Target_x86_64::Scan::global): Likewise.
9199         (Target_x86_64::Relocate::relocate): Likewise.
9200         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
9201         switch.
9202         * target.h (class Target): Add plt_section_for_global and
9203         plt_section_for_local functions.  Add do_plt_section_for_global
9204         and do_plt_section_for_local virtual functions.
9205         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
9206         clarifying comments.
9207         (Symbol::use_plt_offset): Handle IFUNC symbol.
9208         * object.cc (Sized_relobj::Sized_relobj): Initialize
9209         local_plt_offsets_.
9210         (Sized_relobj::local_has_plt_offset): New function.
9211         (Sized_relobj::local_plt_offset): New function.
9212         (Sized_relobj::set_local_plt_offset): New function.
9213         (Sized_relobj::do_count): Handle IFUNC symbol.
9214         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
9215         a bit away from input_shndx_ field.  Add set_is_func_symbol and
9216         is_ifunc_symbol functions.
9217         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
9218         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
9219         local_plt_offsets_ field.
9220         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
9221         * output.h (class Output_section_data): Add non-const
9222         output_section function.
9223         (class Output_data_got): Update declarations.
9224         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
9225         Add use_plt_offset parameter to global and local constructors.
9226         Change all callers.  Change local_sym_index_ field to 31 bits.
9227         Change GSYM_CODE and CONSTANT_CODE accordingly.
9228         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
9229         doing a static link don't set sh_link field.
9230         (Output_data_got::Got_entry::write): Use PLT offset if
9231         appropriate.
9232         (Output_data_got::add_global_plt): New function.
9233         (Output_data_got::add_local_plt): New function.
9234         * target-reloc.h (relocate_section): Handle IFUNC symbol.
9235         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
9236         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
9237         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
9238         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
9239         IFUNC conditional.
9240         * testsuite/ifunc-sel.h: New file.
9241         * testsuite/ifuncmain1.c: New file.
9242         * testsuite/ifuncmain1vis.c: New file.
9243         * testsuite/ifuncmod1.c: New file.
9244         * testsuite/ifuncdep2.c: New file.
9245         * testsuite/ifuncmain2.c: New file.
9246         * testsuite/ifuncmain3.c: New file.
9247         * testsuite/ifuncmod3.c: New file.
9248         * testsuite/ifuncmain4.c: New file.
9249         * testsuite/ifuncmain5.c: New file.
9250         * testsuite/ifuncmod5.c: New file.
9251         * testsuite/ifuncmain6pie.c: New file.
9252         * testsuite/ifuncmod6.c: New file.
9253         * testsuite/ifuncmain7.c: New file.
9254         * configure, testsuite/Makefile.in: Rebuild.
9255
9256 2010-08-18  Ian Lance Taylor  <iant@google.com>
9257
9258         * incremental.cc
9259         (Output_section_incremental_inputs::write_input_files): Add cast
9260         to avoid signed/unsigned comparison warning.
9261         (Output_section_incremental_inputs::write_info_blocks): Likewise.
9262
9263 2010-08-12  Cary Coutant  <ccoutant@google.com>
9264
9265         * common.cc (Sort_commons::operator()): Remove unnecessary code.
9266
9267 2010-08-13  Ian Lance Taylor  <iant@google.com>
9268
9269         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
9270
9271 2010-08-12  Cary Coutant  <ccoutant@google.com>
9272             Doug Kwan  <dougkwan@google.com>
9273
9274         * resolve.cc (Symbol_table::should_override): When a weak dynamic
9275         defintion overrides non-weak undef, remember that the original undef
9276         is not weak.
9277         * symtab.cc (Symbol_table::sized_write_global): For undef without
9278         an original weak binding, set binding to global in output.
9279         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
9280         * testsuite/Makefile.in: Regenerate.
9281         * testsuite/strong_ref_weak_def.sh: New file.
9282         * testsuite/strong_ref_weak_def_1.c: Ditto.
9283         * testsuite/strong_ref_weak_def_2.c: Ditto.
9284
9285 2010-08-12  Cary Coutant  <ccoutant@google.com>
9286
9287         * testsuite/incremental_test.sh: Rewrite.
9288         * testsuite/incremental_test_1.c: Rewrite.
9289         * testsuite/incremental_test_2.c: Rewrite.
9290
9291 2010-08-12  Cary Coutant  <ccoutant@google.com>
9292
9293         * arm.cc (Target_arm::got_size): Add const.
9294         (Target_arm::got_entry_count): New function.
9295         (Target_arm::plt_entry_count): New function.
9296         (Target_arm::first_plt_entry_offset): New function.
9297         (Target_arm::plt_entry_size): New function.
9298         (Output_data_plt_arm::entry_count): New function.
9299         (Output_data_plt_arm::first_plt_entry_offset): New function.
9300         (Output_data_plt_arm::get_plt_entry_size): New function.
9301         * i386.cc (Target_i386::got_size): Add const.
9302         (Target_i386::got_entry_count): New function.
9303         (Target_i386::plt_entry_count): New function.
9304         (Target_i386::first_plt_entry_offset): New function.
9305         (Target_i386::plt_entry_size): New function.
9306         (Output_data_plt_i386::entry_count): New function.
9307         (Output_data_plt_i386::first_plt_entry_offset): New function.
9308         (Output_data_plt_i386::get_plt_entry_size): New function.
9309         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
9310         find_incremental_inputs_sections.  Dump incremental_got_plt section.
9311         * incremental.cc: Include target.h.
9312         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
9313         parameter.  Adjust all callers.  Find incremental_got_plt section.
9314         (Incremental_inputs::create_data_sections): Create incremental_got_plt
9315         section.
9316         (Output_section_incremental_inputs::set_final_data_size): Calculate
9317         size of incremental_got_plt section.
9318         (Output_section_incremental_inputs::do_write): Write the
9319         incremental_got_plt section.
9320         (Got_plt_view_info): New struct.
9321         (Local_got_offset_visitor): New class.
9322         (Global_got_offset_visitor): New class.
9323         (Global_symbol_visitor_got_plt): New class.
9324         (Output_section_incremental_inputs::write_got_plt): New function.
9325         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
9326         Add parameter.  Adjust all callers.
9327         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9328         (Incremental_inputs::got_plt_section): New function.
9329         (Incremental_inputs::got_plt_section_): New data member.
9330         (Incremental_got_plt_reader): New class.
9331         * layout.cc (Layout::create_incremental_info_sections): Add the
9332         incremental_got_plt section.
9333         * object.h (Got_offset_list::get_list): New function.
9334         (Got offset_list::for_all_got_offsets): New function.
9335         (Sized_relobj::local_got_offset_list): New function.
9336         * powerpc.cc (Target_powerpc::got_size): Add const.
9337         (Target_powerpc::got_entry_count): New function.
9338         (Target_powerpc::plt_entry_count): New function.
9339         (Target_powerpc::first_plt_entry_offset): New function.
9340         (Target_powerpc::plt_entry_size): New function.
9341         (Output_data_plt_powerpc::entry_count): New function.
9342         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
9343         (Output_data_plt_powerpc::get_plt_entry_size): New function.
9344         * sparc.cc (Target_sparc::got_size): Add const.
9345         (Target_sparc::got_entry_count): New function.
9346         (Target_sparc::plt_entry_count): New function.
9347         (Target_sparc::first_plt_entry_offset): New function.
9348         (Target_sparc::plt_entry_size): New function.
9349         (Output_data_plt_sparc::entry_count): New function.
9350         (Output_data_plt_sparc::first_plt_entry_offset): New function.
9351         (Output_data_plt_sparc::get_plt_entry_size): New function.
9352         * symtab.h (Symbol::got_offset_list): New function.
9353         (Symbol_table::for_all_symbols): New function.
9354         * target.h (Sized_target::got_entry_count): New function.
9355         (Sized_target::plt_entry_count): New function.
9356         (Sized_target::plt_entry_size): New function.
9357         * x86_64.cc (Target_x86_64::got_size): Add const.
9358         (Target_x86_64::got_entry_count): New function.
9359         (Target_x86_64::plt_entry_count): New function.
9360         (Target_x86_64::first_plt_entry_offset): New function.
9361         (Target_x86_64::plt_entry_size): New function.
9362         (Output_data_plt_x86_64::entry_count): New function.
9363         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
9364         (Output_data_plt_x86_64::get_plt_entry_size): New function.
9365
9366 2010-08-12  Cary Coutant  <ccoutant@google.com>
9367
9368         * archive.cc: Include incremental.h.
9369         (Archive::Archive): Initialize incremental_info_.
9370         (Archive::include_member): Record archive members in incremental info.
9371         (Add_archive_symbols::run): Record begin and end of an archive in
9372         incremental info.
9373         (Lib_group::include_member): Record objects in incremental info.
9374         * archive.h (Incremental_archive_entry): Forward declaration.
9375         (Archive::set_incremental_info): New member function.
9376         (Archive::incremental_info): New member function.
9377         (Archive::Unused_symbol_iterator): New class.
9378         (Archive::unused_symbols_begin): New member function.
9379         (Archive::unused_symbols_end): New member function.
9380         (Archive::incremental_info_): New data member.
9381         * incremental-dump.cc (find_input_containing_global): New function.
9382         (dump_incremental_inputs): Dump new incremental info sections.
9383         * incremental.cc: Include symtab.h.
9384         (Output_section_incremental_inputs): New class.
9385         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
9386         new incremental info sections.
9387         (Sized_incremental_binary::do_check_inputs): Likewise.
9388         (Incremental_inputs::report_archive): Remove.
9389         (Incremental_inputs::report_archive_begin): New function.
9390         (Incremental_inputs::report_archive_end): New function.
9391         (Incremental_inputs::report_object): New function.
9392         (Incremental_inputs::finalize_inputs): Remove.
9393         (Incremental_inputs::report_input_section): New function.
9394         (Incremental_inputs::report_script): Rewrite.
9395         (Incremental_inputs::finalize): Do nothing but finalize string table.
9396         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9397         (Incremental_inputs::sized_create_inputs_section_data): Remove.
9398         (Incremental_inputs::create_data_sections): New function.
9399         (Incremental_inputs::relocs_entsize): New function.
9400         (Output_section_incremental_inputs::set_final_data_size): New function.
9401         (Output_section_incremental_inputs::do_write): New function.
9402         (Output_section_incremental_inputs::write_header): New function.
9403         (Output_section_incremental_inputs::write_input_files): New function.
9404         (Output_section_incremental_inputs::write_info_blocks): New function.
9405         (Output_section_incremental_inputs::write_symtab): New function.
9406         * incremental.h (Incremental_script_entry): Forward declaration.
9407         (Incremental_object_entry): Forward declaration.
9408         (Incremental_archive_entry): Forward declaration.
9409         (Incremental_inputs): Forward declaration.
9410         (Incremental_inputs_header_data): Remove.
9411         (Incremental_inputs_header): Remove.
9412         (Incremental_inputs_header_write): Remove.
9413         (Incremental_inputs_entry_data): Remove.
9414         (Incremental_inputs_entry): Remove.
9415         (Incremental_inputs_entry_write): Remove.
9416         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
9417         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
9418         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9419         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
9420         Likewise.
9421         (Incremental_input_entry): New class.
9422         (Incremental_script_entry): New class.
9423         (Incremental_object_entry): New class.
9424         (Incremental_archive_entry): New class.
9425         (Incremental_inputs::Incremental_inputs): Initialize new data members.
9426         (Incremental_inputs::report_inputs): Remove.
9427         (Incremental_inputs::report_archive): Remove.
9428         (Incremental_inputs::report_archive_begin): New function.
9429         (Incremental_inputs::report_archive_end): New function.
9430         (Incremental_inputs::report_object): Change prototype.
9431         (Incremental_inputs::report_input_section): New function.
9432         (Incremental_inputs::report_script): Change prototype.
9433         (Incremental_inputs::get_reloc_count): New function.
9434         (Incremental_inputs::set_reloc_count): New function.
9435         (Incremental_inputs::create_data_sections): New function.
9436         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9437         (Incremental_inputs::inputs_section): New function.
9438         (Incremental_inputs::symtab_section): New function.
9439         (Incremental_inputs::relocs_section): New function.
9440         (Incremental_inputs::get_stringpool): Add const.
9441         (Incremental_inputs::command_line): Add const.
9442         (Incremental_inputs::inputs): Remove.
9443         (Incremental_inputs::command_line_key): New function.
9444         (Incremental_inputs::input_file_count): New function.
9445         (Incremental_inputs::input_files): New function.
9446         (Incremental_inputs::relocs_entsize): New function.
9447         (Incremental_inputs::sized_create_inputs_section_data): Remove.
9448         (Incremental_inputs::finalize_inputs): Remove.
9449         (Incremental_inputs::Input_info): Remove.
9450         (Incremental_inputs::lock_): Remove.
9451         (Incremental_inputs::inputs_): Change type.
9452         (Incremental_inputs::inputs_map_): Remove.
9453         (Incremental_inputs::current_object_entry_): New data member.
9454         (Incremental_inputs::inputs_section_): New data member.
9455         (Incremental_inputs::symtab_section_): New data member.
9456         (Incremental_inputs::relocs_section_): New data member.
9457         (Incremental_inputs::reloc_count_): New data member.
9458         (Incremental_inputs_reader): New class.
9459         (Incremental_symtab_reader): New class.
9460         (Incremental_relocs_reader): New class.
9461         * layout.cc (Layout::finalize): Move finalization of incremental info
9462         and creation of incremental info sections to follow finalization of
9463         symbol table.  Set offsets for postprocessing sections.
9464         (Layout::create_incremental_info_sections): Call
9465         Incremental_inputs::create_data_sections.  Add incremental symtab
9466         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
9467         sections to layout after input sections.
9468         * layout.h (struct Timespec): Forward declaration.
9469         (Layout::incremental_inputs): Add const.
9470         (Layout::create_incremental_info_sections): Add parameter.
9471         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
9472         * object.cc: Include incremental.h.
9473         (Relobj::finalize_incremental_relocs): New function.
9474         (Sized_relobj::do_layout): Record input sections in incremental info.
9475         * object.h (Object::output_section): New function.
9476         (Object::output_section_offset): Moved from Relobj.
9477         (Object::get_incremental_reloc_base): New function.
9478         (Object::get_incremental_reloc_count): New function.
9479         (Object::do_output_section): New function.
9480         (Object::do_output_section_offset): Moved from Relobj.
9481         (Object::do_get_incremental_reloc_base): New function.
9482         (Object::do_get_incremental_reloc_count): New function.
9483         (Object::Object): Initialize new data members.
9484         (Relobj::output_section): Renamed do_output_section and moved to
9485         protected.
9486         (Relobj::output_section_offset): Moved to Object.
9487         (Relobj::do_get_incremental_reloc_base): New function.
9488         (Relobj::do_get_incremental_reloc_count): New function.
9489         (Relobj::allocate_incremental_reloc_counts): New function.
9490         (Relobj::count_incremental_reloc): New function.
9491         (Relobj::finalize_incremental_relocs): New function.
9492         (Relobj::next_incremental_reloc_index): New function.
9493         (Relobj::reloc_counts_): New data member.
9494         (Relobj::reloc_bases_): New data member.
9495         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
9496         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
9497         (Sized_relobj::incremental_relocs_scan): New function.
9498         (Sized_relobj::incremental_relocs_scan_reltype): New function.
9499         (Sized_relobj::incremental_relocs_write): New function.
9500         (Sized_relobj::incremental_relocs_write_reltype): New function.
9501         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
9502         incremental link.
9503         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
9504         archives and object files elsewhere.
9505         (Add_symbols::run): Report object files here.
9506         (Finish_group::run): Report end of archive at end of group.
9507         * reloc.cc: Include layout.h, incremental.h.
9508         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
9509         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
9510         (Sized_relobj::incremental_relocs_scan): New function.
9511         (Sized_relobj::incremental_relocs_scan_reltype): New function.
9512         (Sized_relobj::do_relocate_sections): Write incremental relocations.
9513         (Sized_relobj::incremental_relocs_write): New function.
9514         (Sized_relobj::incremental_relocs_write_reltype): New function.
9515         * script.cc (read_input_script): Rewrite test for incremental link.
9516         Change call to Incremental_inputs::report_script.
9517         * symtab.h (Symbol_table::first_global_index): New function.
9518         (Symbol_table::output_count): New function.
9519
9520 2010-08-12  Doug Kwan  <dougkwan@google.com>
9521
9522         * arm.cc (Target_arm::merge_object_attributes): Check command line
9523         options --no-wchar-size-warning and --no-enum-size-warning.
9524         * options.h (General_options): Add ld-compatible options
9525         --no-enum-size-warning and --no-wchar-size-warning.
9526
9527 2010-08-04  Ian Lance Taylor  <iant@google.com>
9528
9529         * x86_64.cc (Target_x86_64::Scan::local): Use
9530         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
9531         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
9532         (Target_x86_64::Scan::global): Likewise.
9533         (Target_x86_64::Relocate::relocate): Likewise.
9534         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
9535         Likewise.
9536
9537 2010-08-03  Cary Coutant  <ccoutant@google.com>
9538
9539         * merge.cc (Output_merge_string::do_add_input_section): Count strings
9540         to reserve space in merged_strings vector. Keep total input size
9541         for stats.
9542         (Output_merge_string::do_print_merge_stats): Print total input size.
9543         * merge.h (Output_merge_string): Add input_size_ field.
9544         * stringpool.cc (Stringpool_template::string_length): Move
9545         implementations out of Stringpool_template class and place in
9546         stringpool.h.
9547         * stringpool.h (string_length): Move out of Stringpool_template.
9548
9549 2010-08-03  Ian Lance Taylor  <iant@google.com>
9550
9551         PR 11712
9552         * layout.cc (relaxation_loop_body): If address of load segment is
9553         set, adjust address to include headers if possible.
9554
9555 2010-08-03  Ian Lance Taylor  <iant@google.com>
9556
9557         * version.cc (version_string): Bump to 1.10.
9558
9559 2010-08-03  Ian Lance Taylor  <iant@google.com>
9560
9561         PR 11805
9562         * layout.h (enum Output_section_order): Define.
9563         (class Layout): Update declarations.
9564         * layout.cc (Layout::get_output_section): Add order parameter.
9565         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
9566         is_first_non_relro parameters.  Change all callers.
9567         (Layout::choose_output_section): Likewise.
9568         (Layout::add_output_section_data): Likewise.
9569         (Layout::make_output_section): Likewise.  Set order.
9570         (Layout::default_section_order): New function.
9571         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
9572         * output.cc (Output_section::Output_section): Initialize order_.
9573         Don't initialize deleted fields.
9574         (Output_segment::Output_segment): Don't initialize deleted
9575         fields.
9576         (Output_segment::add_output_section_to_load): New function
9577         replacing add_output_section.  Change all callers to call this or
9578         add_output_section_to_nonload.
9579         (Output_segment::add_output_section_to_nonload): New function.
9580         (Output_segment::remove_output_section): Rewrite.
9581         (Output_segment::add_initial_output_data): Likewise.
9582         (Output_segment::has_any_data_sections): Likewise.
9583         (Output_segment::is_first_section_relro): Likewise.
9584         (Output_segment::maximum_alignment): Likewise.
9585         (Output_segment::has_dynamic_reloc): New function replacing
9586         dynamic_reloc_count.  Change all callers.
9587         (Output_segment::has_dynamic_reloc_list): New function replacing
9588         dynamic_reloc_count_list.  Change all callers.
9589         (Output_segment::set_section_addresses): Rewrite.
9590         (Output_segment::set_offset): Rewrite.
9591         (Output_segment::find_first_and_last_list): Remove.
9592         (Output_segment::set_tls_offsets): Rewrite.
9593         (Output_segment::first_section_load_address): Likewise.
9594         (Output_segment::output_section_count): Likewise.
9595         (Output_segment::section_with_lowest_load_address): Likewise.
9596         (Output_segment::write_section_headers): Likewise.
9597         (Output_segment::print_sections_to_map): Likewise.
9598         * output.h (class Output_data): Remove dynamic_reloc_count_
9599         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
9600         (Output_data::add_dynamic_reloc): Rewrite.
9601         (Output_data::has_dynamic_reloc): New function.
9602         (Output_data::dynamic_reloc_count): Remove.
9603         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
9604         is_last_relro_, is_first_non_relro_, is_interp_,
9605         is_dynamic_linker_section_ fields.  Add order and set_order
9606         functions.  Remove is_relro_local, set_is_relro_local,
9607         is_last_relro, set_is_last_relro, is_first_non_relro,
9608         set_is_first_non_relro functions, is_interp, set_is_interp,
9609         is_dynamic_linker_section, and set_is_dynamic_linker_section
9610         functions.
9611         (class Output_segment): Change Output_data_list from std::list to
9612         std:;vector.  Add output_lists_ field.  Remove output_data_ and
9613         output_bss_ fields.  Update declarations.
9614
9615 2010-08-02  Ian Lance Taylor  <iant@google.com>
9616
9617         * arm.cc (Target_arm::gc_process_relocs): Use typename.
9618         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
9619         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
9620
9621 2010-08-02  Ian Lance Taylor  <iant@google.com>
9622
9623         PR 11855
9624         * script.cc (Script_options::Script_options): Initialize
9625         symbol_definitions_ and symbol_references_.
9626         (Script_options::add_symbol_assignment): Update
9627         symbol_definitions_ and symbol_references_.
9628         (Script_options::add_symbol_reference): New function.
9629         (script_symbol): New function.
9630         * script.h (class Script_options): Add symbol_definitions_ and
9631         symbol_references_ fields.
9632         (Script_options::referenced_const_iterator): New type.
9633         (Script_options::referenced_begin): New function.
9634         (Script_options::referenced_end): New function.
9635         (Script_options::is_referenced): New function.
9636         (Script_options::any_unreferenced): New function.
9637         * script-c.h (script_symbol): Declare.
9638         * yyscript.y (exp): Call script_symbol.
9639         * symtab.cc: Include "script.h".
9640         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
9641         Change all callers.  Check symbols referenced by scripts.
9642         (Symbol_table::add_undefined_symbols_from_command_line): Add
9643         layout parameter.  Change all callers.
9644         (Symbol_table::do_add_undefined_symbols_from_command_line):
9645         Likewise.  Break out loop body.  Check symbols referenced by
9646         scripts.
9647         (Symbol_table::add_undefined_symbol_from_command_line): New
9648         function broken out of
9649         do_add_undefined_symbols_from_command_line.
9650         * symtab.h (class Symbol_table): Update declarations.
9651         * archive.cc: Include "layout.h".
9652         (Archive::should_include_member): Add layout parameter.  Change
9653         all callers.  Check for symbol mentioned in expression.
9654         * archive.h (class Archive): Update declaration.
9655         * object.cc (Sized_relobj::do_should_include_member): Add layout
9656         parameter.
9657         * object.h (Object::should_include_member): Add layout parameter.
9658         Change all callers.
9659         (Object::do_should_include_member): Add layout parameter.
9660         (class Sized_relobj): Update declaration.
9661         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
9662         parameter.
9663         * dynobj.h (class Sized_dynobj): Update declaration.
9664         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
9665         layout parameter.
9666         * plugin.h (class Sized_pluginobj): Update declaration.
9667
9668 2010-08-02  Ian Lance Taylor  <iant@google.com>
9669
9670         PR 11866
9671         * output.cc (Output_segment::set_offset): Search for the first and
9672         last sections rather than assuming that the list is in order.
9673         (Output_segment::find_first_and_last_list): New function.
9674         * output.h (class Output_segment): Update declarations.
9675         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
9676         (relro_strip_test_SOURCES): New variable.
9677         (relro_strip_test_DEPENDENCIES): New variable.
9678         (relro_strip_test_LDFLAGS): New variable.
9679         (relro_strip_test_LDADD): New variable.
9680         (relro_strip_test.so): New target.
9681
9682 2010-08-02  Ian Lance Taylor  <iant@google.com>
9683
9684         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
9685         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
9686         (Target_i386::got_tlsdesc_section): New function.
9687         (Target_i386::got_section): Create space for GOT entries for
9688         TLSDESC relocations.
9689         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
9690         R_386_TLS_GOTDESC.
9691         (Target_i386::Scan::global): Likewise.
9692         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
9693         using TLSDESC GOT.
9694         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
9695         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
9696         (Target_x86_64::got_tlsdesc_section): New function.
9697         (Target_x86_64::got_section): Create space for GOT entries for
9698         TLSDESC relocations.
9699         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
9700         R_386_TLS_GOTDESC.
9701         (Target_x86_64::Scan::global): Likewise.
9702         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
9703         using TLSDESC GOT.
9704
9705 2010-08-02  Ian Lance Taylor  <iant@google.com>
9706
9707         * testsuite/final_layout.sh: Use dc to convert from hex to
9708         decimal.
9709
9710 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
9711
9712         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
9713         paramter to the call to gold::gc_process_relocs.
9714         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
9715         paramter to the call to gold::gc_process_relocs.
9716         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
9717         parameter to the call to gold::gc_process_relocs.
9718         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
9719         template parameter to the call to gold::gc_process_relocs.
9720         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
9721         paramter to the call to gold::gc_process_relocs.
9722         * gc.h (get_embedded_addend_size): New function.
9723         (gc_process_relocs): Save the size of the reloc for use by ICF.
9724         * icf.cc (get_section_contents): Get the addend from the text section
9725         for SHT_REL relocation sections.
9726         * icf.h (Icf::Reloc_addend_size_info): New typedef.
9727         (Icf::Reloc_info): Add new member reloc_addend_size_info.
9728         * int_encoding.h (read_from_pointer): New overloaded function.
9729         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
9730         * testsuite/icf_sht_rel_addend_test.sh: New file.
9731         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
9732         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
9733
9734 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9735
9736         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
9737         * Makefile.in: Regenerate.
9738         * testsuite/Makefile.in: Regenerate.
9739
9740 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
9741
9742         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
9743         * gold/testsuite/debug_msg.cc: Likewise.
9744         * gold/testsuite/odr_violation1.cc
9745         * gold/testsuite/odr_violation2.cc
9746
9747 2010-07-21  Cary Coutant  <ccoutant@google.com>
9748
9749         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
9750         string, and length fields.
9751         (Output_merge_string::Merged_strings_list): New type.
9752         (Output_merge_string::Merged_strings_lists): New typedef.
9753         (Output_merge_string): Replace merged_strings_ with
9754         merged_strings_lists_.
9755         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
9756         Merged_strings_list per input object and section.  Don't store pointer
9757         to the string.  Don't store length with each merged string entry.
9758         (Output_merge_string::finalize_merged_data): Loop over list of merged
9759         strings lists.  Recompute length of each merged string.
9760
9761 2010-07-15  Cary Coutant  <ccoutant@google.com>
9762
9763         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
9764         here.
9765
9766 2010-07-14  Ian Lance Taylor  <iant@google.com>
9767
9768         * descriptors.cc (Descriptors::open): Report correct name in error
9769         message.
9770
9771 2010-07-13  Doug Kwan  <dougkwan@google.com>
9772
9773         * arm.cc (Arm_input_section::Arm_input_section): For a
9774         SHT_ARM_EXIDX section, always keeps the input sections.
9775         (Arm_input_section::set_exidx_section_link): New method.
9776         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
9777         has_errors_ to false.
9778         (Arm_exidx_input_section::has_errors,
9779         Arm_exidx_input_section::set_has_errors): New methods.
9780         (Arm_exidx_input_section::has_errors_): New data member.
9781         (Arm_relobj::get_exidx_shndx_list): New method.
9782         (Arm_output_section::append_text_sections_to_list): Do not skip
9783         section without SHF_EXECINSTR.
9784         (Arm_output_section::fix_exidx_coverage): Skip input sections with
9785         errors.
9786         (Arm_relobj::make_exidx_input_section): Add new parameter for text
9787         section header.  Make error messages more verbose.  Check for
9788         a non-executable section linked to an EXIDX section.
9789         (Arm_relobj::do_read_symbols): Remove error checking, which has been
9790         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
9791         check that there is no deferred EXIDX section if we exit early.
9792         Instead of not making an EXIDX section in case of an error, make one
9793         and set the has_errors flag of it.
9794         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
9795         in a relocatable link.
9796         (Target_arm::do_relax): Look for the EXIDX output section instead of
9797         assuming that it is called .ARM.exidx.
9798         (Target_arm::fix_exidx_coverage): Add a new parameter for input
9799         section list.  Do not check for SHF_EXECINSTR section flags but
9800         skip any input section with errors.
9801         * output.cc (Output_section::Output_section): Initialize
9802         always_keeps_input_sections_ to false.
9803         (Output_section::add_input_section): Check for
9804         always_keeps_input_sections_.
9805         *  output.h (Output_section::always_keeps_input_sections,
9806         Output_section::set_always_keeps_input_sections): New methods.
9807         (Output_section::always_keeps_input_sections): New data member.
9808
9809 2010-07-13  Rafael Espindola  <espindola@google.com>
9810
9811         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
9812         * fileread.h (Input_file): Add try_extra_search_path and find_file.
9813
9814 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
9815             Ian Lance Taylor  <iant@google.com>
9816
9817         * output.h (Output_section_lookup_maps::add_merge_section):
9818         Correct check of whether value was inserted.
9819         (Output_section_lookup_maps::add_merge_input_section): Likewise.
9820         (Output_section_lookup_maps::add_relaxed_input_section):
9821         Likewise.
9822         * arm.cc (Target_arm::got_section): Remove used local os.
9823         * i386.cc (Target_i386::got_section): Likewise.
9824         * x86_64.cc (Target_x86_64::got_section): Likewise.
9825         * sparc.cc (Target_sparc::got_section): Likewise.
9826         (Target_sparc::relocate): Remove unused local have_got_offset.
9827         * powerpc.cc (Target_powerpc::relocate): Likewise.
9828
9829 2010-07-13  Ian Lance Taylor  <iant@google.com>
9830
9831         * compressed_output.cc (zlib_decompress): Fix signature in
9832         !HAVE_ZLIB_H case.
9833
9834         * archive.cc (Archive::include_member): Unlock an external member
9835         of a thin archive.  Don't bother to delete an object we know is
9836         NULL.
9837
9838 2010-07-12  Cary Coutant  <ccoutant@google.com>
9839
9840         * compressed_output.cc (zlib_decompress): New function.
9841         (get_uncompressed_size): New function.
9842         (decompress_input_section): New function.
9843         * compressed_output.h (get_uncompressed_size): New function.
9844         (decompress_input_section): New function.
9845         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
9846         Handle compressed debug sections.
9847         * layout.cc (is_compressed_debug_section): New function.
9848         (Layout::output_section_name): Map compressed section names to
9849         canonical names.
9850         * layout.h (is_compressed_debug_section): New function.
9851         (is_debug_info_section): Recognize compressed debug sections.
9852         * merge.cc: Include compressed_output.h.
9853         (Output_merge_data::do_add_input_section): Handle compressed
9854         debug sections.
9855         (Output_merge_string::do_add_input_section): Handle compressed
9856         debug sections.
9857         * object.cc: Include compressed_output.h.
9858         (Sized_relobj::Sized_relobj): Initialize new data members.
9859         (build_compressed_section_map): New function.
9860         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
9861         * object.h (Object::section_is_compressed): New method.
9862         (Object::do_section_is_compressed): New method.
9863         (Sized_relobj::Compressed_section_map): New type.
9864         (Sized_relobj::do_section_is_compressed): New method.
9865         (Sized_relobj::compressed_sections_): New data member.
9866         * output.cc (Output_section::add_input_section): Handle compressed
9867         debug sections.
9868         * reloc.cc: Include compressed_output.h.
9869         (Sized_relobj::write_sections): Handle compressed debug sections.
9870
9871 2010-07-08  Cary Coutant  <ccoutant@google.com>
9872
9873         * resolve.cc (Symbol_table::resolve): Remember whether undef was
9874         weak when resolving to a dynamic def.
9875         (Symbol_table::should_override): Add adjust_dyndef flag; set it
9876         for weak undef/dynamic def cases. Adjust callers.
9877         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
9878         undef_binding_weak_.
9879         (Symbol_table::sized_write_globals): Adjust symbol binding.
9880         (Symbol_table::sized_write_symbol): Add binding parameter.
9881         * symtab.h (Symbol::set_undef_binding): New method.
9882         (Symbol::is_undef_binding_weak): New method.
9883         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
9884         (Symbol_table::should_override): Add new parameter.
9885         (Symbol_table::sized_write_symbol): Add new parameter.
9886
9887         * testsuite/weak_undef_file1.cc: Add new test case.
9888         * testsuite/weak_undef_file2.cc: Fix header comment.
9889         * testsuite/weak_undef_test.cc: Add new test case.
9890
9891 2010-06-29  Doug Kwan  <dougkwan@google.com>
9892
9893         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
9894         Initialize USE_SYMBOL_.
9895         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
9896         definition.
9897         (Arm_reloc_property::uses_symbol_): New data member declaration.
9898         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
9899         uses symbol value and symbol is undefined but not weakly undefined.
9900
9901 2010-06-28  Rafael Espindola  <espindola@google.com>
9902
9903         * plugin.cc (Plugin::load): Use dlerror.
9904
9905 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
9906
9907         * symtab.cc (detect_odr_violations): When reporting an ODR
9908         violation, report an object where the symbol is defined.
9909
9910 2010-06-25  Doug Kwan  <dougkwan@google.com>
9911
9912         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
9913         (Target_arm::section_may_have_icf_unsafe_pointers): New method
9914         definition.
9915         (Target_arm::Scan::local_reloc_may_be_function_pointer,
9916         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
9917         target hook to detect function points.
9918         (Target_arm::Scan::possible_function_pointer_reloc): New method.
9919         * icf.h (Icf::check_section_for_function_pointers): Change type of
9920         parameter SECTION_NAME to const reference to std::string.  Use
9921         target hook to determine if section may have unsafe pointers.
9922         * target.h (Target::section_may_have_icf_unsafe_pointers): New
9923         method definition.
9924
9925 2010-06-21  Rafael Espindola  <espindola@google.com>
9926
9927         * fileread.cc (Input_file::find_fie): New
9928         (Input_file::open): Use Input_file::find_fie.
9929         * fileread.h (Input_file::find_fie): New
9930         * plugin.cc (set_extra_library_path): New.
9931         (Plugin::load): Add set_extra_library_path to the transfer vector.
9932         (Plugin_manager::set_extra_library_path): New.
9933         (Plugin_manager::add_input_file): Use the extra search path if set.
9934         (set_extra_library_path(): New.
9935         * plugin.h (Plugin_manager): Add set_extra_library_path and
9936         extra_search_path_.
9937
9938 2010-06-19  Cary Coutant  <ccoutant@google.com>
9939
9940         * layout.cc (gdb_sections): Add .debug_types.
9941         (lines_only_debug_sections): Likewise.
9942
9943 2010-06-18  Rafael Espindola  <espindola@google.com>
9944
9945         * plugin.cc (add_input_file,add_input_library)
9946         (Plugin_manager::add_input_file): Make filename arguments const.
9947         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
9948         const.
9949
9950 2010-06-16  Doug Kwan  <dougkwan@google.com>
9951
9952         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
9953         .ARM.attributes section if we have not merged any input
9954         attributes sections.
9955
9956 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9957
9958         * arm.cc: Allow combining objects with no EABI version
9959         information.
9960
9961 2010-06-15  Rafael Espindola  <espindola@google.com>
9962
9963         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
9964
9965 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9966
9967         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
9968         (struct iovec): Correct !HAVE_READV definition.
9969
9970 2010-06-10  Cary Coutant  <ccoutant@google.com>
9971
9972         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
9973         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
9974         reloc sections.
9975         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
9976
9977         PR 11683
9978         * symtab.h (Symbol::is_placeholder): New member function.
9979         * target-reloc.h (relocate_section): Check for placeholder symbols.
9980
9981         * testsuite/Makefile.am (plugin_test_8): New test.
9982         (plugin_test_9): New test.
9983         * testsuite/Makefile.in: Regenerate.
9984
9985 2010-06-09  Nick Clifton  <nickc@redhat.com>
9986
9987         * yyscript.y (input_list_element): Allow strings prefixed with
9988         the '-' character.  Treat these as libraries.
9989         * script.cc (script_add_library): New function.  Adds a library
9990         specified by "-l<name>" found in an input script.
9991         * script-c.h: Add prototype for script_add_library.
9992
9993 2010-06-07  Doug Kwan  <dougkwan@google.com>
9994
9995         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
9996         Restrict stub-group size to be within long conditional branch
9997         range when working around cortex-A8 erratum.
9998
9999 2010-06-07  Damien Diederen  <dd@crosstwine.com>
10000
10001         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
10002         #ifdef typo.
10003
10004 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
10005
10006         PR gold/11658
10007         * output.cc
10008         (Output_section::Input_section_sort_entry::compare_section_ordering):
10009         Change to return non-zero correctly.
10010         (Output_section::Input_section_sort_section_order_index_compare
10011         ::operator()): Change to fix ambiguity in comparisons.
10012
10013 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
10014
10015         * gold.h (is_wildcard_string): New function.
10016         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
10017         (Layout::layout_eh_frame): Ditto.
10018         (Layout::find_section_order_index): New method.
10019         (Layout::read_layout_from_file): New method.
10020         * layout.h (Layout::find_section_order_index): New method.
10021         (Layout::read_layout_from_file): New method.
10022         (Layout::input_section_position_): New private member.
10023         (Layout::input_section_glob_): New private member.
10024         * main.cc (main): Call read_layout_from_file here.
10025         * options.h (--section-ordering-file): New option.
10026         * output.cc (Output_section::input_section_order_specified_): New
10027         member.
10028         (Output_section::Output_section): Initialize new member.
10029         (Output_section::add_input_section): Add new parameter.
10030         Keep input sections when --section-ordering-file is used.
10031         (Output_section::set_final_data_size): Sort input sections when
10032         section ordering file is specified.
10033         (Output_section::Input_section_sort_entry): Add new parameter.
10034         Check sorting type.
10035         (Output_section::Input_section_sort_entry::compare_section_ordering):
10036         New method.
10037         (Output_section::Input_section_sort_compare::operator()): Change to
10038         consider section_order_index.
10039         (Output_section::Input_section_sort_init_fini_compare::operator()):
10040         Change to consider section_order_index.
10041         (Output_section::Input_section_sort_section_order_index_compare
10042         ::operator()): New method.
10043         (Output_section::sort_attached_input_sections): Change to sort
10044         according to section order when specified.
10045         (Output_section::add_input_section<32, true>): Add new parameter.
10046         (Output_section::add_input_section<64, true>): Add new parameter.
10047         (Output_section::add_input_section<32, false>): Add new parameter.
10048         (Output_section::add_input_section<64, false>): Add new parameter.
10049         * output.h (Output_section::add_input_section): Add new parameter.
10050         (Output_section::input_section_order_specified): New
10051         method.
10052         (Output_section::set_input_section_order_specified): New method.
10053         (Input_section::Input_section): Initialize section_order_index_.
10054         (Input_section::section_order_index): New method.
10055         (Input_section::set_section_order_index): New method.
10056         (Input_section::section_order_index_): New member.
10057         (Input_section::Input_section_sort_section_order_index_compare): New
10058         struct.
10059         (Output_section::input_section_order_specified_): New member.
10060         * script-sections.cc (is_wildcard_string): Delete and move modified
10061         method to gold.h.
10062         (Output_section_element_input::Output_section_element_input): Modify
10063         call to is_wildcard_string.
10064         (Output_section_element_input::Input_section_pattern
10065         ::Input_section_pattern): Ditto.
10066         (Output_section_element_input::Output_section_element_input): Ditto.
10067         * testsuite/Makefile.am (final_layout): New test case.
10068         * testsuite/Makefile.in: Regenerate.
10069         * testsuite/final_layout.cc: New file.
10070         * testsuite/final_layout.sh: New file.
10071
10072 2010-06-01  Rafael Espindola  <espindola@google.com>
10073
10074         * plugin.cc (Plugin::load): Pass the output name to the plugin.
10075
10076 2010-06-01  Rafael Espindola  <espindola@google.com>
10077
10078         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
10079         visibility of symbols.
10080
10081 2010-05-27  Doug Kwan  <dougkwan@google.com>
10082
10083         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
10084         from start of output section instead of address for a local symbol
10085         in a merged or relaxed section when doing a relocatable link.
10086
10087 2010-05-26  Rafael Espindola  <espindola@google.com>
10088
10089         PR 11604
10090         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
10091         adding sections the garbage collector removed.
10092         * gold/testsuite/Makefile.am: Add test.
10093         * gold/testsuite/Makefile.in: Regenerate.
10094         * gold/testsuite/plugin_test_7.sh: New.
10095         * gold/testsuite/plugin_test_7_1.c: New.
10096         * gold/testsuite/plugin_test_7_2.c: New.
10097
10098 2010-05-26  Rafael Espindola  <espindola@google.com>
10099
10100         * script-sections.cc (Output_section_definition::set_section_addresses):
10101         Check for --section-start.
10102
10103 2010-05-26  Doug Kwan  <dougkwan@google.com>
10104
10105         * arm.cc (Arm_scan_relocatable_relocs): New class.
10106         (Target_arm::relocate_special_relocatable): New method.
10107         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
10108         (Arm_relocate_functions::thumb_branch_common): Same.
10109         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
10110         instead of Default_scan_relocatable_relocs.
10111         * target-reloc.h (relocate_for_relocatable): Let target handle
10112         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
10113         * target.h (Sized_target::relocate_special_relocatable): New method.
10114
10115 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10116
10117         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
10118
10119 2010-05-23  Doug Kwan  <dougkwan@google.com>
10120
10121         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
10122         instead of a cast.
10123         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
10124         with a direct branch, not a conditional branch, to a stub.
10125         * merge.cc (Output_merge_base::record_input_section): New method
10126         defintion.
10127         (Output_merge_data::do_add_input_section): Record input section if
10128         keeps-input-sections flag is set.
10129         (Output_merge_string::do_add_input_section): Ditto.
10130         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
10131         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
10132         INPUT_SECTIONS_.
10133         (Output_merge_base::keeps_input_sections,
10134         Output_merge_base::set_keeps_input_sections,
10135         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
10136         method definitions.
10137         (Output_merge_base::Input_sections): New type declaration.
10138         (Output_merge_base::input_sections_begin,
10139         Output_merge_base::input_sections_end,
10140         Output_merge_base::do_set_keeps_input_sections): New method definitions.
10141         (Output_merge_base::bool keeps_input_sections_,
10142         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
10143         Output_merge_base::input_sections_): New data members.
10144         (Output_merge_data::do_set_keeps_input_sections): New method
10145         defintion.
10146         (Output_merge_string::do_set_keeps_input_sections): Ditto.
10147         * output.cc (Output_section::Input_section::relobj): Move method
10148         defintion from class declaration to here and handle merge sections.
10149         (Output_section::Input_section::shndx): Ditto.
10150         (Output_section::Output_section): Remove initializations of removed
10151         data members and initialize new data member LOOKUP_MAPS_.
10152         (Output_section::add_input_section): Set keeps-input-sections flag
10153         for a newly created merge output section as appropriate.  Adjust code
10154         to use Output_section_lookup_maps class.
10155         (Output_section::add_relaxed_input_section): Adjst code for lookup
10156         maps code refactoring.
10157         (Output_section::add_merge_input_section): Add a new parameter
10158         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
10159         class.  If adding input section to a newly created merge output
10160         section fails, remove the new merge section.
10161         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
10162         Adjust code for use of the Output_section_lookup_maps class.
10163         (Output_section::find_merge_section): Ditto.
10164         (Output_section::build_lookup_maps): New method defintion.
10165         (Output_section::find_relaxed_input_section): Adjust code to use
10166         Output_section_lookup_maps class.
10167         (Output_section::get_input_sections): Export merge sections.  Adjust
10168         code to use Output_section_lookup_maps class.
10169         (Output_section:::add_script_input_section): Adjust code to use
10170         Output_section_lookup_maps class.  Update lookup maps for merge
10171         sections also.
10172         (Output_section::discard_states): Use Output_section_lookup_maps.
10173         (Output_section::restore_states): Same.
10174         * output.h (Merge_section_properties): Move class defintion out of
10175         Output_section.
10176         (Output_section_lookup_maps): New class.
10177         (Output_section::Input_section::is_merge_section): New method
10178         defintion.
10179         (Output_section::Input_section::relobj): Move defintion out of class
10180         defintion.  Declare method only.
10181         (Output_section::Input_section::shndx): Ditto.
10182         (Output_section::Input_section::output_merge_base): New method defintion.
10183         (Output_section::Input_section::u2_.pomb): New union field.
10184         (Output_section::Merge_section_by_properties_map,
10185         Output_section::Output_section_data_by_input_section_map,
10186         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
10187         Remove types.
10188         (Output_section::add_merge_input_section): Add new parameter
10189         KEEPS_INPUT_SECTIONS.
10190         (Output_section::build_lookup_maps): New method declaration.
10191         (Output_section::merge_section_map_,
10192         Output_section::merge_section_by_properties_map_,
10193         Output_section::relaxed_input_section_map_,
10194         Output_section::is_relaxed_input_section_map_valid_): Remove data
10195         members.
10196         (Output_section::lookup_maps_): New data member.
10197
10198 2010-05-21  Doug Kwan  <dougkwan@google.com>
10199
10200         PR gold/11619
10201         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
10202         avoid a compilation error.
10203
10204 2010-05-19  Rafael Espindola  <espindola@google.com>
10205
10206         * script-sections.cc (Output_section_definition::allocate_to_segment):
10207         Update the phdrs_list even when the output section is NULL.
10208         * testsuite/Makefile.am: Add test.
10209         * testsuite/Makefile.in: Regenerate.
10210         * testsuite/script_test_9.cc: New.
10211         * testsuite/script_test_9.sh: New.
10212         * testsuite/script_test_9.t: New.
10213
10214 2010-05-19  Doug Kwan  <dougkwan@google.com>
10215
10216         * arm.cc (Arm_input_section::original_size): New method.
10217         (Arm_input_section::do_addralign): Add a cast.
10218         (Arm_input_section::do_output_offset): Remove static cast.
10219         (Arm_input_section::original_addralign,
10220          Arm_input_section::original_size_): Change type to uint32_t.
10221         (Arm_input_section::init): Add safe casts for section alignment
10222         and size.
10223         (Arm_input_section::set_final_data_size): Do not set address and
10224         offset of stub table.
10225         (Arm_output_section::fix_exidx_coverage): Change use of of
10226         Output_section::Simple_input_section to that of
10227         Output_section::Input_section.
10228         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
10229         except for the first pass.
10230         * output.cc (Output_section::get_input_sections): Change type of
10231         input_sections to std::list<Input_section>.
10232         (Output_section::add_script_input_section): Rename from
10233         Output_section::add_simple_input_section.  Change type of SIS
10234         parameter from Simple_input_section to Input_section.
10235         * output.h (Output_section::Simple_input_section): Remove class.
10236         (Output_section::Input_section): Change class visibility to public.
10237         (Output_section::Input_section::addralign): Use stored alignments
10238         for special input sections if set.
10239         (Output_section::Input_section::set_addralign): New method.
10240         (Output_section::get_input_sections): Change parameter type from
10241         list of Simple_input_section to list of Input_section.
10242         (Output_section::add_script_input_section): Rename from
10243         Output_section::add_simple_input_section. Change first parameter's
10244         type from Simple_input_section to Input_section and remove the
10245         second and third parameters.
10246         * script-sections.cc (Input_section::Input_section_list): Change
10247         type to list of Output_section::Input_section/
10248         (Input_section_info::Input_section_info): Change parameter type of
10249         INPUT_SECTION to Output_section::Input_section.
10250         (Input_section_info::input_section): Change return type.
10251         (Input_section_info::input_section_): Change type to
10252         Output_section::Input_section.
10253         (Output_section_element_input::set_section_addresses): Adjust code
10254         to use Output_section::Input_section instead of
10255         Output_section::Simple_input_section.  Adjust code for renaming
10256         of Output_section::add_simple_input_section.
10257         (Orphan_output_section::set_section_addresses): Ditto.
10258
10259 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10260
10261         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
10262         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
10263
10264 2010-05-18  Rafael Espindola  <espindola@google.com>
10265
10266         * options.cc (General_options::finalize): Handle -nostdlib.
10267         * options.h (nostdlib): New option.
10268         * script.cc (script_add_search_dir): Handle -nostdlib.
10269
10270 2010-05-12  Doug Kwan  <dougkwan@google.com>
10271
10272         * arm.cc (Target_arm::do_finalize_sections): Create an empty
10273         attributes section only if there no attributes section after merging.
10274         (Target_arm::merge_object_attributes): Move value of
10275         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
10276         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
10277         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
10278         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
10279         and arm_attr_merge_7.stdout.
10280         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
10281         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
10282         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
10283         arm_attr_merge_7b.o): New rules.
10284         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
10285         arm_attr_merge_7
10286         * testsuite/Makefile.in: Regenerate.
10287         * testsuite/arm_attr_merge.sh: New file.
10288         * testsuite/arm_attr_merge_[67][ab].s: Same.
10289
10290 2010-05-05  Nick Clifton  <nickc@redhat.com>
10291
10292         * po/es.po: Updated Spanish translation.
10293
10294 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
10295
10296         * Makefile.am (install-exec-local): Properly install gold as
10297         default cross linker.
10298         * Makefile.in: Regenerated.
10299
10300 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
10301             Nick Clifton  <nickc@redhat.com>
10302
10303         * configure.ac (install_as_default): Define and set to false
10304         unless --enable-gold or --enable-gold=both/gold has been
10305         specified.
10306         * configure: Regenerate.
10307
10308         * Makefile.am (install-exec-local): Install the executable as
10309         'ld.gold'.  If install_as_default is true then also install it as
10310         'ld'.
10311         * Makefile.in: Regenerated.
10312
10313 2010-04-24  Ian Lance Taylor  <iant@google.com>
10314
10315         * layout.cc (Layout::layout_reloc): In relocatable link don't
10316         combine reloc sections for grouped sections.
10317
10318 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
10319
10320         * gc.h (gc_process_relocs): Pass information on relocs pointing to
10321         sections that are not ordinary to icf.
10322         * icf.cc (get_section_contents): Handle relocation pointing to section
10323         with no object or shndx information.
10324         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
10325         * testsuite/Makefile.in: Regenerate.
10326         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
10327         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
10328
10329 2010-04-22  Ian Lance Taylor  <iant@google.com>
10330
10331         * expression.cc (Expression::Expression_eval_info): Add
10332         result_alignment_pointer field.
10333         (Expression::eval_with_dot): Add result_alignment_pointer
10334         parameter.  Change all callers.
10335         (Expression::eval_maybe_dot): Likewise.
10336         (class Binary_expression): Add alignment_pointer parameter to
10337         left_value and right_value.  Change all callers.
10338         (BINARY_EXPRESSION): Set result alignment.
10339         (class Trinary_expression): Add alignment_pointer parameter to
10340         arg2_value and arg3_value.  Change all callers.
10341         (Trinary_cond::value): Set result alignment.
10342         (Max_expression::value, Min_expression::value): Likewise.
10343         (Align_expression::value): Likewise.
10344         * script-sections.cc (class Sections_element): Add dot_alignment
10345         parameter to set_section_addresses virtual function.  Update
10346         instantiations.
10347         (class Output_section_element): Likewise.
10348         (Script_sections::create_segments): Add dot_alignment parameter.
10349         Change all callers.
10350         (Script_sections::create_segments_from_phdrs_clause): Likewise.
10351         (Script_sections::set_phdrs_clause_addresses): Likewise.
10352         * script-sections.h: Update declarations.
10353         * script.h: Update declarations.
10354         * output.h (Output_segment::set_minimum_p_align): Don't decrease
10355         min_p_align.
10356         * testsuite/script_test_3.t: Set large alignment.
10357         * testsuite/script_test_3.sh: Make sure that at least one LOAD
10358         segment has expected alignment.
10359
10360 2010-04-22  Nick Clifton  <nickc@redhat.com>
10361
10362         * po/gold.pot: Updated by the Translation project.
10363         * po/vi.po: Updated Vietnamese translation.
10364
10365 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
10366
10367         * testsuite/Makefile.am (check_PROGRAMS): Add
10368         icf_virtual_function_folding_test.
10369         * testsuite/Makefile.in: Regenerated.
10370
10371 2010-04-15  Andrew Haley  <aph@redhat.com>
10372
10373         * options.h (merge_exidx_entries): New option.
10374         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
10375         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
10376         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
10377         (Target_arm::merge_exidx_entries): New function.
10378         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
10379         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
10380         to Arm_exidx_fixup constructor.
10381         Add new arg, merge_exidx_entries.
10382         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
10383         Arm_output_section::fix_exidx_coverage.
10384
10385 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
10386
10387         * icf.cc (get_section_contents): Check for preemptible functions.
10388         Ignore addend when appropriate.
10389         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
10390         section folded.
10391         (add_from_relobj): Check for section folded.
10392         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
10393         * symtab.h (should_add_dynsym_entry): Add new parameter.
10394         * target-reloc.h (scan_relocs): Check for section folded.
10395         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
10396         Check reloc types for function pointers in shared objects.
10397         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
10398         case.
10399         (icf_preemptible_functions_test): New test case.
10400         (icf_string_merge_test): New test case.
10401         * testsuite.Makefile.in: Regenerate.
10402         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
10403         bar_glob.  Refactor code.
10404         * testsuite/icf_preemptible_functions_test.cc: New file.
10405         * testsuite/icf_preemptible_functions_test.sh: New file.
10406         * testsuite/icf_string_merge_test.cc: New file.
10407         * testsuite/icf_string_merge_test.sh: New file.
10408         * testsuite/icf_virtual_function_folding_test.cc: New file.
10409         * testsuite/icf_virtual_function_folding_test.sh: New file.
10410
10411 2010-04-14  Doug Kwan  <dougkwan@google.com>
10412
10413         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
10414         for local symbol recounting if we remove a section due to ICF.
10415         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
10416         there are no regular objects in input.
10417
10418 2010-04-13  Doug Kwan  <dougkwan@google.com>
10419
10420         * arm.cc (Arm_input_section::set_final_data_size): Compute
10421         accurate final data size instead of using current data size.
10422
10423 2010-04-09  Doug Kwan  <dougkwan@google.com>
10424
10425         * layout.cc (Layout::choose_output_section): Handle script section
10426         types.
10427         (Layout::make_output_section_for_script): Add section type parameter.
10428         Handle script section types.
10429         * layout.h (Layout::make_output_section_for_script): Add section
10430         type parameter.
10431         * output.cc (Output_section::Output_section): Initialize data member
10432         is_noload_.
10433         (Output_section::do_reset_address_and_file_offset): Do not set address
10434         to 0 if section is a NOLOAD section.
10435         * output.h (Output_section::is_noload): New method.
10436         (Output_section::set_is_noload): Ditto.
10437         (Output_section::is_noload_): New data member.
10438         * script-c.h (Script_section_type): New enum type.
10439         (struct Parser_output_section_header): Add new file section_type.
10440         * script-sections.cc (Sections_element::output_section_name): Add
10441         parameter for returning script section type.
10442         (Output_section_definition::output_section_name): Ditto.
10443         (Output_section_definition::section_type)P; New method.
10444         (Output_section_definiton::script_section_type_name): Ditto.
10445         (Output_section_definition::script_section_type_): New data member.
10446         (Output_section_definition::Output_section_definition): Initialize
10447         data member Output_section_definition::script_section_type_.
10448         (Output_section_definition::create_sections): Pass script section type
10449         to Layout::make_output_section_for_script.
10450         (Output_section_definition::output_section_name): Return script
10451         section type to caller.
10452         (Output_section_definition::set_section_address): Do not advance
10453         dot value and load address if section type is NOLOAD.  Set address
10454         of NOLOAD sections regardless of section flags.
10455         (Output_section_definition::print): Print section type if it is
10456         not SCRIPT_SECTION_TYPE_NONE.
10457         (Output_section_definition::section_type): New method.
10458         (Output_section_definition::script_section_type_name): Ditto.
10459         (Script_sections::output_section_name): Add new parameter
10460         PSECTION_TYPE for returning script section type.  Pass it to
10461         section elements.  Handle discard sections.
10462         (Sort_output_sections::operator()): Handle NOLOAD sections.
10463         * script-sections.h (Script_sections::Section_type): New enum type.
10464         (Script_sections::output_section_name): Add a new parameter for
10465         returning script section type.
10466         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
10467         INFO and NOLOAD.
10468         * yyscript.y (union): Add new field SECTION_TYPE.
10469         (COPY, DSECT, INFO, NOLOAD): New tokens.
10470         (opt_address_and_section_type): Change type to output_section_header.
10471         (section_type): New non-terminal
10472         (section_header): Handle section type.
10473         (opt_address_and_section_type): Return section type value.
10474
10475 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
10476
10477         * testsuite/plugin_common_test_1.c (foo): Add prototype.
10478         * testsuite/plugin_common_test_2.c (foo): Likewise.
10479
10480 2010-04-08  Doug Kwan  <dougkwan@google.com>
10481
10482         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
10483         Output_merge_data.
10484         * output.cc (Output_section::add_merge_input_section): Simplify
10485         code and return status of Output_merge_base::add_input_section.
10486         Update merge section map only if Output_merge_base::add_input_section
10487         returns true.
10488
10489 2010-04-07  Doug Kwan  <dougkwan@google.com>
10490
10491         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
10492         if section is marked as containing instructions but has no mapping
10493         symbols.
10494         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
10495         correct section index.
10496         (Arm_relobj::find_linked_text_section): Ditto.
10497
10498 2010-04-07  Cary Coutant  <ccoutant@google.com>
10499
10500         * archive.cc (include_member): Destroy Read_symbols_data object before
10501         releasing file.
10502         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
10503         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
10504         (Read_symbols_data::~Read_symbols_data) New destructor.
10505         (Section_relocs::Section_relocs) New constructor.
10506         (Section_relocs::~Section_relocs) New destructor.
10507         (Read_relocs_data::Read_relocs_data) New constructor.
10508         (Read_relocs_data::~Read_relocs_data) New destructor.
10509         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
10510         pointers to NULL after deleting.
10511
10512 2010-04-07  Doug Kwan  <dougkwan@google.com>
10513
10514         * arm.cc: Replace "endianity" with "endianness" in comments.
10515         (Arm_exidx_cantunwind): Ditto.
10516         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
10517         (Arm_relobj::merge_flags_and_attributes): New method.
10518         (Arm_relobj::merge_flags_and_attributes_): New data member.
10519         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
10520         (Arm_relobj::scan_sections_for_stubs): Ditto.
10521         (Arm_relobj::do_read_symbols): Check to see if we really want to
10522         merge processor-specific flags and attributes.  Exit early if
10523         an object is empty except for section names and the undefined symbol.
10524         (Target_arm::do_finalize_sections): Move check for ELF format to
10525         Arm_relobj::do_read_symbols.  Merge processor specific flags and
10526         attributes from a regular object only when we have determined that
10527         it is aapropriate.  Do not create an .ARM.attributes section in
10528         output if there is no regular input object.
10529         (Target_arm::merge_processor_specific_flags): Check
10530         --warn-mismatch before printing any error.
10531         (Target_arm::merge_object_attributes): Ditto.
10532         * gold.cc (queue_middle_tasks): Handle the case in which there is
10533         no regular object in input.
10534         * options.cc (General_options::parse_EB): New method.
10535         (General_options::parse_EL): Same.
10536         (General_options::General_options): Initialize endianness_.
10537         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
10538         New options.
10539         (General_options::Endianness): New enum.
10540         (General_options::endianness): New method.
10541         (General_options::endianness_): New data member.
10542         * parameters.cc (Parameters::set_options): Check target endianness.
10543         (Parameters::set_target_once): Ditto.
10544         (Parameters::check_target_endianness): New method.
10545         (parameters_force_valid_target): If either -EL or -EB is specified,
10546         use it to define endianness of default target.
10547         * parameters.h (Parameters::check_target_endianness): New method
10548         declaration.
10549         * target.h (class Target): Change "endianity" to "endianness"
10550         in comments.
10551
10552 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10553
10554         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
10555         * configure: Regenerate.
10556         * Makefile.in: Regenerate.
10557         * testsuite/Makefile.in: Regenerate.
10558
10559 2010-04-06  Cary Coutant  <ccoutant@google.com>
10560
10561         gcc PR lto/42757
10562         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
10563         prevailing definitions of common symbols.
10564         * testsuite/plugin_test_6.sh: New test case.
10565         * testsuite/plugin_common_test_1.c: New test case.
10566         * testsuite/plugin_common_test_2.c: New test case.
10567         * testsuite/Makefile.am (plugin_test_6): New test case.
10568         * testsuite/Makefile.in: Regenerate.
10569
10570 2010-04-06  Nick Clifton  <nickc@redhat.com>
10571
10572         * po/vi.po: New Vietnamese translation.
10573
10574 2010-03-30  Doug Kwan  <dougkwan@google.com>
10575
10576         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
10577
10578 2010-03-25  Doug Kwan  <dougkwan@google.com>
10579
10580         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
10581         to avoid a conversion warning on a 32-bit host.
10582
10583 2010-03-24  Ian Lance Taylor  <iant@google.com>
10584
10585         * testsuite/script_test_3.t: Add a TLS segment.
10586         * testsuite/Makefile.am (check_PROGRAMS): Add
10587         tls_phdrs_script_test.
10588         (tls_phdrs_script_test_SOURCES): Define.
10589         (tls_phdrs_script_test_DEPENDENCIES): Define.
10590         (tls_phdrs_script_test_LDFLAGS): Define.
10591         (tls_phdrs_script_test_LDADD): Define.
10592         * testsuite/Makefile.in: Rebuild.
10593
10594 2010-03-23  Cary Coutant  <ccoutant@google.com>
10595
10596         * fileread.cc (find_or_make_view): Fix comment.
10597
10598 2010-03-23  Ian Lance Taylor  <iant@google.com>
10599
10600         * script-sections.cc (class Orphan_section_placement): Define
10601         PLACE_TLS and PLACE_TLS_BSS.
10602         (Orphan_section_placement::Orphan_section_placement): Initialize
10603         new places.
10604         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
10605         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
10606         (tls_script_test_SOURCES): Define.
10607         (tls_script_test_DEPENDENCIES): Define.
10608         (tls_script_test_LDFLAGS): Define.
10609         (tls_script_test_LDADD): Define.
10610         * testsuite/Makefile.in: Rebuild.
10611
10612 2010-03-22  Doug Kwan  <dougkwan@google.com>
10613
10614         * arm.cc (Arm_relocate_functions::abs8,
10615         Arm_relocate_functions::abs16): Use correct check for overflow
10616         specified in the ARM ELF specs.
10617         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
10618         target of a BLX instruction specially.
10619         (Reloc_stub::stub_type_for_reloc): Ditto.
10620         (Relocate::relocate): Use symbolic names instead of numeric relocation
10621         codes to report error.
10622         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
10623         workaround.
10624         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
10625         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
10626         thumb2_blx_out_of_range.stdout
10627         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
10628         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
10629         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
10630         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
10631         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
10632         thumb2_blx_in_range, thumb2_blx_in_range.o,
10633         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
10634         thumb2_blx_out_of_range.o): New rules.
10635         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
10636         thumb2_blx_in_range and thumb2_blx_out_of_range.
10637         * testsuite/Makefile.in: Regenerate.
10638         * arm_branch_in_range.sh: Add tests for THUMB BLX.
10639         * testsuite/thumb_blx_in_range.s: New file.
10640         * testsuite/thumb_blx_out_of_range.s: New file.
10641
10642 2010-03-22  Rafael Espindola  <espindola@google.com>
10643
10644         * archive.cc (Should_include): Move to archive.h.
10645         (should_include_member): Make it a member of Archive.
10646         (Lib_group): New.
10647         (Add_lib_group_symbols): New.
10648         * archive.h: Include options.h.
10649         (Archive_member): Moved from Archive.
10650         (Should_include): Moved from archive.cc.
10651         (Lib_group): New.
10652         (Add_lib_group_symbols): New.
10653         * dynobj.cc (do_should_include_member): New.
10654         * dynobj.h (do_should_include_member): New.
10655         * gold.cc (queue_initial_tasks): Update call to queue.
10656         * main.cc (main): Print lib group stats.
10657         * object.cc (do_should_include_member): New.
10658         * object.h: Include archive.h.
10659         (Object::should_include_member): New.
10660         (Object::do_should_include_member): New.
10661         (Sized_relobj::do_should_include_member): New.
10662         * options.cc (General_options::parse_start_lib): New.
10663         (General_options::parse_end_lib): New.
10664         (Input_arguments::add_file): Handle lib groups.
10665         (Input_arguments::start_group): Check we are not in a lib.
10666         (Input_arguments::start_lib): New.
10667         (Input_arguments::end_lib): New.
10668         * options.h (General_options): Add start_lib and end_lib.
10669         (Input_argument::lib_): New.
10670         (Input_argument::lib): New.
10671         (Input_argument::is_lib): New.
10672         (Input_file_lib): New.
10673         (Input_arguments::in_lib_): New.
10674         (Input_arguments::in_lib): New.
10675         (Input_arguments::start_lib): New.
10676         (Input_arguments::end_lib_): New.
10677         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
10678         in unused members as preempted.
10679         (Sized_pluginobj::do_should_include_member): New.
10680         * plugin.h (Sized_pluginobj::do_should_include_member): New.
10681         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
10682         return the blocker.
10683         (Read_symbols::do_whole_lib_group): New.
10684         (Read_symbols::do_lib_group): New.
10685         (Read_symbols::do_read_symbols): Handle lib groups.
10686         (Read_symbols::get_name): Handle lib groups.
10687         * readsyms.h (Read_symbols): Add an archive member pointer.
10688         (Read_symbols::do_whole_lib_group): New.
10689         (Read_symbols::do_lib_group): New.
10690         (Read_symbols::member_): New.
10691         * script.cc (read_input_script): Update call to queue_soon.
10692
10693 2010-03-19  Doug Kwan  <dougkwan@google.com>
10694
10695         * arm.cc (Stub_table::Stub_table): Initialize new data members
10696         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10697         (Stub_table::add_reloc_stub): Assign stub offset and update
10698         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10699         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
10700         New data members.
10701         (Stub_table::update_data_size_and_addralign): Use
10702         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
10703         instead of going over all reloc stubs.
10704         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
10705         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10706         Stringpool_template::offset_ to size of Stringpool_char.
10707         (Stringpool_template::new_key_offset): Remove code to initialize
10708         Stringpool_template::offset_.
10709         * stringpool.h (Stringpool_template::set_no_zero_null): Set
10710         Stringpool_template::offset_ to zero.
10711
10712 2010-03-15  Doug Kwan  <dougkwan@google.com>
10713
10714         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10715         offset_.
10716         (Stringpool_template::new_key_offset): New method.
10717         (Stringpool_template::add_string): Assign offsets when adding new
10718         strings.
10719         (Stringpool_template::set_string_offsets): Do not set string offsets
10720         when not optimizing.
10721         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
10722         member size_.
10723         (Chunked_vector::clear): Clear size_.
10724         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
10725         (Chunked_vector::size): Return size_.
10726         (Chunked_vector::push_back): Use size_ to find insert position.
10727         (Chunked_vector::size_): New data member.
10728         (Stringpool_template::set_no_zero_null): Assert string set is empty.
10729         (Stringpool_template::new_key_offset): New method declaration.
10730         (Stringpool_template::offset_): New data member.
10731
10732 2010-03-15   Rafael Espindola  <espindola@google.com>
10733
10734         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
10735         Add_symbols' constructor.
10736         * readsyms.h (Add_symbols): Remove the input_group member.
10737
10738 2010-03-10  Ian Lance Taylor  <iant@google.com>
10739
10740         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
10741         target to ask whether a reference to a symbol requires a stack
10742         split.
10743         * target.h (Target::is_call_to_non_split): New function.
10744         (Target::do_is_call_to_non_split): Declare virtual function.
10745         * target.cc: Include "symtab.h".
10746         (Target::do_is_call_to_non_split): New function.
10747         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
10748
10749 2010-03-10  Cary Coutant  <ccoutant@google.com>
10750
10751         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
10752         (File_read::open[1]): Remove initial mapping of whole_file_view_.
10753         (File_read::open[2]): Add whole_file_view_ to list of views.
10754         (File_read::make_view): Remove test of whole_file_view_.
10755         (File_read::find_or_make_view): Create whole_file_view_ if
10756         necessary.
10757         (File_read::clear_views): Replace bool parameter with enum;
10758         adjust all callers.  Don't delete views with permanent data;
10759         do delete cached views and views from archives if
10760         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
10761         if clearing the corresponding view.
10762         * fileread.h (File_read::Clear_views_mode): New enum.
10763         (File_read::View::is_permanent_view): New method.
10764         (File_read::clear_views): Replace bool parameter
10765         with enum; adjust all callers.
10766         * options.h (General_options): Change keep_files_mapped option;
10767         add map_whole_files.
10768         * readsyms.cc (Add_symbols::run): Delete sd_ object before
10769         releasing the file.
10770         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
10771         the file.
10772
10773 2010-03-10  David S. Miller  <davem@davemloft.net>
10774
10775         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
10776
10777 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
10778
10779         * icf.cc (get_section_contents): Add '@' marker after processing the
10780         merge reloc.
10781
10782 2010-03-08  Doug Kwan  <dougkwan@google.com>
10783
10784         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
10785         due to a conversion warning.
10786         (Arm_relobj::update_output_local_symbol_count): Check for local
10787         symbol with unset output index.
10788
10789 2010-03-05  Ian Lance Taylor  <iant@google.com>
10790
10791         * options.h (class General_options): Add --spare-dynamic-tags.
10792         * output.cc (Output_data_dynamic::set_final_data_size): Implement
10793         --spare-dynamic-tags.
10794
10795 2010-03-05  Ian Lance Taylor  <iant@google.com>
10796
10797         * incremental.cc: Include "libiberty.h".
10798
10799 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
10800
10801         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
10802         function, is_info_ member.
10803         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
10804         (Versions::Versions): Update caller.
10805         (Versions::define_base_version): Likewise.
10806         (Versions::add_def): Likewise.
10807
10808 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
10809
10810         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
10811         (Scan::possible_function_pointer_reloc): New function.
10812         (Scan::local_reloc_may_be_function_pointer): Change to call
10813         possible_function_pointer_reloc.
10814         (Scan::global_reloc_may_be_function_pointer): Ditto.
10815         * icf.h (Icf::check_section_for_function_pointers): Change to reject
10816         relocations in ".data.rel.ro._ZTV" section.
10817         * testsuite/icf_safe_so_test.sh: Change to pass i386.
10818         * testsuite/icf_safe_so_test.cc: Ditto.
10819         * testsuite/icf_safe_test.cc: Ditto.
10820         * testsuite/icf_safe_test.sh: Ditto.
10821
10822 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10823             Ian Lance Taylor  <iant@google.com>
10824
10825         * target-reloc.h (relocate_section): Check the symbol table index
10826         for -1U before setting the local symbol index.
10827         (scan_relocatable_relocs): If copying the relocation, record that
10828         the local symbol is required.
10829         * object.h (Symbol_value::is_output_symtab_index_set): New
10830         function.
10831         (Symbol_value::may_be_discarded_from_output_symtab): New
10832         function.
10833         (Symbol_value::has_output_symtab_entry): New function.
10834         (Symbol_value::needs_output_symtab_entry): Remove.
10835         (Symbol_value::output_symtab_index): Make sure the symbol index is
10836         set.
10837         (Symbol_value::set_output_symtab_index): Make sure the symbol
10838         index is not set.  Make sure the new index is valid.
10839         (Symbol_value::set_must_have_output_symtab_entry): New function.
10840         (Symbol_value::has_output_dynsym_entry): New function.
10841         (Symbol_value::set_output_dynsym_index): Make sure the new index
10842         is valid.
10843         (Sized_relobj::set_must_have_output_symtab_entry): New function.
10844         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
10845         local symbol if permitted.
10846         (Sized_relobj::do_finalize_local_symbols): Call
10847         is_output_symtab_index_set rather than needs_output_symtab_entry.
10848         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
10849         rather than needs_output_symtab_entry.  Call
10850         has_output_dynsym_entry rather than needs_output_dynsym_entry.
10851         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
10852         is_output_symtab_index_set rather than needs_output_symtab_entry.
10853         * testsuite/discard_locals_relocatable_test.c: New file.
10854         * testsuite/discard_locals_test.sh: Test -r.
10855         * testsuite/Makefile.am (check_DATA): Add
10856         discard_locals_relocatable_test1.syms,
10857         discard_local_relocatable_test2.syms.
10858         (MOSTLYCLEANFILES): Likewise.  Also add
10859         discard_locals_relocatable_test1.lout and
10860         discard_locals_relocatable_test2.out.
10861         (discard_locals_relocatable_test1.syms): New target.
10862         (discard_locals_relocatable_test.o): New target.
10863         (discard_locals_relocatable_test1.out): New target.
10864         (discard_locals_relocatable_test2.syms): New target.
10865         (discard_locals_relocatable_test2.out): New target.
10866         (various): Add missing ../ld-new dependencies.
10867         * testsuite/Makefile.in: Rebuild.
10868
10869 2010-03-03  Nick Clifton  <nickc@redhat.com>
10870
10871         * po/fi.po: New Finnish translation.
10872
10873 2010-03-01  Doug Kwan  <dougkwan@google.com>
10874
10875         * layout.cc (Layout::Layout): Force section types of .init_array*,
10876         .preinit_array* and .fini_array* sections.
10877         * output.cc (Output_section::Input_section_sort_entry::has_priority):
10878         Fix check of return value of std::string::find.().
10879         (Output_section::Input_section_sort_compare::operator()): Remove
10880         comment about .init_array.
10881         (Output_section::Input_section_sort_init_fini_compare::operator()):
10882         New method.
10883         (Output_section::sort_attached_input_sections): Handle .init_array
10884         and .fini_array specially.
10885         * output.h (Output_section::Inut_section_sort_compare): Update
10886         comment.
10887         (Output_section::Input_section_sort_init_fini_compare): New struct.
10888
10889 2010-02-26  Doug Kwan  <dougkwan@google.com>
10890
10891         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
10892         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
10893         * testsuite/debug_msg.sh: Avoid matching source line number for
10894         use of global variable undef_int.
10895
10896 2010-02-26  Doug Kwan  <dougkwan@google.com>
10897
10898         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
10899         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
10900         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
10901         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
10902         * options.cc (General_options::General_options): Initialize member
10903         fix_v4bx_.
10904         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
10905         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
10906         and rm_no_fix_v4bx.stdout
10907         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
10908         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
10909         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
10910         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
10911         and arm_no_fix_v4bx.
10912         * Makefile.in: Regenerate.
10913         * testsuite/arm_fix_v4bx.s: New file.
10914         * testsuite/arm_fix_v4bx.sh: Ditto.
10915
10916 2010-02-24  Doug Kwan  <dougkwan@google.com>
10917
10918         * arm.cc (Target_arm::got_section): Make the .got section the first
10919         non RELRO section in the data segment.
10920         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
10921         suffixes of section names.
10922
10923 2010-02-24  Doug Kwan  <dougkwan@google.com>
10924
10925         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
10926         flags and attributes merging if an input file is a binary file.
10927         * fileread.cc (Input_file::open): Record format of original file.
10928         * fileread.h (Input_file::Format): New enum type.
10929         (Input_file::Input_file): Initialize data member format_.
10930         (Input_file::format): New method definition.
10931         (Input_file::format_):: New data member.
10932
10933 2010-02-24  Doug Kwan  <dougkwan@google.com>
10934
10935         * arm.cc (Arm_output_data_got): New class.
10936         (ARM_TCB_SIZE): New constant
10937         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
10938         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10939         If user uses a script with a SECTIONS clause, issue only a warning
10940         for a misplaced EXIDX input section.  Otherwise, issue an error.
10941         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
10942         garbage collection.
10943         (Target_arm::got_mode_index_entry): Handle static linking.
10944         (Target_arm::Scan::local): Ditto.
10945         (Target_arm::Scan::global): Ditto.
10946         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
10947         all incorrectly implemented relocations.
10948         (Target_arm::fix_exidx_coverage): Pass layout to
10949         Arm_output_section::fix_exidx_coverage.
10950         * layout.cc (Layout::section_name_mapping): Remove trailing dots
10951         from ".ARM.exidx." and ".ARM.extab.".
10952
10953 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10954
10955         * arm.cc (Target_arm::do_finalize_sections): Create attribute
10956         section if it does not already exist.
10957         * attributes.cc (Attributes_section_data::Attributes_section_data):
10958         Don't crash if size is zero.
10959
10960 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10961             Ian Lance Taylor  <iant@google.com>
10962
10963         * gold.cc (queue_middle_tasks): If no input files were opened,
10964         exit.
10965         * workqueue.h (Task_function::Task_function): Assert that there is
10966         a blocker.
10967
10968 2010-02-22  Doug Kwan  <dougkwan@google.com>
10969
10970         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
10971         * icf.cc (get_section_contents): Cast snprintf arguments to long long
10972         types to avoid warnings due to different uint64_t implementations
10973         on different hosts.
10974
10975 2010-02-21  Doug Kwan  <dougkwan@google.com>
10976
10977         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
10978         handling of the maximum backward branch offset.
10979         (Arm_relocate_functions::thumb_branch_common): Ditto.
10980         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
10981         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
10982         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
10983         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
10984         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
10985         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
10986         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
10987         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
10988         thumb_bl_out_of_range thumb_bl_out_of_range.o,
10989         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
10990         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
10991         thumb2_bl_out_of_range.o): New rules.
10992         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
10993         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
10994         thumb2_bl_out_of_range
10995         * testsuite/Makefile.in: Regenerate.
10996         * testsuite/arm_bl_in_range.s: New file.
10997         * testsuite/arm_bl_out_of_range.s: Ditto.
10998         * testsuite/arm_branch_in_range.sh: Ditto.
10999         * testsuite/arm_branch_range.t: Ditto.
11000         * testsuite/thumb2_branch_range.t: Ditto.
11001         * testsuite/thumb_bl_in_range.s: Ditto.
11002         * testsuite/thumb_bl_out_of_range.s: Ditto.
11003         * testsuite/thumb_branch_range.t: Ditto.
11004
11005 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
11006
11007         * gc.h (gc_process_relocs): Change vectors to point to the new list.
11008         Add reloc offset information.
11009         * icf.cc (get_section_contents): Change iterators to point to the new
11010         vectors. Add reloc offset information to the contents.
11011         * icf.h (Icf::Sections_reachable_info): New typedef.
11012         (Icf::Sections_reachable_list): New typedef.
11013         (Icf::Offset_info): New typedef.
11014         (Icf::Reloc_info): New struct typedef.
11015         (Icf::Reloc_info_list): New typedef.
11016         (Icf::symbol_reloc_list): Delete method.
11017         (Icf::addend_reloc_list): Delete method.
11018         (Icf::section_reloc_list): Delete method.
11019         (Icf::reloc_info_list): New method.
11020         (Icf::reloc_info_list_): New member.
11021
11022 2010-02-19  Doug Kwan  <dougkwan@google.com>
11023
11024         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
11025         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
11026         * arm.cc (Arm_relocation_functions): New forward declaration.
11027         (Target_arm::Target_arm): Initialize new data members
11028         got_mod_index_offset_ and tls_base_symbol_defined_.
11029         (Target_arm::Relocate::relocate_tls): New method.
11030         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
11031          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
11032         New methods.
11033         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
11034         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
11035         (Target_arm::got_mod_index_offset_,
11036         Target_arm::tls_base_symbol_defined_): New data members.
11037         (Target_arm::Scan::local, Target::Scan::global,
11038         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
11039         relocations.
11040
11041 2010-02-18  Doug Kwan  <dougkwan@google.com>
11042
11043         * arm.cc (Arm_relobj::find_linked_text_section): New method.
11044         (Arm_relobj::make_exidx_input_section): Pass section index of linked
11045         text section as a parameter becuase some broken tools may not set
11046         the link in section header.
11047         (Target_arm::has_got_section): New method.
11048         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
11049         without any mapping symbol as data only.  Remove warning.
11050         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
11051         link in its section header, try to discover the link by inspecting the
11052         REL31 relocation at the beginning of the section.
11053         (Target_arm::Scan::check_non_pic): Report name of offending relocation
11054         in error message.
11055         (Target_arm::Scan::global): Treat any reference to the symbol
11056         _GLOBAL_OFFSET_TABLE_ as a GOT access.
11057
11058 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
11059
11060         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
11061         (Scan::global_reloc_may_be_function_pointer): New function.
11062         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
11063         (Scan::global_reloc_may_be_function_pointer): New function.
11064         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
11065         (Scan::global_reloc_may_be_function_pointer): New function.
11066         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
11067         (Scan::global_reloc_may_be_function_pointer): New function.
11068         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
11069         (Scan::global_reloc_may_be_function_pointer): New function.
11070         (Scan::possible_function_pointer_reloc): New function.
11071         (Target_x86_64::can_check_for_function_pointers): New function.
11072         * gc.h (gc_process_relocs): Scan relocation types to determine if
11073         function pointers were taken for targets that support it.
11074         * icf.cc (Icf::find_identical_sections): Include functions for
11075         folding in safe ICF whose pointer is not taken.
11076         * icf.h (Secn_fptr_taken_set): New typedef.
11077         (fptr_section_id_): New member.
11078         (section_has_function_pointers): New function.
11079         (set_section_has_function_pointers): New function.
11080         (check_section_for_function_pointers): New function.
11081         * options.h: Fix comment for safe ICF option.
11082         * target.h (can_check_for_function_pointers): New function.
11083         * testsuite/Makefile.am: Add icf_safe_so_test test case.
11084         Modify icf_safe_test for X86-64.
11085         * testsuite/Makefile.in: Regenerate.
11086         * testsuite/icf_safe_so_test.cc: New file.
11087         * testsuite/icf_safe_so_test.sh: New file.
11088         * testsuite/icf_safe_test.cc (kept_func_3): New function.
11089         (main): Change to take pointer to function kept_func_3.
11090         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
11091         folding is done correctly for X86-64.
11092
11093 2010-02-12  David S. Miller  <davem@davemloft.net>
11094
11095         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
11096         is_symbolless parameter.
11097         (Output_reloc<SHT_REL>::is_symbolless): New.
11098         (Output_reloc<SHT_REL>::is_symbolless_): New.
11099         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
11100         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
11101         (Output_reloc<SHT_RELA>::is_symbolless): New.
11102         (Output_data_reloc::add_global): Handle is_symbolless.
11103         (Output_data_reloc::add_global_relative): Likewise.
11104         (Output_data_reloc::add_local): Likewise.
11105         (Output_data_reloc::add_local_relative): Likewise.
11106         (Output_data_reloc::add_symbolless_global_addend): New.
11107         (Output_data_reloc::add_symbolless_local_addend): New.
11108         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
11109         is_symbolless.
11110         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
11111         instead of ->is_relative_
11112         (Output_reloc::write): Likewise.
11113         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
11114         (Output_reloc::write_rel): Simplify.
11115
11116         * sparc.cc (Target_sparc::Scan::local): Use
11117         ->add_symbolless_local_addend as needed.
11118         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
11119         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
11120         based upon relocation offset.
11121
11122 2010-02-11  Doug Kwan  <dougkwan@google.com>
11123
11124         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
11125         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
11126         beginning of function.
11127         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
11128         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
11129         parameter is_32bit in calls to should_apply_static_reloc.
11130         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
11131         (check_DATA): Add arm_abs_global.stdout.
11132         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
11133         arm_abs_global.stdout): New rules.
11134         (MOSTLLYCLEANFILES): Add arm_abs_global
11135         * Makefile.in: Regenerate.
11136         * testsuite/arm_abs_global.s: New file.
11137         * testsuite/arm_abs_global.sh: Ditto.
11138         * testsuite/arm_abs_lib.s: Ditto.
11139
11140 2010-02-11  Ian Lance Taylor  <iant@google.com>
11141
11142         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
11143         Read_relocs task.
11144         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
11145         Allocate_commons_task first.
11146         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
11147         task, rather than symtab_lock_.
11148         (Gc_process_relocs::~Gc_process_relocs): New function.
11149         (Gc_process_relocs::is_runnable): Check this_blocker_.
11150         (Gc_process_relocs::locks): Use next_blocker_ rather than
11151         blocker_.
11152         (Scan_relocs::~Scan_relocs): New function.
11153         (Scan_relocs::is_runnable): Check this_blocker_ rather than
11154         symtab_lock_.
11155         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
11156         next_blocker_.
11157         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
11158         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
11159         constructor accordingly.
11160         (class Gc_process_relocs): Likewise.
11161         (class Scan_relocs): Likewise.
11162         * common.h (class Allocate_commons_task): Remove symtab_lock_
11163         field, and corresponding constructor parameter.
11164         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
11165         symtab_lock_.
11166         (Allocate_commons_task::locks): Likewise.
11167
11168 2010-02-11  Ian Lance Taylor  <iant@google.com>
11169
11170         * gold-threads.h (class Once): Define.
11171         (class Initialize_lock): Rewrite as child of Once.
11172         * gold-threads.cc (class Once_initialize): Define.
11173         (once_pointer_control): New static variable.
11174         (once_pointer, once_arg): New static variables.
11175         (c_run_once): New static function.
11176         (Once::Once, Once::run_once, Once::internal_run): New functions.
11177         (class Initialize_lock_once): Remove.
11178         (initialize_lock_control): Remove.
11179         (initialize_lock_pointer): Remove.
11180         (initialize_lock_once): Remove.
11181         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
11182         (Initialize_lock::initialize): Rewrite.
11183         (Initialize_lock::do_run_once): New function.
11184         * archive.cc (Archive::interpret_header): Only clear name if it is
11185         not already empty.
11186         * fileread.cc: Include "gold-threads.h"
11187         (file_counts_lock): New static variable.
11188         (file_counts_initialize_lock): Likewise.
11189         (File_read::release): Only increment counts when using --stats.
11190         Use a lock around the increment.
11191         * parameters.cc (class Set_parameters_target_once): Define.
11192         (set_parameters_target_once): New static variable.
11193         (Parameters::Parameters): Move here from parameters.h.
11194         (Parameters::set_target): Rewrite.
11195         (Parameters::set_target_once): New function.
11196         (Parameters::clear_target): Move here and rewrite.
11197         * parameters.h (class Parameters): Update declarations.  Add
11198         set_parameters_target_once_ field.
11199         (Parameters::Parameters): Move to parameters.cc.
11200         (Parameters::clear_target): Likewise.
11201         * readsyms.cc (Read_symbols::do_group): Create a Start_group
11202         task.
11203         (Start_group::~Start_group): New function.
11204         (Start_group::is_runnable): New function.
11205         (Start_group::locks, Start_group::run): New functions.
11206         (Finish_group::run): Change saw_undefined to size_t.
11207         * readsyms.h (class Start_group): Define.
11208         (class Finish_group): Change saw_undefined_ field to size_t.
11209         (Finish_group::Finish_group): Remove saw_undefined and
11210         this_blocker parameters.  Change all callers.
11211         (Finish_group::set_saw_undefined): New function.
11212         (Finish_group::set_blocker): New function.
11213         * symtab.h (class Symbol_table): Change saw_undefined to return
11214         size_t.  Change saw_undefined_ field to size_t.
11215         * target-select.cc (Set_target_once::do_run_once): New function.
11216         (Target_selector::Target_selector): Initialize set_target_once_
11217         field.  Don't initialize lock_ and initialize_lock_ fields.
11218         (Target_selector::instantiate_target): Rewrite.
11219         (Target_selector::set_target): New function.
11220         * target-select.h (class Set_target_once): Define.
11221         (class Target_selector): Update declarations.  Make
11222         Set_target_once a friend.  Remove lock_ and initialize_lock_
11223         fields.  Add set_target_once_ field.
11224
11225 2010-02-10  Ian Lance Taylor  <iant@google.com>
11226
11227         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
11228         queueing any tasks.
11229         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
11230         (queue_middle_tasks): Add all blockers before queueing any tasks.
11231         (queue_final_tasks): Likewise.
11232         * token.h (Task_token::add_blockers): New function.
11233         * object.h (Input_objects::number_of_relobjs): New function.
11234
11235 2010-02-10  Ian Lance Taylor  <iant@google.com>
11236
11237         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
11238         shared, not if not position independent.
11239         * x86_64.cc (Relocate::relocate_tls): Likewise.
11240         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
11241         (tls_pie_pic_test): New target.
11242         * testsuite/Makefile.in: Rebuild.
11243
11244         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
11245         (tls_test_main_pie.o, tls_test_pie.o): New targets.
11246         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
11247         * testsuite/Makefile.in: Rebuild.
11248
11249 2010-02-09  David S. Miller  <davem@davemloft.net>
11250
11251         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
11252         R_SPARC_RELATIVE using ->add_local_relative().
11253         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
11254
11255         * output.h (Output_data_dynamic::add_section_size): New method
11256         that takes two Output_data objects.
11257         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
11258         entry param.  Handle it in initializers.
11259         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
11260         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
11261         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
11262         arg.
11263         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
11264         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
11265         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
11266         for dynrel_includes_plt.
11267         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11268         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11269         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
11270         before .rela.plt
11271         (Target_sparc::do_finalize_sections): Update to pass true for
11272         dynrel_includes_plt.
11273         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
11274         output before .rela.plt
11275         (Target_powerpc::do_finalize_sections): Update to pass true for
11276         dynrel_includes_plt when 32-bit.
11277
11278 2010-02-08  Doug Kwan  <dougkwan@google.com>
11279
11280         * arm.cc (Arm_relobj::simple_input_section_output_address): New
11281         method.
11282         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
11283         Arm_relobj::scan_section_for_cortex_a8_stubs,
11284         Arm_relobj::do_relocation_section): Instead of calling
11285         Output_section::output_address, use faster
11286         Arm_relobj::simple_input_section_output_address.
11287
11288 2010-02-08  David S. Miller  <davem@davemloft.net>
11289
11290         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
11291         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
11292         relocation helper function.
11293
11294         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
11295         just like R_SPARC_GOT{10,13,22}.
11296         (Target_sparc::Scan::local): Likewise.
11297         (Target_sparc::Relocate:relocate): Likewise.
11298
11299 2010-02-06  Ian Lance Taylor  <iant@google.com>
11300
11301         * configure.ac: Rewrite targetobjs duplicate removal code to use
11302         only shell constructs.
11303         * configure: Rebuild.
11304
11305 2010-02-05  Doug Kwan  <dougkwan@google.com>
11306
11307         PR 11247
11308         * arm.cc (Arm_relobj::section_is_scannable): New method.
11309         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
11310         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
11311
11312 2010-02-04  Doug Kwan  <dougkwan@google.com>
11313
11314         PR 11247
11315         * arm-reloc-property.cc (cstdio): Include.
11316         * configure.ac (targetobjs): Remove duplicates.
11317         * configure: Regenerate.
11318         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
11319         big and little endian version for a given address size.
11320
11321 2010-02-03  Doug Kwan  <dougkwan@google.com>
11322
11323         * arm-reloc-property.cc
11324         (Arm_reloc_property_table::reloc_name_in_error_message): New method
11325         definition.
11326         * arm-reloc-property.h
11327         (Arm_reloc_property_table::get_implemented_static_reloc_property):
11328         New method definition.
11329         (Arm_reloc_property_table::reloc_name_in_error_message): New method
11330         declaration.
11331         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
11332         overflow to N.
11333         (GOT_PREL): Change implemented to Y.
11334         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
11335         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
11336         (Arm_relocate_functions::movw_abs_nc): Remove method.
11337         (Arm_relocate_functions::movt_abs): Ditto.
11338         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
11339         (Arm_relocate_functions::thm_movt_abs): Ditto.
11340         (Arm_relocate_functions::movw_rel_nc): Ditto.
11341         (Arm_relocate_functions::movw_rel): Ditto.
11342         (Arm_relocate_functions::movt_rel): Ditto.
11343         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
11344         (Arm_relocate_functions:thm_movw_rel): Ditto.
11345         (Arm_relocate_functions:thm_movt_rel): Ditto.
11346         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
11347         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
11348         New method definitions.
11349         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
11350         (Arm_relocation_functions::arm_grp_ldr): Ditto.
11351         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
11352         (Arm_relocation_functions::arm_grp_ldc): Ditto.
11353         (Target_arm::Relocate::relocate): Check for non-static or
11354         unimplemented relocation code and exit early.  Change calls to
11355         Target_arm::reloc_uses_thumb_bit and
11356         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
11357         instead.  Refactor code to handle similar relocations to increase
11358         code sharing.  Remove check for unsupported relocation code in switch
11359         statement.
11360         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
11361         relocation property table to find out size.  Change error message to
11362         print out the name of a relocation code instead of the numeric value.
11363         (Target_arm::scan_reloc_for_stub): Use relocation property table
11364         instead of calling Target_arm::reloc_uses_thumb_bit().
11365
11366 2010-02-02  Doug Kwan  <dougkwan@google.com>
11367
11368         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
11369         types of relaxed input section.
11370
11371 2010-02-02  Doug Kwan  <dougkwan@google.com>
11372
11373         * Makefile.am (HFILES): Add arm-reloc-property.h.
11374         (DEFFILES): New.
11375         (TARGETSOURCES): Add arm-reloc-property.cc
11376         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
11377         (libgold_a_SOURCES): $(DEFFILES)
11378         * Makefile.in: Regenerate.
11379         * arm-reloc-property.cc: New file.
11380         * arm-reloc-property.h: New file.
11381         * arm-reloc.def: New file.
11382         * arm.cc: Update comments.
11383         (arm-reloc-property.h): New included header.
11384         (arm_reloc_property_table): New global variable.
11385         (Target_arm::do_select_as_default_target): New method definition.
11386         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
11387         arm-reloc-property to targ_extra_obj.
11388         * parameters.cc (set_parameters_target): Call
11389         Target::select_as_default_target().
11390         * target.h (Target::select_as_default_target): New method definition.
11391         (Target::do_select_as_default_target): Same.
11392
11393 2010-02-01  Doug Kwan  <dougkwan@google.com>
11394
11395         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
11396         first_output_text_section_.
11397         (Arm_exidx_fixup::first_output_text_section): New method definition.
11398         (Arm_exidx_fixup::first_output_text_section_): New data member.
11399         (Arm_exidx_fixup::process_exidx_section): Record the first text
11400         output section seen.
11401         (Arm_output_section::fix_exidx_coverage): Set correct linked section
11402         and entsize in output section header.
11403
11404 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11405
11406         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
11407         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
11408         (Arm_relocate_functions::thm_alu11): New Method.
11409         (Arm_relocate_functions::thm_pc8): New Method.
11410         (Arm_relocate_functions::thm_pc12): New Method.
11411         (Target_arm::Scan::local): Handle the relocations.
11412         (Target_arm::Scan::global): Likewise.
11413         (Target_arm::Relocate::relocate): Likewise.
11414         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11415
11416 2010-01-29  Doug Kwan  <dougkwan@google.com>
11417
11418         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
11419         of relocation types as ld.
11420
11421 2010-01-29  Doug Kwan  <dougkwan@google.com>
11422
11423         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
11424         to public.
11425         (Arm_relocate_functions::thumb_branch_common): Ditto.
11426         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
11427         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
11428         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
11429         Arm_relocate_functions::jump24): Remove.
11430         (Target_arm::Relocate::relocate): Adjust code to call
11431         Arm_relocation_functions::arm_branch_common and
11432         Arm_relocation_functions::thumb_branch_common instead of their removed
11433         wrappers.  Merge switch-cases together to reduce source code size.
11434
11435 2010-01-29  Doug Kwan  <dougkwan@google.com>
11436
11437         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
11438         output_local_symbol_count_needs_update_.
11439         (Arm_relobj::output_local_symbol_count_needs_update,
11440          Arm_relobj::set_output_local_symbol_count_needs_update,
11441          Arm_relobj::update_output_local_symbol_count): New methods.
11442         (Arm_relobj::output_local_symbol_count_needs_update_): New data
11443         member.
11444         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
11445         of pointed function as in a R_ARM_PREL31 relocation.
11446         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
11447         for output local symbol count updating.
11448         (Target_arm::do_relax): Update output local symbol counts in objects
11449         if necessary.
11450         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
11451
11452 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11453
11454         * arm.cc: Added support for the ARM relocations:
11455         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
11456         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
11457         (Arm_relocate_functions::movw_rel_nc): Renamed (was
11458         movw_prel_nc).
11459         (Arm_relocate_functions::movw_rel): New method.
11460         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
11461         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
11462         thm_movw_prel_nc).
11463         (Arm_relocate_functions::thm_movw_rel): New method.
11464         (Arm_relocate_functions::thm_movt_rel): Renamed (was
11465         thm_movt_prel).
11466         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
11467         relocations.
11468         (Target_arm::Scan::global): Likewise.
11469         (Target_arm::Relocate::relocate): Likewise.
11470         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11471         Likewise.
11472
11473 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11474
11475         * arm.cc: Added support for ARM group relocations.
11476         (Target_arm::reloc_needs_sym_origin): New method.
11477         (Arm_relocate_functions::calc_grp_kn): New method.
11478         (Arm_relocate_functions::calc_grp_residual): New method.
11479         (Arm_relocate_functions::calc_grp_gn): New method.
11480         (Arm_relocate_functions::arm_grp_alu): New Method.
11481         (Arm_relocate_functions::arm_grp_ldr): New Method.
11482         (Arm_relocate_functions::arm_grp_ldrs): New Method.
11483         (Arm_relocate_functions::arm_grp_ldc): New Method.
11484         (Target_arm::Scan::local): Handle the ARM group relocations.
11485         (Target_arm::Scan::global): Likewise.
11486         (Target_arm::Relocate::relocate): Likewise.
11487         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11488         Likewise.
11489
11490 2010-01-26  Doug Kwan  <dougkwan@google.com>
11491
11492         * arm.cc (set): Include.
11493         (class Arm_exidx_fixup): Change type of last_input_section_ to const
11494         pointer type.
11495         (Arm_output_section::Text_section_list): New type.
11496         (Arm_output_section::append_text_sections_to_list): New method.
11497         (Arm_output_section::fix_exidx_coverage): Ditto.
11498         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
11499         (Arm_relobj::convert_input_section_to_relaxed_section): Use
11500         Relobj::set_section_offset() instead of
11501         Sized_relobj::invalidate_section_offset().
11502         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
11503         parameter for section headers. Ignore relocation sections for
11504         unallocated sections and EXIDX sections.
11505         (Target_arm::fix_exidx_coverage): New method.
11506         (Target_arm::output_section_address_less_than): New type.
11507         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
11508         linked text section instead of the EXIDX section.
11509         (Arm_output_section::create_stub_group): Add an assertion to check
11510         that this is not an EXIDX output section.
11511         (Arm_output_section::append_text_sections_to_list): New method.
11512         (Arm_output_section::fix_exidx_coverage): Ditto.
11513         (Arm_relobj::scan_sections_for_stubs): Adjust call to
11514         Arm_relobj::section_needs_reloc_stub_scanning.
11515         (Target_arm::do_relax): Fix EXIDX output section coverage in the
11516         first pass.
11517         (Target_arm::fix_exidx_coverage): New method.
11518         * object.h (Relobj::set_output_section): New method.
11519         (Sized_relobj::invalidate_section_offset): Remove method.
11520         (Sized_relobj::do_invalidate_section_offset): Remove method.
11521         (Sized_relobj::do_set_section_offset): Handle offset value -1.
11522
11523 2010-01-25  Doug Kwan  <dougkwan@google.com>
11524
11525         * arm.cc (Arm_exidx_merged_section::do_output_offset):
11526         Fix warning due to signed and unsigned comparison on a 32-bit host.
11527
11528 2010-01-22  Doug Kwan  <dougkwan@google.com>
11529
11530         * arm.cc (Target_arm::do_relax): Record an output section for section
11531         offset adjustment it contains any stub table that has changed.
11532         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
11533         offsets in an output section if necessary.
11534         * output.cc (Output_section::Output_section): Initialize
11535         section_offsets_need_adjustments_.
11536         (Output_section::add_input_section_for_script): Renamed to
11537         Output_section::add_simple_input_section.
11538         (Output_section::save_states): Add a comment.
11539         (Output_section::discard_states): New method defintion.
11540         (Output_section::adjust_section_offsets): Same.
11541         * output.h (Output_section::add_input_section_for_script): Renamed to
11542         Output_section::add_simple_input_section.
11543         (Output_section::discard_states): New method declaration.
11544         (Output_section::adjust_section_offsets): Same.
11545         (Output_section::section_offsets_need_adjustment,
11546         Output_section::set_section_offsets_need_adjustment): New method
11547         definitions.
11548         (Output_section::section_offsets_need_adjustment_): New data member.
11549         * script-sections.cc
11550         (Output_section_element_input::set_section_address): Adjust code for
11551         renaming of Output_section::add_input_section_for_script.
11552         (Orphan_output_section::set_section_address): Same.
11553
11554 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11555
11556         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
11557         Fix_v4bx enum values .
11558         * gold/options.h (General_options): New option definitions.
11559         (General_options::fix_v4bx): New method.
11560         (General_options::Fix_v4bx): New enum.
11561         * gold/options.cc (General_options::parse_fix_v4bx): New method.
11562         (General_options::parse_fix_v4bx_interworking): New method.
11563
11564 2010-01-22  Doug Kwan  <dougkwan@google.com>
11565
11566         * arm.cc (Arm_exidx_fixup): New class.
11567
11568 2010-01-21  Doug Kwan  <dougkwan@google.com>
11569
11570         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
11571         classes.
11572         (Arm_exidx_section_offset_map): New type.
11573
11574 2010-01-21  Doug Kwan  <dougkwan@google.com>
11575
11576         * arm.cc (Arm_exidx_input_section): New class.
11577         (Arm_relobj::exidx_input_section_by_link,
11578         Arm_relobj::exidx_input_section_by_shndx,
11579         Arm_relobj::make_exidx_input_section): New methods.
11580         (read_arm_attributes_section): Remove.
11581         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
11582         information about them.
11583         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
11584         to here.
11585
11586 2010-01-20  Doug Kwan  <dougkwan@google.com>
11587
11588         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
11589         Input_section_specifier to Section_id.
11590         (Target_arm::new_arm_input_section: Adjust code for change of key
11591         type.
11592         (Target_arm::find_arm_input_section): Ditto.
11593         * gc.h (object.h): Include for Section_id nand Section_id_hash.
11594         (Section_id): Remove.
11595         (Garbage_collection::Section_id_hash): Remove.
11596         * icf.h (object.h): Include for Section_id nand Section_id_hash.
11597         (Section_id): Remove.
11598         (Icf::Section_id_hash): Remove.
11599         * object.h (Section_id, Const_section_id, Section_id_hash,
11600         Const_section_id_hash): New type definitions.
11601         * output.cc (Output_section::add_relaxed_input_section): Change to
11602         use Const_section_id instead of Input_section_specifier as key type.
11603         (Output_section::add_merge_input_section): Ditto.
11604         (Output_section::build_relaxation_map): Change to use Section_id
11605         instead of Input_section_specifier as key type.
11606         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11607         Ditto.
11608         (Output_section::convert_input_sections_to_relaxed_sections): Change
11609         to use Const_section_id instead of Input_section_specifier as key type.
11610         (Output_section::find_merge_section): Ditto.
11611         (Output_section::find_relaxed_input_section): Ditto.
11612         * output.h (Input_section_specifier): Remove class.
11613         (Output_section::Output_section_data_by_input_section_map): Change
11614         key type to Const_section_id.
11615         (Output_section::Output_relaxed_input_section_by_input_section_map):
11616         Ditto.
11617         (Output_section::Relaxation_map): Change key type to Section_id.
11618
11619 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11620
11621         * gold/arm.cc: Added support for R_ARM_V4BX relocation
11622         (class Arm_v4bx_stub): New class.
11623         (DEF_STUBS): Updated definition to support v4_veneer_bx.
11624         (Stub_factory::make_arm_v4bx_stub): New method.
11625         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
11626         (Stub_table::empty): Handle v4bx stubs.
11627         (Stub_table::add_arm_v4bx_stub): New method.
11628         (Stub_table::find_arm_v4bx_stub): New method.
11629         (Arm_relocate_functions::v4bx): New method.
11630         (Target_arm::fix_v4bx): New method.
11631         (Target_arm::Target_arm): Handle R_ARM_V4BX.
11632         (Stub_table::relocate_stubs): Likewise.
11633         (Stub_table::do_write): Likewise.
11634         (Stub_table::update_data_size_and_addralign): Likewise.
11635         (Stub_table::finalize_stubs):  Likewise.
11636         (Target_arm::Scan::local): Likewise.
11637         (Target_arm::Scan::global): Likewise.
11638         (Target_arm::do_finalize_sections): Likewise.
11639         (Target_arm::Relocate::relocate): Likewise.
11640         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11641         Likewise.
11642         (Target_arm::scan_reloc_for_stub): Likewise.
11643         (Target_arm::scan_reloc_section_for_stubs): Likewise.
11644
11645 2010-01-19  Ian Lance Taylor  <iant@google.com>
11646
11647         * output.cc (Output_section_headers::do_sized_write): Write large
11648         segment count to sh_info field.
11649         (Output_file_header::do_sized_write): For large segment count,
11650         write PN_XNUM to e_phnum field.
11651
11652 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11653
11654         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
11655         (Arm_relocate_functions::thm_jump8): New function.
11656         (Arm_relocate_functions::thm_jump11): New function.
11657         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
11658         R_ARM_THM_JUMP11.
11659         (Target_arm::Scan::global): Likewise.
11660         (Target_arm::Relocate::relocate): Likewise.
11661         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11662         Likewise.
11663
11664 2010-01-14  Doug Kwan  <dougkwan@google.com>
11665
11666         * arm.cc (map, utility): Include headers.
11667         (Target_arm::apply_cortex_a8_workaround): New method.
11668         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
11669         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
11670         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
11671         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
11672         the --[no-]fix-cortex-a8 command line options.
11673         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
11674         (Target_arm::relocate_stub): Use addend in instruction template.
11675         * options.h (DEFINE_bool): Set the user-set flag.
11676         (General_options): Add --[no-]-fix-cortex options.
11677         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
11678         : Update fast look-up map after conversion.
11679
11680 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
11681
11682         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
11683         in the first pass of do_layout.
11684
11685 2010-01-13  Doug Kwan  <dougkwan@google.com>
11686
11687         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11688         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
11689         apparent compiler problem of not folding static constant integral
11690         data members of elfcpp::Elf_sizes<32>.
11691
11692 2010-01-13  Doug Kwan  <dougkwan@google.com>
11693
11694         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11695         Arm_relobj::section_needs_cortex_a8_stub_scanning,
11696         Arm_relobj::scan_section_for_cortex_a8_erratum,
11697         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
11698         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
11699         sections to scan for relocation stubs into a new method
11700         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
11701         relocation and Cortex-A8 stub scanning.
11702         (Target_arm::do_relax): Force stubs to be after stubbed sections
11703         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
11704         the beginning of a new relaxation pass.  Update a comment.
11705         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
11706
11707 2010-01-12  Ian Lance Taylor  <iant@google.com>
11708
11709         * target-reloc.h (visibility_error): New inline function.
11710         (relocate_section): Call visibility_error.
11711         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
11712         (MOSTLYCLEANFILES): Likewise.
11713         (protected_4_pic.o, protected_3.err): New targets.
11714         * testsuite/protected_4.cc: New file.
11715
11716 2010-01-12  Doug Kwan  <dougkwan@google.com>
11717
11718         * arm.cc (Cortex_a8_reloc): New class.
11719         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
11720         and cortex_a8_relocs_info_.
11721         (Target_arm::fix_cortex_a8): New method definition.
11722         (Target_arm::Cortex_a8_relocs_info): New type.
11723         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
11724         New data member declarations.
11725         (Target_arm::scan_reloc_for_stub): Record information about
11726         relocations for THUMB branches that might be exempted from the
11727         Cortex-A8 workaround.
11728         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
11729         at the beginning of a relaxation pass.
11730
11731 2010-01-12  Doug Kwan  <dougkwan@google.com>
11732
11733         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
11734         (Arm_relobj::Mapping_symbol_position,
11735          Arm_reloj::Mapping_symbol_position_less,
11736          Arm_relobj::Mapping_symbols_info): New types.
11737         (Target_arm::is_mapping_symbol_name): New method definition.
11738         (Arm_relobj::do_count_local_symbols): Save information about mapping
11739         symbols.
11740
11741 2010-01-11  Doug Kwan  <dougkwan@google.com>
11742
11743         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
11744         Arm_relocate_functions::thumb32_branch_upper,
11745         Arm_relocate_functions::thumb32_branch_lower,
11746         Arm_relocate_functions::thumb32_cond_branch_offset,
11747         Arm_relocate_functions::thumb32_cond_branch_upper,
11748         Arm_relocate_functions::thumb32_cond_branch_lower,
11749         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
11750         branch offset encoding.
11751         (Arm_relocate_functions::thumb_branch_common): Use new branch
11752         offset encoding methods to avoid code duplication.
11753         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
11754         (Stub_addend_reader::operator()): Use new branch encoding method
11755         to avoid code duplication.
11756
11757 2010-01-11  Doug Kwan  <dougkwan@google.com>
11758
11759         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
11760         (Target_arm::do_finalize_sections): Define special EXIDX section
11761         symbols only if referenced.
11762         * gc.h (Garbage_collection::add_reference): New method.
11763         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
11764         code duplication.
11765
11766 2010-01-11  Ian Lance Taylor  <iant@google.com>
11767
11768         * script.cc (Version_script_info::build_expression_list_lookup):
11769         Change complaing about duplicate wildcard match from error to
11770         warning.
11771
11772         * script.cc (class Lazy_demangler): Recreate--revert part of patch
11773         of 2009-12-30.
11774         (Version_script_info::Version_script_info): Initialize globs_,
11775         default_version_, default_is_global_, and exact_.  Don't
11776         initialize globals_ or locals_.
11777         (Version_script_info::build_lookup_tables): Build local symbols
11778         first.
11779         (Version_script_info::unquote): New function.
11780         (Version_script_info::add_exact_match): New function.
11781         (Version_script_info::build_expression_list_lookup): Remove lookup
11782         parameter.  Add is_global parameter.  Change all callers.  Handle
11783         wildcard pattern specially.  Unquote pattern.  Call
11784         add_exact_match.
11785         (Version_script_info::get_name_to_match): New function.
11786         (Version_script_info::get_symbol_version): New function.
11787         (Version_script_info::get_symbol_version_helper): Remove.
11788         (Version_script_info::check_unmatched_names): Call unquote.
11789         * script.h (class Version_script_info): Change get_symbol_version
11790         to be non-inline and add is_global parameter; change all callers.
11791         Rewrite symbol_is_local.  Update declarations.  Define struct
11792         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
11793         Remove globals_ and locals_ members.  Add exact_, globs_,
11794         default_version_, is_global_.
11795         (Version_script_info::Glob): Remove pattern, add expression and
11796         is_global.  Update constructor.  Change all callers.
11797         * dynobj.cc (Versions::finalize): Mark the version symbol as the
11798         default version.
11799         (Versions::symbol_section_contents): If a symbol is undefined, or
11800         defined in a dynamic object, set the version index to
11801         VER_NDX_LOCAL.
11802         * symtab.cc (Symbol_table::add_from_relobj): Don't call
11803         symbol_is_local.
11804         (Symbol_table::add_from_pluginobj): Likewise.
11805         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
11806
11807 2010-01-11  Doug Kwan  <dougkwan@google.com>
11808
11809         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
11810         (incremental_dump_LDADD): Add linking option for libintl.
11811         * Makefile.in: Regenerate.
11812
11813 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
11814
11815         PR gold/11144
11816         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
11817         instead of -Ds.
11818         * testsuite/Makefile.in: Regenerated.
11819
11820 2010-01-10  Doug Kwan  <dougkwan@google.com>
11821
11822         * options.h (DEFINE_var): Use parentheses around argument varname__
11823         in macro body to avoid any unintended subsequent substitutions.
11824
11825 2010-01-10  Ian Lance Taylor  <iant@google.com>
11826
11827         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
11828         candidates before doing symbol resolution.
11829
11830         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
11831         ODR candidates if only one is weak.
11832
11833 2010-01-08  Ian Lance Taylor  <iant@google.com>
11834
11835         * script.cc (Version_script_info::build_expression_list_lookup):
11836         Don't warn about ambiguous version, just record the ambiguity.
11837         (Version_script_info::get_symbol_version_helper): Give error if
11838         version is ambiguous.
11839
11840 2010-01-08  Doug Kwan  <dougkwan@google.com>
11841
11842         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
11843         prev_data_size_ and prev_addralign_.  Remove initializer for
11844         deleted data member has_been_changed_.
11845         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
11846         to determine if the table is empty.
11847         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
11848         Remove.
11849         (Stub_table::add_reloc_stub): Define method in class definition
11850         instead of just declaring it there.
11851         (Stub_table::add_cortex_a8_stub): New method definition.
11852         (Stub_table::update_data_size_and_addralign): Ditto.
11853         (Stub_table::finalize_stubs): Ditto.
11854         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
11855         (Stub_table::do_addralign_): Return address alignment in the
11856         (Stub_table::do_reset_address_and_file_offset): Define method in
11857         class definition instead of declaring it there.  Set current data
11858         size to be the data size of the previous pass.
11859         (Stub_table::set_final_data_size): Use current data size as the
11860         final data size.
11861         (Stub_table::relocate_stub): Change parameter type of stub from
11862         Reloc_stub pointer to Stub pointer.
11863         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
11864         (Stub_table::Cortex_a8_stub_list): New typedef.
11865         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
11866          Stub_table::prev_addralign_): New data member.
11867         (Arm_relobj::Arm_relobj): Initialize data member
11868         section_has_cortex_a8_workaround_.
11869         (Arm_relobj::section_has_cortex_a8_workaround,
11870          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
11871          definitions.
11872         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
11873         declarations.
11874         (Target_arm::relocate_stub): Change parameter type of stub from
11875         Reloc_stub pointer to Stub pointer.
11876         (Insn_template::size, Insn_template::alignment): Handle
11877         THUMB16_SPECIAL_TYPE.
11878         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
11879          Stub_table::update_data_size_and_addralign,
11880          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
11881         definitions.
11882         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
11883         (Stub_table::do_write): Ditto.
11884         (Target_arm::do_relax): Adjust code for changes in Stub_table.
11885
11886 2010-01-08  Ian Lance Taylor  <iant@google.com>
11887
11888         PR 11108
11889         * symtab.h (class Symbol): Remove fields is_target_special_ and
11890         has_plt_offset_.  Add field is_defined_in_discarded_section_.
11891         (Symbol::is_defined_in_discarded_section): New function.
11892         (Symbol::set_is_defined_in_discarded_section): New function.
11893         (Symbol::has_plt_offset): Rewrite.
11894         (Symbol::set_plt_offset): Verify that new offset is not -1U.
11895         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
11896         Don't initialize is_target_special_ or has_plt_offset_.
11897         Initialize is_defined_in_discarded_section_.
11898         (Symbol_table::add_from_relobj): If appropriate, set
11899         is_defined_in_discarded_section.
11900         * resolve.cc (Symbol::override_base_with_special): Don't test
11901         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
11902         * target-reloc.h (relocate_section): Do special handling for
11903         symbols defined in discarded sections for global symbols as well
11904         as local symbols.
11905
11906 2010-01-08  Ian Lance Taylor  <iant@google.com>
11907
11908         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
11909         the SHT_SYMTAB case.
11910
11911 2010-01-08  Ian Lance Taylor  <iant@google.com>
11912
11913         * object.cc (Sized_relobj::do_layout): Don't get confused if
11914         layout_eh_frame returns NULL.
11915
11916 2010-01-08  Ian Lance Taylor  <iant@google.com>
11917
11918         PR 11084
11919         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
11920         dynamic symbol table, use the normal symbol table.
11921         (Sized_dynobj::do_read_symbols): Remove assertion about type of
11922         symbol table.
11923
11924 2010-01-08  Ian Lance Taylor  <iant@google.com>
11925
11926         PR 11072
11927         * layout.cc (Layout::include_section): Remove .gnu_debuglink
11928         sections.
11929
11930 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
11931
11932         * version.cc (print_version): Change to "Copyright 2010".
11933
11934 2010-01-08  Ian Lance Taylor  <iant@google.com>
11935
11936         PR 10287
11937         PR 11063
11938         * i386.cc (class Target_i386): Change return type of plt_section
11939         to be non-const.
11940         (class Output_data_plt_i386): Add tls_desc_rel_ field.
11941         (Output_data_plt_i386::Output_data_plt_i386): Initialize
11942         tls_desc_rel_ field.
11943         (Output_data_plt_i386::rel_tls_desc): New function.
11944         (Target_i386::rel_tls_desc_section): New function.
11945         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
11946         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
11947         R_386_TLS_DESC reloc in rel_tls_desc_section.
11948         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
11949         Define struct Tlsdesc_info.
11950         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
11951         (Target_x86_64::do_reloc_symbol_index): New function.
11952         (Target_x86_64::add_tlsdesc_info): New function.
11953         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
11954         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
11955         tlsdesc_rel_ field.
11956         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
11957         all callers.
11958         (Output_data_plt_x86_64::rela_tlsdesc): New function.
11959         (Target_x86_64::rela_tlsdesc_section): New function.
11960         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
11961         handling.
11962         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
11963         (Target_x86_64::do_reloc_addend): New function.
11964         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
11965         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
11966         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
11967         (Output_reloc::type): New function.
11968         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
11969         (Output_reloc::is_target_specific): New function.
11970         (Output_reloc::target_arg): New function.
11971         (class Output_reloc) [SHT_RELA]: Add four new constructors for
11972         absolute relocs and target specific relocs.
11973         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
11974         add_target_specific.
11975         (class Output_data_reloc) [SHT_RELA]: Likewise.
11976         * output.cc (Output_reloc::Output_reloc): Add four new versions
11977         for absolute relocs and target specific relocs.
11978         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
11979         (Output_reloc::get_symbol_index): Likewise.
11980         (Output_reloc::local_section_offset): Check that local_sym_index_
11981         is not TARGET_CODE or 0.
11982         (Output_reloc::symbol_value): Likewise.
11983         (Output_reloc::write) [SHT_RELA]: Call target for target specific
11984         reloc.
11985         * target.h (class Target): Add reloc_symbol_index and reloc_addend
11986         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
11987         functions.
11988         * layout.cc (add_target_dynamic_tags): Use output section for
11989         DT_PLTRELSZ and DT_JMPREL.
11990
11991 2010-01-07  Ian Lance Taylor  <iant@google.com>
11992
11993         PR 11061
11994         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
11995         function.
11996         (class Output_data_reloc_generic): Define.
11997         (class Output_data_reloc_base): Change base class to
11998         Output_data_reloc_generic.  Change add() method to call
11999         bump_relative_reloc_count for a relative reloc.  Remove
12000         sort_relocs_ field.
12001         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
12002         to sort_relocs().
12003         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
12004         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
12005         appropriate.
12006         * layout.h (class Layout): Update declaration.
12007
12008 2010-01-07  Ian Lance Taylor  <iant@google.com>
12009
12010         * output.h (class Output_data): Add const version of
12011         output_section and do_output_section.
12012         (class Output_section_data): Add const version of
12013         do_output_section.
12014         (class Output_section): Likewise.
12015         * layout.cc (Layout::add_target_dynamic_tags): New function.
12016         * layout.h (class Layout): Update declarations.
12017         * arm.cc (Target_arm::do_finalize_sections): Use
12018         add_target_dynamic_tags.
12019         * i386.cc (Target_i386::do_finalize_sections): Likewise.
12020         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12021         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12022         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12023
12024 2010-01-07  Ian Lance Taylor  <iant@google.com>
12025
12026         PR 11042
12027         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
12028         object as needed.
12029
12030 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
12031             Ian Lance Taylor  <iant@google.com>
12032
12033         PR 11019
12034         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
12035         Xindex::read_symtab_xindex.
12036
12037 2010-01-07  Doug Kwan  <dougkwan@google.com>
12038
12039         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
12040         (Insn_template::thumb16_bcond_insn): New method declaration.
12041         (Insn_template): Fix spelling.
12042         (Stub::thumb16_special): New method declaration.
12043         (Stub::do_write): Define virtual method which was previously pure
12044         virtual.
12045         (Stub::do_thumb16_special): New method declaration.
12046         (Stub::do_fixed_endian_write): New template member.
12047         (Reloc_stub::do_write): Remove.
12048         (Reloc_stub::do_fixed_endian_write): Remove.
12049         (Cortex_a8_stub): New class definition.
12050         (Stub_factory::make_cortex_a8_stub): New method definition.
12051         (Stub_factory::Stub_factory): Add missing static storage class
12052         qualifier for elf32_arm_stub_a8_veneer_blx.
12053
12054 2010-01-07  Ian Lance Taylor  <iant@google.com>
12055
12056         PR 10980
12057         * options.h (class General_options): Add --warn-unresolved-symbols
12058         and --error-unresolved-symbols.
12059         * errors.cc (Errors::undefined_symbol): Implement
12060         --warn-unresolved-symbols.
12061
12062         * options.h (class General_options): Add -z text and -z textoff.
12063         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
12064
12065 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
12066
12067         * gc.h (Garbage_collection::Cident_section_map): New typedef.
12068         (Garbage_collection::cident_sections): New function.
12069         (Garbage_collection::add_cident_section): New function.
12070         (Garbage_collection::cident_sections_): New member.
12071         (gc_process_relocs): Add references to sections whose names are C
12072         identifiers.
12073         * gold.h (cident_section_start_prefix): New constant.
12074         (cident_section_stop_prefix): New constant.
12075         (is_cident): New function.
12076         * layout.cc (Layout::define_section_symbols): Replace string constants
12077         with the newly defined constants.
12078         * object.cc (Sized_relobj::do_layout): Track sections whose names are
12079         C identifiers.
12080         * testsuite/Makefile.am: Add gc_orphan_section_test.
12081         * testsuite/Makefile.in: Regenerate.
12082         * testsuite/gc_orphan_section_test.cc: New file.
12083         * testsuite/gc_orphan_section_test.sh: New file.
12084
12085 2010-01-06  Ian Lance Taylor  <iant@google.com>
12086
12087         PR 10980
12088         * options.h (class General_options): Add --warn-shared-textrel.
12089         * layout.cc (Layout::finish_dynamic_section): Implement
12090         --warn-shared-textrel.
12091
12092         PR 10980
12093         * options.h (class General_options): Add --warn-multiple-gp.
12094
12095 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12096
12097         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
12098         $(THREADSLIB) and $(LIBDL).
12099         * Makefile.in: Rebuild.
12100
12101 2010-01-06  Ian Lance Taylor  <iant@google.com>
12102
12103         PR 10980
12104         * options.cc (General_options::parse_section_start): New function.
12105         (General_options::section_start): New function.
12106         (General_options::General_options): Initialize all members.
12107         * options.h: Include <map>
12108         (class General_options): Add --section-start.  Add section_starts_
12109         member.
12110         * layout.cc (Layout::attach_allocated_section_to_segment): If
12111         --section-start was used, set the address of the segment.  Remove
12112         local sort_sections.
12113         (Layout::relaxation_loop_body): If the address of the load segment
12114         has been set by --section-start, don't use it.
12115         * output.h (Output_segment::update_flags_for_output_section): New
12116         function.
12117         * output.cc (Output_segment::add_output_section): Call
12118         update_flags_for_output_section.
12119
12120 2010-01-05  Ian Lance Taylor  <iant@google.com>
12121
12122         PR 10980
12123         * options.h (class General_options): Add --undefined-version.
12124         * script.cc (struct Version_expression): Add was_matched_by_symbol
12125         field.
12126         (Version_script_info::matched_symbol): New function.
12127         (Version_script_info::get_symbol_version_helper): Call
12128         matched_symbol.
12129         (Version_script_info::check_unmatched_names): New function.
12130         * script.h (class Version_script_info): Update declarations.
12131         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
12132
12133         * options.h (class General_options): Use DEFINE_bool_alias for
12134         allow_multiple_definition.
12135         * resolve.cc (Symbol_table::should_override): Don't test
12136         allow_multiple_definition.
12137
12138         PR 10980
12139         * options.h (class General_options): Add --cref.
12140         * main.cc (main): Print cref table if --cref.  Don't close mapfile
12141         until after printing cref table.
12142         * cref.cc: Include "symtab.h".
12143         (class Cref_inputs): Define Cref_table_compare and Cref_table.
12144         (Cref_table_compare::operator()): New function.
12145         (Cref_inputs::gather_cref): New function.
12146         (filecol): New static const.
12147         (Cref_inputs::print_cref): New function.
12148         (Cref::print_cref): New function.
12149         * cref.h: Include <cstdio>.
12150         (class Cref): Update declarations.
12151         * mapfile.h (Mapfile::file): New function.
12152         * object.h (class Object): Define Symbols.  Declare virtual
12153         do_get_global_symbols.
12154         (Object::get_global_symbols): New function.
12155         * object.cc (Input_objects::add_object): Pass object to cref_ if
12156         --cref.
12157         (Input_objects::archive_start): Likewise.
12158         (Input_objects::archive_stop): Likewise.
12159         (Input_objects::print_cref): New function.
12160         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
12161         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
12162         --cref.
12163         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
12164         function.
12165         * plugin.h (class Sized_pluginobj): Update declarations.
12166
12167 2010-01-05  Ian Lance Taylor  <iant@google.com>
12168
12169         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
12170         to is_default_version.  Rename insdef to insdefault.
12171         (Symbol_table::add_from_relobj): Rename def to is_default_version
12172         and local to is_forced_local.
12173         (Symbol_table::add_from_pluginobj): Likewise.
12174         (Symbol_table::add_from_dynobj): Likewise.
12175         (Symbol_table::define_special_symbol): Rename insdef to
12176         insdefault.
12177
12178 2010-01-04  Ian Lance Taylor  <iant@google.com>
12179
12180         PR 10980
12181         * options.h (class General_options): Add
12182         --allow-multiple-definition and -z muldefs.
12183         * resolve.cc (Symbol_table::should_override): Don't warn about a
12184         multiple symbol definition if --allow-multiple-definition or -z
12185         muldefs.
12186
12187         PR 10980
12188         * options.h (class General_options): Add --add-needed and
12189         --copy-dt-needed-entries.  Tweak --as-needed help entry.
12190         * object.cc (Input_objects::check_dynamic_dependencies): Give an
12191         error if --copy-dt-needed-entries aka --add-needed is used and
12192         would cause a change in behaviour.
12193
12194         PR 10980
12195         * options.h (class General_options): Add -G as a short version of
12196         --shared.  Add no-op options -assert, -g, and -i.
12197
12198 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
12199
12200         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
12201         check for .text or .gnu.linkonce.t sections.
12202         * icf.cc (Icf::find_identical_sections): Ditto.
12203         Change the detection for mangled function name within the section
12204         name.
12205         * icf.h (is_section_foldable_candidate): New function.
12206
12207 2009-12-30  Ian Lance Taylor  <iant@google.com>
12208
12209         PR 10980
12210         * options.h (class General_options): Permit two dashes with
12211         --retain-symbols-file.
12212
12213 2009-12-30  Ian Lance Taylor  <iant@google.com>
12214
12215         PR 10979
12216         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
12217         don't put the file header and segment headers in the text
12218         segment.
12219
12220         PR 10979
12221         * common.cc (Sort_commons::operator()): Stabilize sort when both
12222         entries are NULL.
12223         (Symbol_table::do_allocate_commons_list): When allocating common
12224         symbols, skip a symbol which is no longer common.
12225         * symtab.h (Symbol::is_common): Test whether the symbol comes from
12226         an object before checking its type.
12227         * testsuite/common_test_2.c: New file.
12228         * testsuite/common_test_3.c: New file.
12229         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
12230         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
12231         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
12232         (common_test_2_pic.o, common_test_2.so): New targets.
12233         (common_test_3_pic.o, common_test_3.so): New targets.
12234         * testsuite/Makefile.in: Rebuild.
12235
12236         PR 10979
12237         * script.cc (read_input_script): If we see a new SECTIONS clause,
12238         and we have added an input section, give an error.
12239         * layout.h (class Layout): Add have_added_input_section function.
12240         Add have_added_input_section_ field.
12241         * layout.cc (Layout::Layout): Initialize
12242         have_added_input_section_.
12243         (Layout::layout): Set have_added_input_section_.
12244         (Layout::layout_eh_frame): Likewise.
12245
12246 2009-12-30  Ian Lance Taylor  <iant@google.com>
12247
12248         PR 10931
12249         * options.h (class General_options): Add --sort-common option.
12250         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
12251         * common.cc (Sort_common): Add sort_order parameter to
12252         constructor.  Add sort_order_ field.
12253         (Sort_commons::operator): Check sort_order_.
12254         (Symbol_table::allocate_commons): Determine the sort order.
12255         (Symbol_table::do_allocate_commons): Add sort_order parameter.
12256         Change all callers.
12257         (Symbol_table::do_allocate_commons_list): Likewise.
12258
12259 2009-12-30  Ian Lance Taylor  <iant@google.com>
12260
12261         PR 10916
12262         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
12263         symbols from this object, don't change the visibility of an
12264         undefined symbol.
12265         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
12266
12267 2009-12-30  Ian Lance Taylor  <iant@google.com>
12268
12269         PR 10861
12270         * script.h (class Version_script_info): Define Language enum.
12271         Update declarations.  Define Glob, Exact, and Lookup types.  Add
12272         new fields globals_, locals_, and is_finalized_.
12273         * script.cc: Various formatting fixes.
12274         (class Parser_closure): Change language_stack_ from a vector of
12275         std::string to one of Version_script_info::Language.  Adjust all
12276         uses accordingly.
12277         (class Lazy_demangler): Remove.
12278         (struct Version_expression): Change language from std::string to
12279         Version_script_info::Language.
12280         (Version_script_info::Version_script_info): New function.
12281         (Version_script_info::~Version_script_info): Don't call clear.
12282         (Version_script_info::finalize): New function.
12283         (Version_script_info::build_lookup_tables): New function.
12284         (Version_script_info::build_expression_list_lookup): New
12285         function.
12286         (Version_script_info::get_symbol_version_helper): Rewrite to use
12287         lookup tables.
12288         (Version_script_info::print_expression_list): Adjust to use
12289         Version_script_info::Language.
12290         (script_push_lex_into_version_mode): Check that the version script
12291         has not been finalized.
12292         (version_script_push_lang): Change language string to
12293         Version_script_info::Language.
12294         * options.cc (Command_line::version_script): New function.
12295         * options.h (class General_options): Add finalize_dynamic_list
12296         function.  Change version_script from declaration to definition.
12297         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
12298         * testsuite/version_script.map: Remove duplicate def of foo.
12299         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
12300         version_script.map.
12301         * testsuite/Makefile.in: Rebuild.
12302
12303 2009-12-30  Ian Lance Taylor  <iant@google.com>
12304
12305         PR 10843
12306         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
12307         if the input symbol index is 0, make the output symbol index 0.
12308
12309 2009-12-30  Ian Lance Taylor  <iant@google.com>
12310
12311         PR 10670
12312         * options.h (class General_options): Add -x/--discard-all.
12313         * object.cc (Sized_relobj::do_count_local_symbols): Handle
12314         --discard-all.  If the local symbol needs a dynamic entry, check
12315         that before handling --discard-locals.
12316
12317 2009-12-30  Ian Lance Taylor  <iant@google.com>
12318
12319         PR 10450
12320         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
12321         flags to PF_R.
12322         (Output_segment::add_output_section): Don't change the flags if
12323         the type is PT_TLS.
12324
12325         PR 10450
12326         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
12327         GNU hash table if they need a dynamic value.  Otherwise, don't add
12328         them if they are defined in a dynamic object or are forced local.
12329
12330 2009-12-29  Ian Lance Taylor  <iant@google.com>
12331
12332         PR 10450
12333         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
12334         .gnu.hash table for a 32-bit target.
12335
12336         PR 10450
12337         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
12338         regular and a dynamic object only needs a dynamic symbol table
12339         entry if it is externally visible.
12340
12341         PR 10450
12342         * i386.cc (class Target_i386): Initialize global_offset_table_ in
12343         constructor.  Add global_offset_table_ field.
12344         (Target_i386::got_section): Set global_offset_table_.
12345         (Target_i386::do_finalize_sections): Set global_offset_table_
12346         size.
12347         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
12348         in constructor.  Add global_offset_table_ field.
12349         (Target_x86_64::got_section): Set global_offset_table_.
12350         (Target_x86_64::do_finalize_sections): Set global_offset_table_
12351         size.
12352
12353         * layout.cc (Layout::Layout): Initialize increase_relro_.
12354         (Layout::get_output_section): Add is_relro, is_last_relro, and
12355         is_first_non_relro parameters.  Change all callers.
12356         (Layout::choose_output_section): Likewise.
12357         (Layout::add_output_section_data): Likewise.
12358         (Layout::make_output_section): Likewise.
12359         (Layout::set_segment_offsets): Clear increase_relro when using a
12360         linker script.
12361         * layout.h (class Layout): Add increase_relro method.  Add
12362         increase_relro_ field.  Update declarations.
12363         * output.cc (Output_section::Output_section): Initialize
12364         is_last_relro_ and is_first_non_relro_.
12365         (Output_segment::add_output_section): Group relro sections is
12366         do_sort is true.  Handle is_last_relro and is_first_non_relro.
12367         (Output_segment::maximum_alignment): Remove relro handling.
12368         (Output_segment::set_section_addresses): Add increase_relro
12369         parameter.  Change all callers.  Add initial alignment to align
12370         relro sections on separate page.  Remove old relro handling.
12371         (Output_segment::set_section_list_addresses): Remove in_relro
12372         parameter.  Change all callers.
12373         (Output_segment::set_offset): Add increase parameter.  Change all
12374         callers.  Remove old relro handling.
12375         * output.h (class Output_section): Add new methods: is_last_relro,
12376         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
12377         Add is_last_relro_ and is_first_non_relro_ fields.
12378         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
12379         Create separate .got.plt section.  Call increase_relro.
12380         * x86_64.cc (Target_x86_64::got_section): Likewise.
12381         * testsuite/relro_script_test.t: Add .got.plt.
12382
12383         PR 10450
12384         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
12385         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
12386         (Layout::finalize): Call set_dynamic_symbol_size.
12387         (Layout::set_dynamic_symbol_size): New function.
12388         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
12389         set_dynamic_symbol_size.
12390
12391         PR 10450
12392         * output.h (class Output_section): Add is_entsize_zero_ field.
12393         * output.cc (Output_section::Output_section): Initialize
12394         is_entsize_zero_.
12395         (Output_section::set_entsize): If two different entsizes are
12396         requested, force it to zero.
12397         (Output_section::add_input_section): Set flags for .debug_str
12398         before updating section flags.  Set entsize.
12399         (Output_section::update_flags_for_input_section): Set SHF_MERGE
12400         and SHF_STRING if all input sections have those flags.
12401
12402 2009-12-29   Rafael Espindola  <espindola@google.com>
12403
12404         * main.cc (main): Fix the sys time reporting.
12405         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
12406         reporting.
12407
12408 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
12409
12410         * options.cc (General_options::parse_version): Allow -v to exit
12411         without an error if there is nothing to link.
12412
12413 2009-12-29  Ian Lance Taylor  <iant@google.com>
12414
12415         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
12416         using a version of gcc before 4.1.
12417         * configure: Rebuild.
12418
12419 2009-12-28  Chris Demetriou  <cgd@google.com>
12420
12421         * attributes.cc (Output_attributes_section_data::do_write): Use
12422         std::vector::front rather than std::vector::data.
12423
12424 2009-12-28  Ian Lance Taylor  <iant@google.com>
12425
12426         * symtab.h (class Symbol_table): Add enum Defined.
12427         * resolve.cc (Symbol_table::should_override): Add defined
12428         parameter.  Change all callers.  Test whether object is NULL
12429         before calling a method on it.
12430         (Symbol_table::report_resolve_problem): Add defined parameter.
12431         Change all callers.
12432         (Symbol_table::should_override_with_special): Likewise.
12433         * symtab.cc (Symbol_table::define_in_output_data): Add defined
12434         parameter.  Change all callers.
12435         (Symbol_table::do_define_in_output_data): Likewise.
12436         (Symbol_table::define_in_output_segment): Likewise.
12437         (Symbol_table::do_define_in_output_segment): Likewise.
12438         (Symbol_table::define_as_constant): Likewise.
12439         (Symbol_table::do_define_as_constant): Likewise.
12440         * script.h (class Symbol_assignment): Add is_defsym parameter to
12441         constructor; change all callers.
12442         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
12443         parameter.  Change all callers.  Add is_defsym_ field.
12444         (class Parser_closure): Add parsing_defsym parameter to
12445         constructor; change all callers.  Add parsing_defsym accessor
12446         function.  Add parsing_defsym_ field.
12447
12448 2009-12-28  Ian Lance Taylor  <iant@google.com>
12449
12450         * gold.cc (queue_middle_tasks): Fix formatting.
12451         * object.cc (Relobj::is_section_name_included): Likewise.
12452
12453 2009-12-23  Ian Lance Taylor  <iant@google.com>
12454
12455         * i386.cc (Target_i386::do_calls_non_split): Recognize
12456         -fsplit-stack prologue for a function with a static chain.
12457         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
12458         -fsplit-stack prologue when using %r11.
12459
12460 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
12461
12462         * options.cc (General_options::parse_version): Make -v continue and do
12463         the link like GNU ld does.
12464
12465 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
12466
12467         * Makefile.am (CCFILES): Add timer.cc.
12468         (HFILES): Add timer.h.
12469         * configure.ac: Check for sysconf and times.
12470         * main.cc: include timer.h.
12471         (main): Use Timer instead of get_run_time.
12472         * timer.cc: New.
12473         * timer.h: New.
12474         * workqueue.cc: include timer.h.
12475         (Workqueue::find_and_run_task):
12476         Report user, sys and wall time.
12477         * Makefile.in: Regenerate.
12478         * config.in: Regenerate.
12479         * configure: Regenerate.
12480
12481 2009-12-16  Doug Kwan  <dougkwan@google.com>
12482
12483         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
12484         sections.
12485         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
12486         relaxed input sections.
12487         * output.cc (Output_section::find_relaxed_input_section): Change
12488         return type to Output_relaxed_input_section pointer.  Adjust code
12489         for new type of relaxed_input_section_map_.
12490         * output.h (Output_section::find_relaxed_input_section): Change
12491         return type to Output_relaxed_input_section pointer.
12492         (Output_section::Output_relaxed_input_section_by_input_section_map):
12493         New type.
12494         (Output_section::relaxed_input_section_map_): Change type to
12495         Output_section::Output_relaxed_input_section_by_input_section_map.
12496         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
12497         input section.
12498
12499 2009-12-15  Ian Lance Taylor  <iant@google.com>
12500
12501         * layout.cc (Layout::create_shstrtab): Only write out after input
12502         sections if we are compressing debug sections.
12503
12504 2009-12-15  Ian Lance Taylor  <iant@google.com>
12505
12506         * archive.cc (Archive::add_symbols): Only look up a symbol without
12507         a version if there is, in fact, a version.
12508
12509 2009-12-14  Ian Lance Taylor  <iant@google.com>
12510
12511         Revert -Wshadow changes, all changes from:
12512         2009-12-11  Doug Kwan  <dougkwan@google.com>
12513         2009-12-11  Nick Clifton  <nickc@redhat.com>
12514         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
12515
12516 2009-12-11  Doug Kwan  <dougkwan@google.com>
12517
12518         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
12519         due to -Wshadow.
12520         * attributes.cc (Object_attribute::size): Ditto.
12521         (Attributes_section_data::size): Ditto.
12522         (Attributes_section_data::Attributes_section_data): Ditto.
12523         (Output_attributes_section_data::do_write): Ditto.
12524         * attributes.h (Object_attribute::set_type): Ditto.
12525         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
12526
12527 2009-12-11  Nick Clifton  <nickc@redhat.com>
12528
12529         * archive.cc: Fix shadowed variable warnings.
12530         * arm.cc: Likewise.
12531         * compressed_output.cc: Likewise.
12532         * compressed_output.h: Likewise.
12533         * configure: Likewise.
12534         * dwarf_reader.cc: Likewise.
12535         * dynobj.cc: Likewise.
12536         * dynobj.h: Likewise.
12537         * ehframe.cc: Likewise.
12538         * ehframe.h: Likewise.
12539         * errors.cc: Likewise.
12540         * expression.cc: Likewise.
12541         * fileread.cc: Likewise.
12542         * fileread.h: Likewise.
12543         * freebsd.h: Likewise.
12544         * i386.cc: Likewise.
12545         * icf.cc: Likewise.
12546         * incremental.h: Likewise.
12547         * layout.cc: Likewise.
12548         * layout.h: Likewise.
12549         * mapfile.cc: Likewise.
12550         * merge.cc: Likewise.
12551         * merge.h: Likewise.
12552         * object.cc: Likewise.
12553         * object.h: Likewise.
12554         * options.h: Likewise.
12555         * output.cc: Likewise.
12556         * output.h: Likewise.
12557         * parameters.cc: Likewise.
12558         * plugin.cc: Likewise.
12559         * powerpc.cc: Likewise.
12560         * reduced_debug_output.cc: Likewise.
12561         * reduced_debug_output.h: Likewise.
12562         * reloc.cc: Likewise.
12563         * reloc.h: Likewise.
12564         * resolve.cc: Likewise.
12565         * script-sections.cc: Likewise.
12566         * script.cc: Likewise.
12567         * script.h: Likewise.
12568         * sparc.cc: Likewise.
12569         * symtab.cc: Likewise.
12570         * symtab.h: Likewise.
12571         * target-select.cc: Likewise.
12572         * target-select.h: Likewise.
12573         * token.h: Likewise.
12574         * workqueue.cc: Likewise.
12575         * workqueue.h: Likewise.
12576         * x86_64.cc: Likewise.
12577
12578 2009-12-10  Doug Kwan  <dougkwan@google.com>
12579
12580         * arm.cc (attributes.h): New include.
12581         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
12582         (Arm_relobj::~Arm_relobj): Delete object pointed by
12583         attributes_section_data_.
12584         (Arm_relobj::attributes_section_data): New method definition.
12585         (Arm_relobj::attributes_section_data_): New data member declaration.
12586         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
12587         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
12588         attributes_section_data_.
12589         (Arm_dynobj::attributes_section_data): New method definition.
12590         (Arm_dynobj::attributes_section_data_): New data member declaration.
12591         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
12592         initialization value of may_use_blx_ to false.
12593         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
12594         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
12595         object attributes to compute results instead of hard-coding.
12596         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
12597         Target_arm::get_secondary_compatible_arch,
12598         Target_arm::set_secondary_compatible_arch
12599         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12600         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
12601         New method declarations.
12602         (Target_arm::get_aeabi_object_attribute): New method definition.
12603         (Target_arm::attributes_section_data_): New data member declaration.
12604         (read_arm_attributes_section): New template definition.
12605         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
12606         (Arm_dynobj::do_read_symbols): Ditto.
12607         (Target_arm::do_finalize_sections): Merge attributes sections from
12608         input.  Check for BLX use after attributes section merging.
12609         Fix __exidx_start and __exidx_end visibility.  Create an
12610         .ARM.attributes section if necessary.
12611         (Target_arm::get_secondary_compatible_arch,
12612         Target_arm::set_secondary_compatible_arch,
12613         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12614         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
12615         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
12616         New method definitions.
12617
12618 2009-12-09  Ian Lance Taylor  <iant@google.com>
12619
12620         * plugin.cc (Plugin::load): Don't cast from void* to a function
12621         pointer.
12622
12623 2009-12-09  Ian Lance Taylor  <iant@google.com>
12624
12625         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
12626         information fields.
12627
12628 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
12629
12630         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
12631         Replace two_file_shared_1.so with two_file_shared_2.so.
12632         * testsuite/Makefile.in: Regenerated.
12633
12634 2009-12-08  Doug Kwan  <dougkwan@google.com>
12635
12636         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
12637         (HFILES): Add attributes.h and int_encoding.h.
12638         * Makefile.in: Regenerate.
12639         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
12640         function definitions to int_encoding.cc
12641         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
12642         prototypes to int_encoding.h
12643         * reduced_debug_output.cc (int_encoding.h): New include.
12644         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
12645         function definitions to int_encoding.cc
12646         (insert_into_vector, read_from_pointer): Move template definitions to
12647         int_encoding.h
12648         * attributes.cc: New file.
12649         * attributes.h: New file.
12650         * int_encoding.cc: New file.
12651         * int_encoding.h: New file.
12652
12653 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
12654
12655         PR gold/11055
12656         * incremental-dump.cc (dump_incremental_inputs): New.
12657         (main): Use dump_incremental_inputs.
12658
12659 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
12660
12661         PR gold/10893
12662         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
12663         checking elfcpp::STT_FUNC.
12664         (Target_i386::Relocate::relocate): Likewise.
12665         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
12666
12667         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
12668         symbols from shared libraries into normal FUNC symbols.
12669
12670         * symtab.h (Symbol): Add is_func and use it.
12671
12672 2009-12-05  Doug Kwan  <dougkwan@google.com>
12673
12674         * arm.cc (Target_arm::arm_info): Initialize new fields
12675         attributes_section and attributes_vendor.
12676         * i386.cc (Target_i386::i386_info): Same.
12677         * object.cc (Sized_relobj::do_layout): Skip attribute section.
12678         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
12679         fields attributes_section and attributes_vendor.
12680         * sparc.cc (Target_sparc::sparc_info): Same.
12681         * target.h (Target::attributes_section, Target::attributes_vendor,
12682         Target::is_attributes_section, Target::attribute_arg_type,
12683         Target::attributes_order): New method definitions.
12684         (Target::Target_info::attributes_section,
12685         Target::Target_info::attributes_vendor): New fields.
12686         (Target::do_attribute_arg_type, Target::do_attributes_order): New
12687         virtual method definitions.
12688         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
12689         attributes_section and attributes_vendor.
12690         * testsuite/testfile.cc (Target_test::test_target_info): Same.
12691
12692 2009-12-05  Doug Kwan  <dougkwan@google.com>
12693
12694         * arm.cc: Update comments about interworking and stub generation.
12695         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
12696         considered as non-PIC.
12697         (Arm_relocate_functions::base_abs): Fix formatting.
12698         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
12699         of function to use GOT entry address instead of offset.
12700         (Target_arm::Scan::global): Issue an error if a symbol would need a
12701         PLT does not get one because it is untyped.  Remove code to create
12702         dynamic symbols for relative branches.
12703         (Target_arm::Relocate::relocate: Use 0 instead of false since function
12704         takes unsigned integer instead of boolean.
12705
12706 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
12707
12708         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
12709         (two_file_test_LDADD): Likewise.
12710         (common_test_1_LDADD): Likewise.
12711         (exception_test_LDADD) Likewise.
12712         (weak_test_LDADD): Likewise.
12713         (many_sections_test_LDADD): Likewise.
12714         (initpri1_LDADD): Likewise.
12715         (script_test_1_LDADD): Likewise.
12716         (script_test_2_LDADD): Likewise.
12717         (justsyms_LDADD): Likewise.
12718         (binary_test_LDADD): Likewise.
12719         (large_LDADD): Likewise.
12720         * testsuite/Makefile.in: Regenerated.
12721
12722 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
12723
12724         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
12725         (Symbol_table::override_with_special): Likewise.
12726         (Symbol_table::add_from_object): Likewise.
12727
12728 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12729
12730         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12731         Don't set the data_offset twice.
12732
12733 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12734
12735         * testsuite/Makefile.in: Regenerate.
12736
12737 2009-12-03  Doug Kwan  <dougkwan@google.com>
12738
12739         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
12740         (Target_arm::do_finalize_sections): Add parameter for symbol table
12741         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
12742         * i386.cc (Target_i386::do_finalize_sections): Add an additional
12743         parameter for symbol table pointer.
12744         * layout.cc (Layout::finalize): Call Target::finalize_sections with
12745         an additional parameter for a pointer to symbol table.
12746         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
12747         parameter for a symbol table pointer.
12748         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
12749         * target.h (Target::finalize_sections, Target::do_finalize_sections):
12750         Ditto.
12751         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
12752         parameter for a symbol table pointer.
12753
12754 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
12755
12756         * incremental.cc (Incremental_inputs_header)
12757         (Incremental_inputs_header_write, Incremental_inputs_entry)
12758         (Incremental_inputs_entry_write): Move ...
12759         * incremental.h (Incremental_inputs_header)
12760         (Incremental_inputs_header_write, Incremental_inputs_entry)
12761         (Incremental_inputs_entry_write): here.
12762
12763 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12764
12765         * incremental.cc (make_sized_incremental_binary): Set the target.
12766         Error if it is incompatible.
12767         * output.h (Output_file): Add filename method.
12768
12769 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12770
12771         * incremental.cc (Incremental_inputs_entry): Remove unused argument
12772         from the get_* methods.
12773
12774 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12775
12776         * incremental-dump.cc (main): Check that the offeset of a script is 0.
12777         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12778         Write 0 for the data_offset of scripts.
12779
12780 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12781
12782         * testsuite/Makefile.am: Add the incremental_test.sh test.
12783         * testsuite/incremental_test.sh: New.
12784         * testsuite/incremental_test_1.c: New.
12785         * testsuite/incremental_test_2.c: New.
12786
12787 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
12788
12789         * incremental-dump.cc (main): Fix typos.
12790
12791 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
12792
12793         PR gold/11025
12794         * incremental-dump.cc (main): Use llu to print 64 bit values.
12795
12796 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
12797             H.J. Lu  <hongjiu.lu@intel.com>
12798
12799         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
12800         $(LIBDL).
12801         (incremental_dump_LDADD): Likewise.
12802         * Makefile.in: Regenerated.
12803
12804 2009-11-25  Doug Kwan  <dougkwan@google.com>
12805
12806         Revert:
12807
12808         2009-11-25  Doug Kwan  <dougkwan@google.com>
12809
12810                 * arm.cc (Target_arm::Target_arm): Move method definition
12811                 outside of class definition.  Add code to handle
12812                 --target1-rel, --target1-abs and --target2= options.
12813                 (Target_arm::get_reloc_reloc_type): Change method to be
12814                 non-static and const.
12815                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
12816                 New data member declaration.
12817                 (Target_arm::Scan::local, Target_arm::Scan::global,
12818                 Target_arm::Relocate::relocate,
12819                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12820                 Adjust call to Target_arm::get_real_reloc_type.
12821                 (Target_arm::get_real_reloc_type): Use command line options
12822                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12823                 * options.h (--target1-rel, --target1-abs, --target2): New
12824                 ARM-only options.
12825
12826 2009-11-25  Doug Kwan  <dougkwan@google.com>
12827
12828         * arm.cc (Target_arm::Target_arm): Move method definition outside of
12829         class definition.  Add code to handle --target1-rel, --target1-abs
12830         and --target2= options.
12831         (Target_arm::get_reloc_reloc_type): Change method to be non-static
12832         and const.
12833         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
12834         member declaration.
12835         (Target_arm::Scan::local, Target_arm::Scan::global,
12836         Target_arm::Relocate::relocate,
12837         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
12838         call to Target_arm::get_real_reloc_type.
12839         (Target_arm::get_real_reloc_type): Use command line options to
12840         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12841         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
12842         options.
12843
12844 2009-11-25  Doug Kwan  <dougkwan@google.com>
12845
12846         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
12847         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
12848         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
12849         formatting.
12850         (Arm_relocate_functions::thm_call): Replace body with a call to
12851         Arm_relocate_functions::thumb_branch_common.
12852         (Arm_relocate_functions::thm_jump24,
12853         Arm_relocate_functions::thm_xpc22): New method definitions.
12854         (Arm_relocate_functions::thumb_branch_common): New method definition.
12855         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
12856         operator.
12857         (Target_arm::Relocate::relocate): Adjust call to thm_call.
12858         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
12859
12860 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12861
12862         * Makefile.am: Build incremental-dump
12863         * Makefile.in: Regenerate.
12864         * incremental-dump.cc: New.
12865         * incremental.cc (Incremental_inputs_header_data,
12866         Incremental_inputs_entry_data): Move to incremental.h
12867         * incremental.h: (Incremental_inputs_header_data,
12868         Incremental_inputs_entry_data): Move from incremental.cc
12869
12870 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12871
12872         * incremental.cc (Incremental_inputs_header,
12873         Incremental_inputs_header_write, Incremental_inputs_entry,
12874         Incremental_inputs_entry_write): Add a typedef with the data type.
12875
12876 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12877
12878         * incremental.cc (Incremental_inputs_header,
12879         Incremental_inputs_header_write, Incremental_inputs_entry,
12880         Incremental_inputs_entry_write): Update comment about which
12881         type has the filed descriptions.
12882
12883 2009-11-15  Doug Kwan  <dougkwan@google.com>
12884
12885         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
12886         (Arm_relocate_functions::arm_branch_common): Change method defintion
12887         in class definition to a method declaration and update list of formal
12888         parameters.
12889         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
12890         Arm_relocation_functions::jump24): Adjust call to
12891         Arm_relocate_functions::arm_branch_common.  Update list of formal
12892         parameters.
12893         (Arm_relocate_functions::xpc25): New method definition.
12894         (Arm_relocate_functions::arm_branch_common): Move method defintion
12895         out from class definition.  Use stubs for mode-switching and extending
12896         branch ranges.
12897         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
12898         specially.  Change code to enable use of stubs in ARM branches.
12899
12900 2009-11-10  Doug Kwan  <dougkwan@google.com>
12901
12902         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
12903         in method declaration.
12904         (Target_arm::relocate_stub): New method declaration.
12905         (Target_arm::default_target): Change to return a pointer instead of
12906         a const reference.
12907         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
12908         Target_arm::default_target.
12909         (Arm_Relobj::do_relocate_sections): Remove options paramater in
12910         method definition.
12911         (Target_arm::relocate_section): Adjust view.
12912         (Target_arm::relocate_stub): New method definition.
12913
12914 2009-11-10  Doug Kwan  <dougkwan@google.com>
12915
12916         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
12917         a format warning.
12918         * incremental.cc (open_incremental_binary): Initialized local
12919         variables to avoid warnings.
12920         * object.cc (make_elf_object): Ditto.
12921         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
12922         a format warning.
12923
12924 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
12925
12926         PR gold/10930
12927         * testsuite/plugin_test.c: Include "config.h".
12928
12929 2009-11-09  Doug Kwan  <dougkwan@google.com>
12930
12931         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
12932         (arm_symbol_value): Remove.
12933         (Arm_relocate_functions::arm_branch_common,
12934         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
12935         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
12936         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
12937         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
12938         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12939         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12940         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12941         Arm_relocate_functions::thm_mobw_abs_nc,
12942         Arm_relocate_functions::thm_mov_abs,
12943         Arm_relocate_functions::movw_prel_nc,
12944         Arm_relocate_functions::thm_movt_abs,
12945         Arm_relocate_functions::movt_prel,
12946         Arm_relocate_functions::thm_movw_prel_nc,
12947         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
12948         (Target_arm::Relocate::relocate): Only decompose address into two
12949         parts if relocation type uses the thumb-bit and pass the actual
12950         bit instead of a flag indicating that the thumb-bit is used.  Adjust
12951         calls to methods in Arm_relocate_functions for this change.
12952
12953 2009-11-08  Ian Lance Taylor  <iant@google.com>
12954
12955         PR 10925
12956         * reloc.cc: Instantiate
12957         Sized_relobj::initialize_input_to_output_maps and
12958         Sized_relobj:free_input_to_output_maps.
12959
12960 2009-11-06  Ian Lance Taylor  <iant@google.com>
12961
12962         PR 10876
12963         * defstd.cc (in_segment): Set only_if_ref true for "end".
12964
12965 2009-11-06  Doug Kwan  <dougkwan@google.com>
12966
12967         * arm.cc (class Reloc_stub): Correct a comment.
12968         (Target_arm::Target_arm): Initialize arm_input_section_map_.
12969         (Target_arm::scan_section_for_stubs): New method declaration.
12970         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
12971         Change methods from private to protected.
12972         (Target_arm::do_may_relax): New method definition.
12973         (Target_arm::do_relax, Target_arm::group_sections,
12974         Target_arm::scan_reloc_for_stub,
12975         Target_arm::scan_reloc_section_for_stubs): New method declarations.
12976         (Target_arm::arm_input_section_map_): New data member declaration.
12977         (Target_arm::scan_reloc_for_stub,
12978         Target_arm::scan_reloc_section_for_stubs,
12979         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
12980         Target_arm::do_relax): New method definitions.
12981
12982 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
12983
12984         * configure.ac: Check for (struct stat)::st_mtim
12985         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
12986         * config.in: Regenerate.
12987         * configure: Regenerate.
12988
12989 2009-11-05  Ian Lance Taylor  <iant@google.com>
12990
12991         PR 10910
12992         * output.cc (Output_segment::add_output_section): Add missing
12993         return statement.
12994
12995 2009-11-04  Ian Lance Taylor  <iant@google.com>
12996
12997         PR 10880
12998         * object.h (class Object): Add is_needed and set_is_needed
12999         methods.  Add is_needed_ field.  Make bool fields into bitfields.
13000         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
13001         defined in a dynamic object and referenced by a regular object,
13002         set is_needed for the dynamic object.
13003         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
13004         if the file is marked with as_needed and it is not needed.
13005
13006 2009-11-04  Ian Lance Taylor  <iant@google.com>
13007
13008         PR 10887
13009         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
13010         tags if data is discarded by linker script.
13011         * i386.cc (Target_i386::do_finalize_sections): Likewise.
13012         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
13013         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
13014         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
13015
13016 2009-11-04  Ian Lance Taylor  <iant@google.com>
13017
13018         * layout.cc (Layout::get_output_section): Add is_interp and
13019         is_dynamic_linker_section parameters.  Change all callers.
13020         (Layout::choose_output_section): Likewise.
13021         (Layout::make_output_section): Likewise.
13022         (Layout::add_output_section_data): Add is_dynamic_linker_section
13023         parameter.  Change all callers.
13024         * layout.h (class Layout): Update declarations.
13025         * output.h (class Output_section): Add is_interp, set_is_interp,
13026         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
13027         Add is_interp_, is_dynamic_linker_section_ fields.  Change
13028         generate_code_fills_at_write_ to a bitfield.
13029         * output.cc (Output_section::Output_sections): Initialize new
13030         fields.
13031         (Output_segment::add_output_section): Add do_sort parameter.
13032         Change all callers.
13033
13034 2009-11-03  Ian Lance Taylor  <iant@google.com>
13035
13036         PR 10860
13037         * options.h (class General_options): Add --warn-common.
13038         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
13039         merging two common symbols.
13040         (Symbol_table::should_override): Handle --warn-common when merging
13041         a common symbol with a defined symbol.  Use report_resolve_problem
13042         for multiple definitions.
13043         (Symbol_table::report_resolve_problem): New function.
13044         * symtab.h (class Symbol_table): Declare report_resolve_problem.
13045
13046 2009-11-03  Doug Kwan  <dougkwan@google.com>
13047
13048         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
13049         stub_factory_.
13050         (Target_arm::stub_factory): New method definition.
13051         (Target_arm::new_arm_input_section,
13052         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
13053         Target_arm::reloc_uses_thumb_bit): New method declarations.
13054         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
13055         New type definitions.
13056         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
13057         member declarations.
13058         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
13059         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
13060         New method definitions.
13061
13062 2009-11-03  Ian Lance Taylor  <iant@google.com>
13063
13064         * options.h (class General_options): Add --warn_constructors.
13065
13066 2009-11-03  Ian Lance Taylor  <iant@google.com>
13067
13068         PR 10893
13069         * defstd.cc (in_section): Add entries for __rel_iplt_start,
13070         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
13071
13072 2009-11-03  Ian Lance Taylor  <iant@google.com>
13073
13074         PR 10895
13075         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
13076         --msgid-bugs-address.
13077         (install-pdf): New target.
13078         (install-data_yes): Look up one directory to find mkinstalldirs.
13079
13080 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
13081
13082         * po/Make-in (.po.gmo): Don't generate .gmo files in source
13083         tree.
13084
13085 2009-10-30  Doug Kwan  <dougkwan@google.com>
13086
13087         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
13088
13089 2009-10-30  Doug Kwan  <dougkwan@google.com>
13090
13091         * arm.cc (Stub_addend_reader): New struct template definition
13092         and partial specializations.
13093         (Stub_addend_reader::operator()): New method definition for a
13094         partially specialized template.
13095
13096 2009-10-30  Doug Kwan  <dougkwan@google.com>
13097
13098         * arm.cc (Arm_relobj::processor_specific_flags): New method
13099         definition.
13100         (Arm_relobj::do_read_symbols): New method declaration.
13101         (Arm_relobj::processor_specific_flags_): New data member declaration.
13102         (Arm_dynobj): New class definition.
13103         (Target_arm::do_finalize_sections): Add input_objects parameter.
13104         (Target_arm::do_adjust_elf_header): New method declaration.
13105         (Target_arm::are_eabi_versions_compatible,
13106         (Target_arm::merge_processor_specific_flags): New method declaration.
13107         (Target_arm::do_make_elf_object): New overloaded method definitions
13108         and declaration.
13109         (Arm_relobj::do_read_symbols): New method definition.
13110         (Arm_dynobj::do_read_symbols): Ditto.
13111         (Target_arm::do_finalize_sections): Add input_objects parameters.
13112         Merge processor-specific flags from all input objects.
13113         (Target_arm::are_eabi_versions_compatible,
13114         Target_arm::merge_processor_specific_flags,
13115         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
13116         New method definitions.
13117         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
13118         Input_objects pointer type parameter.
13119         * layout.cc (Layout::finalize): Pass input objects to target's.
13120         finalize_sections function.
13121         * output.cc (Output_file_header::do_sized_write): Set ELF file
13122         header's processor-specific flags.
13123         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
13124         Input_objects pointer type parameter.
13125         * sparc.cc (Target_sparc::do_finalize_sections): Same.
13126         * target.h (Input_objects): New forward class declaration.
13127         (Target::processor_specific_flags,
13128         Target::are_processor_specific_flags_sect): New method definitions.
13129         (Target::finalize_sections): Add input_objects parameter.
13130         (Target::Target): Initialize processor_specific_flags_ and
13131         are_processor_specific_flags_set_.
13132         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
13133         parameter.
13134         (Target::set_processor_specific_flags): New method definition.
13135         (Target::processor_specific_flags_,
13136         Target::are_processor_specific_flags_set_): New data member
13137         declarations.
13138         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
13139         Input_objects pointer type parameter.
13140
13141 2009-10-30  Doug Kwan  <dougkwan@google.com>
13142
13143         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
13144
13145 2009-10-28  Ian Lance Taylor  <iant@google.com>
13146
13147         * object.h (class Relobj): Drop options parameter from
13148         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
13149         do_scan_relocs, do_relocate.  Change all callers.
13150         (class Sized_relobj): Drop options parameters from
13151         do_gc_process_relocs, do_scan_relocs, do_relocate,
13152         do_relocate_sections, relocate_sections, emit_relocs_scan,
13153         emit_relocs_scan_reltype.  Change all callers.
13154         (struct Relocate_info): Remove options field and all references to
13155         it.
13156         * reloc.h (class Read_relocs): Remove options constructor
13157         parameter and options_ field.  Change all callers.
13158         (class Gc_process_relocs, class Scan_relocs): Likewise.
13159         (class Relocate_task): Likewise.
13160         * target-reloc.h (scan_relocs): Remove options parameter.  Change
13161         all callers.
13162         (scan_relocatable_relocs): Likewise.
13163         * target.h (class Sized_target): Remove options parameter from
13164         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
13165         all callers.
13166         * gc.h (gc_process_relocs): Remove options parameter.  Change all
13167         callers.
13168         * arm.cc: Update functions to remove options parameters.
13169         * i386.cc: Likewise.
13170         * powerpc.cc: Likewise.
13171         * sparc.cc: Likewise.
13172         * x86_64.cc: Likewise.
13173         * testsuite/testfile.cc: Likewise.
13174
13175 2009-10-28  Doug Kwan  <dougkwan@google.com>
13176
13177         * arm.cc (Arm_relobj): New class definition.
13178         (Arm_relobj::scan_sections_for_stubs,
13179         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
13180         New method definitions.
13181
13182 2009-10-28  Cary Coutant  <ccoutant@google.com>
13183
13184         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
13185         (Plugin::cleanup_done_): New member.
13186         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
13187         (Plugin_manager::cleanup_done_): Remove.
13188         (Plugin_manager::add_input_file): Edit error message.
13189         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
13190         (Plugin_manager::cleanup): Remove use of cleanup_done_.
13191
13192 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
13193
13194         * fileread.cc: (File_read::View::~View): Use the new
13195         data_ownership_ filed.
13196         (File_read::~File_read): Dispose the new whole_file_view_.
13197         (File_read::open): Mmap the whole file if needed.
13198         (File_read::open): Use whole_file_view_ instead of contents_.
13199         (File_read::find_view): Use whole_file_view_ if applicable.
13200         (File_read::do_read): Use whole_file_view_ instead of contents_.
13201         (File_read::make_view): Use whole_file_view_ instead of contents_,
13202         update File_read::View::View call.
13203         (File_read::find_or_make_view): Update File_read::View::View
13204         call.
13205         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
13206         remove contents_
13207         (File_read::View::Data_ownership): New enum.
13208         (File_read::View::View): Replace bool mapped_ with Data_ownership
13209         argument.
13210         (File_read::View::mapped_): Remove (replaced by data_ownership_).
13211         (File_read::View::data_ownership_): New field.
13212         (File_read::contents_): Remove (replaced by whole_file_view_).
13213         (File_read::whole_file_view_): New field.
13214         * options.h (class General_options): Add --keep-files-mapped.
13215
13216 2009-10-27  Cary Coutant  <ccoutant@google.com>
13217
13218         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
13219         * testsuite/Makefile.am (plugin_test_5): New test case.
13220         * testsuite/Makefile.in: Regenerate.
13221
13222 2009-10-25  Doug Kwan  <dougkwan@google.com>
13223
13224         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
13225         from private to protected to allow access by child class.
13226         (Sized_relobj::do_relocate_sections): New method declaration.
13227         (Sized_relobj::relocate_sections): Virtualize.
13228         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
13229         Sized_relobj::relocate_sections.  Instantiate template explicitly
13230         for different target sizes and endianity.
13231
13232 2009-10-24  Doug Kwan  <dougkwan@google.com>
13233
13234         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
13235         (Arm_input_section::as_arm_input_section): New method.
13236         (Arm_output_section): New class definition.
13237         (Arm_output_section::create_stub_group,
13238         Arm_output_section::group_sections): New method definitions.
13239
13240 2009-10-22  Doug Kwan  <dougkwan@google.com>
13241
13242         * arm.cc (Arm_input_section): New class definition.
13243         (Arm_input_section::init, Arm_input_section:do_write,
13244         Arm_input_section::set_final_data_size,
13245         Arm_input_section::do_reset_address_and_file_offset): New method
13246         definitions.
13247
13248 2009-10-21  Doug Kwan  <dougkwan@google.com>
13249
13250         * arm.cc (Stub_table, Arm_input_section): New forward class
13251         declarations.
13252         (Stub_table): New class defintion.
13253         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
13254         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
13255         New method definition.
13256
13257 2009-10-21  Doug Kwan  <dougkwan@google.com>
13258
13259         * arm.cc: Update copyright comments.
13260         (Target_arm): New forward class template declaration.
13261         (Arm_address): New type.
13262         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
13263         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
13264         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
13265         constants.
13266         (Insn_template): Same.
13267         (DEF_STUBS): New macro.
13268         (Stub_type): New enum type.
13269         (Stub_template): New class definition.
13270         (Stub): Same.
13271         (Reloc_stub): Same.
13272         (Stub_factory): Same.
13273         (Target_arm::Target_arm): Initialize may_use_blx_ and
13274         should_force_pic_veneer_.
13275         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
13276         Target_arm::should_force_pic_veneer,
13277         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
13278         Target_arm::using_thumb_only, Target_arm:;default_target): New
13279         method defintions.
13280         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
13281         New data member declarations.
13282         (Insn_template::size, Insn_template::alignment): New method defintions.
13283         (Stub_template::Stub_template): New method definition.
13284         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
13285         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
13286         (Stub_factory::Stub_factory): New method definition.
13287         * gold.h (string_hash): New template.
13288         * output.h (Input_section_specifier::hash_value): Use
13289         gold::string_hash.
13290         (Input_section_specifier::string_hash): Remove.
13291         * stringpool.cc (Stringpool_template::string_hash): Use
13292         gold::string_hash.
13293
13294 2009-10-20  Doug Kwan  <dougkwan@google.com>
13295
13296         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
13297         symbols of relaxed input sections.
13298         * output.h (Output_section::find_relaxed_input_section): Make
13299         method public.
13300
13301 2009-10-16  Doug Kwan  <dougkwan@google.com>
13302
13303         * dynobj.cc (Versions::Versions): Initialize version_script_.
13304         Only insert base version symbol definition for a shared object
13305         if version script defines any version versions.
13306         (Versions::define_base_version): New method definition.
13307         (Versions::add_def): Check that base version is not needed.
13308         (Versions::add_need): Define base version lazily.
13309         * dynobj.h (Versions::define_base_version): New method declaration.
13310         (Versions::needs_base_version_): New data member declaration.
13311         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
13312         (check_DATA): Add no_version_test.stdout.
13313         (libno_version_test.so, no_version_test.o no_version_test.stdout):
13314         New make rules.
13315         * testsuite/Makefile.in: Regenerate.
13316         * testsuite/no_version_test.c: New file.
13317         * testsuite/no_version_test.sh: Ditto.
13318
13319 2009-10-16  Doug Kwan  <dougkwan@google.com>
13320
13321         * expression.cc (class Segment_start_expression): New class definition.
13322         (Segment_start_expression::value): New method definition.
13323         (script_exp_function_segment_start): Return a new
13324         Segment_start_expression.
13325         * gold/script-c.h (script_saw_segment_start_expression): New function
13326         prototype.
13327         * script-sections.cc (Script_sections::Script_sections): Initialize
13328         SAW_SEGMENT_START_EXPRESSION_ to false.
13329         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
13330         and -Tbbs options to specify section addresses if given in
13331         command line and no SEGMENT_START expression is seen in a script.
13332         * script-sections.h (Script_sections::saw_segment_start_expression,
13333         Script_sections::set_saw_segment_start_expression): New method
13334         definition.
13335         (Script_sections::saw_segment_start_expression_): New data member
13336         declaration.
13337         * script.cc (script_saw_segment_start_expression): New function.
13338         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
13339         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
13340         script_test_7.sh and script_test_8.sh.
13341         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
13342         script_test_8.stdout.
13343         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
13344         (script_test_6, script_test_6.stdout, script_test_7,
13345         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
13346         * Makefile.in: Regenerate.
13347         * testsuite/script_test_6.sh: New file.
13348         * testsuite/script_test_6.t: Same.
13349         * testsuite/script_test_7.sh: Same.
13350         * testsuite/script_test_7.t: Same.
13351         * testsuite/script_test_8.sh: Same.
13352
13353 2009-10-16  Doug Kwan  <dougkwan@google.com>
13354
13355         * output.cc (Output_segment::set_section_list_address): Cast
13356         expressions to unsigned long long type to avoid format warnings.
13357
13358 2009-10-15  Ian Lance Taylor  <iant@google.com>
13359
13360         * script.cc (Script_options::add_symbol_assignment): Always add a
13361         dot assignment to script_sections_.
13362         * script-sections.cc (Script_sections::add_dot_assignment):
13363         Initialize if necessary.
13364
13365         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
13366         program headers with no load segment if there is a linker script.
13367
13368         * layout.cc (Layout::set_segment_offsets): Align the file offset
13369         to the segment aligment for -N or -n with no load segment.
13370         * output.cc (Output_segment::add_output_section): Don't crash if
13371         the first section is a TLS section.
13372         (Output_segment::set_section_list_addresses): Print an error
13373         message if the address moves backward in a linker script.
13374         * script-sections.cc
13375         (Output_section_element_input::set_section_addresses): Don't
13376         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
13377         (Orphan_output_section::set_section_addresses): Likewise.
13378
13379 2009-10-15  Doug Kwan  <dougkwan@google.com>
13380
13381         * layout.cc (Layout::finish_dynamic_section): Generate tags
13382         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
13383         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
13384         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
13385
13386 2009-10-14  Ian Lance Taylor  <iant@google.com>
13387
13388         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
13389         fields.
13390         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
13391         data_shdr fields of relinfo.
13392         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
13393         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
13394         R_386_TLS_LDO_32, adjust based on section flags.
13395         (Target_i386::Relocate::fix_up_ldo): Remove.
13396
13397 2009-10-13  Ian Lance Taylor  <iant@google.com>
13398
13399         Add support for -pie.
13400         * options.h (class General_options): Add -pie and
13401         --pic-executable.
13402         (General_options::output_is_position_independent): Test -pie.
13403         (General_options::output_is_executable): Return true if not shared
13404         and not relocatable.
13405         (General_options::output_is_pie): Remove.
13406         * options.cc (General_options::finalize): Reject incompatible uses
13407         of -pie.
13408         * gold.cc (queue_middle_tasks): A -pie link is not static.
13409         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
13410         * symtab.cc (Symbol::final_value_is_known): Return false if
13411         output_is_position_independent.
13412         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
13413         output_is_position_independent.
13414         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
13415         output_is_position_independent.
13416         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
13417         output_is_position_independent.
13418         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
13419         two_file_pie_test.
13420         (basic_pie_test.o, basic_pie_test): New targets.
13421         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
13422         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
13423         (two_file_pie_test): New target.
13424         * testsuite/Makefile.in: Rebuild.
13425         * README: Remove note saying that -pie is not supported.
13426
13427 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
13428
13429         * options.h (class General_options): Add -init and -fini.
13430         * layout.cc (Layout::finish_dynamic_section): Emit
13431         given init and fini functions.
13432
13433 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
13434
13435         * gc.h (gc_process_relocs): Check if icf is enabled using new
13436         function.
13437         * gold.cc (queue_initial_tasks): Likewise.
13438         (queue_middle_tasks): Likewise.
13439         * object.cc (do_layout): Likewise.
13440         * symtab.cc (is_section_folded): Likewise.
13441         * main.cc (main): Likewise.
13442         * reloc.cc (Read_relocs::run): Likewise.
13443         (Sized_relobj::do_scan_relocs): Likewise.
13444         * icf.cc (is_function_ctor_or_dtor): New function.
13445         (Icf::find_identical_sections): Check if function is ctor or dtor when
13446         safe icf is chosen.
13447         * options.h (General_options::icf): Change option to be an enum.
13448         (Icf_status): New enum.
13449         (icf_enabled): New method.
13450         (icf_safe_folding): New method.
13451         (set_icf_status): New method.
13452         (icf_status_): New variable.
13453         * (options.cc) (General_options::finalize): Set icf_status_.
13454         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
13455         icf_test and icf_keep_unique_test to use the --icf enum flag.
13456         * testsuite/icf_safe_test.sh: New file.
13457         * testsuite/icf_safe_test.cc: New file.
13458
13459 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
13460
13461         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
13462         includes to gc.h and icf.h.
13463         * arm.cc: Include gc.h.
13464         * gold.cc: Likewise.
13465         * i386.cc: Likewise.
13466         * powerpc.cc: Likewise.
13467         * sparc.cc: Likewise.
13468         * x86_64.cc: Likewise.
13469         * gc.h: Include icf.h.
13470
13471 2009-10-11  Ian Lance Taylor  <iant@google.com>
13472
13473         * plugin.cc: Include "gold.h" before other header files.
13474
13475 2009-10-10  Chris Demetriou  <cgd@google.com>
13476
13477         * options.h (Input_file_argument::Input_file_type): New enum.
13478         (Input_file_argument::is_lib_): Replace with...
13479         (Input_file_argument::type_): New member.
13480         (Input_file_argument::Input_file_argument): Take Input_file_type
13481         'type' rather than boolean 'is_lib' as second argument.
13482         (Input_file_argument::is_lib): Use type_.
13483         (Input_file_argument::is_searched_file): New function.
13484         (Input_file_argument::may_need_search): Handle is_searched_file.
13485         * options.cc (General_options::parse_library): Support -l:filename.
13486         (General_options::parse_just_symbols): Update for Input_file_argument
13487         changes.
13488         (Command_line::process): Likewise.
13489         * archive.cc (Archive::get_file_and_offset): Likewise.
13490         * plugin.cc (Plugin_manager::release_input_file): Likewise.
13491         * script.cc (read_script_file, script_add_file): Likewise.
13492         * fileread.cc (Input_file::Input_file): Likewise.
13493         (Input_file::will_search_for): Handle is_searched_file.
13494         (Input_file::open): Likewise.
13495         * readsyms.cc (Read_symbols::get_name): Likewise.
13496         * testsuite/Makefile.am (searched_file_test): New test.
13497         * testsuite/Makefile.in: Regenerate.
13498         * testsuite/searched_file_test.cc: New file.
13499         * testsuite/searched_file_test_lib.cc: New file.
13500
13501 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13502             Ian Lance Taylor  <iant@google.com>
13503
13504         * descriptor.cc: Include <cstdio> and "binary-io.h".
13505         (Descriptors::open): Open the files in binary mode always.
13506         * script.cc (Lex::get_token): Treat \r as whitespace.
13507
13508 2009-10-09  Ian Lance Taylor  <iant@google.com>
13509
13510         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
13511
13512 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13513             Ian Lance Taylor  <iant@google.com>
13514
13515         * configure.ac: Check for readv function also.
13516         * fileread.cc (readv): Define if not HAVE_READV.
13517         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
13518         does not exist.
13519         * config.in: Regenerate.
13520         * configure: Regenerate.
13521
13522 2009-10-09  Doug Kwan  <dougkwan@google.com>
13523
13524         * layout.cc (Layout::make_output_section): Call target hook to make
13525         ordinary output section.
13526         (Layout::finalize): Adjust parameter list of call the
13527         Target::may_relax().
13528         * layout.h (class Layout::section_list): New method.
13529         * merge.h (Output_merge_base::entsize): Change visibility to public.
13530         (Output_merge_base::is_string, Output_merge_base::do_is_string):
13531         New methods.
13532         (Output_merge_string::do_is_string): New method.
13533         * object.cc (Sized_relobj::do_setup): renamed from
13534         Sized_relobj::set_up.
13535         * object.h (Sized_relobj::adjust_shndx,
13536         Sized_relobj::initializ_input_to_output_maps,
13537         Sized_relobj::free_input_to_output_maps): Change visibilities to
13538         protected.
13539         (Sized_relobj::setup): Virtualize.
13540         (Sized_relobj::do_setup): New method declaration.
13541         (Sized_relobj::invalidate_section_offset,
13542         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
13543         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
13544         * options.cc (parse_int): New function.
13545         * options.h (parse_int): New declaration.
13546         (DEFINE_int): New macro.
13547         (stub_group_size): New option.
13548         * output.cc (Output_section::Output_section): Initialize memebers
13549         merge_section_map_, merge_section_by_properties_map_,
13550         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
13551         (Output_section::add_input_section): Handled deferred code-fill
13552         generation and remove an old comment.
13553         (Output_section::add_relaxed_input_section): New method definition.
13554         (Output_section::add_merge_input_section): Use merge section by
13555         properties map to speed to search.  Update merge section maps
13556         as appropriate.
13557         (Output_section::build_relaxation_map): New method definition.
13558         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
13559         Same.
13560         (Output_section::relax_input_section): Renamed to
13561         Output_section::convert_input_sections_to_relaxed_sections and change
13562         interface to take a vector of pointers to relaxed sections.
13563         (Output_section::find_merge_section,
13564         Output_section::find_relaxed_input_section): New method definitions.
13565         (Output_section::is_input_address_mapped,
13566         Output_section::output_offset, Output_section::output_address):
13567         Use output section data maps to speed up searching.
13568         (Output_section::find_starting_output_address): Add comments.
13569         (Output_section::do_write,
13570         Output_section::write_to_postprocessing_buffer): Do code-fill
13571         generation as appropriate.
13572         (Output_section::get_input_sections): Invalidate relaxed input section
13573         map.
13574         (Output_section::restore_states): Adjust type of checkpoint .
13575         Invalidate relaxed input section map.
13576         * output.h (Output_merge_base): New class declaration.
13577         (Input_section_specifier): New class defintion.
13578         (class Output_relaxed_input_section) Change base class to
13579         Output_section_data_build.
13580         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
13581         base class initializer.
13582         (Output_section::add_relaxed_input_section): New method declaration.
13583         (Output_section::Input_section): Change visibility to protected.
13584         (Output_section::Input_section::relobj,
13585         Output_section::Input_section::shndx): Handle relaxed input sections.
13586         Output_section::input_sections) Change visibility to protected.  Also
13587         define overload to return a non-const pointer.
13588         (Output_section::Merge_section_properties): New class defintion.
13589         (Output_section::Merge_section_by_properties_map,
13590         Output_section::Output_section_data_by_input_section_map,
13591         Output_section::Relaxation_map): New types.
13592         (Output_section::relax_input_section): Rename method to
13593         Output_section::convert_input_sections_to_relaxed_sections and change
13594         interface to take a vector of relaxed section pointers.
13595         (Output_section::find_merge_section,
13596         Output_section::find_relaxed_input_section,
13597         Output_section::build_relaxation_map,
13598         Output_section::convert_input_sections_in_list_to_relaxed_sections):
13599         New method declarations.
13600         (Output_section::merge_section_map_
13601         Output_section::merge_section_by_properties_map_,
13602         Output_section::relaxed_input_section_map_,
13603         Output_section::is_relaxed_input_section_map_valid_,
13604         Output_section::generate_code_fills_at_write_): New data members.
13605         * script-sections.cc
13606         (Output_section_element_input::set_section_addresses): Call
13607         current_data_size and addralign methods of relaxed input sections.
13608         (Orphan_output_section::set_section_addresses): Call current_data_size
13609         and addralign methods of relaxed input sections.
13610         * symtab.cc (Symbol_table::compute_final_value): Extract template
13611         from the body of Symbol_table::sized_finalize_symbol.
13612         (Symbol_table::sized_finalized_symbol): Call
13613         Symbol_table::compute_final_value.
13614         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
13615         (Symbol_table::compute_final_value): New templated method declaration.
13616         * target.cc (Target::do_make_output_section): New method defintion.
13617         * target.h (Target::make_output_section): New method declaration.
13618         (Target::relax): Add more parameters for input objects, symbol table
13619         and layout.  Adjust call to do_relax.
13620         (Target::do_make_output_section): New method declaration.
13621         (Target::do_relax): Add parameters for input objects, symbol table
13622         and layout.
13623
13624 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13625
13626         * pread.c: Include stdio.h.
13627
13628 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13629
13630         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
13631         defined.
13632
13633 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13634
13635         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
13636         Change read_shndx type to unsigned int.
13637         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13638         int.
13639         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13640         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
13641         Change read_shndx type to unsigned int.
13642         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13643         int.
13644         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13645         * layout.cc (Layout::create_symtab_sections): Cast the result of
13646         local_symcount * symsize to off_t in the gold_assert.
13647
13648 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13649
13650         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
13651         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
13652         R_ARM_BASE_ABS.
13653         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
13654         (Arm_relocate_functions::thm_abs5): New function.
13655         (Arm_relocate_functions::abs12): New function.
13656         (Arm_relocate_functions::abs16): New function.
13657         (Arm_relocate_functions::base_abs): New function.
13658         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
13659         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
13660         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
13661         R_ARM_BASE_ABS.
13662         (Scan::global): Likewise.
13663         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
13664         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
13665         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
13666         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
13667         R_ARM_BASE_ABS.
13668
13669 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13670
13671         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
13672         (Arm_relocate_functions::movt_prel): New function.
13673         (Arm_relocate_functions::thm_movw_prel_nc): New function.
13674         (Arm_relocate_functions::thm_movt_prel): New function.
13675         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
13676         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
13677         (Scan::global, Relocate::relocate): Likewise.
13678         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13679
13680 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13681
13682         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
13683         Incremental_checker.
13684         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
13685         unsigned int.
13686         (class Incremental_inputs_header): New class.
13687         (Incremental_inputs_header_writer): Edit comment.
13688         (Incremental_inputs_entry): New class.
13689         (Incremental_inputs_entry_writer): Edit comment.
13690         (Sized_incremental_binary::do_find_incremental_inputs_section):
13691         Add *strtab_shndx parameter, fill it.
13692         (Sized_incremental_binary::do_check_inputs): New method.
13693         (Incremental_checker::can_incrementally_link_output_file): Use
13694         Sized_incremental_binary::check_inputs.
13695         (Incremental_inputs::report_command_line): Save command line in
13696         command_line_.
13697         * incremental.h:
13698         (Incremental_binary::find_incremental_inputs_section): New
13699         method.
13700         (Incremental_binary::do_find_incremental_inputs_section): Add
13701         strtab_shndx parameter.
13702         (Incremental_binary::do_check_inputs): New pure virtual method.
13703         (Sized_incremental_binary::do_check_inputs): Declare.
13704         (Incremental_checker::Incremental_checker): Add incremental_inputs
13705         parameter, use it to initialize incremental_inputs_.
13706         (Incremental_checker::incremental_inputs_): New field.
13707         (Incremental_checker::command_line): New method.
13708         (Incremental_checker::inputs): New method.
13709         (Incremental_checker::command_line_): New field.
13710
13711 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13712
13713         * incremental.cc: Include <cstdarg> and "target-select.h".
13714         (vexplain_no_incremental): New function.
13715         (explain_no_incremental): New function.
13716         (Incremental_binary::error): New method.
13717         (Sized_incremental_binary::do_find_incremental_inputs_section): New
13718         method.
13719         (make_sized_incremental_binary): New function.
13720         (open_incremental_binary): New function.
13721         (can_incrementally_link_file): Add checks if output is ELF and has
13722         inputs section.
13723         * incremental.h: Include "elfcpp_file.h" and "output.h".
13724         (Incremental_binary): New class.
13725         (Sized_incremental_binary): New class.
13726         (open_incremental_binary): Declare.
13727         * object.cc (is_elf_object): Use
13728         elfcpp::Elf_recognizer::is_elf_file.
13729         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
13730         * output.h (Output_file::filesize): New method.
13731
13732 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13733
13734         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
13735         New function.
13736         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
13737         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
13738         function.
13739         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
13740         function.
13741         (Arm_relocate_functions::movw_abs_nc): New function.
13742         (Arm_relocate_functions::movt_abs): New function.
13743         (Arm_relocate_functions::thm_movw_abs_nc): New function.
13744         (Arm_relocate_functions::thm_movt_abs): New function.
13745         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
13746         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
13747         (Scan::global): Likewise.
13748         (Relocate::relocate): Likewise.
13749         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13750
13751 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13752
13753         * arm.cc (Arm_relocate_functions::got_prel) New function.
13754         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
13755         (Relocate::relocate): Likewise.
13756         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13757
13758 2009-10-06  Ian Lance Taylor  <iant@google.com>
13759
13760         * options.h (class General_options): Define
13761         split_stack_adjust_size parameter.
13762         * object.h (class Object): Add uses_split_stack_ and
13763         has_no_split_stack_ fields.  Add uses_split_stack and
13764         has_no_split_stack accessor functions.  Declare
13765         handle_split_stack_section.
13766         (class Reloc_symbol_changes): Define.
13767         (class Sized_relobj): Define Function_offsets.  Declare
13768         split_stack_adjust, split_stack_adjust_reltype, and
13769         find_functions.
13770         * object.cc (Object::handle_split_stack_section): New function.
13771         (Sized_relobj::do_layout): Call handle_split_stack_section.
13772         * dynobj.cc (Sized_dynobj::do_layout): Call
13773         handle_split_stack_section.
13774         * reloc.cc (Sized_relobj::relocate_sections): Call
13775         split_stack_adjust for executable sections in split_stack
13776         objects.  Pass reloc_map to relocate_section.
13777         (Sized_relobj::split_stack_adjust): New function.
13778         (Sized_relobj::split_stack_adjust_reltype): New function.
13779         (Sized_relobj::find_functions): New function.
13780         * target-reloc.h: Include "object.h".
13781         (relocate_section): Add reloc_symbol_changes parameter.  Change
13782         all callers.
13783         * target.h (class Target): Add calls_non_split method.  Declare
13784         do_calls_non_split virtual method.  Declare match_view and
13785         set_view_to_nop.
13786         * target.cc: Include "elfcpp.h".
13787         (Target::do_calls_non_split): New function.
13788         (Target::match_view): New function.
13789         (Target::set_view_to_nop): New function.
13790         * gold.cc (queue_middle_tasks): Give an error if mixing
13791         split-stack and non-split-stack objects with -r.
13792         * i386.cc (Target_i386::relocate_section): Add
13793         reloc_symbol_changes parameter.
13794         (Target_i386::do_calls_non_split): New function.
13795         * x86_64.cc (Target_x86_64::relocate_section): Add
13796         reloc_symbol_changes parameter.
13797         (Target_x86_64::do_calls_non_split): New function.
13798         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
13799         parameter.
13800         * powerpc.cc (Target_powerpc::relocate_section): Add
13801         reloc_symbol_changes parameter.
13802         * sparc.cc (Target_sparc::relocate_section): Add
13803         reloc_symbol_changes parameter.
13804         * configure.ac: Call AM_CONDITIONAL for the default target.
13805         * configure: Rebuild.
13806         * testsuite/Makefile.am (TEST_AS): New variable.
13807         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
13808         (check_DATA): Add split_i386 and split_x86_64 files.
13809         (SPLIT_DEFSYMS): Define.
13810         (split_i386_[1234n].o): New targets.
13811         (split_i386_[124]): New targets.
13812         (split_i386_[1234r].stdout): New targets.
13813         (split_x86_64_[1234n].o): New targets.
13814         (split_x86_64_[124]): New targets.
13815         (split_x86_64_[1234r].stdout): New targets.
13816         (MOSTLYCLEANFILES): Add new executables.
13817         * testsuite/split_i386.sh: New file.
13818         * testsuite/split_x86_64.sh: New file.
13819         * testsuite/split_i386_1.s: New file.
13820         * testsuite/split_i386_2.s: New file.
13821         * testsuite/split_i386_3.s: New file.
13822         * testsuite/split_i386_4.s: New file.
13823         * testsuite/split_i386_n.s: New file.
13824         * testsuite/split_x86_64_1.s: New file.
13825         * testsuite/split_x86_64_2.s: New file.
13826         * testsuite/split_x86_64_3.s: New file.
13827         * testsuite/split_x86_64_4.s: New file.
13828         * testsuite/split_x86_64_n.s: New file.
13829         * testsuite/testfile.cc (Target_test): Update relocation_section
13830         function.
13831         * testsuite/Makefile.in: Rebuild.
13832
13833 2009-10-06  Ian Lance Taylor  <iant@google.com>
13834
13835         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
13836         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
13837         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
13838         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
13839         the address on ldo_addrs_.
13840         (Target_i386::Relocate::fix_up_ldo): New function.
13841
13842 2009-10-06   Rafael Espindola  <espindola@google.com>
13843
13844         * plugin.cc (add_input_library): New.
13845         (Plugin::load): Add add_input_library to tv.
13846         (Plugin_manager::add_input_file): Add the is_lib argument.
13847         (add_input_file): Update call to Plugin_manager::add_input_file.
13848         (add_input_library): New.
13849         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
13850
13851 2009-09-30  Doug Kwan  <dougkwan@google.com>
13852
13853         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
13854         symbol and call Symbol::may_need_copy_reloc to determine if
13855         a copy reloc is needed.
13856         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
13857         nocopyreloc is given in command line.
13858         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
13859         given in command line.
13860         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
13861         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
13862         of the removed Target_i386::may_need_copy_reloc.
13863         * options.h (copyreloc): New option with default value false.
13864         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13865         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
13866         instead of the removed Target_powerpc::may_need_copy_reloc.
13867         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13868         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
13869         instead of the removed Target_sparc::may_need_copy_reloc.
13870         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
13871         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
13872         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
13873         instead of the removed Target_x86_64::may_need_copy_reloc.
13874
13875 2009-09-30  Ian Lance Taylor  <iant@google.com>
13876
13877         * object.h (class Object): Remove target_ field, and target,
13878         sized_target, and set_target methods.
13879         (Object::sized_target): Remove.
13880         (class Sized_relobj): Update declarations.  Remove sized_target.
13881         * object.cc (Sized_relobj::setup): Remove target parameter.
13882         Change all callers.
13883         (Input_objects::add_object): Don't do anything with the target.
13884         (make_elf_sized_object): Add punconfigured parameter.  Change all
13885         callers.  Set or test parameter target.
13886         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
13887         Change all callers.
13888         * parameters.cc (Parameters::set_target): Change parameter type to
13889         be non-const.
13890         (Parameters::default_target): Remove.
13891         (set_parameters_target): Change parameter type to be non-const.
13892         (parameters_force_valid_target): New function.
13893         (parameters_clear_target): New function.
13894         * parameters.h (class Parameters): Update declarations.  Remove
13895         default_target method.  Add sized_target and clear_target
13896         methods.  Change target_ to be non-const.
13897         (set_parameters_target): Update declaration.
13898         (parameters_force_valid_target): Declare.
13899         (parameters_clear_target): Declare.
13900         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
13901         as NULL if we aren't searching.
13902         (Add_symbols::run): Don't check for compatible target.
13903         * fileread.cc (Input_file::open_binary): Call
13904         parameters_force_valid_target.
13905         * gold.cc (queue_middle_tasks): Likewise.
13906         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
13907         set_target on object.
13908         * dynobj.h (class Sized_dynobj): Update declarations.
13909         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
13910         make_elf_object returns NULL.
13911         (Archive::include_member): Don't check whether object target is
13912         compatible.
13913         * output.cc (Output_section::add_input_section): Get target from
13914         parameters.
13915         (Output_section::relax_input_section): Likewise.
13916         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
13917         parameters.
13918         (Sized_relobj::do_scan_relocs): Likewise.
13919         (Sized_relobj::relocate_sections): Likewise.
13920         * resolve.cc (Symbol_table::resolve): Likewise.
13921         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
13922         parameter.  Change all callers.
13923         (Symbol_table::add_from_object): Get target from parameters.
13924         (Symbol_table::add_from_relobj): Don't check object target.
13925         (Symbol_table::add_from_dynobj): Likewise.
13926         (Symbol_table::define_special_symbol): Get target from
13927         parameters.
13928         * symtab.h (class Symbol_table): Update declaration.
13929         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
13930         parameter.  Change all callers.  Clear parameter target.
13931         (Binary_test): Test target here.
13932         * testsuite/object_unittest.cc (gold_testsuite): Remove
13933         target_test_pointer parameter.  Change all callers.
13934         (Object_test): Test target here.
13935
13936 2009-09-26  Ian Lance Taylor  <iant@google.com>
13937
13938         * testsuite/initpri1.c: Don't try to use constructor priorities if
13939         compiling with gcc before 4.3.
13940
13941 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
13942
13943         * testsuite/retain_symbols_file_test.sh (check_present): Change
13944         output file name to retain_symbols_file_test.stdout.
13945         (check_absent): Likewise.
13946
13947 2009-09-18  Craig Silverstein  <csilvers@google.com>
13948
13949         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
13950         * options.cc: Include <cerrno> and <fstream>.
13951         (General_options::finalize): Parse -retain-symbols-file tag.
13952         * options.h: New flag.
13953         (General_options): New method should_retain_symbol, new
13954         variable symbols_to_retain.
13955         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
13956         should_retain_symbol map.
13957         * testsuite/Makefile.am (retain_symbols_file_test): New test.
13958         * testsuite/Makefile.in: Regenerate.
13959         * testsuite/retain_symbols_file_test.sh: New file.
13960
13961 2009-09-18  Nick Clifton  <nickc@redhat.com>
13962
13963         * po/es.po: Updated Spanish translation.
13964
13965 2009-09-17  Doug Kwan  <dougkwan@google.com>
13966
13967         * debug.h (DEBUG_RELAXATION): New constant.
13968         (DEBUG_ALL): Add DEBUG_RELAXATION.
13969         (debug_string_to_enum): Add relaxation debug option.
13970         * layout.cc
13971         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
13972         Layout::Relaxation_debug_check::read_sections,
13973         Layout::Relaxation_debug_check::read_sections): New method definitions.
13974         (Layout::Layout): Initialize data members
13975         record_output_section_data_from_scrips_,
13976         script_output_section_data_list_ and relaxation_debug_check_.
13977         (Layout::save_segments, Layout::restore_segments,
13978         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13979         Layout::relaxation_loop_body): New method definitions.
13980         (Layout::finalize): Support relaxation.  Move section layout code to
13981         Layout::relaxation_loop_body.
13982         (Layout::set_asection_address_from_script): Move code for orphan
13983         section placement out.
13984         (Layout::place_orphan_sections_in_script): New method definition.
13985         * layout.h (Output_segment_headers, Output_file_header):
13986         New forward class declarations.
13987         (Layout::~Layout): Define.
13988         (Layout::new_output_section_data_from_script): New method definition.
13989         (Layout::place_orphan_sections_in_script): New method declaration.
13990         (Layout::Segment_states): New type declaration.
13991         (Layout::save_segments, Layout::restore_segments,
13992         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13993         Layout::relaxation_loop_body): New method declarations.
13994         (Layout::Output_section_data_list): New type declaration.
13995         (Layout::Relaxation_debug_check): New class definition.
13996         (Layout::record_output_section_data_from_script_,
13997         Layout::script_output_section_data_list_, Layout::segment_states_,
13998         Layout::relaxation_debug_check_): New data members.
13999         * output.cc: (Output_section_headers::do_size): New method definition.
14000         (Output_section_headers::Output_section_headers): Move size
14001         computation to Output_section_headers::do_size.
14002         (Output_segment_headers::do_size): New method definition.
14003         (Output_file_header::Output_file_header): Move size computation to
14004         Output_file_header::do_size and call it.
14005         (Output_file_header::do_size): New method definition.
14006         (Output_data_group::Output_data_group): Adjust call to
14007         Output_section_data.
14008         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
14009         (Output_symtab_xindex::do_write): Add array bound check.
14010         (Output_section::Input_section::print_to_mapfile): Handle
14011         RELAXED_INPUT_SECTION_CODE.
14012         (Output_section::Output_section): Initialize data member checkpoint_.
14013         (Output_section::~Output_section): Delete checkpoint object pointed
14014         by checkpoint_.
14015         (Output_section::add_input_section): Always add an Input_section if
14016         relaxing.
14017         (Output_section::add_merge_input_section): Add assert.
14018         (Output_section::relax_input_section): New method definition.
14019         (Output_section::set_final_data_size): Set load address to zero for
14020         an unallocated section.
14021         (Output_section::do_address_and_file_offset_have_reset_values):
14022         New method definition.
14023         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
14024         Handle relaxed input section.
14025         (Output_section::sort_attached_input_sections): Checkpoint input
14026         section list lazily.
14027         (Output_section::get_input_sections): Change type of input_sections to
14028         list of Simple_input_section pointers.  Checkpoint input section list
14029         lazily.  Also handle relaxed input sections.
14030         (Output_section::add_input_section_for_script): Take a reference to
14031         a Simple_input_section object instead of Relobj pointer and section
14032         index as parameter.  Handle relaxed input sections.
14033         (Output_section::save_states, Output_section::restore_states): New
14034         method definitions.
14035         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
14036         (Output_data::is_data_size_fixed): New method definition.
14037         (Output_data::reset_addresss_and_file_offset): Do not reset data size
14038         if it is fixed.
14039         (Output_data::address_and_file_offset_have_reset_values): New method
14040         definition.
14041         (Output_data::do_address_and_file_offset_have_reset_values): New method
14042         definition.
14043         (Output_data::set_data_size): Check that data size is not fixed.
14044         (Output_data::fix_data_size): New method definition.
14045         (Output_data::is_data_size_fixed_): New data member.
14046         (Output_section_headers::set_final_data_size): New method definition.
14047         (Output_section_headers::do_size): New method declaration.
14048         (Output_segment_headers::set_final_data_size): New method definition.
14049         (Output_segment_headers::do_size): New method declaration.
14050         (Output_file_header::set_final_data_size)::New method definition.
14051         (Output_file_header::do_size)::New method declaration.
14052         (Output_section_data::Output_section_data): Add new parameter
14053         is_data_size_fixed and use it to fix data size.
14054         (Output_data_const::Output_data_const): Adjust call to base class
14055         constructor and fix data size.
14056         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
14057         base class constructor and fix data size.
14058         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
14059         base class constructor and fix data size.
14060         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
14061         class constructor and fix data size.
14062         (Output_data_group::set_final_data_size): New method definition.
14063         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
14064         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
14065         class constructor and fix data size.
14066         (Output_relaxed_input_section): New class definition.
14067         (Output_section::Simple_input_section): New class definition.
14068         (Output_section::get_input_sections): Adjust parameter list.
14069         (Output_section::add_input_section_for_script): Same.
14070         (Output_section::save_states, Output_section::restore_states,
14071         Output_section::do_address_and_file_offset_have_reset_values,
14072         (Output_section::Input_section::Input_section): Handle
14073         RELAXED_INPUT_SECTION_CODE.  Add new overload for
14074         Output_relaxed_input_section.
14075         (Output_section::Input_section::is_input_section,
14076         Output_section::Input_section::set_output_section): Handle relaxed
14077         input section.
14078         (Output_section::Input_section::is_relaxed_input_section,
14079         Output_section::Input_section::output_section_data,
14080         Output_section::Input_section::relaxed_input_section): New method
14081         definitions.
14082         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
14083         value.
14084         (Output_section::Input_section::u1_): Update comments.
14085         (Output_section::Input_section::u2_): Add new union member poris.
14086         (Output_section::Checkpoint_output_section): New classs definition.
14087         (Output_section::relax_input_section): New method declaration.
14088         (Output_section::checkpoint_): New data member.
14089         (Output_segment): Update comments.
14090         (Output_segment::Output_segment): Un-privatize copy constructor.
14091         (Output_segment::operator=): Un-privatize.
14092         * script-sections.cc (Output_section_element::Input_section_list):
14093         Change element type to Output_section::Simple_input_section.
14094         (Output_section_element_dot_assignment::set_section_addresses):
14095         Register output section data for relaxation clean up.
14096         (Output_data_exression::Output_data_expression): Adjust call to base
14097         constructor to fix data size.
14098         (Output_section_element_data::set_section_addresses): Register
14099         Output_data_expression object for relaxation clean up.
14100         (struct Input_section_info): Replace Relobj pointer and section index
14101         pair with Output_section::Simple_input_section and Convert struct to a
14102         class.
14103         (Input_section_sorter::operator()): Adjust access to
14104         Input_section_info data member to use accessors.
14105         (Output_section_element_input::set_section_addresses): Use layout
14106         parameter.  Adjust code to use Output_section::Simple_input_section
14107         and Input_secction_info classes.  Register filler for relaxation
14108         clean up.
14109         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
14110         and section index pair with Output_section::Simple_input_section
14111         class.  Adjust code accordingly.
14112         (Phdrs_element::release_segment): New method definition.
14113         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
14114         segment list.
14115         (Script_sections::release_segments): New method definition.
14116         * gold/script-sections.h (Script_sections::release_segments): New
14117         method declaration.
14118         * gold/target.h (Target::may_relax, Target::relax,
14119         Target::do_may_relax, Target::do_relax): New method definitions.
14120
14121 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
14122
14123         * arm.cc (has_signed_unsigned_overflow): New function.
14124         (Arm_relocate_functions::abs8): New function.
14125         (Target_arm::Scan::local): Handle R_ARM_ABS8.
14126         (Target_arm::Scan::global): Likewise.
14127         (Target_arm::relocate::relocate): Likewise.
14128         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
14129         Likewise.
14130
14131 2009-09-16  Cary Coutant  <ccoutant@google.com>
14132
14133         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
14134         * testsuite/Makefile.in: Regenerate.
14135
14136 2009-09-11  Nick Clifton  <nickc@redhat.com>
14137
14138         * po/gold.pot: Updated by the Translation project.
14139
14140 2009-09-08  Cary Coutant  <ccoutant@google.com>
14141
14142         * output.cc (Output_file::open): Add execute permission to empty file.
14143         * testsuite/Makefile.am (permission_test): New test.
14144         * testsuite/Makefile.in: Regenerate.
14145
14146 2009-09-02  Ian Lance Taylor  <iant@google.com>
14147
14148         * output.cc (Output_file::resize): Call map_no_anonymous rather
14149         than map.
14150
14151 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
14152
14153         * gold.cc: Include "incremental.h".
14154         (queue_initial_tasks): Call Incremental_checker methods.
14155         * incremental.cc: Include "output.h".
14156         (Incremental_checker::can_incrementally_link_output_file): New
14157         method.
14158         * incremental.h (Incremental_checker): New class.
14159
14160         * output.cc (Output_file::open_for_modification): New method.
14161         (Output_file::map_anonymous): Changed return type to bool.  Record
14162         map in base_ field.
14163         (Output_file::map_no_anonymous): New method, broken out of map.
14164         (Output_file::map): Use map_no_anonymous and map_anonymous.
14165         * output.h (class Output_file): Update declarations.
14166
14167 2009-08-24  Cary Coutant  <ccoutant@google.com>
14168
14169         * options.h (Command_line::Pre_options): New class.
14170         (Command_line::pre_options): New member.
14171         * options.cc (gold::options::ready_to_register): New variable.
14172         (One_option::register_option): Do nothing if not registering options.
14173         Assert if same short option registered twice.
14174         (General_options::General_options): Turn off option registration when
14175         done constructing.
14176         (Command_line::Pre_options::Pre_options): New constructor.
14177
14178 2009-08-24  Cary Coutant  <ccoutant@google.com>
14179
14180         * options.h (General_options::no_keep_memory): Remove incorrect
14181         short option.
14182
14183 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
14184
14185         * Makefile.am (am__skiplex, am__skipyacc): New.
14186         * Makefile.in: Regenerate.
14187
14188 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
14189
14190         * Makefile.am (AM_CPPFLAGS): Renamed from ...
14191         (INCLUDES): ... this.
14192         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
14193         (AM_CPPFLAGS): Renamed from ...
14194         (INCLUDE): ... this.
14195         * Makefile.in, testsuite/Makefile.in: Regenerate.
14196
14197         * Makefile.in: Regenerate.
14198         * aclocal.m4: Likewise.
14199         * config.in: Likewise.
14200         * configure: Likewise.
14201         * testsuite/Makefile.in: Likewise.
14202
14203         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
14204         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
14205         * Makefile.in: Regenerate.
14206         * testsuite/Makefile.in: Regenerate.
14207
14208 2009-08-19  Cary Coutant  <ccoutant@google.com>
14209
14210         * resolve.cc (Symbol_table::resolve): Don't complain about defined
14211         symbols in shared libraries overridden by hidden or internal symbols
14212         in the main program.
14213
14214 2009-08-19  Chris Demetriou  <cgd@google.com>
14215
14216         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
14217         checking source file names in error messages.
14218
14219 2009-08-18  Doug Kwan  <dougkwan@google.com>
14220
14221         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
14222         an elcpp::Ehdr as parameter.  Adjust call to set_target.
14223         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
14224         an elfcpp::Ehdr as parameter.
14225         * object.cc (Object::set_target): Remove the version that looks up
14226         a target and sets it.
14227         (Sized_relobj::setup): Take a Target object instead of
14228         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
14229         (make_elf_sized_object): Find target and ask target to
14230         make an ELF object.
14231         * object.h: (Object::set_target): Remove the version that looks up
14232         a target and sets it.
14233         (Sized_relobj::setup): Take a Target object instead of
14234         an elfcpp:Ehdr as parameter.
14235         * target.cc: Include dynobj.h.
14236         (Target::do_make_elf_object_implementation): New.
14237         (Target::do_make_elf_object): New.
14238         * target.h (Target::make_elf_object): New template declaration.
14239         (Target::do_make_elf_object): New method declarations.
14240         (Target::do_make_elf_object_implementation): New template declaration.
14241
14242 2009-08-14  Ian Lance Taylor  <iant@google.com>
14243
14244         * gold.h (FUNCTION_NAME): Define.
14245         (gold_unreachable): Use FUNCTION_NAME.
14246
14247 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
14248
14249         * icf.cc (Icf::find_identical_sections): Issue a warning when a
14250         symbol in the --keep-unique list is not found.
14251
14252 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
14253
14254         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
14255         been maked as --keep-unique.
14256         (Icf::unfold_section): New function.
14257         * icf.h (Icf::unfold_section): New function.
14258         * options.h (General_options::keep_unique): New option.
14259         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
14260         * testsuite/Makefile.in: Regenerate.
14261         * testsuite/icf_keep_unique_test.sh: New file.
14262         * testsuite/icf_keep_unique_test.cc: New file.
14263
14264 2009-08-12  Cary Coutant  <ccoutant@google.com>
14265
14266         PR 10471
14267         * resolve.cc (Symbol_table::resolve): Check for references from
14268         dynamic objects to hidden and internal symbols.
14269         * testsuite/Makefile.am (hidden_test.sh): New test.
14270         * testsuite/Makefile.in: Regenerate.
14271         * testsuite/hidden_test.sh: New script.
14272         * testsuite/hidden_test_1.c: New test source.
14273         * testsuite/hidden_test_main.c: New test source.
14274
14275 2009-08-11  Doug Kwan  <dougkwan@google.com>
14276
14277         * arm.cc: Update comments.
14278         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
14279         segment to locate the .ARM.exidx section if present.
14280
14281 2009-08-09  Doug Kwan  <dougkwan@google.com>
14282
14283         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
14284         patch.
14285
14286 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
14287         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
14288         compiler warnings.
14289
14290 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
14291
14292         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
14293         valid tls_segment only for non-debug-section relocations.
14294         * testsuite/Makefile.am: Add gc_tls_test.
14295         * testsuite/Makefile.in: Regenerate.
14296         * testsuite/gc_tls_test.cc: New file.
14297         * testsuite/gc_tls_test.sh: New file.
14298
14299 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
14300
14301         * icf.cc: New file.
14302         * icf.h: New file.
14303         * Makefile.am (CCFILES): Add icf.cc.
14304         (HFILES): Add icf.h
14305         * Makefile.in: Regenerate.
14306         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
14307         * gc.h (gc_process_relocs): Populate lists used by icf to contain
14308         section, symbol and addend information for the relocs.
14309         * gold.cc (queue_middle_tasks): Call identical code folding.
14310         * gold.h: Add defines for multimap.
14311         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
14312         to the call of finalize_local_symbols.
14313         * main.cc (main): Create object of class Icf.
14314         * object.cc (Sized_relobj::do_layout): Allow this function to be
14315         called twice during icf.
14316         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
14317         to sections marked as identical by icf.
14318         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
14319         when available.
14320         (Sized_relobj::do_section_entsize): New function.
14321         * object.h (Object::section_entsize): New function.
14322         (Object::do_section_entsize): New pure virtual function.
14323         (Relobj::finalize_local_symbols): Add new parameter.
14324         (Relobj::do_section_entsize): New function.
14325         * options.h (General_options::icf): New option.
14326         (General_options::icf_iterations): New option.
14327         (General_options::print_icf_sections): New option.
14328         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
14329         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
14330         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
14331         icf.
14332         * symtab.cc (Symbol_table::is_section_folded): New function.
14333         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
14334         to sections marked as identical by icf.
14335         * symtab.h (Symbol_table::set_icf): New function.
14336         (Symbol_table::icf): New function.
14337         (Symbol_table::is_section_folded): New function.
14338         (Symbol_table::icf_): New data member.
14339         * target-reloc.h (relocate_section): Ignore sections folded by icf.
14340         * testsuite/Makefile.am: Add commands to build icf_test.
14341         * testsuite/Makefile.in: Regenerate.
14342         * testsuite/icf_test.sh: New file.
14343         * testsuite/icf_test.cc: New file.
14344
14345 2009-07-24  Chris Demetriou  <cgd@google.com>
14346
14347         * layout.cc (is_compressible_debug_section): Fix incorrect
14348         comment about compressed section names.
14349
14350 2009-07-20  Ian Lance Taylor  <ian@airs.com>
14351
14352         PR 10419
14353         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
14354
14355 2009-07-16  Ian Lance Taylor  <iant@google.com>
14356
14357         PR 10400
14358         * layout.h: #include <map>.
14359         (class Kept_section): Change from struct to class.  Add accessors
14360         and setters.  Add section size to Comdat_group mapping.  Change
14361         Comdat_group to std::map.  Add is_comdat_ field.  Add
14362         linkonce_size field in union.
14363         (class Layout): Update declaration of find_or_add_kept_section.
14364         Don't declare find_kept_object.
14365         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
14366         parameter.  Add object, shndx, is_comdat, and is_group_name
14367         parameters.  Change all callers.  Adjust for new Kept_section.
14368         (Layout::find_kept_object): Remove.
14369         * object.cc (Sized_relobj::include_section_group): Update use of
14370         Kept_section.  Rename secnum to shndx.  Only record
14371         Kept_comdat_section if sections are the same size.
14372         (Sized_relobj::include_linkonce_section): Update use of
14373         Kept_section.  Only record Kept_comdat_section if sections are the
14374         same size.  Set size of linkonce section.
14375         (Sized_relobj::map_to_kept_section): Update call to
14376         get_kept_comdat_section.
14377         * object.h (class Sized_relobj): Rename fields in
14378         Kept_comdat_section to drop trailing underscores; change object
14379         field to Relobj*.  Change Kept_comdat_section_table to store
14380         struct rather than pointer.
14381         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
14382         Add kept_object and kept_shndx parameters.  Change all callers.
14383         (Sized_relobj::get_kept_comdat_section): Change return type to
14384         bool.  Add kept_object and kept_shndx parameters.  Change all
14385         callers.
14386         * plugin.cc (Pluginobj::include_comdat_group): Update call to
14387         Layout::find_or_add_kept_section.
14388
14389 2009-07-09  Ian Lance Taylor  <iant@google.com>
14390
14391         * merge.cc (Object_merge_map::initialize_input_to_output_map):
14392         Reserve space in the hash table.
14393
14394 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
14395
14396         * fileread.cc (File_read::get_mtime): New method.
14397         * fileread.h (Timespec): New structure.
14398         (File_read::get_mtime): New method.
14399         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
14400         Renamed from timestamp_nsec.
14401         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
14402         Elf_Xword.
14403         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
14404         timestamp_nsec.
14405         (Incremental_inputs::report_archive): Save mtime; style fix.
14406         (Incremental_inputs::report_obejct): Save mtime; style fix.
14407         (Incremental_inputs::report_script): Save mtime; style fix.
14408         (Incremental_inputs::finalize_inputs): Style fix.
14409         (Incremental_inputs::finalize): Style fix.
14410         (Incremental_inputs::create_input_section_data): Store inputs
14411         mtime.
14412         * incremental.h (Incremental_inputs::report_script): Add mtime
14413         argument.
14414         (Incremental_inputs::Input_info::Input_info): Intialize only one
14415         union member.
14416         (Incremental_inputs::Input_info::archive): Move to nameless
14417         union.
14418         (Incremental_inputs::Input_info::obejct): Move to nameless union.
14419         (Incremental_inputs::Input_info::script): Move to nameless union.
14420         (Incremental_inputs::mtime): New field.
14421         * script.cc (read_input_script): Pass file mtime to
14422         Incremental_input.
14423         * script.h (Script_info::inputs): Style fix.
14424
14425 2009-07-01  Ian Lance Taylor  <ian@airs.com>
14426
14427         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
14428         instead of 32.
14429
14430 2009-06-24  Ian Lance Taylor  <iant@google.com>
14431
14432         PR 10156
14433         * layout.cc (Layout::choose_output_section): If we find an
14434         existing section, update the flags.
14435         (Layout::create_notes): New function, broken out of
14436         Layout::finalize.
14437         (Layout::finalize): Don't create note sections.
14438         (Layout::create_note): Don't crash if linker script discards
14439         section.
14440         (Layout::create_gold_note): Likewise.
14441         (Layout::create_build_id): Likewise.  Don't set
14442         after_input_sections on the section.
14443         (Layout::create_executable_stack_info): Remove target parameter.
14444         Change caller.
14445         * layout.h (class Layout): Declare create_notes.  Update
14446         declaration of create_executable_stack_info.
14447         * gold.cc (queue_middle_tasks): Call create_notes.
14448         * output.cc (Output_section::update_flags_for_input_section): Move
14449         here from output.h.  If SHF_ALLOC flag is newly set, mark address
14450         invalid.
14451         * output.h (Output_data::mark_address_invalid): New function.
14452         (class Output_section): Only declare, not define,
14453         update_flags_for_input_section.  Remove set_flags.
14454
14455 2009-06-24  Ian Lance Taylor  <iant@google.com>
14456
14457         * script-sections.cc (Output_section_definition::
14458         set_section_addresses): Rename shadowing local load_address to
14459         laddr.
14460
14461 2009-06-24  Ian Lance Taylor  <iant@google.com>
14462
14463         PR 10244
14464         * reloc.cc (relocate_sections): Skip empty relocation sections.
14465
14466 2009-06-23  Ian Lance Taylor  <iant@google.com>
14467
14468         PR 10156
14469         * layout.cc (Layout::create_note): Use choose_output_section
14470         rather than make_output_section.
14471
14472 2009-06-23  Ian Lance Taylor  <iant@google.com>
14473
14474         PR 10237
14475         * options.cc (General_options::parse_V): Set printed_version_.
14476         (General_options::General_options): Initialize printed_version_.
14477         * options.h (class General_options): Add printed_version_ field.
14478         * gold.cc (queue_initial_tasks): If there are no input files,
14479         don't give a fatal error if we printed the version information.
14480         (queue_middle_tasks): If using -r with a shared object, give a
14481         fatal error rather than an ordinary error.
14482
14483 2009-06-23  Ian Lance Taylor  <iant@google.com>
14484
14485         PR 10219
14486         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
14487         (Layout::make_output_section): Set have_stabstr_section_ if we see
14488         a .stab*str section.
14489         (Layout::finalize): Call link_stabs_sections.
14490         (Layout::link_stabs_sections): New file.
14491         * layout.h (class Layout): Add have_stabstr_section_ field.
14492         Declare link_stabs_sections.
14493
14494 2009-06-23  Doug Kwan  <dougkwan@google.com>
14495
14496         * Makefile.am (libgold_a_LIBADD): New.
14497         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
14498         * Makefile.in: Regenerate.
14499         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
14500         * configure: Regenerate.
14501         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
14502         * fileread.cc: Include sys/state.h
14503         * gold.h: Declare memmem and strndup if found missing.
14504         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
14505
14506 2009-06-23  Ian Lance Taylor  <iant@google.com>
14507
14508         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
14509         * configure: Rebuild.
14510
14511 2009-06-23  Ian Lance Taylor  <iant@google.com>
14512
14513         PR 10147
14514         * object.cc (Object::section_contents): Don't try to get a view if
14515         the section has length zero.
14516         (Object::handle_gnu_warning_section): If the section is empty, use
14517         the name of the section as the warning.
14518
14519 2009-06-23  Ian Lance Taylor  <iant@google.com>
14520
14521         PR 10133
14522         * stringpool.h (class Stringpool_template): Add optimize_ field.
14523         (Stringpool_template::set_optimize): New function.
14524         * stringpool.cc (Stringpool_template::Stringpool_template):
14525         Initialize optimize_ field.
14526         (Stringpool_template::set_string_offsets): Test local optimize
14527         fild rather than parameter.
14528         * layout.cc (Layout::Layout): Call set_optimize on the section
14529         name stringpool.
14530
14531 2009-06-22  Ian Lance Taylor  <iant@google.com>
14532
14533         PR 10030
14534         * yyscript.y: Parse TARGET.
14535         * script.cc (script_set_target): New function.
14536         * script-c.h (script_set_target): Declare.
14537         * options.cc (General_options::string_to_object_format): Rename
14538         from string_to_object_format in anonymous namespace.  Change
14539         callers.
14540         * options.h (class General_options): Declare
14541         string_to_object_format.
14542
14543 2009-06-22  Ian Lance Taylor  <iant@google.com>
14544
14545         * script-sections.cc (Script_sections::create_segments): Don't put
14546         program headers in a PT_LOAD segment if -n or -N.
14547
14548 2009-06-22  Ian Lance Taylor  <iant@google.com>
14549
14550         PR 10141
14551         * options.h (class General_options): Add -z lazy and -z now.  Sort
14552         -z options into alphabetical order.
14553         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
14554
14555 2009-06-21  Ian Lance Taylor  <iant@google.com>
14556
14557         * layout.cc (Layout::make_output_section): Call
14558         Target::new_output_section.
14559         (Layout::attach_allocated_section_to_segment): Put large section
14560         sections in a separate load segment with the large segment flag
14561         set.
14562         (Layout::segment_precedes): Sort large data segments after other
14563         load segments.
14564         (align_file_offset): New static function.
14565         (Layout::set_segment_offsets): Use align_file_offset.
14566         * output.h (class Output_section): Add is_small_section_ and
14567         is_large_section_ fields.
14568         (Output_section::is_small_section): New function.
14569         (Output_section::set_is_small_section):  New function.
14570         (Output_section::is_large_section): New function.
14571         (Output_section::set_is_large_section): New function.
14572         (Output_section::is_large_data_section): New function.
14573         (class Output_segment): Add is_large_data_segment_ field.
14574         (Output_segment::is_large_data_segment): New function.
14575         (Output_segment::set_is_large_data_segment): New function.
14576         * output.cc (Output_section::Output_section): Initialize new
14577         fields.
14578         (Output_segment::Output_segment): Likewise.
14579         (Output_segment::add_output_section): Add assertion that large
14580         data sections always go in large data segments.  Force small data
14581         sections to the end of the list of data sections.  Force small BSS
14582         sections to the start of the list of BSS sections.  For large BSS
14583         sections to the end of the list of BSS sections.
14584         * symtab.h (class Symbol): Declare is_common_shndx.
14585         (Symbol::is_defined): Check Symbol::is_common_shndx.
14586         (Symbol::is_common): Likewise.
14587         (class Symbol_table): Define enum Commons_section_type.  Update
14588         declarations.  Add small_commons_ and large_commons_ fields.
14589         * symtab.cc (Symbol::is_common_shndx): New function.
14590         (Symbol_table::Symbol_table): Initialize new fields.
14591         (Symbol_table::add_from_object): Put small and large common
14592         symbols in the right list.
14593         (Symbol_table::sized_finalized_symbol): Check
14594         Symbol::is_common_shndx.
14595         (Symbol_table::sized_write_globals): Likewise.
14596         * common.cc (Symbol_table::do_allocate_commons): Allocate new
14597         common symbol lists.  Don't call do_allocate_commons_list if the
14598         list is empty.
14599         (Symbol_table::do_allocate_commons_list): Remove is_tls
14600         parameter.  Add comons_section_type parameter.  Change all
14601         callers.  Handle small and large common symbols.
14602         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
14603         Symbol::is_common_shndx.
14604         * resolve.cc (symbol_to_bits): Likewise.
14605         * target.h (Target::small_common_shndx): New function.
14606         (Target::small_common_section_flags): New function.
14607         (Target::large_common_shndx): New function.
14608         (Target::large_common_section_flags): New function.
14609         (Target::new_output_section): New function.
14610         (Target::Target_info): Add small_common_shndx, large_common_shndx,
14611         small_common_section_flags, and large_common_section_flags
14612         fields.
14613         (Target::do_new_output_section): New virtual function.
14614         * arm.cc (Target_arm::arm_info): Initialize new fields.
14615         * i386.cc (Target_i386::i386_info): Likewise.
14616         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
14617         Likewise.
14618         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
14619         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14620         (Target_x86_64::do_new_output_section): New function.
14621         * configure.ac: Define conditional MCMODEL_MEDIUM.
14622         * testsuite/Makefile.am (check_PROGRAMS): Add large.
14623         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
14624         (large_LDFLAGS): Define.
14625         * testsuite/large.c: New file.
14626         * testsuite/testfile.cc (Target_test::test_target_info):
14627         Initialize new fields.
14628         * configure, testsuite/Makefile.in: Rebuild.
14629
14630 2009-06-05  Doug Kwan  <dougkwan@google.com>
14631
14632         * Makefile.am (CCFILES): Add target.cc.
14633         * Makefile.in: Regenerate.
14634         * i386.cc (class Target_i386): Define new virtual method to
14635         override do_is_local_label_name in parent.
14636         * object.cc (Sized_relobj::do_count_local_symbols): Discard
14637         local symbols if --discard-locals or -X is given.
14638         * options.h (class General_options): Declare new options
14639         '--discard-locals' and '-X' for discarding locals.
14640         * target.h (class Target): Define new methods is_local_label_name.
14641         Declare new virtual method do_is_local_label_name.
14642         * target.cc: New file.
14643         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
14644         (check_SCRIPTS): Add discard_locals_test.sh.
14645         (check_DATA): Add discard_local_tests.syms.
14646         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
14647         (discard_local_tests.syms, discard_locals_test.o): New make rules.
14648         * testsuite/Makefile.in: Regenerate.
14649         * testsuite/discard_locals_test.c: New file.
14650         * testsuite/discard_locals_test.sh: Same.
14651
14652 2009-06-05  Doug Kwan  <dougkwan@google.com>
14653
14654         * object.cc (Sized_relobj::Sized_relobj): Initialize
14655         discarded_eh_frame_shndx_ to -1U.
14656         (Sized_relobj::do_layout): Record index of a discard .eh_frame
14657         section.
14658         (Sized_relobj::do_count_local_symbols): Skip local symbols in
14659         a discarded .eh_frame section.
14660         (Sized_relobj::do_finalize_local_symbols): Ditto.
14661         * object.h (class Sized_relobj): Declare new member
14662         discarded_eh_frame_shndx_.
14663         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
14664         (local_labels_test.o, local_labels_test): New rules.
14665         * testsuite/Makefile.in: Regenerate.
14666
14667 2009-06-04  Doug Kwan  <dougkwan@google.com>
14668
14669         * layout.cc (Layout::section_name_mapping): Add mapping for
14670         special ARM sections.
14671
14672 2009-06-03  Doug Kwan  <dougkwan@google.com>
14673
14674         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
14675         (utils::has_overflow): Same.
14676
14677 2009-06-03  Ian Lance Taylor  <iant@google.com>
14678
14679         * layout.cc (Layout::section_name_mapping): New array, replacing
14680         Layout::linkonce_mapping.
14681         (Layout::section_name_mapping_count): New variable, replacing
14682         Layout::linkonce_mapping_count.
14683         (Layout::linkonce_output_name): Remove.
14684         (Layout::output_section_name): Rewrite.
14685         * layout.h (class Layout): Rename Linkonce_mapping to
14686         Section_name_mapping, linkonce_mapping to section_name_mapping,
14687         linkonce_mapping_count to section_name_mapping_count.  Don't
14688         declare linkonce_output_name.
14689
14690 2009-06-03  Doug Kwan  <dougkwan@google.com>
14691
14692         * gold/arm.cc (namespace utils): New.
14693         (Target_arm::reloc_is_non_pic): Define new method.
14694         (class Arm_relocate_functions): New.
14695         (Target_arm::Relocate::relocate): Handle relocation types used by
14696         Android.
14697
14698 2009-06-03  Ian Lance Taylor  <iant@google.com>
14699
14700         * arm.cc (Target_arm::scan::global): Use || instead of |.
14701
14702 2009-06-02  Doug Kwan  <dougkwan@google.com>
14703
14704         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
14705         issued_non_pic_error_.
14706         (class Target_arm::Scan): Declare new method check_non_pic.
14707         Define new method symbol_needs_plt_entry.
14708         Declare new data member issued_non_pic_error_.
14709         (class Target_arm::Relocate): Declare new method
14710         should_apply_static_reloc.
14711         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
14712         (Target_arm::Scan::check_non_pic): Define new method.
14713         (Target_arm::Scan::local): Handle a small subset of reloc types used
14714         by Android.
14715         (Target_arm::Scan::local): Same.
14716         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
14717
14718 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
14719
14720         * incremental.cc (Incremental_inputs::report_command_line): Filter
14721         out --incremental-* options.
14722
14723 2009-05-29  Doug Kwan  <dougkwan@google.com>
14724
14725         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
14726         template class.
14727         (class Target_arm): Update comment.
14728         (Target_arm::Target_arm): Initialize new data members GOT_,
14729         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
14730         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
14731         and Target_arm::rel_dyn_section.
14732         Declare new_enum Target_arm::Got_type.
14733         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
14734         and DYNBSS_.
14735         Update commments for member do_dynsym_value.
14736         (Target_arm::got_size, Target_arm::plt_section,
14737         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
14738         new methods inside class defintion.
14739         (Target_arm::got_section): Define new method.
14740         (Target_arm::rel_dyn_section): Same.
14741         (Output_data_plt_arm): New template class.
14742         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
14743         (Output_data_plt_arm:do_adjust_output_section): Define new method.
14744         (Output_data_plt_arm::add_entry): Same.
14745         (Output_data_plt_arm::first_plt_entry): Define new
14746         static data member for PLT instruction template.
14747         (Output_data_plt_arm::plt_entry): Same.
14748         (Output_data_plt_arm::do_write): Define new method.
14749         (Target_arm::make_plt_entry): Same.
14750         (Target_arm::do_finalize_sections): Same.
14751         (Target_arm::do_dynsym_value): Same.
14752
14753 2009-05-28  Doug Kwan  <dougkwan@google.com>
14754
14755         * Makefile.am (TARGETSOURCES): Add arm.cc.
14756         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
14757         * Makefile.in: Regenerate.
14758         * arm.cc: New file.
14759         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
14760
14761 2009-05-26  Doug Kwan  <dougkwan@google.com>
14762
14763         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
14764         (General_options::check_excluded_libs): Strip off directories in
14765         archive name before matching like GNU ld does.
14766         * testsuite/Makefile.am (MOSTLYCLEANFILES,
14767         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
14768         (exclude_libs_test_LDFLAGS): Add linker option
14769         -Wl,--exclude-libs,libexclude_libs_test_3
14770         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
14771         an explicit archive without using -l.
14772         (alt/libexclude_libs_test_3.a): New make rule.
14773         * testsuite/Makefile.in: Regenerate.
14774         * testsuite/exclude_libs_test.c : Declare lib3_default().
14775         (main): Call it.
14776         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
14777         * exclude_libs_test_3.c: New file.
14778
14779 2009-05-26  Nick Clifton  <nickc@redhat.com>
14780
14781         * po/id.po: New Indonesian translation.
14782         * po/gold.pot: Updated template file.
14783
14784 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
14785
14786         * testsuite/Makefile.am: Add -ffunction-sections to compile
14787         gc_comdat_test files.  Add -Wl,--gc-sections to build
14788         gc_comdat_test.
14789         * testsuite/Makefile.in: Regenerate.
14790         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
14791
14792 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
14793
14794         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
14795         kept comdat section was garbage collected.
14796         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
14797         * testsuite/Makefile.in: Regenerate.
14798         * testsuite/gc_comdat_test.sh: New file.
14799         * testsuite/gc_comdat_test_1.cc: New file.
14800         * testsuite/gc_comdat_test_2.cc: New file.
14801
14802 2009-05-19  Doug Kwan  <dougkwan@google.com>
14803
14804         * archive.cc (Archive::Archive): Move constructor from archive.h
14805         to here.  Initialize no_export_.
14806         (Archive::get_elf_object_for_member): Set no_export flag of object.
14807         * archive.h (Archive::Archive): Move constructor body to
14808         archive.cc.
14809         (Archive::no_export): New method.
14810         (Archive::no_export_): New field.
14811         * object.h (Object::Object): Initialize no_export_ to false.
14812         (Object::no_export, Object::set_no_export): New methods.
14813         (Object::no_export_): New field.
14814         * options.cc (General_options::parse_exclude_libs): New method.
14815         (General_options::check_excluded_libs) Same.
14816         * options.h (exclude_libs): New option.
14817         (General_options::check_excluded_libs): New method declaration.
14818         (General_options::excluded_libs_): New field.
14819         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
14820         default or protected visibility if an object has no-export flag set.
14821         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
14822         (check_SCRIPTS): Add exclude_libs_test.sh.
14823         (check_DATA): Add exclude_libs_test.syms.
14824         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
14825         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
14826         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
14827         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
14828         (exclude_libs_test.syms, libexclude_libs_test_1.a,
14829         libexclude_libs_test_2.a): New rules.
14830         * testsuite/Makefile.in: Regenerate.
14831         * testsuite/exclude_libs_test.c: New file.
14832         * testsuite/exclude_libs_test.sh: Ditto.
14833         * testsuite/exclude_libs_test_1.c: Ditto.
14834         * testsuite/exclude_libs_test_2.c: Ditto.
14835
14836 2009-05-15  Ian Lance Taylor  <iant@google.com>
14837
14838         * configure.ac: Check for declarations for cases where libiberty.h
14839         checks HAVE_DECL_xxx.
14840         * configure, config.in: Rebuild.
14841
14842 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
14843
14844         * gold.h (Incremental_argument_list): Remove (invalid) forward
14845         declaration.
14846         * incremental.cc (Incremental_inputs::report_achive): New method.
14847         (Incremental_inputs::report_object): New method.
14848         (Incremental_inputs::report_script): New method.
14849         (Incremental_inputs::finalize_inputs): New method.
14850         (Incremental_inputs::finalize): Call finalize_inputs().
14851         (Incremental_inputs::sized_create_incremental_inputs_section_data):
14852         Create inputs entries.
14853         * incremental.h (Incremental_input_type): New enum.
14854         (Incremental_inputs::Incremental_input): Initialize new fields.
14855         (Incremental_inputs::report_inputs): New method.
14856         (Incremental_inputs::report_achive): New method.
14857         (Incremental_inputs::report_object): New method.
14858         (Incremental_inputs::report_script): New method.
14859         (Incremental_inputs::finalize_inputs): New method.
14860         (Incremental_inputs::Input_info): New struct.
14861         (Incremental_inputs::Input_info_map): New typedef.
14862         (Incremental_inputs::lock_): New field.
14863         (Incremental_inputs::Inputs_): New field.
14864         (Incremental_inputs::Inputs_map): New field.
14865         * main.cc (main): Call Incremental_input::report_inputs.
14866         * options.h (Input_argument_list): Typedef moved from
14867         Input_arguments.
14868         (Input_file_group::Files): Remove, use ::Input_argument_list.
14869         (Input_file_group::Input_argument_list): Remove, use
14870         ::Input_argument_list.
14871         * plugin.cc (Plugin_manager::add_input_file): Add error in
14872         incremental build.
14873         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
14874         functions.
14875         * script.cc (read_input_script): Call
14876         Incremental_input::report_script.
14877         * script.h (Script_info): New class.
14878
14879 2009-04-27  Ian Lance Taylor  <iant@google.com>
14880
14881         * x86_64.cc (do_adjust_output_section): Set entsize to
14882         plt_entry_size.
14883
14884 2009-04-23  Elliott Hughes  <enh@google.com>
14885
14886         * output.cc (Output_file::close): After short writes, continue
14887         writing from the correct offset in the buffer being written.
14888
14889 2009-04-23  Chris Demetriou  <cgd@google.com>
14890
14891         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
14892         * configure: Regenerate.
14893         * config.in: Regenerate.
14894         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
14895         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
14896
14897 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
14898
14899         * incremental.cc (Incremental_inputs_header_data): Renamed from
14900         Incremental_input_header_data.
14901         (Incremental_inputs_header_data::data_size): New field.
14902         (Incremental_inputs_header_data::put_input_file_count): Renamed
14903         from input_file_count.
14904         (Incremental_inputs_header_data::put_command_line_offset): Renamed
14905         from command_line_offset.
14906         (Incremental_inputs_header_data::put_reserved): Renamed from
14907         put_reserved.
14908         (Incremental_inputs_entry_data): Renamed from
14909         Incremental_input_entry_data.
14910         (Incremental_inputs_entry_data::data_size): New field.
14911         (Incremental_inputs::report_command_line): New method.
14912         (Incremental_inputs::finalize): New method.
14913         (Incremental_inputs::create_incremental_inputs_data): New method.
14914         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
14915         * incremental.h: New file.
14916         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
14917         (Layout::finalize): Create incremental inputs section in
14918         incremental builds.
14919         (Layout::create_incremental_info_sections): New method.
14920         * layout.h (Layout::incremental_inputs): New method.
14921         (Layout::create_incremental_info_sections): New method.
14922         (Layout::incremental_inputs_): New field.
14923         * main.cc (main): Notify Incremental_input of the command line.
14924
14925 2009-04-01  Ian Lance Taylor  <iant@google.com>
14926             Mikolaj Zalewski  <mikolajz@google.com>
14927
14928         * gold.h (reserve_unordered_map): Define, three versions, one for
14929         each version of Unordered_map.
14930         * layout.cc (Layout::Layout): Remove options parameter.  Add
14931         number_of_input_files parameter.  Don't initialize options_.
14932         Initialize number_of_input_files_ and resized_signatures_.  Move
14933         sections_are_attached_.
14934         (Layout::layout_group): Reserve space for group_signatures_.
14935         (Layout::find_or_add_kept_section): Change name parameter to be a
14936         reference.  Resize signatures_ map when it gets large enough.
14937         (Layout::layout_eh_frame): Use parameters->options() instead of
14938         this->options_.
14939         (Layout::make_output_section): Likewise.
14940         (Layout::attach_allocated_section_to_segment): Likewise.
14941         (Layout::finalize, Layout::create_executable_stack): Likewise.
14942         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
14943         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
14944         * layout.h (class Layout): Update declarations.  Remove options_
14945         field.  Add number_of_input_files_ and resized_signatures_
14946         fields.  Move sections_are_attached_ field.
14947         * main.cc (main): Pass number of input files to Layout
14948         constructor.  Don't pass options.
14949
14950 2009-03-30  Ian Lance Taylor  <iant@google.com>
14951
14952         * ffsll.c (ffsll): Correct implementation.
14953
14954 2009-03-27  Ian Lance Taylor  <iant@google.com>
14955
14956         * ffsll.c: New file.
14957         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
14958         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
14959         * ftruncate.c (ftruncate): Declare before definition.
14960         * mremap.c (mremap): Likewise.
14961         * pread.c (pread): Likewise.
14962         * configure, Makefile.in, config.in: Rebuild.
14963
14964         * mremap.c: New file.
14965         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
14966         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
14967         (mremap): Declare if HAVE_MREMAP is not defined.
14968         * configure, Makefile.in, config.in: Rebuild.
14969
14970 2009-03-27  Cary Coutant  <ccoutant@google.com>
14971
14972         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
14973         position independent.
14974         * sparc.cc (Target_sparc::check_non_pic): Likewise.
14975         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
14976
14977 2009-03-24  Cary Coutant  <ccoutant@google.com>
14978
14979         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
14980         an executable.
14981         (needs_dynamic_reloc): Likewise.
14982
14983 2009-03-24  Ian Lance Taylor  <iant@google.com>
14984
14985         * yyscript.y (file_cmd): Recognize EXTERN.
14986         (extern_name_list, extern_name_list_body): New nonterminals.
14987         * script.cc (script_add_extern): Define.
14988         * script-c.h (script_add_extern): Declare.
14989
14990 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
14991
14992         * object.cc (is_elf_object): Define.
14993         * object.h (is_elf_object): Declare.
14994         * archive.cc (Archive::get_elf_object_for_member): Call
14995         is_elf_object.
14996         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
14997
14998 2009-03-24  Elliott Hughes  <enh@google.com>
14999
15000         * output.cc (Output_file::map_anonymous): Define.
15001         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
15002         try an anonymous one.  Report the size if the mmap fails.
15003         * output.h (class Output_file): Declare map_anonymous.
15004
15005 2009-03-24  Ian Lance Taylor  <iant@google.com>
15006
15007         * target-select.cc (instantiate_target): Don't acquire the lock if
15008         the instantiated_target_ field has already been set.
15009
15010 2009-03-23  Ian Lance Taylor  <iant@google.com>
15011
15012         * gold-threads.h (class Initialize_lock): Define.
15013         * gold-threads.cc (class Initialize_lock_once): Define.
15014         (initialize_lock_control): New static variable.
15015         (initialize_lock_pointer): New static variable.
15016         (initialize_lock_once): New static function.
15017         (Initialize_lock::Initialize_lock): Define.
15018         (Initialize_lock::initialize): Define.
15019         * target-select.h: Include "gold-threads.h".
15020         (class Target_selector): Add lock_ and initialize_lock_ fields.
15021         Don't define instantiate_target, just declare it.
15022         * target-select.cc (Target_selector::Target_selector): Initialize
15023         new fields.
15024         (Target_selector::instantiate_target): Define.
15025         * descriptors.h: Include "gold-threads.h".
15026         (class Descriptors): Add initialize_lock_ field.
15027         * descriptors.cc (Descriptors::Descriptors): Initialize new
15028         field.
15029         (Descriptors::open): Use initialize_lock_ field
15030         * errors.h (class Errors): Add initialize_lock_ field.
15031         * errors.cc (Errors::Errors): Initialize new field.
15032         (Errors::initialize_lock): Use initialize_lock_ field.
15033         * powerpc.cc (class Target_selector_powerpc): Remove
15034         instantiated_target_ field.  In do_recognize call
15035         instantiate_target rather than do_instantiate_target.  In
15036         do_instantiate_target just allocate a new target.
15037         * sparc.cc (class Target_selector_sparc): Likewise.
15038
15039         * freebsd.h: New file.
15040         * i386.cc: Include "freebsd.h".
15041         (Target_i386): Derive from Target_freebsd rather than
15042         Sized_target.
15043         (Target_selector_i386): Derive from Target_selector_freebsd rather
15044         than Target_selector.
15045         * x86_64.cc: Include "freebsd.h".
15046         (Target_x86_64): Derive from Target_freebsd rather than
15047         Sized_target.
15048         (Target_selector_x86_64): Derive from Target_selector_freebsd
15049         rather than Target_selector.
15050         * target.h (class Target): Add adjust_elf_header and
15051         do_adjust_elf_header.
15052         * output.cc (Output_file_header:: do_sized_write): Call target
15053         adjust_elf_header routine.
15054         * configure.tgt: Set targ_osabi.
15055         * configure.ac: Define GOLD_DEFAULT_OSABI.
15056         * parameters.cc (Parameters::default_target): Pass
15057         GOLD_DEFAULT_OSABI to select_target.
15058         * target-select.h (class Target_selector): Make instantiate_target
15059         protected rather than private.
15060         * Makefile.am (HFILES): Add freebsd.h.
15061         * configure, Makefile.in, config.in: Rebuild.
15062
15063         * merge.cc (do_add_input_section): Correct pend value.  Change
15064         message about last entry not being null terminated from error to
15065         warning.
15066
15067 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
15068
15069         * incremental.cc: New file.
15070         * Makefile.am (CCFILES): Add incremental.cc.
15071         * Makefile.in: Rebuild.
15072
15073 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
15074
15075         * layout.cc (Layout::output_section_name): Preserve names
15076         of '.note.' sections.
15077
15078 2009-03-19  Ian Lance Taylor  <iant@google.com>
15079
15080         * descriptors.cc (Descriptors::open): Check that the options are
15081         valid before using them.
15082
15083 2009-03-18  Ian Lance Taylor  <iant@google.com>
15084
15085         * script-sections.h: Include <list>.
15086         (class Script_sections): Change Sections_elements from std::vector
15087         to std::list.  Typedef public Elements_iterator.  Add
15088         orphan_section_placement_, data_segment_align_start_, and
15089         saw_data_segment_align_ fields.  Remove data_segment_align_index_
15090         field.
15091         * script-sections.cc (class Orphan_section_placement): New class.
15092         (class Sections_element): Add virtual functions is_relro and
15093         orphan_section_init.  Remove virtual function place_orphan_here.
15094         (class Output_section_definition): Add is_relro and
15095         orphan_section_init.  Remove place_orphan_here.
15096         (class Orphan_output_section): Likewise.
15097         (Script_sections::Script_sections): Update for field changes.
15098         (Script_sections::data_segment_align): Set saw_data_segment_align_
15099         and data_segment_align_start_, not data_segment_align_index.
15100         (Script_sections::data_segment_relro_end): Check
15101         saw_data_segment_align_.  Use data_segment_align_start_ rather
15102         than data_segment_align_index_.
15103         (Script_sections::place_orphan): Rewrite to use
15104         Orphan_section_placement.
15105
15106 2009-03-17  Ian Lance Taylor  <iant@google.com>
15107
15108         * archive.cc (Archive::add_symbols): Check for a version attached
15109         to the symbol name in the archive map.
15110         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
15111         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
15112         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
15113         (ver_test_11.a): New target.
15114         * testsuite/Makefile.in: Rebuild.
15115
15116         * configure.ac: Check for chsize and posix_fallocate.  Replace
15117         ftruncate.
15118         * ftruncate.c: New file, from gnulib.
15119         * output.cc (posix_fallocate): Define dummy version if not
15120         HAVE_POSIX_FALLOCATE.
15121         (Output_file::map): Call posix_fallocate rather than lseek and
15122         write.
15123         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
15124         * configure, Makefile.in, config.in: Rebuild.
15125
15126 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
15127
15128         * layout.h (Layout::create_note): Add section_name parameter.
15129         * layout.cc (Layout::create_note): Likewise.
15130         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
15131
15132 2009-03-17  Ian Lance Taylor  <iant@google.com>
15133
15134         * descriptors.cc: Include "options.h".
15135         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
15136         (Descriptors::open): Always use O_CLOEXEC when opening a new
15137         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
15138         then set FD_CLOEXEC.
15139
15140         * sparc.cc (class Target_sparc): Add has_got_section.
15141         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
15142         make sure we have a GOT section.
15143
15144         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
15145         (Target_sparc::Scan::local): Likewise.
15146         (Target_sparc::Scan::global): Likewise.
15147         (Target_sparc::Relocate::relocate): Likewise.
15148         (Target_sparc::Relocate::relocate_tls): Likewise.
15149
15150         * symtab.cc (Symbol_table::define_default_version): New function,
15151         broken out of add_from_object.
15152         (Symbol_table::add_from_object): Call define_default_version.
15153         (Symbol_table::define_special_symbol): Add resolve_oldsym
15154         parameter.  Change all callers.  If the version for a symbol comes
15155         from a version script, resolve it with the symbol with the same
15156         name with no version.  Also add the symbol without a version if
15157         appropriate.
15158         (do_define_in_output_data): If resolving with oldsym, don't delete
15159         sym.
15160         (do_define_in_output_segment): Likewise.
15161         (do_define_as_constant): Likewise.
15162         * symtab.h (class Symbol_table): Update declarations.
15163
15164 2009-03-13  Ian Lance Taylor  <iant@google.com>
15165
15166         * readsyms.cc (Read_symbols::incompatible_warning): New function.
15167         (Read_symbols::requeue): New function.
15168         (Read_symbols::do_read_symbols): If make_elf_object fails because
15169         the target type is not configured, and the file was searched for,
15170         issue a warning and retry with the next directory.
15171         (Add_symbols::run): If the file has an incompatible format, and
15172         it was searched for, requeue the Read_symbols task.  On error,
15173         release the object.
15174         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
15175         dirindex parameter to constructor.  Change all callers.  Declare
15176         incompatible_warning and requeue.
15177         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
15178         input_argument_ and input_group_ fields.  Add them to
15179         constructor.  Change all callers.
15180         (class Read_script): Add dirindex_ field.  Add it to constructor.
15181         Change all callers.
15182         * archive.cc (Archive::setup): Remove input_objects parameter.
15183         Change all callers.
15184         (Archive::get_file_and_offset): Likewise.
15185         (Archive::read_all_symbols): Likewise.
15186         (Archive::read_symbols): Likewise.
15187         (Archive::get_elf_object_for_member): Remove input_objects
15188         parameter.  Add punconfigured parameter.  Change all callers.
15189         (Archive::add_symbols): Change return type to bool.  Check return
15190         value of include_member.
15191         (Archive::include_all_members): Likewise.
15192         (Archive::include_member): Change return type to bool.  Return
15193         false if first included object has incompatible target.  Set
15194         included_member_ field.
15195         (Add_archive_symbols::run): If add_symbols returns false, requeue
15196         Read_symbols task.
15197         * archive.h (class Archive): Add included_member_ field.
15198         Initialize it in constructor.  Add input_file and searched_for
15199         methods.  Update declarations.
15200         (class Add_archive_symbols): Add dirpath_, dirindex_, and
15201         input_argument_ fields.  Add them to constructor.  Change all
15202         callers.
15203         * script.cc: Include "target-select.h".
15204         (class Parser_closure): Add skip_on_incompatible_target_ and
15205         found_incompatible_target_ fields.  Add
15206         skip_on_incompatible_target parameter to constructor.  Change all
15207         callers.  Add methods skip_on_incompatible_target,
15208         clear_skip_on_incompatible_target, found_incompatible_target, and
15209         set_found_incompatible_target.
15210         (read_input_script): Add dirindex parameter.  Change all callers.
15211         If parser finds an incompatible target, requeue Read_symbols
15212         task.
15213         (script_set_symbol): Clear skip_on_incompatible_target in
15214         closure.
15215         (script_add_assertion, script_parse_option): Likewise.
15216         (script_start_sections, script_add_phdr): Likewise.
15217         (script_check_output_format): New function.
15218         * script.h (read_input_script): Update declaration.
15219         * script-c.h (script_check_output_format): Declare.
15220         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
15221         (ignore_cmd): Remove OUTPUT_FORMAT.
15222         * fileread.cc (Input_file::Input_file): Add explicit this.
15223         (Input_file::will_search_for): New function.
15224         (Input_file::open): Add pindex parameter.  Change all callers.
15225         * fileread.h (class Input_file): Add input_file_argument method.
15226         Declare will_search_for.  Update declarations.
15227         * object.cc (make_elf_object): Add punconfigured parameter.
15228         Change all callers.
15229         * object.h (class Object): Make input_file public.  Add
15230         searched_for method.
15231         (make_elf_object): Update declaration.
15232         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
15233         restart search.
15234         * dirsearch.h (class Dirsearch): Update declaration.
15235         * options.h (class General_options): Add --warn-search-mismatch.
15236         * parameters.cc (Parameters::is_compatible_target): New function.
15237         * parameters.h (class Parameters): Declare is_compatible_target.
15238         * workqueue.cc (Workqueue::add_blocker): New function.
15239         * workqueue.h (class Workqueue): Declare add_blocker.
15240
15241         * fileread.cc (Input_file::open): Remove options parameter.
15242         Change all callers.
15243         (Input_file::open_binary): Likewise.
15244         * script.cc (read_input_script): Likewise.
15245         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
15246         options parameter from constructor.  Change all callers.
15247         (class Read_script): Likewise.
15248         * fileread.h (class Input_file): Update declarations.
15249         * script.h (read_input_script): Update declaration.
15250
15251 2009-03-10  Nick Clifton  <nickc@redhat.com>
15252
15253         * po/es.po: New Spanish translation.
15254
15255 2009-03-06  Cary Coutant  <ccoutant@google.com>
15256
15257         * options.cc (parse_short_option): Keep dash_z from registering itself.
15258
15259 2009-03-03  Ian Lance Taylor  <iant@google.com>
15260
15261         PR 9918
15262         * target-reloc.h (relocate_section): Pass output_section to
15263         relocate.
15264         * i386.cc (Target_i386::should_apply_static_reloc): Add
15265         output_section parameter.  Change all callers.
15266         (Target_i386::Relocate::relocate): Add output_section parameter.
15267         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15268         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
15269         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
15270         * testsuite/two_file_shared.sh: New script.
15271         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
15272         (check_DATA): Add two_file_shared.dbg.
15273         (two_file_shared.dbg): New target.
15274         * testsuite/Makefile.in: Rebuild.
15275
15276 2009-03-01  Ian Lance Taylor  <iant@google.com>
15277
15278         * configure.ac: Check for byteswap.h.
15279         * configure: Rebuild.
15280         * config.in: Rebuild.
15281
15282 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
15283
15284         * layout.cc (Layout::find_or_add_kept_section): New function.
15285         (Layout::add_comdat): Removed.
15286         * layout.h (struct Kept_section): Move out of class Layout.
15287         Remove trailing underscores from field names.  Add group_sections
15288         field.  Rename group_ field to is_group.  Change all uses.
15289         (class Layout): Declare find_or_add_kept_section, not add_comdat.
15290         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
15291         comdat_groups_ field.
15292         (Sized_relobj::include_section_group): Use
15293         find_or_add_kept_section and Kept_section::group_sections.
15294         (Sized_relobj::include_linkonce_section): Likewise.
15295         * object.cc (class Sized_relobj): Don't define Comdat_group or
15296         Comdat_group_table.  Remove find_comdat_group and
15297         add_comdat_group.  Remove comdat_groups_ field.
15298         * plugin.cc (include_comdat_group): Use
15299         Layout::find_or_add_kept_section.
15300
15301 2009-02-28  Ian Lance Taylor  <iant@google.com>
15302
15303         * README: --gc-sections and map files are now supported.  Document
15304         some build requirements.
15305
15306         PR 6992
15307         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
15308         relocatable link set the value of the section symbol to zero.
15309         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
15310         relocatable link don't include the section address in the local
15311         symbol value.
15312
15313 2009-02-27  Ian Lance Taylor  <iant@google.com>
15314
15315         PR 6811
15316         * options.h (class Search_directory): Add is_system_directory.
15317         (class General_options): Declare is_in_system_directory.
15318         * options.cc (get_relative_sysroot): Make static.
15319         (get_default_sysroot): Make static.
15320         (General_optoins::is_in_system_directory): New function.
15321         * fileread.cc (Input_file::is_in_system_directory): New function.
15322         * fileread.h (class Input_file): Declare is_in_system_directory.
15323         * object.h (class Object): Add is_in_system_directory.
15324         (class Input_objects): Remove system_library_directory_ field.
15325         * object.cc (Input_objects::add_object): Don't set
15326         system_library_directory_.
15327         (input_objects::found_in_system_library_directory): Remove.
15328         * symtab.cc (Symbol_table::write_globals): Remove input_objects
15329         parameter.  Change all callers.
15330         (Symbol_table::sized_write_globals): Likewise.
15331         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
15332         Call Object::is_in_system_directory.
15333         * symtab.h (class Symbol_table): Update declarations.
15334
15335         PR 5990
15336         * descriptors.h (Open_descriptor): Add is_on_stack field.
15337         * descriptors.cc (Descriptors::open): If the descriptor is on the
15338         top of the stack, remove it.  Initialize is_on_stack field.
15339         (Descriptors::release): Only add pod to stack if it is not on the
15340         stack already.
15341         (Descriptors::close_some_descriptor): Clear stack_next and
15342         is_on_stack fields.
15343
15344         PR 7091
15345         * output.cc (Output_section::find_starting_output_address): Rename
15346         from starting_output_address; add PADDR parameter; change return
15347         type.
15348         * output.h (class Output_section): Declare
15349         find_starting_output_address instead of starting_output_address.
15350         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
15351         section symbol for which we can't find a merge section.
15352
15353         PR 9836
15354         * symtab.cc (Symbol_table::add_from_object): If the visibility is
15355         hidden or internal, force the symbol to be local.
15356         * resolve.cc (Symbol::override_visibility): Define.
15357         (Symbol::override_base): Use override_visibility.
15358         (Symbol_table::resolve): Likewise.
15359         (Symbol::override_base_with_special): Likewise.
15360         (Symbol_table::override_with_special): If the visibility is hidden
15361         or internal, force the symbol to be local.
15362         * symtab.h (class Symbol): Add set_visibility and
15363         override_visibility.
15364         * testsuite/ver_test_1.sh: New file.
15365         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
15366         (check_DATA): Add ver_test_1.syms.
15367         (ver_test_1.syms): New target.
15368         * testsuite/Makefile.in: Rebuild.
15369
15370 2009-02-25  Cary Coutant  <ccoutant@google.com>
15371
15372         * layout.cc (Layout::choose_output_section): Don't rename sections
15373         when using a linker script that has a SECTIONS clause.
15374         * Makefile.in: Regenerate.
15375
15376         * testsuite/Makefile.am (script_test_5.sh): New test case.
15377         * testsuite/Makefile.in: Regenerate.
15378         * testsuite/script_test_5.cc: New file.
15379         * testsuite/script_test_5.sh: New file.
15380         * testsuite/script_test_5.t: New file.
15381
15382 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
15383
15384         * archive.cc (Archive::include_member): Update calls to add_symbols.
15385         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
15386         the Layout argument.
15387         * dynobj.h (do_add_symbols): Add the Layout argument.
15388         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
15389         Layout argument.
15390         * object.h (Object::add_symbols): Add the Layout argument.
15391         (Object::do_add_symbols): Add the Layout argument.
15392         (Sized_relobj::do_add_symbols): Add the Layout argument.
15393         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
15394         Unify the two versions.
15395         (Add_plugin_symbols): Remove.
15396         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
15397         (Sized_pluginobj::do_add_symbols): Unify the two versions.
15398         (Add_plugin_symbols): Remove.
15399         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
15400         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
15401         (Add_symbols::run): Make it work with Pulginobj.
15402
15403 2009-02-06  Ian Lance Taylor  <iant@google.com>
15404
15405         * object.cc (Sized_relobj::do_layout): Make info message start
15406         with lower case letter.
15407
15408 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
15409
15410         * binary.cc: Fix file comment.
15411
15412         * options.h (enum Incremental_disposition): Define.
15413         (class General_options): Add new options: --incremental,
15414         --incremental_changed, --incremental_unchanged,
15415         --incremental_unknown.  Add incremental_disposition_ and
15416         implicit_incremental_ fields.
15417         (General_options::incremental_disposition): New function.
15418         (class Position_dependent_options): Add incremental_disposition
15419         option.
15420         (Position_dependent_options::copy_from_options): Set incremental
15421         dispositions.
15422         * options.cc (General_options::parse_incremental_changed): New
15423         function.
15424         (General_options::parse_incremental_unchanged): New function.
15425         (General_options::parse_incremental_unknown): New function.
15426         (General_options::General_options): Initialize new fields
15427         incremental_disposition_ and implicit_incremental_.
15428         (General_options::finalize): Check for uasge of --incremental-*
15429         without --incremental.
15430
15431 2009-02-06  Chris Demetriou  <cgd@google.com>
15432
15433         * gold.h (gold_undefined_symbol): Change to take only a Symbol
15434         pointer and to report location as the file name associated with
15435         the symbol.
15436         (gold_undefined_symbol_at_location): New function to replace the
15437         old gold_undefined_symbol functionality.
15438         * target-reloc.h (relocate_section): Update to use
15439         gold_undefined_symbol_at_location.
15440         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15441         Call gold_undefined_symbol function rather than gold_error.
15442         * errors.h (Errors::undefined_symbol): Take location as a
15443         string, rather than calculating it from a relocation.
15444         * errors.cc (Errors::fatal): Print "fatal error:" before the
15445         formatted message.
15446         (Errors::error, Errors::error_at_location): Print "error: "
15447         before the formatted message.
15448         (Errors::undefined_symbol): Take location as a string, rather
15449         than calculating it from a relocation.
15450         (gold_undefined_symbol_at_location): New function akin to
15451         old gold_undefined_symbol, calculates location from relocation.
15452         (gold_undefined_symbol): Change to take only a Symbol pointer
15453         and to report location as the file name associated with the symbol.
15454         * testsuite/debug_msg.sh: Update for changed error messages.
15455         * testsuite/undef_symbol.sh: Likewise.
15456
15457 2009-02-04  Duncan Sands  <baldrick@free.fr>
15458
15459         PR 9812
15460         * reduced_debug_output.h
15461         (Output_reduced_debug_abbrev_section::failed): Use format for
15462         gold_warning.
15463         (Output_reduced_debug_info_section::faild): Likewise.
15464
15465 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
15466
15467         * script.cc (Lazy_demangler): New class.
15468         (Version_script_info::get_symbol_version_helper): Demangle a
15469         symbol only once.
15470
15471 2009-01-29  Cary Coutant  <ccoutant@google.com>
15472
15473         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
15474         to __tls_get_addr.
15475         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15476
15477 2009-01-28  Ian Lance Taylor  <iant@google.com>
15478
15479         * version.cc (version_string): Bump to 1.9.
15480
15481         * gold.h: Include <cstring> and <stdint.h>.
15482         * version.cc: Include <cstdio>.
15483         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
15484         warning.
15485         * reduced_debug_output.cc (insert_into_vector): Rename from
15486         Insert_into_vector; change all callers.  Use Swap_unaligned to
15487         avoid aliasing issue; remove union since it is unnecessary.
15488
15489 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
15490
15491         * Makefile.am (CCFILES): Add gc.cc.
15492         (HFILES): Add gc.h.
15493         * Makefile.in: Regenerate.
15494         * gold.cc (Gc_runner): New class.
15495         (queue_initial_tasks): Call garbage collection related tasks
15496         when corresponding options are invoked.
15497         (queue_middle_gc_tasks): New function.
15498         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
15499         processed early before laying out sections during garbage collection.
15500         * gold.h (queue_middle_gc_tasks): New function.
15501         (is_prefix_of): Move from "layout.cc".
15502         * i386.cc (Target_i386::gc_process_relocs): New function.
15503         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
15504         * main.cc (main): Create object of class "Garbage_collection".
15505         * object.cc (Relobj::copy_symbols_data): New function.
15506         (Relobj::is_section_name_included): New function.
15507         (Sized_relobj::do_layout): Allow this function to be called twice
15508         during garbage collection and defer layout of section during the
15509         first call.
15510         * object.h (Relobj::get_symbols_data): New function.
15511         (Relobj::is_section_name_included): New function.
15512         (Relobj::copy_symbols_data): New function.
15513         (Relobj::set_symbols_data): New function.
15514         (Relobj::get_relocs_data): New function.
15515         (Relobj::set_relocs_data): New function.
15516         (Relobj::is_output_section_offset_invalid): New pure virtual function.
15517         (Relobj::gc_process_relocs): New function.
15518         (Relobj::do_gc_process_relocs): New pure virtual function.
15519         (Relobj::sd_): New data member.
15520         (Sized_relobj::is_output_section_offset_invalid): New function.
15521         (Sized_relobj::do_gc_process_relocs): New function.
15522         * options.h (General_options::gc_sections): Modify to not be a no-op.
15523         (General_options::print_gc_sections): New option.
15524         * plugin.cc (Plugin_finish::run): Remove function call to
15525         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
15526         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
15527         * reloc.cc (Read_relocs::run): Add task to process relocs and
15528         determine unreferenced sections when doing garbage collection.
15529         (Gc_process_relocs): New class.
15530         (Sized_relobj::do_gc_process_relocs): New function.
15531         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
15532         sections that are garbage collected.
15533         * reloc.h (Gc_process_relocs): New class.
15534         * sparc.cc (Target_sparc::gc_process_relocs): New function.
15535         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
15536         symbols whose corresponding sections are garbage collected.
15537         (Symbol_table::Symbol_table): Add new parameter for the garbage
15538         collection object.
15539         (Symbol_table::gc_mark_undef_symbols): New function.
15540         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15541         (Symbol_table::gc_mark_dyn_syms): New function.
15542         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
15543         as garbage.
15544         (Symbol_table::add_from_object): Likewise.
15545         (Symbol_table::add_from_relobj): When building shared objects, do not
15546         treat externally visible symbols as garbage.
15547         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
15548         table information for static and relocatable links.
15549         * symtab.h (Symbol_table::set_gc): New function.
15550         (Symbol_table::gc): New function.
15551         (Symbol_table::gc_mark_undef_symbols): New function.
15552         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15553         (Symbol_table::gc_mark_dyn_syms): New function.
15554         (Symbol_table::gc_): New data member.
15555         * target.h (Sized_target::gc_process_relocs): New pure virtual
15556         function.
15557         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
15558         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
15559
15560 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
15561
15562         * options.h (General_options::gc_sections): Define as a no-op for now.
15563         (General_options::no_keep_memory): Ditto.
15564         (General_options::Bshareable): Define.
15565         * options.cc (General_options::finalize): Honor -Bshareable.
15566
15567 2009-01-20  Andreas Schwab  <schwab@suse.de>
15568
15569         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
15570         read the value in the contents, since we don't use it.  Use the
15571         template endianness when writing.
15572         (Relocate::relocate): Use it for R_PPC_REL16_HA.
15573
15574 2009-01-19  Andreas Schwab  <schwab@suse.de>
15575
15576         * configure.tgt (powerpc64-*): Fix targ_obj.
15577
15578 2009-01-15  Ian Lance Taylor  <iant@google.com>
15579
15580         * object.cc (Sized_relobj::write_local_symbols): Don't write out
15581         local symbols when stripping all symbols.
15582
15583 2009-01-14  Cary Coutant  <ccoutant@google.com>
15584
15585         * output.cc (Output_reloc): Add explicit instantiations.
15586
15587 2009-01-14  Cary Coutant  <ccoutant@google.com>
15588
15589         * archive.cc (Archive::get_elf_object_for_member): Remove call
15590         to File_read::claim_for_plugin.
15591         * descriptors.cc (Descriptors::open): Remove reference to
15592         is_claimed.
15593         (Descriptors::claim_for_plugin): Remove.
15594         * descriptors.h (Descriptors::claim_for_plugin): Remove.
15595         (Descriptors::is_claimed): Remove.
15596         (claim_descriptor_for_plugin): Remove.
15597         * fileread.cc (File_read::claim_for_plugin): Remove.
15598         * fileread.h (File_read::claim_for_plugin): Remove.
15599         (File_read::descriptor): Reopen descriptor if necessary.
15600         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
15601         (Plugin_manager::all_symbols_read): Add task parameter. Change
15602         all callers.
15603         (Plugin_manager::get_input_file): New function.
15604         (Plugin_manager::release_input_file): New function.
15605         (Pluginobj::Pluginobj): Add filesize parameter and initialize
15606         corresponding data member.
15607         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
15608         and pass to base constructor. Change all callers.
15609         (get_input_file, release_input_file): New functions.
15610         (make_sized_plugin_object): Add filesize parameter. Change all callers.
15611         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
15612         (Plugin_manager::all_symbols_read): Add task parameter.
15613         (Plugin_manager::get_input_file): New function.
15614         (Plugin_manager::release_input_file): New function.
15615         (Plugin_manager::task_): New data member.
15616         (Pluginobj::Pluginobj): Add filesize parameter.
15617         (Pluginobj::filename): New function.
15618         (Pluginobj::descriptor): New function.
15619         (Pluginobj::filesize): New function.
15620         (Pluginobj::filesize_): New data member.
15621         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
15622         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
15623         File_read::claim_for_plugin; use Object::unlock to unlock the file.
15624
15625         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
15626         with archive libraries.
15627         * testsuite/Makefile.in: Regenerate.
15628         * testsuite/plugin_test.c (struct sym_info): New type.
15629         (get_input_file, release_input_file): New static variables.
15630         (onload): Capture new transfer vector entries.
15631         (claim_file_hook): Stop reading at end of file according to filesize.
15632         Factor out parsing of readelf output into separate function.
15633         (all_symbols_read_hook): Exercise get_input_file and release_input_file
15634         APIs and get the source file name from the symbol table.  Convert
15635         source file name to corresponding object file name.  Print info
15636         message when adding new input files.
15637         (parse_readelf_line): New function.
15638         * testsuite/plugin_test_1.sh: Add checks for new info messages.
15639         * testsuite/plugin_test_2.sh: Likewise.
15640         * testsuite/plugin_test_3.sh: Likewise.
15641         * testsuite/plugin_test_4.sh: New test case.
15642
15643 2009-01-07  Ian Lance Taylor  <iant@google.com>
15644
15645         * version.cc (version_string): Bump to 1.8.
15646
15647 2008-12-23  Cary Coutant  <ccoutant@google.com>
15648
15649         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
15650         * plugin.cc (Plugin_manager::finish): Rename as
15651         layout_deferred_objects.  Move cleanup to separate function.
15652         (Plugin_manager::cleanup): New function.
15653         (Plugin_finish::run): Call layout_deferred_objects and cleanup
15654         separately.
15655         * plugin.h (Plugin_manager::finish): Rename as
15656         layout_deferred_objects.
15657         (Plugin_manager::cleanup): New function.
15658         (Plugin_manager::cleanup_done): New field.
15659
15660 2008-12-23  Cary Coutant  <ccoutant@google.com>
15661
15662         * plugin.cc (is_visible_from_outside): New function.
15663         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
15664         so we don't return "IR only" status for exported symbols or -r links.
15665
15666         * testsuite/Makefile.am (plugin_test_3): New test case.
15667         * testsuite/Makefile.in: Regenerate.
15668         * testsuite/plugin_test_3.sh: New file.
15669
15670 2008-12-22  Cary Coutant  <ccoutant@google.com>
15671
15672         * object.cc (Sized_relobj::layout_section): New function.
15673         (Sized_relobj::do_layout): Defer layout of input sections until after
15674         plugin has provided replacement files.
15675         (Sized_relobj::do_layout_deferred_sections): New function.
15676         * object.h (Relobj::set_section_offset): Remove virtual keyword.
15677         (Relobj::layout_deferred_sections): New function.
15678         (Relobj::do_layout_deferred_sections): New function.
15679         (Sized_relobj::do_layout_deferred_sections): New function.
15680         (Sized_relobj::layout_section): New function.
15681         (Sized_relobj::Deferred_layout): New structure.
15682         (Sized_relobj::deferred_layout_): New field.
15683         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
15684         Change all callers.  Layout deferred sections.
15685         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
15686         references.
15687         (Plugin_hook::run): Move code from do_plugin_hook inline.
15688         (Plugin_hook::do_plugin_hook): Remove.
15689         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
15690         (Plugin_manager::finish): Renamed, was cleanup.
15691         (Plugin_manager::should_defer_layout): New function.
15692         (Plugin_manager::add_deferred_layout_object): New function.
15693         (Plugin_manager::Deferred_layout_list): New type.
15694         (Plugin_manager::deferred_layout_objects_): New field.
15695         (Plugin_hook::do_plugin_hook): Remove.
15696
15697 2008-12-17  Ian Lance Taylor  <iant@google.com>
15698
15699         * options.h (class General_options): Add --no case for
15700         --export-dynamic.
15701
15702 2008-12-16  Cary Coutant  <ccoutant@google.com>
15703
15704         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
15705         vector.
15706         (Plugin_manager::claim_file): Create plugin object even if
15707         plugin did not call the add_symbols callback.
15708         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
15709         asking for more symbols than were added.
15710         * testsuite/Makefile.am (plugin_test_1): Add test case with
15711         no global symbols.
15712         (empty.syms): New target.
15713         * testsuite/Makefile.in: Regenerate.
15714         * testsuite/plugin_test.c (claim_file_hook): Add new debug
15715         message. Don't call add_symbols if no globals.
15716         (all_symbols_read_hook): Don't provide replacement for empty
15717         claimed file.
15718
15719 2008-12-12  Ian Lance Taylor  <iant@google.com>
15720
15721         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
15722         r_type == 0 for a local symbol with r_sym == 0.
15723         (scan_relocatable_relocs): Pass r_sym to
15724         local_non_section_strategy.
15725         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
15726         r_sym parameter.
15727
15728         * configure.ac: Update test for TLS descriptors: they are
15729         supported as of glibc 2.9.
15730         * configure: Rebuild.
15731
15732 2008-12-11  Ian Lance Taylor  <iant@google.com>
15733
15734         PR 7091
15735         * target-reloc.h (Default_scan_relocatable_relocs): For each
15736         function, map r_type == 0 to RELOC_DISCARD.
15737
15738 2008-12-10  Cary Coutant  <ccoutant@google.com>
15739
15740         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
15741         object to override a kept COMDAT group from a plugin object.
15742
15743 2008-12-09  Ian Lance Taylor  <iant@google.com>
15744
15745         PR 7088
15746         * yyscript.y (file_cmd): Handle INPUT.
15747
15748         * testsuite/initpri1.c: Change all declarations to be full
15749         prototypes by adding void, to avoid compiler warnings.
15750
15751 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
15752
15753         * options.cc (General_options::parse_plugin_opt): New.
15754         (General_options::add_plugin): The argument now is just the filename.
15755         (General_options::add_plugin_option): New.
15756         * options.h (plugin_opt): New.
15757         (add_plugin): Change argument name.
15758         (add_plugin_option): New.
15759         * plugin.cc (Plugin::load): Don't parse the plugin option.
15760         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
15761         (Plugin::add_option): New.
15762         (Plugin::args_): Change type.
15763         (Plugin::filename_): New.
15764         (Plugin_manager::add_plugin_option): New.
15765         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
15766         * testsuite/Makefile.in: Regenerate.
15767
15768 2008-12-05  Cary Coutant  <ccoutant@google.com>
15769
15770         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
15771         Handle --strip-lto-sections option.
15772         * options.h (strip_lto_sections): New option.
15773
15774 2008-12-01  Cary Coutant  <ccoutant@google.com>
15775
15776         * plugin.cc (ld_plugin_message): Change format parameter to const.
15777         Fix mismatch between new[] and delete.
15778
15779 2008-11-14  Cary Coutant  <ccoutant@google.com>
15780
15781         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
15782         instead of -1U.
15783
15784 2008-11-05  Craig Silverstein  <csilvers@google.com>
15785
15786         * options.cc (General_options::parse_dynamic_list): New function.
15787         * options.h (General_options): New flags dynamic_list,
15788         dynamic_list_data, dynamic_list_cpp_new, and
15789         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
15790         (General_options::in_dynamic_list): New function.
15791         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
15792         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
15793         (Lex::can_continue_name): Likewise.
15794         (yylex): Likewise.
15795         (read_script_file): New parameter script_options.
15796         (read_dynamic_list): New function.
15797         (Script_options::define_dynamic_list): New function.
15798         (dynamic_list_keyword_parsecodes): New variable.
15799         (dynamic_list_keywords): New variable.
15800         * script.h (Script_options::define_dynamic_list): New function
15801         prototype.
15802         (read_dynamic_list): New function prototype.
15803         * symtab.cc (strprefix): New macro.
15804         (Symbol::should_add_dynsym_entry): Support dynamic_list,
15805         dynamic_list_data, dynamic_list_cpp_new, and
15806         dynamic_list_cpp_typeinfo.
15807         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
15808         (dynamic_list_expr): New rule.
15809         (dynamic_list_nodes): Likewise.
15810         (dynamic_list_node): Likewise.
15811         * testsuite/Makefile.am (dynamic_list): New test.
15812         * testsuite/Makefile.in: Regenerated.
15813         * testsuite/dynamic_list.t: New file.
15814         * testsuite/dynamic_list.sh: New file.
15815
15816 2008-11-05  Craig Silverstein  <csilvers@google.com>
15817
15818         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
15819         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
15820         (t11_last): Likewise.
15821         * testsuite/ver_test_6.c (main): Likewise.
15822
15823 2008-10-07  Cary Coutant  <ccoutant@google.com>
15824
15825         * options.c (General_options::finalize): Add check for -static and
15826         -shared.
15827         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
15828         is not empty.
15829
15830 2008-10-02  Cary Coutant  <ccoutant@google.com>
15831
15832         * plugin.cc (make_sized_plugin_object): Fix conditional
15833         compilation to work when not all targets are enabled.
15834
15835 2008-09-29  Cary Coutant  <ccoutant@google.com>
15836
15837         * archive.cc (Archive::get_file_and_offset): Use filename instead
15838         of name to get library path.
15839         (Archive::include_member): Unlock external member of a thin archive.
15840
15841         * testsuite/Makefile.am (TEST_AR): New variable.
15842         (thin_archive_test_1): New test.
15843         (thin_archive_test_2): New test.
15844         * testsuite/Makefile.in: Regenerate.
15845         * testsuite/thin_archive_main.cc: New file.
15846         * testsuite/thin_archive_test_1.cc: New file.
15847         * testsuite/thin_archive_test_2.cc: New file.
15848         * testsuite/thin_archive_test_3.cc: New file.
15849         * testsuite/thin_archive_test_4.cc: New file.
15850
15851 2008-09-29  Cary Coutant  <ccoutant@google.com>
15852
15853         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
15854         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
15855         instead of -1U.
15856         (Sized_relobj::do_finalize_local_symbols): Likewise.
15857         (Sized_relobj::map_to_kept_section): Likewise.
15858         * object.h (Sized_relobj::invalid_address): New constant.
15859         (Sized_relobj::do_output_section_offset): Check for invalid_address
15860         and return -1ULL.
15861         * output.cc (Output_reloc::local_section_offset): Use constant
15862         invalid_address instead of -1U.
15863         (Output_reloc::get_address): Likewise.
15864         (Output_section::output_address): Change -1U to -1ULL.
15865         * output.h (Output_reloc::invalid_address): New constant.
15866         * reloc.cc (Sized_relobj::write_sections): Use constant
15867         invalid_address instead of -1U.
15868         (Sized_relobj::relocate_sections): Likewise.
15869         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
15870         values for merge sections.
15871         * target-reloc.h (relocate_for_relocatable): Use constant
15872         invalid_address instead of -1U.
15873
15874 2008-09-19  Cary Coutant  <ccoutant@google.com>
15875
15876         Add plugin functionality for link-time optimization (LTO).
15877         * configure.ac (plugins): Add --enable-plugins option.
15878         * configure: Regenerate.
15879         * config.in: Regenerate.
15880         * Makefile.am (LIBDL): New variable.
15881         (CCFILES): Add plugin.cc.
15882         (HFILES): Add plugin.h.
15883         (ldadd_var): Add LIBDL.
15884         * Makefile.in: Regenerate.
15885
15886         * archive.cc: Include "plugin.h".
15887         (Archive::setup): Don't preread archive symbols when using a plugin.
15888         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
15889         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
15890         files.
15891         (Archive::include_member): Add symbols from plugin objects.
15892         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
15893         * descriptors.cc (Descriptors::open): Check for file descriptors
15894         abandoned by plugins.
15895         (Descriptors::claim_for_plugin): New function.
15896         * descriptors.h (Descriptors::claim_for_plugin): New function.
15897         (Open_descriptor::is_claimed): New field.
15898         (claim_descriptor_for_plugin): New function.
15899         * fileread.cc (File_read::claim_for_plugin): New function.
15900         * fileread.h (File_read::claim_for_plugin): New function.
15901         (File_read::descriptor): New function.
15902         * gold.cc: Include "plugin.h".
15903         (queue_initial_tasks): Add task to call plugin hooks for generating
15904         new object files.
15905         * main.cc: Include "plugin.h".
15906         (main): Load plugin libraries.
15907         * object.h (Pluginobj): Declare.
15908         (Object::pluginobj): New function.
15909         (Object::do_pluginobj): New function.
15910         (Object::set_target): New function.
15911         * options.cc: Include "plugin.h".
15912         (General_options::parse_plugin): New function.
15913         (General_options::General_options): Initialize plugins_ field.
15914         (General_options::add_plugin): New function.
15915         * options.h (Plugin_manager): Declare.
15916         (General_options): Add --plugin option.
15917         (General_options::has_plugins): New function.
15918         (General_options::plugins): New function.
15919         (General_options::add_plugin): New function.
15920         (General_options::plugins_): New field.
15921         * plugin.cc: New file.
15922         * plugin.h: New file.
15923         * readsyms.cc: Include "plugin.h".
15924         (Read_symbols::do_read_symbols): Check for archive before checking
15925         for ELF file.  Call plugin hooks to claim files.
15926         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
15927         from a real object file; force override when processing replacement
15928         files.
15929         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
15930         (Symbol::init_base_object): Likewise.
15931         (Symbol::init_base_output_data): Likewise.
15932         (Symbol::init_base_output_segment): Likewise.
15933         (Symbol::init_base_constant): Likewise.
15934         (Symbol::init_base_undefined): Likewise.
15935         (Symbol::output_section): Assert that object is not a plugin.
15936         (Symbol_table::add_from_pluginobj): New function.
15937         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15938         undefined.
15939         (Symbol_table::sized_write_globals): Likewise.
15940         (Symbol_table::add_from_pluginobj): Instantiate template.
15941         * symtab.h (Sized_pluginobj): Declare.
15942         (Symbol::in_real_elf): New function.
15943         (Symbol::set_in_real_elf): New function.
15944         (Symbol::in_real_elf_): New field.
15945         (Symbol_table::add_from_pluginobj): New function.
15946
15947         * testsuite/Makefile.am (AM_CFLAGS): New variable.
15948         (LIBDL): New variable.
15949         (LDADD): Add LIBDL.
15950         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
15951         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
15952         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
15953         (MOSTLYCLEANFILES): Likewise.
15954         * testsuite/Makefile.in: Regenerate.
15955         * testsuite/plugin_test.c: New file.
15956         * testsuite/plugin_test_1.sh: New file.
15957         * testsuite/plugin_test_2.sh: New file.
15958
15959 2008-09-16  Ian Lance Taylor  <iant@google.com>
15960
15961         * target-reloc.h (relocate_section): Check whether a symbol is
15962         defined by the ABI before reporting an undefined symbol error.
15963         * target.h (Target::is_defined_by_abi): Make parameter const.
15964         (Target::do_is_defined_by_abi): Likewise.
15965         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
15966         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
15967         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
15968         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
15969         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
15970         * testsuite/Makefile.in: Rebuild.
15971
15972         * fileread.cc (make_view): Add casts to avoid warning.
15973
15974 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15975
15976         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
15977         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15978
15979 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15980
15981         * options.h (General_options::output_is_executable): New.
15982         (General_options::output_is_pie): New.
15983         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
15984         for shared libraries.
15985         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15986
15987 2008-09-11  Chris Demetriou  <cgd@google.com>
15988
15989         * options.h (origin): New -z option.
15990         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
15991         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
15992         in DT_FLAGS_1.
15993
15994 2008-09-05  Cary Coutant  <ccoutant@google.com>
15995
15996         * fileread.cc (File_read::make_view): Add check for attempt to map
15997         beyond end of file.
15998
15999 2008-09-05  Cary Coutant  <ccoutant@google.com>
16000
16001         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
16002         explicit instantiations.
16003
16004 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
16005
16006         PR gold/6858
16007         * options.cc (General_options::finalize): Allow undefined symbols
16008         in shlibs if linking -shared.
16009
16010         PR gold/6859
16011         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
16012         symbols as not needing a dynsym entry.
16013
16014 2008-08-20  Craig Silverstein  <csilvers@google.com>
16015
16016         * fileread.cc (File_read::open): Do not lock the file unless it
16017         was successfully opened.
16018
16019 2008-08-14  Cary Coutant  <ccoutant@google.com>
16020
16021         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
16022         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
16023         * testsuite/tls_test.cc (struct int128): 128-bit struct
16024         for testing TLS relocs with non-zero addend.
16025         (v12): New TLS variable.
16026         (t12): New test.
16027         (t_last): Add check for v12.
16028         * testsuite/tls_test.h (t12): New function.
16029         * testsuite/tls_test_main.cc (thread_routine): Call new test.
16030
16031 2008-08-13  Ian Lance Taylor  <iant@google.com>
16032
16033         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
16034         set tls_segment_ or relro_segment_.
16035         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
16036         when appropriate.
16037         * output.h (Output_section::clear_is_relro): New function.
16038         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
16039         sections specially even when output_data_ is empty.
16040         (Output_segment::maximum_alignment): When first section is relro,
16041         only force alignment for PT_LOAD segments.
16042         * script.cc (script_data_segment_align): New function.
16043         (script_data_segment_relro_end): New function.
16044         * script-c.h (script_data_segment_align): Declare.
16045         (script_data_segment_relro_end): Declare.
16046         * script-sections.h (class Script_sections): Declare
16047         data_segment_align and data_segment_relro_end.  Add fields
16048         segment_align_index_ and saw_relro_end_.
16049         * script-sections.cc (class Sections_element): Add set_is_relro
16050         virtual function.  Add new bool* parameter to place_orphan_here.
16051         Add get_output_section virtual function.
16052         (class Output_section_definition): Add set_is_relro.  Add new
16053         bool* parameter to place_orphan_here.  Add get_output_section.
16054         Add is_relro_ field.
16055         (Output_section_definition::Output_section_definition): Initialize
16056         evaluated_address_, evaluated_load_address, evaluated_addralign_,
16057         and is_relro_ fields.
16058         (Output_section_definition::place_orphan_here): Add is_relro
16059         parameter.
16060         (Output_section_definition::set_section_addresses): Set relro for
16061         output section.
16062         (Output_section_definition::alternate_constraint): Likewise.
16063         (class Orphan_output_section): Add new bool* parameter to
16064         place_orphan_here.  Add get_output_section.
16065         (Orphan_output_section::place_orphan_here): Add is_relro
16066         parameter.
16067         (Script_sections::Script_sections): Initialize
16068         data_segment_align_index_ and saw_relro_end_.
16069         (Script_sections::data_segment_align): New function.
16070         (Script_sections::data_segment_relro_end): New function.
16071         (Script_sections::place_orphan): Set or clear is_relro.
16072         (Script_sections::set_section_addresses): Force alignment of first
16073         TLS section.
16074         * yyscript.y (exp): Call script_data_segment_align and
16075         script_data_segment_relro_end.
16076         * testsuite/relro_script_test.t: New file.
16077         * testsuite/relro_test.cc (using_script): Declare.
16078         (t1, t2): Test using_script.
16079         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
16080         (relro_script_test_SOURCES): Define.
16081         (relro_script_test_DEPENDENCIES): Define.
16082         (relro_script_test_LDFLAGS): Define.
16083         (relro_script_test_LDADD): Define.
16084         (relro_script_test.so): New target.
16085         * testsuite/Makefile.in: Rebuild.
16086
16087 2008-08-06  Cary Coutant <ccoutant@google.com>
16088
16089         * archive.cc (Archive::total_archives, Archive::total_members)
16090         (Archive::total_members_loaded): New variables.
16091         (Archive::setup): Add parameter.  Add option to preread
16092         archive symbols.
16093         (Archive::read_armap): Add counter.
16094         (Archive::get_file_and_offset): New function.
16095         (Archive::get_elf_object_for_member): New function.
16096         (Archive::read_all_symbols): New function.
16097         (Archive::read_symbols): New function.
16098         (Archive::add_symbols): Add counters.
16099         (Archive::include_all_members): Use armap to find members if it's
16100         already built.
16101         (Archive::include_member): Skip reading symbols if already read.
16102         Factored code into Archive::get_file_and_offset and
16103         Archive::get_elf_object_for_member.  Changed call to
16104         Mapfile::report_include_archive_member.
16105         (Archive::print_stats): New function.
16106         * archive.h: Declare Object and Read_symbols_data classes.
16107         (Archive::Archive): Add initializers for new members.
16108         (Archive::setup): Add parameter.
16109         (Archive::print_stats): New function.
16110         (Archive::total_archives, Archive::total_members)
16111         (Archive::total_members_loaded): New variables.
16112         (Archive::get_file_and_offset): New function.
16113         (Archive::get_elf_object_for_member): New function.
16114         (Archive::read_all_symbols): New function.
16115         (Archive::read_symbols): New function.
16116         (Archive::Archive_member): New class.
16117         (Archive::members_): New member.
16118         (Archive::num_members_): New member.
16119         * main.cc: Include archive.h.
16120         (main): Call Archive::print_stats.
16121         * mapfile.cc (Mapfile::report_include_archive_member): Delete
16122         archive parameter; member_name is now the fully-decorated name.
16123         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
16124         * options.h: (General_options): Add --preread-archive-symbols option.
16125         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
16126         Archive::setup.
16127
16128 2008-08-04  Ian Lance Taylor  <iant@google.com>
16129
16130         * symtab.h (Symbol::use_plt_offset): New function.
16131         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
16132         * powerpc.cc (Relocate::relocate): Likewise.
16133         * sparc.cc (Relocate::relocate): Likewise.
16134         * x86_64.cc (Relocate::relocate): Likewise.
16135         * testsuite/weak_plt.sh: New test.
16136         * testsuite/weak_plt_main.cc: New test.
16137         * testsuite/weak_plt_shared.cc: New test.
16138         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
16139         (check_PROGRAMS): Add weak_plt.
16140         (check_DATA): Add weak_plt_shared.so.
16141         (weak_plt_main_pic.o, weak_plt): New targets.
16142         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
16143         * testsuite/Makefile.in: Rebuild.
16144
16145         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
16146         gcctestdir/ld.
16147         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
16148         * testsuite/Makefile.in: Rebuild.
16149
16150 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
16151
16152         * Makefile.am (POTFILES.in): Set LC_ALL=C.
16153         * Makefile.in: Regenerate.
16154         * po/POTFILES.in: Regenerate.
16155
16156 2008-07-29  Ian Lance Taylor  <iant@google.com>
16157
16158         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
16159         symbols before other symbols.
16160         * testsuite/script_test_2.cc (test_addr): Declare.
16161         (test_addr_alias): Declare.
16162         (main): Check that test_addr and test_addr_alias have the right
16163         values.
16164         * testsuite/script_test_2.t: Define test_addr_alias and
16165         test_addr.
16166
16167 2008-07-24  Ian Lance Taylor  <iant@google.com>
16168
16169         PR 5990
16170         * descriptors.cc: New file.
16171         * descriptors.h: New file.
16172         * gold-threads.h (class Hold_optional_lock): New class.
16173         * fileread.cc: Include "descriptors.h".
16174         (File_read::~File_read): Release descriptor rather than closing
16175         it.
16176         (File_read::open) [file]: Call open_descriptor rather than open.
16177         Set is_descriptor_opened_.
16178         (File_read::open) [memory]: Assert that descriptor is not open.
16179         (File_read::reopen_descriptor): New function.
16180         (File_read::release): Release descriptor.
16181         (File_read::do_read): Make non-const.  Reopen descriptor.
16182         (File_read::read): Make non-const.
16183         (File_read::make_view): Reopen descriptor.
16184         (File_read::do_readv): Likewise.
16185         * fileread.h (class File_read): Add is_descriptor_opened_ field.
16186         Update declarations.
16187         * layout.cc: Include "descriptors.h".
16188         (Layout::create_build_id): Use open_descriptor rather than open.
16189         * output.cc: Include "descriptors.h".
16190         (Output_file::open): Use open_descriptor rather than open.
16191         * archive.cc (Archive::const_iterator): Change Archive to be
16192         non-const.
16193         (Archive::begin, Archive::end): Make non-const.
16194         (Archive::count_members): Likewise.
16195         * archive.h (class Archive): Update declarations.
16196         * object.h (Object::read): Make non-const.
16197         * Makefile.am (CCFILES): Add descriptors.cc.
16198         (HFILES): Add descriptors.h.
16199         * Makefile.in: Rebuild.
16200
16201         PR 6716
16202         * gold.h: Always include <clocale>.  Add Solaris workarounds
16203         following code in binutils/sysdep.h.
16204
16205         PR 6048
16206         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
16207         this->eh_frame_hdr_ is NULL before using it.
16208
16209         * dynobj.cc (Versions::Versions): Update comment.
16210
16211         * dynobj.cc (Versions::Versions): If there is an soname, use it as
16212         the base version name.
16213
16214         * stringpool.cc (Stringpool_template::add_with_length): Set key to
16215         array size plus one.
16216         (Stringpool_template::set_string_offsets): Subtract one from key
16217         before using it as an array index.
16218         (Stringpool_template::get_offset_with_length): Likewise.
16219         (Stringpool_template::write_to_buffer): Likewise.
16220         * stringpool.h (Stringpool_template::get_offset_from_key):
16221         Likewise.
16222
16223 2008-07-23  Ian Lance Taylor  <iant@google.com>
16224
16225         PR 6658
16226         * object.h (Merged_symbol_value::value): Do our best to handle a
16227         negative addend.
16228
16229         PR 6647
16230         * script.cc (Version_script_info::get_versions): Don't add empty
16231         version tag to return value.
16232         (Version_script_info::get_symbol_version_helper): Change return
16233         type to bool.  Add pversion parameter.  Change all callers.
16234         (script_register_vers_node): Don't require a non-NULL tag.
16235         * script.h (class Version_script_info): Update declarations.
16236         (Version_script_info::get_symbol_version): Change return type to
16237         bool.  Add version parameter.  Change all callers.
16238         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
16239         handling.  Handle an empty version from a version script.
16240         (Symbol_table::define_special_symbol): Likewise.
16241         * testsuite/ver_test_10.script: New file.
16242         * testsuite/ver_test_10.sh: New file.
16243         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
16244         (check_DATA): Add ver_test_10.syms.
16245         (ver_test_10.syms, ver_test_10.so): New target.
16246         * testsuite/Makefile.in: Rebuild.
16247
16248 2008-07-23  Simon Baldwin  <simonb@google.com>
16249
16250         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
16251         to zero for undefined symbols from dynamic libraries.
16252
16253 2008-07-23  Ian Lance Taylor  <iant@google.com>
16254
16255         * symtab.cc (Symbol_table::resolve): Remove version parameter.
16256         Change all callers.
16257         * symtab.h (class Symbol_table): Update declaration.
16258         * testsuite/ver_test_9.cc: New file.
16259         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
16260         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
16261         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
16262         (ver_test_9.so, ver_test_9.o): New targets.
16263         * testsuite/Makefile.in: Rebuild.
16264
16265 2008-07-22  Ian Lance Taylor  <iant@google.com>
16266
16267         * options.h (class General_options): Define --check-sections.
16268         * layout.cc (Layout::set_segment_offsets): Handle
16269         --check-sections.
16270
16271         * options.h (class General_options): Define -n/--nmagic and
16272         -N/--omagic.
16273         * options.cc (General_options::finalize): For -n/--nmagic or
16274         -N/--omagic, set -static.
16275         * layout.cc (Layout::attach_allocated_section_to_segment): If
16276         -N/--omagic, don't put read-only and read-write sections in
16277         different segments.
16278         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
16279         finding a read-only segment.
16280         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
16281         don't set the minimum segment alignment to the common page size,
16282         and don't set the file offset to the address modulo the page size.
16283         * script-sections.cc (Script_sections::create_segments): If
16284         -n/--omagic, don't put read-only and read-write sections in
16285         different segments.
16286
16287         * cref.cc: New file.
16288         * cref.h: New file.
16289         * options.h (class General_options): Add --print-symbol-counts.
16290         * main.cc (main): Issue defined symbol report if requested.
16291         * archive.cc (Archive::interpret_header): Make into a const member
16292         function.
16293         (Archive::add_symbols): Call Input_objects::archive_start and
16294         archive_stop.
16295         (Archive::const_iterator): Define new class.
16296         (Archive::begin, Archive::end): New functions.
16297         (Archive::include_all_members): Rewrite to use iterator.
16298         (Archive::count_members): New function.
16299         * archive.h (class Archive): Update declarations.
16300         (Archive::filename): New function.
16301         * object.cc: Include "cref.h".
16302         (Sized_relobj::Sized_relobj): Initialize defined_count_.
16303         (Sized_relobj::do_get_global_symbol_counts): New function.
16304         (Input_objects::add_object): Add object to cross-referencer.
16305         (Input_objects::archive_start): New function.
16306         (Input_objects::archive_stop): New function.
16307         (Input_objects::print_symbol_counts): New function.
16308         * object.h: Declare Cref and Archive.
16309         (Object::get_global_symbol_counts): New function.
16310         (Object::do_get_global_symbol_counts): New pure virtual function.
16311         (class Sized_relobj): Add defined_count_ field.  Update
16312         declarations.
16313         (class Input_objects): Add cref_ field.  Update constructor.
16314         Update declarations.
16315         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
16316         defined_count_.
16317         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
16318         symbol counts.
16319         (Sized_dynobj::do_get_global_symbol_counts): New function.
16320         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
16321         defined_count_.  Update declarations.  Define Symbols typedef.
16322         * symtab.cc (Symbol_table::add_from_relobj): Add defined
16323         parameter.  Change all callers.
16324         (Symbol_table::add_from_dynobj): Add sympointers and defined
16325         parameters.  Change all callers.
16326         * symtab.h (class Symbol_table): Update declarations.
16327         * Makefile.am (CCFILES): Add cref.cc.
16328         (HFILES): Add cref.h.
16329         * Makefile.in: Rebuild.
16330
16331 2008-07-22  Simon Baldwin  <simonb@google.com>
16332
16333         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
16334         to zero when writing undefined symbols.
16335
16336 2008-07-22  Ian Lance Taylor  <iant@google.com>
16337
16338         * output.cc (Output_section::add_input_section): Don't try to
16339         merge empty merge sections.
16340
16341 2008-07-21  Craig Silverstein  <csilvers@google.com>
16342
16343         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
16344         Include symbol version in error message.
16345
16346 2008-07-20  Chris Demetriou  <cgd@google.com>
16347
16348         * configure.ac (gold_cv_c_random_seed): New configured variable.
16349         (RANDOM_SEED_CFLAGS): New substituted variable.
16350         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
16351         * configure: Rebuild.
16352         * Makefile.in: Likewise.
16353         * testsuite/Makefile.in: Likewise.
16354
16355 2008-07-18  Ian Lance Taylor  <iant@google.com>
16356
16357         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
16358         where we see NAME/NULL and NAME/VERSION  as separate symbols.
16359         * testsuite/ver_test_main.cc (main): Call t4.
16360         (t4, t4_2a): Define.
16361         * testsuite/ver_test_2.cc (t4_2): Define.
16362         * testsuite/ver_test_2.script: Put t4_2a in VER2.
16363         * testsuite/ver_test_4.cc (t4_2a): Define.
16364         * testsuite/ver_test_4.script: Put t4_2a in VER2.
16365         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
16366
16367 2008-07-17  Ian Lance Taylor  <iant@google.com>
16368
16369         * dynobj.cc (Versions::add_def): If we give an error about a
16370         missing version, go ahead and create the version anyhow.
16371
16372 2008-07-10  Ian Lance Taylor  <iant@google.com>
16373
16374         Handle output sections with more than 0x7fffffff bytes.
16375         * object.h (class Relobj): Change map_to_output_ to
16376         output_sections_, and just keep a section pointer.  Change all
16377         uses.  Move comdat group support to Sized_relobj.
16378         (Relobj::is_section_specially_mapped): Remove.
16379         (Relobj::output_section): Remove poff parameter.  Change all
16380         callers.
16381         (Relobj::output_section_offset): New function.
16382         (Relobj::set_section_offset): Rewrite.
16383         (Relobj::map_to_output): Remove.
16384         (Relobj::output_sections): New function.
16385         (Relobj::do_output_section_offset): New pure virtual function.
16386         (Relobj::do_set_section_offset): Likewise.
16387         (class Sized_relobj): Add section_offsets_ field.  Add comdat
16388         group support from Relobj.  Update declarations.
16389         (Sized_relobj::get_output_section_offset): New function.
16390         (Sized_relobj::do_output_section_offset): New function.
16391         (Sized_relobj::do_set_section_offset): New function.
16392         * object.cc (Relobj::output_section_address): Remove.
16393         (Sized_relobj::Sized_relobj): Initialize new fields.
16394         (Sized_relobj::include_section_group): Cast find_kept_object to
16395         Sized_relobj.
16396         (Sized_relobj::include_linkonce_section): Likewise.
16397         (Sized_relobj::do_layout): Use separate arrays for output section
16398         and output offset.
16399         (Sized_relobj::do_count_local_symbols): Change map_to_output to
16400         output_sections.
16401         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
16402         output_sections and section_offsets.
16403         (Sized_relobj::write_local_symbols): Likewise.
16404         (map_to_kept_section): Compute output address directly.
16405         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
16406         output_sections and section_offsets.
16407         (Sized_relobj::write_sections): Likewise.
16408         (Sized_relobj::relocate_sections): Likewise.
16409         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
16410         * output.h (class Output_reloc): Update declarations.  Change
16411         u2_.relobj to Sized_relobj*.
16412         (class Output_data_reloc): Change add functions to use
16413         Sized_relobj*.
16414         * output.cc (Output_reloc::Output_reloc): Change relobj to
16415         Sized_relobj*.
16416         (Output_reloc::local_section_offset): Change return type to
16417         Elf_Addr.  Use get_output_section_offset.
16418         (Output_reloc::get_address): Likewise.
16419         (Output_section::is_input_address_mapped): Don't call
16420         is_section_specially_mapped.
16421         (Output_section::output_offset): Likewise.
16422         (Output_section::output_address): Likewise.
16423         (Output_section::starting_output_address): Likewise.
16424         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
16425         parameter to Sized_relobj*.
16426         (Copy_relocs::need_copy_reloc): Likewise.
16427         (Copy_relocs::save): Likewise.
16428         * copy-relocs.h (class Copy_relocs): Update declarations.
16429         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
16430         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
16431         * target-reloc.h (relocate_for_relocatable): Change
16432         offset_in_output_section type to Elf_Addr.  Change code that uses
16433         it as well.
16434         * layout.cc (Layout::layout): Always set *off.
16435         * mapfile.cc (Mapfile::print_input_section): Use
16436         output_section_offset.
16437         * i386.cc (Target_i386::copy_reloc): Change object parameter to
16438         Sized_relobj*.
16439         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
16440         * sparc.cc (Target_sparc::copy_reloc): Likewise.
16441         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
16442
16443 2008-07-03  Ian Lance Taylor  <iant@google.com>
16444
16445         * layout.cc (Layout::include_section): Do not discard unrecognized
16446         SHT_STRTAB sections.
16447
16448 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
16449
16450         * script.cc (Lex::can_continue_name): Make '?' allowable in
16451         version-script names.
16452         * testsuite/version_script.map: Change glob pattern to use '?'
16453
16454 2008-06-30  Manish Singh  <yosh@gimp.org>
16455
16456         PR 6585
16457         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
16458         Correct typo.
16459
16460 2008-06-30  Ian Lance Taylor  <iant@google.com>
16461
16462         PR 6660
16463         PR 6682
16464         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
16465         versions]: Don't try to read the value in the contents, since we
16466         don't use it.  Use the template endianness when writing.
16467
16468 2008-06-25  Cary Coutant  <ccoutant@google.com>
16469
16470         * fileread.cc (File_read::make_view): Assert on zero-length view.
16471         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
16472         symbol table when there are no symbols to read.
16473
16474 2008-06-23  Craig Silverstein  <csilvers@google.com>
16475
16476         * version.cc (version_string): Bump to 1.7
16477
16478 2008-06-18  Craig Silverstein  <csilvers@google.com>
16479
16480         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
16481         constant 0xFFFF to type Valtype.
16482         (Powerpc_relocate_functions::rel16_ha): Likewise.
16483
16484 2008-06-17  Ian Lance Taylor  <iant@google.com>
16485
16486         * output.h (Output_section::Input_section): Initialize p2align_ to
16487         zero for Output_section_data constructors.
16488         (Output_section::Input_section::addralign): If not an input
16489         section, return the alignment of the Output_section_data.
16490         * testsuite/copy_test.cc: New file.
16491         * testsuite/copy_test_1.cc: New file.
16492         * testsuite/copy_test_2.cc: New file.
16493         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
16494         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
16495         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
16496         (copy_test_1_pic.o, copy_test_1.so): New targets.
16497         (copy_test_2_pic.o, copy_test_2.so): New targets.
16498         * testsuite/Makefile.in: Rebuild.
16499
16500         * script-sections.cc (Script_sections::place_orphan): Initialize
16501         local variable exact.
16502
16503 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
16504
16505         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
16506
16507 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
16508             David S. Miller  <davem@davemloft.net>
16509
16510         * powerpc.cc: New file.
16511         * Makefile.am (TARGETSOURCES): Add powerpc.cc
16512         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
16513         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
16514         * Makefile.in: Rebuild.
16515
16516 2008-06-09  Ian Lance Taylor  <iant@google.com>
16517
16518         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
16519         <exception>.
16520         (throwing, orig_terminate): New static variables.
16521         (terminate_handler): New static function.
16522         (t2): Set terminate handler.
16523
16524 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
16525
16526         PR 6584
16527         * binary.cc (Binary_to_elf::sized_convert): Fix .data
16528         alignment.
16529
16530 2008-05-30  Cary Coutant  <ccoutant@google.com>
16531
16532         * archive.cc (Archive::include_all_members) Correct to step
16533         over symbol table and extended name table in thin archives.
16534
16535 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
16536
16537         PR 6407
16538         * target-reloc.h (relocate_for_relocatable): Fix new_offset
16539         calculation.
16540
16541 2008-05-28  Caleb Howe  <cshowe@google.com>
16542
16543         * reduced_debug_output.cc: New file.
16544         * reduced_debug_output.h: New file.
16545         * options.h (class General_options): Add --strip-debug-non-line.
16546         * options.cc (General_options::finalize): Add strip_debug_non_line
16547         to the strip heirarchy.
16548         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
16549         fields.
16550         * layout.cc: Include "reduced_debug_output.h".
16551         (Layout::Layout): Initialize new fields.
16552         (line_only_debug_sections): New static array.
16553         (is_lines_only_debug_sections): New static inline function.
16554         (Layout::include_section): Handle --strip-debug-non-line.
16555         (Layout::make_output_section): If --strip-debug-non-line, build
16556         new output sections for .debug_abbrev and .debug_info.
16557         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
16558         gold.  Warn about possible overflow.
16559         (read_signed_LEB_128): Likewise.
16560         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
16561         (read_signed_LEB_128): Declare.
16562         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
16563         (HFILES): Add reduced_debug_output.h.
16564         * Makefile.in: Rebuild.
16565
16566 2008-05-21  Ian Lance Taylor  <iant@google.com>
16567
16568         * mapfile.cc: New file.
16569         * mapfile.h: New file.
16570         * options.h (class General_options): Add -M/--print-map and -Map.
16571         * options.cc (General_options::finalize): Make -M equivalent to
16572         -Map -.
16573         * main.cc: Include <cstdio> and "mapfile.h".
16574         (main): Open mapfile if requested.
16575         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
16576         constructor.  Change caller.
16577         (queue_initial_tasks): Add mapfile parameter.  Change caller.
16578         (queue_middle_tasks): Likewise.
16579         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
16580         declarations.
16581         * archive.cc: Include "mapfile.h".
16582         (Archive::add_symbols): Add mapfile parameter.  Change all
16583         callers.  Pass mapfile, symbol, and reason to include_member.
16584         (Archive::include_all_members): Add mapfile parameter.  Change all
16585         callers.
16586         (Archive::include_member): Add mapfile, sym, and why parameters.
16587         Change all callers.  Report inclusion to map file.
16588         * archive.h: Include "fileread.h".
16589         (class Archive): Update declarations.
16590         (Archive::file): New const method.
16591         (class Add_archive_symbols): Add mapfile_ field.  Update
16592         constructor.  Change all callers.
16593         * readsyms.h (class Read_symbols): Likewise.
16594         (class Finish_group): Likewise.
16595         (class Read_script): Likewise.
16596         * common.cc: Include "mapfile.h".
16597         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
16598         all callers.
16599         (Symbol_table::do_allocate_commons): Likewise.
16600         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
16601         symbol allocation to mapfile.
16602         * common.h (class Allocate_commons_task): Add mapfile_ field.
16603         Update constructor.  Change all callers.
16604         * symtab.h (class Symbol_table): Update declarations.
16605         * layout.cc: Include "mapfile.h".
16606         (Layout_task_runner::run): Print information to mapfile.
16607         (Layout::create_gold_note): Change Output_data_fixed_space to
16608         Output_data_zero_fill.
16609         (Layout::create_build_id): Likewise.
16610         (Layout::print_to_mapfile): New function.
16611         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
16612         constructor.  Change caller.
16613         (class Layout): Declare print_to_mapfile.
16614         * output.cc (Output_section::Input_section::print_to_mapfile): New
16615         function.
16616         (Output_section::add_input_section): If producing a map, always
16617         add to input_sections_ list.
16618         (Output_section::do_print_to_mapfile): New function.
16619         (Output_segment::print_sections_to_mapfile): New function.
16620         (Output_segment::print_section_list_to_mapfile): New function.
16621         * output.h: Include "mapfile.h".
16622         (Output_data::print_to_mapfile): New function.
16623         (Output_data::do_print_to_mapfile): New virtual function.
16624         (Output_segment_headers::do_print_to_mapfile): New function.
16625         (Output_file_header::do_print_to_mapfile): New function.
16626         (Output_data_const::do_print_to_mapfile): New function.
16627         (class Output_data_const_buffer): Add map_name_ field.  Update
16628         constructor.  Change all callers.  Add do_print_to_mapfile
16629         function.
16630         (class Output_data_fixed_space): Likewise.
16631         (class Output_data_space): Likewise.
16632         (class Output_data_zero_fill): New class.
16633         (Output_data_strtab::do_print_to_mapfile): New function.
16634         (Output_data_reloc_base::do_print_to_mapfile): New function.
16635         (Output_relocatable_relocs::do_print_to_mapfile): New function.
16636         (Output_data_group::do_print_to_mapfile): New function.
16637         (Output_data_got::do_print_to_mapfile): New function.
16638         (Output_data_dynamic::do_print_to_mapfile): New function.
16639         (Output_symtab_xindex::do_print_to_mapfile): New function.
16640         (class Output_section): Declare do_print_to_mapflie.  Declare
16641         print_to_mapfile in Input_section.
16642         (class Output_segment): Declare new functions.
16643         * object.h (Sized_relobj::symbol_count): New function.
16644         * script-sections.cc
16645         (Output_section_element_dot_assignment::set_section_addresses):
16646         Change Output_data_fixed_space to Output_data_zero_fill.
16647         (Output_data_expression::do_print_to_mapfile): New function.
16648         * script.cc (read_input_script): Add mapfile parameter.  Change
16649         all callers.
16650         * script.h (read_input_script): Update declaration.
16651         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
16652         (Eh_frame::do_print_to_mapfile): New function.
16653         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
16654         (Output_merge_string::do_print_to_mapfile): New function.
16655         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
16656         function.
16657         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
16658         function.
16659         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
16660         function.
16661         * Makefile.am (CCFILES): Add mapfile.cc.
16662         (HFILES): Add mapfile.h.
16663         * Makefile.in: Rebuild.
16664
16665 2008-05-19  Ian Lance Taylor  <iant@google.com>
16666
16667         * options.h (class General_options): Add -z relro.
16668         * layout.cc (Layout::Layout): Initialize relro_segment_.
16669         (Layout::add_output_section_data): Return the output section.
16670         (Layout::make_output_section): Rcognize relro sections and mark
16671         them appropriately.
16672         (Layout::attach_allocated_section_to_segment): Put relro sections
16673         in a PT_GNU_RELRO segment.
16674         (Layout::create_initial_dynamic_sections): Mark the .dynamic
16675         section as relro.
16676         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
16677         PT_TLS segments.
16678         (Layout::linkonce_mapping): Map d.rel.ro.local to
16679         .data.rel.ro.local.
16680         (Layout::output_section_name): Us .data.rel.ro.local for any
16681         section which begins with that.
16682         * layout.h (class Layout): Update add_output_section_data
16683         declaration.  Add relro_segment_ field.
16684         * output.cc (Output_section::Output_section): Initialize is_relro_
16685         and is_relro_local_ fields.
16686         (Output_segment::add_output_section): Group relro sections.
16687         (Output_segment::is_first_section_relro): New function.
16688         (Output_segment::maximum_alignment): If there is a relro section,
16689         align the segment to the common page size.
16690         (Output_segment::set_section_addresses): Track whether we are
16691         looking at relro sections.  If the last section is a relro
16692         section, align to the common page size.
16693         (Output_segment::set_section_list_addresses): Add in_relro
16694         parameter.  Change all callers.  Align to the page size when
16695         moving from relro to non-relro section.
16696         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
16697         segment.
16698         * output.h (class Output_section): Add is_relro_ and
16699         is_relro_local_ fields.
16700         (Output_section::is_relro): New function.
16701         (Output_section::set_is_relro): New function.
16702         (Output_section::is_relro_local): New function.
16703         (Output_section::set_is_relro_local): New function.
16704         (class Output_segment): Update declarations.
16705         * i386.cc (Target_i386::got_section): Mark .got section as relro.
16706         * sparc.cc (Target_sparc::got_section): Likewise.
16707         * x86_64.cc (Target_x86_64::got_section): Likewise.
16708         * testsuite/relro_test_main.cc: New file.
16709         * testsuite/relro_test.cc: New file.
16710         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
16711         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
16712         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
16713         (relro_test.so, relro_test_pic.o): New targets.
16714         * testsuite/Makefile.in: Rebuild.
16715
16716 2008-05-16  Ian Lance Taylor  <iant@google.com>
16717
16718         * output.cc (Output_segment::add_output_section): Remove front
16719         parameter.
16720         * output.h (class Output_segment): Remove
16721         add_initial_output_section and overloaded add_output_section.
16722         Update declaration of remaining add_output_section.
16723         * layout.cc (Layout::create_interp): Call add_output_section
16724         rather than add_initial_output_section.
16725         (Layout::finish_dynamic_section): Likewise.
16726
16727         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
16728         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
16729         know the dynamic type.
16730         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
16731         field.  Initialize it in constructor.
16732         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
16733         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
16734         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
16735         reloc.
16736
16737         * output.cc (Output_reloc::get_address): Change return type to
16738         Elf_Addr.
16739         * output.h (class Output_reloc): Update get_address declaration.
16740         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
16741         for section addresses.
16742
16743 2008-05-09  Ian Lance Taylor  <iant@google.com>
16744
16745         PR 6493
16746         * gold.cc (gold_nomem): Use return value of write.
16747
16748 2008-05-08  Ian Lance Taylor  <iant@google.com>
16749
16750         * symtab.c (Symbol::init_base_output_data): Add version
16751         parameter.  Change all callers.
16752         (Symbol::init_base_output_segment): Likewise.
16753         (Symbol::init_base_constant): Likewise.
16754         (Symbol::init_base_undefined): Likewise.
16755         (Sized_symbol::init_output_data): Likewise.
16756         (Sized_symbol::init_output_segment): Likewise.
16757         (Sized_symbol::init_constant): Likewise.
16758         (Sized_symbol::init_undefined): Likewise.
16759         (Symbol_table::do_define_in_output_data): If the new symbol has a
16760         version, mark it as the default.
16761         (Symbol_table::do_define_in_output_segment): Likewise.
16762         (Symbol_table::do_define_as_constant): Likewise.
16763         * symtab.h (class Symbol): Update declarations.
16764         (class Sized_symbol): Likewise.
16765         * resolve.cc (Symbol::override_version): New function.
16766         (Symbol::override_base): Call override_version.
16767         (Symbol::override_base_with_special): Likewise.
16768         * testsuite/ver_script_8.script: New file.
16769         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
16770         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
16771         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
16772         (ver_test_8_1.so, ver_test_8_2.so): New targets.
16773
16774 2008-05-06  Ian Lance Taylor  <iant@google.com>
16775
16776         PR 6049
16777         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
16778         functions.
16779         (class General_options): Remove existing --undefined, and add
16780         --no-undefined instead.  Add new --undefined as synonym for -u.
16781         * archive.cc (Archive::add_symbols): Check whether symbol was
16782         named with -u.
16783         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
16784         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
16785         all uses.  Add IS_UNDEFINED.  Update declarations to split
16786         different versions of init_base.  Declare init_base_undefined.
16787         (Symbol::is_defined): Handle IS_UNDEFINED.
16788         (Symbol::is_undefined): Likewise.
16789         (Symbol::is_weak_undefined): Call is_undefined.
16790         (Symbol::is_absolute): Handle IS_CONSTANT.
16791         (class Sized_symbol): Update declarations to split different
16792         versions of init.  Declare init_undefined.
16793         (class Symbol_table): Declare new functions.
16794         * symtab.cc (Symbol::init_base_object): Rename from init_base.
16795         Change all callers.
16796         (Symbol::init_base_output_data): Likewise.
16797         (Symbol::init_base_output_segment): Likewise.
16798         (Symbol::init_base_constant): Likewise.
16799         (Symbol::init_base_undefined): New function.
16800         (Sized_symbol::init_object): Rename from init.  Change all
16801         callers.
16802         (Sized_symbol::init_output_data): Likewise.
16803         (Sized_symbol::init_output_segment): Likewise.
16804         (Sized_symbol::init_constant): Likewise.
16805         (Sized_symbol::init_undefined): New function.
16806         (Symbol_table::add_undefined_symbols_from_command_line): New
16807         function.
16808         (Symbol_table::do_add_undefined_symbols_from_command_line): New
16809         function.
16810         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
16811         (Symbol::output_section): Likewise.
16812         (Symbol::set_output_section): Likewise.
16813         (Symbol_table::sized_finalize_symbol): Likewise.
16814         (Symbol_table::sized_write_globals): Likewise.
16815         * resolve.cc (Symbol_table::should_override): Likewise.
16816         (Symbol::override_base_with_special): Likewise.
16817
16818         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
16819         symbol, change it to have default visibility.
16820         * testsuite/protected_1.cc: New file.
16821         * testsuite/protected_2.cc: New file.
16822         * testsuite/protected_3.cc: New file.
16823         * testsuite/protected_main_1.cc: New file.
16824         * testsuite/protected_main_2.cc: New file.
16825         * testsuite/protected_main_3.cc: New file.
16826         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
16827         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
16828         (protected_1_LDFLAGS, protected_1_LDADD): Define.
16829         (protected_1.so): New target.
16830         (protected_1_pic.o, protected_2_pic.o): New targets.
16831         (protected_3_pic.o): New target.
16832         (check_PROGRAMS): Add protected_2.
16833         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
16834         (protected_2_LDFLAGS, protected_2_LDADD): Define.
16835         * testsuite/Makefile.in: Rebuild.
16836
16837         * options.h (DEFINE_var): Add set_user_set_##varname__.
16838         (DEFINE_bool_alias): New macro.
16839         (class General_options): Define -Bstatic using DEFINE_bool_alias
16840         rather than DEFINE_special.  Add --undefined as an alias for -z
16841         defs.
16842         * options.cc (General_options::parse_Bstatic): Remove.
16843
16844         * options.h (class General_options): Add --fatal-warnings.
16845         * main.cc (main): Implement --fatal-warnings.
16846         * errors.h (Errors::warning_count): New function.
16847
16848         * options.h (class General_options): Add -Bsymbolic-functions.
16849         * symtab.h (Symbol::is_preemptible): Check for
16850         -Bsymbolic-functions.
16851
16852 2008-05-05  Ian Lance Taylor  <iant@google.com>
16853
16854         * options.h (DEFINE_bool): For DASH_Z, create the negative option
16855         as noVARNAME rather than no-VARNAME.
16856         (class General_options): Add option -z combreloc.
16857         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
16858         get_address.
16859         (Output_reloc::sort_before) [SHT_REL]: New function.
16860         (Output_reloc::sort_before) [SHT_RELA]: New function.
16861         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
16862         Sort_relocs_comparison.
16863         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
16864         parameter.  Change all callers.
16865         (Output_data_reloc::Output_data_reloc) [both versions]: Add
16866         sort_relocs parameter.  Change all callers.
16867         * output.cc (Output_reloc::get_address): New function, broken out
16868         of write_rel.
16869         (Output_reloc::write_rel): Call it.
16870         (Output_reloc::compare): New function.
16871         (Output_data_reloc_base::do_write): Optionally sort relocs.
16872
16873         * configure.ac: If targ_extra_obj is set, link it in.
16874         * configure.tgt: Initialize all variables.
16875         (x86_64*): Set targ_extra_obj and targ_extra_size.
16876         * configure: Rebuild.
16877
16878         * object.cc (Sized_relobj::include_section_group): Adjust section
16879         indexes read from group data.  Build vector to pass to
16880         layout_group.
16881         * layout.cc (Layout::layout_group): Add flags and shndxes
16882         parameters.  Remove contents parameter.  Change caller.  Update
16883         explicit instantiations.
16884         * layout.h (class Layout): Update layout_group declaration.
16885         * output.cc (Output_data_group::Output_data_group): Add flags and
16886         input_shndxes parameters.  Remove contents parameter.  Change
16887         caller.
16888         (Output_data_group::do_write): Change input_sections_ to
16889         input_shndxes_.
16890         * output.h (class Output_data_group): Update constructor
16891         declaration.  Rename input_sections_ to input_shndxes_.
16892         * testsuite/many_sections_test.cc: Add template.
16893
16894 2008-04-30  Cary Coutant  <ccoutant@google.com>
16895
16896         * target-reloc.h (relocate_section): Fix dead-pointer bug.
16897
16898         * layout.cc (Layout::include_section): Refactored check for debug
16899         info section.
16900         (Layout::add_comdat): Add new parameters.  Change type
16901         of signature parameter.  Add object and shndx to signatures table.
16902         (Layout::find_kept_object): New function.
16903         * layout.h: Include <cstring>.
16904         (Layout::is_debug_info_section): New function.
16905         (Layout::add_comdat): Add new parameters.
16906         (Layout::find_kept_object): New function.
16907         (Layout::Kept_section): New struct.
16908         (Layout::Signatures): Change type of map range.
16909         * object.cc (Relobj::output_section_address): New function.
16910         (Sized_relobj::include_section_group): Add new parameters.  Change
16911         calls to Layout::add_comdat.  Change to build table of kept comdat
16912         groups and table mapping discarded sections to kept sections.
16913         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
16914         (Sized_relobj::do_layout): Change calls to include_section_group and
16915         include_linkonce_section.
16916         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
16917         value to zero when section is discarded.
16918         (Sized_relobj::map_to_kept_section): New function.
16919         * object.h (Relobj::output_section_address): New function.
16920         (Relobj::Comdat_group): New type.
16921         (Relobj::find_comdat_group): New function.
16922         (Relobj::Comdat_group_table): New type.
16923         (Relobj::Kept_comdat_section): New type.
16924         (Relobj::Kept_comdat_section_table): New type.
16925         (Relobj::add_comdat_group): New function.
16926         (Relobj::set_kept_comdat_section): New function.
16927         (Relobj::get_kept_comdat_section): New function.
16928         (Relobj::comdat_groups_): New field.
16929         (Relobj::kept_comdat_sections_): New field.
16930         (Symbol_value::input_value): Update comment.
16931         (Sized_relobj::map_to_kept_section) New function.
16932         (Sized_relobj::include_linkonce_section): Add new parameter.
16933         * target-reloc.h (Comdat_behavior): New type.
16934         (get_comdat_behavior): New function.
16935         (relocate_section): Add code to map a discarded section to the
16936         corresponding kept section when applying a relocation.
16937
16938 2008-04-30  Craig Silverstein  <csilvers@google.com>
16939
16940         * dwarf_reader.cc (next_generation_count): New static var.
16941         (Addr2line_cache_entry): New struct.
16942         (addr2line_cache): New static var.
16943         (Dwarf_line_info::one_addr2line): Added caching.
16944         (Dwarf_line_info::clear_addr2line_cache): New function.
16945         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
16946         cache-size parameter.
16947         (Dwarf_line_info::one_addr2line_cache): New function.
16948         * symtab.cc (Symbol_table::detect_odr_violations): Pass
16949         new cache-size argument to one_addr2line(), and clear cache.
16950
16951 2008-04-28  Cary Coutant  <ccoutant@google.com>
16952
16953         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
16954         R_386_PC8 relocations.
16955
16956 2008-04-23  Ian Lance Taylor  <iant@google.com>
16957
16958         * object.cc (Sized_relobj::include_section_group): Check for
16959         invalid section group.
16960
16961         * object.cc (make_elf_object): Correct test for 64-bit ELF file
16962         header size.
16963
16964         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
16965         than read for file header.
16966         * archive.cc (Archive::include_member): Likewise.
16967
16968 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
16969
16970         * aclocal.m4: Regenerate.
16971         * configure: Regenerate.
16972
16973 2008-04-19  Ian Lance Taylor  <iant@google.com>
16974
16975         * version.cc (version_string): Bump to 1.6.
16976
16977         * testsuite/Makefile.am (many_sections_r_test): New target.
16978         (many_sections_r_test_SOURCES): Remove.
16979         (many_sections_r_test_DEPENDENCIES): Remove.
16980         (many_sections_r_test_LDFLAGS): Remove.
16981         (many_sections_r_test_LDADD): Remove.
16982
16983         * object.cc (Sized_relobj::do_add_symbols): Always pass
16984         local_symbol_count_ to add_from_relobj.
16985
16986         * testsuite/Makefile.am (many_sections_check.h): Only check one in
16987         every thousand variables.
16988         * testsuite/Makefile.in: Rebuild.
16989
16990         * object.cc (Xindex::initialize_symtab_xindex): New function.
16991         (Xindex::read_symtab_xindex): New function.
16992         (Xindex::sym_xindex_to_shndx): New function.
16993         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
16994         available.
16995         (Sized_relobj::do_initialize_xindex): New function.
16996         (Sized_relobj::do_read_symbols): Adjust section links.
16997         (Sized_relobj::symbol_section_and_value): Add is_ordinary
16998         parameter.  Change all callers.
16999         (Sized_relobj::include_section_group): Adjust section links and
17000         symbol section indexes.
17001         (Sized_relobj::do_layout): Adjust section links.
17002         (Sized_relobj::do_count_local_symbols): Adjust section links and
17003         symbol section indexes.
17004         (Sized_relobj::do_finalize_local_symbols): Distinguish between
17005         ordinary and special symbols.
17006         (Sized_relobj::write_local_symbols): Add symtab_xindex and
17007         dynsym_xindex parameters.  Change all callers.  Adjust section
17008         links.  Use SHN_XINDEX when needed.
17009         (Sized_relobj::get_symbol_location_info): Adjust section links.
17010         Don't get fooled by special symbols.
17011         * object.h (class Xindex): Define.
17012         (class Object): Add xindex_ parameter.  Declare virtual functoin
17013         do_initialize_xindex.
17014         (Object::adjust_sym_shndx): New function.
17015         (Object::set_xindex): New protected function.
17016         (class Symbol_value): Add is_ordinary_shndx_ field.
17017         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
17018         (Symbol_value::value): Assert ordinary section.
17019         (Symbol_value::initialize_input_to_output_map): Likewise.
17020         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
17021         Change all callers.
17022         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
17023         all callers.
17024         (class Sized_relobj): Update declarations.
17025         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
17026         parameter.  Change all callers.
17027         (Sized_relobj::adjust_shndx): New function.
17028         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
17029         field.
17030         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
17031         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
17032         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
17033         (Sized_dynobj::read_dynsym_section): Adjust section links.
17034         (Sized_dynobj::read_dynamic): Likewise.
17035         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
17036         section links.
17037         (Sized_dynobj::do_initialize_xindex): New function.
17038         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
17039         do_initialize_xindex.
17040         (Sized_dynobj::adjust_shndx): New function.
17041         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
17042         dynsym_xindex_ fields.
17043         (Layout::finalize): Add a call to set_section_indexes before
17044         creating the symtab sections.
17045         (Layout::set_section_indexes): Don't do anything if the section
17046         already has a section index.
17047         (Layout::create_symtab_sections): Add shnum parameter.  Change
17048         caller.  Create .symtab_shndx section if needed.
17049         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
17050         caller.
17051         (Layout::allocated_output_section_count): New function.
17052         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
17053         needed.
17054         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
17055         fields.  Update declarations.
17056         (Layout::symtab_xindex): New function.
17057         (Layout::dynsym_xindex): New function.
17058         (class Write_symbols_task): Add layout_ field.
17059         (Write_symbols_task::Write_symbols_task): Add layout parameter.
17060         Change caller.
17061         * output.cc (Output_section_headers::Output_section_headers): Add
17062         shstrtab_section parameter.  Change all callers.
17063         (Output_section_headers::do_sized_write): Store overflow values
17064         for section count and section string table section index in
17065         section header zero.
17066         (Output_file_header::do_sized_write): Check for overflow of
17067         section count and section string table section index.
17068         (Output_symtab_xindex::do_write): New function.
17069         (Output_symtab_xindex::endian_do_write): New function.
17070         * output.h (class Output_section_headers): Add shstrtab_section_.
17071         Update declarations.
17072         (class Output_symtab_xindex): Define.
17073         (Output_section::has_out_shndx): New function.
17074         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
17075         field.
17076         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
17077         Change all callers.
17078         (Sized_symbol::init): Likewise.
17079         (Symbol::output_section): Check for ordinary symbol.
17080         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
17081         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
17082         callers.
17083         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
17084         Change all callers.  Simplify handling of symbols from sections
17085         not included in the link.
17086         (Symbol_table::add_from_dynobj): Handle ordinary symbol
17087         distinction.
17088         (Weak_alias_sorter::operator()): Assert that symbols are
17089         ordinary.
17090         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
17091         distinction.
17092         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
17093         parameters.  Change all callers.
17094         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
17095         symbol distinction.  Use SHN_XINDEX when needed.
17096         (Symbol_table::write_section_symbol): Add symtab_xindex
17097         parameter.  Change all callers.
17098         (Symbol_table::sized_write_section_symbol): Likewise.  Use
17099         SHN_XINDEX when needed.
17100         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
17101         declarations.
17102         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
17103         (Symbol::is_defined): Check is_ordinary.
17104         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
17105         (Symbol::is_absolute, Symbol::is_common): Likewise.
17106         (class Sized_symbol): Update declarations.
17107         (class Symbol_table): Update declarations.
17108         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
17109         parameters.  Change all callers.
17110         (Sized_symbol::override): Likewise.
17111         (Symbol_table::override): Likewise.
17112         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
17113         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
17114         is_ordinary, and orig_st_shndx parameters.  Change all callers.
17115         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
17116         to be in an ordinary section.
17117         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
17118         object and is_ordinary parameters.  Change all callers.
17119         (Sized_dwarf_line_info::read_relocs): Add object parameter.
17120         Change all callers.  Don't add undefined or non-ordinary symbols
17121         to reloc_map_.
17122         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
17123         Change all callers.
17124         * dwarf_reader.h (class Sized_dwarf_line_info): Update
17125         declarations.
17126         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
17127         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
17128         (Sized_relobj::relocate_sections): Likewise.
17129         * target-reloc.h (scan_relocs): Adjust section symbol index.
17130         (scan_relocatable_relocs): Likewise.
17131         * i386.cc (Scan::local): Check for ordinary symbols.
17132         * sparc.cc (Scan::local): Likewise.
17133         * x86_64.cc (Scan::local): Likewise.
17134         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
17135         to symbol_section_and_value.
17136         * testsuite/many_sections_test.cc: New file.
17137         * testsuite/Makefile.am (BUILT_SOURCES): Define.
17138         (check_PROGRAMS): Add many_sections_test.
17139         (many_sections_test_SOURCES): Define.
17140         (many_sections_test_DEPENDENCIES): Define.
17141         (many_sections_test_LDFLAGS): Define.
17142         (BUILT_SOURCES): Add many_sections_define.h.
17143         (many_sections_define.h): New target.
17144         (BUILT_SOURCES): Add many_sections_check.h.
17145         (many_sections_check.h): New target.
17146         (check_PROGRAMS): Add many_sections_r_test.
17147         (many_sections_r_test_SOURCES): Define.
17148         (many_sections_r_test_DEPENDENCIES): Define.
17149         (many_sections_r_test_LDFLAGS): Define.
17150         (many_sections_r_test_LDADD): Define.
17151         (many_sections_r_test.o): New target.
17152         * testsuite/Makefile.in: Rebuild.
17153
17154 2008-04-17  Cary Coutant  <ccoutant@google.com>
17155
17156         * errors.cc (Errors::info): New function.
17157         (gold_info): New function.
17158         * errors.h (Errors::info): New function.
17159         * gold.h (gold_info): New function.
17160         * object.cc (Input_objects::add_object): Print trace output.
17161         * options.cc (options::parse_set): New function.
17162         (General_options::parse_wrap): Deleted.
17163         (General_options::General_options): Deleted initializer.
17164         * options.h (options::String_set): New typedef.
17165         (options::parse_set): New function.
17166         (DEFINE_set): New macro.
17167         (General_options::wrap): Changed to use DEFINE_set. Changed
17168         callers of any_wrap_symbols and is_wrap_symbol.
17169         (General_options::trace, General_options::trace_symbol):
17170         New options.
17171         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
17172         (General_options::wrap_symbols_): Deleted.
17173         * symtab.cc (Symbol_table::add_from_object): Print trace output.
17174
17175 2008-04-17  David S. Miller  <davem@davemloft.net>
17176
17177         * options.cc (General_options::parse_V): New function.
17178         * options.h: Add entries for -V and -Qy.
17179
17180 2008-04-17  Ian Lance Taylor  <iant@google.com>
17181
17182         * common.cc (Symbol_table::allocate_commons): Remove options
17183         parameter.  Change caller.
17184         (Symbol_table::do_allocate_commons): Remove options parameter.
17185         Change caller.  Just call do_allocate_commons_list twice.
17186         (Symbol_table::do_allocate_commons_list): New function, broken out
17187         of do_allocate_commons.
17188         * common.h (class Allocate_commons_task): Remove options_ field.
17189         Update constructor.
17190         * symtab.cc (Symbol_table::Symbol_table): Initialize
17191         tls_commons_.
17192         (Symbol_table::add_from_object): Put TLS common symbols on
17193         tls_commons_ list.
17194         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
17195         which are IN_OUTPUT_DATA.
17196         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
17197         allocate_commons and do_allocate_commons declarations.  Declare
17198         do_allocate_commons_list.
17199         * gold.cc (queue_middle_tasks): Update creation of
17200         Allocate_commons_task to not pass options.
17201         * testsuite/Makefile.am (INCLUDES): Add -I.. .
17202         (TLS_TEST_C_FLAGS): New variable.
17203         (tls_test_c_pic.o): New target.
17204         (tls_test_shared.so): Link in tls_test_c_pic.o.
17205         (tls_test_c_pic_ie.o): New target.
17206         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
17207         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
17208         (tls_test_c.o): New target.
17209         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
17210         (tls_pic_test_LDADD): Likewise.
17211         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
17212         (tls_shared_gd_to_ie_test_LDADD): Likewise.
17213         (tls_test_c_gnu2.o): New target.
17214         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
17215         tls_test_c_gnu2.o.
17216         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
17217         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
17218         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
17219         * testsuite/tls_test.cc: Include "config.h".
17220         (t_last): Call t11_last.
17221         * testsuite/tls_test.h (t11, t11_last): Declare.
17222         * testsuite/tls_test_c.c: New file.
17223         * testsuite/tls_test_main.cc (thread_routine): Call t11.
17224         * configure.ac: Check for OpenMP support.
17225         * configure, config.in, Makefile.in: Rebuild.
17226         * testsuite/Makefile.in: Rebuild.
17227
17228 2008-04-16  Cary Coutant  <ccoutant@google.com>
17229
17230         * i386.cc (Target_i386::define_tls_base_symbol): New function.
17231         (Target_i386::tls_base_symbol_defined_): New field.
17232         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
17233         (Target_i386::Scan::global): Likewise.
17234         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
17235         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
17236         (Target_x86_64::tls_base_symbol_defined_): New field.
17237         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
17238         (Target_x86_64::Scan::global): Likewise.
17239
17240 2008-04-16  Cary Coutant  <ccoutant@google.com>
17241
17242         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
17243         (Symbol::needs_plt_entry): Allow weak undefined symbols.
17244         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
17245         building shared libraries.
17246         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
17247         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
17248         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
17249         * testsuite/Makefile.in: Rebuild.
17250         * testsuite/weak_undef.h: New file.
17251         * testsuite/weak_undef_file1.cc: Add extra test cases.
17252         * testsuite/weak_undef_file2.cc: Likewise.
17253         * testsuite/weak_undef_test.cc: Likewise.
17254
17255 2008-04-16  David S. Miller  <davem@davemloft.net>
17256
17257         * sparc.cc (Target_sparc::Scan): Change from struct to class.
17258         Add issued_non_pic_error_ field.  Declare check_non_pic.
17259         (Target_sparc::Scan::check_non_pic): New function.
17260         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
17261         (Target_sparc::Scan::global): Likewise.
17262
17263         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
17264         * configure: Rebuild.
17265
17266         * options.h (DEFINE_enable): New macro.
17267         (new_dtags): New enable option.
17268         (initfirst, interpose, loadfltr, nodefaultlib,
17269         nodelete, nodlopen, nodump): New -z options.
17270         * layout.cc (Layout:finish_dynamic_section): If new
17271         dtags enabled, emit DT_RUNPATH.  Also, emit a
17272         DT_FLAGS_1 containing any specified -z flags.
17273
17274 2008-04-16  Ian Lance Taylor  <iant@google.com>
17275
17276         * copy-relocs.cc: New file.
17277         * copy-relocs.h: New file.
17278         * reloc.cc: Remove Copy_relocs code.
17279         * reloc.h: Likewise.
17280         * reloc-types.h (struct Reloc_types) [both versions]: Add
17281         get_reloc_addend_noerror.
17282         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
17283         variants of add_global which take an addend which must be zero.
17284         * i386.cc: Include "copy-relocs.h".
17285         (class Target_i386): Change type of copy_relocs_ to variable,
17286         update initializer.
17287         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
17288         Change all callers.
17289         (Target_i386::do_finalize_sections): Change handling of
17290         copy_relocs_.
17291         * sparc.cc: Include "copy-relocs.h".
17292         (class Target_sparc): Change type of copy_relocs_ to variable,
17293         update initializer.
17294         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
17295         Change all callers.
17296         (Target_sparc::do_finalize_sections): Change handling of
17297         copy_relocs_.
17298         * x86_64.cc: Include "copy-relocs.h".
17299         (class Target_x86_64): Change type of copy_relocs_ to variable,
17300         update initializer.
17301         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
17302         class.  Change all callers.
17303         (Target_x86_64::do_finalize_sections): Change handling of
17304         copy_relocs_.
17305         * Makefile.am (CCFILES): Add copy-relocs.cc.
17306         (HFILES): Add copy-relocs.h.
17307
17308         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
17309
17310         * testsuite/script_test_4.sh: Permit leading zeroes.
17311
17312 2008-04-15  Ian Lance Taylor  <iant@google.com>
17313
17314         * script-sections.cc (Script_sections::create_segments): Use
17315         header_size_adjustment even when there is enough room for the
17316         headers.
17317         * testsuite/script_test_4.sh: New file.
17318         * testsuite/script_test_4.t: New file.
17319         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
17320         (check_DATA): Add script_test_4.stdout.
17321         (MOSTLYCLEANFILES): Likewise.
17322         (script_test_4): New target.
17323         (script_test_4.stdout): New target.
17324         * testsuite/Makefile.in: Rebuild.
17325
17326         * sparc.cc: Add definitions for Output_data_plt_sparc class
17327         constants.
17328
17329 2008-04-14  David S. Miller  <davem@davemloft.net>
17330
17331         * sparc.cc: New file.
17332         * Makefile.am (TARGETSOURCES): Add sparc.cc
17333         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
17334         * configure.tgt: Document targ_extra_size and
17335         targ_extra_big_endian.  Add entries for sparc-* and
17336         sparc64-*.
17337         * configure.ac: Handle targ_extra_size and
17338         targ_extra_big_endian.
17339         * Makefile.in: Rebuild.
17340         * configure: Likewise.
17341         * po/POTFILES.in: Likewise.
17342         * po/gold.pot: Likewise.
17343
17344 2008-04-14  Ian Lance Taylor  <iant@google.com>
17345
17346         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
17347         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
17348         in the name/type/flags to section mapping.  Don't call
17349         allocate_output_section.
17350         (Layout::choose_output_section): Change parameter from adjust_name
17351         to is_input_section.  Don't permit input sections after sections
17352         are attached to segments.  Don't call allocate_output_section.
17353         (Layout::layout_eh_frame): Call update_flags_for_input_section,
17354         not write_enable_output_section.
17355         (Layout::make_output_section): Don't push to
17356         unattached_section_list_ nor call attach_to_segment.  Call
17357         attach_section_to_segment if sections are attached.
17358         (Layout::attach_sections_to_segments): New function.
17359         (Layout::attach_section_to_segment): New function.
17360         (Layout::attach_allocated_section_to_segment): Rename from
17361         attach_to_segment.  Remove flags parameter.
17362         (Layout::allocate_output_section): Remove function.
17363         (Layout::write_enable_output_section): Remove function.
17364         * layout.h (class Layout): Update for above changes.  Add new
17365         field sections_are_attached_.
17366         * output.h (Output_section::update_flags_for_input_section): New
17367         function.
17368         * output.cc (Output_section::add_input_section): Call
17369         update_flags_for_input_section.
17370         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
17371
17372 2008-04-11  Cary Coutant  <ccoutant@google.com>
17373
17374         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
17375         thought unnecessary.
17376         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
17377
17378 2008-04-11  Ian Lance Taylor  <iant@google.com>
17379
17380         * output.h (class Output_section_data): Remove inline definition
17381         of set_addralign.
17382         * output.cc (Output_section_data::set_addralign): New function.
17383
17384 2008-04-11  Cary Coutant  <ccoutant@google.com>
17385
17386         Add support for TLS descriptors for i386 and x86_64.
17387         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
17388         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
17389         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
17390         GOT_TYPE_TLS_DESC.
17391         (Target_i386::got_mod_index_entry): Remove unnecessary code.
17392         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
17393         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
17394         relocations.
17395         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
17396         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
17397         Fix problem with initial-exec relocations.
17398         (Target_i386::Relocate::relocate_tls): Likewise.
17399         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
17400         relaxation.
17401         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
17402         support for section-plus-offset dynamic table entries.
17403         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
17404         (Output_data_dynamic::Dynamic_entry): Add support for
17405         section-plus-offset dynamic table entries.
17406         (Output_data_dynamic::Classification): Likewise.
17407         (Output_data_dynamic::classification_): Renamed offset_.
17408         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
17409         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
17410         (Target_x86_64::make_plt_section): New function.
17411         (Target_x86_64::reserve_tlsdesc_entries): New function.
17412         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
17413         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
17414         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
17415         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
17416         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
17417         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
17418         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
17419         add extra PLT entry for TLS descriptors.
17420         (Output_data_plt_x86_64::got_): New field.
17421         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
17422         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
17423         fields.
17424         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
17425         descriptors.
17426         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
17427         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
17428         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
17429         R_386_TLS_DESC_CALL relocations.
17430         (Target_x86_64::Scan::global): Likewise.
17431         (Target_x86_64::do_finalize_sections): Add dynamic table entries
17432         for TLS descriptors.
17433         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
17434         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
17435         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
17436         GD-to-IE relaxation.
17437         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
17438         and TLS_DESCRIPTORS.
17439         * Makefile.in: Rebuild.
17440         * configure: Rebuild.
17441         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
17442         (tls_test_shared2.so): New target.
17443         (tls_shared_gd_to_ie_test_SOURCES): New variable.
17444         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
17445         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
17446         (tls_shared_gd_to_ie_test_LDADD): New variable.
17447         (tls_shared_gnu2_gd_to_ie_test): New target.
17448         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
17449         New targets.
17450         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
17451         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
17452         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
17453         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
17454         (tls_shared_gnu2_test): New target.
17455         (tls_test_gnu2_shared.so): New target.
17456         (tls_shared_gnu2_test_SOURCES): New variable.
17457         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
17458         (tls_shared_gnu2_test_LDFLAGS): New variable.
17459         (tls_shared_gnu2_test_LDADD): New variable.
17460         * testsuite/Makefile.in: Rebuild.
17461         * testsuite/Makefile.
17462
17463 2008-04-11  Ian Lance Taylor  <iant@google.com>
17464
17465         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
17466         justsyms.t.
17467         * testsuite/Makefile.in: Rebuild.
17468
17469         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
17470         long.
17471         * testsuite/script_test_2.cc (main): Adjust test.
17472
17473 2008-04-11  David S. Miller  <davem@davemloft.net>
17474             Ian Lance Taylor  <iant@google.com>
17475
17476         * options.h (General_options): Add entries for '-Y' and
17477         '-relax'.
17478         * options.cc (General_options:finalize): If -Y was used, add those
17479         entries to the library path instead of the default "/lib" and
17480         "/usr/lib".
17481
17482 2008-04-11  David S. Miller  <davem@davemloft.net>
17483
17484         * testsuite/justsyms.t: Start at 0x100.
17485         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
17486         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
17487         long.
17488         * testsuite/script_test_2.cc: Adjust string and section length
17489         checks.
17490
17491 2008-04-09  Ian Lance Taylor  <iant@google.com>
17492
17493         PR gold/5996
17494         * script-sections.cc (Sections_element::allocate_to_segment): Add
17495         orphan parameter.
17496         (Output_section_definition::allocate_to_segment): Likewise.
17497         (Orphan_output_section::allocate_to_segment): Likewise.
17498         (Script_sections::attach_sections_using_phdrs_clause): Don't
17499         propagate non-PT_LOAD segments to orphan sections.
17500         * testsuite/Makefile.am (script_test_3.stdout): Generate using
17501         readelf rather than objdump.
17502         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
17503         .interp section and PT_INTERP segment are the same size.
17504         * testsuite/Makefile.in: Rebuild.
17505
17506         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
17507         aliases for symbols defined in the same object.
17508         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
17509         (weak_alias_test_SOURCES): New variable.
17510         (weak_alias_test_DEPENDENCIES): New variable.
17511         (weak_alias_test_LDFLAGS): New variable.
17512         (weak_alias_test_LDADD): New variable.
17513         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
17514         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
17515         (weak_alias_test_3.o): New target.
17516         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
17517         * testsuite/weak_alias_test_main.cc: New file.
17518         * testsuite/weak_alias_test_1.cc: New file.
17519         * testsuite/weak_alias_test_2.cc: New file.
17520         * testsuite/weak_alias_test_3.cc: New file.
17521
17522 2008-04-08  Ian Lance Taylor  <iant@google.com>
17523
17524         * options.h (class General_options): Add --noinhibit-exec option.
17525         * main.cc (main): Check --noinhibit-exec.
17526
17527         * options.h (class General_options): Define --wrap as a special
17528         option.  Add wrap_symbols_ field.
17529         (General_options::any_wrap_symbols): New function.
17530         (General_options::is_wrap_symbol): New function.
17531         * options.cc (General_options::parse_wrap): New function.
17532         (General_options::General_options): Initialize wrap_symbols_.
17533         * symtab.cc (Symbol_table::wrap_symbol): New function.
17534         (Symbol_table::add_from_object): Handle --wrap.
17535         * symtab.h (class Symbol_table): Declare wrap_symbol.
17536         * target.h (Target::wrap_char): New function.
17537         (Target::Target_info): Add wrap_char field.
17538         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
17539         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
17540         * testsuite/testfile.cc (Target_test::test_target_info):
17541         Likewise.
17542
17543         * errors.cc (Errors::undefined_symbol): Mention symbol version if
17544         there is one.
17545
17546         * layout.h (class Layout): Add added_eh_frame_data_ field.
17547         * layout.cc (Layout::Layout): Initialize new field.
17548         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
17549         output section until we find a section we merged successfully.
17550         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
17551         that the size be non-zero.
17552
17553         * merge.cc (Object_merge_map::get_output_offset): Remove inline
17554         qualifier.
17555
17556 2008-04-08  Craig Silverstein  <csilvers@google.com>
17557
17558         * configure.ac: Export new conditional variable HAVE_ZLIB.
17559         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
17560         on HAVE_ZLIB.
17561         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
17562         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17563
17564 2008-04-07  Ian Lance Taylor  <iant@google.com>
17565
17566         * version.cc (version_string): Set to "1.5".
17567
17568         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
17569         Add issued_non_pic_error_ field.  Declare check_non_pic.
17570         (Target_x86_64::Scan::check_non_pic): New function.
17571         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
17572         (Target_x86_64::Scan::global): Likewise.
17573
17574         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
17575         addend parameter.  Change caller.  Handle merge sections.
17576         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
17577         Address to Addend.  Don't add in the result of
17578         local_section_offset, pass down the addend and use the returned
17579         value.
17580         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
17581         Update declarations of local_section_offset and symbol_value.
17582         * testsuite/two_file_test_1.cc (t18): New function.
17583         * testsuite/two_file_test_2.cc (f18): New function.
17584         * testsuite/two_file_test_main.cc (main): Call t18.
17585         * testsuite/two_file_test.h (t18, f18): Declare.
17586
17587         * configure.ac: Don't test for objdump, c++filt, or readelf.
17588         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
17589         conditionals.
17590         (TEST_READELF): New variable.
17591         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
17592         (check_PROGRAMS): Add two_file_strip_test.
17593         (two_file_strip_test): New target.
17594         (check_PROGRAMS): Add two_file_same_shared_strip_test.
17595         (two_file_same_shared_strip_test_SOURCES): New variable.
17596         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
17597         (two_file_same_shared_strip_test_LDFLAGS): New variable.
17598         (two_file_same_shared_strip_test_LDADD): New variable.
17599         (two_file_shared_strip.so): New target.
17600         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
17601         (ver_test_5.syms, ver_test_7.syms): Likewise.
17602         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
17603         (strip_test_3.stdout): Use TEST_OBJDUMP.
17604         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17605
17606 2008-04-04  Cary Coutant  <ccoutant@google.com>
17607
17608         * symtab.h (Symbol::is_weak_undefined): New function.
17609         (Symbol::is_strong_undefined): New function.
17610         (Symbol::is_absolute): New function.
17611         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
17612         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
17613         absolute symbols.
17614         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
17615         (weak_undef_test): New target.
17616         * testsuite/Makefile.in: Rebuild.
17617         * testsuite/weak_undef_file1.cc: New file.
17618         * testsuite/weak_undef_file2.cc: New file.
17619         * testsuite/weak_undef_test.cc: New file.
17620
17621 2008-04-03  Craig Silverstein  <csilvers@google.com>
17622
17623         * compressed_output.h (class Output_compressed_section): Use
17624         unsigned buffer.
17625         * compressed_output.cc (zlib_compress): Use unsigned buffers,
17626         add zlib header.
17627         (zlib_compressed_suffix): Removed.
17628         (Output_compressed_section::set_final_data_size): Use unsigned
17629         buffers.
17630         * testsuite/Makefile.am (flagstest_compress_debug_sections):
17631         Fix linker invocation.
17632         (flagstest_o_specialfile_and_compress_debug_sections):
17633         Likewise.
17634         * testsuite/Makefile.in: Regenerated.
17635
17636 2008-04-02  David S. Miller  <davem@davemloft.net>
17637
17638         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
17639         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
17640
17641 2008-04-02  Craig Silverstein  <csilvers@google.com>
17642
17643         * TODO: New file.
17644
17645 2008-04-02  Ian Lance Taylor  <iant@google.com>
17646
17647         * fileread.cc (File_read::find_view): Add byteshift and vshifted
17648         parameters.  Update for new key type to views_.  Change all
17649         callers.
17650         (File_read::read): Adjust for byteshift in returned view.
17651         (File_read::add_view): New function, broken out of
17652         find_and_make_view.
17653         (File_read::make_view): New function, broken out of
17654         find_and_make_view.
17655         (File_read::find_or_make_view): Add offset and aligned
17656         parameters.  Rewrite accordingly.  Change all callers.
17657         (File_read::get_view): Add offset and aligned parameters.  Adjust
17658         for byteshift in return value.
17659         (File_read::get_lasting_view): Likewise.
17660         * fileread.h (class File_read): Update declarations.
17661         (class File_read::View): Add byteshift_ field.  Add byteshift to
17662         constructor.  Add byteshift method.
17663         * archive.h (Archive::clear_uncached_views): New function.
17664         (Archive::get_view): Add aligned parameter.  Change all callers.
17665         * object.h (Object::get_view): Add aligned parameter.  Change all
17666         callers.
17667         (Object::get_lasting_view): Likewise.
17668
17669         * fileread.cc (File_read::release): Don't call clear_views if
17670         there are multiple objects.
17671         * fileread.h (File_read::clear_uncached_views): New function.
17672         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
17673         on the archive.
17674
17675 2008-03-31  Cary Coutant  <ccoutant@google.com>
17676
17677         Add thin archive support.
17678         * archive.cc (Archive::armagt): New const.
17679         (Archive::setup): Remove task parameter and calls to unlock.
17680         (Archive::unlock_nested_archives): New function.
17681         (Archive::read_header): Add nested_off parameter. Change
17682         all callers.
17683         (Archive::interpret_header): Likewise.
17684         (Archive::include_all_members): Change to handle thin
17685         archives.
17686         (Archive::include_member): Likewise.
17687         * archive.h (Archive::Archive): Add new parameters and
17688         initializers.
17689         (Archive::armagt): New const.
17690         (Archive::setup): Remove task parameter.
17691         (Archive::unlock_nested_archives): New function.
17692         (Archive::read_header): Add nested_off parameter.
17693         (Archive::interpret_header): Likewise.
17694         (Archive::Nested_archive_table): New typedef.
17695         (Archive::is_thin_archive_): New field.
17696         (Archive::nested_archives_): New field.
17697         (Archive::options_): New field.
17698         (Archive::dirpath_): New field.
17699         (Archive::task_): New field.
17700         * readsyms.cc (Read_symbols::do_read_symbols): Add check
17701         for thin archives.  Pass additional parameters to
17702         Archive::Archive.  Unlock the archive file after calling
17703         Archive::setup.
17704
17705 2008-03-29  Ian Lance Taylor  <iant@google.com>
17706
17707         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
17708         version symbol to be local.
17709         * testsuite/ver_test_4.sh: New file.
17710         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
17711         (check_DATA): Add ver_test_4.syms.
17712         (ver_test_4.syms): New target.
17713         * testsuite/Makefile.in: Rebuild.
17714
17715         * output.cc
17716         (Output_section::Input_section_sort_entry::has_priority): New
17717         function.
17718         (Output_section::Input_section_sort_entry::match_file_name): New
17719         function.
17720         (Output_section::Input_section_sort_entry::match_section_name):
17721         Remove.
17722         (Output_section::Input_section_sort_entry::match_section_name_prefix):
17723         Remove.
17724         (Output_section::Input_section_sort_entry::match_section_file):
17725         Remove.
17726         (Output_section::Input_section_sort_compare::operator()): Rewrite
17727         using new Input_section_sort_entry functions.  Sort crtbegin and
17728         crtend first.  Sort sections with no priority before sections with
17729         a priority.
17730         * testsuite/initpri1.c (d3): Check j != 4.
17731         (cd5): New constructor/destructor function.
17732         (main): Check j != 2.
17733
17734         * symtab.cc (Symbol_table::add_from_object): If we don't use the
17735         new symbol when resolving, don't call set_is_default.
17736         * testsuite/ver_test_7.cc: New file.
17737         * testsuite/ver_test_7.sh: New file.
17738         * testsuite/Makefile.am (ver_test_7.so): New target.
17739         (ver_test_7.o): New target.
17740         (check_SCRIPTS): Add ver_test_7.sh.
17741         (check_DATA): Add ver_test_7.syms.
17742         (ver_test_7.syms): New target.
17743
17744 2008-03-28  Ian Lance Taylor  <iant@google.com>
17745
17746         * layout.cc (Layout::layout): If we see an input section with a
17747         name that needs sorting, set the must_sort flag for the output
17748         section.
17749         (Layout::make_output_section): If the name of the output section
17750         indicates that it might require sorting, set the may_sort flag.
17751         * output.h (Output_section::may_sort_attached_input_sections): New
17752         function.
17753         (Output_section::set_may_sort_attached_input_sections): New
17754         function.
17755         (Output_section::must_sort_attached_input_sections): New
17756         function.
17757         (Output_section::set_must_sort_attached_input_sections): New
17758         function.
17759         (class Output_section): Declare Input_section_sort_entry.  Define
17760         Input_section_sort_compare.  Declare
17761         sort_attached_input_sections.  Add new fields:
17762         may_sort_attached_input_sections_,
17763         must_sort_attached_input_sections_,
17764         attached_input_sections_are_sorted_.
17765         * output.cc (Output_section::Output_section): Initialize new
17766         fields.
17767         (Output_section::add_input_section): Add an entry to
17768         input_sections_ if may_sort or must_sort are true.
17769         (Output_section::set_final_data_size): Call
17770         sort_attached_input_sections if necessary.
17771         (Output_section::Input_section_sort_entry): Define new class.
17772         (Output_section::Input_section_sort_compare::operator()): New
17773         function.
17774         (Output_section::sort_attached_input_sections): New function.
17775         * configure.ac: Check whether the compiler supports constructor
17776         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
17777         * testsuite/initpri1.c: New file.
17778         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
17779         CONSTRUCTOR_PRIORITY.
17780         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
17781         (initpri1_LDFLAGS): New variable.
17782         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17783
17784 2008-03-27  Ian Lance Taylor  <iant@google.com>
17785
17786         * common.cc (Sort_commons::operator): Correct sorting algorithm.
17787         * testsuite/common_test_1.c: New file.
17788         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
17789         (common_test_1_SOURCES): New variable.
17790         (common_test_1_DEPENDENCIES): New variable.
17791         (common_test_1_LDFLAGS): New variable.
17792
17793         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
17794         and commons_ correctly when NAME/VERSION does not override
17795         NAME/NULL.
17796         * testsuite/ver_test_6.c: New file.
17797         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
17798         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
17799         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
17800
17801 2008-03-26  Ian Lance Taylor  <iant@google.com>
17802
17803         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
17804         of an undefined symbol from a version script.
17805         * testsuite/Makefile.am (ver_test_5.so): New target.
17806         (ver_test_5.o): New target.
17807         (check_SCRIPTS): Add ver_test_5.sh.
17808         (check_DATA): Add ver_test_5.syms.
17809         (ver_test_5.syms): New target.
17810         * testsuite/ver_test_5.cc: New file.
17811         * testsuite/ver_test_5.script: New file.
17812         * testsuite/ver_test_5.sh: New file.
17813         * Makefile.in, testsuite/Makefile.in: Rebuild.
17814
17815         PR gold/5986
17816         Fix problems building gold with gcc 4.3.0.
17817         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
17818         (gold_error_at_location, gold_warning_at_location): Use it.
17819         * configure.ac: Check whether we can compile and use a template
17820         function with a printf attribute.
17821         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
17822         when jumping over bytes.
17823         * object.cc: Instantiate Object::read_section_data.
17824         * debug.h: Include <cstring>
17825         * dwarf_reader.cc: Include <algorithm>
17826         * main.cc: Include <cstring>.
17827         * options.cc: Include <cstring>.
17828         * output.cc: Include <cstring>.
17829         * script.cc: Include <cstring>.
17830         * script.h: Include <string>.
17831         * symtab.cc: Include <cstring> and <algorithm>.
17832         * target-select.cc: Include <cstring>.
17833         * version.cc: Include <string>.
17834         * testsuite/testmain.cc: Include <cstdlib>.
17835         * configure, config.in: Rebuild.
17836
17837 2008-03-25  Ian Lance Taylor  <iant@google.com>
17838
17839         * options.cc: Include "../bfd/bfdver.h".
17840         (options::help): Print bug reporting address.
17841
17842         * version.cc (print_version): Adjust output for current value of
17843         BFD_VERSION_STRING.
17844
17845         * NEWS: New file.
17846
17847         * options.cc (options::help): Print list of supported targets.
17848         * target-select.h: Include <vector>.
17849         (class Target_selector): Make machine_, size_, and is_big_endian_
17850         fields const.  Add bfd_name_ and instantiated_target_ fields.
17851         (Target_selector::Target_selector): Add bfd_name parameter.
17852         (Target_selector::recognize): Make non-virtual, call
17853         do_recognize.
17854         (Target_selector::recognize_by_name): Make non-virtual, call
17855         do_recognize_by_name.
17856         (Target_selector::supported_names): New function.
17857         (Target_selector::bfd_name): New function.
17858         (Target_selector::do_instantiate_target): New pure virtual
17859         function.
17860         (Target_selector::do_recognize): New virtual function.
17861         (Target_selector::do_recognize_by_name): New virtual function.
17862         (Target_selector::instantiate_target): New private function.
17863         (supported_target_names): Declare.
17864         * target-select.cc (Target_selector::Target_selector): Update for
17865         new parameter and fields.
17866         (select_target_by_name): Check that the name matches before
17867         calling recognize_by_name.
17868         (supported_target_names): New function.
17869         * i386.cc (class Target_selector_i386): Update Target_selector
17870         constructor call.  Remove recognize and recognize_by_name.  Add
17871         do_instantiate_target.
17872         * x86_64.cc (class Target_selector_x86_64): Likewise.
17873         * testsuite/testfile.cc (class Target_selector_test): Update for
17874         changes to Target_selector.
17875
17876         * README: Rewrite, with some notes on unsupported features.
17877
17878 2008-03-24  Cary Coutant  <ccoutant@google.com>
17879
17880         * i386.cc (Target_i386::Got_type): New enum declaration.
17881         (Target_i386::Scan::local): Updated callers of Output_data_got
17882         member functions.
17883         (Target_i386::Scan::global): Likewise.
17884         (Target_i386::Relocate::relocate): Likewise.
17885         (Target_i386::Relocate::relocate_tls): Likewise.
17886         * object.h (Got_offset_list): New class.
17887         (Sized_relobj::local_has_got_offset): Added got_type parameter.
17888         (Sized_relobj::local_got_offset): Likewise.
17889         (Sized_relobj::set_local_got_offset): Likewise.
17890         (Sized_relobj::local_has_tls_got_offset): Removed.
17891         (Sized_relobj::local_tls_got_offset): Removed.
17892         (Sized_relobj::set_local_tls_got_offset): Removed.
17893         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
17894         * output.cc (Output_data_got::add_global): Added got_type parameter.
17895         (Output_data_got::add_global_with_rel): Likewise.
17896         (Output_data_got::add_global_with_rela): Likewise.
17897         (Output_data_got::add_global_pair_with_rel): New function.
17898         (Output_data_got::add_global_pair_with_rela): New function.
17899         (Output_data_got::add_local): Added got_type parameter.
17900         (Output_data_got::add_local_with_rel): Likewise.
17901         (Output_data_got::add_local_with_rela): Likewise.
17902         (Output_data_got::add_local_pair_with_rel): New function.
17903         (Output_data_got::add_local_pair_with_rela): New function.
17904         (Output_data_got::add_global_tls): Removed.
17905         (Output_data_got::add_global_tls_with_rel): Removed.
17906         (Output_data_got::add_global_tls_with_rela): Removed.
17907         (Output_data_got::add_local_tls): Removed.
17908         (Output_data_got::add_local_tls_with_rel): Removed.
17909         (Output_data_got::add_local_tls_with_rela): Removed.
17910         * output.h (Output_data_got::add_global): Added got_type parameter.
17911         (Output_data_got::add_global_with_rel): Likewise.
17912         (Output_data_got::add_global_with_rela): Likewise.
17913         (Output_data_got::add_global_pair_with_rel): New function.
17914         (Output_data_got::add_global_pair_with_rela): New function.
17915         (Output_data_got::add_local): Added got_type parameter.
17916         (Output_data_got::add_local_with_rel): Likewise.
17917         (Output_data_got::add_local_with_rela): Likewise.
17918         (Output_data_got::add_local_pair_with_rel): New function.
17919         (Output_data_got::add_local_pair_with_rela): New function.
17920         (Output_data_got::add_global_tls): Removed.
17921         (Output_data_got::add_global_tls_with_rel): Removed.
17922         (Output_data_got::add_global_tls_with_rela): Removed.
17923         (Output_data_got::add_local_tls): Removed.
17924         (Output_data_got::add_local_tls_with_rel): Removed.
17925         (Output_data_got::add_local_tls_with_rela): Removed.
17926         * resolve.cc (Symbol::override_base_with_special): Removed
17927         reference to has_got_offset_ field.
17928         * symtab.cc (Symbol::init_fields): Replaced initialization
17929         of got_offset_ with got_offsets_.  Removed initialization
17930         of has_got_offset_
17931         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
17932         (Symbol::got_offset): Likewise.
17933         (Symbol::set_got_offset): Likewise.
17934         (Symbol::has_tls_got_offset): Removed.
17935         (Symbol::tls_got_offset): Removed.
17936         (Symbol::set_tls_got_offset): Removed.
17937         (Symbol::got_offset_): Removed.
17938         (Symbol::tls_mod_got_offset_): Removed.
17939         (Symbol::tls_pair_got_offset_): Removed.
17940         (Symbol::got_offsets_): New field.
17941         (Symbol::has_got_offset): Removed.
17942         (Symbol::has_tls_mod_got_offset): Removed.
17943         (Symbol::has_tls_pair_got_offset): Removed.
17944         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
17945         (Target_x86_64::Scan::local): Updated callers of Output_data_got
17946         member functions.
17947         (Target_x86_64::Scan::global): Likewise.
17948         (Target_x86_64::Relocate::relocate): Likewise.
17949         (Target_x86_64::Relocate::relocate_tls): Likewise.
17950
17951 2008-03-25  Ben Elliston  <bje@au.ibm.com>
17952
17953         * yyscript.y: Fix spelling error in comment.
17954
17955 2008-03-24  Ian Lance Taylor  <iant@google.com>
17956
17957         * options.h (class General_options): Define build_id option.
17958         * layout.h (class Layout): Declare write_build_id, create_note,
17959         create_build_id.  Add build_id_note_ member.
17960         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
17961         "libiberty.h", "md5.h", "sha1.h".
17962         (Layout::Layout): Initialize eh_frame_data_,
17963         eh_frame_hdr_section_, and build_id_note_.
17964         (Layout::finalize): Call create_build_id.
17965         (Layout::create_note): New function, broken out of
17966         Layout::create_gold_note.
17967         (Layout::create_gold_note): Call create_note.
17968         (Layout::create_build_id): New function.
17969         (Layout::write_build_id): New function.
17970         (Close_task_runner::run): Call write_build_id.
17971
17972         * x86_64.cc: Correct license to GPLv3.
17973
17974 2008-03-23  Ian Lance Taylor  <iant@google.com>
17975
17976         * options.cc: Include "demangle.h".
17977         (parse_optional_string): New function.
17978         (parse_long_option): Handle takes_optional_argument.
17979         (parse_short_option): Update dash_z initializer.  Handle
17980         takes_optional_argument.
17981         (General_options::General_options): Initialize do_demangle_.
17982         (General_options::finalize): Set do_demangle_.  Handle demangling
17983         style.
17984         * options.h (parse_optional_string): Declare.
17985         (struct One_option): Add optional_arg field.  Update constructor.
17986         Update call constructor calls.  Add takes_optional_argument
17987         function.
17988         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
17989         (DEFINE_optional_string): Define.
17990         (General_options::demangle): Change from DEFINE_bool to
17991         DEFINE_optional_string.
17992         (General_options::no_demangle): New function.
17993         (General_options::do_demangle): New function.
17994         (General_options::set_do_demangle): New function.
17995         (General_options::execstack_status_): Move definition to end of
17996         class definition.
17997         (General_options::static_): Likewise.
17998         (General_options::do_demangle_): New field.
17999         * object.cc (big_endian>::get_symbol_location_info): Call
18000         Options::do_demangle, not Options::demangle.
18001         * symtab.cc (demangle): Likewise.
18002
18003 2008-03-22  Ian Lance Taylor  <iant@google.com>
18004
18005         * gold.h: Include <cstddef> and <sys/types.h>
18006         * options.h: Include <cstring>.
18007
18008 2008-03-21  Ian Lance Taylor  <iant@google.com>
18009
18010         * Added source code to GNU binutils.
18011 \f
18012 Copyright (C) 2008-2015 Free Software Foundation, Inc.
18013
18014 Copying and distribution of this file, with or without modification,
18015 are permitted in any medium without royalty provided the copyright
18016 notice and this notice are preserved.
18017
18018 Local Variables:
18019 mode: change-log
18020 left-margin: 8
18021 fill-column: 74
18022 version-control: never
18023 End: