Add EM_IAMCU support to gold
[external/binutils.git] / gold / ChangeLog
1 2015-10-13  H.J. Lu  <hongjiu.lu@intel.com>
2
3         PR gold/19118
4         * i386.cc (Target_iamcu): New class.
5         (Target_selector_iamcu): Likewise.
6         (Target_iamcu::iamcu_info): New variable.
7         (target_selector_iamcu): Likewise.
8
9 2015-10-07  Andreas Schwab  <schwab@suse.de>
10
11         * aarch64.cc (aarch64_info): Set abi_pagesize to 64K.
12
13 2015-10-06  Cary Coutant  <ccoutant@gmail.com>
14
15         PR gold/18855
16         * sparc.cc (Sparc_relocate_functions::gdop_hix22): Remove addend
17         parameter.
18         (Sparc_relocate_functions::gdop_lox10): Likewise.
19         (Target_sparc::Relocate::relocate): Use addend when computing
20         symbol value for R_SPARC_GOTDATA_OP*.
21
22 2015-09-07  Cary Coutant  <ccoutant@gmail.com>
23
24         PR gold/18930
25         PR gold/18886
26         * resolve.cc (Symbol::override_base): Don't convert IFUNC symbols here.
27         * symtab.cc (Symbol_table::add_from_dynobj): Convert them here instead.
28
29 2015-09-02  H.J. Lu  <hongjiu.lu@intel.com>
30
31         PR gold/18886
32         * resolve.cc (Symbol::override_base): Turn IFUNC symbols from
33         shared libraries into normal FUNC symbols.
34         * symtab.cc (Symbol_table::sized_write_symbol): Assert IFUNC
35         symbols aren't from shared libraries.
36
37 2015-09-02  Alan Modra  <amodra@gmail.com>
38
39         PR 18878
40         * powerpc.cc (Target_powerpc): Add savres_section_ and accessor.
41         (Target_powerpc::Branch_info::make_stub): Determine whether long
42         branch stub is for save/restore function.
43         (Branch_stub_ent): Add save_res_, and extra parm to constructor.
44         (Stub_table): Add need_save_res_.
45         (Stub_table:clear_stubs): Clear need_save_res_.
46         (Stub_table:set_address_and_size): Add save/restore section size.
47         (Stub_table::add_long_branch_entry): Add save_res param.  Set
48         need_save_res_, but don't add space for save/restore stubs.
49         (Stub_table::find_long_branch_entry): Return offset to local copy
50         of save/restore func.
51         (Stub_table::do_write): Don't output save/restore stubs.  Instead
52         copy the save/restore functions.
53         (Output_data_save_res:contents): New accessor.
54         (Target_powerpc::define_save_restore_funcs): Set savres_section_.
55
56 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
57
58         PR gold/18847
59         * script-sections.cc (Memory_region::set_address): New method.
60         (Script_sections::find_memory_region): Add explicit_only parameter.
61         (Output_section_definition::set_section_addresses): Handle case where
62         script specifies both address and vma region.
63         * script-sections.h (Script_sections::find_memory_region): Add
64         explicit_only parameter.
65
66 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
67
68         PR gold/18859
69         * object.cc (Input_objects::add_object): Store objects in a map,
70         indexed by soname; update as-needed flag when necessary.
71         * object.h (Object::clear_as_needed): New method.
72         (Input_objects::so_names_): Change from set to map.
73
74 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
75
76         PR gold/14746
77         * expression.cc (Expression::Expression_eval_info): Add
78         is_valid_pointer field.
79         (Expression::eval_maybe_dot): Add is_valid_pointer parameter.
80         Adjust all callers.
81         (Addr_expression::value_from_output_section): Check whether address
82         is valid.
83         * script.cc (Symbol_assignment::set_if_absolute): Defer assignment
84         if evaluation failed due to address that is not yet valid.
85         * script.h: (Expression::eval_maybe_dot): Add is_valid_pointer
86         parameter.
87
88 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
89
90         PR gold/18866
91         PR gold/18703
92         * symtab.cc (Symbol_table): Reorder conditions to avoid internal error.
93
94 2015-08-20  Alan Modra  <amodra@gmail.com>
95
96         PR gold/18846
97         * target-reloc.h (relocate_relocs <RELOC_ADJUST_FOR_SECTION_RELA>):
98         Subtract os->address() from addend.
99         * powerpc.cc (relocate_relocs): Likewise.
100
101 2015-08-12  Simon Dardis  <simon.dardis@imgtec.com>
102
103         * mips.cc (plt0_entry_o32, plt0_entry_n32, plt0_entry_n64,
104         lazy_stub_normal_1, lazy_stub_normal_1_n64,
105         lazy_stub_normal_2, lazy_stub_normal_2_n64, lazy_stub_big,
106         lazy_stub_big_n64, lazy_stub_micromips32_normal_1_n64,
107         lazy_stub_micromips32_normal_2_n64, lazy_stub_micromips32_big,
108         lazy_stub_micromips32_big_n64): Update to use 'or' for move instead
109         of 'addu/daddu'.
110
111 2015-07-27  H.J. Lu  <hongjiu.lu@intel.com>
112
113         * configure: Regenerated.
114
115 2015-07-26  Doug Kwan  <dougkwan@google.com>
116
117         * testsuite/arm_unaligned_reloc.{s,sh}: Make test less sensitive to
118           disassembler output format.
119
120 2015-07-23  Ian Coolidge  <icoolidge@google.com>
121         Plumb --pic-veneer option for gold.
122
123         * arm.cc (Reloc_stub::stub_type_for_reloc): Plumb to stub
124         generation.
125         * options.h (General_options): Add --pic-veneer option.
126
127 2015-07-22  H.J. Lu  <hongjiu.lu@intel.com>
128
129         PR gold/18663
130         * testsuite/Makefile.am (script_test_1_SOURCES): Set to
131         script_test_1a.cc script_test_1b.cc.
132         (script_test_11_r.o): Replace script_test_11.o with
133         script_test_11a.o script_test_11b.o.
134         (script_test_11.o): Removed.
135         (script_test_11a.o): New.
136         (script_test_11b.o): Likewise.
137         * testsuite/Makefile.in: Regenerated.
138         * testsuite/script_test_1.h: New file.
139         * testsuite/script_test_1b.cc: Likewise.
140         * testsuite/script_test_11.h: Likewise.
141         * testsuite/script_test_11b.c: Likewise.
142         * testsuite/script_test_1.cc: Renamed to ...
143         * testsuite/script_test_1a.cc: This.
144         Include "script_test_1.h".
145         (main): Call check_int and check_ptr.
146         * testsuite/script_test_11.c: Renamed to ...
147         * testsuite/script_test_11a.c: This.
148         Include "script_test_11.h".
149         (main): Call ptr_equal.
150
151 2015-07-22  H.J. Lu  <hongjiu.lu@intel.com>
152
153         PR gold/18628
154         * testsuite/ifuncdep2.c (global): Change protected to hidden.
155         * testsuite/ifuncmod1.c (global): Likewise.
156         * testsuite/ifuncmod5.c (global): Likewise.
157
158 2015-07-22  Alan Modra  <amodra@gmail.com>
159
160         * aarch64.cc (try_fix_erratum_843419_optimized): Warning fix.
161
162 2015-07-21  Cary Coutant  <ccoutant@gmail.com>
163
164         PR gold/18548
165         * symtab.cc (Symbol_table::do_define_in_output_data): Check for
166         forced local symbol even when oldsym != NULL.
167         (Symbol_table::do_define_in_output_segment): Likewise.
168         (Symbol_table::do_define_as_constant): Likewise.
169
170 2015-07-21  Cary Coutant  <ccoutant@gmail.com>
171
172         PR gold/18698
173         * archive.cc (Library_base::should_include_member): Don't use entry
174         point for relocatable links, or if target is not yet valid.
175         * parameters.cc (Parameters::entry): Check target_valid().
176
177 2015-07-20  Han Shen  <shenhan@google.com>
178
179         Optimize erratum 843419 fix.
180
181         * aarch64.cc (AArch64_insn_utilities::is_adr): New method.
182         (AArch64_insn_utilities::aarch64_adr_encode_imm): New method.
183         (AArch64_insn_utilities::aarch64_adrp_decode_imm): New method.
184         (E843419_stub): New sub-class of Erratum_stub.
185         (AArch64_relobj::try_fix_erratum_843419_optimized): New method.
186         (AArch64_relobj::section_needs_reloc_stub_scanning): Try optimized fix.
187         (AArch64_relobj::create_erratum_stub): Add 1 argument.
188         (Target_aarch64::scan_erratum_843419_span): Pass in adrp insn offset.
189
190 2015-07-20  Han Shen  <shenhan@google.com>
191
192         Fix arm elf header flags wrt hardfp bit.
193
194         * arm.cc (Target_arm::do_adjust_elf_header): Set flags into view.
195
196 2015-07-20  H.J. Lu  <hongjiu.lu@intel.com>
197
198         PR gold/18689
199         * layout.cc (Layout::layout): Clear the SHF_COMPRESSED flag bit
200         from input group section for relocatable link.
201         * testsuite/Makefile.am (check_SCRIPTS): Add pr18689.sh.
202         (check_DATA): Add pr18689.stdout.
203         (MOSTLYCLEANFILES): Add pr18689a.o pr18689b.o.
204         (pr18689.stdout): New rule.
205         (pr18689a.o): Likewise.
206         (pr18689b.o): Likewise.
207         (pr18689.o): Likewise.
208         * testsuite/pr18689.c: New file.
209         * testsuite/pr18689.sh: Likewise.
210         * testsuite/Makefile.in: Regenerated.
211
212 2015-07-20  Yiran Wang  <yiran@google.com>
213         Cary Coutant  <ccoutant@gmail.com>
214
215         PR gold/15574
216         * resolve.cc (Symbol_table): Remove warning about references
217         from shared objects to hidden symbols.
218         * testsuite/Makefile.am (hidden_test): Add hidden_test.syms.
219         * testsuite/Makefile.in: Regenerate.
220         * testsuite/hidden_test.sh: Check dynamic symbol table; update
221         expected error messages.
222
223 2015-07-14  H.J. Lu  <hongjiu.lu@intel.com>
224
225         * compressed_output.cc (Output_compressed_section::set_final_data_size):
226         Make --compress-debug-sections=zlib the same as
227         --compress-debug-sections=zlib-gabi.
228         * testsuite/Makefile.am (flagstest_compress_debug_sections.check):
229         Expect ".debug_.*" with the SHF_COMPRESSED bit, instead of
230         ".zdebug_".
231         * testsuite/Makefile.in: Regenerated.
232
233 2015-07-12  H.J. Lu  <hongjiu.lu@intel.com>
234
235         PR gold/18322
236         * compressed_output.cc (zlib_compress): Add argument for
237         compression header size.  Set header size to compression header
238         size if it isn't 0.  Don't write out the zlib header here.
239         (Output_compressed_section::set_final_data_size): Support
240         zlib-gnu and zlib-gabi compressions.  Pass compression header
241         size to zlib_compress and write out compression header.  Set
242         the SHF_COMPRESSED bit for zlib-gabi compression.  Otherwise
243         clear the SHF_COMPRESSED bit
244         * options.h (compress_debug_sections): Add zlib-gnu and
245         zlib-gabi.
246         * output.h (Output_section::set_flags): New.
247         * testsuite/Makefile.am (check_PROGRAMS): Add
248         flagstest_compress_debug_sections_none,
249         flagstest_compress_debug_sections_gnu and
250         flagstest_compress_debug_sections_gabi.
251         (check_DATA): Add flagstest_compress_debug_sections_none.stdout.
252         flagstest_compress_debug_sections.stdout,
253         flagstest_compress_debug_sections.cmp,
254         flagstest_compress_debug_sections.check,
255         flagstest_compress_debug_sections_gnu.stdout,
256         flagstest_compress_debug_sections_gnu.cmp,
257         flagstest_compress_debug_sections_gnu.check,
258         flagstest_compress_debug_sections_gabi.stdout,
259         flagstest_compress_debug_sections_gabi.cmp and
260         flagstest_compress_debug_sections_gabi.check.
261         (flagstest_compress_debug_sections_none): New.
262         (flagstest_compress_debug_sections_none.stdout): Likewise.
263         (flagstest_compress_debug_sections.stdout): Likewise.
264         (flagstest_compress_debug_sections.check): Likewise.
265         (flagstest_compress_debug_sections.cmp): Likewise.
266         (flagstest_compress_debug_sections_gnu): Likewise.
267         (flagstest_compress_debug_sections_gnu.stdout): Likewise.
268         (flagstest_compress_debug_sections_gnu.check): Likewise.
269         (flagstest_compress_debug_sections_gnu.cmp): Likewise.
270         (flagstest_compress_debug_sections_gabi): Likewise.
271         (flagstest_compress_debug_sections_gabi.stdout): Likewise.
272         (flagstest_compress_debug_sections_gnu.check): Likewise.
273         (flagstest_compress_debug_sections_gnu.cmp): Likewise.
274         * testsuite/Makefile.in: Regenerated.
275
276 2015-07-12  H.J. Lu  <hongjiu.lu@intel.com>
277
278         PR gold/18321
279         * compressed_output.h (decompress_input_section): Add arguments
280         for ELF class, big endian and sh_flags.
281         * compressed_output.cc (decompress_input_section): Likewise.
282         Support the SHF_COMPRESSED section.
283         * dynobj.h (Dynobj): Add elfsize and is_big_endian member
284         functions.
285         * plugin.h (Pluginobj): Likewise.
286         * layout.cc (Layout::get_output_section_flags): Also clear the
287         SHF_COMPRESSED bit.
288         * object.h (Compressed_section_info): Add flag to store sh_flags.
289         (Object): Add pure virtual elfsize and is_big_endian member
290         functions.
291         * object.cc (need_decompressed_section): Don't skip the ".zdebug"
292         prefix here.
293         (build_compressed_section_map): Check SHF_COMPRESSED for
294         uncompressed size.  Store sh_flags in Compressed_section_info.
295         Pass size, big_endian and sh_flags to decompress_input_section.
296         Skip the ".debug"/".zdebug" prefix when passing section name to
297         need_decompressed_section.
298         (Sized_relobj_file<size, big_endian>::do_find_special_section):
299         Don't check ".zdebug_*" sections.
300         (Object::decompressed_section_contents): Pass ELF class, big
301         endian and sh_flags to decompress_input_section.
302         * reloc.cc (Sized_relobj_file<size, big_endian>::write_sections):
303         Likewise.
304         * testsuite/Makefile.am (check_DATA): Add
305         debug_msg_cdebug_gabi.err and gdb_index_test_2_gabi.stdout.
306         (MOSTLYCLEANFILES): Add debug_msg_cdebug_gabi.err and
307         gdb_index_test_2_gabi.stdout.
308         (debug_msg_cdebug_gabi.o): New.
309         (odr_violation1_cdebug_gabi.o): Likewise.
310         (odr_violation2_cdebug_gabi.o): Likewise.
311         (debug_msg_cdebug_gabi.err): Likewise.
312         (check_SCRIPTS): Add gdb_index_test_2_gabi.sh.
313         (gdb_index_test_cdebug_gabi.o): Likewise.
314         (gdb_index_test_2_gabi): Likewise.
315         (gdb_index_test_2_gabi.stdout): Likewise.
316         * testsuite/gdb_index_test_2_gabi.sh: New file.
317         * testsuite/Makefile.in: Regenerated.
318
319 2015-07-09  Han Shen  <shenhan@google.com>
320
321         Use "gold_info" instead of "gold_warning" for erratum fix.
322
323         * aarch64.cc (Target_aarch64::scan_erratum_843419_span): Use
324         'gold_info'.
325         (Target_aarch64::scan_erratum_835769_span): USe 'gold_info'.
326
327 2015-07-09  Han Shen  <shenhan@google.com>
328
329         Drop missing symbol warning for arm/aarch64.
330
331         * aarch64.cc (AArch64_relobj::scan_errata): Drop missing symbol warning.
332         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Drop missing
333         symbol warning.
334
335 2015-07-07  Han Shen  <shenhan@google.com>
336
337         Make gold aarch64 accept long form of mapping symbols.
338
339         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Make legal
340         of mapping symbols.
341
342 2015-06-29  Doug Kwan  <dougkwan@google.com>
343
344         * testsuite/arm_bl_out_of_range.s: Align stub table so that it appears
345           at address expected by test.
346         * testsuite/arm_cortex_a8_b.s: Ditto.
347         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
348         * testsuite/arm_cortex_a8_bl.s: Ditto.
349         * testsuite/arm_cortex_a8_blx.s: Ditto.
350         * testsuite/arm_cortex_a8_local.s: Ditto.
351         * testsuite/arm_fix_v4bx.s: Ditto.
352         * testsuite/arm_unaligned_reloc.s: Ditto.
353         * testsuite/thumb_bl_out_of_range.s: Ditto.
354         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
355         * testsuite/thumb_blx_out_of_range.s: Ditto.
356
357 2015-06-29  Han Shen  <shenhan@google.com>
358
359         Patch for erratum 843419 internal error.
360
361         * aarch64.cc (Erratum_stub::Insn_utilities): New typedef.
362         (Erratum_stub::update_erratum_insn): New method.
363         (Stub_table::relocate_stubs): Modified to place relocated insn.
364         (AArch64_relobj::fix_errata): Modified gold_assert.
365
366 2015-06-12  Han Shen  <shenhan@google.com>
367
368         Fix erratum 835769.
369
370         * aarch64.cc (AArch64_insn_utilities::BYTES_PER_INSN): Move
371         defintion outside class definition.
372         (AArch64_insn_utilities::AARCH64_ZR): New static constant.
373         (AArch64_insn_utilities::aarch64_op31): New member.
374         (AArch64_insn_utilities::aarch64_ra): New member.
375         (AArch64_insn_utilities::aarch64_mac): New member.
376         (AArch64_insn_utilities::aarch64_mlxl): New member.
377         (ST_E_835769): New global enum member.
378         (Stub_table::relocate_stubs): Add 835769 handler.
379         (Stub_template_repertoire::Stub_template_repertoire): Install new
380         stub type.
381         (AArch64_relobj::scan_errata): This func is renamed from
382         scan_erratum_843419.
383         (AArch64_relobj::do_count_local_symbols): Add 835769 handler.
384         (AArch64_relobj::do_relocate_sections): Add 835769 handler.
385         (AArch64_relobj::scan_sections_for_stubs): Add 835769 handler.
386         (Target_aarch64::scan_erratum_835769_span): New method.
387         (Target_aarch64::create_erratum_stub): New method.
388         (Target_aarch64::is_erratum_835769_sequence): New method.
389         (Target_aarch64::scan_erratum_843419_sequence): Move part of the
390         code into create_erratum_stub.
391         * options.h (fix_cortex_a53_835769): New option.
392
393 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
394
395         * aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
396         outside class body.
397         (Reloc_stub::STUB_ADDR_ALIGN): Likewise.
398
399 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
400
401         PR gold/17731
402         * layout.cc (corresponding_uncompressed_section_name): New function.
403         (Layout::choose_output_section): Call it.
404         * layout.h (corresponding_uncompressed_section_name): New function.
405         * script-sections.cc (Input_section_info::set_section_name): Check
406         for compressed debug section (.zdebug style).
407
408 2015-06-11  Jing Yu  <jingyu@google.com>
409
410         * testsuite/Makefile.am: Add -O0 for script_test_12 test.
411         * testsuite/Makefile.in: Regenerate.
412
413 2015-06-11  Davide Italiano  <dccitaliano@gmail.com>
414
415         * gold.h (is_cident): Correct typo.
416
417 2015-06-10  Han Shen  <shenhan@google.com>
418         Patch for erratum-843419 (2 of 2 - fix erratum occurrences).
419
420         Now fixing for 843419 is fully functional.
421
422         The first part of the erratum fix CL is here -
423         https://sourceware.org/ml/binutils/2015-04/msg00229.html
424
425         * aarch64.cc(global enum): New constants representing stub types.
426         (Stub_template): New POD struct.
427         (Stub_template_repertoire): New class.
428         (Stub_base): New class.
429         (Erratum_stub): New class.
430         (Reloc_stub): Refactored to be a subclass of Stub_base.
431         (Reloc_stub::Stub_type): Removed.
432         (Reloc_stub::offset): Moved to Stub_base.
433         (Reloc_stub::set_offset): Moved to Stub_base.
434         (Reloc_stub::destination_address): Moved to Stub_base.
435         (Reloc_stub::set_destination_address): Moved to Stub_base.
436         (Reloc_stub::reset_destination_address): Moved to Stub_base.
437         (Reloc_stub::stub_type): Renamed and moved to Stub_base.
438         (Reloc_stub::stub_size): Renamed and moved to Stub_base.
439         (Reloc_stub::stub_insns): Renamed and moved to Stub_base.
440         (Reloc_stub::write): Moved to Stub_base.
441         (Reloc_stub::invalid_offset): Moved to Stub_base.
442         (Reloc_stub::invalid_address): Moved to Stub_base.
443         (Reloc_stub::stub_type_): Renamed and moved to Stub_base.
444         (Reloc_stub::stub_insns_): Moved to Stub_base.
445         (Reloc_stub::offset_): Moved to Stub_base.
446         (Reloc_stub::destination_address_): Moved to Stub_base.
447         (Stub_table::The_aarch64_relobj): New typedef.
448         (Stub_table::The_erratum_stub): New typedef.
449         (Stub_table::The_erratum_stub_less): New typedef.
450         (Stub_table::The_erratum_stub_set): New typedef.
451         (Stub_table::The_erratum_stub_set_iter): New typedef.
452         (Stub_table::empty): Added emptiness testing for erratum stubs.
453         (Stub_table::add_erratum_stub): New method to add an erratum stub.
454         (Stub_table::find_erratum_stub): New method.
455         (Stub_table::find_erratum_stubs_for_input_section): New method.
456         (Stub_table::erratum_stub_address): New method.
457         (Stub_table::update_date_size_changed_p): Modified to handle erratum stubs.
458         (Stub_table::do_addralign): Modified to handle erratum stubs.
459         (Stub_table::erratum_stubs_): New member.
460         (Stub_table::erratum_stub_size_): New member.
461         (Stub_table::relocate_stubs): Modified to handle erratum stubs.
462         (Stub_table::do_write): Modified to handle erratum stubs.
463         (AArch64_relobj::The_erratum_stub): New typedef.
464         (AArch64_relobj::Erratum_stub_set_iter): New typedef.
465         (AArch64_relobj::fix_errata): New method.
466         (Target_aarch64::The_reloc_stub_type): Removed.
467         (Target_aarch64::The_erratum_stub): New typede.
468         (AArch64_relocate_functions::construct_b): New method.
469
470 2015-06-08  Nick Clifton  <nickc@redhat.com>
471
472         * po/fr.po: New French Translation.
473
474 2015-06-07  Cary Coutant  <ccoutant@gmail.com>
475
476         PR gold/18288
477         * resolve.cc (symbol_to_bits): Remove type parameter; adjust all
478         callers. Don't use STT_COMMON to check for common symbols.
479         (Symbol_table::resolve): Warn if relocatable object has STT_COMMON
480         symbol that's not in a common section.
481         * symtab.h (Symbol::is_common): Don't use STT_COMMON to check for
482         common symbols.
483
484 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
485
486         PR gold/18200
487         * Makefile.am (diststuff): Add target.
488         * Makefile.in: Regenerate.
489
490 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
491
492         PR gold/17498
493         * object.cc (Sized_relobj_file::do_count_local_symbols): Discard
494         temporary locals in merge sections.
495         * options.cc (General_options::parse_discard_all): New method.
496         (General_options::parse_discard_locals): New method.
497         (General_options::parse_discard_none): New method.
498         (General_options::General_options): Initialize discard_locals_.
499         * options.h (--discard-all): Convert to special option.
500         (--discard-locals): Likewise.
501         (--discard-none): New option.
502         (General_options::discard_all): New method.
503         (General_options::discard_locals): New method.
504         (General_options::discard_sec_merge): New method.
505         (General_options::Discard_locals): New enum.
506         (General_options::discard_locals_): New data member.
507
508 2015-06-03  Cary Coutant  <cary@google.com>
509
510         * script-sections.cc (Script_sections::Script_sections): Initialize
511         segments_created_.
512         (Script_sections::create_note_and_tls_segments): Set flag when
513         segments are created.
514         (Script_sections::expected_segment_count): Count PT_INTERP.
515         (Script_sections::attach_sections_using_phdrs_clause): Set flag when
516         segments are created.
517         * script-sections.h (Script_sections::segments_created_): New data
518         member.
519
520 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
521
522         PR gold/15370
523         * script-sections.cc
524         (Output_section_element_input::set_section_addresses): When there
525         are several patterns with no sort spec, put all sections in the same
526         bin.
527         * testsuite/Makefile.am (script_test_12): New testcase.
528         (script_test_12i): New testcase.
529         * testsuite/Makefile.in: Regenerate.
530         * testsuite/script_test_12.t: New test linker script.
531         * testsuite/script_test_12i.t: New test linker script.
532         * testsuite/script_test_12a.c: New test source file.
533         * testsuite/script_test_12b.c: New test source file.
534
535 2015-06-02  Cary Coutant  <ccoutant@gmail.com>
536
537         * nacl.h (Sniff_file): Switch parameters to get_view to get an
538         aligned view.
539
540 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
541
542         PR gold/17819
543         * gold.cc (queue_final_tasks): When --build-id=tree, queue a
544         separate task to schedule the build id computation.
545         * layout.cc (Hash_task::Hash_task): Remove build_id_blocker,
546         add Output_file and offset.
547         (Hash_task::run): Get and release the input views.
548         (Hash_task::is_runnable): Always return NULL (always runnable).
549         (Layout::queue_build_id_tasks): Remove.
550         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
551         parameters; use them instead of class members.
552         (Build_id_task_runner::run): New function.
553         (Close_task_runner::run): Pass array_of_hashes and size_of_hashes
554         to write_build_id.
555         * layout.h (Layout::queue_build_id_tasks): Remove.
556         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
557         parameters.
558         (Layout::array_of_hashes_): Remove.
559         (Layout::size_of_array_of_hashes_): Remove.
560         (Layout::input_view_): Remove.
561         (Build_id_task_runner): New class.
562         (Close_task_runner::Close_task_runner): Add array_of_hashes and
563         size_of_hashes parameters.
564         (Close_task_runner::array_of_hashes_): New data member.
565         (Close_task_runner::size_of_hashes_): New data member.
566         * testsuite/Makefile.am
567         (flagstest_compress_debug_sections_and_build_id_tree): New test.
568         * testsuite/Makefile.in: Regenerate.
569
570 2015-06-01  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
571
572         * merge.cc (get_input_merge_map): Update for data structure change.
573         (get_or_make_input_merge_map): Update for data structure change.
574         * merge.h (Object_merge_map): Use a std::vector<std::pair>> instead of
575         a std::map. Remove first_shnum_, first_map_, second_shnum_, second_map_.
576
577 2015-05-16  Alan Modra  <amodra@gmail.com>
578
579         * reloc.cc (Sized_relobj_file::find_functions): Use function_location.
580         * powerpc.cc (Target_powerpc::do_calls_non_split): New function.
581         (addi_12_1, addis_2_12, addis_12_1, cmpld_7_12_0): New constants.
582         (lis_0): Rename from lis_0_0.
583
584 2015-04-29  Cary Coutant  <cary@google.com>
585             Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
586
587         * gc.h (Garbage_collection::is_section_garbage): Change Object*
588         to Relobj*.
589         (Garbage_collection::add_reference): Likewise.
590         (Garbage_collection::gc_process_relocs): Likewise. Don't push
591         object/shndx pair onto *secvec for dynamic objects. Don't follow
592         relocations pointing to dynamic objects for GC.
593         * icf.cc (Icf::find_identical_sections): Change Object* to Relobj*.
594         (Icf::unfold_section): Likewise.
595         (Icf::is_section_folded): Likewise.
596         (Icf::get_folded_section): Likewise.
597         * icf.h: (Icf::get_folded_section): Likewise.
598         (Icf::unfold_section): Likewise.
599         (Icf::is_section_folded): Likewise.
600         (Icf::section_has_function_pointers): Likewise.
601         (Icf::set_section_has_function_pointers): Likewise.
602         * object.h (Section_id): Likewise.
603         (Const_section_id): Likewise.
604         * output.cc (Output_section::update_section_layout): Likewise.
605         * output.h: (Output_section_lookup_maps::find_relaxed_input_section):
606         Likewise.
607         * plugin.cc (update_section_order): Likewise.
608         (unique_segment_for_sections): Likewise.
609         * powerpc.cc (Powerpc_relobj::add_reference): Likewise.
610         (Target_powerpc::do_gc_add_reference): Likewise.
611         (Target_powerpc::gc_process_relocs): Likewise.
612         (Target_powerpc::do_gc_add_reference): Likewise.
613         * symtab.cc (Symbol_table::is_section_folded): Likewise.
614         (Symbol_table::gc_mark_symbol): Likewise.
615         * symtab.h: (Symbol_table::is_section_folded): Likewise.
616         * target.h: (Sized_target::gc_add_reference): Likewise.
617         (Sized_target::do_gc_add_reference): Likewise.
618
619 2015-04-29  Nick Clifton  <nickc@redhat.com>
620
621         * po/fi.po: Updated Finnish translation.
622
623 2015-04-28  Alan Modra  <amodra@gmail.com>
624
625         * powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather
626         than unsigned int for find_global_entry result temp.  Compare
627         against invalid_address.
628         (Target_powerpc::do_plt_address_for_global): Likewise.
629         (Target_powerpc::Relocate::relocate): Likewise.  Don't assert
630         on plt call stub existence for debug info.  Do assert for plt
631         and global entry stub existence if an alloc section.
632
633 2015-04-28  Alan Modra  <amodra@gmail.com>
634
635         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert
636         on missing global entry stub due to bogus debug info.
637
638 2015-04-27  Han Shen  <shenhan@google.com>
639
640         * options.h (--fix-cortex-a53-843419): Rename option.
641         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Use renamed
642         option.
643         (AArch64_relobj::scan_sections_for_stubs): Use renamed option.
644
645 2015-04-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
646
647         PR gold/18327
648         * output.cc (Output_section::is_input_address_mapped): Assume a missing
649         entry is mapped.
650         * testsuite/Makefile.am: Add the eh_test test.
651         * testsuite/Makefile.in: Regenerate.
652         * testsuite/eh_test_a.cc: New test.
653         * testsuite/eh_test_b.cc: New test.
654
655 2015-04-23  Sriraman Tallam  <tmsriram@google.com>
656
657         * options.h (--weak-unresolved-symbols): New option.
658         * symtab.cc (Symbol_table::sized_write_globals): Change symbol
659         binding to weak with new option.
660         * symtab.h (is_weak_undefined): Check for new option.
661         (is_strong_undefined): Check for new option.
662         * testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
663         * testsuite/Makefile.in: Regenerate.
664         * testsuite/weak_unresolved_symbols_test.cc: New file.
665
666 2015-04-20  Ian Coolidge  <icoolidge@google.com>
667
668         * symtab.cc (Symbol::should_add_dynsym_entry): Return true for
669         GNU_UNIQUE.
670
671 2015-04-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
672
673         * gc.cc (Garbage_collection::do_transitive_closure): Use back and
674         push_back.
675         * gc.h (Garbage_collection): Use a std::vector instead of a std::queue.
676         * object.cc (Sized_relobj_file::do_layout): Use push_back.
677         * powerpc.cc (process_gc_mark): Use push_back.
678         (Target_powerpc::do_gc_mark_symbol): Use push_back.
679         * symtab.cc (Symbol_table::gc_mark_symbol): Use push_back.
680
681 2015-04-16  Han Shen  <shenhan@google.com>
682
683         * aarch64.cc (AArch64_insn_utilities): New utility class.
684         (AArch64_relobj::Mapping_symbol_position): New struct.
685         (AArch64_relobj::Mapping_symbol_info): New typedef.
686         (AArch64_relobj::do_count_local_symbols): New function overriding
687         parent's implementation.
688         (AArch64_relobj::mapping_symbol_info_): New member
689         (AArch64_relobj::scan_erratum_843419): New method.
690         (Target_aarch64::scan_erratum_843419_span): New method.
691         (Target_aarch64::is_erratum_843419_sequence): New method.
692         * options.h (fix_cortex_a53): New option.
693
694 2015-04-09  Cary Coutant  <ccoutant@google.com>
695
696         * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
697         in a PIE link.
698         * testsuite/Makefile.am (tls_pie_test.sh): New test.
699         * testsuite/Makefile.in: Regenerate.
700         * testsuite/tls_pie_test.sh: New.
701
702 2015-04-09  Cary Coutant  <ccoutant@google.com>
703
704         * debug.h (DEBUG_LOCATION): New.
705         (DEBUG_ALL): Include DEBUG_LOCATION.
706         (debug_string_to_enum): Add DEBUG_LOCATION.
707         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
708         output to print correct context.
709         (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
710         up to 4 more locations at the beginning of the function.
711         * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
712         result before sorting list of line numbers.
713         * testsuite/debug_msg.sh: Allow range of line numbers for
714         canonical results on optimized code.
715
716 2015-04-07  HC Yen <hc.yen@mediatek.com>
717
718         Add AArch32 support for gold linker.
719         gold/
720         * arm.cc: Add V8 arch combine table.
721
722 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
723
724         * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
725
726 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
727
728         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
729         to find by using the return value of insert.
730
731 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
732
733         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
734         constructor call.
735
736 2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>
737
738         PR gold/17641
739         * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
740         (Target_x86_64::Scan::local): Don't create GOT entry, when we
741         can convert mov to lea.
742         (Target_x86_64::Scan::global): Ditto.
743         (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
744         %reg to lea foo(%rip), %reg if possible.
745         * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
746         * testsuite/x86_64_mov_to_lea1.s: New.
747         * testsuite/x86_64_mov_to_lea2.s: Ditto.
748         * testsuite/x86_64_mov_to_lea3.s: Ditto.
749         * testsuite/x86_64_mov_to_lea4.s: Ditto.
750         * testsuite/x86_64_mov_to_lea.sh: Ditto.
751
752 2015-04-02  H.J. Lu  <hongjiu.lu@intel.com>
753
754         * configure: Regenerated.
755
756 2015-04-01  Ilya Tocar  <ilya.tocar@intel.com>
757
758         PR gold/17640
759         * i386.cc (Target_i386::can_convert_mov_to_lea): New.
760         (Target_i386::Scan::local): Don't create GOT entry, when we
761         can convert GOT to GOTOFF.
762         (Target_i386::Scan::global): Ditto.
763         (Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
764         lea foo@GOTOFF(%reg), %reg if possible.
765         * testsuite/Makefile.am (i386_mov_to_lea): New test.
766         * testsuite/i386_mov_to_lea1.s: New.
767         * testsuite/i386_mov_to_lea2.s: Ditto.
768         * testsuite/i386_mov_to_lea3.s: Ditto.
769         * testsuite/i386_mov_to_lea4.s: Ditto.
770         * testsuite/i386_mov_to_lea5.s: Ditto.
771         * testsuite/i386_mov_to_lea.sh: Ditto.
772
773 2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>
774
775         * Makefile.am (ZLIB): New.
776         (ZLIBINC): Likewise.
777         (AM_CFLAGS): Add $(ZLIBINC).
778         (AM_CXXFLAGS): Likewise.
779         (ldadd_varldadd_var): Add $(ZLIB).
780         (incremental_dump_LDADD): Likewise.
781         (dwp_LDADD): Likewise.
782         * compressed_output.cc: Don't check HAVE_ZLIB_H to include
783         <zlib.h>.
784         (zlib_compress): Don't check HAVE_ZLIB_H.
785         (zlib_decompress): Likewise.
786         * options.h (compress_debug_sections): Likewise.
787         * configure.ac (AM_CONDITIONAL): Removed.
788         * testsuite/Makefile.am (ZLIB): New.
789         (LDADD): Add $(ZLIB).
790         Don't check HAVE_ZLIB.
791         * Makefile.in: Regenerated.
792         * config.in: Likewise.
793         * configure: Likewise.
794         * testsuite/Makefile.in: Likewise.
795
796 2015-03-30  Jing Yu  <jingyu@google.com>
797
798         * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
799         TLSLD_ADD_DTPREL_LO12_NC.
800         * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
801         _TLS_MODULE_BASE_ point to the start of tls segment.
802         (Target_aarch64::optimize_tls_reloc): Add cases for
803         R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
804         R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
805         (Target_aarch64::Scan::local): Likewise.
806         (Target_aarch64::Scan::global): Likewise.
807         (Target_aarch64::Relocate::relocate): Likewise.
808         (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
809         subtracting tls segment size from symbol value for TLSLD_*_DTPREL
810         relocations.
811
812 2015-03-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
813
814         * merge.cc (Object_merge_map::add_mapping): call
815         Object_merge_map::Input_merge_map::add_mapping.
816         (Object_merge_map::Input_merge_map::add_mapping): New.
817         (Output_merge_data::do_add_input_section): Call
818         get_or_make_input_merge_map before a loop.
819         (Output_merge_string<Char_type>::finalize_merged_data): Call
820         get_or_make_input_merge_map before a loop.
821         * merge.h (Object_merge_map): Make Input_merge_map public.
822         * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
823         (Relobj::get_or_create_merge_map): New.
824         * object.h (Relobj::get_or_create_merge_map): New.
825
826 2015-03-24  Alan Modra  <amodra@gmail.com>
827
828         PR 18147
829         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
830         relocation errors for branches to strong undefined symbols.
831
832 2015-03-23  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
833
834         * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
835         (Object_merge_map::is_merge_section_for): Remove.
836         (Object_merge_map::find_merge_section): New.
837         * merge.h (Object_merge_map::is_merge_section_for): Remove.
838         (Object_merge_map::find_merge_section): New.
839         (Object_merge_map::get_input_merge_map): Add a const version.
840         * object.cc (Relobj::is_merge_section_for): Remove.
841         (Relobj::find_merge_section): New.
842         * object.h (Relobj::is_merge_section_for): Remove.
843         (Relobj::find_merge_section): New.
844         * output.cc
845         (Output_section::Input_section::is_merge_section_for): Remove.
846         (Output_section::add_merge_input_section): Don't call
847         add_merge_input_section.
848         (Output_section::find_merge_section): Return const. Use
849         object->find_merge_section.
850         (Output_section::build_lookup_maps): Don't build a map for
851         merge sections.
852         (Output_section::is_input_address_mapped): Return false if
853         section is not found.
854         (Output_section::find_starting_output_address): Use
855         find_merge_section instead of is_merge_section_for.
856         (Output_section::add_script_input_section):  Don't build a map for
857         merge sections.
858         * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
859         (Output_section_lookup_maps::find_merge_section): Remove.
860         (Output_section_lookup_maps::add_merge_input_section) Remove.
861         (Output_section::find_merge_section): Return const.
862
863 2015-03-22  Cary Coutant  <cary@google.com>
864
865         PR gold/18106
866         * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
867         non-SIB form of lea, with nop after the call.
868
869 2015-03-21  Cary Coutant  <cary@google.com>
870
871         PR gold/14217
872         * output.cc (Output_segment::is_first_section_relro): Don't ignore
873         .tdata section.
874         (Output_segment::set_section_addresses): Don't align size of relro
875         segment for .tbss.
876
877 2015-03-21  Cary Coutant  <cary@google.com>
878
879         PR gold/18010
880         * stringpool.cc (Stringpool_template): Don't optimize if section
881         alignment is greater than sizeof(char).
882
883 2015-03-21  Cary Coutant  <cary@google.com>
884
885         PR gold/18048
886         * script-c.h (script_include_directive): Add first_token parameter.
887         * script.cc (script_include_directive): Add first_token parameter, and
888         pass it to read_script_file.
889         * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
890         (PARSING_MEMORY_DEF): New tokens.
891         (top): Add new productions for INCLUDE files.
892         (file_cmd): Replace file_or_sections_cmd with copy of its productions.
893         Pass PARSING_LINKER_SCRIPT to script_include_directive.
894         (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
895         (section_cmd): Pass PARSING_SECTION_CMDS.
896         (file_or_sections_cmd): Remove.
897         (memory_def): Pass PARSING_MEMORY_DEF.
898         * testsuite/Makefile.am (memory_test_2): New test.
899         * testsuite/Makefile.in: Regenerate.
900         * testsuite/memory_test_inc.t: New script file.
901         * testsuite/memory_test_inc_1.t.src: New script file.
902         * testsuite/memory_test_inc_2.t.src: New script file.
903         * testsuite/memory_test_inc_3.t.src: New script file.
904
905 2015-03-21  Cary Coutant  <cary@google.com>
906
907         * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
908         (Sized_relobj_dwo::setup): Build compressed section map.
909         (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
910         * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
911         section map.
912         * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
913         compressed_sections_ field.
914         (build_compressed_section_map): Take Object instead of
915         Sized_relobj_file parameter; add decompress_if_needed parameter.
916         (Sized_relobj_file::do_find_special_sections): Store compressed
917         section map in parent Object.
918         (Sized_relobj_file::do_decompressed_section_contents): Move
919         implementation to Object::decompressed_section_contents.
920         (Sized_relobj_file::do_discard_decompressed_sections): Move
921         implementation to Object::discard_decompressed_sections.
922         * object.h (build_compressed_section_map): Declare.
923         (Object::Object): Add compressed_sections_ field.
924         (Object::section_is_compressed): Move implementation here.
925         (Object::decompressed_section_contents): De-virtualize.
926         (Object::discard_decompressed_sections): De-virtualize.
927         (Object::do_section_is_compressed): Delete.
928         (Object::do_decompressed_section_contents): Delete.
929         (Object::set_compressed_sections): New method.
930         (Object::compressed_sections): New method.
931         (Object::compressed_sections_): New data member.
932         (Compressed_section_info, Compressed_section_map): Move to top of file.
933         (Sized_relobj_file::do_section_is_compressed): Delete.
934         (Sized_relobj_file::do_decompressed_section_contents): Delete.
935         (Sized_relobj_file::do_discard_decompressed_sections): Delete.
936         (Sized_relobj_file::compressed_sections_): Move to Object class.
937
938 2015-03-21  Cary Coutant  <ccoutant@google.com>
939
940         PR gold/18152
941         * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
942         deferred objects.
943
944 2015-03-11  Cary Coutant  <ccoutant@google.com>
945
946         * options.cc (General_options::finalize): Don't allow -z relro
947         with incremental linking.
948         * testsuite/Makefile.am (incremental_test): Add -z norelro.
949         (incremental_test_2): Likewise.
950         (incremental_test_3): Likewise.
951         (incremental_test_4): Likewise.
952         (incremental_test_5): Likewise.
953         (incremental_test_6): Likewise.
954         (incremental_copy_test): Likewise.
955         (incremental_common_test_1): Likewise.
956         (incremental_comdat_test_1): Likewise.
957         * testsuite/Makefile.in: Regenerate.
958
959 2015-03-09  Cary Coutant  <ccoutant@google.com>
960
961         PR gold/14675
962         * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
963         return enum indicating whether .eh_frame section is empty, optimizable,
964         unrecognized, or an end marker. Adjust explicit instantiations.
965         * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
966         (Eh_frame::add_ehframe_input_section): Change return type.
967         * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
968         * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
969         to the .eh_frame output section until we see the end marker.
970         (Layout::finalize_eh_frame_section): New.
971         * layout.h: (Layout::finalize_eh_frame_section): New.
972
973 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
974
975         * output.cc (Relobj::initialize_input_to_output_map<size>):
976         Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
977
978 2015-03-04  Cary Coutant  <ccoutant@google.com>
979
980         * parameters.cc (Parameters::set_target_once): Call
981         Target::select_as_default_target just once from here...
982         (set_parameters_target): ...instead of from here.
983
984 2015-03-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
985
986         * ehframe.cc (Cie::set_output_offset): Pass in and use a
987         Output_section_data instead of a Merge_map.
988         (Eh_frame::Eh_frame): Don't initialize merge_map_.
989         (Eh_frame::read_cie): Use add_merge_mapping instead of
990         Merge_map::add_mapping.
991         (Eh_frame::read_fde): Ditto.
992         (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
993         (Eh_frame::do_output_offset): Use merge_output_offset istead of
994         merge_map_->get_output_offset.
995         (Eh_frame::do_is_merge_section_for): Delete.
996         * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
997         instead of a Merge_map.
998         (Cie::set_output_offset): Pass in a Output_section_data instead of a
999         Merge_map.
1000         (Eh_frame::do_is_merge_section_for): Delete.
1001         (Eh_frame::merge_map_): Delete.
1002         * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
1003         and use a Output_section_data instead of a Merge_map.
1004         (Object_merge_map::add_mapping): Ditto.
1005         (Object_merge_map::get_output_offset): Remove the merge_map argument.
1006         (Object_merge_map::is_merge_section_for): Pass in and use a
1007         Output_section_data instead of a Merge_map.
1008         (Merge_map): Delete.
1009         (Output_merge_base::do_output_offset): Use merge_output_offset instead
1010         of merge_map_.get_output_offset.
1011         (Output_merge_base::do_is_merge_section_for): Delete.
1012         (Output_merge_data::do_add_input_section): Use
1013         object->add_merge_mapping instead of add_mapping.
1014         (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
1015         * merge.h (Merge_map): Delete forward declaration.
1016         (Object_merge_map::add_mapping): Pass in and use a Output_section_data
1017         instead of a Merge_map.
1018         (Object_merge_map::get_output_offset): Remove the merge_map argument.
1019         (Object_merge_map::is_merge_section_for): Pass in and use a
1020         Output_section_data instead of a Merge_map.
1021         (Input_merge_map::Object_merge_map::merge_map): Replace with
1022         output_data.
1023         (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
1024         Output_section_data instead of a Merge_map.
1025         (Merge_map): Delete.
1026         (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
1027         (Output_merge_base::do_is_merge_section_for): Delete.
1028         (Output_merge_base::add_mapping): Delete.
1029         (Output_merge_base::merge_map_): Delete.
1030         * object.cc (Relobj::initialize_input_to_output_map): New.
1031         (Relobj::initialize_input_to_output_map): New.
1032         (Relobj::merge_output_offset): New.
1033         (Relobj::is_merge_section_for): New.
1034         (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
1035         bits.
1036         * object.h (Relobj::merge_map): Delete.
1037         (initialize_input_to_output_map): New.
1038         (set_merge_map): Delete.
1039         (add_merge_mapping): New.
1040         (merge_output_offset): New.
1041         (is_merge_section_for): New.
1042         * output.cc (Output_section::Input_section::is_merge_section_for):
1043         Use object->is_merge_section_for.
1044         * output.h (Output_section_data::is_merge_section_for): Delete.
1045         (Output_section_data::do_is_merge_section_for): Delete.
1046         * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
1047         Use object->initialize_input_to_output_map.
1048         (Merged_symbol_value<size>::value_from_output_section): Use
1049         object->merge_output_offset.
1050
1051 2015-03-02  Peter Collingbourne  <pcc@google.com>
1052             Cary Coutant  <ccoutant@google.com>
1053
1054         * output.cc (Output_section::add_merge_input_section): Do not
1055         attempt to merge sections with an entsize of 0.
1056
1057 2015-03-02  Khem Raj  <raj.khem@gmail.com>
1058
1059         * attributes.h (class Output_attributes_section_data ): Add
1060         do_print_to_mapfile function.
1061
1062 2015-02-24  Alan Modra  <amodra@gmail.com>
1063
1064         PR 18010
1065         * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
1066         complain if value is not a multiple of four.
1067         (Target_powerpc::Relocate::relocate): Correct handling of
1068         R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
1069
1070 2015-02-21  H.J. Lu  <hongjiu.lu@intel.com>
1071
1072         * configure.ac (default_size): Set to 32 for x32.
1073         * configure: Regenerated.
1074
1075 2015-02-18  Alan Modra  <amodra@gmail.com>
1076
1077         PR 17954
1078         * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
1079         visibility.
1080
1081 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1082
1083         * gc.h (Garbage_collection::add_reference): Don't use find.
1084
1085 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1086
1087         * object.cc (write_local_symbols): avoid std::vector copy.
1088
1089 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1090
1091         * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
1092
1093 2015-02-09  Mark Wielaard  <mjw@redhat.com>
1094
1095         * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
1096         DW_LANG_Fortran03 and DW_LANG_Fortran08.
1097
1098 2015-02-16  Cary Coutant  <ccoutant@google.com>
1099
1100         PR gold/13577
1101         PR gold/16992
1102         * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
1103         DF_SYMBOLIC if --dynamic-list option is used.
1104         * options.cc (General_options::finalize): --dynamic-list is not
1105         mutually exclusive with -Bsymbolic.
1106         * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
1107         listed in --dynamic-list.
1108         * testsuite/Makefile.am (dynamic_list_lib2.so): Add
1109         -Bsymbolic-functions.
1110         * testsuite/Makefile.in: Regenerate.
1111
1112 2015-02-16  Cary Coutant  <ccoutant@google.com>
1113
1114         PR gold/17971
1115         * incremental.cc: Remove redundant include of "output.h".
1116
1117 2015-02-12  Jing Yu  <jingyu@google.com>
1118
1119         * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
1120         TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
1121         New relocation.
1122         * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
1123         TLSLE_MOVW_* relocations.
1124         (Target_aarch64::Scan::global): Likewise.
1125         (Target_aarch64::Relocate::relocate): Likewise.
1126         (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
1127         for new TLSLE_MOVW_* relocations.
1128
1129 2015-02-11  Will Newton  <will.newton@linaro.org>
1130
1131         PR gold/13321
1132         * arm.cc (Target_arm::make_plt_section): Create an ARM
1133         state mapping symbol at the start of the PLT.
1134
1135 2015-02-09  H.J. Lu  <hongjiu.lu@intel.com>
1136
1137         * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
1138         Replace two_file_shared_2.so with two_file_shared_1.so.
1139         * testsuite/Makefile.in: Regenerated.
1140
1141 2015-02-09  Alan Modra  <amodra@gmail.com>
1142
1143         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
1144         plugin_test_thin.a and defsym_test.
1145         * testsuite/Makefile.in: Regenerate.
1146
1147 2015-02-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1148
1149         * merge.cc (do_add_input_section): Combine loop epilogue into main loop
1150         body.
1151
1152 2015-02-04  Peter Collingbourne  <pcc@google.com>
1153
1154         * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
1155         forwarding symbols when computing symbol resolution info for plugins.
1156         * plugin.h (Plugin_manager::symtab): New method.
1157         (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
1158
1159 2015-02-03  Cary Coutant  <ccoutant@google.com>
1160             Peter Collingbourne  <pcc@google.com>
1161
1162         PR gold/15660
1163         * archive.cc (Thin_archive_object_unlocker): New class.
1164         (Archive::include_member): Unlock external members of thin archives.
1165         * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
1166         (plugin_test_2): Likewise.
1167         (plugin_test_3): Likewise.
1168         (plugin_test_4): Likewise.
1169         (plugin_test_5): Likewise.
1170         (plugin_test_6): Likewise.
1171         (plugin_test_7): Likewise.
1172         (plugin_test_8): Likewise.
1173         (plugin_test_9): Likewise.
1174         (plugin_test_10): Likewise.
1175         (plugin_test_11): New test case.
1176         * testsuite/Makefile.in: Regenerate.
1177         * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
1178         file to decide whether to claim file.
1179         (all_symbols_read_hook): Likewise.
1180         * testsuite/plugin_test_1.sh: Adjust expected output.
1181         * testsuite/plugin_test_2.sh: Likewise.
1182         * testsuite/plugin_test_3.sh: Likewise.
1183         * testsuite/plugin_test_6.sh: Likewise.
1184         * testsuite/plugin_test_tls.sh: Likewise.
1185         * testsuite/plugin_test_11.sh: New testcase.
1186
1187 2015-02-03  Cary Coutant  <ccoutant@google.com>
1188
1189         * descriptors.cc (Descriptors::open): Set artificially-low limit for
1190         file descriptors when debugging enabled. Add debug output.
1191         (Descriptors::release): Add debug output.
1192         (Descriptors::close_some_descriptor): Likewise.
1193         (Descriptors::close_all): Likewise.
1194         * fileread.cc (File_read::lock): Likewise.
1195         (File_read::unlock): Likewise.
1196
1197 2015-02-02  Cary Coutant  <ccoutant@google.com>
1198
1199         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
1200         executable output file.
1201
1202 2015-01-22  Han Shen  <shenhan@google.com>
1203
1204         * arm.cc (Target_arm::Target_arm): Add initialization for new members.
1205         (Target_arm::do_plt_address_for_global): New method.
1206         (Target_arm::do_plt_address_for_local): New method.
1207         (Target_arm::rel_irelative_section): New method.
1208         (Target_arm::make_data_plt): Add more parameters for plt ctor.
1209         (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
1210         (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
1211         (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
1212         (Target_arm::Scan::check_non_pic): Add ifunc support.
1213         (Target_arm::Scan::local): Add ifunc support.
1214         (Target_arm::Scan::global): Add ifunc support.
1215         (Target_arm::make_plt_section): New method.
1216         (Target_arm::make_plt_entry): Change to call to make_plt_section.
1217         (Target_arm::make_local_ifunc_plt_entry): New method.
1218         (Target_arm::got_irelative_): New member.
1219         (Target_arm::rel_irelative_): New member.
1220         (Target_arm::got_section): Add creation for got_irelative_.
1221         (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
1222         (Target_arm::Relocate::relocate): Properly set local ifunc address.
1223         (Target_arm::do_dynsym_value): Properly set global ifunc address.
1224         (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
1225         (Output_data_plt_arm::IRelative_data): New type.
1226         (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
1227         (Output_data_plt_arm::add_entry): Add more parameters.
1228         (Output_data_plt_arm::add_relocation): New method.
1229         (Output_data_plt_arm::add_local_ifunc_entry): New method.
1230         (Output_data_plt_arm::rel_irelative): New method.
1231         (Output_data_plt_arm::entry_count): Modified.
1232         (Output_data_plt_arm::address_for_global): New method.
1233         (Output_data_plt_arm::address_for_local): New method.
1234 gold/
1235         (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
1236         (Output_data_plt_arm::insert_irelative_data): New method.
1237         (Output_data_plt_arm::irelative_rel_): New member.
1238         (Output_data_plt_arm::got_): New member.
1239         (Output_data_plt_arm::got_irelative_): New member.
1240         (Output_data_plt_arm::irelative_count_): New member.
1241         (Output_data_plt_arm::IRelative_data_vec): New typedef.
1242         (Output_data_plt_arm::irelative_data_vec_): New member.
1243         (Output_data_plt_arm::do_write): Write out irelative entries.
1244         (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
1245         more parameters to ctor.
1246         (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
1247         more parameters to ctor.
1248         * output.h (Output_data_reloc::add_local_relative): New method.
1249         * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
1250
1251 2015-01-29  Alan Modra  <amodra@gmail.com>
1252
1253         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
1254         and GOT_TLSGD to LE optimization.
1255
1256 2015-01-28  Cary Coutant  <ccoutant@google.com>
1257
1258         * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
1259         for undef TLS symbols.
1260         (Target_x86_64::Relocate::relocate_tls): Likewise.
1261         (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
1262
1263 2015-01-25  Cary Coutant  <ccoutant@google.com>
1264
1265         * output.cc (Output_segment::set_section_addresses): Fix calculation
1266         of size of relro segment.
1267
1268 2015-01-22  Alan Modra  <amodra@gmail.com>
1269
1270         * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
1271         condition for need of ifunc plt entry.
1272         (Target_powerpc::Scan::global <got relocs>): Likewise.
1273
1274 2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1275
1276         * mips.cc (reloc_high): Add r_sym.
1277         (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
1278         reloc_high constructor.
1279         (Mips_relocate_functions::relgot16_local): Likewise.
1280         (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
1281         r_type to decide whether LO16 matches HI16.
1282         (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
1283         rello16 and relgot16_local.
1284
1285 2015-01-09  Cary Coutant  <ccoutant@google.com>
1286
1287         * layout.cc (Layout::set_segment_offsets): Don't align start of segment
1288         unless alignment is larger than page size.
1289
1290 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1291             Cary Coutant  <ccoutant@google.com>
1292
1293         PR gold/17729
1294         * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
1295         (DEFAULT_TARGET_X32): Set for x32.
1296         * x86_64.cc (cmp_insn_32): New.
1297         (lea_r10_insn_32): Likewise.
1298         (lea_r11_insn_32): Likewise.
1299         (cmp_insn_64): Likewise.
1300         (lea_r10_insn_64): Likewise.
1301         (lea_r11_insn_64): Likewise.
1302         (Target_x86_64<size>::do_calls_non_split): Handle x32.
1303         * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
1304         (check_DATA): Add split_x32 files.
1305         (split_x32_[1234n].o): New targets.
1306         (split_x32_[124]): New targets.
1307         (split_x32_[1234r].stdout): New targets.
1308         * testsuite/split_x32.sh: New file.
1309         * testsuite/split_x32_1.s: Likewise.
1310         * testsuite/split_x32_2.s: Likewise.
1311         * testsuite/split_x32_3.s: Likewise.
1312         * testsuite/split_x32_4.s: Likewise.
1313         * testsuite/split_x32_n.s: Likewise.
1314         * configure: Regenerated.
1315         * testsuite/Makefile.in: Likewise.
1316
1317 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1318
1319         PR gold/17809
1320         * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
1321         x32.
1322
1323 2015-01-02  Alan Modra  <amodra@gmail.com>
1324
1325         * version.cc (print_version): Just print current year.
1326         * dwp.cc (print_version): Likewise.
1327
1328 2015-01-01  Alan Modra  <amodra@gmail.com>
1329
1330         Update year range in copyright notice of all files.
1331
1332 2014-12-25  Alan Modra  <amodra@gmail.com>
1333
1334         * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
1335         new enums.
1336         (Target_arm::merge_object_attributes, ): Likewise.
1337
1338 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
1339
1340         * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
1341         as hard float only when Tag_ABI_VFP_args is 1, using new enum value
1342         AEABI_VFP_args_vfp to check that.
1343         (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
1344         value and replace hardcoded values by enum values.
1345
1346 2014-12-22  Cary Coutant  <ccoutant@google.com>
1347
1348         * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
1349
1350 2014-12-20  H.J. Lu  <hongjiu.lu@intel.com>
1351
1352         PR gold/14608
1353         * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
1354         to "return i * i * 3;".
1355
1356 2014-12-16  Cary Coutant  <ccoutant@google.com>
1357
1358         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
1359         (Mapfile::print_output_data): Use current_data_size() to avoid
1360         assert for sections requiring postprocessing; if address is not valid,
1361         print 0.
1362         (Mapfile::print_output_section): Use current_data_size(); print note
1363         that addresses and sizes are before compression.
1364
1365 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
1366
1367         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1368         Cast current_group_size to unsigned long when reporting error.
1369
1370 2014-12-10  Jing Yu  <jingyu@google.com>
1371
1372         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
1373         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
1374         Update error message.
1375         (Target_aarch64::do_relax): Use absolute value of option
1376         stub_group_size. Replace local variable with class member
1377         stub_group_size_.
1378
1379 2014-12-04  Alan Modra  <amodra@gmail.com>
1380
1381         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
1382         addend of PLTREL24 reloc when not generating a plt stub.  Make
1383         max_branch_offset an "Address".
1384         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
1385         (Target_powerpc::Relocate::relocate): Likewise.
1386
1387 2014-12-04  Alan Modra  <amodra@gmail.com>
1388
1389         PR 17670
1390         * symtab.cc (Symbol::set_undefined): Remove assertion.
1391         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1392         on symbols defined in discarded sections, instead return false.
1393         Rearrange params, update all callers.
1394         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
1395         branches to syms in discarded sections.
1396         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
1397         undefined and flag as discarded.
1398         (Target_powerpc::Relocate::relocate): Localize variable.
1399
1400 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
1401
1402         PR gold/17675
1403         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
1404         * testsuite/Makefile.in: Regenerated.
1405
1406 2014-12-03  Alan Modra  <amodra@gmail.com>
1407
1408         PR 17566
1409         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
1410         when adding dynamic relocations against section symbols.
1411
1412 2014-12-01  Dimitry Ivanov <dimitry@google.com>
1413
1414         * layout.cc (Layout::finish_dynamic_section): When '-z global'
1415         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
1416         * options.h (General_options): New -z option (global).
1417
1418 2014-12-01  Cary Coutant  <ccoutant@google.com>
1419
1420         PR gold/17578
1421         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
1422         is given.
1423         (Layout::create_executable_stack_info): Warn when -z noexecstack is
1424         given but some inputs require executable stack.
1425
1426 2014-11-26  Cary Coutant  <ccoutant@google.com>
1427
1428         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
1429         .debug_str_offsets; strip .debug_gnu_pubnames and
1430         .debug_gnu_pubtypes.
1431         (lines_only_debug_sections): Strip all four new sections.
1432
1433 2014-11-26  Jing Yu  <jingyu@google.com>
1434
1435         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
1436         register to be x0 when to relax TLSDESC_LD64_LO12.
1437
1438 2014-11-26  Alan Modra  <amodra@gmail.com>
1439
1440         * powerpc.cc (struct Stub_table_owner): New.
1441         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
1442         unsigned int vector.  Update all references.
1443         (powerpc_relobj::set_stub_table): Take an unsigned int param
1444         rather than a Stub_table.  Update callers.
1445         (Powerpc_relobj::clear_stub_table): New function.
1446         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
1447         stub_group_size_ vars.
1448         (Target_powerpc::new_stub_table): Delete.
1449         (max_branch_delta): New function, extracted from..
1450         (Target_powerpc::Relocate::relocate): ..here..
1451         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
1452         status on whether stub created successfully.
1453         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
1454         default sizing to..
1455         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
1456         reduce on relax failure.
1457         (Target_powerpc::group_sections): Add "no_size_errors" param.
1458         Use stub_group_size_.  Set up group info in a temp vector,
1459         before building Stub_table vector.  Account for input sections
1460         possibly already converted to relaxed sections.
1461         (Stub_table::init): Delete.  Merge into..
1462         (Stub_table::Stub_table): ..here.
1463         (Stub_table::can_reach_stub): New function.
1464         (Stub_table::add_plt_call_entry): Add "from" parameter and
1465         return true iff stub could be reached.
1466         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
1467         param too.
1468         (Stub_table::clear_stubs): Add "all" param.
1469
1470 2014-11-26  Alan Modra  <amodra@gmail.com>
1471
1472         * powerpc.cc (Stub_control::set_output_and_owner): New function.
1473         (Target_powerpc::group_sections): Use it.
1474
1475 2014-11-25  Cary Coutant  <ccoutant@google.com>
1476
1477         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
1478         (Binary_to_elf::write_symbol): Add st_size parameter.
1479         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
1480
1481 2014-11-25  Cary Coutant  <ccoutant@google.com>
1482
1483         PR gold/17639
1484         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
1485         (Sized_relobj_file::do_layout): Handle deferred sections properly
1486         during GC pass 1. Don't add reloc sections to deferred list twice.
1487         * object.h (Sized_relobj_file::is_deferred_layout): New function.
1488         (Sized_relobj_file::is_deferred_layout_): New data member.
1489
1490 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
1491
1492         PR gold/17619
1493         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
1494         Check PC-relative offset overflow in PLT entry.
1495
1496 2014-11-21  Alan Modra  <amodra@gmail.com>
1497
1498         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
1499         for undefined weaks.
1500
1501 2014-11-20  Alan Modra  <amodra@gmail.com>
1502
1503         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
1504         from --stub-group-size parameter divided by 1024.
1505         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
1506         template parameter.  Update all uses.
1507         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
1508         has_stub_value.  Set for long branches.  Don't report overflow for
1509         branch to undefined weak symbols.  Print info message on
1510         overflowing branch to stub.
1511
1512 2014-11-20  Alan Modra  <amodra@gmail.com>
1513
1514         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
1515
1516 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
1517
1518         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
1519         entry for R_X86_64_GOTPLT64.
1520         (Target_x86_64<size>::Relocate::relocate): Update comments for
1521         R_X86_64_GOTPLT64.
1522
1523 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
1524
1525         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
1526         * plugin.h: add lock definition
1527
1528 2014-10-29  Han Shen  <shenhan@google.com>
1529             Jing Yu   <jingyu@google.com>
1530
1531         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
1532         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1533         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
1534         Symbol::TLS_REF.
1535         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
1536         method.
1537         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
1538         (Target_aarch64::tls_ld_to_le): New method.
1539         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
1540         for 64bit targets.
1541         (Output_data_plt_aarch64::irelative_rel_): New data member.
1542         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
1543         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
1544         (Output_data_plt_aarch64::add_relocation): New method.
1545         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
1546         offset. Add got_irelative size to got size.
1547         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
1548         type string with the new typename.
1549         (AArch64_relocate_functions::update_adr): Replace parameter x with
1550         immed.
1551         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
1552         (AArch64_relocate_functions::reloc_common): New method.
1553         (AArch64_relocate_funcsions::rela_general): Extract common part out
1554         into reloc_common method.
1555         (AArch64_relocate_functions::rela_general): Likewise.
1556         (AArch64_relocate_functions::pcrela_general): Likewise.
1557         (AArch64_relocate_functions::adr): New method.
1558         (AArch64_relocate_functions::adrp): Calculate immed before calling
1559         update_adr.
1560         (AArch64_relocate_functions::adrp): Likewise.
1561         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
1562         comparing x to 0. Calculate immed from ~x when x < 0.
1563         (Target_aarch64::optimize_tls_reloc): Add new cases for
1564         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1565         TLSLD_MOVW_DTPREL_G0_NC.
1566         (Target_aarch64::possible_function_pointer_reloc): Implement this
1567         method.
1568         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
1569         comment.
1570         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
1571         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1572         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1573         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
1574         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1575         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1576         (Target_aarch64::make_plt_entry): Call add_entry with two more
1577         parameters.
1578         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1579         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
1580         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1581         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1582         (Target_aarch64::Relocate::relocate_tls): Add cases for
1583         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1584         TLSLD_MOVW_DTPREL_G0_NC.
1585         * testsuite/icf_safe_so_test.cc: Correct test comment.
1586         * testsuite/icf_safe_test.sh: Add AArch64 arch.
1587
1588 2014-10-22  Alan Modra  <amodra@gmail.com>
1589
1590         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
1591         thread_starter.
1592
1593 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
1594
1595         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
1596
1597 2014-10-17  Cary Coutant  <ccoutant@google.com>
1598
1599         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1600         Add "typename" keyword.
1601
1602 2014-10-15  Han Shen  <shenhan@google.com>
1603             Jing Yu   <jingyu@google.com>
1604
1605         Patch for gold aarch64 backend to support relaxation.
1606         * aarch64-reloc.def: Change format.
1607         * aarch64.cc (class Reloc_stub): New class.
1608         (class Stub_table): New class.
1609         (class AArch64_relobj): New class.
1610         (class AArch64_input_section): New class.
1611         (class AArch64_output_section): New class.
1612         (Target_aarch64::new_stub_table): New method.
1613         (Target_aarch64::new_aarch64_input_section): New method.
1614         (Target_aarch64::find_aarch64_input_section): New method.
1615         (Target_aarch64::scan_section_for_stubs): New method.
1616         (Target_aarch64::scan_reloc_section_for_stubs): New method.
1617         (Target_aarch64::relocate_stub): New method.
1618         (Target_aarch64::current_target): New method.
1619         (Target_aarch64::do_make_elf_object): New method.
1620         (Target_aarch64::do_may_relax): New method.
1621         (Target_aarch64::do_relax): New method.
1622         (Target_aarch64::group_sections): New method.
1623         (Target_aarch64::scan_reloc_for_stub): New method.
1624         (Target_aarch64::do_make_output_section): New method.
1625         (Target_aarch64::stub_tables_): New data member.
1626         (Target_aarch64::aarch64_input_section_map_): New data member.
1627         (AArch64_relocate_functions::maybe_apply_stub): New method.
1628
1629 2014-09-30  Cary Coutant  <ccoutant@google.com>
1630
1631         PR gold/17432
1632         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
1633
1634 2014-09-30  Kito Cheng  <kito@0xlab.org>
1635
1636         PR gold/13597
1637         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
1638         hash table before sysv-style hash table.
1639
1640 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
1641
1642         * options.h (--pic-executable): Add negative to alias to -no-pie.
1643
1644 2014-09-26  Cary Coutant  <ccoutant@google.com>
1645
1646         PR gold/16773
1647         * object.cc (Sized_relobj_file): Compute value of section symbols
1648         for TLS sections the same as TLS symbols.
1649
1650 2014-09-25  Cary Coutant  <ccoutant@google.com>
1651
1652         PR gold/17432
1653         * resolve.cc (Symbol_table::resolve): Override common placeholder
1654         symbols, but adjust sizes.
1655         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
1656         symbols to common lists.
1657
1658 2014-09-24  Alan Modra  <amodra@gmail.com>
1659
1660         * po/POTFILES.in: Regenerate.
1661
1662 2014-09-23  Taiju Tsuiki  <tzik@google.com>
1663             Cary Coutant  <ccoutant@google.com>
1664
1665         PR gold/14860
1666         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
1667         on input_sections_blocker.
1668         * layout.cc (Write_sections_task::locks): Unblock
1669         input_sections_blocker_.
1670         * layout.h (Write_sections_task::Write_sections_task): Add
1671         input_sections_blocker.
1672         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
1673         to DEPENDENCIES.
1674         * testsuite/Makefile.in: Regenerate.
1675
1676 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1677
1678         * testsuite/Makefile.am (plugin_test_10): New test.
1679         * testsuite/Makefile.in: Regenerate
1680         * testsuite/plugin_common_test_2.c (c1): Align to 8.
1681         * testsuite/plugin_test_10.sh: New file.
1682
1683 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1684
1685         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
1686         * resolve.cc (Symbol_table::resolve): Don't override common symbols
1687         during the replacement phase.
1688
1689 2014-09-17  Han Shen  <shenhan@google.com>
1690             Jing Yu  <jingyu@google.com>
1691
1692         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
1693         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
1694         * aarch64.cc (Target_aarch64): Add data members
1695         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
1696         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
1697         constructor.
1698         (Target_aarch64::do_reloc_symbol_index): New method.
1699         (Target_aarch64::do_reloc_addend): New method.
1700         (Target_aarch64::add_tlsdesc_info): New method.
1701         (Target_aarch64::do_dynsym_value): New method.
1702         (Target_aarch64::do_make_data_plt): Add new parameters: got,
1703         got_irelative. Pass them to Output_data_plt_aarch64_standard.
1704         (Target_aarch64::make_data_plt): Add new parameters: got,
1705         got_irelative. Pass them to do_make_data_plt.
1706         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
1707         (Target_aarch64::Relocate:tls_gd_to_le): New method.
1708         (Target_aarch64::Relocate:tls_ie_to_le): New method.
1709         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
1710         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
1711         (Target_aarch64::got_tlsdesc_section): New method.
1712         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1713         (Target_aarch64::define_tls_base_symbol): New method.
1714         (Target_aarch64::reserve_tlsdesc_entries): New method.
1715         (Target_aarch64::got_mod_index_entry): New method.
1716         (Target_aarch64::rela_tlsdesc_section): New method.
1717         (Target_aarch64::rela_irelative_section): New method.
1718         (Target_aarch64::Tlsdesc_info): New struct.
1719         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
1720         relocations and tlsdesc relocations.
1721         (Target_aarch64::optimize_tls_reloc): Implement method.
1722         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
1723         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
1724         in constructor.
1725         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
1726         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
1727         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
1728         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
1729         (Output_data_plt_aarch64::rela_tlsdesc): New method.
1730         (Output_data_plt_aarch64::rela_irelative): New method.
1731         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
1732         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
1733         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
1734         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
1735         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
1736         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
1737         (Output_data_plt_aarch64_standard): New member variables:
1738         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
1739         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
1740         New parameter: got, got_irelative.
1741         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
1742         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
1743         (Output_data_plt_aarch64::do_write): Replace got_address with
1744         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
1745         (AArch64_relocate_functions::update_movnz): New method.
1746         (AArch64_relocate_functions): Correct format.
1747         (AArch64_relocate_functions::movnz): New method.
1748         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
1749         before the switch. Add new cases to switch.
1750         Check ie_to_le relaxation on tlsie relocations. Add code handling
1751         tlsgd tlsdesc cases.
1752         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
1753         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
1754         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
1755         Call reloc_name_in_error_message to print unsupported reloc.
1756         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
1757         make_data_plt.
1758         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
1759         relocs. Fill in some more dynamic tags.
1760         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
1761         Skip call tls_get_addr when tlsgd is relaxed.
1762         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
1763         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
1764         tlsdesc->ie relaxation.
1765
1766 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1767
1768         * mips.cc (Target_mips_nacl): New class.
1769         (Target_selector_mips_nacl): New class.
1770         (target_selector_mips32): Rename from target_selector_mips32be and use
1771         Target_selector_mips_nacl instead of Target_selector_mips.
1772         (target_selector_mips32el): Rename from target_selector_mips32 and use
1773         Target_selector_mips_nacl instead of Target_selector_mips.
1774         (target_selector_mips64): Rename from target_selector_mips64be and use
1775         Target_selector_mips_nacl instead of Target_selector_mips.
1776         (target_selector_mips64el): Rename from target_selector_mips64 and use
1777         Target_selector_mips_nacl instead of Target_selector_mips.
1778         (Target_mips::mips_info): Add const attribute.
1779
1780 2014-09-02  Cary Coutant  <ccoutant@google.com>
1781
1782         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
1783         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
1784         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
1785         (Sized_incr_dynobj::do_section_name): Likewise.
1786         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
1787         (Sized_incr_dynobj::do_section_name): Likewise.
1788         * object.h (Object::section_name): Likewise.
1789         (Object::do_section_name): Likewise.
1790         (Sized_relobj_file::do_section_name): Likewise.
1791         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
1792         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
1793
1794 2014-09-02  Cary Coutant  <ccoutant@google.com>
1795
1796         PR gold/17005
1797         * ehframe.cc (Fde::write): Add output_offset parameter.
1798         (Cie::write): Likewise.
1799         (Eh_frame::set_final_data_size): Account for offset within output
1800         section.
1801         (Eh_frame::do_sized_write): Likewise.
1802         * ehframe.h (Fde::write): Add output_offset parameter.
1803         (Cie::write): Likewise.
1804         * output.cc (Output_section::Input_section_sort_entry): Remove
1805         section_has_name_; add output_section_name parameter. Use
1806         output section name for non-input sections.
1807         (Output_section::Input_section_sort_entry::section_has_name): Remove.
1808         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
1809         (Output_section::Input_section_sort_compare): Remove logic for
1810         sections without names.
1811         (Output_section::Input_section_sort_init_fini_compare): Likewise.
1812         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
1813         Likewise.
1814         (Output_section::Input_section_sort_section_name_compare): Likewise.
1815
1816 2014-08-29 Han Shen <shenhan@google.com>
1817            Jing Yu <jingyu@google.com>
1818
1819         * aarch64-reloc-property.cc
1820         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
1821         reference reloc property in the table.
1822         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
1823         3 other entries.
1824         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
1825         2 new overloaded methods.
1826         (Output_data_got_aarch64::do_write): Add code to write out
1827         static relocs.
1828         (class Output_data_got_aarch64::Static_reloc): New class to wrap
1829         static relocs.
1830         (Output_data_got_aarch64::static_relocs): New vector to
1831         hold static relocs.
1832         (Target_aarch64::TCB_SIZE): New const static memeber.
1833         (Target_aarch64::tcb_size): New method.
1834         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
1835         (Target_aarch64::Relocate::relocate_tls): New method.
1836         (Target_aarch64::Scan::local): Add code handling new reloc types.
1837         (Target_aarch64::Scan::global): Add code handling new reloc types.
1838
1839 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
1840
1841         * options.h (-no-pie): Add option.
1842
1843 2014-08-08  Jing Yu  <jingyu@google.com>
1844             Han Shen  <shenhan@google.com>
1845
1846         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
1847         (DEFFILES): add aarch64-reloc.def.
1848         (TARGETSOURCES): Add aarch64-reloc-property.cc.
1849         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
1850         * Makefile.in: Regenerate.
1851         * aarch64-reloc-property.cc: New file.
1852         * aarch64-reloc-property.h: New file.
1853         * aarch64-reloc.def: New file.
1854         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
1855         with tab to make the format consistent.
1856         (Output_data_got_aarch64::symbol_table_): New method.
1857         (Target_aarch64::do_plt_address_for_global): New method.
1858         (Target_aarch64::do_plt_address_for_local): New method.
1859         (Target_aarch64::do_select_as_default_target): New method.
1860         (Target_aarch64::do_make_data_plt): New method.
1861         (Target_aarch64::make_data_plt): New method.
1862         (Output_data_plt_aarch64::has_irelative_section): New method.
1863         (Output_data_plt_aarch64::address_for_global): New method.
1864         (Output_data_plt_aarch64::address_for_local): New method.
1865         (Output_data_plt_aarch64::irelative_rel_): New parameter.
1866         (Output_data_plt_aarch64::add_entry): Implement contents.
1867         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
1868         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
1869         the got_pov entry to plt0.
1870         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
1871         Implement contents.
1872         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
1873         (AArch64_howto): New struct.
1874         (aarch64_howto[]): New static const array.
1875         (AArch64_relocate_functions): New class.
1876         (Target_aarch64::Scan::get_reference_flags): Remove method.
1877         (Target_aarch64::Scan::local): Implement to support a few relocations.
1878         (Target_aarch64::Scan::global): Implement to support a few relocations.
1879         (Target_aarch64::make_plt_section): Implement contents.
1880         (Target_aarch64::make_plt_entry): Implement contents.
1881         (Target_aarch64::do_finalize_sections): Implement contents.
1882         (Target_aarch64::Relocate::relocate): Implement a few relocations.
1883         (Target_aarch64::relocate_section): Implement contents.
1884
1885 2014-08-06  Alan Modra  <amodra@gmail.com>
1886
1887         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
1888
1889 2014-08-06  Alan Modra  <amodra@gmail.com>
1890
1891         PR 13227
1892         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
1893
1894 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
1895
1896         * object.cc (Relobj::is_section_name_included): Add
1897         ".rodata.nptl_version" to not garbage collect this section.
1898
1899 2014-07-08  Cary Coutant  <ccoutant@google.com>
1900
1901         * expression.cc (struct Expression::Expression_eval_info): Add
1902         new fields type_pointer, vis_pointer, and nonvis_pointer.
1903         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
1904         nonvis_pointer parameters. Adjust all calls.
1905         (Symbol_expression::value): Update type, visibility, and nonvis bits
1906         in caller.
1907         * script.cc (Symbol_assignment::sized_finalize): Update type,
1908         visibility, and remaining st_other bits for new symbol.
1909         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
1910         vis_pointer, and nonvis_pointer parameters.
1911         * symtab.h (Symbol::set_type): New method.
1912
1913         * testsuite/Makefile.am (defsym_test): New test.
1914         * testsuite/Makefile.in: Regenerate.
1915         * testsuite/defsym_test.c: New file.
1916         * testsuite/defsym_test.sh: New file.
1917
1918 2014-07-08  Cary Coutant  <ccoutant@google.com>
1919
1920         PR gold/15639
1921         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
1922         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
1923         (Sized_dynobj::base_read_symbols): ...new method.
1924         * object.h (Sized_relobj_file::base_read_symbols): New method.
1925         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
1926         (Sized_relobj_file::base_read_symbols): ...new method.
1927         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
1928         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
1929         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
1930
1931 2014-07-04  Alan Modra  <amodra@gmail.com>
1932
1933         * po/POTFILES.in: Regenerate.
1934
1935 2014-07-02  Jing Yu  <jingyu@google.com>
1936
1937         * aarch64.cc: New file
1938         * Makefile.am (TARGETSOURCES): Add aarch64.cc
1939         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
1940         * Makefile.in: Regenerate.
1941         * configure.tgt: Add entries for aarch64*.
1942         * configure.ac:  Likewise.
1943         * configure: Likewise.
1944
1945 2014-06-27  Alan Modra  <amodra@gmail.com>
1946
1947         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
1948
1949 2014-06-24  Cary Coutant  <ccoutant@google.com>
1950
1951         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
1952         sections.
1953         (Dwo_file::sized_read_unit_index): Likewise.
1954
1955 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1956
1957         * mips.cc: New file.
1958         * Makefile.am (TARGETSOURCES): Add mips.cc
1959         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
1960         * configure.tgt: Add entries for mips*.
1961         * configure.ac: Likewise.
1962         * Makefile.in: Regenerate.
1963         * configure: Likewise.
1964
1965 2014-06-09  Cary Coutant  <ccoutant@google.com>
1966
1967         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
1968         unit_length is within section bounds.
1969
1970 2014-06-09  Cary Coutant  <ccoutant@google.com>
1971
1972         PR gold/16980
1973         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
1974         map.
1975
1976 2014-06-07  Alan Modra  <amodra@gmail.com>
1977
1978         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
1979
1980 2014-06-06  Cary Coutant  <ccoutant@google.com>
1981
1982         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
1983         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
1984         (Dwarf_pubnames_table::read_header): Likewise.
1985         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
1986         .debug_gnu_pubtypes.
1987
1988 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
1989
1990         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
1991         * Makefile.in, configure: Regenerate.
1992
1993 2014-06-03  Alan Modra  <amodra@gmail.com>
1994
1995         * powerpc.cc (addis_12_2): Define.
1996         (Stub_table::do_write): Support fusion on ELFv2 stubs.
1997
1998 2014-06-03  Alan Modra  <amodra@gmail.com>
1999
2000         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
2001         st_other output.
2002
2003 2014-06-02  Alan Modra  <amodra@gmail.com>
2004
2005         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
2006         Only ignore relocs on ELFv1.
2007         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
2008
2009 2014-05-30  Cary Coutant  <ccoutant@google.com>
2010
2011         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
2012         * testsuite/Makefile.in: Regenerate.
2013         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
2014
2015 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
2016
2017         PR gold/16945
2018         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
2019         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
2020
2021 2014-05-15  Alan Modra  <amodra@gmail.com>
2022
2023         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
2024         Compare FDE contents with DW_CFA_nop rather than 0.
2025
2026 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
2027
2028         * symtab.h (may_need_copy_reloc): Remove check for position independent
2029         code.
2030         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
2031         position independence before pc absolute may_need_copy_reloc call.
2032         Add check for executable output befor pc relative may_need_copy_reloc
2033         call.
2034         * i386.cc: Ditto.
2035         * arm.cc: Ditto.
2036         * sparc.cc: Ditto.
2037         * tilegx.cc: Ditto.
2038         * powerpc.cc: Add check for no position independence before
2039         may_need_copy_reloc calls.
2040         * testsuite/pie_copyrelocs_test.cc: New file.
2041         * testsuite/pie_copyrelocs_shared_test.cc: New file.
2042         * Makefile.am (pie_copyrelocs_test): New test.
2043         * Makefile.in: Regenerate.
2044
2045 2014-05-08  Martin Liška  <mliska@suse.cz>
2046
2047         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
2048
2049 2014-05-06  Cary Coutant  <ccoutant@google.com>
2050
2051         PR gold/16900
2052         * i386.cc (Output_data_got_plt_i386): New class.
2053         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
2054         parameter. Change all callers.
2055         (Output_data_plt_i386::layout_): Remove.
2056         (Output_data_plt_i386::got_plt_): Change type.
2057         (Target_i386::got_plt_): Change type. Change all references.
2058         (Target_i386::got_section): Create instance of new class.
2059         (Output_data_got_plt_i386::do_write): New function.
2060         * x86_64.cc (Output_data_got_plt_x86_64): New class.
2061         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
2062         parameter. Change all callers.
2063         (Output_data_plt_x86_64::layout_): Remove.
2064         (Output_data_plt_x86_64::got_plt_): Change type.
2065         (Target_x86_64::got_plt_): Change type. Change all references.
2066         (Target_x86_64::got_section): Create instance of new class.
2067         (Output_data_got_plt_x86_64::do_write): New function.
2068         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
2069         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
2070         class.
2071
2072 2014-05-05  Cary Coutant  <ccoutant@google.com>
2073
2074         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
2075         if we have pubnames/pubtypes.
2076
2077 2014-05-02  Cary Coutant  <ccoutant@google.com>
2078
2079         * defstd.cc (in_segment): Define __ehdr_start here...
2080         * layout.cc (Layout::finalize): ...Instead of here.  Set the
2081         output segment when known.
2082         * resolve.cc (Symbol::override_base_with_special): Remember
2083         the original binding.
2084         * symtab.cc (Symbol::set_output_segment): New function.
2085         (Symbol::set_undefined): New function.
2086         * symtab.h (Symbol::is_weak_undefined): Check original undef
2087         binding.
2088         (Symbol::is_strong_undefined): New function.
2089         (Symbol::set_output_segment): New function.
2090         (Symbol::set_undefined): New function.
2091         * target-reloc.h (is_strong_undefined): Remove.
2092         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
2093         Check for hidden undefs.
2094         (relocate_section): Call Symbol::is_strong_undefined.
2095
2096         * testsuite/Makefile.am (ehdr_start_test_1)
2097         (ehdr_start_test_2, ehdr_start_test_3)
2098         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
2099         * testsuite/Makefile.in: Regenerate.
2100         * testsuite/ehdr_start_def.cc: New source file.
2101         * testsuite/ehdr_start_test.cc: New source file.
2102         * testsuite/ehdr_start_test.t: New linker script.
2103         * testsuite/ehdr_start_test_4.sh: New shell script.
2104
2105 2014-04-23  Cary Coutant  <ccoutant@google.com>
2106
2107         PR gold/16870
2108         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
2109
2110 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2111
2112         * layout.cc (Layout::include_section): Allow a target to decide
2113         whether to include a section.
2114         * target.h (Target::should_include_section): New function.
2115         (Target::do_should_include_section): New function.
2116
2117 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2118
2119         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
2120         inline into ...
2121         (Copy_relocs::emit): ... here.
2122         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
2123         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
2124         (Copy_reloc_entry::entries_): Change from private to protected.
2125
2126 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
2127
2128         * icf.cc (get_section_contents): Replace copies of reloc
2129         vectors with const references.
2130
2131 2014-04-02  Cary Coutant  <ccoutant@google.com>
2132
2133         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
2134         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
2135         * configure: Regenerate.
2136         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
2137         -fno-use-linker-plugin.
2138         (LINK1, CXXLINK1): Add it to the link command.
2139         * testsuite/Makefile.in: Regenerate.
2140
2141 2014-03-12  Alan Modra  <amodra@gmail.com>
2142
2143         * Makefile.in: Regenerate.
2144
2145 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2146
2147         * symtab.h (Symbol::set_nonvis): New function.
2148
2149 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2150
2151         * symtab.cc (Sized_symbol<32>::init_output_data):
2152         Instantiate the template.
2153         (Sized_symbol<64>::init_output_data): Likewise.
2154
2155 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2156
2157         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
2158         adjust dynamic symbol value.
2159         * target.h (Target::adjust_dyn_symbol): New function.
2160         (Target::do_adjust_dyn_symbol): New function.
2161
2162 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2163
2164         * output.cc (Output_data_dynamic::Dynamic_entry::write):
2165         Get the value of DYNAMIC_CUSTOM dynamic entry.
2166         * output.h (Output_data_dynamic::add_custom): New function.
2167         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
2168         dynamic entry.
2169         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
2170         * target.h (Target::dynamic_tag_custom_value): New function.
2171         (Target::do_dynamic_tag_custom_value): New function.
2172
2173 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2174
2175         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
2176         dynsym indexes.
2177         * target.h (Target::has_custom_set_dynsym_indexes): New function.
2178         (Target::do_has_custom_set_dynsym_indexes): New function.
2179         (Target::set_dynsym_indexes): New function.
2180         (Target::do_set_dynsym_indexes): New function.
2181
2182 2014-03-07  Alan Modra  <amodra@gmail.com>
2183
2184         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
2185         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
2186         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
2187         (Powerpc_relocate_functions::has_overflow_bitfield,
2188         overflowed): Use the above.
2189         (Target_powerpc::Relocate::relocate): Correct overflow checking
2190         for a number of relocations.  Modify overflow test for 16-bit
2191         fields in instructions to signed/unsigned according to whether
2192         the field takes a signed or unsigned value.
2193
2194 2014-03-05  Alan Modra  <amodra@gmail.com>
2195
2196         Update copyright years.
2197
2198 2014-03-05  Alan Modra  <amodra@gmail.com>
2199
2200         * powerpc.cc (Target_powerpc::Scan::local, global): Support
2201         R_PPC64_ADDR64_LOCAL.
2202         (Target_powerpc::Relocate::relocate): Likewise.
2203
2204 2014-03-03  Alan Modra  <amodra@gmail.com>
2205
2206         * dwp.cc (print_version): Update copyright year to current.
2207
2208 2014-02-10  Alan Modra  <amodra@gmail.com>
2209
2210         * po/gold.pot: Regenerate.
2211
2212 2014-02-06  Cary Coutant  <ccoutant@google.com>
2213
2214         Fix problem where -u is ignored when a weak undef is seen.
2215
2216         * archive.cc (Library_base::should_include_member): Reorder
2217         code to check for -u option if a weak undef has already been seen.
2218         * testsuite/Makefile.am (weak_undef_test_2): New test case.
2219         * testsuite/Makefile.in: Regenerate.
2220         * testsuite/weak_undef_file3.cc: New file.
2221         * testsuite/weak_undef_file4.cc: New file.
2222         * testsuite/weak_undef_test_2.cc: New file.
2223
2224 2014-02-05  Cary Coutant  <ccoutant@google.com>
2225
2226         Fix issues with gold undefined symbol diagnostics.
2227
2228         PR binutils/15435
2229         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
2230         check to here.
2231         * target-reloc.h (is_strong_undefined): New function.
2232         (relocate_section): Move undef vtable symbol check from here.
2233         Check for is_strong_undefined.
2234
2235 2014-02-05  Cary Coutant  <ccoutant@google.com>
2236
2237         Fix problems with the --dynamic-list option.
2238
2239         PR gold/13577
2240         * options.cc (General_options::parse_dynamic_list):
2241         Set have_dynamic_list_.
2242         (General_options::General_options): Initialize have_dynamic_list_.
2243         (General_options::finalize): Turn off -Bsymbolic and
2244         -Bsymbolic-functions if --dynamic-list provided.
2245         * options.h (General_options::have_dynamic_list): New function.
2246         (General_options::have_dynamic_list_): New data member.
2247         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
2248         correctly.
2249
2250         PR gold/16530
2251         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
2252         in --dynamic-list, mark it.
2253
2254         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
2255         (dynamic_list_2): New test case.
2256         * testsuite/Makefile.in: Regenerate.
2257         * testsuite/dynamic_list_2.cc: New file.
2258         * testsuite/dynamic_list_2.t: New file.
2259         * testsuite/dynamic_list_lib1.cc: New file.
2260         * testsuite/dynamic_list_lib2.cc: New file.
2261         * testsuite/gc_dynamic_list_test.c: New file.
2262         * testsuite/gc_dynamic_list_test.sh: New file.
2263         * testsuite/gc_dynamic_list_test.t: New file.
2264
2265 2014-01-28  Cary Coutant  <ccoutant@google.com>
2266
2267         Add .gdb_index version 7 support.
2268
2269         * gold/dwarf_reader.cc: include <utility> (for make_pair).
2270         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
2271         debug sections.
2272         (Dwarf_ranges_table::read_ranges_table): Likewise.
2273         (Dwarf_pubnames_table::read_section): Check for GNU-style
2274         sections, and for compressed debug sections.
2275         (Dwarf_pubnames_table::read_header): Compute end address of table.
2276         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
2277         for end of list by offset, not by offset == 0.
2278         (Dwarf_info_reader::do_read_string_table): Check for compressed
2279         debug sections.
2280         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2281         Initialize new data members.
2282         (Dwarf_pubnames_table::next_name): return flag_byte.
2283         (Dwarf_pubnames_table::end_of_table_): New data member.
2284         (Dwarf_pubnames_table::is_gnu_style_): New data member.
2285         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
2286         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
2287         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
2288         read skeleton type unit DIEs.
2289         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
2290         (Gdb_index::do_write): Write flag_byte.
2291         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
2292         (Gdb_index::Cu_vector): Store flags along with cu indexes.
2293         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
2294         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
2295
2296 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
2297
2298         * version.cc (print_version): Update copyright year to 2014.
2299
2300 2013-12-19  Dimitry Andric  <dimitry@andric.com>
2301
2302         * stringpool.cc (Stringpool_template::reserve): Add
2303         HAVE_UNORDERED_MAP case.
2304         * stringpool.cc (Stringpool_template::print_stats): Likewise.
2305
2306 2013-12-18  Cary Coutant  <ccoutant@google.com>
2307
2308         * configure.ac: Check for <unordered_set> and <unordered_map>.
2309         * config.in: Regenerate.
2310         * configure: Regenerate.
2311         * system.h: Use <unordered_set> and <unordered_map> if available.
2312
2313 2013-12-10  Roland McGrath  <mcgrathr@google.com>
2314
2315         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
2316         with $(INSTALL_PROGRAM_ENV).
2317         * Makefile.in: Regenerate.
2318
2319 2013-11-22  Cary Coutant  <ccoutant@google.com>
2320
2321         * configure.ac: Add check for which library is needed for
2322         dlopen.
2323         * configure: Regenerate.
2324
2325 2013-11-22  Cary Coutant  <ccoutant@google.com>
2326
2327         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
2328         assembler.
2329         * testsuite/Makefile.in: Regenerate.
2330
2331 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
2332
2333         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
2334         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
2335         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
2336         (Target_x86_64<size>::Scan::local): Likewise.
2337         (Target_x86_64<size>::Scan::global): Likewise.
2338         (Target_x86_64<size>::Relocate::relocate): Likewise.
2339         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
2340         Likewise.
2341         (Target_x86_64<size>::Scan::check_non_pic(): Handle
2342         R_X86_64_PC32_BND.
2343
2344         * testsuite/Makefile.am (check_PROGRAMS): Add
2345         exception_x86_64_bnd_test.
2346         (exception_x86_64_bnd_test_SOURCES): New macro.
2347         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
2348         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
2349         (exception_x86_64_bnd_test_LDADD): Likewise.
2350         (exception_x86_64_bnd_1.o): New rule.
2351         (exception_x86_64_bnd_2.o): Likewise.
2352         * testsuite/Makefile.in: Regenerated.
2353
2354 2013-11-15  Alan Modra  <amodra@gmail.com>
2355
2356         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
2357         accessor.
2358         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
2359         Only call ppc64_local_entry_offset for 64-bit.  Restrict
2360         symval_for_branch lookup to ELFv1.
2361         (Stub_table::add_plt_call_entry): Use unsigned int off.
2362         (Output_data_glink::Address, invalid_address): New.
2363         (Output_data_glink::add_eh_frame): Move out of line.  Add
2364         support for ELFv2.
2365         (Output_data_glink::add_global_entry, find_global_entry,
2366         global_entry_address): New functions.
2367         (Output_data_glink::global_entry_stubs_, end_branch_table_,
2368         ge_size): New variables.
2369         (Output_data_glink::set_final_data_size): Add global entry
2370         stub sizing.
2371         (Output_data_glink::do_write): Write global entry stubs.
2372         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
2373         parameter.  Return true for ELFv2.  Adjust callers.
2374         (Target_powerpc::Scan::local, global): Restrict opd lookup to
2375         ELFv1.  Similarly for ifunc and dynamic relocation processing
2376         specific to ELFv1.  Recognize that symbols are defined on
2377         their plt entries for ELFv2.
2378         (Target_powerpc::symval_for_branch): Assert if called for
2379         ELFv2 or ppc32.
2380         (Target_powerpc::Relocate::relocate): Use global entry plt
2381         stub for symbol value if such exists on ELFv2.
2382         (Target_powerpc::Relocate::relocate): Don't call
2383         symval_for_branch when ELFv2.  Do adjust for local entry
2384         offset when ELFv2.
2385         (Target_powerpc::do_dynsym_value): Set symbols to global entry
2386         plt stub for ELFv2.
2387         (Target_powerpc::do_plt_address_for_global): Similarly.
2388
2389 2013-11-14  Cary Coutant  <ccoutant@google.com>
2390
2391         Revert patch -- this did not fix the problem, and there is
2392         no race there.
2393
2394         2013-11-14  Cary Coutant  <ccoutant@google.com>
2395
2396             PR gold/14860
2397             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2398             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2399             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2400             updating fde_offsets_.
2401             (Eh_frame_hdr::lock_): New data member.
2402
2403 2013-11-14  Cary Coutant  <ccoutant@google.com>
2404
2405         * dwp.cc (Dwo_file_entry): New type.
2406         (File_list): Use Dwo_file_entry.
2407         (Dwo_file::verify): New function.
2408         (Dwo_file::verify_dwo_list): New function.
2409         (Dwo_file::sized_verify_dwo_list): New function.
2410         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
2411         list.
2412         (Dwp_options): New enum type.
2413         (dwp_options): Add --verify-only.
2414         (usage): Likewise.
2415         (main): Likewise.
2416         * dwp.h (gold_info): Add declaration.
2417
2418 2013-11-14  Cary Coutant  <ccoutant@google.com>
2419
2420         PR gold/14860
2421         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2422         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2423         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2424         updating fde_offsets_.
2425         (Eh_frame_hdr::lock_): New data member.
2426
2427 2013-11-06  Cary Coutant  <ccoutant@google.com>
2428
2429         PR gold/15758
2430         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
2431         before reloc sections.
2432
2433 2013-11-04  Alan Modra  <amodra@gmail.com>
2434
2435         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
2436         (Symbol::needs_dynamic_reloc): Test new flag.
2437         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
2438         (Target_powerpc::Scan::get_reference_flags): Add target param.
2439         Return FUNC_DESC_ABI for 64-bit ELFv1.
2440         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
2441         call.
2442         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
2443         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
2444
2445 2013-10-31  Cary Coutant  <ccoutant@google.com>
2446
2447         Restore support for dwp v2 DWARF package file format.
2448
2449         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2450         tu_length parameter.  Adjust all callers.
2451         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2452         * dwp.cc: Include dwarf.h.
2453         (Section_bounds): New struct type.
2454         (Unit_set): New struct type.
2455         (Dwo_file::Dwo_file): Initialize new data member.
2456         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2457         Combine and rename to...
2458         (Dwo_file::read_unit_index): ...this.
2459         (Dwo_file::sized_read_compunit_index)
2460         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2461         (Dwo_file::sized_read_unit_index): ...this.
2462         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2463         parameters; add section_id parameter.
2464         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2465         (Dwo_file::add_unit_set): ...this.
2466         (Dwo_file::shndx_map_): Remove.
2467         (Dwo_file::sect_offsets_): New data member.
2468         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2469         (Dwp_output_file::add_section): Rename to...
2470         (Dwp_output_file::add_contribution): ...this.
2471         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2472         (Dwp_output_file::add_tu_set): Likewise.
2473         (Dwp_output_file::Contribution): New type.
2474         (Dwp_output_file::Section::contributions): New data member.
2475         (Dwp_output_file::Cu_or_tu_set): Remove.
2476         (Dwp_output_file::Section::Section): New ctor.
2477         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2478         (Dwp_output_file::Dwp_index::Section_table): New type.
2479         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2480         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2481         parameter.
2482         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2483         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2484         (Dwp_output_file::Dwp_index::section_table): New member function.
2485         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2486         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2487         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2488         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2489         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2490         (Dwp_output_file::Dwp_index::section_table_): New data member.
2491         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2492         (Dwp_output_file::add_output_section): New member function.
2493         (Dwp_output_file::write_new_section): New member function.
2494         (Dwp_output_file::write_contributions): New member function.
2495         (Dwp_output_file::section_id_map_): New data member.
2496         (class Dwo_id_info_reader): Remove.
2497         (class Unit_reader): New class.
2498         (get_dwarf_section_name): New function.
2499         (Dwo_file::read_executable): Adjust initializations of class data.
2500         (Dwo_file::read): Add support for v2 package file format.
2501         (Dwo_file::read_unit_index): Likewise.
2502         (Dwo_file::sized_read_unit_index): Likewise.
2503         (Dwo_file::copy_section): Likewise.
2504         (Dwo_file::add_unit_set): Likewise.
2505         (Dwp_output_file::add_output_section): Likewise.
2506         (Dwp_output_file::add_contribution): Likewise.
2507         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2508         for empty slot.
2509         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2510         file format.
2511         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2512         slot.
2513         (Dwp_output_file::initialize): Remove unused function.
2514         (Dwp_output_file::finalize): Add support for v2 package file format.
2515         (Dwp_output_file::write_index): Likewise.
2516         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2517         function prototype.
2518
2519 2013-10-31  Cary Coutant  <ccoutant@google.com>
2520
2521         * configure.ac: Fix check for -fmerge-constants.
2522         * configure.ac: Regenerate.
2523
2524 2013-10-30  Roland McGrath  <mcgrathr@google.com>
2525
2526         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
2527         Correct 9-byte nop sequence to match what the assembler generates.
2528
2529 2013-10-30  Alan Modra  <amodra@gmail.com>
2530
2531         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
2532         ppc64_local_entry_offset, ppc64_local_entry_offset,
2533         do_read_symbols): New functions.
2534         (Powerpc_relobj::e_flags_, st_other_): New vars.
2535         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
2536         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
2537         (Powerpc_relobj::e_flags_): New var.
2538         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
2539         and adjust for ELFv2.
2540         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
2541         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
2542         (Powerpc_dynobj::do_find_special_sections): Likewise.
2543         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
2544         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
2545         to ELFv2 local entry.
2546         (Target_powerpc::do_relax): No thread safe barriers needed for
2547         ELFv2.
2548         (Output_data_plt_powerpc::initial_plt_entry_size_,
2549         plt_entry_size): Delete.  Replace all uses with
2550         first_plt_entry_offset() and plt_entry_size().
2551         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
2552         reserved_size parm.  Update callers.
2553         (Output_data_plt_powerpc::entry_count): Update.
2554         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
2555         and use Target_powerpc::first_plt_entry_offset().
2556         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
2557         rename to plt_entry_size.
2558         (Output_data_plt_powerpc::add_ifunc_entry,
2559         add_local_ifunc_entry): Adjust reloc for ELFv2.
2560         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
2561         (glink_eh_frame_fde_64v2): New.
2562         (Stub_table::plt_call_size): Support ELFv2 sizing.
2563         (Output_data_glink::add_eh_frame): Use the new FDE.
2564         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
2565         (Stub_table::do_write): Write ELFv2 stubs and glink.
2566         (Target_powerpc::Relocate::relocate): Replaces nop after call
2567         with ld 2,24(1) and adjust local offset destination for ELFv2.
2568
2569 2013-10-30  Alan Modra  <amodra@gmail.com>
2570
2571         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
2572         (Target_powerpc::Scan::global, local): Likewise.
2573         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
2574         on all ppc64 @h and @ha relocs.
2575
2576 2013-10-14  Alan Modra  <amodra@gmail.com>
2577
2578         * output.h (Output_data_got::add_constant): Tidy.
2579         (Output_data_got::add_constant_pair): New function.
2580         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
2581         methods used so as to first call reserve_ent().
2582
2583 2013-10-11  Roland McGrath  <mcgrathr@google.com>
2584
2585         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
2586         add_got_entry and add_got_entry_pair.
2587
2588         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
2589         (HAVE_PUBNAMES): Likewise.
2590         * configure: Regenerate.
2591
2592         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
2593         * testsuite/Makefile.in: Regenerate.
2594
2595         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
2596         Remove const from declaration.
2597         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
2598         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
2599         * output.h (Output_file_header): Remove const from member target_
2600         and corresponding constructor argument.
2601         * output.cc (Output_file_header::Output_file_header): Update prototype.
2602         (Output_file_header::do_sized_write): Use this->target_ in place
2603         of parameters()->target().
2604
2605         * testsuite/undef_symbol.cc (Foo::get_a): New method.
2606
2607         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
2608         * configure: Regenerate.
2609         * Makefile.in: Regenerate.
2610         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
2611         * testsuite/merge_string_literals_2.c: Likewise.
2612         * testsuite/Makefile.am
2613         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
2614         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
2615         literal -fmerge-constants.
2616         * testsuite/Makefile.in: Regenerate.
2617
2618         * i386.cc (Target_i386): Remove unused member dynbss_.
2619         * arm.cc (Target_arm): Likewise.
2620         * powerpc.cc (Target_powerpc): Likewise.
2621         * sparc.cc (Target_sparc): Likewise.
2622         * tilegx.cc (Target_tilegx): Likewise.
2623         * x86_64.cc (Target_x86_64): Likewise.
2624         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
2625         type_signature_, type_offset_.
2626         * plugin.h (Plugin_hook): Remove unused member layout_.
2627         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
2628         mapfile_.
2629         (Read_member): Remove unused members input_objects_, symtab_,
2630         mapfile_, layout_.
2631         (Check_library): Remove unused member symtab_.
2632         * archive.h (Lib_group): Remove unused member lib_.
2633         * archive.cc (Lib_group::Lib_group): Update initializer.
2634         * incremental.h (Incremental_binary): Remove unused member target_.
2635         (Incremental_script_entry): Removed unused member script_.
2636         * layout.h (Write_symbols_task): Remove unused member input_objects_.
2637         * icf.h (Icf): Remove unused member num_tracked_relocs.
2638
2639         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
2640         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
2641         its only use.
2642         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
2643
2644         * archive.h: Use struct rather than class for forward declaration
2645         of Read_symbols_data.
2646
2647 2013-10-07  Cary Coutant  <ccoutant@google.com>
2648
2649         PR gold/16010
2650         * testsuite/Makefile.am (icf_test): Fix dependencies.
2651         (icf_safe_test): Likewise.
2652         (icf_safe_so_test): Likewise.
2653         (large_symbol_alignment): Add empty _LDADD rule.
2654         * testsuite/Makefile.in: Regenerate.
2655
2656 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
2657
2658         PR gold/15927
2659         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
2660         relocation for R_X86_64_32 on x32.
2661
2662 2013-08-27  Roland McGrath  <mcgrathr@google.com>
2663
2664         * output.cc (Output_segment::set_section_addresses): Take new
2665         Target* argument.  If target->isolate_execinstr() and the segment
2666         is executable and starts at a target->abi_pagesize() boundary,
2667         pad its end out to a target->abi_pagesize() boundary with code fill.
2668         * output.h (Output_segment::set_section_addresses): Update decl.
2669         * layout.h (Layout::check_output_data_for_reset_values): Take new
2670         argument RELAX_OUTPUTS.
2671         (Layout): New member relax_output_list_.
2672         (Layout::add_relax_output): New method.
2673         * layout.cc (Layout::Layout): Update constructor.
2674         (Layout::reset_relax_output): New method.
2675         (Layout::clean_up_after_relaxation): Call it.
2676         (Layout::prepare_for_relaxation): Update caller.
2677         (Layout::set_segment_offsets): Update callers of set_section_addresses.
2678         Call reset_relax_output before re-processing segments for
2679         isolate_execinstr case.
2680         (Layout::write_data): Handle relax_output_list_.
2681         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
2682         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
2683
2684 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
2685
2686         PR binutils/15834
2687         * object.h: Fix typos.
2688
2689 2013-08-16  Roland McGrath  <mcgrathr@google.com>
2690
2691         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
2692         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
2693
2694 2013-08-07  Cary Coutant  <ccoutant@google.com>
2695
2696         Revert support for v2 DWP files:
2697
2698         2013-03-01  Cary Coutant  <ccoutant@google.com>
2699
2700             Add dwp support for v2 DWARF package file format.
2701             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2702             tu_length parameter.  Adjust all callers.
2703             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2704             * dwp.cc: Include dwarf.h.
2705             (Section_bounds): New struct type.
2706             (Unit_set): New struct type.
2707             (Dwo_file::Dwo_file): Initialize new data member.
2708             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2709             Combine and rename to...
2710             (Dwo_file::read_unit_index): ...this.
2711             (Dwo_file::sized_read_compunit_index)
2712             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2713             (Dwo_file::sized_read_unit_index): ...this.
2714             (Dwo_file::copy_section): Remove section_name, is_str_offsets
2715             parameters; add section_id parameter.
2716             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2717             (Dwo_file::add_unit_set): ...this.
2718             (Dwo_file::shndx_map_): Remove.
2719             (Dwo_file::sect_offsets_): New data member.
2720             (Dwp_output_file::Dwp_output_file): Initialize new data members.
2721             (Dwp_output_file::add_section): Rename to...
2722             (Dwp_output_file::add_contribution): ...this.
2723             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2724             (Dwp_output_file::add_tu_set): Likewise.
2725             (Dwp_output_file::Contribution): New type.
2726             (Dwp_output_file::Section::contributions): New data member.
2727             (Dwp_output_file::Cu_or_tu_set): Remove.
2728             (Dwp_output_file::Section::Section): New ctor.
2729             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2730             (Dwp_output_file::Dwp_index::Section_table): New type.
2731             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2732             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2733             parameter.
2734             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2735             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2736             (Dwp_output_file::Dwp_index::section_table): New member function.
2737             (Dwp_output_file::Dwp_index::section_table_end): New member function.
2738             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2739             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2740             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2741             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2742             (Dwp_output_file::Dwp_index::section_table_): New data member.
2743             (Dwp_output_file::Dwp_index::section_mask_): New data member.
2744             (Dwp_output_file::add_output_section): New member function.
2745             (Dwp_output_file::write_new_section): New member function.
2746             (Dwp_output_file::write_contributions): New member function.
2747             (Dwp_output_file::section_id_map_): New data member.
2748             (class Dwo_id_info_reader): Remove.
2749             (class Unit_reader): New class.
2750             (get_dwarf_section_name): New function.
2751             (Dwo_file::read_executable): Adjust initializations of class data.
2752             (Dwo_file::read): Add support for v2 package file format.
2753             (Dwo_file::read_unit_index): Likewise.
2754             (Dwo_file::sized_read_unit_index): Likewise.
2755             (Dwo_file::copy_section): Likewise.
2756             (Dwo_file::add_unit_set): Likewise.
2757             (Dwp_output_file::add_output_section): Likewise.
2758             (Dwp_output_file::add_contribution): Likewise.
2759             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2760             for empty slot.
2761             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2762             file format.
2763             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2764             slot.
2765             (Dwp_output_file::initialize): Remove unused function.
2766             (Dwp_output_file::finalize): Add support for v2 package file format.
2767             (Dwp_output_file::write_index): Likewise.
2768             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2769             function prototype.
2770
2771 2013-07-31  Cary Coutant  <ccoutant@google.com>
2772
2773         * object.cc (Sized_relobj::do_output_section_address): New function.
2774         (Sized_relobj): Instantiate explicitly.
2775         * object.h (Object::output_section_address): New function.
2776         (Object::do_output_section_address): New function.
2777         (Sized_relobj::do_output_section_address): New function.
2778         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
2779
2780 2013-07-30  Cary Coutant  <ccoutant@google.com>
2781             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2782
2783         * parameters.cc (Parameters::entry): Return target-specific entry
2784         symbol name.
2785         * target.h (Target::entry_symbol_name): New function.
2786         (Target_info::entry_symbol_name): New data member.
2787
2788         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
2789         * i386.cc (Target_i386::i386_info): Likewise.
2790         (Target_i386_nacl::i386_nacl_info): Likewise.
2791         * sparc.cc (Target_sparc::sparc_info): Likewise.
2792         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
2793         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
2794         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
2795         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2796
2797 2013-07-22  Sterling Augustine  <saugustine@google.com>
2798
2799         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
2800         Convert parameter shndx to local variable. Add parameters symtab
2801         and symtab_size.  Scan over section names.  Find relocation
2802         section corresponding to current section.  Create and initialize
2803         reloc_mapper_ and reloc_type_.
2804         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
2805         unit_length to off_t.  Initialize member unit_length_.  Fill in field
2806         cu_offset_.
2807         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2808         Initialize new fields unit_length_ and cu_offset_.
2809         (Dwarf_pubnames_table::read_section): Update prototype.
2810         (Dwarf_pubnames_table::cu_offset): New member function.
2811         (Dwarf_pubnames_table::subsection_size): Likewise.
2812         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
2813         New fields.
2814         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
2815         member functions public.
2816         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
2817         Update comment.  Rework logic.  Move repeated parts to...
2818         (Gdb_index_info_reader::read_pubtable): ...here. New function.
2819         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
2820         pubtypes_table_, and stmt_list_offset.
2821         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2822         Gdb_index::find_pubtype_offset,
2823         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
2824         (Gdb_index::pubnames_read): Update prototype and rework logic.
2825         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
2826         Forward declare.
2827         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2828         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
2829         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
2830         Gdb_index::map_pubtable_to_dies):
2831         Declare functions.
2832         (Gdb_index::pubnames_read): Update declaration.
2833         (Gdb_index::Pubname_offset_map): New type.
2834         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
2835         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
2836         Gdb_index::stmt_list_offset): Declare.
2837         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
2838         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
2839         Gdb_index::pubtypes_offset_): Remove.
2840
2841 2013-07-19  Roland McGrath  <mcgrathr@google.com>
2842
2843         * options.h (General_options): Add -Trodata-segment option.
2844         * parameters.cc (Parameters::check_rodata_segment): New function.
2845         (Parameters::set_target_once): Call it.
2846         * parameters.h (Parameters): Declare it (private member function).
2847         * layout.cc (load_seg_unusable_for_headers): New function, broken
2848         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
2849         then validate rodata segment rather than text segment.
2850         (relaxation_loop_body): Call that.
2851         (is_text_segment): New function.  Don't admit a non-executable
2852         segment if TARGET->isolate_execinstr().
2853         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
2854
2855 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
2856
2857         PR gold/15070
2858         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
2859         * nacl.h (Sniff_file::View::View): Request aligned view.
2860
2861 2013-07-11  Cary Coutant  <ccoutant@google.com>
2862
2863         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
2864         correct BRLT entry size.
2865
2866 2013-07-03  Alan Modra  <amodra@gmail.com>
2867
2868         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
2869         comment.
2870
2871 2013-07-01  Cary Coutant  <ccoutant@google.com>
2872
2873         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
2874         reloc_type_.
2875         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
2876         (Dwarf_ranges_table::lookup_reloc): New function.
2877         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
2878         reloc_type_.
2879         (Dwarf_ranges_table::lookup_reloc): New function.
2880         (Dwarf_ranges_table::reloc_type_): New data member.
2881
2882 2013-06-27  Jing Yu  <jingyu@google.com>
2883
2884         PR gold/15662
2885         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
2886         function.
2887         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
2888         (Target_powerpc::do_relax): Call the above.
2889
2890 2013-06-27  Cary Coutant  <ccoutant@google.com>
2891
2892         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
2893         on garbage collected .opd section.
2894
2895 2013-06-27  Alan Modra  <amodra@gmail.com>
2896
2897         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
2898         is non-zero.
2899         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
2900         (Target_powerpc::do_function_location): Likewise for loc->shndx.
2901
2902 2013-06-14  Cary Coutant  <ccoutant@google.com>
2903
2904         * resolve.cc (Symbol::override_base): Don't override st_type
2905         from plugin placeholder symbols.
2906         (Symbol_table::resolve): Likewise.
2907         (Symbol_table::should_override): Don't complain about TLS mismatch
2908         if the TO symbol is a plugin placeholder.
2909         * testsuite/Makefile.am (plugin_test_tls): New test.
2910         * testsuite/Makefile.in: Regenerate.
2911         * testsuite/plugin_test_tls.sh: New test script.
2912         * testsuite/two_file_test_2_tls.cc: New test source.
2913         * testsuite/two_file_test_tls.cc: New test source.
2914
2915 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2916
2917         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
2918         the maximum segment alignment is larger than the page size.
2919         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
2920         correctly aligns the symbols with large alignemnt.
2921         * testsuite/Makefile.in: Regenerate.
2922         * testsuite/large_symbol_alignment.cc: New file.
2923
2924 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2925             Sriraman Tallam  <tmsriram@google.com>
2926
2927         * options.h (sort_section): New option.
2928         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
2929         Rename from Input_section_sort_section_name_special_ordering_compare.
2930         (Input_section_sort_section_name_compare): New struct.
2931         * output.cc (Output_section::Input_section_sort_section_name_compare::
2932         operator()): New function.
2933         (Output_section::sort_attached_input_sections): Use new sort function
2934         for .text if --sort-section=name is specified.
2935         * layout.cc (Layout::make_output_section):
2936         Add sorting by name when --sort-section=name is specified.
2937         * testsuite/Makefile.am (text_section_grouping): Test option
2938         --sort-section=name.
2939         * testsuite/Makefile.in: Regenerate.
2940         * testsuite/section_sorting_name.cc: New file.
2941         * testsuite/section_sorting_name.sh: New file.
2942
2943 2013-05-21  Cary Coutant  <ccoutant@google.com>
2944
2945         * symtab.h (Symbol::is_cxx_vtable): New function.
2946         * target-reloc.h (relocate_section): Check for vtable symbol.
2947         * testsuite/Makefile.am (missing_key_func.sh): New test case.
2948         * testsuite/Makefile.in: Regenerate.
2949         * testsuite/missing_key_func.cc: New test source.
2950         * testsuite/missing_key_func.sh: New test script.
2951
2952 2013-05-21  Cary Coutant  <ccoutant@google.com>
2953
2954         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
2955         type of enclosing symbol.
2956         (Relocate_info::location): Check symbol type when describing symbol.
2957         * object.h (Symbol_location_info): Remove unused line_number;
2958         add enclosing_symbol_type.
2959         * testsuite/debug_msg.sh: Adjust expected output.
2960
2961 2013-05-13  Cary Coutant  <ccoutant@google.com>
2962
2963         * configure.ac: Export DEFAULT_TARGET.
2964         * configure: Regenerate.
2965         * Makefile.in: Regenerate.
2966         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
2967         * testsuite/Makefile.in: Regenerate.
2968         * testsuite/debug_msg.sh: Delete duplicate tests.
2969         Don't check undef_int error message match for powerpc where the
2970         source file and line number aren't available.
2971
2972 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2973
2974         * options.h (General_options): Add --rosegment-gap option.
2975         * options.cc (finalize): --rosegment-gap implies --rosegment.
2976         * layout.cc (set_segment_offsets): Let user option override
2977         target->rosegment_gap().
2978
2979 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2980
2981         * options.h (General_options): Remove leading space from help
2982         messages for -nostdlib and --rosegment.
2983
2984 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
2985
2986         PR ld/15365
2987         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
2988
2989 2013-05-03  Alan Modra  <amodra@gmail.com>
2990
2991         * merge.cc (Output_merge_string::do_add_input_section): Correct
2992         scan for number of strings.  Rename vars to avoid shadowing.
2993         Include missing terminator in input_size_.
2994
2995 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
2996
2997         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
2998         Restore empty string handling.
2999
3000 2013-05-01  Cary Coutant  <ccoutant@google.com>
3001
3002         * stringpool.cc (Stringpool_template::new_key_offset): Fix
3003         uninitialized warning.
3004
3005 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3006
3007         * output.cc (Output_section::add_merge_input_section): Allow
3008         to merge sections if the alignment is more than character size.
3009         * merge.h (Output_merge_string::Output_merge_string): Remove
3010         assert.
3011         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
3012         only not-null strings. Check the alignment of strings.
3013         * stringpool.h
3014         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
3015         alignment as the argument.
3016         (Stringpool_template<Stringpool_char>::addralign_): New class member.
3017         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
3018         Align non-zero length strings according to the addralign_.
3019         (Stringpool_template<Stringpool_char>::set_string_offsets):
3020         Updating offsets according to the given alignment.
3021         * testsuite/Makefile.am (text_section_grouping): Test if string
3022         literals are getting merged.
3023         * testsuite/Makefile.in: Regenerate.
3024         * testsuite/merge_string_literals_1.c: New file.
3025         * testsuite/merge_string_literals_2.c: Ditto.
3026         * testsuite/merge_string_literals.sh: Ditto.
3027
3028 2013-04-26  Ian Lance Taylor  <iant@google.com>
3029
3030         * target-reloc.h (relocate_section): If the reloc offset is out of
3031         range, pass VIEW as NULL to relocate.relocate.
3032         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
3033         * i386.cc (Target_i386::Relocate::relocate): Likewise.
3034         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
3035         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
3036         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
3037         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3038
3039 2013-04-26  Geoff Pike  <gpike@chromium.org>
3040
3041         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
3042         * layout.cc (Hash_task): New class.
3043         (Layout::queue_build_id_tasks): New function.
3044         (Layout::write_build_id): Handle single-thread portion of build ID
3045         computation.  (In some cases, all of it is single-threaded.)  Replace
3046         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
3047         functionality in fewer lines of code.
3048         * layout.h (Layout::queue_build_id_tasks): New function declaration.
3049         * options.h (General_options): make "--build-id" default to tree
3050         rather than sha1.  Add two new options related to --build-id=tree:
3051         --build-id-chunk-size-for-treehash and
3052         --build-id-min-file-size-for-treehash.
3053         * Makefile.am: add testing of --build-id=tree and related new options
3054         (these tests will be invoked by "make check").
3055         * Makefile.in: Regenerate.
3056
3057 2013-04-25  Alan Modra  <amodra@gmail.com>
3058
3059         * configure.tgt: Add powerpcle and powerpc64le.
3060
3061 2013-04-22  Alan Modra  <amodra@gmail.com>
3062
3063         PR gold/15355
3064         * layout.cc (Layout::segment_precedes): Allow more than one
3065         segment with the same type and flags.
3066
3067 2013-04-15  Cary Coutant  <ccoutant@google.com>
3068
3069         * layout.cc (Layout::set_relocatable_section_offsets): Don't
3070         allocate space in file for BSS sections.
3071
3072 2013-04-15  Cary Coutant  <ccoutant@google.com>
3073
3074         * script-sections.cc (Orphan_output_section): Reset address
3075         to zero after each orphaned section for relocatable links.
3076
3077 2013-04-15  Cary Coutant  <ccoutant@google.com>
3078
3079         * symtab.cc (Symbol_table::sized_write_globals): Subtract
3080         section starting address for relocatable link.
3081         * testsuite/Makefile.am (script_test_11): New test.
3082         * testsuite/Makefile.in: Regenerate.
3083         * testsuite/script_test_11.c: New source file.
3084         * testsuite/script_test_11.t: New linker script.
3085
3086 2013-04-13  Alan Modra  <amodra@gmail.com>
3087
3088         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
3089         owner when sections are not adjacent and exceed group size.
3090         (Target_powerpc::group_sections): Handle corner case.
3091         (Target_powerpc::Branch_info::make_stub): Handle case where
3092         stub table doesn't exist due to branches in non-exec sections.
3093         (Target_powerpc::Relocate::relocate): Likewise.
3094
3095 2013-04-11  Alan Modra  <amodra@gmail.com>
3096
3097         PR gold/15354
3098         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
3099         .branch_lt to match bfd ld.  Adjust comments throughout file.
3100
3101 2013-04-04  Ian Lance Taylor  <iant@google.com>
3102
3103         GCC PR c++/56840
3104         * object.cc (do_layout_deferred_sections): Handle .eh_frame
3105         sections before checking whether they are included in the link.
3106
3107 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
3108
3109         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
3110         object before calling the plugin claim_file handler.  Pass the elf
3111         object of the archive to the plugin. Delete the elf object if the
3112         plugin claims the file.
3113
3114 2013-03-21  Alan Modra  <amodra@gmail.com>
3115
3116         * layout.cc (Layout::set_segment_offsets): Accept writable .text
3117         segment when omagic.
3118
3119 2013-03-21  Alan Modra  <amodra@gmail.com>
3120
3121         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
3122         comparison warning.
3123         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
3124         uninitialized" warning.
3125
3126 2013-03-20  Alan Modra  <amodra@gmail.com>
3127
3128         * symtab.h (Symbol::clear_version): New function.
3129         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
3130         is_needed by weak references.  Clear version for symbols defined
3131         in as-needed objects that are not needed.
3132
3133 2013-03-15  Alan Modra  <amodra@gmail.com>
3134
3135         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
3136         static and public.  Add report_err param.  Return false for data refs.
3137         (Target_powerpc::rela_dyn_section): New overloaded function.
3138         (Target_powerpc::plt_, iplt_): Elucidate.
3139         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
3140         (Output_data_plt_powerpc::do_write): Don't write .iplt.
3141         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
3142         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
3143         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
3144         push_branch and make_plt_entry for ifunc syms when
3145         reloc_needs_plt_for_ifunc.
3146         (Target_powerpc::Relocate::relocate): Don't use plt entry value
3147         for ifunc unless reloc_needs_plt_for_ifunc.
3148
3149 2013-03-15  Alan Modra  <amodra@gmail.com>
3150
3151         * gc.h (gc_process_relocs): Don't look through function descriptors.
3152         * icf.cc (get_section_contents): Do so here instead.
3153
3154 2013-03-13  Alan Modra  <amodra@gmail.com>
3155
3156         * powerpc.cc (is_branch_reloc): Forward declare.
3157         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
3158         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
3159         false for 64-bit, true for 32-bit non-branch relocs.
3160         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
3161         * testsuite/Makefile.am (icf_test): Use linker map file instead of
3162         nm output.
3163         (icf_safe_test): Generate linker map file as well as nm output.
3164         (icf_safe_so_test): Likewise.
3165         * testsuite/Makefile.in: Regenerate.
3166         * testsuite/icf_test.sh: Parse linker map file to determine
3167         section folding.
3168         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
3169         * testsuite/icf_safe_so_test.sh: Likewise.
3170         (X86_32_or_ARM_specific_safe_fold): Merge into..
3171         (arch_specific_safe_fold): ..this.
3172         (X86_64_specific_safe_fold): Delete unused function.
3173
3174 2013-03-12  Alan Modra  <amodra@gmail.com>
3175
3176         * gc.h (gc_process_relocs): Look through function descriptors
3177         to determine shndx, symvalue and addend used by ICF.  Tidy
3178         variable duplication.
3179
3180 2013-03-11  Alan Modra  <amodra@gmail.com>
3181
3182         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
3183         * layout.cc (Layout_task_runner::run): ..to here.
3184         * symtab.h (struct Symbol_location): Extract from..
3185         (class Symbol_table): ..here.
3186         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
3187         * target.h (class Target): Add function_location and
3188         do_function_location functions.
3189         (class Sized_target): Add do_function_location.
3190         * object.h (class Sized_relobj_file): Move find_shdr..
3191         (class Object): ..to here.
3192         * object.cc: Likewise.  Update to suit.  Instantiate.
3193         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
3194         * powerpc.cc (class Powerpc_dynobj): New.
3195         (Target_powerpc::do_function_location): New function.
3196         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
3197         (Powerpc_dynobj::do_read_symbols): New function.
3198         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
3199
3200 2013-03-08  Ian Lance Taylor  <iant@google.com>
3201
3202         * options.cc (General_options::string_to_object_format): Accept
3203         "default".
3204
3205 2013-03-08  Alan Modra  <amodra@gmail.com>
3206
3207         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
3208         pointer to Post_fde.
3209         (struct Post_fde): Move definition to here..
3210         * ehframe.cc (struct Post_fde): ..from here.
3211         (Cie::write): Don't alloc Post_fde.
3212         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
3213
3214 2013-03-07  Alan Modra  <amodra@gmail.com>
3215
3216         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
3217         relocation referencing .LC0.
3218         * testsuite/discard_locals_test.sh: Remove FIXMEs.
3219
3220 2013-03-07  Alan Modra  <amodra@gmail.com>
3221
3222         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
3223         always_inline.  Add assembly for powerpc to avoid GOT.
3224
3225 2013-03-07  Alan Modra  <amodra@gmail.com>
3226
3227         * testsuite/script_test_10.sh: Don't test .bss section
3228         header number.
3229
3230 2013-03-06  Alan Modra  <amodra@gmail.com>
3231
3232         * powerpc.cc (class Powerpc_relobj): Move some member functions.
3233         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
3234         all callers.  Handle folded sections.
3235         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
3236         to Powerpc_relobj.
3237         (Global_symbol_visitor_opd::operator()): Likewise.
3238
3239 2013-03-04  Alan Modra  <amodra@gmail.com>
3240
3241         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
3242         * testsuite/Makefile.in: Regenerate.
3243
3244 2013-03-01  Cary Coutant  <ccoutant@google.com>
3245
3246         Add dwp support for v2 DWARF package file format.
3247         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
3248         tu_length parameter.  Adjust all callers.
3249         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
3250         * dwp.cc: Include dwarf.h.
3251         (Section_bounds): New struct type.
3252         (Unit_set): New struct type.
3253         (Dwo_file::Dwo_file): Initialize new data member.
3254         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
3255         Combine and rename to...
3256         (Dwo_file::read_unit_index): ...this.
3257         (Dwo_file::sized_read_compunit_index)
3258         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
3259         (Dwo_file::sized_read_unit_index): ...this.
3260         (Dwo_file::copy_section): Remove section_name, is_str_offsets
3261         parameters; add section_id parameter.
3262         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
3263         (Dwo_file::add_unit_set): ...this.
3264         (Dwo_file::shndx_map_): Remove.
3265         (Dwo_file::sect_offsets_): New data member.
3266         (Dwp_output_file::Dwp_output_file): Initialize new data members.
3267         (Dwp_output_file::add_section): Rename to...
3268         (Dwp_output_file::add_contribution): ...this.
3269         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
3270         (Dwp_output_file::add_tu_set): Likewise.
3271         (Dwp_output_file::Contribution): New type.
3272         (Dwp_output_file::Section::contributions): New data member.
3273         (Dwp_output_file::Cu_or_tu_set): Remove.
3274         (Dwp_output_file::Section::Section): New ctor.
3275         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
3276         (Dwp_output_file::Dwp_index::Section_table): New type.
3277         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
3278         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
3279         parameter.
3280         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
3281         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
3282         (Dwp_output_file::Dwp_index::section_table): New member function.
3283         (Dwp_output_file::Dwp_index::section_table_end): New member function.
3284         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
3285         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
3286         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
3287         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
3288         (Dwp_output_file::Dwp_index::section_table_): New data member.
3289         (Dwp_output_file::Dwp_index::section_mask_): New data member.
3290         (Dwp_output_file::add_output_section): New member function.
3291         (Dwp_output_file::write_new_section): New member function.
3292         (Dwp_output_file::write_contributions): New member function.
3293         (Dwp_output_file::section_id_map_): New data member.
3294         (class Dwo_id_info_reader): Remove.
3295         (class Unit_reader): New class.
3296         (get_dwarf_section_name): New function.
3297         (Dwo_file::read_executable): Adjust initializations of class data.
3298         (Dwo_file::read): Add support for v2 package file format.
3299         (Dwo_file::read_unit_index): Likewise.
3300         (Dwo_file::sized_read_unit_index): Likewise.
3301         (Dwo_file::copy_section): Likewise.
3302         (Dwo_file::add_unit_set): Likewise.
3303         (Dwp_output_file::add_output_section): Likewise.
3304         (Dwp_output_file::add_contribution): Likewise.
3305         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
3306         for empty slot.
3307         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
3308         file format.
3309         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
3310         slot.
3311         (Dwp_output_file::initialize): Remove unused function.
3312         (Dwp_output_file::finalize): Add support for v2 package file format.
3313         (Dwp_output_file::write_index): Likewise.
3314         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
3315         function prototype.
3316
3317 2013-03-01  Cary Coutant  <ccoutant@google.com>
3318
3319         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
3320         function into class definition in header file.
3321         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
3322         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
3323         New function.
3324         (Dwarf_info_reader::check_buffer): Move here from .cc file.
3325
3326 2013-02-28  Alan Modra  <amodra@gmail.com>
3327
3328         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
3329         * target.cc (Target::do_plt_fde_location): New function.
3330         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
3331         accessor function, and constructor param.
3332         (struct Post_fde, Post_fdes): Declare.
3333         (Cie::write): Add post_fdes param.
3334         * ehframe.cc (Fde::write): Use plt_fde_location.
3335         (struct Post_fde): Define.
3336         (Cie::write): Stash FDEs added post merge mapping.
3337         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
3338         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
3339         (Eh_frame::do_sized_write): Arrange to write post map FDES after
3340         other FDEs.
3341         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
3342         (Target_powerpc::has_glink): New function.
3343         (Target_powerpc::do_relax): Add eh_frame info for stubs.
3344         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
3345         glink_eh_frame_fde_32, default_fde): New data.
3346         (Stub_table::eh_frame_added_): New var.
3347         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
3348         Make const.
3349         (Stub_table::add_eh_frame): New function.
3350         (Output_data_glink::add_eh_frame): New function.
3351         (Target_powerpc::make_glink_section): Call add_eh_frame.
3352
3353 2013-02-15  Ian Lance Taylor  <iant@google.com>
3354
3355         * options.h (DEFINE_uint64_alias): Define.
3356         (class General_options): Add -Ttext-segment as an alias for
3357         -Ttext.
3358
3359 2013-02-15  Alan Modra  <amodra@gmail.com>
3360
3361         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
3362         (Stub_table::do_write): ..here, two places.
3363         (Stub_table::plt_call_size): Use it here too.
3364
3365 2013-02-11  Ian Lance Taylor  <iant@google.com>
3366
3367         * descriptors.cc (Descriptors::close_all): New function.
3368         * descriptors.h (class Descriptors): Declare close_all.
3369         (close_all_descriptors): New inline function.
3370         * plugin.cc: Include "descriptors.h".
3371         (Plugin_manager::cleanup): Call close_all_descriptors.
3372
3373 2013-02-06  Alan Modra  <amodra@gmail.com>
3374
3375         * README: Update coding style link.
3376
3377 2013-01-28  Cary Coutant  <ccoutant@google.com>
3378
3379         * dwp.cc (File_list): New typedef.
3380         (Dwo_name_info_reader): New class.
3381         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
3382         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
3383         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
3384         (Dwo_file::read_executable): New function.
3385         (Dwo_file::read): Move common setup code to ...
3386         (Dwo_file::make_object): ... here.
3387         (dwp_options): Add --exec/-e.
3388         (usage): Likewise.
3389         (main): Likewise.
3390
3391 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
3392
3393         * layout.cc (Layout::layout): Check for option text_reorder.
3394         (Layout::make_output_section): Ditto.
3395         * options.h (text_reorder): New option.
3396         * output.cc (Input_section_sort_compare): Remove special ordering
3397         of section names.
3398         (Output_section::
3399          Input_section_sort_section_name_special_ordering_compare::
3400          operator()): New function.
3401         (Output_section::sort_attached_input_sections): Use new sort function
3402         for .text.
3403         * output.h (Input_section_sort_section_name_special_ordering_compare):
3404         New struct.
3405         * testsuite/Makefile.am (text_section_grouping): Test option
3406         --no-text-reorder
3407         * testsuite/Makefile.in: Regenerate.
3408         * testsuite/text_section_grouping.sh: Check order of functions without
3409         default text reordering.
3410
3411 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3412
3413         * options.h (General_options): Change default to true for new_dtags.
3414
3415 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3416
3417         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
3418         when enable_new_dtags is false.  Only add DT_RUNPATH when
3419         enable_new_dtags is true.
3420
3421 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
3422
3423         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
3424         used in declaration and definition consistent.
3425         (Target_powerpc::symval_for_branch): Ditto.
3426
3427 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3428
3429         * testsuite/plugin_final_layout.cc: Fix comment.
3430
3431 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3432
3433         * layout.cc (Layout::layout): Do not do default sorting for
3434         text sections when section ordering is specified.
3435         (make_output_section): Ditto.
3436         * testsuite/plugin_final_layout.cc: Name the function sections
3437         to catch reordering issues.
3438
3439 2013-01-15  Alan Modra  <amodra@gmail.com>
3440
3441         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
3442         plt-thread-safe.
3443
3444 2013-01-15  Alan Modra  <amodra@gmail.com>
3445
3446         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
3447         * testsuite/Makefile.in: Regenerate.
3448
3449 2013-01-14  Alan Modra  <amodra@gmail.com>
3450
3451         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
3452         * testsuite/Makefile.in: Regenerate.
3453
3454 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
3455
3456         PR bfd/14430
3457         Fix mingw gold build with plugins enabled
3458         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
3459         * configure.ac: Export DLOPEN_LIBS and add headers check.
3460         * plugin.cc: Handle non-dlfcn case.
3461         * Makefile.in: Regenerate.
3462         * config.in: Regenerate.
3463         * configure: Regenerate.
3464         * testsuite/Makefile.in: Regenerate.
3465
3466 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
3467
3468         * output.h (sort_attached_input_sections): Change to be public.
3469         * script-sections.cc
3470         (Output_section_definition::set_section_addresses): Sort
3471         attached input sections according to section order before linker
3472         script assigns section addresses.
3473         (Orphan_output_section::set_section_addresses): Sort
3474         attached input sections according to section order before linker
3475         script assigns section addresses.
3476         * Makefile.am (final_layout.sh): Use a simple linker script to
3477         check if section ordering still works.
3478         * Makefile.in: Regenerate.
3479
3480 2013-01-09  Ben Cheng  <bccheng@google.com>
3481
3482         * arm.cc (Target_arm::attributes_accept_div): New function.
3483         (Target_arm::attributes_forbid_div): New function.
3484         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
3485         attribute using the same new functions as what bfd/elf32_arm.c
3486         does.
3487
3488 2013-01-07  Cary Coutant  <ccoutant@google.com>
3489
3490         PR gold/14993
3491         * output.cc (Output_section::add_input_section): For incremental
3492         updates, don't track input sections that are allocated from patch
3493         space.
3494
3495 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3496             Ian Lance Taylor  <iant@google.com>
3497
3498         PR gold/14897
3499         * configure.ac (--enable-ld): Removed.
3500         (install_as_default): Set to yes only for --enable-gold=default
3501         or --disable-ld.
3502         * configure: Regenerated.
3503
3504 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3505
3506         * options.h (General_options): Add -fuse-ld= for GCC linker
3507         option compatibility.
3508
3509 2013-01-04  Cary Coutant  <ccoutant@google.com>
3510
3511         * configure.ac: Fix typo restoring CXXFLAGS.
3512         * configure: Regenerate.
3513
3514 2013-01-04  Cary Coutant  <ccoutant@google.com>
3515
3516         * testsuite/Makefile.am (CXXLINK_S): New macro.
3517         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
3518         * testsuite/Makefile.in: Regenerate.
3519
3520 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
3521
3522         * version.cc (print_version): Update copyright year to 2013.
3523
3524 2012-12-20  Ian Lance Taylor  <iant@google.com>
3525
3526         * layout.cc (Layout::special_ordering_of_input_section): New
3527         function.
3528         (Layout::layout): If input section requires special ordering, must
3529         sort input sections.
3530         (Layout::make_output_section): May sort .text input sections.
3531         (Layout::is_section_name_prefix_grouped): Remove.
3532         * layout.h (class Layout): Declare
3533         special_ordering_of_input_section.  Don't declare
3534         is_section_name_prefix_grouped.
3535         * output.cc (Output_section::add_input_section): Revert last
3536         change.
3537         (Output_section::Input_section_sort::match_file_name): Don't crash
3538         if called on output section data.
3539         (Output_section::Input_section_sort_compare): Sort based on
3540         special ordering.
3541         (Output_section::Input_section_sort_section_order_index_compare):
3542         Revert last patch.
3543         (Output_section::sort_attached_input_sections): Likewise.
3544
3545 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
3546
3547         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
3548         * layout.h (Layout::is_section_name_prefix_grouped): New function.
3549         * output.cc (Output_section::add_input_section): Check if section
3550         name contains special prefix.  Keep input sections to sort such
3551         sections.
3552         (Output_section::Input_section_sort_section_order_index_compare
3553          ::operator()): Group sections according to prefixes.
3554         (Output_section::sort_attached_input_sections): Add condition to
3555         Input_section_entry constructor call.
3556         * testsuite/Makefile.am (text_section_grouping): New test.
3557         * testsuite/Makefile.in: Regenerate.
3558         * testsuite/text_section_grouping.cc: New file.
3559         * testsuite/text_section_grouping.sh: New file.
3560
3561 2012-12-17  Nick Clifton  <nickc@redhat.com>
3562
3563         * Makefile.am: Add copyright notice.
3564         * NEWS: Likewise.
3565         * README: Likewise.
3566         * configure.ac: Likewise.
3567         * ftruncate.c: Likewise.
3568         * Makefile.in: Regenerate.
3569
3570 2012-12-14  Cary Coutant  <ccoutant@google.com>
3571
3572         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
3573         --no-as-needed flag.
3574         (exception_separate_shared_12_test): Likewise.
3575         (incremental_copy_test): Likewise.
3576         * testsuite/Makefile.in: Regenerate.
3577
3578 2012-12-14  Cary Coutant  <ccoutant@google.com>
3579
3580         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
3581         (Dwp_output_file::Dwp_index::enter_set): Add assert.
3582
3583 2012-12-12  Alan Modra  <amodra@gmail.com>
3584
3585         * powerpc.cc (class Track_tls): New.
3586         (class Relocate, class Scan): Inherit Track_tls.
3587         (Target_powerpc::Scan::local, global): Track tls optimization
3588         and avoid creating plt entry for __tls_get_addr if all uses
3589         are optimized away.
3590         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
3591
3592 2012-12-12  Alan Modra  <amodra@gmail.com>
3593
3594         * options.h (General_options): Add --toc-sort/--no-toc-sort.
3595         Replace no_toc_optimize with toc_optimize.
3596         * output.h (Output_section::input_sections): Provide non-const variant.
3597         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
3598         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
3599         accessors.
3600         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
3601         (class Sort_toc_sections): New.
3602         (Target_powerpc::do_finalize_sections): Sort toc sections.
3603         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
3604
3605 2012-12-10  Roland McGrath  <mcgrathr@google.com>
3606
3607         * testsuite/binary_unittest.cc (read_all): New function.
3608         (Sized_binary_test): Use it instead of ::read.
3609         * fileread.cc (do_read): Don't assume pread always reads the whole
3610         amount in a single call.
3611
3612 2012-12-10  Alan Modra  <amodra@gmail.com>
3613
3614         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
3615         Set EM_PPC64 or EM_PPC here.
3616         (Target_selector_powerpc::do_recognize): Delete.
3617
3618 2012-12-10  Alan Modra  <amodra@gmail.com>
3619
3620         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
3621         stub_table_.
3622         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
3623
3624 2012-12-07  Roland McGrath  <mcgrathr@google.com>
3625
3626         * testsuite/binary_unittest.cc (Sized_binary_test):
3627         Use open_descriptor rather than ::open.
3628
3629 2012-12-07  Alan Modra  <amodra@gmail.com>
3630
3631         * powerpc.cc (Stub_table::do_write): Delete redundant Address
3632         typedef and invalid_address constant.
3633         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
3634         instantiate constants.
3635
3636 2012-12-06  Roland McGrath  <mcgrathr@google.com>
3637
3638         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
3639         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
3640         * aclocal.m4: Regenerate.
3641         * configure: Regenerate.
3642         * Makefile.in: Regenerate.
3643         * testsuite/Makefile.in: Regenerate.
3644
3645 2012-12-07  Alan Modra  <amodra@gmail.com>
3646
3647         * options.h (General_options): Add no_toc_optimize.
3648         * powerpc.cc (ok_lo_toc_insn): New function.
3649         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
3650
3651 2012-12-06  Alan Modra  <amodra@gmail.com>
3652
3653         * options.h (General_options): Add plt_align, plt_static_chain,
3654         plt_thread_safe.  Update stub_group_size help text.
3655         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
3656         for new plt_thread_safe_ var.
3657         (use_plt_offset): Correct comments.
3658         (Target_powerpc::do_relax): Look for thread creation symbols to
3659         determine default plt_thread_safe value.  Clear plt call stubs
3660         as well as branch stubs each iteration.
3661         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
3662         insn constants.
3663         (l, hi, ha, write_insn): Move earlier.
3664         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
3665         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
3666         plt stubs too.
3667         (Stub_table::update_size): Adjust.
3668         (Stub_table::prev_size, set_prev_size): Delete.
3669         (Stub_table::stub_align): Let --plt-align affect result.
3670         (Stub_table::plt_call_size): Calculate sizes for various stubs.
3671         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
3672         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
3673         (Stub_table::do_write): Support more stub variants.
3674
3675 2012-12-04  Alan Modra  <amodra@gmail.com>
3676
3677         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
3678         (Target_powerpc::do_define_standard_symbols): New function.
3679
3680 2012-12-03  Alan Modra  <amodra@gmail.com>
3681
3682         * output.h: Formatting, whitespace.
3683
3684 2012-12-03  Alan Modra  <amodra@gmail.com>
3685
3686         * layout.h (Layout::get_executable_sections): Declare.
3687         * layout.cc (Layout::get_executable_sections): New function.
3688         * arm.cc (Target_arm::group_sections): Use it.
3689         (Arm_output_section::group_sections): Delete now redundant test.
3690         * output.cc (Output_reloc::Output_reloc): Add is_relative.
3691         param to handle relative relocs.
3692         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
3693         (Output_data_reloc::add_absolute): Adjust.
3694         (Output_data_reloc::add_relative): New function.
3695         (Output_data::reset_data_size): New function.
3696         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
3697         (Output_section::set_addralign): New function.
3698         (Output_section::checkpoint_set_addralign): New function.
3699         (Output_section::clear_section_offsets_need_adjustment): New function.
3700         (Output_section::input_sections): Make public.
3701         * powerpc.cc (class Output_data_brlt_powerpc): New.
3702         (class Stub_table, class Stub_control): New.
3703         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
3704         stub_table_, set_stub_table, stub_table): New vectors and accessor
3705         functions.
3706         (Target_powerpc::do_may_relax, do_relax, push_branch,
3707         new_stub_table, stub_tables, brlt_section, group_sections,
3708         add_branch_lookup_table, find_branch_lookup_table,
3709         write_branch_lookup_table, make_brlt_section): New functions.
3710         (Target_powerpc::struct Sort_sections, class Branch_info): New.
3711         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
3712         branch_info_): New vars.
3713         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
3714         make call stubs here.
3715         (Output_data_glink): Remove all call stub handling from this class.
3716         (Target_powerpc::Scan::local, global): Save interesting branch
3717         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
3718         (Target_powerpc::do_finalize_sections): Only make reg save/restore
3719         functions on final link.
3720         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
3721         Handle long branch destinations too.
3722         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
3723         do_plt_address_for_local): Adjust lookup of plt call stubs.
3724
3725 2012-11-30  Alan Modra  <amodra@gmail.com>
3726
3727         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
3728         relocs against protected symbols when building 32-bit shared libs.
3729
3730 2012-11-30  Alan Modra  <amodra@gmail.com>
3731
3732         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
3733         param.  Call got_section() to make .got.  Update all callers
3734         and their callers and so on.
3735
3736 2012-11-30  Alan Modra  <amodra@gmail.com>
3737
3738         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
3739         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
3740         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
3741         value if it already exists.
3742
3743 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
3744
3745         PR gold/14858
3746         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
3747
3748 2012-11-14  Roland McGrath  <mcgrathr@google.com>
3749
3750         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
3751         than bfc instruction for data sandboxing.
3752
3753 2012-11-08  Alan Modra  <amodra@gmail.com>
3754
3755         * po/POTFILES.in: Regenerate.
3756
3757 2012-11-05  Alan Modra  <amodra@gmail.com>
3758
3759         * configure.ac: Apply 2012-09-10 change to config.in here.
3760         * configure: Regenerate.
3761
3762 2012-11-05  Alan Modra  <amodra@gmail.com>
3763
3764         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
3765         (struct Opd_ent): Use "Address" rather than "Offset".
3766         (Output_data_got_powerpc::got_base_offset): Return Valtype.
3767         (Target_powerpc::got_section): Make public.
3768         (Target_powerpc::scan_relocs): Move code setting symbols..
3769         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
3770         Create _SDA_BASE_ only when referenced.
3771
3772 2012-11-02  Roland McGrath  <mcgrathr@google.com>
3773
3774         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
3775         from last change.
3776
3777 2012-11-01  Roland McGrath  <mcgrathr@google.com>
3778
3779         * target.h (Sized_target::relocate_relocs): Use Elf_Off
3780         for offset_in_output_section parameter.
3781         (Sized_target::relocate_special_relocatable): Likewise.
3782         * arm.cc (Target_arm::relocate_relocs): Likewise.
3783         (Target_arm::relocate_special_relocatable): Likewise.
3784         * i386.cc (Target_i386::relocate_relocs): Likewise.
3785         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
3786         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
3787         * target-reloc.h (relocate_relocs): Likewise.
3788         * testsuite/testfile.cc (Target_test): Likewise.
3789         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
3790         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
3791
3792         * system.h: Move inclusion of <clocale> to after <libintl.h> in
3793         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
3794
3795         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
3796         parameter, which is unused in the [!F_SETFD] case.
3797
3798         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
3799         SYMNDX to off_t before comparing it to this->data_size().
3800         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
3801         * incremental.cc (Output_section_incremental_inputs::do_write):
3802         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
3803
3804         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
3805
3806 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
3807
3808         * gold.cc (Target_arm::do_adjust_elf_header): Add the
3809         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
3810         in EABI_VER5.
3811
3812 2012-10-29  Cary Coutant  <ccoutant@google.com>
3813
3814         * dwp.cc (usage): Add file and exit status parameters;
3815         add --help and --version options.
3816         (print_version): New function.
3817         (main): Add --help and --version options.
3818
3819 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3820
3821         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
3822         final_layout_sequence.txt.
3823         * testsuite/Makefile.in: Regenerated.
3824
3825 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3826
3827         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
3828         COMPILE generated by automake.
3829         (LINK1): Likewise.
3830         (CXXCOMPILE1): Likewise.
3831         (CXXLINK1): Likewise.
3832         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
3833         (LINK): Likewise.
3834         (CXXCOMPILE): Likewise.
3835         (CXXLINK): Likewise.
3836         * testsuite/Makefile.in: Regenerated.
3837
3838 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3839
3840         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
3841         on bad fwrite return.
3842
3843 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3844
3845         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
3846         on val.
3847
3848 2012-10-23  Cary Coutant  <ccoutant@google.com>
3849
3850         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
3851         * testsuite/Makefile.in: Regenerate.
3852         * testsuite/dwp_test.h: New source file.
3853         * testsuite/dwp_test_1.cc: New source file.
3854         * testsuite/dwp_test_1.s: New source file.
3855         * testsuite/dwp_test_1.sh: New source file.
3856         * testsuite/dwp_test_1b.cc: New source file.
3857         * testsuite/dwp_test_1b.s: New source file.
3858         * testsuite/dwp_test_2.cc: New source file.
3859         * testsuite/dwp_test_2.s: New source file.
3860         * testsuite/dwp_test_2.sh: New source file.
3861         * testsuite/dwp_test_main.cc: New source file.
3862         * testsuite/dwp_test_main.s: New source file.
3863
3864 2012-10-23  Cary Coutant  <ccoutant@google.com>
3865
3866         * dwp.h: New header file.
3867         * dwp.cc: New source file.
3868         * gold.h: Move shared declarations to system.h.
3869         * system.h: New header file.
3870         * Makefile.am: Add dwp.
3871         * Makefile.in: Regenerate.
3872
3873 2012-10-23  Cary Coutant  <ccoutant@google.com>
3874
3875         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
3876         Dwarf_info_reader::read_from_pointer.
3877         (Dwarf_pubnames_table::read_header): Likewise.
3878         (Dwarf_pubnames_table::next_name): Likewise.
3879         (Dwarf_die::read_attributes): Likewise.
3880         (Dwarf_die::skip_attributes): Likewise.
3881         (Dwarf_info_reader::read_from_pointer): New function template.
3882         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
3883         (Dwarf_pubnames_table): Likewise.
3884         (Dwarf_info_reader::read_from_pointer): New function template.
3885         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
3886         Dwarf_pubnames_table ctor.
3887
3888 2012-10-23  Cary Coutant  <ccoutant@google.com>
3889
3890         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
3891         abbrev_shndx.
3892         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
3893         abbrev_shndx_.
3894         (Dwarf_info_reader::set_abbrev_shndx): New method.
3895         (Dwarf_info_reader::abbrev_shndx_): New data member.
3896
3897 2012-10-23  Cary Coutant  <ccoutant@google.com>
3898
3899         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
3900         from object, not parameters.
3901         (Dwarf_info_reader::parse): Likewise.
3902         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
3903         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
3904         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
3905         methods.
3906
3907 2012-10-23  Cary Coutant  <ccoutant@google.com>
3908
3909         * fileread.cc (Input_file::Input_file): New constructor.
3910         * fileread.h (class Input_file): Add new constructor.
3911
3912 2012-10-18  Alan Modra  <amodra@gmail.com>
3913
3914         PR gold/14727
3915         * object.cc (Relobj::is_section_name_included): Also match
3916         .sdata personality section.
3917
3918 2012-10-18  Alan Modra  <amodra@gmail.com>
3919
3920         * target-reloc.h (class Default_comdat_behavior): New, package up..
3921         (get_comdat_behaviour): ..this.
3922         (relocate_section): Add Relocate_comdat_behavior template arg,
3923         adjust code to suit.
3924         * arm.cc (Target_arm::relocate_section): Adjust to suit.
3925         (Target_arm::scan_reloc_section): Likewise.
3926         * i386.cc (Target_i386::relocate_section): Likewise.
3927         * sparc.cc (Target_sparc::relocate_section): Likewise.
3928         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
3929         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
3930         * powerpc.cc (class Relocate_comdat_behavior): New.
3931         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
3932         gold::relocate_section with new template arg.
3933
3934 2012-10-18  Alan Modra  <amodra@gmail.com>
3935
3936         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
3937         dynamic relocs for GOT_TPREL got entries, without symbol if
3938         resolving locally.
3939         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
3940         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
3941         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
3942
3943 2012-10-17  Alan Modra  <amodra@gmail.com>
3944
3945         PR gold/14726
3946         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
3947
3948 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
3949
3950         * layout.cc (Layout::include_section): Keep sections marked
3951         SHF_EXCLUDE when doing relocatable links.
3952
3953 2012-10-16  Alan Modra  <amodra@gmail.com>
3954
3955         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
3956         (Target_powerpc::do_finalize_sections): Call it.
3957         (Output_data_save_res): New class and supporting functions.
3958         (Target_powerpc::symval_for_branch): Only look up .opd entry for
3959         normal symbols defined in object files.
3960
3961 2012-10-12  Alan Modra  <amodra@gmail.com>
3962
3963         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
3964         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
3965         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
3966         section if scan_opd_relocs not yet called.
3967         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
3968
3969 2012-10-12  Alan Modra  <amodra@gmail.com>
3970
3971         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3972         add_local_ifunc_entry): Revert last change.
3973         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
3974
3975 2012-10-05  Alan Modra  <amodra@gmail.com>
3976
3977         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
3978         do_plt_address_for_global): New functions.
3979         (Output_data_got_powerpc::do_write): Don't segfault when linking
3980         statically.
3981         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3982         add_local_ifunc_entry): Return true on adding entry..
3983         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
3984         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
3985         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
3986         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
3987         set up symbols here.
3988         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
3989         syms here.  Do so even when no .iplt.  Don't segfault when linking
3990         statically.
3991         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
3992         new variants without reloc param.
3993         (Glink_sym_ent::Glink_sym_ent): Likewise.
3994         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
3995         reloc when refs will resolve to plt call stub.
3996         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
3997         R_PPC_PLTREL24 to resolve locally.
3998         (Target_powerpc::Scan::global): Correct ifunc handling.
3999         (Target_powerpc::Relocate::relocate): Correct local sym glink
4000         lookup.  Don't destroy "value" when we have a plt call stub,
4001         and when checking plt call validity.
4002         (Target_powerpc::do_dynsym_value): Simplify.
4003
4004 2012-10-05  Alan Modra  <amodra@gmail.com>
4005
4006         * i386.cc (Output_data_plt_i386::address_for_global,
4007         address_for_local): Add plt offset to returned value.  Adjust uses.
4008         * sparc.cc (Output_data_plt_sparc::address_for_global,
4009         address_for_local): Likewise.
4010         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
4011         address_for_local): Likewise.
4012         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
4013         address_for_local): Likewise.
4014         * target.h (Target::plt_address_for_global, plt_address_for_local):
4015         Update comment.
4016         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
4017         (Output_data_got::Got_entry::write): Nor here.
4018         * output.h: Comment fix.
4019
4020 2012-10-02  Jiong Wang  <jiwang@tilera.com>
4021
4022         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
4023         global_offset_table_ value for larget got.
4024         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
4025
4026 2012-09-29  Alan Modra  <amodra@gmail.com>
4027
4028         * powerpc.cc (Target_powerpc::iplt_): New output section.
4029         (Target_powerpc::iplt_section, make_iplt_section,
4030         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
4031         (Target_powerpc::make_plt_entry): Handle ifunc syms.
4032         Target_powerpc::plt_entry_count): Count iplt entries too.
4033         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
4034         reloc section in constructor.  New params.
4035         (Target_powerpc::make_plt_section): Create reloc section here instead.
4036         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
4037         functions.
4038         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
4039         (Output_data_glink::add_entry, find_entry): New functions to
4040         deal with local syms.
4041         (Glink_sym_ent): Add support for local syms.
4042         (Output_data_glink::do_write): Handle ifunc plt entries.
4043         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4044         (Target_powerpc::Scan::local, global): Handle ifunc syms.
4045         (Target_powerpc::Relocate::relocate): Likewise.
4046         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
4047
4048 2012-09-25  Alan Modra  <amodra@gmail.com>
4049
4050         * object.h (Sized_relobj_file::adjust_local_symbol,
4051         do_adjust_local_symbol): New functions.
4052         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
4053         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
4054         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
4055         and irregular opd entry spacing.
4056         (Powerpc_relobj::do_read_relocs): Add opd size checks.
4057         (Global_symbol_visitor_opd): New functor.
4058         (Target_powerpc::do_finalize_sections): Omit global symbols defined
4059         on deleted opd entries.
4060
4061 2012-09-15  Jiong Wang  <jiwang@tilera.com>
4062
4063         * tilegx.cc: New file.
4064         * Makefile.am (TARGETSOURCES): Add tilegx.cc
4065         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
4066         * configure.tgt: Add entries for tilegx*.
4067         * configure.ac: Likewise.
4068         * Makefile.in: Rebuild.
4069         * configure: Likewise.
4070         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
4071         tilegx.
4072
4073 2012-09-13  Alan Modra  <amodra@gmail.com>
4074
4075         * target-reloc.h (scan_relocs): Call scan.local for relocs
4076         against symbols in discarded sections.  Pass is_discarded
4077         param.
4078         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
4079         Add is_discarded param.
4080         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
4081         is_discarded to flag opd entry as discarded.  Don't emit dyn
4082         relocs on such entries.
4083         (Target_powerpc::Scan::global): Similarly detect and handle
4084         such opd entries.
4085         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
4086         opd_ent_.  Update all uses.
4087         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
4088         (Target_powerpc::relocate_section): Zero out discarded opd
4089         entry relocs.
4090
4091 2012-09-12  Ian Lance Taylor  <iant@google.com>
4092
4093         PR gold/14570
4094         * output.cc: Rename Output_data_got template parameter from size
4095         to got_size for all functions.  Compile all variants of
4096         Output_data_got.
4097         (Output_data_got::Got_entry::write): Correct use of size for
4098         symbol value.  Use local_is_tls rather than casting to
4099         Sized_relobj_file.
4100         * object.h (class Object): Add local_is_tls and do_local_is_tls.
4101         (class Sized_relobj_file): Add do_local_is_tls.
4102         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
4103
4104 2012-09-11  Alan Modra  <amodra@gmail.com>
4105
4106         PR gold/14566
4107         * layout.cc (Layout::set_segment_offsets): When using
4108         common-page-size alignment, ensure we are on a new max-page-size
4109         page.
4110         * output.cc (Output_segment::set_section_addresses): Use
4111         abi_pagesize, not common_pagesize for relro boundary.
4112         (Output_segment::set_offset): Likewise.
4113
4114 2012-09-11  Alan Modra  <amodra@gmail.com>
4115
4116         * output.h (Output_data_got::add_global_tls, add_local_tls,
4117         add_local_tls_pair): New functions.
4118         (Output_data_got::add_local_pair_with_rel): Remove second
4119         reloc param.  Expand comment.
4120         (Output_data_got::Got_entry): Rename use_plt_offset_ to
4121         use_plt_or_tls_offset_, similarly for constructor param.
4122         (Output_data_got::Got_entry::write): Add got_index param.
4123         * output.cc (Output_data_got::add_global_tls, add_local_tls,
4124         add_local_tls_pair): New functions.
4125         (Output_data_got::Got_entry::write): Handle tls symbols
4126         with use_plt_or_tls_offset_ set specially.
4127         (Output_data_got::add_local_pair_with_rel): Only one reloc.
4128         (Output_data_got::do_write): Replace iterator with index, pass
4129         index to entry write function.
4130         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
4131         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
4132         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
4133         call.
4134         * i386.cc (Target_i386::Scan::local): Likewise.
4135         * sparc.cc (Target_sparc::Scan::local): Likewise.
4136         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
4137         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
4138         do_tls_offset_for_global): New functions.
4139         (Target_powerpc::Scan::local): Correct TLS relocations and got
4140         entry values.
4141         (Target_powerpc::Scan::global): Don't emit unnecessary
4142         dynamic relocations on TLS GOT entries.
4143
4144 2012-09-10  Matthias Klose  <doko@ubuntu.com>
4145
4146         * config.in: Disable sanity check for kfreebsd.
4147
4148 2012-09-10  Sterling Augustine  <saugustine@google.com>
4149
4150         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
4151         (Gdb_index::pubtypes_read): New parameter.
4152         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
4153         to calls.
4154         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
4155         pubtypes_object_.
4156
4157 2012-09-09  Alan Modra  <amodra@gmail.com>
4158
4159         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
4160         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
4161         * gc.h (gc_process_relocs): Call target gc_add_reference.
4162         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
4163         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
4164         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
4165         unnecessary cast.
4166         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
4167         to cater for when we don't need code offset.  Update use.
4168         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
4169         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
4170         set_opd_valid): New functions.
4171         (Target_powerpc::do_gc_add_reference): New function.
4172         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
4173         stashed refs.
4174         (Target_powerpc::do_gc_mark_symbol): New function.
4175
4176 2012-09-06  Cary Coutant  <ccoutant@google.com>
4177
4178         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
4179         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
4180         (Dwarf_die::skip_attributes): Likewise.
4181         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
4182         * testsuite/gdb_index_test.cc (inline_func_1): New function.
4183         (main): Call it.
4184         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
4185
4186 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
4187
4188         * testsuite/script_test_3.t: Add .got.plt output section
4189         statement.
4190         * testsuite/script_test_4.t: Likewise.
4191
4192 2012-09-05  Alan Modra  <amodra@gmail.com>
4193
4194         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
4195         update all uses and lose "enum" when using type.
4196
4197 2012-09-05  Alan Modra  <amodra@gmail.com>
4198
4199         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
4200         * configure: Regenerate.
4201         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
4202         (plugin_final_layout.stdout): Likewise.
4203         (memory_test): Set page sizes to 0x1000.
4204         * testsuite/Makefile.in: Regenerate.
4205         * testsuite/discard_locals_test.sh: Add FIXME comment.
4206         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
4207         * testsuite/pr14265.t: Add .got output section statement.
4208         * testsuite/script_test_2.t: Likewise.
4209         * testsuite/script_test_3.t: Likewise.
4210         * testsuite/script_test_4.t: Likewise.
4211         * testsuite/script_test_5.t: Likewise.
4212         * testsuite/script_test_6.t: Likewise.
4213         * testsuite/script_test_7.t: Likewise.
4214         * testsuite/script_test_9.t: Likewise.
4215
4216 2012-09-05  Alan Modra  <amodra@gmail.com>
4217
4218         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
4219         (Powerpc_relocate_functions::Status): New typedef.
4220         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4221         (Target_powerpc::Scan::local): Handle REL64.
4222         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
4223         for REL32 and REL64.
4224         (Target_powerpc::symval_for_branch): New function, extracted from..
4225         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
4226         checks.  Report overflow errors.
4227
4228 2012-09-05  Alan Modra  <amodra@gmail.com>
4229
4230         * object.h (Sized_relobj_file::emit_relocs): Delete.
4231         (Sized_relobj_file::emit_relocs_reltype): Delete.
4232         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
4233         relocate_relocs for --emit-relocs.
4234         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
4235         * output.h: Update comment.
4236         (Output_segment::first_section): New function.
4237         (Output_segment::first_section_load_address): Use first_section.
4238         * output.cc (Output_segment::first_section): New function extracted..
4239         (Output_segment::first_section_load_address): ..from here.  Delete.
4240         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
4241         * target.h (Sized_target::relocate_for_relocatable): Likewise.
4242         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
4243         adjust call to target.h function.
4244         * i386.cc (Target_i386): Likewise.
4245         * sparc.cc (Target_sparc): Likewise.
4246         * x86_64.cc (Target_x86_64): Likewise.
4247         * powerpc.cc (Target_powerpc): Likewise.
4248         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
4249         first tls section has section symbol for optimised local dynamic
4250         output relocs.
4251         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
4252         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
4253         optimised tls code.
4254         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
4255         Rename to relocate_relocs.  Update error message.
4256
4257 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
4258
4259         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
4260         --just-symbols.
4261
4262 2012-08-31  Alan Modra  <amodra@gmail.com>
4263
4264         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
4265         (Powerpc_relobj::toc_base_offset): New stub function.
4266         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
4267         got_mod_index_offset to tlsld_got_offset.  Update all refs.
4268         (Target_powerpc::Relocate::enum skip_tls): New.
4269         (Target_powerpc::call_tls_get_addr_): New var.
4270         (Target_powerpc::is_branch_reloc): Move to file scope.
4271         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
4272         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
4273         New functions.
4274         (Target_powerpc::enum Got_type): Delete old values, add new ones.
4275         (powerpc_info): Correct common_pagesize for ppc64.
4276         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
4277         (Powerpc_relocate_functions): Add overflow check enums and functions.
4278         Add non-shift version of rela, rela_ua.  Delete all rel public
4279         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
4280         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
4281         addr16_ha3, addr14 functions.
4282         (Output_data_got_powerpc::add_constant_pair): New function.
4283         (Output_data_got_powerpc::got_base_offset): Likewise.
4284         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
4285         (instruction constants): Sort, add some more.
4286         (Output_data_glink::do_write): Add and use Address typedef.  Use
4287         object->toc_base_offset() stub for 64-bit.
4288         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
4289         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4290         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
4291         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
4292         Always treat .opd relocs as against locally defined symbol.
4293         Correct condition for RELATIVE relocs.
4294         (Target_powerpc::do_finalize_sections): Test for NULL sections.
4295         (Target_powerpc::Relocate::relocate): Use plt call stub as value
4296         for 32-bit syms with a plt entry.  Correct ppc64 toc base
4297         calculations.  Handle TLS relocs, and more.  Add overflow
4298         checking and adjust for Powerpc_relocate_functions changes.
4299         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
4300         Reinstate --emit-relocs code with FIXME.
4301
4302 2012-08-30  Alan Modra  <amodra@gmail.com>
4303
4304         * layout.cc (Layout::set_segment_offsets): Set p_align to
4305         abi_pagesize, not common_pagesize.
4306         (Layout::relaxation_loop_body): Similarly use abi_pagesize
4307         to determine whether file header can go in segment.
4308
4309 2012-08-30  Alan Modra  <amodra@gmail.com>
4310
4311         * output.h (Output_reloc::Output_reloc <output section>): Add
4312         is_relative param.  Adjust calls.
4313         (Output_reloc::add_output_section_relative): New functions.
4314         * output.cc (Output_reloc::Output_reloc <output section>): Handle
4315         is_relative.
4316         (Output_reloc::symbol_value): Handle SECTION_CODE.
4317
4318 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
4319
4320         * gold.cc (queue_middle_tasks): Call layout again when unique
4321         segments for sections is desired.
4322         * layout.cc (Layout::Layout): Initialize new members.
4323         (Layout::get_output_section_flags): New function.
4324         (Layout::choose_output_section): Call get_output_section_flags.
4325         (Layout::layout): Make output section for mapping to a unique segment.
4326         (Layout::insert_section_segment_map): New function.
4327         (Layout::attach_allocated_section_to_segment): Make unique segment for
4328         output sections marked so.
4329         (Layout::segment_precedes): Check for unique segments when sorting.
4330         * layout.h (Layout::Unique_segment_info): New struct.
4331         (Layout::Section_segment_map): New typedef.
4332         (Layout::insert_section_segment_map): New function.
4333         (Layout::get_output_section_flags): New function.
4334         (Layout::is_unique_segment_for_sections_specified): New function.
4335         (Layout::set_unique_segment_for_sections_specified): New function.
4336         (Layout::unique_segment_for_sections_specified_): New member.
4337         (Layout::section_segment_map_): New member.
4338         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
4339         Rename is_gc_pass_one to is_pass_one.
4340         Rename is_gc_pass_two to is_pass_two.
4341         Rename is_gc_or_icf to is_two_pass.
4342         Check for which pass based on whether symbols data is present.
4343         Make it two pass when unique segments for sections is desired.
4344         * output.cc (Output_section::Output_section): Initialize new
4345         members.
4346         * output.h (Output_section::is_unique_segment): New function.
4347         (Output_section::set_is_unique_segment): New function.
4348         (Output_section::is_unique_segment_): New member.
4349         (Output_section::extra_segment_flags): New function.
4350         (Output_section::set_extra_segment_flags): New function.
4351         (Output_section::extra_segment_flags_): New member.
4352         (Output_section::segment_alignment): New function.
4353         (Output_section::set_segment_alignment): New function.
4354         (Output_section::segment_alignment_): New member.
4355         (Output_segment::Output_segment): Initialize is_unique_segment_.
4356         (Output_segment::is_unique_segment): New function.
4357         (Output_segment::set_is_unique_segment): New function.
4358         (Output_segment::is_unique_segment_): New member.
4359         * plugin.cc (allow_unique_segment_for_sections): New function.
4360         (unique_segment_for_sections): New function.
4361         (Plugin::load): Add new functions to transfer vector.
4362         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
4363         * Makefile.in: Regenerate.
4364         * testsuite/plugin_final_layout.sh: Check if unique segment
4365         functionality works.
4366         * testsuite/plugin_section_order.c (onload): Check if new interfaces
4367         are available.
4368         (allow_unique_segment_for_sections): New global.
4369         (unique_segment_for_sections): New global.
4370         (claim_file_hook): Call allow_unique_segment_for_sections.
4371         (all_symbols_read_hook): Call unique_segment_for_sections.
4372
4373 2012-08-22  Cary Coutant  <ccoutant@google.com>
4374
4375         * layout.cc (Layout::include_section): Don't assert on GROUP
4376         sections with --emit-relocs.
4377
4378 2012-08-21  Cary Coutant  <ccoutant@google.com>
4379
4380         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
4381         if --export-dynamic-symbol names an undef symbol.
4382
4383 2012-08-18  Alan Modra  <amodra@gmail.com>
4384
4385         * powerpc.cc: Formatting and white space.
4386         (Powerpc_relobj): Rename got2_section_ to special_.
4387         Add opd_ent_shndx_ and opd_ent_off_ vectors.
4388         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
4389         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
4390         (Target_powerpc): Add Address typedef and invalid_address.  Use
4391         throughout.
4392         (Target_powerpc::is_branch_reloc): New function.
4393         (Powerpc_relocate_functions): Add Address typedef, use throughout.
4394         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
4395         for dst_mask, value and addend.
4396         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
4397         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
4398         (Output_data_glink::do_write): Correct toc base.  Don't try to use
4399         uint16_t for 24-bit offset.  Use get_output_section_offset and
4400         check return.
4401         (Target_powerpc::Scan::local): Handle more relocs.
4402         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
4403         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
4404         Plug in toc restoring insn after plt calls.  Translate branches
4405         to function descriptor symbols to corresponding entry point.
4406         (Target_powerpc::relocate_for_relocatable): Check return from
4407         get_output_section_offset.
4408         * symtab.h: Comment typo.
4409
4410 2012-08-14  Ian Lance Taylor  <iant@google.com>
4411
4412         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
4413         unsupported_relocal_local to call unsupported_reloc_global.
4414
4415 2012-08-14  Nick Clifton  <nickc@redhat.com>
4416
4417         PR ld/14265
4418         * script-sections.cc (Sections_element::output_section_name): Add
4419         keep return parameter.
4420         (Output_section_element::match_name): Add keep return parameter.
4421         Return the value of the keep_ member.
4422         * script-sections.h (class Output_section): Update
4423         output_section_name prototype.
4424         * layout.cc (Layout::keep_input_section): New public member
4425         function.
4426         (Layout::choose_output_section): Pass keep parameter to
4427         output_section_name.
4428         * layout.h (class Layout): Add keep_input_section.
4429         * object.cc (Sized_relobj_file::do_layout): Check for kept input
4430         sections.
4431         * testsuite/Makefile.am: Add a test.
4432         * testsuite/Makefile.in: Regenerate.
4433         * testsuite/pr14265.c: Source file for the test.
4434         * testsuite/pr14265.t: Linker script for the test.
4435         * testsuite/pr14265.sh: Shell script for the test.
4436
4437 2012-08-14  Alan Modra  <amodra@gmail.com>
4438
4439         * target.h (Target::output_section_name): New function.
4440         (Target::do_output_section_name): New function.
4441         * layout.cc (Layout::choose_output_section): Call the above.
4442         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
4443
4444 2012-08-14  Alan Modra  <amodra@gmail.com>
4445
4446         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
4447         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
4448         for replace_constant call.
4449         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
4450         (Output_data_glink::do_print_to_mapfile): New function.
4451         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
4452         (Target_powerpc::Relocate::relocate): Likewise.
4453
4454 2012-08-14  Alan Modra  <amodra@gmail.com>
4455
4456         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
4457         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
4458         (Output_data_glink::add_entry,find_entry): Remove shndx param.
4459         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
4460         all references to shndx_.  Handle special case for R_PPC_PLTREL24
4461         here.
4462         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
4463         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
4464         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
4465         here.
4466         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
4467         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
4468
4469 2012-08-12  Alan Modra  <amodra@gmail.com>
4470
4471         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
4472         (glink insn constants): Use uint32_t.
4473         (Output_data_glink::add_entry): Use insert, not [] operator.
4474
4475 2012-08-11  Alan Modra  <amodra@gmail.com>
4476
4477         * object.h (Sized_relobj_file::find_shdr): New function.
4478         (Sized_relobj_file::find_special_sections): New function.
4479         * object.cc (Sized_relobj_file::find_shdr): New function.
4480         (Sized_relobj_file::find_eh_frame): Use find_shdr.
4481         (Sized_relobj_file::find_special_sections): New function, split out..
4482         (Sized_relobj_file::do_read_symbols): ..from here.
4483         * output.h (Output_data_got::replace_constant): New function.
4484         (Output_data_got::num_entries): New function.
4485         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
4486         (Output_data_got::got_offset): Protected rather than private.
4487         (Output_data_got::replace_got_entry): New function.
4488         * output.cc (Output_data_got::replace_got_entry): New function.
4489         * powerpc.cc (class Powerpc_relobj): New.
4490         (class Powerpc_relocate_functions): Delete all psymval variants or
4491         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
4492         Implement _ha functions using corresponding _hi function.
4493         (Powerpc_relobj::find_special_sections): New function.
4494         (Target_powerpc::do_make_elf_object): New function.
4495         (class Output_data_got_powerpc): New.
4496         (class Output_data_glink): New.
4497         (class Powerpc_scan_relocatable_reloc): New.
4498         Many more changes througout file.
4499
4500 2012-08-09  Nick Clifton  <nickc@redhat.com>
4501
4502         * po/vi.po: Updated Vietnamese translation.
4503
4504 2012-08-07  Ian Lance Taylor  <iant@google.com>
4505
4506         * layout.cc (Layout::add_target_dynamic_tags): If
4507         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
4508         plt_rel.
4509
4510 2012-07-30  Nick Clifton  <nickc@redhat.com>
4511
4512         * po/gold.pot: Updated template.
4513         * po/es.po: Updated Spanish translation.
4514
4515 2012-07-18  Cary Coutant  <ccoutant@google.com>
4516
4517         PR gold/14344
4518         * configure.ac: Add check for -gpubnames support.
4519         * configure: Regenerate.
4520         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
4521         support; force -gno-pubnames.
4522         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
4523         support.
4524         (gdb_index_test_4): New test.
4525         * testsuite/Makefile.in: Regenerate.
4526         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
4527         * testsuite/gdb_index_test_2.sh: Likewise.
4528         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
4529         * testsuite/gdb_index_test_4.sh: New script.
4530         * testsuite/gdb_index_test_comm.sh: New script with common code;
4531         don't look for space after colon.
4532
4533 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
4534
4535         * gold.cc (queue_middle_tasks): Update function order only after
4536         deferred objects due to plugins are processed.
4537
4538 2012-07-11  Ian Lance Taylor  <iant@google.com>
4539
4540         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
4541         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
4542         (Target_arm::scan_reloc_for_stub): Likewise.
4543         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
4544         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
4545         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
4546         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
4547         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
4548
4549 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
4550             Ian Lance Taylor  <iant@google.com>
4551
4552         PR gold/14309
4553         * configure.ac: Test whether std::tr1::hash<off_t> works.
4554         * gold.h: Add a specialization for std::tr1::hash<off_t> if
4555         needed.
4556         * output.h (class Output_fill): Add virtual destructor.
4557         * configure, config.in: Rebuild.
4558
4559 2012-06-22  Roland McGrath  <mcgrathr@google.com>
4560
4561         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
4562
4563 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
4564
4565         * plugin.cc (Plugin::load): Handle position independent executables.
4566
4567 2012-06-06  Cary Coutant  <ccoutant@google.com>
4568
4569         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
4570         add .debug_macro.
4571         (lines_only_debug_sections): Likewise.
4572         (gdb_fast_lookup_sections): New static array.
4573         (is_gdb_debug_section): Rename formal parameter.
4574         (is_lines_only_debug_section): Likewise.
4575         (is_gdb_fast_lookup_section): New function.
4576         (Layout::include_section): Check for ".zdebug_" prefix; pass
4577         section name suffix to is_gdb_debug_section, et al.; check for
4578         fast-lookup sections when building .gdb_index.
4579         * options.h (--strip-debug-gdb): Update GDB version number.
4580
4581 2012-06-06  Cary Coutant  <ccoutant@google.com>
4582
4583         * configure.ac: Add check for fallocate.
4584         * configure: Regenerate.
4585         * config.in: Regenerate.
4586
4587         * options.h (class General_options): Add --mmap-output-file and
4588         --posix-fallocate options.
4589         * output.cc: (posix_fallocate): Remove; replace with...
4590         (gold_fallocate): New function.
4591         (Output_file::map_no_anonymous): Call gold_fallocate.
4592         (Output_file::map): Check --mmap-output-file option.
4593
4594 2012-06-05  Jing Yu  <jingyu@google.com>
4595
4596         * gold.h (textdomain): Add do {} to empty while(0).
4597         (bindtextdomain): Likewise.
4598
4599 2012-06-04  Cary Coutant  <ccoutant@google.com>
4600
4601         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
4602         has_dynsym_index.
4603
4604 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
4605
4606         * symtab.cc (Symbol_table::define_special_symbol):
4607         Initialize *poldsym to prevent uninitialized variable errors.
4608
4609 2012-05-23  Cary Coutant  <ccoutant@google.com>
4610
4611         * layout.cc (Layout::section_name_mapping): Add rules to handle
4612         exact match on .data.rel.ro.local or .data.rel.ro.
4613         (Layout::output_section_name): Check for exact matches.
4614
4615 2012-05-23  Cary Coutant  <ccoutant@google.com>
4616
4617         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
4618         more carefully.
4619
4620 2012-05-22  Cary Coutant  <ccoutant@google.com>
4621
4622         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
4623         object before exporting symbol.
4624
4625 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
4626
4627         * testsuite/tls_test.cc: Include "config.h" first.
4628         * testsuite/tls_test_c.c: Likewise.
4629
4630 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
4631             Nick Clifton  <nickc@redhat.com>
4632
4633         PR 14072
4634         * configure.in: Add check that sysdep.h has been included before
4635         any system header files.
4636         * configure: Regenerate.
4637         * config.in: Regenerate.
4638
4639 2012-05-14  Cary Coutant  <ccoutant@google.com>
4640
4641         * layout.cc (Layout::make_output_section): Mark .tdata section
4642         as RELRO.
4643         * testsuite/relro_test.cc: Add a TLS variable.
4644
4645 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
4646
4647         PR gold/14091
4648         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
4649         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
4650         R_X86_64_64.
4651
4652 2012-05-08  Cary Coutant  <ccoutant@google.com>
4653
4654         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
4655         (lines_only_debug_sections): Likewise.
4656
4657 2012-05-02  Roland McGrath  <mcgrathr@google.com>
4658
4659         * nacl.cc: New file.
4660         * nacl.h: New file.
4661         * Makefile.am (CCFILES, HFILES): Add them.
4662         * Makefile.in: Regenerate.
4663         * i386.cc (Output_data_plt_i386_nacl): New class.
4664         (Output_data_plt_i386_nacl_exec): New class.
4665         (Output_data_plt_i386_nacl_dyn): New class.
4666         (Target_i386_nacl): New class.
4667         (Target_selector_i386_nacl): New class.
4668         (target_selector_i386): Use it instead of Target_selector_i386.
4669         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
4670         (Target_x86_64_nacl): New class.
4671         (Target_selector_x86_64_nacl): New class.
4672         (target_selector_x86_64, target_selector_x32): Use it instead of
4673         Target_selector_x86_64.
4674         * arm.cc (Output_data_plt_arm_nacl): New class.
4675         (Target_arm_nacl): New class.
4676         (Target_selector_arm_nacl): New class.
4677         (target_selector_arm, target_selector_armbe): Use it instead of
4678         Target_selector_arm.
4679
4680         * target-select.cc (select_target): Take new Input_file* and off_t
4681         arguments, pass them on to recognize method of selector.
4682         * object.cc (make_elf_sized_object): Update caller.
4683         * parameters.cc (parameters_force_valid_target): Likewise.
4684         * incremental.cc (make_sized_incremental_binary): Likewise.
4685         * target-select.h: Update decl.
4686         (Target_selector::recognize): Take new Input_file* argument,
4687         pass it on to do_recognize.
4688         (Target_selector::do_recognize): Take new Input_file* argument.
4689         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
4690         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
4691         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
4692         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
4693
4694         * target.h (Target::Target_info): New members isolate_execinstr
4695         and rosegment_gap.
4696         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
4697         * arm.cc (Target_arm::arm_info): Update initializer.
4698         * i386.cc (Target_i386::i386_info): Likewise.
4699         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
4700         * sparc.cc (Target_sparc::sparc_info): Likewise.
4701         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4702         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
4703         * layout.cc (Layout::attach_allocated_section_to_segment):
4704         Take new const Target* argument.  If target->isolate_execinstr(), act
4705         like --rosegment.
4706         (Layout::find_first_load_seg): Take new const Target* argument;
4707         if target->isolate_execinstr(), reject PF_X segments.
4708         (Layout::relaxation_loop_body): Update caller.
4709         (Layout::set_segment_offsets): If target->isolate_execinstr(),
4710         reset file offset to zero when we hit LOAD_SEG, and then do a second
4711         loop over the segments before LOAD_SEG to reassign offsets after
4712         addresses have been determined.  Handle target->rosegment_gap().
4713         (Layout::attach_section_to_segment): Take new const Target* argument;
4714         pass it to attach_allocated_section_to_segment.
4715         (Layout::make_output_section): Update caller.
4716         (Layout::attach_sections_to_segments): Take new const Target* argument;
4717         pass it to attach_section_to_segment.
4718         * gold.cc (queue_middle_tasks): Update caller.
4719         * layout.h (Layout): Update method decls with new arguments.
4720
4721         * arm.cc (Target_arm::Target_arm): Take optional argument for the
4722         Target_info pointer to use.
4723         (Target_arm::do_make_data_plt): New virtual method.
4724         (Target_arm::make_data_plt): New method that calls it.
4725         (Target_arm::make_plt_entry): Use it.
4726         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
4727         for the section alignment.
4728         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
4729         method.
4730         (Output_data_plt_arm::first_plt_entry_offset): Call it.
4731         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
4732         method.
4733         (Output_data_plt_arm::get_plt_entry_size): Call it.
4734         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
4735         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
4736         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
4737         method.
4738         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
4739         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
4740         method instead of sizeof(plt_entry).
4741         (Output_data_plt_arm::add_entry): Likewise.
4742         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
4743         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
4744         than static method.
4745         (Target_arm::plt_entry_size): Likewise.
4746         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
4747         Move to ...
4748         (Output_data_plt_arm_standard): ... here, new class.
4749         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
4750         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
4751         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
4752
4753         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4754         Take additional argument for the PLT entry size.
4755         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
4756         Use get_plt_entry_size method rather than plt_entry_size variable.
4757         (Output_data_plt_x86_64::reserve_slot): Likewise.
4758         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
4759         (Output_data_plt_x86_64::add_entry): Likewise.
4760         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
4761         (Output_data_plt_x86_64::address_for_global): Likewise.
4762         (Output_data_plt_x86_64::address_for_local): Likewise.
4763         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4764         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
4765         Make method non-static.
4766         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
4767         method.
4768         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
4769         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
4770         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
4771         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
4772         virtual method.
4773         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
4774         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
4775         virtual method.
4776         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
4777         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
4778         virtual method.
4779         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
4780         (Output_data_plt_x86_64::plt_entry_size)
4781         (Output_data_plt_x86_64::first_plt_entry)
4782         (Output_data_plt_x86_64::plt_entry)
4783         (Output_data_plt_x86_64::tlsdesc_plt_entry)
4784         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
4785         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
4786         (Output_data_plt_x86_64_standard): ... here, new class.
4787         (Target_x86_64::Target_x86_64): Take optional argument for the
4788         Target_info pointer to use.
4789         (Target_x86_64::do_make_data_plt): New virtual method.
4790         (Target_x86_64::make_data_plt): New method to call it.
4791         (Target_x86_64::init_got_plt_for_update): Use that.
4792         Call this->plt_->add_eh_frame method here.
4793         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
4794         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
4795         rather than static method.
4796         (Target_x86_64::plt_entry_size): Likewise.
4797         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
4798         rather than plt_entry_size variable.  Move guts of PLT filling to...
4799         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
4800         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
4801         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
4802
4803         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
4804         additional argument for the section alignment.
4805         Don't do add_eh_frame_for_plt here.
4806         (Output_data_plt_i386::first_plt_entry_offset): Make the method
4807         non-static.  Use get_plt_entry_size method rather than plt_entry_size
4808         variable.
4809         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
4810         method.
4811         (Output_data_plt_i386::get_plt_entry_size): Call it.
4812         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
4813         (Output_data_plt_i386::add_eh_frame): New method to call it.
4814         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
4815         method.
4816         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
4817         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
4818         method.
4819         (Output_data_plt_i386::fill_plt_entry): New method to call it.
4820         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
4821         method instead of plt_entry_size.
4822         (Output_data_plt_i386::plt_entry_size)
4823         (Output_data_plt_i386::plt_eh_frame_fde_size)
4824         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
4825         (Output_data_plt_i386_standard): ... here, new class.
4826         (Output_data_plt_i386_exec): New class.
4827         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
4828         (Output_data_plt_i386_exec::first_plt_entry): ... here.
4829         (Output_data_plt_i386::exec_plt_entry): Move to ...
4830         (Output_data_plt_i386_exec::plt_entry): ... here.
4831         (Output_data_plt_i386_dyn): New class.
4832         (Output_data_plt_i386::first_plt_entry): Move to ...
4833         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
4834         (Output_data_plt_i386::dyn_plt_entry): Move to ...
4835         (Output_data_plt_i386_dyn::plt_entry): ... here.
4836         (Target_i386::Target_i386): Take optional argument for the Target_info
4837         pointer to use.
4838         (Target_i386::do_make_data_plt): New virtual method.
4839         (Target_i386::make_data_plt): New method to call it.
4840         (Target_i386::make_plt_section): Use that.
4841         Call this->plt_->add_eh_frame method here.
4842         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
4843         rather than plt_entry_size variable.
4844         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
4845         (Output_data_plt_i386::address_for_local): Likewise.
4846         (Output_data_plt_i386::do_write): Likewise.
4847         Move guts of PLT filling to...
4848         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
4849         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
4850         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
4851         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
4852
4853 2012-05-01  Cary Coutant  <ccoutant@google.com>
4854
4855         * dwarf_reader.cc (Dwarf_die::read_attributes)
4856         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
4857         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
4858         * reduced_debug_output.cc
4859         (Output_reduced_debug_info_section::get_die_end): Remove
4860         DW_FORM_GNU_ref_index.  Add default case.
4861
4862 2012-04-26  Mark Wielaard  <mjw@redhat.com>
4863
4864         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
4865         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
4866         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
4867         DW_AT_high_pc as offset from DW_AT_low_pc.
4868
4869         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
4870         * testsuite/Makefile.in: Regenerate.
4871         * testsuite/gdb_index_test_3.c: New test source file.
4872         * testsuite/gdb_index_test_3.sh: New test source file.
4873
4874 2012-04-25  Ian Lance Taylor  <iant@google.com>
4875
4876         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
4877         pointer.
4878         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
4879         as a class, not a struct.
4880         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
4881         (Target_arm::apply_cortex_a8_workaround): Likewise.
4882         * gc.h: Declare Reloc_types as a struct, not a class.
4883         * object.h: Declare Symbols_data as a struct.
4884         * reloc.h: Declare Read_relocs_data as a struct.
4885         * target.h: Declare Relocate_info as a struct.
4886
4887 2012-04-24  David S. Miller  <davem@davemloft.net>
4888
4889         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
4890         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
4891         and R_SPARC_WPLT30.
4892
4893 2012-04-24  Cary Coutant  <ccoutant@google.com>
4894
4895         * incremental-dump.cc (find_input_containing_global): Replace
4896         magic number with symbolic constant.
4897         (dump_incremental_inputs): Update version number.
4898         * incremental.cc (Output_section_incremental_inputs): Update version
4899         number; import symbolic constants from Incremental_inputs_reader.
4900         (Incremental_inputs::create_data_sections): Align relocations
4901         section correctly for 64-bit targets.
4902         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
4903         constants; add padding.
4904         (Output_section_incremental_inputs::write_header): Add assert for
4905         header_size.
4906         (Output_section_incremental_inputs::write_input_files): Add assert
4907         for input_entry_size.
4908         (Output_section_incremental_inputs::write_info_blocks): Add padding;
4909         add assert for object_info_size, input_section_entry_size,
4910         global_sym_entry_size.
4911         * incremental.h (Incremental_inputs_reader): Add symbolic constants
4912         for data structure sizes; use them.
4913         (Incremental_input_entry_reader): Import symbolic constants from
4914         Incremental_inputs_reader; use them.
4915
4916 2012-04-23  David S. Miller  <davem@davemloft.net>
4917
4918         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
4919         and elf_flags_set_.
4920         (Target_sparc::Target_sparc): Initialize new fields.
4921         (Target_sparc::do_make_elf_object): New function.
4922         (Target_sparc::do_adjust_elf_header): New function.
4923
4924 2012-04-23  Cary Coutant  <ccoutant@google.com>
4925
4926         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
4927         CU range table of gdb index.
4928
4929 2012-04-20  David S. Miller  <davem@davemloft.net>
4930
4931         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
4932         instead of false.
4933
4934 2012-04-16  David S. Miller  <davem@davemloft.net>
4935
4936         * sparc.cc (Target_sparc::got_address): New function.
4937         (Sparc_relocate_functions::gdop_hix22): New function.
4938         (Sparc_relocate_functions::gdop_lox10): New function.
4939         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
4940         relocs.
4941         (Target_sparc::Scan::local): Likewise if the global symbol is not
4942         preemptible and is not IFUNC.
4943         (Target_sparc::Relocate::relocate): Perform GOTDATA code
4944         transformations for local and non-preemptible non-IFUNC global
4945         symbols.
4946
4947         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
4948         writing out 64-bit part of ranges.
4949
4950         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
4951         -fpic and -fpie respectively.
4952         * Makefile.in: Regenerate.
4953
4954         * sparc.cc (class Target_sparc): Add rela_ifunc_.
4955         (Target_sparc::Target_sparc): Initialize new field.
4956         (Target_sparc::do_plt_section_for_global): New function.
4957         (Target_sparc::do_plt_section_for_local): New function.
4958         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
4959         (Target_sparc::make_plt_section): New function, broken out of
4960         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
4961         (Target_sparc::make_plt_entry): Call make_plt_section.
4962         (Target_sparc::make_local_ifunc_plt_entry): New function.
4963         (Target_sparc::rela_ifunc_section): New function.
4964         (Target_sparc::plt_section): Remove const.
4965         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
4966         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
4967         and ifunc_count_ fields.
4968         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
4969         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
4970         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
4971         (Output_data_plt_sparc::rela_ifunc): New function.
4972         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
4973         (Output_data_plt_sparc::has_ifunc_section): New function.
4974         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
4975         (Output_data_plt_sparc::address_for_global): New function.
4976         (Output_data_plt_sparc::address_for_local): New function.
4977         (Output_data_plt_sparc::plt_index_to_offset): New function.
4978         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
4979         and entry_count.
4980         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
4981         entry_count.
4982         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
4983         R_SPARC_JMP_IREL to switch.
4984         (Target_sparc::Scan::check_non_pic): Likewise.
4985         (Target_sparc::Scan::local): Handle IFUNC symbols.
4986         (Target_sparc::Scan::local): Likewise.
4987         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
4988         and plt_address_for_local.
4989         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
4990         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
4991
4992         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
4993         (class Output_data_reloc): Adjust calls to Output_reloc_type.
4994         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
4995         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
4996         global relocs too.
4997         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
4998         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
4999         calls.
5000         * sparc.cc (Target_sparc::Scan::global): Likewise.
5001         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5002
5003 2012-04-16  Cary Coutant  <ccoutant@google.com>
5004
5005         * archive.cc (Library_base::should_include_member): Check for
5006         --export-dynamic-symbol.
5007         * options.h (class General_options): Add --export-dynamic-symbol.
5008         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
5009         --export-dynamic-symbol.
5010         (Symbol_table::gc_mark_undef_symbols): Likewise.
5011         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
5012
5013 2012-04-12  David S. Miller  <davem@davemloft.net>
5014
5015         * sparc.cc (Reloc::wdisp10): New relocation method.
5016         (Reloc::h34): Likewise.
5017         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
5018         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
5019         R_SPARC_WDISP10.
5020         (Target_sparc::Scan::local): Likewise.
5021         (Target_sparc::Scan::global): Likewise.
5022         (Target_sparc::Relocate::relocate): Likewise.
5023
5024 2012-04-09  Cary Coutant  <ccoutant@google.com>
5025
5026         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
5027         low_pc == 0.
5028
5029 2012-04-06  Ian Lance Taylor  <iant@google.com>
5030
5031         * timer.cc: #include <unistd.h>.
5032
5033 2012-04-06  Roland McGrath  <mcgrathr@google.com>
5034
5035         * configure.in (AC_CHECK_HEADERS): Add locale.h.
5036         * config.in: Regenerate.
5037         * configure: Regenerate.
5038
5039 2012-04-05  Nick Clifton  <nickc@redhat.com>
5040
5041         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
5042         (AM_LC_MESSAGES): Add.
5043         * aclocal.m4: Regenerate.
5044         * config.in: Regenerate.
5045         * configure: Regenerate.
5046
5047 2012-03-21  Cary Coutant  <ccoutant@google.com>
5048
5049         * Makefile.am: Add gdb-index.cc, gdb-index.h.
5050         * Makefile.in: Regenerate.
5051         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
5052         (Sized_elf_reloc_mapper::symbol_section): New function.
5053         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
5054         (make_elf_reloc_mapper): New function.
5055         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
5056         (Dwarf_abbrev_table::do_read_abbrevs): New function.
5057         (Dwarf_abbrev_table::do_get_abbrev): New function.
5058         (Dwarf_ranges_table::read_ranges_table): New function.
5059         (Dwarf_ranges_table::read_range_list): New function.
5060         (Dwarf_pubnames_table::read_section): New function.
5061         (Dwarf_pubnames_table::read_header): New function.
5062         (Dwarf_pubnames_table::next_name): New function.
5063         (Dwarf_die::Dwarf_die): New function.
5064         (Dwarf_die::read_attributes): New function.
5065         (Dwarf_die::skip_attributes): New function.
5066         (Dwarf_die::set_name): New function.
5067         (Dwarf_die::set_linkage_name): New function.
5068         (Dwarf_die::attribute): New function.
5069         (Dwarf_die::string_attribute): New function.
5070         (Dwarf_die::int_attribute): New function.
5071         (Dwarf_die::uint_attribute): New function.
5072         (Dwarf_die::ref_attribute): New function.
5073         (Dwarf_die::child_offset): New function.
5074         (Dwarf_die::sibling_offset): New function.
5075         (Dwarf_info_reader::check_buffer): New function.
5076         (Dwarf_info_reader::parse): New function.
5077         (Dwarf_info_reader::do_parse): New function.
5078         (Dwarf_info_reader::do_read_string_table): New function.
5079         (Dwarf_info_reader::lookup_reloc): New function.
5080         (Dwarf_info_reader::get_string): New function.
5081         (Dwarf_info_reader::visit_compilation_unit): New function.
5082         (Dwarf_info_reader::visit_type_unit): New function.
5083         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
5084         Sized_elf_reloc_mapper.
5085         (Sized_dwarf_line_info::symbol_section): Remove function.
5086         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
5087         (Sized_dwarf_line_info::read_line_mappings): Remove object
5088         parameter, adjust callers.
5089         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
5090         * dwarf_reader.h: Include <sys/types.h>.
5091         (class Track_relocs): Remove forward declaration.
5092         (class Elf_reloc_mapper): New class.
5093         (class Sized_elf_reloc_mapper): New class.
5094         (class Dwarf_abbrev_table): New class.
5095         (class Dwarf_range_list): New class.
5096         (class Dwarf_ranges_table): New class.
5097         (class Dwarf_pubnames_table): New class.
5098         (class Dwarf_die): New class.
5099         (class Dwarf_info_reader): New class.
5100         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
5101         (Sized_dwarf_line_info::symbol_section): Remove member function.
5102         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
5103         base class.
5104         * gdb-index.cc: New source file.
5105         * gdb-index.h: New source file.
5106         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
5107         and .debug_types sections, call Layout::add_to_gdb_index.
5108         (Sized_relobj_incr::do_section_name): Implement.
5109         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
5110         return type; Implement.
5111         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
5112         return type.
5113         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
5114         parameter list and return type.
5115         (Sized_incr_dynobj::do_section_contents): Likewise.
5116         * layout.cc: Include gdb-index.h.
5117         (Layout::Layout): Initialize gdb_index_data_.
5118         (Layout::init_fixed_output_section): Check for .gdb_index section.
5119         (Layout::add_to_gdb_index): New function. Instantiate.
5120         * layout.h: Add forward declaration for class Gdb_index.
5121         (Layout::add_to_gdb_index): New member function.
5122         (Layout::gdb_index_data_): New data member.
5123         * main.cc: Include gdb-index.h.
5124         (main): Print statistics for gdb index.
5125         * object.cc (Object::section_contents): Move code into
5126         do_section_contents.
5127         (need_decompressed_section): Check for sections needed when building
5128         gdb index.
5129         (build_compressed_section_map): Likewise.
5130         (Sized_relobj_file::do_read_symbols): Need local symbols when building
5131         gdb index.
5132         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
5133         sections; call Layout::add_to_gdb_index.
5134         (Sized_relobj_file::do_decompressed_section_contents): Call
5135         do_section_contents directly.
5136         * object.h (Object::do_section_contents): Adjust parameter list and
5137         return type.
5138         (Object::do_decompressed_section_contents): Call do_section_contents
5139         directly.
5140         (Sized_relobj_file::do_section_contents): Adjust parameter list and
5141         return type.
5142         * options.h (class General_options): Add --gdb-index option.
5143         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
5144         list and return type.
5145         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
5146         * reloc.h (Track_relocs::checkpoint): New function.
5147         (Track_relocs::reset): New function.
5148
5149         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
5150         New test cases.
5151         * testsuite/Makefile.in: Regenerate.
5152         * testsuite/gdb_index_test.cc: New test source file.
5153         * testsuite/gdb_index_test_1.sh: New test source file.
5154         * testsuite/gdb_index_test_2.sh: New test source file.
5155
5156 2012-03-19  Doug Kwan  <dougkwan@google.com>
5157
5158         * arm.cc (Target_arm::do_define_standard_symbols): New method.
5159         (Target_arm::do_finalize_sections): Remove code which defines
5160         __exidx_start and __exidx_end.  Make symbol table parameter
5161         anonymous as it is not used.
5162         * gold.cc (queue_middle_tasks): Call target hook to define any
5163         target-specific symbols.
5164         * target.h (Target::define_standard_symbols): New method.
5165         (Target::do_define_standard_symbols): Same.
5166         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
5167         * testsuite/Makefile.in: Regenerate.
5168         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
5169         and __exidx_end.
5170         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
5171         relocations are generated for __exidx_start and __exidx_end.
5172
5173 2012-03-16  Doug Kwan  <dougkwan@google.com>
5174
5175         * testsuite/Makefile.am: Disable test initpri3b.
5176         * testsuite/Makefile.in: Regenerate.
5177
5178 2012-03-15  Doug Kwan  <dougkwan@google.com>
5179
5180         * arm.cc (Target_arm::got_section): Make .got section read-only
5181         if -z now is given.
5182
5183 2012-03-15  Ian Lance Taylor  <iant@google.com>
5184
5185         PR gold/13850
5186         * layout.cc (Layout::make_output_section): Correctly mark
5187         SHT_INIT_ARRAY, et. al., as relro.
5188
5189 2012-03-14  Doug Kwan  <dougkwan@google.com>
5190
5191         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
5192         dynamic relocations for protected symbols in shared objects.
5193
5194 2012-03-13  Ian Lance Taylor  <iant@google.com>
5195
5196         * resolve.cc (Symbol_table::resolve): When merging common symbols,
5197         keep the larger alignment.
5198
5199 2012-03-12  Cary Coutant  <ccoutant@google.com>
5200
5201         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
5202         handling of DW_LNE_define_file.
5203
5204 2012-03-12  Cary Coutant  <ccoutant@google.com>
5205
5206         * reduced_debug_output.cc
5207         (Output_reduced_debug_info_section::get_die_end): Add new FORM
5208         codes to switch.
5209
5210 2012-02-29  Cary Coutant  <ccoutant@google.com>
5211
5212         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
5213
5214 2012-02-29  Cary Coutant  <ccoutant@google.com>
5215
5216         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5217         Call Object::decompressed_section_contents.
5218         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
5219         New dtor.
5220         (Sized_dwarf_line_info::buffer_start_): New data member.
5221         * merge.cc (Output_merge_data::do_add_input_section): Call
5222         Object::decompressed_section_contents.
5223         (Output_merge_string::do_add_input_section): Likewise.
5224         * object.cc (need_decompressed_section): New function.
5225         (build_compressed_section_map): Decompress sections needed later.
5226         (Sized_relobj_file::do_decompressed_section_contents): New function.
5227         (Sized_relobj_file::do_discard_decompressed_sections): New function.
5228         * object.h (Object::decompressed_section_contents): New function.
5229         (Object::discard_decompressed_sections): New function.
5230         (Object::do_decompressed_section_contents): New function.
5231         (Object::do_discard_decompressed_sections): New function.
5232         (Compressed_section_info): New type.
5233         (Compressed_section_map): Include decompressed section contents.
5234         (Sized_relobj_file::do_decompressed_section_contents): New function.
5235         (Sized_relobj_file::do_discard_decompressed_sections): New function.
5236
5237 2012-02-16  Cary Coutant  <ccoutant@google.com>
5238
5239         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
5240         * testsuite/Makefile.in: Regenerate.
5241
5242 2012-02-14  Cary Coutant  <ccoutant@google.com>
5243
5244         * options.cc (General_options::finalize): Disallow -pie and -static.
5245
5246 2012-02-03  Doug Kwan  <dougkwan@google.com>
5247
5248         * arm.cc (Arm_relocate_functions::abs8,
5249         Arm_relocate_functions::abs16): Use
5250         Bits::has_signed_unsigned_overflow32.
5251         (Arm_relocate_functions::thm_abs8): Correct range of
5252         overflow check.
5253         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
5254         in assertions.
5255
5256 2012-02-02  Doug Kwan  <dougkwan@google.com>
5257
5258         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
5259         position independent outputs, not just shared objects.
5260
5261 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
5262
5263         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
5264         * configure: Regenerated.
5265
5266 2012-01-27  Ian Lance Taylor  <iant@google.com>
5267
5268         * reloc.h (Bits): New class with static functions, copied from
5269         namespace utils in arm.cc.
5270         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
5271         instead.
5272
5273 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5274
5275         * incremental.cc (write_info_blocks): Correct relocation offset.
5276
5277 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5278
5279         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
5280         (Relocate::tls_gd_to_le): Likewise.
5281
5282 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5283
5284         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
5285
5286 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5287
5288         * configure.ac: Check if -mcmodel=medium works.
5289         * configure: Regenerated.
5290
5291 2012-01-24  Cary Coutant  <ccoutant@google.com>
5292
5293         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
5294         definition and ...
5295         (read_unsigned_LEB_128_x): ... this new function.
5296         (read_signed_LEB_128): Replaced with inline definition and ...
5297         (read_signed_LEB_128_x): ... this new function.
5298         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
5299         (read_unsigned_LEB_128): Add inline definition.
5300         (read_signed_LEB_128_x): New function.
5301         (read_signed_LEB_128): Add inline definition.
5302         * testsuite/Makefile.am (leb128_unittest): New unit test.
5303         * testsuite/Makefile.in: Regenerate.
5304         * testsuite/leb128_unittest.cc: New unit test.
5305
5306 2012-01-23  Ian Lance Taylor  <iant@google.com>
5307
5308         PR gold/13617
5309         * i386.cc (Target_i386::do_code_fill): When using a jmp
5310         instruction, pad with nop instructions.
5311         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5312
5313 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
5314
5315         * x86_64.cc (gc_process_relocs): Add typename on types used in
5316         template.
5317         (scan_relocs): Likewise.
5318         (relocate_section): Likewise.
5319         (apply_relocation): Likewise.
5320
5321 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
5322
5323         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
5324         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
5325         under x32.
5326
5327 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
5328
5329         * x86_64.cc: Initial support for x32.
5330
5331 2012-01-03  Cary Coutant  <ccoutant@google.com>
5332
5333         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
5334         Use abstract base class for GOT.
5335         * gold/output.h (class Output_data_got_base): New abstract base class.
5336         (class Output_data_got): Derive from new base class, adjust ctors.
5337         (Output_data_got::reserve_slot): Make virtual; rename to
5338         do_reserve_slot; Adjust callers.
5339         * gold/target.h (Sized_target::init_got_plt_for_update): Return
5340         pointer to abstract base class.
5341         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
5342
5343 2011-12-18  Ian Lance Taylor  <iant@google.com>
5344
5345         * object.h (Relobj::local_symbol_value): New function.
5346         (Relobj::local_plt_offset): New function.
5347         (Relobj::local_has_got_offset): New function.
5348         (Relobj::local_got_offset): New function.
5349         (Relobj::set_local_got_offset): New function.
5350         (Relobj::do_local_symbol_value): New pure virtual function.
5351         (Relobj::do_local_plt_offset): Likewise.
5352         (Relobj::do_local_has_got_offset): Likewise.
5353         (Relobj::do_local_got_offset): Likewise.
5354         (Relobj::do_set_local_got_offset): Likewise.
5355         (Sized_relobj::do_local_has_got_offset): Rename from
5356         local_has_got_offset.
5357         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
5358         (Sized_relobj::do_set_local_got_offset): Rename from
5359         set_local_got_offset.
5360         (Sized_relobj_file::do_local_plt_offset): Rename from
5361         local_plt_offset.
5362         (Sized_relobj_file::do_local_symbol_value): New function.
5363         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
5364         local_plt_offset.
5365         * output.cc (Output_data_got::Got_entry::write): Change object to
5366         Relobj.  Use local_symbol_value.
5367         (Output_data_got::add_global_with_rel): Change rel_dyn to
5368         Output_data_reloc_generic*.  Use add_global_generic.
5369         (Output_data_got::add_global_with_rela): Remove.  Change all
5370         callers to use add_global_with_rel.
5371         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
5372         Output_data_reloc_generic*.  Use add_global_generic.
5373         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
5374         callers to use add_global_pair_with_rel.
5375         (Output_data_got::add_local): Change object to Relobj*.
5376         (Output_data_got::add_local_plt): Likewise.
5377         (Output_data_got::add_local_with_rel): Change object to Relobj*,
5378         change rel_dyn to Output_data_reloc_generic*.  Use
5379         add_local_generic.
5380         (Output_data_got::add_local_with_rela): Remove.  Change all
5381         callers to use all_local_with_rel.
5382         (Output_data_got::add_local_pair_with_rel): Change object to
5383         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
5384         add_output_section_generic.
5385         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
5386         callers to use add_local_pair_with_rel.
5387         (Output_data_got::reserve_local): Change object to Relobj*.
5388         * output.h: (class Output_data_reloc_generic): Add pure virtual
5389         declarations for add_global_generic, add_local_generic,
5390         add_output_section_generic.
5391         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
5392         functions for Output_data_reloc_generic.  Update declarations for
5393         changes listed in output.cc.
5394         (class Output_data_got): Change template parameter to got_size.
5395         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
5396         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
5397         function.
5398         (Sized_relobj_incr::do_local_plt_offset): New function.
5399         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
5400         add_global_generic.
5401
5402 2011-12-17  Cary Coutant  <ccoutant@google.com>
5403
5404         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
5405         * resolve.cc (Symbol_table::resolve): Likewise.
5406         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
5407         arrays.
5408         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5409
5410 2011-12-16  Ian Lance Taylor  <iant@google.com>
5411
5412         * output.h (Output_data_reloc_generic::add): Only call
5413         add_dynamic_reloc if this is a dynamic reloc section.
5414
5415 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
5416
5417         PR gold/13505
5418         * target-reloc.h (apply_relocation): Replace <64, false> with
5419         <size, big_endian>.
5420
5421 2011-11-25  Nick Clifton  <nickc@redhat.com>
5422
5423         * po/it.po: New Italian translation.
5424
5425 2011-11-17  Sterling Augustine  <saugustine@google.com>
5426
5427         * script.cc (script_include_directive): Implement.
5428         (read_script_file): New local variables name and search_path. Update
5429         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
5430         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
5431         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
5432
5433 2011-11-11  Sterling Augustine  <saugustine@google.com>
5434
5435         * yyscript.y (section_cmd): Add support for INCLUDE directive.
5436         (file_or_sections_cmd): Likewise.
5437
5438 2011-11-11  Doug Kwan  <dougkwan@google.com>
5439
5440         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
5441         if --just-symbols is given.
5442
5443 2011-11-10  Doug Kwan  <dougkwan@google.com>
5444
5445         PR gold/13362
5446         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
5447         when processing data relocs.
5448         * reloc.h (Relocate_functions::rel_unaligned): New method.
5449         (Relocate_functions::pcrel_unaligned): Ditto.
5450         (Relocate_functions::rel32_unaligned): Ditto.
5451         (Relocate_functions::pcrel32_unaligned): Ditto.
5452
5453 2011-11-09  Doug Kwan  <dougkwan@google.com>
5454
5455         PR gold/13362
5456         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
5457         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
5458         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
5459         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5460         (Relocate_functions::rel_unaligned): New.
5461         (Relocate_functions::rel32_unaligned): New.
5462         * target-reloc.h (relocate_for_relocatable): Add code to handle
5463         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5464         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
5465         arm_unaligned_reloc_r): New targets.
5466         * testsuite/Makefile.in: Regenerate.
5467         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
5468         linking.
5469
5470 2011-11-02  Ian Lance Taylor  <iant@google.com>
5471
5472         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
5473         NATIVE_LINKER.
5474         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
5475         * options.cc (General_options::finalize): Use library search path
5476         from configure script if specified.  If not native and no sysroot,
5477         only search TOOLLIBDIR.
5478         * options.h (Search_directory::Search_directory): Change name to
5479         const std::string&.
5480         (General_options::add_to_library_path_with_sysroot): Change arg to
5481         const std::string&.
5482         * configure, Makefile.in, config.in: Rebuild.
5483
5484 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5485
5486         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
5487         we are working around the ARM1176 Erratum.
5488         * options.h (General_options::fix_arm1176): Add option.
5489         * testsuite/Makefile.am: Add testcases, and keep current ones
5490         working.
5491         * testsuite/Makefile.in: Regenerate.
5492         * testsuite/arm_fix_1176.s: New file.
5493         * testsuite/arm_fix_1176.sh: Likewise.
5494
5495 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5496
5497         * arm.cc (Target_arm::Target_arm): Remove initialisation of
5498         may_use_blx_.
5499         (Target_arm::may_use_blx): Remove method.
5500         (Target_arm::set_may_use_blx): Likewise.
5501         (Target_arm::may_use_v4t_interworking): New method.
5502         (Target_arm::may_use_v5t_interworking): Likewise.
5503         (Target_arm::may_use_blx_): Remove member variable.
5504         (Arm_relocate_functions::arm_branch_common): Check for v5T
5505         interworking.
5506         (Arm_relocate_functions::thumb_branch_common): Likewise.
5507         (Reloc_stub::stub_type_for_reloc): Likewise.
5508         (Target_arm::do_finalize_sections): Correct interworking checks.
5509         * testsuite/Makefile.am: Add new tests.
5510         * testsuite/Makefile.in: Regenerate.
5511         * testsuite/arm_farcall_arm_arm.s: New test.
5512         * testsuite/arm_farcall_arm_arm.sh: Likewise.
5513         * testsuite/arm_farcall_arm_thumb.s: Likewise.
5514         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
5515         * testsuite/arm_farcall_thumb_arm.s: Likewise.
5516         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
5517         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
5518         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
5519
5520 2011-10-31  Cary Coutant  <ccoutant@google.com>
5521
5522         PR gold/13023
5523         * expression.cc (Expression::eval_with_dot): Add
5524         is_section_dot_assignment parameter.
5525         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
5526         absolute and assigning to dot within a section.
5527         * script-sections.cc
5528         (Output_section_element_assignment::set_section_addresses): Pass
5529         dot_section to set_if_absolute.
5530         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
5531         as is_section_dot_assignment flag to eval_with_dot.
5532         (Output_section_element_dot_assignment::set_section_addresses):
5533         Likewise.
5534         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
5535         parameter.  Also set value if relative to dot_section; set the
5536         symbol's output_section.
5537         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
5538         parameter.  Adjust all callers.
5539         (Expression::eval_maybe_dot): Likewise.
5540         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
5541         Adjust all callers.
5542         * testsuite/script_test_2.t: Test assignment of an absolute value
5543         to dot within an output section element.
5544
5545 2011-10-31  Cary Coutant  <ccoutant@google.com>
5546
5547         * options.h (class General_options): Add --[no-]gnu-unique options.
5548         * symtab.cc (Symbol_table::sized_write_globals): Convert
5549         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
5550
5551 2011-10-31  Cary Coutant  <ccoutant@google.com>
5552
5553         PR gold/13359
5554         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
5555         unnecessary assertion.
5556         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
5557
5558 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
5559
5560         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5561         gc_mark_symbol.
5562         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5563         gc_mark_symbol.
5564         Change to just keep the section associated with symbol.
5565         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
5566         they are externally visible and --export-dynamic is turned on.
5567         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
5568
5569 2011-10-19  Ian Lance Taylor  <iant@google.com>
5570
5571         PR gold/13163
5572         * script-sections.cc
5573         (Output_section_element_dot_assignment::needs_output_section): New
5574         function.
5575
5576 2011-10-19  Ian Lance Taylor  <iant@google.com>
5577
5578         PR gold/13204
5579         * layout.cc (Layout::segment_precedes): Don't assert failure if a
5580         --section-start option was seen.
5581         * options.h (General_options::any_section_start): New function.
5582
5583 2011-10-18  David S. Miller  <davem@davemloft.net>
5584
5585         PR binutils/13301
5586         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
5587         member to track relocation locations that have moved during TLS
5588         reloc optimizations.
5589         (Target_sparc::Relocate::Relocate): Initialize to NULL.
5590         (Target_sparc::Relocate::relocate): Adjust view down by 4
5591         bytes if it matches reloc_adjust_addr_.
5592         (Target_sparc::Relocate::relocate_tls): Always move the
5593         __tls_get_addr call delay slot instruction forward 4 bytes when
5594         performing relaxation.
5595
5596 2011-10-18  Cary Coutant  <ccoutant@google.com>
5597
5598         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
5599         (Output_file::map_no_anonymous): Check for non-zero
5600         return code from posix_fallocate.
5601
5602 2011-10-17  Cary Coutant  <ccoutant@google.com>
5603
5604         PR gold/13245
5605         * plugin.cc (is_visible_from_outside): Check for symbols
5606         referenced from dynamic objects.
5607         * resolve.cc (Symbol_table::resolve): Don't count references
5608         from dynamic objects as references from real ELF files.
5609         * testsuite/plugin_test_2.sh: Adjust expected result.
5610
5611 2011-10-17  Cary Coutant  <ccoutant@google.com>
5612
5613         * gold.cc: Include timer.h.
5614         (queue_middle_tasks): Stamp time.
5615         (queue_final_tasks): Likewise.
5616         * main.cc (main): Store timer in parameters.  Print timers
5617         for each pass.
5618         * parameters.cc (Parameters::Parameters): Initialize timer_.
5619         (Parameters::set_timer): New function.
5620         (set_parameters_timer): New function.
5621         * parameters.h (Parameters::set_timer): New function.
5622         (Parameters::timer): New function.
5623         (Parameters::timer_): New data member.
5624         (set_parameters_timer): New function.
5625         * timer.cc (Timer::stamp): New function.
5626         (Timer::get_pass_time): New function.
5627         * timer.h (Timer::stamp): New function.
5628         (Timer::get_pass_time): New function.
5629         (Timer::pass_times_): New data member.
5630
5631 2011-10-17  Cary Coutant  <ccoutant@google.com>
5632
5633         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
5634         task for members of lib groups.
5635
5636 2011-10-17  Cary Coutant  <ccoutant@google.com>
5637
5638         PR gold/13288
5639         * fileread.cc (File_read::find_view): Add assert.
5640         (File_read::make_view): Move bounds check (replace with assert)...
5641         (File_read::find_or_make_view): ... to here.
5642
5643 2011-10-12  Cary Coutant  <ccoutant@google.com>
5644
5645         * output.cc (Output_file::open_base_file): Handle case where
5646         ::read returns less than requested size.
5647
5648 2011-10-10  Cary Coutant  <ccoutant@google.com>
5649
5650         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
5651         Initialize defined_count_.
5652         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
5653         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
5654         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
5655         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
5656         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
5657         * incremental.h (Sized_relobj_incr::defined_count_): New data
5658         member.
5659         (Sized_incr_dynobj::defined_count_): New data member.
5660         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
5661         Return zeroes instead of internal error.
5662
5663 2011-10-10  Cary Coutant  <ccoutant@google.com>
5664
5665         PR gold/13249
5666         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
5667         (Output_reloc::symbol_value): Return PLT offset if flag is set.
5668         * output.h (class Output_reloc): Add use_plt_offset flag.
5669         (Output_reloc::type_): Adjust size of bit field.
5670         (Output_reloc::use_plt_offset_): New bit field.
5671         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
5672         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
5673         flag.  Adjust all callers.
5674         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
5675         creating RELATIVE relocations.
5676
5677 2011-10-10  Nick Clifton  <nickc@redhat.com>
5678
5679         * po/es.po: Updated Spanish translation.
5680         * po/fi.po: Updated Finnish translation.
5681
5682 2011-10-03   Diego Novillo  <dnovillo@google.com>
5683
5684         * options.cc (parse_uint): Fix dereference of RETVAL.
5685
5686 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
5687
5688         * layout.h (section_order_map_): New member.
5689         (get_section_order_map): New member function.
5690         * output.cc (Output_section::add_input_section): Check for patterns
5691         only when --section-ordering-file is specified.
5692         * gold.cc (queue_middle_tasks): Delay updating order of sections till
5693         output_sections have been formed.
5694         * layout.cc (Layout_Layout): Initialize section_order_map_.
5695         * plugin.cc (update_section_order): Store order in order_map. Do not
5696         update the order.
5697         * testsuite/Makefile.am: Add test case for plugin_final_layout.
5698         * testsuite/Makefile.in: Regenerate.
5699         * testsuite/plugin_section_order.c: New file.
5700         * testsuite/plugin_final_layout.cc: New file.
5701         * testsuite/plugin_final_layout.sh: New file.
5702
5703 2011-09-29  Cary Coutant  <ccoutant@google.com>
5704
5705         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5706         Check for NULL.
5707         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
5708         symbols during incremental update.
5709         (Symbol_table::add_from_dynobj): Likewise.
5710
5711 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5712             Ian Lance Taylor  <iant@google.com>
5713
5714         * symtab.cc (Symbol_table::define_special_symbol): Always
5715         canonicalize version string.
5716
5717 2011-09-26  Cary Coutant  <ccoutant@google.com>
5718
5719         * gold.cc (queue_initial_tasks): Move option checks ...
5720         * options.cc (General_options::finalize): ... to here. Disable
5721         some options; make others fatal.
5722
5723 2011-09-26  Cary Coutant  <ccoutant@google.com>
5724
5725         gcc PR lto/47247
5726         * plugin.cc (get_symbols_v2): New function.
5727         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
5728         (is_referenced_from_outside): New function.
5729         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
5730         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
5731         (get_symbols): Pass version parameter.
5732         (get_symbols_v2): New function.
5733         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
5734         parameter.
5735         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
5736         (onload): Add LDPT_GET_SYMBOLS_V2.
5737         (all_symbols_read_hook): Use get_symbols_v2; check for
5738         LDPR_PREVAILING_DEF_IRONLY_EXP.
5739         * testsuite/plugin_test_3.sh: Update expected results.
5740
5741 2011-09-23  Simon Baldwin  <simonb@google.com>
5742
5743         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5744         configuration options.
5745         * configure: Regenerate.
5746         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
5747         * Makefile.in: Regenerate.
5748         * testsuite/Makefile.in: Regenerate.
5749
5750 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
5751
5752         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
5753
5754 2011-09-19  Cary Coutant  <ccoutant@google.com>
5755
5756         * incremental.cc (can_incremental_update): Fix typo in comment.
5757         * incremental.h (can_incremental_update): Likewise.
5758
5759 2011-09-18  Cary Coutant  <ccoutant@google.com>
5760
5761         * incremental.cc (can_incremental_update): New function.
5762         * incremental.h (can_incremental_update): New function.
5763         * layout.cc (Layout::init_fixed_output_section): Call it.
5764         (Layout::make_output_section): Don't allow patch space in .eh_frame.
5765         * object.cc (Sized_relobj_file::do_layout): Call
5766         can_incremental_update.
5767
5768 2011-09-13  Cary Coutant  <ccoutant@google.com>
5769
5770         * configure.ac: Check for glibc support for gnu_indirect_function
5771         support with static linking, setting automake conditional
5772         IFUNC_STATIC.
5773         * Makefile.in: Regenerate.
5774         * configure: Regenerate.
5775
5776         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
5777         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
5778         for IFUNC_STATIC.
5779         * testsuite/Makefile.in: Regenerate.
5780
5781 2011-09-13  Cary Coutant  <ccoutant@google.com>
5782
5783         * incremental.cc (Sized_relobj_incr::do_layout): Call
5784         report_comdat_group for kept comdat sections.
5785         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
5786         * testsuite/Makefile.in: Regenerate.
5787         * testsuite/incr_comdat_test_1.cc: New source file.
5788         * testsuite/incr_comdat_test_2_v1.cc: New source file.
5789         * testsuite/incr_comdat_test_2_v2.cc: New source file.
5790         * testsuite/incr_comdat_test_2_v3.cc: New source file.
5791
5792 2011-09-13  Ian Lance Taylor  <iant@google.com>
5793
5794         * object.cc (Sized_relobj_file::do_layout): Remove unused local
5795         variable external_symbols_offset.
5796
5797 2011-09-12  Ian Lance Taylor  <iant@google.com>
5798
5799         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
5800         triggered if object has no symbols.
5801
5802 2011-09-09  David S. Miller  <davem@davemloft.net>
5803
5804         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
5805         (Output_fill_debug_line::do_write): Likewise.
5806
5807 2011-08-29  Cary Coutant  <ccoutant@google.com>
5808
5809         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
5810         casts to match formatting specs.
5811         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
5812
5813 2011-08-26  Cary Coutant  <ccoutant@google.com>
5814
5815         * layout.cc (Free_list::allocate): Provide guarantee of minimum
5816         remaining hole size when allocating.
5817         (Layout::make_output_section): Set fill methods for debug sections.
5818         * layout.h (Free_list::Free_list_node): Move from private to
5819         public.
5820         (Free_list::set_min_hole_size): New function.
5821         (Free_list::begin, Free_list::end): New functions.
5822         (Free_list::min_hole_): New data member.
5823         * output.cc: Include dwarf.h.
5824         (Output_fill_debug_info::do_minimum_hole_size): New function.
5825         (Output_fill_debug_info::do_write): New function.
5826         (Output_fill_debug_line::do_minimum_hole_size): New function.
5827         (Output_fill_debug_line::do_write): New function.
5828         (Output_section::Output_section): Initialize new data member.
5829         (Output_section::set_final_data_size): Ensure patch space is larger
5830         than minimum hole size.
5831         (Output_section::do_write): Fill holes in debug sections.
5832         * output.h (Output_fill): New class.
5833         (Output_fill_debug_info): New class.
5834         (Output_fill_debug_line): New class.
5835         (Output_section::set_free_space_fill): New function.
5836         (Output_section::free_space_fill_): New data member.
5837         * testsuite/Makefile.am (incremental_test_3): Add
5838         --incremental-patch option.
5839         (incremental_test_4): Likewise.
5840         (incremental_test_5): Likewise.
5841         (incremental_test_6): Likewise.
5842         (incremental_copy_test): Likewise.
5843         (incremental_common_test_1): Likewise.
5844         * testsuite/Makefile.in: Regenerate.
5845
5846 2011-08-26  Nick Clifton  <nickc@redhat.com>
5847
5848         * po/es.po: Updated Spanish translation.
5849
5850 2011-08-01  Cary Coutant  <ccoutant@google.com>
5851
5852         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
5853         * gold/testsuite/Makefile.in: Regenerate.
5854         * gold/testsuite/justsyms_exec.c: New source file.
5855         * gold/testsuite/justsyms_lib.c: New source file.
5856
5857 2011-08-01  Cary Coutant  <ccoutant@google.com>
5858
5859         * layout.cc (Layout::set_segment_offsets): Don't realign text
5860         segment if -Ttext was specified.
5861         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
5862         file type.
5863         * object.h (Sized_relobj_file::e_type): New function.
5864         (Sized_relobj_file::e_type_): New data member.
5865         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
5866         base address for ET_EXEC files.
5867         * target.cc (Target::do_make_elf_object_implementation): Allow
5868         ET_EXEC files with --just-symbols option.
5869
5870 2011-07-28  Cary Coutant  <ccoutant@google.com>
5871
5872         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
5873         Add thread_number parameter.
5874         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
5875         * workqueue-threads.cc
5876         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
5877         current thread if its thread number is greater than desired thread
5878         count.
5879         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
5880         Add thread_number parameter.
5881         (Workqueue::should_cancel_thread): Likewise.
5882         (Workqueue::find_runnable_or_wait): Pass thread_number to
5883         should_cancel_thread.
5884         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
5885         parameter.
5886
5887 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
5888
5889         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
5890         only after checking if it cannot be forced local.
5891         * symtab.h (is_externally_visible): Check if the symbol is not forced
5892         local.
5893
5894 2011-07-15  Ian Lance Taylor  <iant@google.com>
5895
5896         * options.h (class General_options): Add --print-output-format.
5897         Move -EL next to -EB, for  better --help output.
5898         * target-select.cc: Include <cstdio>, "options.h", and
5899         "parameters.h".
5900         (Target_selector::do_target_bfd_name): New function.
5901         (print_output_format): New function.
5902         * target-select.h (class Target_selector): Update declarations.
5903         (Target_selector::target_bfd_name): New function.
5904         (print_output_format): Declare.
5905         * main.cc: Include "target-select.h".
5906         (main): Handle --print-output-format.
5907         * gold.cc: Include "target-select.h".
5908         (queue_initial_tasks): Handle --print-output-format when there are
5909         no input files.
5910         * parameters.cc (parameters_force_valid_target): Give a better
5911         error message if -EB/-EL does not match target.
5912         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
5913         function.
5914
5915 2011-07-15  Ian Lance Taylor  <iant@google.com>
5916
5917         * i386.cc (class Output_data_plt_i386): Add layout_ field.
5918         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
5919         (Output_data_plt_i386::do_write): Write address of .dynamic
5920         section to first entry in .got.plt section.
5921         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
5922         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5923         Initialize layout_.
5924         (Output_data_plt_x86_64::do_write): Write address of .dynamic
5925         section to first entry in .got.plt section.
5926         * layout.h (Layout::dynamic_section): New function.
5927
5928 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
5929
5930         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
5931         to claim_file call.
5932         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
5933         input_section_position_, and input_section_glob_.
5934         (read_layout_from_file): Call function section_ordering_specified.
5935         * layout.h (is_section_ordering_specified): New function.
5936         (section_ordering_specified): New function.
5937         (section_ordering_specified_): New boolean member.
5938         * main.cc(main): Call load_plugins after layout object is defined.
5939         * output.cc (Output_section::add_input_section): Use
5940         function section_ordering_specified to check if section ordering is
5941         needed.
5942         * output.cc (Output_section::add_relaxed_input_section): Use
5943         function section_ordering_specified to check if section ordering is
5944         needed.
5945         (Output_section::update_section_layout): New function.
5946         (Output_section::sort_attached_input_sections): Check if input section
5947         must be reordered.
5948         * output.h (Output_section::update_section_layout): New function.
5949         * plugin.cc (get_section_count): New function.
5950         (get_section_type): New function.
5951         (get_section_name): New function.
5952         (get_section_contents): New function.
5953         (update_section_order): New function.
5954         (allow_section_ordering): New function.
5955         (Plugin::load): Add the new interfaces to the transfer vector.
5956         (Plugin_manager::load_plugins): New parameter.
5957         (Plugin_manager::all_symbols_read): New parameter.
5958         (Plugin_manager::claim_file): New parameter. Save the elf object for
5959         unclaimed objects.
5960         (Plugin_manager::get_elf_object): New function.
5961         (Plugin_manager::get_view): Change to directly use the bool to check
5962         if get_view is called from claim_file_hook.
5963         * plugin.h (input_objects): New function
5964         (Plugin__manager::load_plugins): New parameter.
5965         (Plugin_manager::claim_file): New parameter.
5966         (Plugin_manager::get_elf_object): New function.
5967         (Plugin_manager::in_claim_file_handler): New function.
5968         (Plugin_manager::in_claim_file_handler_): New member.
5969         (layout): New function.
5970         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
5971         handler with an extra parameter. Make the elf object before calling
5972         claim_file handler.
5973         * testsuite/plugin_test.c (get_section_count): New function pointer.
5974         (get_section_type): New function pointer.
5975         (get_section_name): New function pointer.
5976         (get_section_contents): New function pointer.
5977         (update_section_order): New function pointer.
5978         (allow_section_ordering): New function pointer.
5979         (onload): Check if the new interfaces exist.
5980
5981 2011-07-13  Ian Lance Taylor  <iant@google.com>
5982
5983         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
5984         relro section.
5985         * x86_64.cc (Target_x86_64::got_section): Likewise.
5986         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
5987         (relro_now_test_SOURCES): New variable.
5988         (relro_now_test_DEPENDENCIES): New variable.
5989         (relro_now_test_LDFLAGS): New variable.
5990         (relro_now_test_LDADD): New variable.
5991         (relro_now_test.so): New target.
5992         * testsuite/Makefile.in: Rebuild.
5993
5994 2011-07-12  Ian Lance Taylor  <iant@google.com>
5995
5996         PR gold/12980
5997         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
5998         GLOB_DAT relocation rather than a RELATIVE relocation for a
5999         protected symbol when creating a shared library.
6000         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6001         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
6002         * testsuite/protected_main_1.cc (main): Test that protected
6003         function has same address.
6004
6005 2011-07-11  Ian Lance Taylor  <iant@google.com>
6006
6007         PR gold/12979
6008         * options.h (class General_options): Add -Bgroup.
6009         * options.cc (General_options::finalize): If -Bgroup is set,
6010         default to --unresolved-symbols=report-all.
6011         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
6012         * target-reloc.h (issue_undefined_symbol_error): Handle
6013         --unresolved-symbols=report-all.
6014
6015 2011-07-08  Ian Lance Taylor  <iant@google.com>
6016
6017         PR gold/11985
6018         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
6019         if linker script discards key sections.
6020         (Layout::create_dynamic_symtab): Likewise.
6021         (Layout::assign_local_dynsym_offsets): Likewise.
6022         (Layout::sized_create_version_sections): Likewise.
6023         (Layout::create_interp): Likewise.
6024         (Layout::finish_dynamic_section): Likewise.
6025         (Layout::set_dynamic_symbol_size): Likewise.
6026
6027 2011-07-08  Ian Lance Taylor  <iant@google.com>
6028
6029         PR gold/12386
6030         * options.h (class General_options): Add --unresolved-symbols.
6031         * target-reloc.h (issue_undefined_symbol_error): Check
6032         --unresolved-symbols.  Add comments.
6033
6034 2011-07-08  Ian Lance Taylor  <iant@google.com>
6035
6036         * testsuite/odr_violation2.cc (Ordering::operator()): Make
6037         expression more complex.
6038
6039 2011-07-08  Ian Lance Taylor  <iant@google.com>
6040
6041         PR gold/11317
6042         * target-reloc.h (issue_undefined_symbol_error): New inline
6043         function, broken out of relocate_section.
6044         (relocate_section): Call issue_undefined_symbol_error.
6045         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
6046         there is no TLS segment if we are about to issue an undefined
6047         symbol error.
6048         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
6049
6050 2011-07-08  Ian Lance Taylor  <iant@google.com>
6051
6052         PR gold/12279
6053         * resolve.cc (Symbol_table::should_override): Add fromtype
6054         parameter.  Change all callers.  Give error when linking together
6055         TLS and non-TLS symbol.
6056         (Symbol_table::should_override_with_special): Add fromtype
6057         parameter.  Change all callers.
6058         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
6059         there is no TLS segment if we have reported some errors.
6060         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
6061
6062 2011-07-08  Ian Lance Taylor  <iant@google.com>
6063
6064         PR gold/12372
6065         * target.h (Target::plt_address_for_global): New function.
6066         (Target::plt_address_for_local): New function.
6067         (Target::plt_section_for_global): Remove.
6068         (Target::plt_section_for_local): Remove.
6069         (Target::do_plt_address_for_global): New virtual function.
6070         (Target::do_plt_address_for_local): New virtual function.
6071         (Target::do_plt_section_for_global): Remove.
6072         (Target::do_plt_section_for_local): Remove.
6073         (Target::register_global_plt_entry): Add Symbol_table and Layout
6074         parameters.
6075         * output.cc (Output_data_got::Got_entry::write): Use
6076         plt_address_for_global and plt_address_for_local.
6077         * layout.cc (Layout::add_target_dynamic_tags): Use size and
6078         address of output section.
6079         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
6080         got_irelative_, and irelative_count_ fields.  Update
6081         declarations.
6082         (Output_data_plt_i386::has_irelative_section): New function.
6083         (Output_data_plt_i386::entry_count): Add irelative_count_.
6084         (Output_data_plt_i386::set_final_data_size): Likewise.
6085         (class Target_i386): Add got_irelative_ and rel_irelative_
6086         fields.  Update declarations.
6087         (Target_i386::Target_i386): Initialize new fields.
6088         (Target_i386::do_plt_address_for_global): New function replacing
6089         do_plt_section_for_global.
6090         (Target_i386::do_plt_address_for_local): New function replacing
6091         do_plt_section_for_local.
6092         (Target_i386::got_section): Create got_irelative_.
6093         (Target_i386::rel_irelative_section): New function.
6094         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
6095         fields.  Don't define __rel_iplt_{start,end}.
6096         (Output_data_plt_i386::add_entry): Add symtab and layout
6097         parameters.  Change all callers.  Use different PLT and GOT for
6098         IFUNC symbols.
6099         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
6100         layout parameters.  Change all callers.  Use different PLT and
6101         GOT.
6102         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
6103         (Output_data_plt_i386::rel_irelative): New function.
6104         (Output_data_plt_i386::address_for_global): New function.
6105         (Output_data_plt_i386::address_for_local): New function.
6106         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
6107         IRELATIVE GOT when changing IFUNC GOT entries.
6108         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
6109         reloc.
6110         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
6111         if we didn't create an IRELATIVE GOT.
6112         (Target_i386::Relocate::relocate): Use plt_address_for_global and
6113         plt_address_for_local.
6114         (Target_i386::do_dynsym_value): Use plt_address_for_global.
6115         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
6116         got_irelative_, and irelative_count_ fields.  Update
6117         declarations.
6118         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
6119         Initialize new fields.  Remove symtab parameter.  Change all
6120         callers.
6121         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
6122         irelative_count_.
6123         (Output_data_plt_x86_64::has_irelative_section): New function.
6124         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
6125         (class Target_x86_64): Add got_irelative_ and rel_irelative_
6126         fields.  Update declarations.
6127         (Target_x86_64::Target_x86_64): Initialize new fields.
6128         (Target_x86_64::do_plt_address_for_global): New function replacing
6129         do_plt_section_for_global.
6130         (Target_x86_64::do_plt_address_for_local): New function replacing
6131         do_plt_section_for_local.
6132         (Target_x86_64::got_section): Create got_irelative_.
6133         (Target_x86_64::rela_irelative_section): New function.
6134         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
6135         all callers.  Don't create __rel_iplt_{start,end}.
6136         (Output_data_plt_x86_64::add_entry): Add symtab and layout
6137         parameters.  Change all callers.  Use different PLT and GOT for
6138         IFUNC symbols.
6139         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
6140         layout parameters.  Change all callers.  Use different PLT and
6141         GOT.
6142         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
6143         parameters.  Change all callers.  Use different PLT and GOT for
6144         IFUNC symbols.
6145         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
6146         (Output_data_plt_x86_64::rela_irelative): New function.
6147         (Output_data_plt_x86_64::address_for_global): New function.
6148         (Output_data_plt_x86_64::address_for_local): New function.
6149         (Output_data_plt_x86_64::set_final_data_size): Likewise.
6150         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
6151         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
6152         (Target_x86_64::register_global_plt_entry): Add symtab and layout
6153         parameters.
6154         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
6155         reloc.
6156         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
6157         symbols if we didn't create an IRELATIVE GOT.
6158         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
6159         plt_address_for_local.
6160         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
6161         * testsuite/ifuncvar1.c: New test file.
6162         * testsuite/ifuncvar2.c: New test file.
6163         * testsuite/ifuncvar3.c: New test file.
6164         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
6165         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
6166         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
6167         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
6168         * testsuite/Makefile.in: Rebuild.
6169
6170 2011-07-07  Cary Coutant  <ccoutant@google.com>
6171
6172         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
6173         (two_file_test_1_ndebug.o): Likewise.
6174         (two_file_test_1b_ndebug.o): Likewise.
6175         (two_file_test_2_ndebug.o): Likewise.
6176         (two_file_test_main_ndebug.o): Likewise.
6177         (incremental_test_2): Link with no-debug versions.
6178
6179 2011-07-06  Cary Coutant  <ccoutant@google.com>
6180
6181         * gold/incremental.cc
6182         (Output_section_incremental_inputs::write_info_blocks): Check for
6183         hidden and internal symbols.
6184
6185 2011-07-06  Cary Coutant  <ccoutant@google.com>
6186
6187         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
6188         Check disposition for startup file.
6189         (Incremental_inputs::report_command_line): Ignore
6190         --incremental-startup-unchanged option.
6191         * options.cc (General_options::parse_incremental_startup_unchanged):
6192         New function.
6193         (General_options::General_options): Initialize new data member.
6194         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
6195         (General_options): Add --incremental-startup-unchanged option.
6196         (General_options::incremental_startup_disposition): New function.
6197         (General_options::incremental_startup_disposition_): New data member.
6198
6199 2011-07-06  Cary Coutant  <ccoutant@google.com>
6200
6201         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
6202         input file index to Script_info ctor.
6203         (Sized_incremental_binary::do_file_has_changed): Find the
6204         command-line argument for files named in scripts.
6205         * incremental.h (Script_info::Script_info): New ctor
6206         with input file index.
6207         (Script_info::input_file_index): New function.
6208         (Script_info::input_file_index_): New data member.
6209         (Incremental_binary::get_library): Add const.
6210         (Incremental_binary::get_script_info): Add const.
6211         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
6212         * testsuite/Makefile.am (incremental_test_5): New test case.
6213         (incremental_test_6): New test case.
6214         * testsuite/Makefile.in: Regenerate.
6215
6216 2011-07-06  Cary Coutant  <ccoutant@google.com>
6217
6218         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
6219         debug output when command lines differ.
6220
6221 2011-07-06  Cary Coutant  <ccoutant@google.com>
6222
6223         * incremental.cc (Incremental_inputs::report_command_line): Ignore
6224         --incremental-patch option.
6225         * layout.cc (Free_list::allocate): Extend allocation beyond original
6226         end if enabled.
6227         (Layout::make_output_section): Mark sections that should get
6228         patch space.
6229         * options.cc (parse_percent): New function.
6230         * options.h (parse_percent): New function.
6231         (DEFINE_percent): New macro.
6232         (General_options): Add --incremental-patch option.
6233         * output.cc (Output_section::Output_section): Initialize new data
6234         members.
6235         (Output_section::add_input_section): Print section name when out
6236         of patch space.
6237         (Output_section::add_output_section_data): Likewise.
6238         (Output_section::set_final_data_size): Add patch space when
6239         doing --incremental-full.
6240         (Output_section::do_reset_address_and_file_offset): Remove patch
6241         space.
6242         (Output_segment::set_section_list_addresses): Print debug output
6243         only if --incremental-update.
6244         * output.h (Output_section::set_is_patch_space_allowed): New function.
6245         (Output_section::is_patch_space_allowed_): New data member.
6246         (Output_section::patch_space_): New data member.
6247         * parameters.cc (Parameters::incremental_full): New function.
6248         * parameters.h (Parameters::incremental_full): New function
6249         * testsuite/Makefile.am (incremental_test_2): Add test for
6250         --incremental-patch option.
6251         * testsuite/Makefile.in: Regenerate.
6252         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
6253         (t18): Remove function body.
6254
6255 2011-07-05  Doug Kwan  <dougkwan@google.com>
6256
6257         PR gold/12771
6258         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
6259         Arm_Address type for relocation result.
6260         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
6261         overflow check.
6262         (Arm_relocate_functions::abs32): Use unaligned access.
6263         (Arm_relocate_functions::rel32): Ditto.
6264         (Arm_relocate_functions::prel31): Ditto.
6265         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
6266         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
6267         static data relocations.
6268         * testsuite/Makefile.in: Regnerate.
6269         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
6270
6271 2011-07-05  Ian Lance Taylor  <iant@google.com>
6272
6273         PR gold/12392
6274         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
6275         symbols if necessary.
6276         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6277
6278 2011-07-05  Ian Lance Taylor  <iant@google.com>
6279
6280         PR gold/12952
6281         * resolve.cc (Symbol::override_base_with_special): Simply override
6282         version with special symbol version, ignoring previous version.
6283
6284 2011-07-05  Ian Lance Taylor  <iant@google.com>
6285
6286         * object.cc (Sized_relobj_file::include_section_group): Add
6287         information to comment about signature location.
6288
6289 2011-07-02  Ian Lance Taylor  <iant@google.com>
6290
6291         PR gold/12957
6292         * options.h (class General_options): Add -f and -F.
6293         * options.cc (General_options::finalize): Fatal error if -f/-F
6294         are used without -shared.
6295         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
6296
6297 2011-07-02  Ian Lance Taylor  <iant@google.com>
6298
6299         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
6300
6301 2011-07-01  Ian Lance Taylor  <iant@google.com>
6302
6303         PR gold/12525
6304         PR gold/12952
6305         * resolve.cc (Symbol::override_base_with_special): Don't override
6306         the version if the overriding symbol has a different name.
6307         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
6308         all callers.  If we give an error about an undefined version,
6309         define the base version if necessary.
6310         * dynobj.h (class Versions): Update declaration.
6311         * testsuite/weak_alias_test_5.cc: New file.
6312         * testsuite/weak_alias_test.script: New file.
6313         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
6314         and versioned_alias have the right value, and call t2.
6315         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
6316         weak_alias_test_5.so.
6317         (weak_alias_test_LDADD): Likewise.
6318         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
6319         * testsuite/Makefile.in: Rebuild.
6320
6321 2011-07-01  Ian Lance Taylor  <iant@google.com>
6322
6323         PR gold/12525
6324         * options.h (class General_options): Support -z notext.
6325         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
6326         -Wl,-z,notext.
6327         (two_file_shared_nonpic.so): Likewise.
6328         (two_file_shared_mixed.so): Likewise.
6329         (two_file_shared_mixed_1.so): Likewise.
6330         (weak_undef_lib_nonpic.so): Likewise.
6331         (alt/weak_undef_lib_nonpic.so): Likewise.
6332         (tls_test_shared_nonpic.so): Likewise.
6333         * testsuite/Makefile.in: Rebuild.
6334
6335 2011-07-01  Ian Lance Taylor  <iant@google.com>
6336
6337         PR gold/12525
6338         * configure.ac: Test whether static linking works, setting
6339         the automake conditional HAVE_STATIC.
6340         * testsuite/Makefile.am: Disable tests using -static if
6341         HAVE_STATIC is not true.
6342         * configure, testsuite/Makefile.in: Rebuild.
6343
6344 2011-07-01  Ian Lance Taylor  <iant@google.com>
6345
6346         PR gold/12525
6347         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
6348         Assert if we see DW_EH_PE_indirect.
6349         * target.h (Target::ehframe_datarel_base): New function.
6350         (Target::do_ehframe_datarel_base): New target function.
6351         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
6352         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
6353         function.
6354
6355 2011-07-01  Ian Lance Taylor  <iant@google.com>
6356
6357         PR gold/12571
6358         * options.h (class General_options): Add
6359         --ld-generated-unwind-info.
6360         * ehframe.cc (Fde::write): Add address parameter.  Change all
6361         callers.  If associated with PLT, fill in address and size.
6362         (Cie::set_output_offset): Only add merge mapping if there is an
6363         object.
6364         (Cie::write): Add address parameter.  Change all callers.
6365         (Eh_frame::add_ehframe_for_plt): New function.
6366         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
6367         input_offset_ fields into union u_, with new plt field.
6368         (Fde::Fde): Adjust for new union field.
6369         (Fde::Fde) [Output_data version]: New constructor.
6370         (Fde::add_mapping): Only add merge mapping if there is an object.
6371         (class Cie): Update declarations.
6372         (class Eh_frame): Declare add_ehframe_for_plt.
6373         * layout.cc (Layout::layout_eh_frame): Break out code into
6374         make_eh_frame_section, and call it.
6375         (Layout::make_eh_frame_section): New function.
6376         (Layout::add_eh_frame_for_plt): New function.
6377         * layout.h (class Layout): Update declarations.
6378         * merge.cc (Merge_map::add_mapping): Add assertion.
6379         * i386.cc: Include "dwarf.h".
6380         (class Output_data_plt_i386): Make first_plt_entry,
6381         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
6382         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6383         and plt_eh_frame_fde.
6384         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
6385         boundary.  Call add_eh_frame_for_plt if appropriate.
6386         * x86_64.cc: Include "dwarf.h".
6387         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
6388         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
6389         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6390         and plt_eh_frame_fde.
6391         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
6392         appropriate.
6393
6394 2011-06-29  Ian Lance Taylor  <iant@google.com>
6395
6396         PR gold/12629
6397         * object.cc (Sized_relobj_file::layout_section): Change shdr
6398         parameter to be const.
6399         (Sized_relobj_file::layout_eh_frame_section): New function, broken
6400         out of do_layout.
6401         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
6402         appropriate.  Call layout_eh_frame_section.
6403         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
6404         sections.
6405         * object.h (class Sized_relobj_file): Update declarations.
6406
6407 2011-06-29  Ian Lance Taylor  <iant@google.com>
6408
6409         PR gold/12652
6410         * script.cc (Token::integer_value): Accept trailing M/m/K/k
6411         modifier.
6412         (Lex::gather_token): Accept trailing M/m/K/k for integers.
6413
6414 2011-06-29  Ian Lance Taylor  <iant@google.com>
6415
6416         PR gold/12675
6417         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
6418         SHT_X86_64_UNWIND.
6419         * layout.cc (Layout::layout_eh_frame): Likewise.
6420
6421 2011-06-29  Ian Lance Taylor  <iant@google.com>
6422
6423         PR gold/12695
6424         * layout.cc (Layout::symtab_section_shndx): New function.
6425         * layout.h (class Layout): Declare symtab_section_shndx.
6426         * output.cc (Output_section::write_header): Call it.
6427
6428 2011-06-29  Ian Lance Taylor  <iant@google.com>
6429
6430         PR gold/12818
6431         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
6432         symbols which are not used in a relocation.
6433
6434 2011-06-28  Ian Lance Taylor  <iant@google.com>
6435
6436         PR gold/12898
6437         * layout.cc (Layout::segment_precedes): Don't crash if a linker
6438         script create indistinguishable segments.
6439         (Layout::set_segment_offsets): Use stable_sort when sorting
6440         segments.  Pass this to Compare_segments constructor.
6441         * layout.h (class Layout): Make segment_precedes non-static.
6442         (class Compare_segments): Change from struct to class.  Add
6443         layout_ field.  Add constructor.
6444         * script-sections.cc
6445         (Script_sections::attach_sections_using_phdrs_clause): Rename
6446         local orphan to is_orphan.  Don't report failure to put empty
6447         section in segment.  On attachment failure, report name of
6448         section, and attach to first PT_LOAD segment.
6449
6450 2011-06-28  Ian Lance Taylor  <iant@google.com>
6451
6452         PR gold/12934
6453         * target-select.cc (Target_selector::Target_selector): Add
6454         emulation parameter.  Change all callers.
6455         (select_target_by_bfd_name): Rename from select_target_by_name.
6456         Change all callers.
6457         (select_target_by_emulation): New function.
6458         (supported_emulation_names): New function.
6459         * target-select.h (class Target_selector): Add emulation_ field.
6460         Update declarations.
6461         (Target_selector::recognize_by_bfd_name): Rename from
6462         recognize_by_name.  Change all callers.
6463         (Target_selector::supported_bfd_names): Rename from
6464         supported_names.  Change all callers.
6465         (Target_selector::recognize_by_emulation): New function.
6466         (Target_selector::supported_emulations): New function.
6467         (Target_selector::emulation): New function.
6468         (Target_selector::do_recognize_by_bfd_name): Rename from
6469         do_recognize_by_name.  Change all callers.
6470         (Target_selector::do_supported_bfd_names): Rename from
6471         do_supported_names.  Change all callers.
6472         (Target_selector::do_recognize_by_emulation): New function.
6473         (Target_selector::do_supported_emulations): New function.
6474         (select_target_by_bfd_name): Change name in declaration.
6475         (select_target_by_emulation): Declare.
6476         (supported_emulation_names): Declare.
6477         * parameters.cc (parameters_force_valid_target): Try to find
6478         target based on emulation from -m option.
6479         * options.h (class General_options): Change doc string for -m.
6480         * options.cc (help): Print emulations.
6481         (General_options::parse_V): Likewise.
6482         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
6483         Add emulation parameter.  Change all callers.
6484
6485 2011-06-28  Ian Lance Taylor  <iant@google.com>
6486
6487         * target.h (class Target): Add osabi_ field.
6488         (Target::osabi): New function.
6489         (Target::set_osabi): New function.
6490         (Target::Target): Initialize osabi_.
6491         (Target::do_adjust_elf_header): Make pure virtual.
6492         (Sized_target::do_adjust_elf_header): Declare.
6493         * target.cc (Sized_target::do_adjust_elf_header): New function.
6494         (class Sized_target): Instantiate all versions.
6495         * freebsd.h (class Target_freebsd): Remove.
6496         (Target_selector_freebsd::do_recognize): Call set_osabi on
6497         Target.
6498         (Target_selector_freebsd::do_recognize_by_name): Likewise.
6499         (Target_selector_freebsd::set_osabi): Remove.
6500         * i386.cc (class Target_i386): Inherit from Sized_target rather
6501         than Target_freebsd.
6502         * x86_64.cc (class Target_x86_64): Likewise.
6503
6504 2011-06-28  Ian Lance Taylor  <iant@google.com>
6505
6506         * target.h (Target::can_check_for_function_pointers): Rewrite.
6507         Make non-virtual.
6508         (Target::can_icf_inline_merge_sections): Likewise.
6509         (Target::section_may_have_icf_unsafe_poineters): Likewise.
6510         (Target::Target_info): Add can_icf_inline_merge_sections field.
6511         (Target::do_can_check_for_function_pointers): New virtual
6512         function.
6513         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
6514         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
6515         from can_check_for_function_pointers, move in file.
6516         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
6517         section_may_have_icf_unsafe_poineters, move in file.
6518         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
6519         * i386.cc (Target_i386::do_can_check_for_function_pointers):
6520         Rename from can_check_for_function_pointers, move in file.
6521         (Target_i386::can_icf_inline_merge_sections): Remove.
6522         (Target_i386::i386_info): Initialize
6523         can_icf_inline_merge_sections.
6524         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6525         Initialize can_icf_inline_merge_sections.
6526         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
6527         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
6528         Rename from can_check_for_function_pointers, move in file.
6529         (Target_x86_64::can_icf_inline_merge_sections): Remove.
6530         (Target_x86_64::x86_64_info): Initialize
6531         can_icf_inline_merge_sections.
6532         * testsuite/testfile.cc (Target_test::test_target_info):
6533         Likewise.
6534         * icf.cc (get_section_contents): Correct formatting.
6535
6536 2011-06-27  Ian Lance Taylor  <iant@google.com>
6537
6538         * symtab.cc (Symbol::versioned_name): New function.
6539         (Symbol_table::add_to_final_symtab): Use versioned_name when
6540         appropriate.
6541         (Symbol_table::sized_write_symbol): Likewise.
6542         * symtab.h (class Symbol): Declare versioned_name.
6543         * stringpool.h (class Stringpool_template): Add variant of add
6544         which takes a std::basic_string.
6545         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
6546         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
6547         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
6548         (ver_test_12.o): New target.
6549         * testsuite/Makefile.in: Rebuild.
6550
6551 2011-06-27  Doug Kwan  <dougkwan@google.com>
6552
6553         * arm.cc (Arm_relocate_functions::thm_jump8,
6554         Arm_relocate_functions::thm_jump11): Use a wider signed
6555         type to compute offset.
6556         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
6557         arm_thm_jump8.
6558         * testsuite/Makefile.in: Regenerate.
6559         * testsuite/arm_branch_in_range.sh: Check test results of
6560         arm_thm_jump11 and arm_thm_jump8.
6561         * testsuite/arm_thm_jump11.s: New test source file.
6562         * testsuite/arm_thm_jump11.t: New linker script.
6563         * testsuite/arm_thm_jump8.s: New test source file.
6564         * testsuite/arm_thm_jump8.t: New linker script.
6565
6566 2011-06-24  Ian Lance Taylor  <iant@google.com>
6567
6568         * layout.cc: Include "object.h".
6569         (ctors_sections_in_init_array): New static variable.
6570         (Layout::is_ctors_in_init_array): New function.
6571         (Layout::layout): Add entry to ctors_sections_in_init_array if
6572         appropriate.
6573         * layout.h (class Layout): Declare is_ctors_in_init_array.
6574         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
6575         is_ctors_reverse_view is set.
6576         (Sized_relobj_file::write_sections): Add layout parameter.  Change
6577         all callers.  Set is_ctors_reverse_view field of View_size.
6578         (Sized_relobj_file::reverse_words): New function.
6579         * object.h (Sized_relobj_file::View_size): Add
6580         is_ctors_reverse_view field.
6581         (class Sized_relobj_file): Update declarations.
6582         * testsuite/initpri3.c: New test.
6583         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
6584         initpri3b.
6585         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
6586         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
6587         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
6588         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
6589         * testsuite/Makefile.in: Rebuild.
6590
6591 2011-06-24  Cary Coutant  <ccoutant@google.com>
6592
6593         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
6594         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
6595         (debug_msg_cdebug.err): New targets.
6596         * testsuite/Makefile.in: Regenerate.
6597         * testsuite/debug_msg.sh: Check output of link with compressed debug.
6598         Fix checks for link with shared library.
6599
6600 2011-06-24  Doug Kwan  <dougkwan@google.com>
6601
6602         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
6603         skip empty text sections.
6604         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
6605
6606 2011-06-22  Ian Lance Taylor  <iant@google.com>
6607
6608         PR gold/12910
6609         * options.h (class General_options): Add --ctors-in-init-array.
6610         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
6611         friends as SHT_PROGBITS for merging sections.
6612         (Layout::layout): Remove special handling of .init_array and
6613         friends.  Don't sort if doing relocatable link.  Sort for .ctors
6614         and .dtors if ctors_in_init_array.
6615         (Layout::make_output_section): Force correct section types for
6616         .init_array and friends.  Don't sort if doing relocatable link,
6617         Don't sort .ctors and .dtors if ctors_in_init_array.
6618         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
6619         (Layout::output_section_name): Add relobj parameter.  Change all
6620         callers.  Handle .ctors. and .dtors. in code rather than table.
6621         Handle .ctors and .dtors if ctors_in_init_array.
6622         (Layout::match_file_name): New function, moved from output.cc.
6623         * layout.h (class Layout): Update declarations.
6624         * output.cc: Include "layout.h".
6625         (Input_section_sort_entry::get_priority): New function.
6626         (Input_section_sort_entry::match_file_name): Just call
6627         Layout::match_file_name.
6628         (Output_section::Input_section_sort_init_fini_compare::operator()):
6629         Handle .ctors and .dtors.  Sort by explicit priority rather than
6630         by name.
6631         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
6632         * testsuite/initpri2.c: New test.
6633         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
6634         (check_PROGRAMS): Add initpri2.
6635         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
6636         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
6637         * configure, testsuite/Makefile.in: Rebuild.
6638
6639 2011-06-19  Ian Lance Taylor  <iant@google.com>
6640
6641         PR gold/12880
6642         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
6643         .interp section to a PT_INTERP segment even if we have seen a
6644         --dynamic-linker option.  Don't do it if we have seen a PHDRS
6645         clause in a linker script.
6646         (Layout::finalize): Don't create a .interp section if we've
6647         already create a PT_INTERP segment.
6648         (Layout::create_interp): Always call choose_output_section (revert
6649         patch of 2011-06-17).  Don't create PT_INTERP segment.
6650         * script-sections.cc
6651         (Script_sections::create_note_and_tls_segments): Add a .interp
6652         section to a PT_INTERP segment even if we have seen a
6653         --dynamic-linker option.
6654
6655 2011-06-18  Ian Lance Taylor  <iant@google.com>
6656
6657         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
6658         merely because a non-PT_LOAD segment has a dynamic reloc.
6659
6660 2011-06-18  Ian Lance Taylor  <iant@google.com>
6661
6662         * layout.cc (Layout::finish_dynamic_section): Don't create
6663         DT_FLAGS entry if not needed.
6664
6665 2011-06-18  Ian Lance Taylor  <iant@google.com>
6666
6667         PR gold/12745
6668         * layout.cc (Layout::layout_eh_frame): Correct handling of
6669         writable .eh_frame section.
6670
6671 2011-06-17  Ian Lance Taylor  <iant@google.com>
6672
6673         PR gold/12893
6674         * resolve.cc (Symbol_table::resolve): Don't give an error if a
6675         symbol is redefined with the exact same object and value.
6676
6677 2011-06-17  Ian Lance Taylor  <iant@google.com>
6678
6679         PR gold/12880
6680         * layout.h (class Layout): Add interp_segment_ field.
6681         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
6682         (Layout::attach_allocated_section_to_segment): If making shared
6683         library, put .interp section in PT_INTERP segment.
6684         (Layout::finalize): Also call create_interp if -dynamic-linker
6685         option was used.
6686         (Layout::create_interp): Assert that there is no PT_INTERP
6687         segment.  If not using a SECTIONS clause, use make_output_section.
6688         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
6689         * script-sections.cc
6690         (Script_sections::create_note_and_tls_segments): If making shared
6691         library, put .interp section in PT_INTERP segment.
6692
6693 2011-06-17  Ian Lance Taylor  <iant@google.com>
6694
6695         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
6696         when making a shared library.
6697
6698 2011-06-17  Ian Lance Taylor  <iant@google.com>
6699
6700         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
6701         parameter.  Change all callers.  Don't issue warning about PC32
6702         against locally defined symbol.
6703
6704 2011-06-16  Ian Lance Taylor  <iant@google.com>
6705
6706         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
6707         occurs in same object.
6708
6709 2011-06-14  Alan Modra  <amodra@gmail.com>
6710
6711         * po/POTFILES.in: Regenerate.
6712
6713 2011-06-09  Ian Lance Taylor  <iant@google.com>
6714
6715         * script-sections.cc
6716         (Orphan_output_section::set_section_addresses): For a relocatable
6717         link set address to 0.
6718
6719 2011-06-09  Cary Coutant  <ccoutant@google.com>
6720
6721         PR gold/12804
6722         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
6723         used with --compress-debug-sections.
6724         * gold/object.cc (Sized_relobj_file::do_layout): Report
6725         uncompressed size of compressed input sections.
6726
6727 2011-06-08  Cary Coutant  <ccoutant@google.com>
6728
6729         PR gold/12804
6730         * testsuite/two_file_test_2_v1.cc: Change initialization of
6731         v2 to keep it in .data.
6732
6733 2011-06-07  Cary Coutant  <ccoutant@google.com>
6734
6735         * common.cc (Symbol_table::do_allocate_commons_list): Call
6736         gold_fallback.
6737         * errors.cc (Errors::fatal): Adjust call to gold_exit.
6738         (Errors::fallback): New function.
6739         (gold_fallback): New function.
6740         * errors.h (Errors::fallback): New function.
6741         * gold.cc (gold_exit): Change status parameter to enum; adjust
6742         all callers.
6743         (queue_initial_tasks): Call gold_fallback.
6744         * gold.h: Include cstdlib.
6745         (Exit_status): New enum type.
6746         (gold_exit): Change status parameter to enum.
6747         (gold_fallback): New function.
6748         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
6749         (Layout::create_symtab_sections): Likewise.
6750         (Layout::create_shdrs): Likewise.
6751         * main.cc (main): Adjust call to gold_exit.
6752         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
6753         (Output_data_got::add_got_entry_pair): Likewise.
6754         (Output_section::add_input_section): Likewise.
6755         (Output_section::add_output_section_data): Likewise.
6756         (Output_segment::set_section_list_addresses): Likewise.
6757         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
6758
6759 2011-06-07  Cary Coutant  <ccoutant@google.com>
6760
6761         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
6762         for incremental links.
6763         * output.cc (Output_segment::set_section_list_addresses): Remove
6764         FIXME and test for TLS or BSS.
6765
6766 2011-06-07  Cary Coutant  <ccoutant@google.com>
6767
6768         * testsuite/Makefile.am: Add incremental_copy_test,
6769         incremental_common_test_1.
6770         * testsuite/Makefile.in: Regenerate.
6771         * testsuite/common_test_1_v1.c: New source file.
6772         * testsuite/common_test_1_v2.c: New source file.
6773         * testsuite/copy_test_v1.cc: New source file.
6774
6775 2011-06-07  Cary Coutant  <ccoutant@google.com>
6776
6777         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
6778         update, allocate common from bss section's free list.
6779         * incremental-dump.cc (dump_incremental_inputs): Print flag for
6780         linker-defined symbols.
6781         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
6782         Skip GOT and PLT entries that are no longer referenced.
6783         (Output_section_incremental_inputs::write_info_blocks): Mark
6784         linker-defined symbols.
6785         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
6786         * output.cc (Output_section::allocate): New function.
6787         * output.h (Output_section::allocate): New function.
6788         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
6789         linker-defined symbols.
6790         (Symbol::override_base_with_special): Copy is_predefined_ flag.
6791         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
6792         (Symbol::init_base_output_data): Likewise.
6793         (Symbol::init_base_output_segment): Likewise.
6794         (Symbol::init_base_constant): Likewise.
6795         (Sized_symbol::init_output_data): Likewise.
6796         (Sized_symbol::init_output_segment): Likewise.
6797         (Sized_symbol::init_constant): Likewise.
6798         (Symbol_table::do_define_in_output_data): Likewise.
6799         (Symbol_table::do_define_in_output_segment): Likewise.
6800         (Symbol_table::do_define_as_constant): Likewise.
6801         * symtab.h (Symbol::is_predefined): New function.
6802         (Symbol::init_base_output_data): Add is_predefined parameter.
6803         (Symbol::init_base_output_segment): Likewise.
6804         (Symbol::init_base_constant): Likewise.
6805         (Symbol::is_predefined_): New data member.
6806         (Sized_symbol::init_output_data): Add is_predefined parameter.
6807         (Sized_symbol::init_output_segment): Likewise.
6808         (Sized_symbol::init_constant): Likewise.
6809         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
6810
6811 2011-06-07  Cary Coutant  <ccoutant@google.com>
6812
6813         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
6814         instead of emit_copy_reloc.
6815         (Copy_relocs::emit_copy_reloc): Refactor.
6816         (Copy_relocs::make_copy_reloc): New function.
6817         (Copy_relocs::add_copy_reloc): Remove.
6818         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
6819         section.
6820         (Copy_relocs::make_copy_reloc): New function.
6821         (Copy_relocs::add_copy_reloc): Remove.
6822         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
6823         unchanged input files.
6824         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
6825         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
6826         Reserve BSS space for COPY relocations.
6827         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6828         (Output_section_incremental_inputs::write_info_blocks): Record
6829         whether a symbol is copied from a shared object.
6830         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
6831         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
6832         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
6833         (Incremental_input_entry_reader::get_output_symbol_index): Add
6834         is_copy parameter.
6835         (Incremental_binary::emit_copy_relocs): New function.
6836         (Incremental_binary::do_emit_copy_relocs): New function.
6837         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6838         new data member.
6839         (Sized_incremental_binary::add_copy_reloc): New function.
6840         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6841         (Sized_incremental_binary::Copy_reloc): New struct.
6842         (Sized_incremental_binary::Copy_relocs): New typedef.
6843         (Sized_incremental_binary::copy_relocs_): New data member.
6844         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
6845         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
6846         * target.h (Sized_target::emit_copy_reloc): New function.
6847         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
6848
6849 2011-06-02  Cary Coutant  <ccoutant@google.com>
6850
6851         PR gold/12163
6852         * gold/archive.cc (Archive::Archive): Initialize new data member.
6853         (Archive::include_all_members): Return if archive has already been
6854         included.
6855         * gold/archive.h (Archive::include_all_members_): New data member.
6856
6857 2011-06-02  Nick Clifton  <nickc@redhat.com>
6858
6859         * dynobj.h: Fix spelling mistake in comment.
6860         * output.cc: Likewise.
6861
6862 2011-05-31  Doug Kwan  <dougkwan@google.com>
6863             Asier Llano
6864
6865         PR gold/12826
6866         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
6867         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
6868         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
6869         redundant arm_exidx_test.so.
6870         * testsuite/Makefile.in: Regenerate.
6871         (check_SCRIPTS): Add pr12826.sh
6872         (check_DATA): Add pr12826.stdout
6873         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
6874         * testsuite/pr12826.sh: New file.
6875         * testsuite/pr12826_1.s: Ditto.
6876         * testsuite/pr12826_1.s: Ditto.
6877
6878 2011-05-30  Ian Lance Taylor  <iant@google.com>
6879
6880         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
6881         sections.
6882
6883 2011-05-29  Ian Lance Taylor  <iant@google.com>
6884
6885         PR gold/12804
6886         * testsuite/Makefile.am: Use different file name for two_file_test
6887         temporary file for each incremental test.
6888         * testsuite/Makefile.in: Rebuild.
6889
6890 2011-05-29  Ian Lance Taylor  <iant@google.com>
6891
6892         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
6893         binary input file is empty.
6894
6895 2011-05-27  Ian Lance Taylor  <iant@google.com>
6896
6897         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
6898         (ver_test_9.so): Likewise.
6899         * testsuite/Makefile.in: Rebuild.
6900
6901 2011-05-26 Cary Coutant  <ccoutant@google.com>
6902
6903         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
6904         * incremental.cc (Incremental_inputs::report_input_section): Fix
6905         comment, indentation.
6906         (Incremental_inputs::report_comdat_group): New function.
6907         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6908         of data for incremental input file entry.
6909         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
6910         group count, COMDAT group signatures.
6911         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
6912         an unchanged input file.
6913         * incremental.h (Incremental_object_entry::Incremental_object_entry):
6914         Initialize new data member.
6915         (Incremental_object_entry::add_comdat_group): New function.
6916         (Incremental_object_entry::get_comdat_group_count): New function.
6917         (Incremental_object_entry::get_comdat_signature_key): New function.
6918         (Incremental_object_entry::groups_): New data member.
6919         (Incremental_inputs::report_comdat_group): New function.
6920         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
6921         data for incremental input file entry.
6922         (Incremental_input_entry_reader::get_comdat_group_count): New function.
6923         (Incremental_input_entry_reader::get_input_section): Adjust size of
6924         data for incremental input file entry.
6925         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
6926         (Incremental_input_entry_reader::get_comdat_group_signature): New
6927         function.
6928         * object.cc (Sized_relobj::include_section_group): Report kept
6929         COMDAT groups for incremental links.
6930
6931 2011-05-24  David Meyer  <pdox@google.com>
6932
6933         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
6934         with name parameter.  Add found_name parameter.
6935         * fileread.cc (Input_file::find_file): Adjust code accordingly.
6936         * dirsearch.h (class Dirsearch): Update declaration.
6937
6938 2011-05-24  Ian Lance Taylor  <iant@google.com>
6939
6940         * archive.cc (Library_base::should_include_member): Pull in object
6941         from archive if it defines the entry symbol.
6942         * parameters.cc (Parameters::entry): New function.
6943         * parameters.h (class Parameters): Declare entry.
6944         * output.h (class Output_file_header): Remove entry_ field.
6945         * output.cc (Output_file_header::Output_file_header): Remove entry
6946         parameter.  Change all callers.
6947         (Output_file_header::entry): Use parameters->entry.
6948         * gold.cc (queue_middle_tasks): Likewise.
6949         * plugin.cc (Plugin_hook::run): Likewise.
6950
6951 2011-05-24 Cary Coutant  <ccoutant@google.com>
6952
6953         * gold.cc (queue_initial_tasks): Pass incremental base filename
6954         to Output_file::open_base_file; don't print error message.
6955         * incremental-dump.cc (main): Adjust call to
6956         Output_file::open_for_modification.
6957         * incremental-dump.cc (main): Likewise.
6958         * incremental.cc (Incremental_inputs::report_command_line):
6959         Ignore --incremental-base option when comparing command lines.
6960         Ignore parameter when given as separate argument.
6961         * options.h (class General_options): Add --incremental-base.
6962         * output.cc (Output_file::Output_file):
6963         (Output_file::open_base_file): Add base_name and writable parameters;
6964         read base file into new file; print error message here.
6965         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6966         callers.
6967         * output.h (Output_file::open_for_modification): Rename to...
6968         (Output_file::open_base_file): ...this; add base_name and
6969         writable parameters; adjust all callers.
6970         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6971         callers.
6972         * testsuite/Makefile.am (incremental_test_4): Test
6973         --incremental-base.
6974         * testsuite/Makefile.in: Regenerate.
6975
6976 2011-05-24 Cary Coutant  <ccoutant@google.com>
6977
6978         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
6979         incremental_test_4.
6980         * testsuite/Makefile.in: Regenerate.
6981         * testsuite/two_file_test_1_v1.cc: New test source file.
6982         * testsuite/two_file_test_1b_v1.cc: New test source file.
6983         * testsuite/two_file_test_2_v1.cc: New test source file.
6984
6985 2011-05-24 Cary Coutant  <ccoutant@google.com>
6986
6987         * dynobj.h (Dynobj::do_dynobj): New function.
6988         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
6989         flag and soname for shared objects.
6990         * incremental.cc (Incremental_inputs::report_object): Make
6991         either Incremental_object_entry or Incremental_dynobj_entry; add
6992         soname to string table.
6993         (Incremental_inputs::report_input_section): Add assertion.
6994         (Output_section_incremental_inputs::set_final_data_size): Adjust
6995         type of input file entry for shared libraries; adjust size of
6996         shared library info entry.
6997         (Output_section_incremental_inputs::write_input_files): Write
6998         as_needed flag for shared libraries.
6999         (Output_section_incremental_inputs::write_info_blocks): Adjust type
7000         of input file entry for shared libraries; write soname.
7001         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
7002         soname from incremental info.
7003         * incremental.h (enum Incremental_input_flags): Add
7004         INCREMENTAL_INPUT_AS_NEEDED.
7005         (Incremental_input_entry::Incremental_input_entry): Initialize new
7006         data member.
7007         (Incremental_input_entry::set_as_needed): New function.
7008         (Incremental_input_entry::as_needed): New function.
7009         (Incremental_input_entry::do_dynobj_entry): New function.
7010         (Incremental_input_entry::as_needed_): New data member.
7011         (Incremental_object_entry::Incremental_object_entry): Don't check
7012         for shared library.
7013         (Incremental_object_entry::do_type): Likewise.
7014         (class Incremental_dynobj_entry): New class.
7015         (Incremental_input_entry_reader::as_needed): New function.
7016         (Incremental_input_entry_reader::get_soname): New function.
7017         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
7018         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
7019         size of shared library info entry.
7020         * layout.cc (Layout::finish_dynamic_section): Don't test for
7021         incremental link when adding DT_NEEDED entries.
7022         * object.h (Object::Object): Initialize new data member.
7023         (Object::dynobj): New function.
7024         (Object::set_as_needed): New function.
7025         (Object::as_needed): New function.
7026         (Object::do_dynobj): New function.
7027         (Object::as_needed_): New data member.
7028
7029 2011-05-24 Cary Coutant  <ccoutant@google.com>
7030
7031         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
7032         info; adjust display of GOT entries.
7033         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7034         vector of input objects; remove file_status_.
7035         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
7036         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
7037         got_plt reader; call target hooks to reserve GOT entries.
7038         (Output_section_incremental_inputs::set_final_data_size): Adjust size
7039         of input file info header and GOT info entry.
7040         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
7041         relocation info.
7042         (Got_plt_view_info::got_descriptor): Remove.
7043         (Got_plt_view_info::sym_index): New data member.
7044         (Got_plt_view_info::input_index): New data member.
7045         (Local_got_offset_visitor::visit): Write input file index.
7046         (Global_got_offset_visitor::visit): Write 0 for input file index.
7047         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
7048         with sym_index and input_index.
7049         (Output_section_incremental_inputs::write_got_plt): Adjust size of
7050         incremental info GOT entry; replace got_descriptor with input_index.
7051         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
7052         map from input file index to object.
7053         (Sized_relobj_incr::do_layout): Replace direct data member reference
7054         with accessor function.
7055         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
7056         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
7057         Adjust size of input file info header.
7058         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
7059         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
7060         (Incremental_input_entry_reader::get_input_section): Adjust size of
7061         input file info header.
7062         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
7063         of incremental info GOT entry.
7064         (Incremental_got_plt_reader::get_got_desc): Remove.
7065         (Incremental_got_plt_reader::get_got_symndx): New function.
7066         (Incremental_got_plt_reader::get_got_input_index): New function.
7067         (Sized_incremental_binary::Sized_incremental_binary): Remove
7068         file_status_; add input_objects_.
7069         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
7070         (Sized_incremental_binary::set_file_is_unchanged): Remove.
7071         (Sized_incremental_binary::file_is_unchanged): Remove.
7072         (Sized_incremental_binary::set_input_object): New function.
7073         (Sized_incremental_binary::input_object): New function.
7074         (Sized_incremental_binary::file_status_): Remove.
7075         (Sized_incremental_binary::input_objects_): New data member.
7076         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
7077         references.
7078         (Sized_relobj_incr::invalid_address): Move to base class.
7079         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
7080         class.
7081         (Sized_relobj_incr::do_output_section_offset): Likewise.
7082         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
7083         (Sized_relobj_incr::section_offsets_): Likewise.
7084         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
7085         function.
7086         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
7087         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
7088         with accessor function.
7089         (Sized_relobj_file::do_layout): Likewise.
7090         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
7091         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
7092         (Sized_relobj_file::compute_final_local_value): Replace refs to
7093         section_offsets_ with accessor function.
7094         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
7095         * object.h (Relobj::Relobj): Initialize new data members.
7096         (Relobj::add_dyn_reloc): New function.
7097         (Relobj::first_dyn_reloc): New function.
7098         (Relobj::dyn_reloc_count): New function.
7099         (Relobj::first_dyn_reloc_): New data member.
7100         (Relobj::dyn_reloc_count_): New data member.
7101         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
7102         references.
7103         (Sized_relobj::Address): New typedef.
7104         (Sized_relobj::invalid_address): Move here from child class.
7105         (Sized_relobj::Sized_relobj): Initialize new data members.
7106         (Sized_relobj::sized_relobj): New function.
7107         (Sized_relobj::is_output_section_offset_invalid): Move here from
7108         child class.
7109         (Sized_relobj::get_output_section_offset): Likewise.
7110         (Sized_relobj::local_has_got_offset): Likewise.
7111         (Sized_relobj::local_got_offset): Likewise.
7112         (Sized_relobj::set_local_got_offset): Likewise.
7113         (Sized_relobj::do_for_all_local_got_entries): Likewise.
7114         (Sized_relobj::clear_got_offsets): New function.
7115         (Sized_relobj::section_offsets): Move here from child class.
7116         (Sized_relobj::do_output_section_offset): Likewise.
7117         (Sized_relobj::do_set_section_offset): Likewise.
7118         (Sized_relobj::Local_got_offsets): Likewise.
7119         (Sized_relobj::local_got_offsets_): Likewise.
7120         (Sized_relobj::section_offsets_): Likewise.
7121         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
7122         references.
7123         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
7124         class.
7125         (Sized_relobj_file::sized_relobj): New function
7126         (Sized_relobj_file::local_has_got_offset): Move to base class.
7127         (Sized_relobj_file::local_got_offset): Likewise.
7128         (Sized_relobj_file::set_local_got_offset): Likewise.
7129         (Sized_relobj_file::get_output_section_offset): Likewise.
7130         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
7131         (Sized_relobj_file::do_output_section_offset): Likewise.
7132         (Sized_relobj_file::do_set_section_offset): Likewise.
7133         (Sized_relobj_file::Local_got_offsets): Likewise.
7134         (Sized_relobj_file::local_got_offsets_): Likewise.
7135         (Sized_relobj_file::section_offsets_): Likewise.
7136         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
7137         (all constructors).
7138         (set_needs_dynsym_index): Convert relobj to derived class pointer.
7139         (Output_reloc::get_symbol_index): Likewise.
7140         (Output_reloc::local_section_offset): Likewise.
7141         (Output_reloc::get_address): Likewise.
7142         (Output_reloc::symbol_value): Likewise.
7143         (Output_data_got::reserve_slot): Move to class definition.
7144         (Output_data_got::reserve_local): New function.
7145         (Output_data_got::reserve_slot_for_global): Remove.
7146         (Output_data_got::reserve_global): New function.
7147         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
7148         (all constructors, two instantiations).
7149         (Output_reloc::get_relobj): New function (two instantiations).
7150         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
7151         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
7152         (Output_data_reloc::add_global): Adjust type of relobj.
7153         (Output_data_reloc::add_global_relative): Likewise.
7154         (Output_data_reloc::add_symbolless_global_addend): Likewise.
7155         (Output_data_reloc::add_local): Likewise.
7156         (Output_data_reloc::add_local_relative): Likewise.
7157         (Output_data_reloc::add_symbolless_local_addend): Likewise.
7158         (Output_data_reloc::add_local_section): Likewise.
7159         (Output_data_reloc::add_output_section): Likewise.
7160         (Output_data_reloc::add_absolute): Likewise.
7161         (Output_data_reloc::add_target_specific): Likewise.
7162         (Output_data_got::reserve_slot): Move definition here.
7163         (Output_data_got::reserve_local): New function.
7164         (Output_data_got::reserve_global): New function.
7165         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
7166         section_offsets_ with accessor function.
7167         (Sized_relobj_file::write_sections): Likewise.
7168         (Sized_relobj_file::do_relocate_sections): Likewise.
7169         * target.h (Sized_target::reserve_local_got_entry): New function.
7170         (Sized_target::reserve_global_got_entry): New function.
7171         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
7172         (Target_x86_64::reserve_global_got_entry): New function.
7173         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
7174
7175 2011-05-23 Cary Coutant  <ccoutant@google.com>
7176
7177         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
7178         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
7179         bit when checking got_type.
7180         * incremental.cc (Sized_incremental_binary::setup_readers):
7181         Store symbol table and string table locations; initialize bit vector
7182         of file status flags.
7183         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
7184         unchanged files.
7185         (Sized_incremental_binary::do_process_got_plt): New function.
7186         (Sized_incremental_binary::get_symtab_view): Use stored locations.
7187         (Output_section_incremental_inputs::set_final_data_size): Record
7188         file index for each input file.
7189         (Output_section_incremental_inputs::write_got_plt): Store file index
7190         instead of input entry offset for each GOT entry.
7191         * incremental.h
7192         (Incremental_input_entry::Incremental_input_entry): Initialize new
7193         data member.
7194         (Incremental_input_entry::set_offset): Store file index.
7195         (Incremental_input_entry::get_file_index): New function.
7196         (Incremental_input_entry::file_index_): New data member.
7197         (Incremental_binary::process_got_plt): New function.
7198         (Incremental_binary::do_process_got_plt): New function.
7199         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7200         data members.
7201         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
7202         (Sized_incremental_binary::set_file_is_unchanged): New function.
7203         (Sized_incremental_binary::file_is_unchanged): New function.
7204         (Sized_incremental_binary::do_process_got_plt): New function.
7205         (Sized_incremental_binary::file_status_): New data member.
7206         (Sized_incremental_binary::main_symtab_loc_): New data member.
7207         (Sized_incremental_binary::main_strtab_loc_): New data member.
7208         * output.cc (Output_data_got::Got_entry::write): Add case
7209         RESERVED_CODE.
7210         (Output_data_got::add_global): Call add_got_entry.
7211         (Output_data_got::add_global_plt): Likewise.
7212         (Output_data_got::add_global_with_rel): Likewise.
7213         (Output_data_got::add_global_with_rela): Likewise.
7214         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
7215         (Output_data_got::add_global_pair_with_rela): Likewise.
7216         (Output_data_got::add_local): Call add_got_entry.
7217         (Output_data_got::add_local_plt): Likewise.
7218         (Output_data_got::add_local_with_rel): Likewise.
7219         (Output_data_got::add_local_with_rela): Likewise.
7220         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
7221         (Output_data_got::add_local_pair_with_rela): Likewise.
7222         (Output_data_got::reserve_slot): New function.
7223         (Output_data_got::reserve_slot_for_global): New function.
7224         (Output_data_got::add_got_entry): New function.
7225         (Output_data_got::add_got_entry_pair): New function.
7226         (Output_section::add_output_section_data): Edit FIXME.
7227         * output.h
7228         (Output_section_data_build::Output_section_data_build): New
7229         constructor with size parameter.
7230         (Output_data_space::Output_data_space): Likewise.
7231         (Output_data_got::Output_data_got): Initialize new data member; new
7232         constructor with size parameter.
7233         (Output_data_got::add_constant): Call add_got_entry.
7234         (Output_data_got::reserve_slot): New function.
7235         (Output_data_got::reserve_slot_for_global): New function.
7236         (class Output_data_got::Got_entry): Add RESERVED_CODE.
7237         (Output_data_got::add_got_entry): New function.
7238         (Output_data_got::add_got_entry_pair): New function.
7239         (Output_data_got::free_list_): New data member.
7240         * target.h (Sized_target::init_got_plt_for_update): New function.
7241         (Sized_target::register_global_plt_entry): New function.
7242         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
7243         Initialize new data member; call init; add constructor with PLT count.
7244         (Output_data_plt_x86_64::init): New function.
7245         (Output_data_plt_x86_64::add_relocation): New function.
7246         (Output_data_plt_x86_64::reserve_slot): New function.
7247         (Output_data_plt_x86_64::free_list_): New data member.
7248         (Target_x86_64::init_got_plt_for_update): New function.
7249         (Target_x86_64::register_global_plt_entry): New function.
7250         (Output_data_plt_x86_64::add_entry): Allocate from free list for
7251         incremental updates.
7252         (Output_data_plt_x86_64::add_relocation): New function.
7253         * testsuite/object_unittest.cc (Object_test): Set default options.
7254
7255 2011-05-16  Ian Lance Taylor  <iant@google.com>
7256
7257         * options.h (class General_options): Make -i a synonym for -r.
7258
7259 2011-05-16  Ian Lance Taylor  <iant@google.com>
7260
7261         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
7262
7263 2011-05-10 Cary Coutant  <ccoutant@google.com>
7264
7265         * object.cc (Sized_relobj::do_count_local_symbols): Check for
7266         strip_all (-s).
7267
7268 2011-05-06  Ian Lance Taylor  <iant@google.com>
7269
7270         * layout.cc (Layout::layout): If the output section flags change,
7271         update the ordering.
7272
7273 2011-04-25 Cary Coutant  <ccoutant@google.com>
7274
7275         * incremental-dump.cc (dump_incremental_inputs): Print local
7276         symbol info for each input file.
7277         * incremental.cc
7278         (Output_section_incremental_inputs::set_final_data_size): Add local
7279         symbol info to input file entries in incremental info.
7280         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7281         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
7282         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
7283         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
7284         implementation.
7285         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
7286         (Sized_incr_relobj::do_relocate): Write the local symbols.
7287         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
7288         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
7289         Adjust size of input file header.
7290         (Incremental_inputs_reader::get_local_symbol_offset): New function.
7291         (Incremental_inputs_reader::get_local_symbol_count): New function.
7292         (Incremental_inputs_reader::get_input_section): Adjust size of input
7293         file header.
7294         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
7295         (Sized_incr_relobj::This): New typedef.
7296         (Sized_incr_relobj::sym_size): New const data member.
7297         (Sized_incr_relobj::Local_symbol): New struct.
7298         (Sized_incr_relobj::do_output_local_symbol_count): New function.
7299         (Sized_incr_relobj::do_local_symbol_offset): New function.
7300         (Sized_incr_relobj::local_symbol_count_): New data member.
7301         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
7302         (Sized_incr_relobj::local_symbol_index_): New data member.
7303         (Sized_incr_relobj::local_symbol_offset_): New data member.
7304         (Sized_incr_relobj::local_dynsym_offset_): New data member.
7305         (Sized_incr_relobj::local_symbols_): New data member.
7306         * object.h (Relobj::output_local_symbol_count): New function.
7307         (Relobj::local_symbol_offset): New function.
7308         (Relobj::do_output_local_symbol_count): New function.
7309         (Relobj::do_local_symbol_offset): New function.
7310         (Sized_relobj::do_output_local_symbol_count): New function.
7311         (Sized_relobj::do_local_symbol_offset): New function.
7312
7313 2011-04-22  Vladimir Simonov  <sv@sw.ru>
7314
7315         * descriptors.cc (set_close_on_exec): New function.
7316         (Descriptors::open): Use set_close_on_exec.
7317         * output.cc (S_ISLNK): Define if not defined.
7318
7319 2011-04-22 Cary Coutant  <ccoutant@google.com>
7320
7321         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7322         global symbol map.
7323         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7324         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
7325         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
7326         relocations.
7327         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
7328         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
7329         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
7330         * incremental.h
7331         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
7332         function.
7333         (Incremental_binary::apply_incremental_relocs): New function.
7334         (Incremental_binary::do_apply_incremental_relocs): New function.
7335         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7336         data member.
7337         (Sized_incremental_binary::add_global_symbol): New function.
7338         (Sized_incremental_binary::global_symbol): New function.
7339         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7340         (Sized_incremental_binary::symbol_map_): New data member.
7341         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
7342         * target.h (Sized_target::apply_relocation): New function.
7343         * target-reloc.h (apply_relocation): New function.
7344         * x86_64.cc (Target_x86_64::apply_relocation): New function.
7345
7346 2011-04-22  Doug Kwan  <dougkwan@google.com>
7347
7348         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
7349         flag of a SHT_ARM_EXIDX section.
7350         * testsuite/Makefile.am (arm_exidx_test): New test rules.
7351         * testsuite/Makefile.in: Regenerate.
7352         * testsuite/arm_exidx_test.s: New file.
7353         * testsuite/arm_exidx_test.sh: Same.
7354
7355 2011-04-20 Cary Coutant  <ccoutant@google.com>
7356
7357         PR gold/12689
7358         * archive.h (Incremental_archive_entry::Archive_member):
7359         Initialize arg_serial_ (second constructor).
7360
7361 2011-04-17  Ian Lance Taylor  <iant@google.com>
7362
7363         * object.cc (Relocate_info::location): Simplify location string.
7364         * errors.cc (Errors::error_at_location): Don't print program
7365         name.
7366         (Errors::warning_at_location): Likewise.
7367         (Errors::undefined_symbol): Likewise.
7368         * testsuite/debug_msg.sh: Update accordingly.
7369
7370 2011-04-14 Cary Coutant  <ccoutant@google.com>
7371
7372         * gold/layout.cc (Layout::symtab_section_offset): New function.
7373         * gold/layout.h (Layout::symtab_section_offset): New function.
7374         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
7375
7376 2011-04-12  Ian Lance Taylor  <iant@google.com>
7377
7378         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
7379         with MREMAP_MAYMOVE.
7380         * output.h (class Output_file): Add map_is_allocated_ field.
7381         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
7382         not available, provide stubs.  If mremap is not available, #define
7383         it to gold_mremap.
7384         (MREMAP_MAYMOVE): Define if not defined.
7385         (Output_file::Output_file): Initialize map_is_allocated_.
7386         (Output_file::resize): Check map_is_allocated_.
7387         (Output_file::map_anonymous): If mmap fails, use malloc.
7388         (Output_file::unmap): Don't do anything for an anonymous map.
7389         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
7390         is not available, provide stubs.
7391         (File_read::View::~View): Use free rather than delete[].
7392         (File_read::make_view): Use malloc rather than new[].  If mmap
7393         fails, use malloc.
7394         (File_read::find_or_make_view): Use malloc rather than new[].
7395         * gold.h: Remove HAVE_REMAP code.
7396         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
7397         exists.  Rename mremap to gold_mremap.  If mmap is not available
7398         don't do anything.
7399         * configure, config.in: Rebuild.
7400
7401 2011-04-11  Ian Lance Taylor  <iant@google.com>
7402
7403         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
7404         initialize local variable v.
7405
7406 2011-04-11  Cary Coutant  <ccoutant@google.com>
7407
7408         * archive.cc (Archive::include_member): Adjust call to
7409         report_object.
7410         (Add_archive_symbols::run): Track argument serial numbers.
7411         (Lib_group::include_member): Likewise.
7412         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
7413         * archive.h (Incremental_archive_entry::Archive_member):
7414         Initialize arg_serial_.
7415         (Archive_member::arg_serial_): New data member.
7416         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
7417         (Sized_dynobj::do_add_symbols): Track symbols when doing an
7418         incremental link.
7419         (Sized_dynobj::do_for_all_local_got_entries): New function.
7420         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
7421         function.
7422         * fileread.cc (get_mtime): New function.
7423         * fileread.h (get_mtime): New function.
7424         * gold.cc (queue_initial_tasks): Check for incremental update.
7425         (process_incremental_input): New function.
7426         (queue_middle_tasks): Don't force valid target for incremental
7427         update.
7428         * incremental-dump.cc (find_input_containing_global): Adjust
7429         size of symbol info entry.
7430         (dump_incremental_inputs): Dump argument serial number and
7431         in_system_directory flag; bias shndx by 1; print symbol names
7432         when dumping per-file symbol lists; use new symbol info readers.
7433         * incremental.cc
7434         (Output_section_incremental_inputs:update_data_size): New function.
7435         (Sized_incremental_binary::setup_readers): Setup input readers
7436         for each input file; build maps for files added from libraries
7437         and scripts.
7438         (Sized_incremental_binary::check_input_args): New function.
7439         (Sized_incremental_binary::do_check_inputs): Build map of argument
7440         serial numbers to input arguments.
7441         (Sized_incremental_binary::do_file_has_changed): Rename
7442         do_file_is_unchanged to this; compare file modification times.
7443         (Sized_incremental_binary::do_init_layout): New function.
7444         (Sized_incremental_binary::do_reserve_layout): New function.
7445         (Sized_incremental_binary::do_get_input_reader): Remove.
7446         (Sized_incremental_binary::get_symtab_view): New function.
7447         (Incremental_checker::can_incrementally_link_output_file): Remove.
7448         (Incremental_inputs::report_command_line): Exclude --debug options.
7449         (Incremental_inputs::report_archive_begin): Add parameter; track
7450         argument serial numbers; don't put input file entry for archive
7451         before archive members.
7452         (Incremental_inputs::report_archive_end): Put input file entry
7453         for archive after archive members.
7454         (Incremental_inputs::report_object): Add parameter; track argument
7455         serial numbers and in_system_directory flag.
7456         (Incremental_inputs::report_script): Add parameter; track argument
7457         serial numbers.
7458         (Output_section_incremental_inputs::set_final_data_size): Adjust
7459         size of symbol info entry; check for forwarding symbols.
7460         (Output_section_incremental_inputs::write_input_files): Write
7461         in_system_directory flag and argument serial number.
7462         (Output_section_incremental_inputs::write_info_blocks): Map section
7463         indices between incremental info and original input file; store
7464         input section index for each symbol.
7465         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
7466         change operator() to visit().
7467         (class Global_got_offset_visitor): Likewise.
7468         (class Global_symbol_visitor_got_plt):
7469         (Output_section_incremental_inputs::write_got_plt): Use new visitor
7470         classes.
7471         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
7472         (Sized_incr_relobj::do_read_symbols): New function.
7473         (Sized_incr_relobj::do_layout): New function.
7474         (Sized_incr_relobj::do_layout_deferred_sections): New function.
7475         (Sized_incr_relobj::do_add_symbols): New function.
7476         (Sized_incr_relobj::do_should_include_member): New function.
7477         (Sized_incr_relobj::do_for_all_global_symbols): New function.
7478         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
7479         (Sized_incr_relobj::do_section_size): New function.
7480         (Sized_incr_relobj::do_section_name): New function.
7481         (Sized_incr_relobj::do_section_contents): New function.
7482         (Sized_incr_relobj::do_section_flags): New function.
7483         (Sized_incr_relobj::do_section_entsize): New function.
7484         (Sized_incr_relobj::do_section_address): New function.
7485         (Sized_incr_relobj::do_section_type): New function.
7486         (Sized_incr_relobj::do_section_link): New function.
7487         (Sized_incr_relobj::do_section_info): New function.
7488         (Sized_incr_relobj::do_section_addralign): New function.
7489         (Sized_incr_relobj::do_initialize_xindex): New function.
7490         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
7491         (Sized_incr_relobj::do_read_relocs): New function.
7492         (Sized_incr_relobj::do_gc_process_relocs): New function.
7493         (Sized_incr_relobj::do_scan_relocs): New function.
7494         (Sized_incr_relobj::do_count_local_symbols): New function.
7495         (Sized_incr_relobj::do_finalize_local_symbols): New function.
7496         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
7497         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
7498         (Sized_incr_relobj::do_relocate): New function.
7499         (Sized_incr_relobj::do_set_section_offset): New function.
7500         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
7501         (Sized_incr_dynobj::do_read_symbols): New function.
7502         (Sized_incr_dynobj::do_layout): New function.
7503         (Sized_incr_dynobj::do_add_symbols): New function.
7504         (Sized_incr_dynobj::do_should_include_member): New function.
7505         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
7506         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
7507         (Sized_incr_dynobj::do_section_size): New function.
7508         (Sized_incr_dynobj::do_section_name): New function.
7509         (Sized_incr_dynobj::do_section_contents): New function.
7510         (Sized_incr_dynobj::do_section_flags): New function.
7511         (Sized_incr_dynobj::do_section_entsize): New function.
7512         (Sized_incr_dynobj::do_section_address): New function.
7513         (Sized_incr_dynobj::do_section_type): New function.
7514         (Sized_incr_dynobj::do_section_link): New function.
7515         (Sized_incr_dynobj::do_section_info): New function.
7516         (Sized_incr_dynobj::do_section_addralign): New function.
7517         (Sized_incr_dynobj::do_initialize_xindex): New function.
7518         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
7519         (make_sized_incremental_object): New function.
7520         (Incremental_library::copy_unused_symbols): New function.
7521         (Incremental_library::do_for_all_unused_symbols): New function.
7522         * incremental.h (enum Incremental_input_flags): New type.
7523         (class Incremental_checker): Remove.
7524         (Incremental_input_entry::Incremental_input_entry): Add argument
7525         serial number.
7526         (Incremental_input_entry::arg_serial): New function.
7527         (Incremental_input_entry::set_is_in_system_directory): New function.
7528         (Incremental_input_entry::is_in_system_directory): New function.
7529         (Incremental_input_entry::arg_serial_): New data member.
7530         (Incremental_input_entry::is_in_system_directory_): New data member.
7531         (class Script_info): Move here from script.h.
7532         (Script_info::Script_info): Add filename parameter.
7533         (Script_info::filename): New function.
7534         (Script_info::filename_): New data member.
7535         (Incremental_script_entry::Incremental_script_entry): Add argument
7536         serial number.
7537         (Incremental_object_entry::Incremental_object_entry): Likewise.
7538         (Incremental_object_entry::add_input_section): Build list of input
7539         sections with map to original shndx.
7540         (Incremental_object_entry::get_input_section_index): New function.
7541         (Incremental_object_entry::shndx_): New data member.
7542         (Incremental_object_entry::name_key_): Rename; adjust all refs.
7543         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
7544         (Incremental_archive_entry::Incremental_archive_entry): Add argument
7545         serial number.
7546         (Incremental_inputs::report_archive_begin): Likewise.
7547         (Incremental_inputs::report_object): Likewise.
7548         (Incremental_inputs::report_script): Likewise.
7549         (class Incremental_global_symbol_reader): New class.
7550         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
7551         and store flags and input file type.
7552         (Incremental_input_entry_reader::arg_serial): New function.
7553         (Incremental_input_entry_reader::type): Extract type from flags.
7554         (Incremental_input_entry_reader::is_in_system_directory): New function.
7555         (Incremental_input_entry_reader::get_input_section_count): Call
7556         accessor function for type.
7557         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
7558         function for type; adjust size of global symbol entry.
7559         (Incremental_input_entry_reader::get_global_symbol_count): Call
7560         accessor function for type.
7561         (Incremental_input_entry_reader::get_object_count): Likewise.
7562         (Incremental_input_entry_reader::get_object_offset): Likewise.
7563         (Incremental_input_entry_reader::get_member_count): Likewise.
7564         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
7565         (Incremental_input_entry_reader::get_member_offset): Likewise.
7566         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
7567         (Incremental_input_entry_reader::Global_symbol_info): Remove.
7568         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
7569         (Incremental_input_entry_reader::get_global_symbol_reader): New
7570         function.
7571         (Incremental_input_entry_reader::get_output_symbol_index): New
7572         function.
7573         (Incremental_input_entry_reader::type_): Remove.
7574         (Incremental_input_entry_reader::flags_): New data member.
7575         (Incremental_inputs_reader::input_file_offset): New function.
7576         (Incremental_inputs_reader::input_file_index): New function.
7577         (Incremental_inputs_reader::input_file): Call input_file_offset.
7578         (Incremental_inputs_reader::input_file_at_offset): New function.
7579         (Incremental_relocs_reader::get_r_type): Reformat.
7580         (Incremental_relocs_reader::get_r_shndx): Reformat.
7581         (Incremental_relocs_reader::get_r_offset): Reformat.
7582         (Incremental_relocs_reader::data): New function.
7583         (Incremental_binary::Incremental_binary): Initialize new data members.
7584         (Incremental_binary::check_inputs): Add cmdline parameter.
7585         (Incremental_binary::file_is_unchanged): Remove.
7586         (Input_reader::arg_serial): New function.
7587         (Input_reader::get_unused_symbol_count): New function.
7588         (Input_reader::get_unused_symbol): New function.
7589         (Input_reader::do_arg_serial): New function.
7590         (Input_reader::do_get_unused_symbol_count): New function.
7591         (Input_reader::do_get_unused_symbol): New function.
7592         (Incremental_binary::input_file_count): New function.
7593         (Incremental_binary::get_input_reader): Change signature to use
7594         index instead of filename.
7595         (Incremental_binary::file_has_changed): New function.
7596         (Incremental_binary::get_input_argument): New function.
7597         (Incremental_binary::get_library): New function.
7598         (Incremental_binary::get_script_info): New function.
7599         (Incremental_binary::init_layout): New function.
7600         (Incremental_binary::reserve_layout): New function.
7601         (Incremental_binary::output_file): New function.
7602         (Incremental_binary::do_check_inputs): New function.
7603         (Incremental_binary::do_file_is_unchanged): Remove.
7604         (Incremental_binary::do_file_has_changed): New function.
7605         (Incremental_binary::do_init_layout): New function.
7606         (Incremental_binary::do_reserve_layout): New function.
7607         (Incremental_binary::do_input_file_count): New function.
7608         (Incremental_binary::do_get_input_reader): Change signature.
7609         (Incremental_binary::input_args_map_): New data member.
7610         (Incremental_binary::library_map_): New data member.
7611         (Incremental_binary::script_map_): New data member.
7612         (Sized_incremental_binary::Sized_incremental_binary): Initialize
7613         new data members.
7614         (Sized_incremental_binary::output_section): New function.
7615         (Sized_incremental_binary::inputs_reader): Add const.
7616         (Sized_incremental_binary::symtab_reader): Add const.
7617         (Sized_incremental_binary::relocs_reader): Add const.
7618         (Sized_incremental_binary::got_plt_reader): Add const.
7619         (Sized_incremental_binary::get_symtab_view): New function.
7620         (Sized_incremental_binary::Inputs_reader): New typedef.
7621         (Sized_incremental_binary::Input_entry_reader): New typedef.
7622         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
7623         (Sized_incremental_binary::do_file_is_unchanged): Remove.
7624         (Sized_incremental_binary::do_file_has_changed): New function.
7625         (Sized_incremental_binary::do_init_layout): New function.
7626         (Sized_incremental_binary::do_reserve_layout): New function.
7627         (Sized_input_reader::Inputs_reader): Remove.
7628         (Sized_input_reader::Input_entry_reader): Remove.
7629         (Sized_input_reader::do_arg_serial): New function.
7630         (Sized_input_reader::do_get_unused_symbol_count): New function.
7631         (Sized_input_reader::do_get_unused_symbol): New function.
7632         (Sized_incremental_binary::do_input_file_count): New function.
7633         (Sized_incremental_binary::do_get_input_reader): Change signature;
7634         use index instead of filename.
7635         (Sized_incremental_binary::section_map_): New data member.
7636         (Sized_incremental_binary::input_entry_readers_): New data member.
7637         (class Sized_incr_relobj): New class.
7638         (class Sized_incr_dynobj): New class.
7639         (make_sized_incremental_object): New function.
7640         (class Incremental_library): New class.
7641         * layout.cc (Free_list::num_lists): New static data member.
7642         (Free_list::num_nodes): New static data member.
7643         (Free_list::num_removes): New static data member.
7644         (Free_list::num_remove_visits): New static data member.
7645         (Free_list::num_allocates): New static data member.
7646         (Free_list::num_allocate_visits): New static data member.
7647         (Free_list::init): New function.
7648         (Free_list::remove): New function.
7649         (Free_list::allocate): New function.
7650         (Free_list::dump): New function.
7651         (Free_list::print_stats): New function.
7652         (Layout_task_runner::run): Resize output file for incremental updates.
7653         (Layout::Layout): Initialize new data members.
7654         (Layout::set_incremental_base): New function.
7655         (Layout::init_fixed_output_section): New function.
7656         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
7657         incremental updates.
7658         (Layout::create_gold_note): Do not create gold note section for
7659         incremental updates.
7660         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
7661         for incremental updates.
7662         (Layout::set_section_offsets): For incremental updates, allocate space
7663         from free list.
7664         (Layout::create_symtab_sections): Layout with offsets relative to
7665         start of section; for incremental updates, allocate space from free
7666         list.
7667         (Layout::create_shdrs): For incremental updates, allocate space from
7668         free list.
7669         (Layout::finish_dynamic_section): For incremental updates, do not
7670         check --as-needed (fixed in subsequent patch).
7671         * layout.h (class Free_list): New class.
7672         (Layout::set_incremental_base): New function.
7673         (Layout::incremental_base): New function.
7674         (Layout::init_fixed_output_section): New function.
7675         (Layout::allocate): New function.
7676         (Layout::incremental_base_): New data member.
7677         (Layout::free_list_): New data member.
7678         * main.cc (main): Print Free_list statistics.
7679         * object.cc (Relobj::finalize_incremental_relocs): Add
7680         clear_counts parameter; clear counts only when clear_counts is set.
7681         (Sized_relobj::Sized_relobj): Initialize new base class.
7682         (Sized_relobj::do_layout): Don't report special sections.
7683         (Sized_relobj::do_for_all_local_got_entries): New function.
7684         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
7685         symtab_off to all symbol table offsets.
7686         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
7687         * object.h (class Got_offset_list): Move to top of file.
7688         (Object::Object): Allow case where input_file == NULL.
7689         (Object::~Object): Likewise.
7690         (Object::input_file): Assert that input_file != NULL.
7691         (Object::lock): Allow case where input_file == NULL.
7692         (Object::unlock): Likewise.
7693         (Object::is_locked): Likewise.
7694         (Object::token): Likewise.
7695         (Object::release): Likewise.
7696         (Object::is_incremental): New function.
7697         (Object::get_mtime): New function.
7698         (Object::for_all_local_got_entries): New function.
7699         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
7700         (Object::set_is_in_system_directory): New function.
7701         (Object::is_in_system_directory): New function.
7702         (Object::do_is_incremental): New function.
7703         (Object::do_get_mtime): New function.
7704         (Object::do_for_all_local_got_entries): New function.
7705         (Object::is_in_system_directory_): New data member.
7706         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
7707         (class Sized_relobj_base): New class.
7708         (class Sized_relobj): Derive from Sized_relobj_base.
7709         (class Sized_relobj::Symbols): Redeclare from base class.
7710         (class Sized_relobj::local_got_offset_list): Remove.
7711         (class Sized_relobj::Output_sections): Redeclare from base class.
7712         (class Sized_relobj::do_for_all_local_got_entries): New function.
7713         (class Sized_relobj::write_local_symbols): Add offset parameter.
7714         (class Sized_relobj::local_symbol_offset_): Update comment.
7715         (class Sized_relobj::local_dynsym_offset_): Update comment.
7716         * options.cc (Input_arguments::add_file): Remove const.
7717         * options.h (Input_file_argument::Input_file_argument):
7718         Initialize arg_serial_ (all constructors).
7719         (Input_file_argument::set_arg_serial): New function.
7720         (Input_file_argument::arg_serial): New function.
7721         (Input_file_argument::arg_serial_): New data member.
7722         (Input_arguments::Input_arguments): Initialize file_count_.
7723         (Input_arguments::add_file): Remove const.
7724         (Input_arguments::number_of_input_files): New function.
7725         (Input_arguments::file_count_): New data member.
7726         (Command_line::number_of_input_files): Call
7727         Input_arguments::number_of_input_files.
7728         * output.cc (Output_segment_headers::Output_segment_headers):
7729         Set current size.
7730         (Output_section::Input_section::current_data_size): New function.
7731         (Output_section::Output_section): Initialize new data members.
7732         (Output_section::add_input_section): Don't do merge sections for
7733         an incremental link; allocate space from free list for an
7734         incremental update.
7735         (Output_section::add_output_section_data): Allocate space from
7736         free list for an incremental update.
7737         (Output_section::update_data_size): New function.
7738         (Output_section::set_fixed_layout): New function.
7739         (Output_section::reserve): New function.
7740         (Output_segment::set_section_addresses): Remove const.
7741         (Output_segment::set_section_list_addresses): Remove const; allocate
7742         space from free list for an incremental update.
7743         (Output_segment::set_offset): Adjust size of RELRO segment for an
7744         incremental update.
7745         * output.h (Output_data::current_data_size): Move here from
7746         child classes.
7747         (Output_data::pre_finalize_data_size): New function.
7748         (Output_data::update_data_size): New function.
7749         (Output_section_headers::update_data_size): new function.
7750         (Output_section_data_build::current_data_size): Move to Output_data.
7751         (Output_data_strtab::update_data_size): New function.
7752         (Output_section::current_data_size): Move to Output_data.
7753         (Output_section::set_fixed_layout): New function.
7754         (Output_section::has_fixed_layout): New function.
7755         (Output_section::reserve): New function.
7756         (Output_section::update_data_size): New function.
7757         (Output_section::has_fixed_layout_): New data member.
7758         (Output_section::free_list_): New data member.
7759         (Output_segment::set_section_addresses): Remove const.
7760         (Output_segment::set_section_list_addresses): Remove const.
7761         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
7762         New function.
7763         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
7764         New function.
7765         * readsyms.cc (Read_symbols::do_read_symbols): Add library
7766         parameter when calling Add_symbols constructor; store argument
7767         serial number for members of a lib group.
7768         (Add_symbols::locks): Allow case where token == NULL.
7769         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
7770         (Read_member::~Read_member): New function.
7771         (Read_member::is_runnable): New function.
7772         (Read_member::locks): New function.
7773         (Read_member::run): New function.
7774         (Check_script::~Check_script): New function.
7775         (Check_script::is_runnable): New function.
7776         (Check_script::locks): New function.
7777         (Check_script::run): New function.
7778         (Check_library::~Check_library): New function.
7779         (Check_library::is_runnable): New function.
7780         (Check_library::locks): New function.
7781         (Check_library::run): New function.
7782         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
7783         (Add_symbols::library_): New data member.
7784         (class Read_member): New class.
7785         (class Check_script): New class.
7786         (class Check_library): New class.
7787         * reloc.cc (Read_relocs::is_runnable): Allow case where
7788         token == NULL.
7789         (Read_relocs::locks): Likewise.
7790         (Scan_relocs::locks): Likewise.
7791         (Relocate_task::locks): Likewise.
7792         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
7793         to clear counters.
7794         (Sized_relobj::incremental_relocs_scan): Fix comment.
7795         (Sized_relobj::do_relocate): Pass output file offset to
7796         write_local_symbols.
7797         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
7798         from class declaration.
7799         * script.cc (read_input_script): Allocate Script_info; pass
7800         argument serial number to report_script.
7801         * script.h (class Script_info): Move to incremental.h.
7802         * symtab.cc (Symbol_table::add_from_incrobj): New function.
7803         * symtab.h (Symbol_table::add_from_incrobj): New function.
7804         (Symbol_table::set_file_offset): New function.
7805
7806 2011-04-05  Cary Coutant  <ccoutant@google.com>
7807
7808         * incremental-dump.cc (dump_incremental_inputs): Change signature
7809         to take a Sized_incremental_binary; change caller.  Use readers
7810         in Sized_incremental_binary.
7811         * incremental.cc
7812         (Sized_incremental_binary::find_incremental_inputs_sections):
7813         Rename do_find_incremental_inputs_sections to this.
7814         (Sized_incremental_binary::setup_readers): New function.
7815         (Sized_incremental_binary::do_check_inputs): Check
7816         has_incremental_info_ flag; move setup code to setup_readers;
7817         use input readers.
7818         (Sized_incremental_binary::do_file_is_unchanged): New function.
7819         (Sized_incremental_binary::do_get_input_reader): New function.
7820         * incremental.h (class Incremental_binary): Move to end of file.
7821         (Incremental_binary::file_is_unchanged): New function.
7822         (Incremental_binary::do_file_is_unchanged): New function.
7823         (Incremental_binary::Input_reader): New class.
7824         (Incremental_binary::get_input_reader): New function.
7825         (class Sized_incremental_binary): Move to end of file.
7826         (Sized_incremental_binary::Sized_incremental_binary): Setup the
7827         input section reader classes.
7828         (Sized_incremental_binary::has_incremental_info): New function.
7829         (Sized_incremental_binary::inputs_reader): New function.
7830         (Sized_incremental_binary::symtab_reader): New function.
7831         (Sized_incremental_binary::relocs_reader): New function.
7832         (Sized_incremental_binary::got_plt_reader): New function.
7833         (Sized_incremental_binary::do_file_is_unchanged): New function.
7834         (Sized_incremental_binary::Sized_input_reader): New class.
7835         (Sized_incremental_binary::get_input_reader): New function.
7836         (Sized_incremental_binary::find_incremental_inputs_sections):
7837         Rename do_find_incremental_inputs_sections to this.
7838         (Sized_incremental_binary::setup_readers): New function.
7839         (Sized_incremental_binary::has_incremental_info_): New data member.
7840         (Sized_incremental_binary::inputs_reader_): New data member.
7841         (Sized_incremental_binary::symtab_reader_): New data member.
7842         (Sized_incremental_binary::relocs_reader_): New data member.
7843         (Sized_incremental_binary::got_plt_reader_): New data member.
7844         (Sized_incremental_binary::current_input_file_): New data member.
7845
7846 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
7847
7848         PR gold/12640
7849         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
7850         violation.
7851
7852 2011-03-30  Cary Coutant  <ccoutant@google.com>
7853
7854         * archive.cc (Archive::include_member): Adjust call to report_object.
7855         (Add_archive_symbols::run): Add script_info to call to
7856         report_archive_begin.
7857         (Lib_group::include_member): Adjust call to report_object.
7858         (Add_lib_group_symbols::run): Adjust call to report_object.
7859         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
7860         blocks.  Add object count for script input files.
7861         * incremental.cc (Incremental_inputs::report_archive_begin): Add
7862         script_info parameter; change all callers.
7863         (Incremental_inputs::report_object): Add script_info parameter;
7864         change all callers.
7865         (Incremental_inputs::report_script): Store backpointer to
7866         incremental info entry.
7867         (Output_section_incremental_inputs::set_final_data_size): Record
7868         additional information for scripts.
7869         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7870         * incremental.h (Incremental_script_entry::add_object): New function.
7871         (Incremental_script_entry::get_object_count): New function.
7872         (Incremental_script_entry::get_object): New function.
7873         (Incremental_script_entry::objects_): New data member; adjust
7874         constructor.
7875         (Incremental_inputs::report_archive_begin): Add script_info parameter.
7876         (Incremental_inputs::report_object): Add script_info parameter.
7877         (Incremental_inputs_reader::get_object_count): New function.
7878         (Incremental_inputs_reader::get_object_offset): New function.
7879         * options.cc (Input_arguments::add_file): Return reference to
7880         new input argument.
7881         * options.h (Input_argument::set_script_info): New function.
7882         (Input_argument::script_info): New function.
7883         (Input_argument::script_info_): New data member; adjust all
7884         constructors.
7885         (Input_file_group::add_file): Return reference to new input argument.
7886         (Input_file_lib::add_file): Likewise.
7887         (Input_arguments::add_file): Likewise.
7888         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
7889         * script.cc (Parser_closure::Parser_closure): Add script_info
7890         parameter; adjust all callers.
7891         (Parser_closure::script_info): New function.
7892         (Parser_closure::script_info_): New data member.
7893         (read_input_script): Report scripts earlier to incremental info.
7894         (script_add_file): Set script_info in Input_argument.
7895         (script_add_library): Likewise.
7896         * script.h (Script_options::Script_info): Rewrite class.
7897
7898 2011-03-29  Cary Coutant  <ccoutant@google.com>
7899
7900         * archive.cc (Library_base::should_include_member): Move
7901         method here from class Archive.
7902         (Archive::Archive): Initialize base class.
7903         (Archive::should_include_member): Move to base class.
7904         (Archive::do_for_all_unused_symbols): New function.
7905         (Add_archive_symbols::run): Remove redundant access to
7906         incremental_inputs.
7907         (Lib_group::Lib_group): Initialize base class.
7908         (Lib_group::do_filename): New function.
7909         (Lib_group::include_member): Pass pointer to Lib_group to
7910         report_object.
7911         (Lib_group::do_for_all_unused_symbols): New function.
7912         (Add_lib_group_symbols::run): Report archive information for
7913         incremental links.
7914         * archive.h (class Library_base): New base class.
7915         (class Archive): Derive from Library_base.
7916         (Archive::filename): Move to base class.
7917         (Archive::set_incremental_info): Likewise.
7918         (Archive::incremental_info): Likewise.
7919         (Archive::Should_include): Likewise.
7920         (Archive::should_include_member): Likewise.
7921         (Archive::Armap_entry): Remove.
7922         (Archive::Unused_symbol_iterator): Remove.
7923         (Archive::unused_symbols_begin): Remove.
7924         (Archive::unused_symbols_end): Remove.
7925         (Archive::do_filename): New function.
7926         (Archive::do_get_mtime): New function.
7927         (Archive::do_for_all_unused_symbols): New function.
7928         (Archive::task_): Move to base class.
7929         (Archive::incremental_info_): Likewise.
7930         (class Lib_group): Derive from Library_base.
7931         (Lib_group::do_filename): New function.
7932         (Lib_group::do_get_mtime): New function.
7933         (Lib_group::do_for_all_unused_symbols): New function.
7934         (Lib_group::task_): Move to base class.
7935         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
7936         function.
7937         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
7938         function.
7939         * incremental.cc (Incremental_inputs::report_archive_begin):
7940         Use Library_base; call library's get_mtime; add incremental inputs
7941         entry before members.
7942         (class Unused_symbol_visitor): New class.
7943         (Incremental_inputs::report_archive_end): Use Library_base; use
7944         visitor class to record unused symbols; don't add incremental inputs
7945         entry after members.
7946         (Incremental_inputs::report_object): Use Library_base.
7947         * incremental.h
7948         (Incremental_archive_entry::Incremental_archive_entry): Remove
7949         unused Archive parameter.
7950         (Incremental_inputs::report_archive_begin): Use Library_base.
7951         (Incremental_inputs::report_archive_end): Likewise.
7952         (Incremental_inputs::report_object): Likewise.
7953         * object.cc (Sized_relobj::do_for_all_global_symbols): New
7954         function.
7955         * object.h (Object::for_all_global_symbols): New function.
7956         (Object::do_for_all_global_symbols): New function.
7957         (Sized_relobj::do_for_all_global_symbols): New function.
7958         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
7959         function.
7960         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
7961         function.
7962
7963 2011-03-27  Ian Lance Taylor  <iant@google.com>
7964
7965         * archive.cc (Archive::interpret_header): Return -1 if something
7966         goes wrong.  Change callers accordingly.
7967
7968 2011-03-25  Cary Coutant  <ccoutant@google.com>
7969
7970         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
7971         * testsuite/Makefile.in: Regenerate.
7972
7973 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
7974
7975         * plugin.cc (get_view): New.
7976         (Plugin::load): Pass get_view to the plugin.
7977         (Plugin_manager::get_view): New.
7978
7979 2011-03-21  Ian Lance Taylor  <iant@google.com>
7980
7981         * testsuite/final_layout.sh: Rewrite to not use dc.
7982         * testsuite/relro_test.sh: Fail if dc is not present.
7983
7984 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
7985
7986         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
7987         Change == to -eq.
7988         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
7989         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
7990         Change == to -eq.
7991         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
7992         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
7993
7994 2011-03-14  Ian Lance Taylor  <iant@google.com>
7995
7996         * script-sections.cc (Sort_output_sections::script_compare):
7997         Rename from is_before, change return type.
7998         (Sort_output_sections::operator()): Adjust accordingly.
7999
8000 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
8001
8002         PR gold/12572
8003         * testsuite/odr_violation2.cc: Add comment to make all error line
8004         numbers double digits.
8005         * testsuite/debug_msg.sh: Adjust expected errors.
8006
8007 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
8008
8009         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
8010         but mark earlier ones as non-canonical
8011         (offset_to_iterator): Update search target and example
8012         (do_addr2line): Return extra lines in a vector*
8013         (format_file_lineno): Extract from do_addr2line
8014         (one_addr2line): Add vector* out-param
8015         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
8016         when a lineno entry appeared last for its instruction
8017         (Dwarf_line_info): Add vector* out-param
8018         * object.cc (Relocate_info): Pass NULL for the vector* out-param
8019         * symtab.cc (Odr_violation_compare): Include the lineno in the
8020         comparison again.
8021         (linenos_from_loc): New. Combine the canonical line for an
8022         address with its other lines.
8023         (True_if_intersect): New. Helper functor to make
8024         std::set_intersection a query.
8025         (detect_odr_violations): Compare sets of lines instead of just
8026         one line for each function. This became less deterministic, but
8027         has fewer false positives.
8028         * symtab.h: Declarations.
8029         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
8030         mix an optimized and non-optimized object in the same binary
8031         (odr_violation2.so): Same.
8032         * testsuite/Makefile.in: Regenerate from Makefile.am.
8033         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
8034         * testsuite/debug_msg.sh: Update line numbers and add
8035         assertions.
8036         * testsuite/odr_violation1.cc: Use OdrDerived, in a
8037         non-optimized context.
8038         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
8039         isn't inlined, and use OdrDerived in an optimized context.
8040         * testsuite/odr_header1.h: Defines OdrDerived, where
8041         optimization will change the
8042         first-instruction-in-the-destructor's file and line number.
8043         * testsuite/odr_header2.h: Defines OdrBase.
8044
8045 2011-03-09  Ian Lance Taylor  <iant@google.com>
8046
8047         * fileread.cc (File_read::clear_views): Don't delete the whole
8048         file view.
8049
8050 2011-03-08  Ian Lance Taylor  <iant@google.com>
8051
8052         PR gold/12525
8053         * fileread.cc: #include <climits>.
8054         (GOLD_IOV_MAX): Define.
8055         (File_read::read_multiple): Limit number of entries by iov_max.
8056         * fileread.h (class File_read): Always set max_readv_entries to
8057         128.
8058
8059 2011-03-07  Ian Lance Taylor  <iant@google.com>
8060
8061         PR gold/12525
8062         * options.h (class General_options): Add -dy and -dn.
8063
8064 2011-03-02  Cary Coutant  <ccoutant@google.com>
8065
8066         * testsuite/script_test_9.t: Add TLS segment.
8067
8068 2011-03-02  Simon Baldwin  <simonb@google.com>
8069
8070         * configure.ac: Add check for gnu_indirect_function support in
8071         the toolchain building binutils.
8072         * configure: Rebuild.
8073
8074 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
8075
8076         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
8077         plugin only symbols.
8078         (Symbol_table::sized_finalize_symbol) Mark symbol only present
8079         in plugin files as not needed in the symbol table.
8080
8081 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
8082
8083         * output.cc (Output_section::add_input_section): Delay fill
8084         generation for section ordering.
8085
8086 2011-02-09  Ian Lance Taylor  <iant@google.com>
8087
8088         PR gold/12316
8089         * object.h (class Sized_relobj): Remove clear_local_symbols.
8090         * reloc.cc (Sized_relobj::do_relocate): Don't call
8091         clear_local_symbols.
8092
8093 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
8094
8095         * plugin.cc (is_visible_from_outside): Return true for symbols
8096         in the -u option.
8097
8098 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
8099
8100         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
8101         filename.
8102
8103 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
8104
8105         * icf.h (is_section_foldable_candidate): Change type of parameter
8106         to std::string.
8107         * icf.cc (Icf::find_identical_sections): Change type of local variable
8108         section_name to be std::string.
8109         (is_function_ctor_or_dtor): Change type of parameter to std::string.
8110
8111 2011-01-25  Ian Lance Taylor  <iant@google.com>
8112
8113         * script.cc (script_add_extern): Rewrite to use
8114         add_symbol_reference.
8115
8116 2011-01-25  Doug Kwan  <dougkwan@google.com>
8117
8118         * icf.cc (get_section_contents): Always lock section's object.
8119
8120 2011-01-24  Ian Lance Taylor  <iant@google.com>
8121
8122         * options.h (class General_options): Accept
8123         --no-detect-odr-violations.
8124
8125 2011-01-24  Ian Lance Taylor  <iant@google.com>
8126
8127         * version.cc (version_string): Bump to 1.11.
8128
8129 2011-01-24  Ian Lance Taylor  <iant@google.com>
8130
8131         * plugin.cc (class Plugin_rescan): Define new class.
8132         (Plugin_manager::claim_file): Set any_claimed_.
8133         (Plugin_manager::save_archive): New function.
8134         (Plugin_manager::save_input_group): New function.
8135         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
8136         necessary.
8137         (Plugin_manager::new_undefined_symbol): New function.
8138         (Plugin_manager::rescan): New function.
8139         (Plugin_manager::rescannable_defines): New function.
8140         (Plugin_manager::add_input_file): Set any_added_.
8141         * plugin.h (class Plugin_manager): define new fields rescannable_,
8142         undefined_symbols_, any_claimed_, and any_added_.  Declare
8143         Plugin_rescan as friend.  Declare new functions.
8144         (Plugin_manager::Rescannable): Define type.
8145         (Plugin_manager::Rescannable_list): Define type.
8146         (Plugin_manager::Undefined_symbol_list): Define type.
8147         (Plugin_manager::Plugin_manager): Initialize new fields.
8148         * archive.cc (Archive::defines_symbol): New function.
8149         (Add_archive_symbols::run): Pass archive to plugins if any.
8150         * archive.h (class Archive): Declare defines_symbol.
8151         * readsyms.cc (Input_group::~Input_group): New function.
8152         (Finish_group::run): Pass input_group to plugins if any.
8153         * readsyms.h (class Input_group): Declare destructor.
8154         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
8155         any.
8156
8157 2011-01-10  Ian Lance Taylor  <iant@google.com>
8158
8159         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
8160         section as relro.
8161         (Layout::set_segment_offsets): Reset increase_relro before calling
8162         set_section_addresses a second time.
8163
8164 2011-01-04  Cary Coutant  <ccoutant@google.com>
8165
8166         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
8167         sections before NOBITS sections.
8168
8169 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
8170
8171         * version.cc (print_version): Update copyright to 2011.
8172
8173 2010-12-23  Cary Coutant  <ccoutant@google.com>
8174
8175         * output.h (Output_data_reloc::add_output_section): Pass OD instead
8176         of OS to this->add.  Add OD parameter to second form of the function.
8177
8178 2010-12-20  Ian Lance Taylor  <iant@google.com>
8179
8180         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
8181         second of two consecutive entries with same offset.
8182
8183 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8184
8185         * testsuite/Makefile.am (ifuncmain2static_LDADD)
8186         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
8187         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
8188         to avoid unneeded links against $(LDADD).
8189         * testsuite/Makefile.in: Regenerate.
8190
8191 2010-12-15  Ian Lance Taylor  <iant@google.com>
8192
8193         PR gold/12324
8194         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
8195         for R_X86_64_32 and R_X86_64_PC32.
8196         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
8197         ver_matching_def_pic.o.
8198         (ver_matching_def_pic.o): New target.
8199
8200 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8201
8202         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
8203         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
8204         Move definition before File_read::View member definitions.
8205         (File_read::View::~View): Initialize and hold lock before
8206         updating current_mapped_bytes.
8207
8208 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8209
8210         * dwarf_reader.cc: Remove outdated comment.
8211         * gold-threads.cc: Fix typo in error message.
8212         * archive.cc: Fix typos in comments.
8213         * archive.h: Likewise.
8214         * arm-reloc-property.cc: Likewise.
8215         * arm-reloc-property.h: Likewise.
8216         * arm-reloc.def: Likewise.
8217         * arm.cc: Likewise.
8218         * attributes.h: Likewise.
8219         * cref.cc: Likewise.
8220         * ehframe.cc: Likewise.
8221         * fileread.h: Likewise.
8222         * gold.h: Likewise.
8223         * i386.cc: Likewise.
8224         * icf.cc: Likewise.
8225         * incremental.h: Likewise.
8226         * int_encoding.cc: Likewise.
8227         * layout.h: Likewise.
8228         * main.cc: Likewise.
8229         * merge.h: Likewise.
8230         * object.cc: Likewise.
8231         * object.h: Likewise.
8232         * options.cc: Likewise.
8233         * readsyms.cc: Likewise.
8234         * reduced_debug_output.cc: Likewise.
8235         * reloc.cc: Likewise.
8236         * script-sections.cc: Likewise.
8237         * sparc.cc: Likewise.
8238         * symtab.h: Likewise.
8239         * target-reloc.h: Likewise.
8240         * target.cc: Likewise.
8241         * target.h: Likewise.
8242         * timer.cc: Likewise.
8243         * timer.h: Likewise.
8244         * x86_64.cc: Likewise.
8245
8246 2010-12-09  Cary Coutant  <ccoutant@google.com>
8247
8248         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
8249         stack.
8250         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
8251         parameter; change all callers.
8252         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
8253         * options.h (warn_execstack): New option.
8254
8255 2010-12-07  Doug Kwan  <dougkwan@google.com>
8256
8257         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
8258         like function call relocations.
8259
8260 2010-12-07  Ian Lance Taylor  <iant@google.com>
8261
8262         * archive.cc (Archive::get_elf_object_for_member): Permit
8263         punconfigured to be NULL.
8264         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
8265         (Archive::include_member): Pass NULL to get_elf_object_for_member
8266         if we searched for the archive and this is the first included
8267         object.
8268
8269 2010-12-01  Ian Lance Taylor  <iant@google.com>
8270
8271         * dwarf_reader.h (class Sized_dwarf_line_info): Add
8272         track_relocs_type_ field.
8273         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8274         Set track_relocs_type_.
8275         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
8276         contents when using RELA relocs.
8277         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
8278         reloc_map_.
8279         * reloc.cc (Track_relocs::next_addend): New function.
8280         * reloc.h (class Track_relocs): Declare next_addend.
8281
8282 2010-12-01  Ian Lance Taylor  <iant@google.com>
8283
8284         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
8285         virtual destructor.
8286
8287 2010-12-01  Ian Lance Taylor  <iant@google.com>
8288
8289         * README: Update compilers known to work and fail.
8290
8291 2010-11-23  Matthias Klose  <doko@ubuntu.com>
8292
8293         * configure.in: For --enable-gold, handle value `default' instead of
8294         `both*'.  Always install ld as ld.bfd, install as ld if gold is
8295         not the default.
8296         * configure: Regenerate.
8297
8298 2010-11-18  Doug Kwan  <dougkwan@google.com>
8299
8300         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
8301         and right_alignment to be zero.  Store result alignment only if it is
8302         greater than existing alignment.
8303
8304 2010-11-16  Cary Coutant  <ccoutant@google.com>
8305
8306         PR gold/12220
8307         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8308         Check for ".zdebug_line".
8309
8310 2010-11-16  Doug Kwan  <dougkwan@google.com>
8311             Cary Coutant  <ccoutant@google.com>
8312
8313         * output.h (Output_segment::set_section_addresses): Pass increase_relro
8314         by reference; adjust all callers.
8315         * output.cc (Output_segment::set_section_addresses): Adjust references
8316         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
8317         list is empty.
8318         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
8319         end at page boundary.
8320
8321 2010-11-16  Cary Coutant  <ccoutant@google.com>
8322
8323         PR gold/12220
8324         * layout.cc (Layout::choose_output_section): Transform names of
8325         compressed sections even when using a script with a SECTIONS clause.
8326         (Layout::output_section_name): Remove code to transform
8327         compressed debug section names.
8328         * output.cc (Output_section::add_input_section): Use uncompressed
8329         section size when tracking input sections.
8330
8331 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
8332
8333         * symtab.h (Symbol::NON_PIC_REF): Remove.
8334         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
8335         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
8336         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
8337         (Symbol::use_plt_offset): Take a flags argument and pass it
8338         directly to needs_dynamic_reloc.  Restrict check for undefined
8339         weak symbols to function calls.
8340         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
8341         (Target_arm::Scan::global): Use it.
8342         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
8343         (Target_arm::Relocate::relocate): Likewise.
8344         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
8345         parameter with an r_type parameter.  Use get_reference_flags
8346         to get the flags.
8347         (Target_arm::Relocate::relocate): Update accordingly.
8348         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
8349         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
8350         (Target_i386::Scan::global): Likewise.
8351         (Target_i386::Relocate::relocate): Likewise.
8352         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
8353         parameter with an r_type parameter.  Use get_reference_flags
8354         to get the flags.
8355         (Target_i386::Relocate::relocate): Update accordingly.
8356         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
8357         (Target_powerpc::Scan::global): Use it.
8358         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
8359         (Target_powerpc::Relocate::relocate): Likewise.
8360         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
8361         (Target_sparc::Scan::global): Use it.
8362         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
8363         (Target_sparc::Relocate::relocate): Likewise.
8364         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
8365         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
8366         (Target_x86_64::Scan::global): Likewise.
8367         (Target_x86_64::Relocate::relocate): Likewise.
8368
8369 2010-11-08  Doug Kwan  <dougkwan@google.com>
8370             Cary Coutant  <ccoutant@google.com>
8371
8372         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
8373         (Arm_exidx_merge_section::section_contents_): New data member.
8374         (Arm_input_section::Arm_input_section): Initialize original_contents_.
8375         (Arm_input_section::~Arm_input_section): De-allocate memory.
8376         (Arm_input_section::original_contents_): New data member.
8377         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
8378         in parameters instead of calling Object::section_contents without
8379         locking.
8380         (Arm_output_section::group_section): New parameter TASK.  Pass it
8381         to callees that need locking objects.
8382         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
8383         to lock EXIDX input sections.  Fix a formatting issue.  Call
8384         Arm_exidx_merged_section::build_contents to create merged section
8385         contents.
8386         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
8387         to lock object of stub table owner.
8388         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
8389         TEXT_SIZE to initialize data member TEXT_SIZE_.
8390         (Arm_exidx_input_section::addralign): Fix typo in comment.
8391         (Arm_exidx_input_section::text_size): New method.
8392         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
8393         that require locking objects.  Lock objects before scanning for stubs
8394         and updating local symbols.
8395         (Arm_input_section<big_endian>::init): Copy contents of original
8396         input section.
8397         (Arm_input_section<big_endian>::do_write): Use saved contents of
8398         original input section instead of calling Object::section_contents
8399         without locking.
8400         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
8401         size without calling Object::section_size().
8402         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
8403         for size.  Allocate a buffer for merged EXIDX entries.
8404         (Arm_exidx_merged_section::build_contents): New method.
8405         (Arm_exidx_merged_section::do_write): Move merge section contents
8406         building code to Arm_exidx_merged_section::build_contetns.  Write
8407         out contetns in buffer instead of building it on the fly.
8408         (Arm_relobj::make_exidx_input_section): Also pass text section size
8409         to Arm_exidx_input_section constructor.
8410         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
8411         (Arm_dynobj::do_read_symbols): Fix memory leak.
8412         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
8413         * target.h: (class Task): Add forward declaration.
8414         (Target::relax): Add new parameter TASK and pass it to
8415         Target::do_relax().
8416         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
8417
8418 2010-11-05  Cary Coutant  <ccoutant@google.com>
8419
8420         PR gold/10708
8421         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
8422         object when reading from the file.
8423         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
8424         second layout pass.
8425         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
8426         when reading section contents.
8427         (get_section_contents): Likewise.
8428         (icf::find_identical_sections): Likewise.
8429         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
8430         object when reading from the file.
8431         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
8432         the object when doing deferred section layout.
8433
8434 2010-11-03  Nick Clifton  <nickc@redhat.com>
8435
8436         PR gold/12001
8437         * script.h (class Symbol_assignment: name): New member.  Returns
8438         the name of the symbol.
8439         * scrfipt.cc (Script_options::is_pending_assignment): New member.
8440         Returns true if the given symbol name is on the list of
8441         assignments wating to be processed.
8442         * archive.cc (should_incldue_member): If the symbol is undefined,
8443         check to see if it is on the list of symbols pending assignment.
8444
8445 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
8446
8447         * script-sections.cc (Script_sections::find_memory_region): Check
8448         for a NULL output section pointer.
8449
8450 2010-10-29  Doug Kwan  <dougkwan@google.com>
8451
8452         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
8453         Output_section::add_relaxed_input_section.
8454         * output.cc (Output_section::add_relaxed_input_section): Add new
8455         arguments LAYOUT and NAME.  Set section order index.
8456         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8457         Copy section order index.
8458         * output.h (Output_section::add_relaxed_input_section): Add new
8459         arguments LAYOUT and NAME.
8460
8461 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8462
8463         * testsuite/Makefile.am: Move gcctestdir/ld rule to
8464         NATIVE_OR_CROSS_LINKER.
8465         * testsuite/Makefile.in: Regenerate.
8466
8467 2010-10-20  Doug Kwan  <dougkwan@google.com>
8468
8469         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
8470         without SHF_LINK_ORDER flags.
8471         * layout.cc (Layout::choose_output_section): Do not filter
8472         SHF_LINK_ORDER flag in a relocatable link.
8473
8474 2010-10-17  Cary Coutant  <ccoutant@google.com>
8475
8476         * output.h (Output_segment::set_section_addresses): Change function
8477         signature.  Update all callers.
8478         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
8479         sections.
8480         (Output_segment::set_section_addresses): Align after last TLS
8481         section.  Add padding before last relro section instead of after.
8482
8483 2010-10-17  Doug Kwan  <dougkwan@google.com>
8484
8485         * gold/arm.cc (Target_arm::got_section): Use correct order and set
8486         GOT output section to be writable.
8487
8488 2010-10-14  Cary Coutant  <ccoutant@google.com>
8489
8490         * debug.h (DEBUG_INCREMENTAL): New flag.
8491         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
8492         * gold.cc (queue_initial_tasks): Check parameters for incremental link
8493         mode.
8494         * incremental.cc (report_command_line): Ignore all forms of
8495         --incremental.
8496         * layout.cc (Layout::Layout): Check parameters for incremental link
8497         mode.
8498         * options.cc (General_options::parse_incremental): New function.
8499         (General_options::parse_no_incremental): New function.
8500         (General_options::parse_incremental_full): New function.
8501         (General_options::parse_incremental_update): New function.
8502         (General_options::incremental_mode_): New data member.
8503         (General_options::finalize): Check incremental_mode_.
8504         * options.h (General_options): Update help text for --incremental.
8505         Add --no-incremental, --incremental-full, --incremental-update.
8506         (General_options::Incremental_mode): New enum type.
8507         (General_options::incremental_mode): New function.
8508         (General_options::incremental_mode_): New data member.
8509         * parameters.cc (Parameters::incremental_mode_): New data member.
8510         (Parameters::set_options): Set incremental_mode_.
8511         (Parameters::set_incremental_full): New function.
8512         (Parameters::incremental): New function.
8513         (Parameters::incremental_update): New function.
8514         (set_parameters_incremental_full): New function.
8515         * parameters.h (Parameters::set_incremental_full): New function.
8516         (Parameters::incremental): New function.
8517         (Parameters::incremental_update): New function.
8518         (Parameters::incremental_mode_): New data member.
8519         (set_parameters_incremental_full): New function.
8520         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
8521         incremental link mode.
8522         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
8523         (Sized_relobj::do_relocate_sections): Likewise.
8524         * testsuite/Makefile.am (incremental_test): Use --incremental-full
8525         option.
8526         * testsuite/Makefile.in: Regenerate.
8527         * testsuite/incremental_test.sh: Filter all forms of --incremental.
8528
8529 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8530
8531         * script-sections.h (class Script_sections): Make
8532         Sections_elements typedef public.
8533         * script-sections.cc (class Sort_output_sections): Add elements_
8534         field.  Add constructor which sets it; change all callers.
8535         (Sort_output_sections::is_before): New function.
8536         (Sort_output_sections::operator()): Call is_before.
8537         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
8538         conditional.
8539         * testsuite/script_test_10.sh: New test. Test script section
8540         order.
8541         * testsuite/script_test_10.t: Likewise.
8542         * testsuite/script_test_10.s: Likewise.
8543         * testsuite/Makefile.am: Wrap the cross linker tests and the
8544         common tests into NATIVE_OR_CROSS_LINKER.
8545         (check_SCRIPTS): Add script_test_10.sh.
8546         (check_DATA): Add script_test_10.stdout.
8547         (script_test_10.o, script_test_10): New targets.
8548         (script_test_10.stdout): New target.
8549         * configure, testsuite/Makefile.in: Regenerate.
8550
8551 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8552
8553         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
8554         error for the deprecated relocations.
8555         (Target_arm::Scan::global): Likewise.
8556         (Target_arm::Relocate::relocate): Likewise.
8557
8558 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
8559
8560         * fileread.cc (Input_file::find_file): Initialize *found_name
8561         and *namep when using the fallback search for case 4.
8562
8563 2010-10-11  Cary Coutant  <ccoutant@google.com>
8564
8565         * options.h (class General_options): Redefine -z lazy as an alias for
8566         the negation of -z now.
8567
8568 2010-10-11  Ian Lance Taylor  <iant@google.com>
8569
8570         * resolve.cc (symbol_to_bits): Report the value of the unsupported
8571         binding.
8572
8573 2010-10-06  Nick Clifton  <nickc@redhat.com>
8574
8575         * script-sections.cc(class Memory_region): Remove
8576         current_lma_offset_ field.  Rename current_vma_offset_ to
8577         current_offset_.  Add last_section_ field.
8578         (Memory_region::get_current_vma_address): Rename to
8579         get_current_address.
8580         (Memory_region::get_current_lma_address): Delete.
8581         (Memory_region::increment_vma_offset): Rename to
8582         increment_offset.
8583         (Memory_region::increment_lma_offset): Delete.
8584         (Memory_region::attributes_compatible): New method.  Returns
8585         true if the provided section is compatible with the region.
8586         (Memory_region::get_last_section): New method.  Returns the last
8587         section to use the region.
8588         (Memory_region::set_last_section): New method.  Stores the last
8589         section to use the region.
8590         (Script_sections::block_in_region): New method.  Returns true if
8591         a block of memory is contained within a region.
8592         (Script_sections::find_memory_region): New method.  Locates a
8593         memory region to be used to set a VMA or LMA address.
8594         (Output_section_definition::set_section_addresses): Add code to
8595         check for addresses set by memory regions.
8596         (Output_segment::set_section_addresses): Remove memory region
8597         walking code.
8598         (Script_sections::create_segment): Add a warning if a header
8599         segment is created outside of any region.
8600         * script-sections.h (class Script_sections): Add prototypes for
8601         find_memory_region and block_in_region methods.
8602         * testsuite/memory_test.s: Use .long instead of .word.
8603         * testsuite/memory_test.t: Add some more output sections.
8604         * testsuite/memory_test.sh: Update expected output.
8605
8606 2010-10-02  Doug Kwan  <dougkwan@google.com>
8607
8608         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
8609         defintion to symtab.h
8610         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
8611         declaration to defintion.
8612
8613 2010-10-01  Nick Clifton  <nickc@redhat.com>
8614
8615         * expression.cc (eval): Replace dummy argument with NULL.
8616         (eval_maybe_dot): Check for a NULL result section pointer.
8617         (Symbol_expression::value): Likewise.
8618         (Dot_expression::value): Likewise.
8619         (BINARY_EXPRESSION): Likewise.
8620         (Max_expression::value): Likewise.
8621         (Min_expression::value): Likewise.
8622         (Absolute_expression::value): Likewise.
8623         (Addr_expression::value_from_output_section): Likewise.
8624         (Loaddddr_expression::value_from_output_section): Likewise.
8625         (Segment_start_expression::value): Likewise.
8626         * script-sections.cc
8627         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
8628         argument with NULL.
8629         (Sections_elememt_dot_assignment::set_section_addresses):
8630         Likewise.
8631         (Output_data_expression::do_write_to_buffer): Likewise.
8632         (Output_section_definition::finalize_symbols): Likewise.
8633         (Output_section_definition::set_section_addresses): Likewise.
8634
8635 2010-09-30  Doug Kwan  <dougkwan@google.com>
8636
8637         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
8638
8639 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
8640
8641         * target.h (Target::can_icf_inline_merge_sections): New virtual
8642         function.
8643         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
8644         virtual function.
8645         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
8646         virtual function.
8647         * icf.cc (get_section_contents): Inline merge sections only when
8648         target allows it.
8649
8650 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8651
8652         * configure: Regenerate.
8653
8654 2010-09-17  Ian Lance Taylor  <iant@google.com>
8655
8656         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
8657         * testsuite/Makefile.am (memory_test.o): New target.
8658         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
8659         memory_test.t.
8660         * testsuite/Makefile.in: Rebuild.
8661
8662 2010-09-17  Doug Kwan  <dougkwan@google.com>
8663
8664         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
8665         defintion if relocation uses GOT entries of the symbol.
8666         * testsuite/icf_safe_test.sh: Fix test.
8667         * testsuite/icf_safe_so_test.sh: Fix test.
8668
8669 2010-09-16  Cary Coutant  <ccoutant@google.com>
8670
8671         * script_sections.cc (class Memory_region): Remove "NULL" from
8672         vector initializations.
8673
8674 2010-09-15  Cary Coutant  <ccoutant@google.com>
8675
8676         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
8677         Resolve forwarding symbols.
8678
8679 2010-09-15  Doug Kwan  <dougkwan@google.com>
8680
8681         * gold/testsuite/script_test_3.t: Add ARM special sections.
8682         * gold/testsuite/script_test_4.t: Same.
8683         * gold/testsuite/script_test_5.t: Same.
8684         * gold/testsuite/script_test_6.t: Same.
8685         * gold/testsuite/script_test_7.t: Same.
8686         * gold/testsuite/script_test_7.t: Same.
8687         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
8688
8689 2010-09-14  Cary Coutant  <ccoutant@google.com>
8690
8691         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
8692         (Target_x86_64::Relocate::relocate_tls): Replace check for
8693         saw_tls_block_reloc_ with test for executable section.
8694
8695 2010-09-12  Cary Coutant  <ccoutant@google.com>
8696
8697         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
8698         position-independent executables to shared libraries need dynamic
8699         relocations.
8700         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
8701         position-independent executables.
8702         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
8703         * testsuite/Makefile.in: Regenerate.
8704
8705 2010-09-10  Nick Clifton  <nickc@redhat.com>
8706
8707         PR gold/11997
8708         * testsuite/memory_test.t: Discard any sections that are not
8709         needed.
8710
8711 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
8712
8713         PR gold/11996
8714         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8715         "This::" to work around a bug in gcc 4.2.
8716
8717         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
8718
8719 2010-09-09  Rafael Espindola  <espindola@google.com>
8720
8721         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
8722         sections with different PF_X flags in the same segment.
8723         (Layout::find_first_load_seg): Search all segments to find the first
8724         one.
8725         * options.h (rosegment): New.
8726
8727 2010-09-08  Rafael Espindola  <espindola@google.com>
8728
8729         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
8730
8731 2010-09-08  Doug Kwan  <dougkwan@google.com>
8732
8733         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
8734         (Arm_relobj::do_relocate_sections): Add new parameter for output
8735         file to match the parent.
8736         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
8737         of local symbols instead of input values.  Update code to track
8738         changes in gold::relocate_section.
8739         * object.cc (Sized_relobj::compute_final_local_value): New methods.
8740         (Sized_relobj::compute_final_local_value_internal): New methods.
8741         (Sized_relobj::do_finalize_local_symbols): Move code from loop
8742         body into private version of Sized_relobj::compute_final_local_value.
8743         Call the inline method.
8744         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
8745         merged symbol value if there is one.
8746         (Symbol_value::has_output_value): New method defintiion.
8747         (Sized_relobj::Compute_final_local_value_status): New enum type.
8748         (Sized_relobj::compute_final_local_value): New methods.
8749         (Sized_relobj::compute_final_local_value_internal): New methods.
8750         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
8751         and arm_cortex_a8.sh.
8752         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
8753         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
8754         New tests.
8755         * Makefile.in: Regenerate.
8756         * testsuite/arm_bl_out_of_range.s: Update test.
8757         * testsuite/thumb_bl_out_of_range.s: Ditto.
8758         * testsuite/thumb_blx_out_of_range.s: Ditto.
8759         * testsuite/arm_branch_out_of_range.sh: New file.
8760         * testsuite/arm_cortex_a8.sh: Ditto.
8761         * testsuite/arm_cortex_a8_b.s: Ditto.
8762         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
8763         * testsuite/arm_cortex_a8_b_local.s: Ditto.
8764         * testsuite/arm_cortex_a8_bl.s: Ditto.
8765         * testsuite/arm_cortex_a8_blx.s: Ditto.
8766         * testsuite/arm_cortex_a8_local.s: Ditto.
8767         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
8768         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
8769
8770 2010-09-08  Rafael Espindola  <espindola@google.com>
8771
8772         * Makefile.am (memory_test.stdout): Run readelf with -W.
8773         * Makefile.in: Regenerate.
8774         * testsuite/memory_test.sh: Make the regexps accept both 32 and
8775         64 bit output.
8776
8777 2010-09-08  Rafael Espindola  <espindola@google.com>
8778
8779         * script-sections.cc (Script_sections::add_memory_region): Convert
8780         field precision to int.
8781         * script.cc (script_set_section_region, script_set_section_region):
8782         Convert field precision to int.
8783
8784 2010-09-08  Rafael Espindola  <espindola@google.com>
8785
8786         * arm.cc (do_finalize_sections): Create the __exidx_start and
8787         __exdix_end symbols even when the section is missing.
8788
8789 2010-09-08  Nick Clifton  <nickc@redhat.com>
8790
8791         * README: Remove claim that MEMORY is not supported.
8792         * expression.cc (script_exp_function_origin)
8793         (script_exp_function_length): Move from here to ...
8794         * script.cc: ... here.
8795         (script_set_section_region, script_add_memory)
8796         (script_parse_memory_attr, script_include_directive): New
8797         functions.
8798         * script-sections.cc
8799         (class Memory_region): New class.
8800         (class Output_section_definition): Add set_memory_region,
8801         set_section_vma, set_section_lma and get_section_name methods.
8802         (class Script_Sections): Add add_memory_region,
8803         find_memory_region, find_memory_region_origin,
8804         find_memory_region_length and set_memory_region methods.
8805         Have set_section_addresses method walk the list of set memory
8806         regions.
8807         Extend the print methos to display memory regions.
8808         * script-sections.h: Add prototypes for new methods.
8809         Add enum for MEMORY region attributes.
8810         * yyscript.y: Add support for parsing MEMORY regions.
8811         * script-c.h: Add prototypes for new functions.
8812         * testsuite/Makefile.am: Add test of MEMORY region functionality.
8813         * testsuite/Makefile.in: Regenerate.
8814         * testsuite/memory_test.sh: New script.
8815         * testsuite/memory_test.s: New assembler source file.
8816         * testsuite/memory_test.t: New linker script.
8817
8818 2010-08-27  Doug Kwan  <dougkwan@google.com>
8819
8820         * gold/resolve.cc (Symbol_table::should_override): Let a weak
8821         reference override an existing dynamic weak reference.
8822         * testsuite/Makefile.am: Add new test dyn_weak_ref.
8823         * testsuite/Makefile.in: Regenerate.
8824         * testsuite/dyn_weak_ref.sh: New file.
8825         * testsuite/dyn_weak_ref_1.c: Ditto.
8826         * testsuite/dyn_weak_ref_2.c: Ditto.
8827
8828 2010-08-27  Ian Lance Taylor  <iant@google.com>
8829
8830         * incremental.h (class Incremental_input_entry): Add virtual
8831         destructor.
8832
8833 2010-08-27  Ian Lance Taylor  <iant@google.com>
8834
8835         * testsuite/start_lib_test_3.c: Mark t3 as used.
8836
8837 2010-08-27  Nick Clifton  <nickc@redhat.com>
8838
8839         * options.cc (version_script): Fix small typo in previous
8840         whitespace tidyup.
8841
8842 2010-08-25  Nick Clifton  <nickc@redhat.com>
8843
8844         * archive.cc: Formatting fixes: Remove whitespace between
8845         typename and following asterisk.  Remove whitespace between
8846         function name and opening parenthesis.
8847         * archive.h: Likewise.
8848         * arm.cc: Likewise.
8849         * attributes.cc: Likewise.
8850         * attributes.h: Likewise.
8851         * common.cc: Likewise.
8852         * copy-relocs.cc: Likewise.
8853         * dirsearch.h: Likewise.
8854         * dynobj.cc: Likewise.
8855         * ehframe.cc: Likewise.
8856         * ehframe.h: Likewise.
8857         * expression.cc: Likewise.
8858         * fileread.cc: Likewise.
8859         * fileread.h: Likewise.
8860         * gc.h: Likewise.
8861         * gold-threads.cc: Likewise.
8862         * gold.cc: Likewise.
8863         * i386.cc: Likewise.
8864         * icf.h: Likewise.
8865         * incremental-dump.cc: Likewise.
8866         * incremental.cc: Likewise.
8867         * layout.cc: Likewise.
8868         * layout.h: Likewise.
8869         * main.cc: Likewise.
8870         * merge.cc: Likewise.
8871         * merge.h: Likewise.
8872         * object.cc: Likewise.
8873         * object.h: Likewise.
8874         * options.cc: Likewise.
8875         * options.h: Likewise.
8876         * output.cc: Likewise.
8877         * output.h: Likewise.
8878         * plugin.cc: Likewise.
8879         * plugin.h: Likewise.
8880         * powerpc.cc: Likewise.
8881         * reloc.cc: Likewise.
8882         * script-c.h: Likewise.
8883         * script-sections.cc: Likewise.
8884         * script.cc: Likewise.
8885         * stringpool.cc: Likewise.
8886         * symtab.cc: Likewise.
8887         * symtab.h: Likewise.
8888         * target.cc: Likewise.
8889         * timer.cc: Likewise.
8890         * timer.h: Likewise.
8891         * version.cc: Likewise.
8892         * x86_64.cc: Likewise.
8893
8894 2010-08-24  Nick Clifton  <nickc@redhat.com>
8895
8896         PR 11899
8897         * layout.cc (segment_precedes): Sort segments by their physical
8898         addresses, if they have been set.
8899
8900 2010-08-23  Cary Coutant  <ccoutant@google.com>
8901
8902         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
8903         symbols data.
8904         (Lib_group::include_member): Unlock object after deleting its
8905         symbols data.
8906         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
8907         the bug fixed here.
8908
8909 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
8910             Cary Coutant  <ccoutant@google.com>
8911
8912         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
8913         constructor, and set_blocker.
8914         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
8915         readsyms_blocker_.
8916         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
8917         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
8918         * testsuite/Makefile.am (start_lib_test): New test case.
8919         * testsuite/Makefile.in: Regenerate.
8920         * testsuite/start_lib_test_main.c: New file.
8921         * testsuite/start_lib_test_1.c: New file.
8922         * testsuite/start_lib_test_2.c: New file.
8923         * testsuite/start_lib_test_3.c: New file.
8924
8925 2010-08-19  Ian Lance Taylor  <iant@google.com>
8926
8927         * Makefile.in: Rebuild with automake 1.11.1.
8928         * aclocal.m4: Likewise.
8929         * testsuite/Makefile.in: Likewise.
8930
8931 2010-08-19  Ian Lance Taylor  <iant@google.com>
8932
8933         PR 10893
8934         * i386.cc (class Output_data_plt_i386): Update declarations.
8935         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
8936         local_ifuncs_ fields.
8937         (Target_i386::do_plt_section_for_global): New function.
8938         (Target_i386::do_plt_section_for_local): New function.
8939         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
8940         parameter; change all callers.  Initialize global_ifuncs_ and
8941         local_ifuncs_.  If doing a static link define __rel_iplt_start and
8942         __rel_iplt_end.
8943         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
8944         (Output_data_plt_i386::add_local_ifunc_entry): New function.
8945         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
8946         symbols.
8947         (Target_i386::make_plt_section): New function, broken out of
8948         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
8949         (Target_i386::make_plt_entry): Call make_plt_section.
8950         (Target_i386::make_local_ifunc_plt_entry): New function.
8951         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
8952         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
8953         R_386_IRELATIVE to switch.
8954         (Target_i386::Scan::global): Likewise.
8955         (Target_i386::Relocate::relocate): Likewise.
8956         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
8957         switch.
8958         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
8959         (Target_x86_64::do_plt_section_for_global): New function.
8960         (Target_x86_64::do_plt_section_for_local): New function.
8961         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
8962         parameter; change all callers.  If doing a static link define
8963         __rela_iplt_start and __rela_iplt_end.
8964         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
8965         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
8966         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
8967         to point to .plt.
8968         (Target_x86_64::make_local_ifunc_plt_entry): New function.
8969         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
8970         switch.
8971         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
8972         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
8973         R_X86_64_IRELATIVE to switch.
8974         (Target_x86_64::Scan::global): Likewise.
8975         (Target_x86_64::Relocate::relocate): Likewise.
8976         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
8977         switch.
8978         * target.h (class Target): Add plt_section_for_global and
8979         plt_section_for_local functions.  Add do_plt_section_for_global
8980         and do_plt_section_for_local virtual functions.
8981         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
8982         clarifying comments.
8983         (Symbol::use_plt_offset): Handle IFUNC symbol.
8984         * object.cc (Sized_relobj::Sized_relobj): Initialize
8985         local_plt_offsets_.
8986         (Sized_relobj::local_has_plt_offset): New function.
8987         (Sized_relobj::local_plt_offset): New function.
8988         (Sized_relobj::set_local_plt_offset): New function.
8989         (Sized_relobj::do_count): Handle IFUNC symbol.
8990         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
8991         a bit away from input_shndx_ field.  Add set_is_func_symbol and
8992         is_ifunc_symbol functions.
8993         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
8994         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
8995         local_plt_offsets_ field.
8996         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
8997         * output.h (class Output_section_data): Add non-const
8998         output_section function.
8999         (class Output_data_got): Update declarations.
9000         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
9001         Add use_plt_offset parameter to global and local constructors.
9002         Change all callers.  Change local_sym_index_ field to 31 bits.
9003         Change GSYM_CODE and CONSTANT_CODE accordingly.
9004         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
9005         doing a static link don't set sh_link field.
9006         (Output_data_got::Got_entry::write): Use PLT offset if
9007         appropriate.
9008         (Output_data_got::add_global_plt): New function.
9009         (Output_data_got::add_local_plt): New function.
9010         * target-reloc.h (relocate_section): Handle IFUNC symbol.
9011         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
9012         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
9013         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
9014         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
9015         IFUNC conditional.
9016         * testsuite/ifunc-sel.h: New file.
9017         * testsuite/ifuncmain1.c: New file.
9018         * testsuite/ifuncmain1vis.c: New file.
9019         * testsuite/ifuncmod1.c: New file.
9020         * testsuite/ifuncdep2.c: New file.
9021         * testsuite/ifuncmain2.c: New file.
9022         * testsuite/ifuncmain3.c: New file.
9023         * testsuite/ifuncmod3.c: New file.
9024         * testsuite/ifuncmain4.c: New file.
9025         * testsuite/ifuncmain5.c: New file.
9026         * testsuite/ifuncmod5.c: New file.
9027         * testsuite/ifuncmain6pie.c: New file.
9028         * testsuite/ifuncmod6.c: New file.
9029         * testsuite/ifuncmain7.c: New file.
9030         * configure, testsuite/Makefile.in: Rebuild.
9031
9032 2010-08-18  Ian Lance Taylor  <iant@google.com>
9033
9034         * incremental.cc
9035         (Output_section_incremental_inputs::write_input_files): Add cast
9036         to avoid signed/unsigned comparison warning.
9037         (Output_section_incremental_inputs::write_info_blocks): Likewise.
9038
9039 2010-08-12  Cary Coutant  <ccoutant@google.com>
9040
9041         * common.cc (Sort_commons::operator()): Remove unnecessary code.
9042
9043 2010-08-13  Ian Lance Taylor  <iant@google.com>
9044
9045         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
9046
9047 2010-08-12  Cary Coutant  <ccoutant@google.com>
9048             Doug Kwan  <dougkwan@google.com>
9049
9050         * resolve.cc (Symbol_table::should_override): When a weak dynamic
9051         defintion overrides non-weak undef, remember that the original undef
9052         is not weak.
9053         * symtab.cc (Symbol_table::sized_write_global): For undef without
9054         an original weak binding, set binding to global in output.
9055         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
9056         * testsuite/Makefile.in: Regenerate.
9057         * testsuite/strong_ref_weak_def.sh: New file.
9058         * testsuite/strong_ref_weak_def_1.c: Ditto.
9059         * testsuite/strong_ref_weak_def_2.c: Ditto.
9060
9061 2010-08-12  Cary Coutant  <ccoutant@google.com>
9062
9063         * testsuite/incremental_test.sh: Rewrite.
9064         * testsuite/incremental_test_1.c: Rewrite.
9065         * testsuite/incremental_test_2.c: Rewrite.
9066
9067 2010-08-12  Cary Coutant  <ccoutant@google.com>
9068
9069         * arm.cc (Target_arm::got_size): Add const.
9070         (Target_arm::got_entry_count): New function.
9071         (Target_arm::plt_entry_count): New function.
9072         (Target_arm::first_plt_entry_offset): New function.
9073         (Target_arm::plt_entry_size): New function.
9074         (Output_data_plt_arm::entry_count): New function.
9075         (Output_data_plt_arm::first_plt_entry_offset): New function.
9076         (Output_data_plt_arm::get_plt_entry_size): New function.
9077         * i386.cc (Target_i386::got_size): Add const.
9078         (Target_i386::got_entry_count): New function.
9079         (Target_i386::plt_entry_count): New function.
9080         (Target_i386::first_plt_entry_offset): New function.
9081         (Target_i386::plt_entry_size): New function.
9082         (Output_data_plt_i386::entry_count): New function.
9083         (Output_data_plt_i386::first_plt_entry_offset): New function.
9084         (Output_data_plt_i386::get_plt_entry_size): New function.
9085         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
9086         find_incremental_inputs_sections.  Dump incremental_got_plt section.
9087         * incremental.cc: Include target.h.
9088         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
9089         parameter.  Adjust all callers.  Find incremental_got_plt section.
9090         (Incremental_inputs::create_data_sections): Create incremental_got_plt
9091         section.
9092         (Output_section_incremental_inputs::set_final_data_size): Calculate
9093         size of incremental_got_plt section.
9094         (Output_section_incremental_inputs::do_write): Write the
9095         incremental_got_plt section.
9096         (Got_plt_view_info): New struct.
9097         (Local_got_offset_visitor): New class.
9098         (Global_got_offset_visitor): New class.
9099         (Global_symbol_visitor_got_plt): New class.
9100         (Output_section_incremental_inputs::write_got_plt): New function.
9101         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
9102         Add parameter.  Adjust all callers.
9103         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9104         (Incremental_inputs::got_plt_section): New function.
9105         (Incremental_inputs::got_plt_section_): New data member.
9106         (Incremental_got_plt_reader): New class.
9107         * layout.cc (Layout::create_incremental_info_sections): Add the
9108         incremental_got_plt section.
9109         * object.h (Got_offset_list::get_list): New function.
9110         (Got offset_list::for_all_got_offsets): New function.
9111         (Sized_relobj::local_got_offset_list): New function.
9112         * powerpc.cc (Target_powerpc::got_size): Add const.
9113         (Target_powerpc::got_entry_count): New function.
9114         (Target_powerpc::plt_entry_count): New function.
9115         (Target_powerpc::first_plt_entry_offset): New function.
9116         (Target_powerpc::plt_entry_size): New function.
9117         (Output_data_plt_powerpc::entry_count): New function.
9118         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
9119         (Output_data_plt_powerpc::get_plt_entry_size): New function.
9120         * sparc.cc (Target_sparc::got_size): Add const.
9121         (Target_sparc::got_entry_count): New function.
9122         (Target_sparc::plt_entry_count): New function.
9123         (Target_sparc::first_plt_entry_offset): New function.
9124         (Target_sparc::plt_entry_size): New function.
9125         (Output_data_plt_sparc::entry_count): New function.
9126         (Output_data_plt_sparc::first_plt_entry_offset): New function.
9127         (Output_data_plt_sparc::get_plt_entry_size): New function.
9128         * symtab.h (Symbol::got_offset_list): New function.
9129         (Symbol_table::for_all_symbols): New function.
9130         * target.h (Sized_target::got_entry_count): New function.
9131         (Sized_target::plt_entry_count): New function.
9132         (Sized_target::plt_entry_size): New function.
9133         * x86_64.cc (Target_x86_64::got_size): Add const.
9134         (Target_x86_64::got_entry_count): New function.
9135         (Target_x86_64::plt_entry_count): New function.
9136         (Target_x86_64::first_plt_entry_offset): New function.
9137         (Target_x86_64::plt_entry_size): New function.
9138         (Output_data_plt_x86_64::entry_count): New function.
9139         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
9140         (Output_data_plt_x86_64::get_plt_entry_size): New function.
9141
9142 2010-08-12  Cary Coutant  <ccoutant@google.com>
9143
9144         * archive.cc: Include incremental.h.
9145         (Archive::Archive): Initialize incremental_info_.
9146         (Archive::include_member): Record archive members in incremental info.
9147         (Add_archive_symbols::run): Record begin and end of an archive in
9148         incremental info.
9149         (Lib_group::include_member): Record objects in incremental info.
9150         * archive.h (Incremental_archive_entry): Forward declaration.
9151         (Archive::set_incremental_info): New member function.
9152         (Archive::incremental_info): New member function.
9153         (Archive::Unused_symbol_iterator): New class.
9154         (Archive::unused_symbols_begin): New member function.
9155         (Archive::unused_symbols_end): New member function.
9156         (Archive::incremental_info_): New data member.
9157         * incremental-dump.cc (find_input_containing_global): New function.
9158         (dump_incremental_inputs): Dump new incremental info sections.
9159         * incremental.cc: Include symtab.h.
9160         (Output_section_incremental_inputs): New class.
9161         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
9162         new incremental info sections.
9163         (Sized_incremental_binary::do_check_inputs): Likewise.
9164         (Incremental_inputs::report_archive): Remove.
9165         (Incremental_inputs::report_archive_begin): New function.
9166         (Incremental_inputs::report_archive_end): New function.
9167         (Incremental_inputs::report_object): New function.
9168         (Incremental_inputs::finalize_inputs): Remove.
9169         (Incremental_inputs::report_input_section): New function.
9170         (Incremental_inputs::report_script): Rewrite.
9171         (Incremental_inputs::finalize): Do nothing but finalize string table.
9172         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9173         (Incremental_inputs::sized_create_inputs_section_data): Remove.
9174         (Incremental_inputs::create_data_sections): New function.
9175         (Incremental_inputs::relocs_entsize): New function.
9176         (Output_section_incremental_inputs::set_final_data_size): New function.
9177         (Output_section_incremental_inputs::do_write): New function.
9178         (Output_section_incremental_inputs::write_header): New function.
9179         (Output_section_incremental_inputs::write_input_files): New function.
9180         (Output_section_incremental_inputs::write_info_blocks): New function.
9181         (Output_section_incremental_inputs::write_symtab): New function.
9182         * incremental.h (Incremental_script_entry): Forward declaration.
9183         (Incremental_object_entry): Forward declaration.
9184         (Incremental_archive_entry): Forward declaration.
9185         (Incremental_inputs): Forward declaration.
9186         (Incremental_inputs_header_data): Remove.
9187         (Incremental_inputs_header): Remove.
9188         (Incremental_inputs_header_write): Remove.
9189         (Incremental_inputs_entry_data): Remove.
9190         (Incremental_inputs_entry): Remove.
9191         (Incremental_inputs_entry_write): Remove.
9192         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
9193         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
9194         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9195         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
9196         Likewise.
9197         (Incremental_input_entry): New class.
9198         (Incremental_script_entry): New class.
9199         (Incremental_object_entry): New class.
9200         (Incremental_archive_entry): New class.
9201         (Incremental_inputs::Incremental_inputs): Initialize new data members.
9202         (Incremental_inputs::report_inputs): Remove.
9203         (Incremental_inputs::report_archive): Remove.
9204         (Incremental_inputs::report_archive_begin): New function.
9205         (Incremental_inputs::report_archive_end): New function.
9206         (Incremental_inputs::report_object): Change prototype.
9207         (Incremental_inputs::report_input_section): New function.
9208         (Incremental_inputs::report_script): Change prototype.
9209         (Incremental_inputs::get_reloc_count): New function.
9210         (Incremental_inputs::set_reloc_count): New function.
9211         (Incremental_inputs::create_data_sections): New function.
9212         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9213         (Incremental_inputs::inputs_section): New function.
9214         (Incremental_inputs::symtab_section): New function.
9215         (Incremental_inputs::relocs_section): New function.
9216         (Incremental_inputs::get_stringpool): Add const.
9217         (Incremental_inputs::command_line): Add const.
9218         (Incremental_inputs::inputs): Remove.
9219         (Incremental_inputs::command_line_key): New function.
9220         (Incremental_inputs::input_file_count): New function.
9221         (Incremental_inputs::input_files): New function.
9222         (Incremental_inputs::relocs_entsize): New function.
9223         (Incremental_inputs::sized_create_inputs_section_data): Remove.
9224         (Incremental_inputs::finalize_inputs): Remove.
9225         (Incremental_inputs::Input_info): Remove.
9226         (Incremental_inputs::lock_): Remove.
9227         (Incremental_inputs::inputs_): Change type.
9228         (Incremental_inputs::inputs_map_): Remove.
9229         (Incremental_inputs::current_object_entry_): New data member.
9230         (Incremental_inputs::inputs_section_): New data member.
9231         (Incremental_inputs::symtab_section_): New data member.
9232         (Incremental_inputs::relocs_section_): New data member.
9233         (Incremental_inputs::reloc_count_): New data member.
9234         (Incremental_inputs_reader): New class.
9235         (Incremental_symtab_reader): New class.
9236         (Incremental_relocs_reader): New class.
9237         * layout.cc (Layout::finalize): Move finalization of incremental info
9238         and creation of incremental info sections to follow finalization of
9239         symbol table.  Set offsets for postprocessing sections.
9240         (Layout::create_incremental_info_sections): Call
9241         Incremental_inputs::create_data_sections.  Add incremental symtab
9242         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
9243         sections to layout after input sections.
9244         * layout.h (struct Timespec): Forward declaration.
9245         (Layout::incremental_inputs): Add const.
9246         (Layout::create_incremental_info_sections): Add parameter.
9247         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
9248         * object.cc: Include incremental.h.
9249         (Relobj::finalize_incremental_relocs): New function.
9250         (Sized_relobj::do_layout): Record input sections in incremental info.
9251         * object.h (Object::output_section): New function.
9252         (Object::output_section_offset): Moved from Relobj.
9253         (Object::get_incremental_reloc_base): New function.
9254         (Object::get_incremental_reloc_count): New function.
9255         (Object::do_output_section): New function.
9256         (Object::do_output_section_offset): Moved from Relobj.
9257         (Object::do_get_incremental_reloc_base): New function.
9258         (Object::do_get_incremental_reloc_count): New function.
9259         (Object::Object): Initialize new data members.
9260         (Relobj::output_section): Renamed do_output_section and moved to
9261         protected.
9262         (Relobj::output_section_offset): Moved to Object.
9263         (Relobj::do_get_incremental_reloc_base): New function.
9264         (Relobj::do_get_incremental_reloc_count): New function.
9265         (Relobj::allocate_incremental_reloc_counts): New function.
9266         (Relobj::count_incremental_reloc): New function.
9267         (Relobj::finalize_incremental_relocs): New function.
9268         (Relobj::next_incremental_reloc_index): New function.
9269         (Relobj::reloc_counts_): New data member.
9270         (Relobj::reloc_bases_): New data member.
9271         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
9272         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
9273         (Sized_relobj::incremental_relocs_scan): New function.
9274         (Sized_relobj::incremental_relocs_scan_reltype): New function.
9275         (Sized_relobj::incremental_relocs_write): New function.
9276         (Sized_relobj::incremental_relocs_write_reltype): New function.
9277         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
9278         incremental link.
9279         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
9280         archives and object files elsewhere.
9281         (Add_symbols::run): Report object files here.
9282         (Finish_group::run): Report end of archive at end of group.
9283         * reloc.cc: Include layout.h, incremental.h.
9284         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
9285         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
9286         (Sized_relobj::incremental_relocs_scan): New function.
9287         (Sized_relobj::incremental_relocs_scan_reltype): New function.
9288         (Sized_relobj::do_relocate_sections): Write incremental relocations.
9289         (Sized_relobj::incremental_relocs_write): New function.
9290         (Sized_relobj::incremental_relocs_write_reltype): New function.
9291         * script.cc (read_input_script): Rewrite test for incremental link.
9292         Change call to Incremental_inputs::report_script.
9293         * symtab.h (Symbol_table::first_global_index): New function.
9294         (Symbol_table::output_count): New function.
9295
9296 2010-08-12  Doug Kwan  <dougkwan@google.com>
9297
9298         * arm.cc (Target_arm::merge_object_attributes): Check command line
9299         options --no-wchar-size-warning and --no-enum-size-warning.
9300         * options.h (General_options): Add ld-compatible options
9301         --no-enum-size-warning and --no-wchar-size-warning.
9302
9303 2010-08-04  Ian Lance Taylor  <iant@google.com>
9304
9305         * x86_64.cc (Target_x86_64::Scan::local): Use
9306         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
9307         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
9308         (Target_x86_64::Scan::global): Likewise.
9309         (Target_x86_64::Relocate::relocate): Likewise.
9310         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
9311         Likewise.
9312
9313 2010-08-03  Cary Coutant  <ccoutant@google.com>
9314
9315         * merge.cc (Output_merge_string::do_add_input_section): Count strings
9316         to reserve space in merged_strings vector. Keep total input size
9317         for stats.
9318         (Output_merge_string::do_print_merge_stats): Print total input size.
9319         * merge.h (Output_merge_string): Add input_size_ field.
9320         * stringpool.cc (Stringpool_template::string_length): Move
9321         implementations out of Stringpool_template class and place in
9322         stringpool.h.
9323         * stringpool.h (string_length): Move out of Stringpool_template.
9324
9325 2010-08-03  Ian Lance Taylor  <iant@google.com>
9326
9327         PR 11712
9328         * layout.cc (relaxation_loop_body): If address of load segment is
9329         set, adjust address to include headers if possible.
9330
9331 2010-08-03  Ian Lance Taylor  <iant@google.com>
9332
9333         * version.cc (version_string): Bump to 1.10.
9334
9335 2010-08-03  Ian Lance Taylor  <iant@google.com>
9336
9337         PR 11805
9338         * layout.h (enum Output_section_order): Define.
9339         (class Layout): Update declarations.
9340         * layout.cc (Layout::get_output_section): Add order parameter.
9341         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
9342         is_first_non_relro parameters.  Change all callers.
9343         (Layout::choose_output_section): Likewise.
9344         (Layout::add_output_section_data): Likewise.
9345         (Layout::make_output_section): Likewise.  Set order.
9346         (Layout::default_section_order): New function.
9347         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
9348         * output.cc (Output_section::Output_section): Initialize order_.
9349         Don't initialize deleted fields.
9350         (Output_segment::Output_segment): Don't initialize deleted
9351         fields.
9352         (Output_segment::add_output_section_to_load): New function
9353         replacing add_output_section.  Change all callers to call this or
9354         add_output_section_to_nonload.
9355         (Output_segment::add_output_section_to_nonload): New function.
9356         (Output_segment::remove_output_section): Rewrite.
9357         (Output_segment::add_initial_output_data): Likewise.
9358         (Output_segment::has_any_data_sections): Likewise.
9359         (Output_segment::is_first_section_relro): Likewise.
9360         (Output_segment::maximum_alignment): Likewise.
9361         (Output_segment::has_dynamic_reloc): New function replacing
9362         dynamic_reloc_count.  Change all callers.
9363         (Output_segment::has_dynamic_reloc_list): New function replacing
9364         dynamic_reloc_count_list.  Change all callers.
9365         (Output_segment::set_section_addresses): Rewrite.
9366         (Output_segment::set_offset): Rewrite.
9367         (Output_segment::find_first_and_last_list): Remove.
9368         (Output_segment::set_tls_offsets): Rewrite.
9369         (Output_segment::first_section_load_address): Likewise.
9370         (Output_segment::output_section_count): Likewise.
9371         (Output_segment::section_with_lowest_load_address): Likewise.
9372         (Output_segment::write_section_headers): Likewise.
9373         (Output_segment::print_sections_to_map): Likewise.
9374         * output.h (class Output_data): Remove dynamic_reloc_count_
9375         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
9376         (Output_data::add_dynamic_reloc): Rewrite.
9377         (Output_data::has_dynamic_reloc): New function.
9378         (Output_data::dynamic_reloc_count): Remove.
9379         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
9380         is_last_relro_, is_first_non_relro_, is_interp_,
9381         is_dynamic_linker_section_ fields.  Add order and set_order
9382         functions.  Remove is_relro_local, set_is_relro_local,
9383         is_last_relro, set_is_last_relro, is_first_non_relro,
9384         set_is_first_non_relro functions, is_interp, set_is_interp,
9385         is_dynamic_linker_section, and set_is_dynamic_linker_section
9386         functions.
9387         (class Output_segment): Change Output_data_list from std::list to
9388         std:;vector.  Add output_lists_ field.  Remove output_data_ and
9389         output_bss_ fields.  Update declarations.
9390
9391 2010-08-02  Ian Lance Taylor  <iant@google.com>
9392
9393         * arm.cc (Target_arm::gc_process_relocs): Use typename.
9394         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
9395         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
9396
9397 2010-08-02  Ian Lance Taylor  <iant@google.com>
9398
9399         PR 11855
9400         * script.cc (Script_options::Script_options): Initialize
9401         symbol_definitions_ and symbol_references_.
9402         (Script_options::add_symbol_assignment): Update
9403         symbol_definitions_ and symbol_references_.
9404         (Script_options::add_symbol_reference): New function.
9405         (script_symbol): New function.
9406         * script.h (class Script_options): Add symbol_definitions_ and
9407         symbol_references_ fields.
9408         (Script_options::referenced_const_iterator): New type.
9409         (Script_options::referenced_begin): New function.
9410         (Script_options::referenced_end): New function.
9411         (Script_options::is_referenced): New function.
9412         (Script_options::any_unreferenced): New function.
9413         * script-c.h (script_symbol): Declare.
9414         * yyscript.y (exp): Call script_symbol.
9415         * symtab.cc: Include "script.h".
9416         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
9417         Change all callers.  Check symbols referenced by scripts.
9418         (Symbol_table::add_undefined_symbols_from_command_line): Add
9419         layout parameter.  Change all callers.
9420         (Symbol_table::do_add_undefined_symbols_from_command_line):
9421         Likewise.  Break out loop body.  Check symbols referenced by
9422         scripts.
9423         (Symbol_table::add_undefined_symbol_from_command_line): New
9424         function broken out of
9425         do_add_undefined_symbols_from_command_line.
9426         * symtab.h (class Symbol_table): Update declarations.
9427         * archive.cc: Include "layout.h".
9428         (Archive::should_include_member): Add layout parameter.  Change
9429         all callers.  Check for symbol mentioned in expression.
9430         * archive.h (class Archive): Update declaration.
9431         * object.cc (Sized_relobj::do_should_include_member): Add layout
9432         parameter.
9433         * object.h (Object::should_include_member): Add layout parameter.
9434         Change all callers.
9435         (Object::do_should_include_member): Add layout parameter.
9436         (class Sized_relobj): Update declaration.
9437         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
9438         parameter.
9439         * dynobj.h (class Sized_dynobj): Update declaration.
9440         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
9441         layout parameter.
9442         * plugin.h (class Sized_pluginobj): Update declaration.
9443
9444 2010-08-02  Ian Lance Taylor  <iant@google.com>
9445
9446         PR 11866
9447         * output.cc (Output_segment::set_offset): Search for the first and
9448         last sections rather than assuming that the list is in order.
9449         (Output_segment::find_first_and_last_list): New function.
9450         * output.h (class Output_segment): Update declarations.
9451         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
9452         (relro_strip_test_SOURCES): New variable.
9453         (relro_strip_test_DEPENDENCIES): New variable.
9454         (relro_strip_test_LDFLAGS): New variable.
9455         (relro_strip_test_LDADD): New variable.
9456         (relro_strip_test.so): New target.
9457
9458 2010-08-02  Ian Lance Taylor  <iant@google.com>
9459
9460         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
9461         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
9462         (Target_i386::got_tlsdesc_section): New function.
9463         (Target_i386::got_section): Create space for GOT entries for
9464         TLSDESC relocations.
9465         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
9466         R_386_TLS_GOTDESC.
9467         (Target_i386::Scan::global): Likewise.
9468         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
9469         using TLSDESC GOT.
9470         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
9471         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
9472         (Target_x86_64::got_tlsdesc_section): New function.
9473         (Target_x86_64::got_section): Create space for GOT entries for
9474         TLSDESC relocations.
9475         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
9476         R_386_TLS_GOTDESC.
9477         (Target_x86_64::Scan::global): Likewise.
9478         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
9479         using TLSDESC GOT.
9480
9481 2010-08-02  Ian Lance Taylor  <iant@google.com>
9482
9483         * testsuite/final_layout.sh: Use dc to convert from hex to
9484         decimal.
9485
9486 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
9487
9488         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
9489         paramter to the call to gold::gc_process_relocs.
9490         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
9491         paramter to the call to gold::gc_process_relocs.
9492         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
9493         parameter to the call to gold::gc_process_relocs.
9494         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
9495         template parameter to the call to gold::gc_process_relocs.
9496         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
9497         paramter to the call to gold::gc_process_relocs.
9498         * gc.h (get_embedded_addend_size): New function.
9499         (gc_process_relocs): Save the size of the reloc for use by ICF.
9500         * icf.cc (get_section_contents): Get the addend from the text section
9501         for SHT_REL relocation sections.
9502         * icf.h (Icf::Reloc_addend_size_info): New typedef.
9503         (Icf::Reloc_info): Add new member reloc_addend_size_info.
9504         * int_encoding.h (read_from_pointer): New overloaded function.
9505         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
9506         * testsuite/icf_sht_rel_addend_test.sh: New file.
9507         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
9508         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
9509
9510 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9511
9512         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
9513         * Makefile.in: Regenerate.
9514         * testsuite/Makefile.in: Regenerate.
9515
9516 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
9517
9518         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
9519         * gold/testsuite/debug_msg.cc: Likewise.
9520         * gold/testsuite/odr_violation1.cc
9521         * gold/testsuite/odr_violation2.cc
9522
9523 2010-07-21  Cary Coutant  <ccoutant@google.com>
9524
9525         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
9526         string, and length fields.
9527         (Output_merge_string::Merged_strings_list): New type.
9528         (Output_merge_string::Merged_strings_lists): New typedef.
9529         (Output_merge_string): Replace merged_strings_ with
9530         merged_strings_lists_.
9531         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
9532         Merged_strings_list per input object and section.  Don't store pointer
9533         to the string.  Don't store length with each merged string entry.
9534         (Output_merge_string::finalize_merged_data): Loop over list of merged
9535         strings lists.  Recompute length of each merged string.
9536
9537 2010-07-15  Cary Coutant  <ccoutant@google.com>
9538
9539         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
9540         here.
9541
9542 2010-07-14  Ian Lance Taylor  <iant@google.com>
9543
9544         * descriptors.cc (Descriptors::open): Report correct name in error
9545         message.
9546
9547 2010-07-13  Doug Kwan  <dougkwan@google.com>
9548
9549         * arm.cc (Arm_input_section::Arm_input_section): For a
9550         SHT_ARM_EXIDX section, always keeps the input sections.
9551         (Arm_input_section::set_exidx_section_link): New method.
9552         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
9553         has_errors_ to false.
9554         (Arm_exidx_input_section::has_errors,
9555         Arm_exidx_input_section::set_has_errors): New methods.
9556         (Arm_exidx_input_section::has_errors_): New data member.
9557         (Arm_relobj::get_exidx_shndx_list): New method.
9558         (Arm_output_section::append_text_sections_to_list): Do not skip
9559         section without SHF_EXECINSTR.
9560         (Arm_output_section::fix_exidx_coverage): Skip input sections with
9561         errors.
9562         (Arm_relobj::make_exidx_input_section): Add new parameter for text
9563         section header.  Make error messages more verbose.  Check for
9564         a non-executable section linked to an EXIDX section.
9565         (Arm_relobj::do_read_symbols): Remove error checking, which has been
9566         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
9567         check that there is no deferred EXIDX section if we exit early.
9568         Instead of not making an EXIDX section in case of an error, make one
9569         and set the has_errors flag of it.
9570         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
9571         in a relocatable link.
9572         (Target_arm::do_relax): Look for the EXIDX output section instead of
9573         assuming that it is called .ARM.exidx.
9574         (Target_arm::fix_exidx_coverage): Add a new parameter for input
9575         section list.  Do not check for SHF_EXECINSTR section flags but
9576         skip any input section with errors.
9577         * output.cc (Output_section::Output_section): Initialize
9578         always_keeps_input_sections_ to false.
9579         (Output_section::add_input_section): Check for
9580         always_keeps_input_sections_.
9581         *  output.h (Output_section::always_keeps_input_sections,
9582         Output_section::set_always_keeps_input_sections): New methods.
9583         (Output_section::always_keeps_input_sections): New data member.
9584
9585 2010-07-13  Rafael Espindola  <espindola@google.com>
9586
9587         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
9588         * fileread.h (Input_file): Add try_extra_search_path and find_file.
9589
9590 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
9591             Ian Lance Taylor  <iant@google.com>
9592
9593         * output.h (Output_section_lookup_maps::add_merge_section):
9594         Correct check of whether value was inserted.
9595         (Output_section_lookup_maps::add_merge_input_section): Likewise.
9596         (Output_section_lookup_maps::add_relaxed_input_section):
9597         Likewise.
9598         * arm.cc (Target_arm::got_section): Remove used local os.
9599         * i386.cc (Target_i386::got_section): Likewise.
9600         * x86_64.cc (Target_x86_64::got_section): Likewise.
9601         * sparc.cc (Target_sparc::got_section): Likewise.
9602         (Target_sparc::relocate): Remove unused local have_got_offset.
9603         * powerpc.cc (Target_powerpc::relocate): Likewise.
9604
9605 2010-07-13  Ian Lance Taylor  <iant@google.com>
9606
9607         * compressed_output.cc (zlib_decompress): Fix signature in
9608         !HAVE_ZLIB_H case.
9609
9610         * archive.cc (Archive::include_member): Unlock an external member
9611         of a thin archive.  Don't bother to delete an object we know is
9612         NULL.
9613
9614 2010-07-12  Cary Coutant  <ccoutant@google.com>
9615
9616         * compressed_output.cc (zlib_decompress): New function.
9617         (get_uncompressed_size): New function.
9618         (decompress_input_section): New function.
9619         * compressed_output.h (get_uncompressed_size): New function.
9620         (decompress_input_section): New function.
9621         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
9622         Handle compressed debug sections.
9623         * layout.cc (is_compressed_debug_section): New function.
9624         (Layout::output_section_name): Map compressed section names to
9625         canonical names.
9626         * layout.h (is_compressed_debug_section): New function.
9627         (is_debug_info_section): Recognize compressed debug sections.
9628         * merge.cc: Include compressed_output.h.
9629         (Output_merge_data::do_add_input_section): Handle compressed
9630         debug sections.
9631         (Output_merge_string::do_add_input_section): Handle compressed
9632         debug sections.
9633         * object.cc: Include compressed_output.h.
9634         (Sized_relobj::Sized_relobj): Initialize new data members.
9635         (build_compressed_section_map): New function.
9636         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
9637         * object.h (Object::section_is_compressed): New method.
9638         (Object::do_section_is_compressed): New method.
9639         (Sized_relobj::Compressed_section_map): New type.
9640         (Sized_relobj::do_section_is_compressed): New method.
9641         (Sized_relobj::compressed_sections_): New data member.
9642         * output.cc (Output_section::add_input_section): Handle compressed
9643         debug sections.
9644         * reloc.cc: Include compressed_output.h.
9645         (Sized_relobj::write_sections): Handle compressed debug sections.
9646
9647 2010-07-08  Cary Coutant  <ccoutant@google.com>
9648
9649         * resolve.cc (Symbol_table::resolve): Remember whether undef was
9650         weak when resolving to a dynamic def.
9651         (Symbol_table::should_override): Add adjust_dyndef flag; set it
9652         for weak undef/dynamic def cases. Adjust callers.
9653         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
9654         undef_binding_weak_.
9655         (Symbol_table::sized_write_globals): Adjust symbol binding.
9656         (Symbol_table::sized_write_symbol): Add binding parameter.
9657         * symtab.h (Symbol::set_undef_binding): New method.
9658         (Symbol::is_undef_binding_weak): New method.
9659         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
9660         (Symbol_table::should_override): Add new parameter.
9661         (Symbol_table::sized_write_symbol): Add new parameter.
9662
9663         * testsuite/weak_undef_file1.cc: Add new test case.
9664         * testsuite/weak_undef_file2.cc: Fix header comment.
9665         * testsuite/weak_undef_test.cc: Add new test case.
9666
9667 2010-06-29  Doug Kwan  <dougkwan@google.com>
9668
9669         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
9670         Initialize USE_SYMBOL_.
9671         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
9672         definition.
9673         (Arm_reloc_property::uses_symbol_): New data member declaration.
9674         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
9675         uses symbol value and symbol is undefined but not weakly undefined.
9676
9677 2010-06-28  Rafael Espindola  <espindola@google.com>
9678
9679         * plugin.cc (Plugin::load): Use dlerror.
9680
9681 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
9682
9683         * symtab.cc (detect_odr_violations): When reporting an ODR
9684         violation, report an object where the symbol is defined.
9685
9686 2010-06-25  Doug Kwan  <dougkwan@google.com>
9687
9688         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
9689         (Target_arm::section_may_have_icf_unsafe_pointers): New method
9690         definition.
9691         (Target_arm::Scan::local_reloc_may_be_function_pointer,
9692         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
9693         target hook to detect function points.
9694         (Target_arm::Scan::possible_function_pointer_reloc): New method.
9695         * icf.h (Icf::check_section_for_function_pointers): Change type of
9696         parameter SECTION_NAME to const reference to std::string.  Use
9697         target hook to determine if section may have unsafe pointers.
9698         * target.h (Target::section_may_have_icf_unsafe_pointers): New
9699         method definition.
9700
9701 2010-06-21  Rafael Espindola  <espindola@google.com>
9702
9703         * fileread.cc (Input_file::find_fie): New
9704         (Input_file::open): Use Input_file::find_fie.
9705         * fileread.h (Input_file::find_fie): New
9706         * plugin.cc (set_extra_library_path): New.
9707         (Plugin::load): Add set_extra_library_path to the transfer vector.
9708         (Plugin_manager::set_extra_library_path): New.
9709         (Plugin_manager::add_input_file): Use the extra search path if set.
9710         (set_extra_library_path(): New.
9711         * plugin.h (Plugin_manager): Add set_extra_library_path and
9712         extra_search_path_.
9713
9714 2010-06-19  Cary Coutant  <ccoutant@google.com>
9715
9716         * layout.cc (gdb_sections): Add .debug_types.
9717         (lines_only_debug_sections): Likewise.
9718
9719 2010-06-18  Rafael Espindola  <espindola@google.com>
9720
9721         * plugin.cc (add_input_file,add_input_library)
9722         (Plugin_manager::add_input_file): Make filename arguments const.
9723         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
9724         const.
9725
9726 2010-06-16  Doug Kwan  <dougkwan@google.com>
9727
9728         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
9729         .ARM.attributes section if we have not merged any input
9730         attributes sections.
9731
9732 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9733
9734         * arm.cc: Allow combining objects with no EABI version
9735         information.
9736
9737 2010-06-15  Rafael Espindola  <espindola@google.com>
9738
9739         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
9740
9741 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9742
9743         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
9744         (struct iovec): Correct !HAVE_READV definition.
9745
9746 2010-06-10  Cary Coutant  <ccoutant@google.com>
9747
9748         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
9749         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
9750         reloc sections.
9751         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
9752
9753         PR 11683
9754         * symtab.h (Symbol::is_placeholder): New member function.
9755         * target-reloc.h (relocate_section): Check for placeholder symbols.
9756
9757         * testsuite/Makefile.am (plugin_test_8): New test.
9758         (plugin_test_9): New test.
9759         * testsuite/Makefile.in: Regenerate.
9760
9761 2010-06-09  Nick Clifton  <nickc@redhat.com>
9762
9763         * yyscript.y (input_list_element): Allow strings prefixed with
9764         the '-' character.  Treat these as libraries.
9765         * script.cc (script_add_library): New function.  Adds a library
9766         specified by "-l<name>" found in an input script.
9767         * script-c.h: Add prototype for script_add_library.
9768
9769 2010-06-07  Doug Kwan  <dougkwan@google.com>
9770
9771         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
9772         Restrict stub-group size to be within long conditional branch
9773         range when working around cortex-A8 erratum.
9774
9775 2010-06-07  Damien Diederen  <dd@crosstwine.com>
9776
9777         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
9778         #ifdef typo.
9779
9780 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
9781
9782         PR gold/11658
9783         * output.cc
9784         (Output_section::Input_section_sort_entry::compare_section_ordering):
9785         Change to return non-zero correctly.
9786         (Output_section::Input_section_sort_section_order_index_compare
9787         ::operator()): Change to fix ambiguity in comparisons.
9788
9789 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
9790
9791         * gold.h (is_wildcard_string): New function.
9792         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
9793         (Layout::layout_eh_frame): Ditto.
9794         (Layout::find_section_order_index): New method.
9795         (Layout::read_layout_from_file): New method.
9796         * layout.h (Layout::find_section_order_index): New method.
9797         (Layout::read_layout_from_file): New method.
9798         (Layout::input_section_position_): New private member.
9799         (Layout::input_section_glob_): New private member.
9800         * main.cc (main): Call read_layout_from_file here.
9801         * options.h (--section-ordering-file): New option.
9802         * output.cc (Output_section::input_section_order_specified_): New
9803         member.
9804         (Output_section::Output_section): Initialize new member.
9805         (Output_section::add_input_section): Add new parameter.
9806         Keep input sections when --section-ordering-file is used.
9807         (Output_section::set_final_data_size): Sort input sections when
9808         section ordering file is specified.
9809         (Output_section::Input_section_sort_entry): Add new parameter.
9810         Check sorting type.
9811         (Output_section::Input_section_sort_entry::compare_section_ordering):
9812         New method.
9813         (Output_section::Input_section_sort_compare::operator()): Change to
9814         consider section_order_index.
9815         (Output_section::Input_section_sort_init_fini_compare::operator()):
9816         Change to consider section_order_index.
9817         (Output_section::Input_section_sort_section_order_index_compare
9818         ::operator()): New method.
9819         (Output_section::sort_attached_input_sections): Change to sort
9820         according to section order when specified.
9821         (Output_section::add_input_section<32, true>): Add new parameter.
9822         (Output_section::add_input_section<64, true>): Add new parameter.
9823         (Output_section::add_input_section<32, false>): Add new parameter.
9824         (Output_section::add_input_section<64, false>): Add new parameter.
9825         * output.h (Output_section::add_input_section): Add new parameter.
9826         (Output_section::input_section_order_specified): New
9827         method.
9828         (Output_section::set_input_section_order_specified): New method.
9829         (Input_section::Input_section): Initialize section_order_index_.
9830         (Input_section::section_order_index): New method.
9831         (Input_section::set_section_order_index): New method.
9832         (Input_section::section_order_index_): New member.
9833         (Input_section::Input_section_sort_section_order_index_compare): New
9834         struct.
9835         (Output_section::input_section_order_specified_): New member.
9836         * script-sections.cc (is_wildcard_string): Delete and move modified
9837         method to gold.h.
9838         (Output_section_element_input::Output_section_element_input): Modify
9839         call to is_wildcard_string.
9840         (Output_section_element_input::Input_section_pattern
9841         ::Input_section_pattern): Ditto.
9842         (Output_section_element_input::Output_section_element_input): Ditto.
9843         * testsuite/Makefile.am (final_layout): New test case.
9844         * testsuite/Makefile.in: Regenerate.
9845         * testsuite/final_layout.cc: New file.
9846         * testsuite/final_layout.sh: New file.
9847
9848 2010-06-01  Rafael Espindola  <espindola@google.com>
9849
9850         * plugin.cc (Plugin::load): Pass the output name to the plugin.
9851
9852 2010-06-01  Rafael Espindola  <espindola@google.com>
9853
9854         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
9855         visibility of symbols.
9856
9857 2010-05-27  Doug Kwan  <dougkwan@google.com>
9858
9859         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
9860         from start of output section instead of address for a local symbol
9861         in a merged or relaxed section when doing a relocatable link.
9862
9863 2010-05-26  Rafael Espindola  <espindola@google.com>
9864
9865         PR 11604
9866         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
9867         adding sections the garbage collector removed.
9868         * gold/testsuite/Makefile.am: Add test.
9869         * gold/testsuite/Makefile.in: Regenerate.
9870         * gold/testsuite/plugin_test_7.sh: New.
9871         * gold/testsuite/plugin_test_7_1.c: New.
9872         * gold/testsuite/plugin_test_7_2.c: New.
9873
9874 2010-05-26  Rafael Espindola  <espindola@google.com>
9875
9876         * script-sections.cc (Output_section_definition::set_section_addresses):
9877         Check for --section-start.
9878
9879 2010-05-26  Doug Kwan  <dougkwan@google.com>
9880
9881         * arm.cc (Arm_scan_relocatable_relocs): New class.
9882         (Target_arm::relocate_special_relocatable): New method.
9883         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
9884         (Arm_relocate_functions::thumb_branch_common): Same.
9885         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
9886         instead of Default_scan_relocatable_relocs.
9887         * target-reloc.h (relocate_for_relocatable): Let target handle
9888         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
9889         * target.h (Sized_target::relocate_special_relocatable): New method.
9890
9891 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9892
9893         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
9894
9895 2010-05-23  Doug Kwan  <dougkwan@google.com>
9896
9897         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
9898         instead of a cast.
9899         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
9900         with a direct branch, not a conditional branch, to a stub.
9901         * merge.cc (Output_merge_base::record_input_section): New method
9902         defintion.
9903         (Output_merge_data::do_add_input_section): Record input section if
9904         keeps-input-sections flag is set.
9905         (Output_merge_string::do_add_input_section): Ditto.
9906         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
9907         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
9908         INPUT_SECTIONS_.
9909         (Output_merge_base::keeps_input_sections,
9910         Output_merge_base::set_keeps_input_sections,
9911         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
9912         method definitions.
9913         (Output_merge_base::Input_sections): New type declaration.
9914         (Output_merge_base::input_sections_begin,
9915         Output_merge_base::input_sections_end,
9916         Output_merge_base::do_set_keeps_input_sections): New method definitions.
9917         (Output_merge_base::bool keeps_input_sections_,
9918         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
9919         Output_merge_base::input_sections_): New data members.
9920         (Output_merge_data::do_set_keeps_input_sections): New method
9921         defintion.
9922         (Output_merge_string::do_set_keeps_input_sections): Ditto.
9923         * output.cc (Output_section::Input_section::relobj): Move method
9924         defintion from class declaration to here and handle merge sections.
9925         (Output_section::Input_section::shndx): Ditto.
9926         (Output_section::Output_section): Remove initializations of removed
9927         data members and initialize new data member LOOKUP_MAPS_.
9928         (Output_section::add_input_section): Set keeps-input-sections flag
9929         for a newly created merge output section as appropriate.  Adjust code
9930         to use Output_section_lookup_maps class.
9931         (Output_section::add_relaxed_input_section): Adjst code for lookup
9932         maps code refactoring.
9933         (Output_section::add_merge_input_section): Add a new parameter
9934         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
9935         class.  If adding input section to a newly created merge output
9936         section fails, remove the new merge section.
9937         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
9938         Adjust code for use of the Output_section_lookup_maps class.
9939         (Output_section::find_merge_section): Ditto.
9940         (Output_section::build_lookup_maps): New method defintion.
9941         (Output_section::find_relaxed_input_section): Adjust code to use
9942         Output_section_lookup_maps class.
9943         (Output_section::get_input_sections): Export merge sections.  Adjust
9944         code to use Output_section_lookup_maps class.
9945         (Output_section:::add_script_input_section): Adjust code to use
9946         Output_section_lookup_maps class.  Update lookup maps for merge
9947         sections also.
9948         (Output_section::discard_states): Use Output_section_lookup_maps.
9949         (Output_section::restore_states): Same.
9950         * output.h (Merge_section_properties): Move class defintion out of
9951         Output_section.
9952         (Output_section_lookup_maps): New class.
9953         (Output_section::Input_section::is_merge_section): New method
9954         defintion.
9955         (Output_section::Input_section::relobj): Move defintion out of class
9956         defintion.  Declare method only.
9957         (Output_section::Input_section::shndx): Ditto.
9958         (Output_section::Input_section::output_merge_base): New method defintion.
9959         (Output_section::Input_section::u2_.pomb): New union field.
9960         (Output_section::Merge_section_by_properties_map,
9961         Output_section::Output_section_data_by_input_section_map,
9962         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
9963         Remove types.
9964         (Output_section::add_merge_input_section): Add new parameter
9965         KEEPS_INPUT_SECTIONS.
9966         (Output_section::build_lookup_maps): New method declaration.
9967         (Output_section::merge_section_map_,
9968         Output_section::merge_section_by_properties_map_,
9969         Output_section::relaxed_input_section_map_,
9970         Output_section::is_relaxed_input_section_map_valid_): Remove data
9971         members.
9972         (Output_section::lookup_maps_): New data member.
9973
9974 2010-05-21  Doug Kwan  <dougkwan@google.com>
9975
9976         PR gold/11619
9977         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
9978         avoid a compilation error.
9979
9980 2010-05-19  Rafael Espindola  <espindola@google.com>
9981
9982         * script-sections.cc (Output_section_definition::allocate_to_segment):
9983         Update the phdrs_list even when the output section is NULL.
9984         * testsuite/Makefile.am: Add test.
9985         * testsuite/Makefile.in: Regenerate.
9986         * testsuite/script_test_9.cc: New.
9987         * testsuite/script_test_9.sh: New.
9988         * testsuite/script_test_9.t: New.
9989
9990 2010-05-19  Doug Kwan  <dougkwan@google.com>
9991
9992         * arm.cc (Arm_input_section::original_size): New method.
9993         (Arm_input_section::do_addralign): Add a cast.
9994         (Arm_input_section::do_output_offset): Remove static cast.
9995         (Arm_input_section::original_addralign,
9996          Arm_input_section::original_size_): Change type to uint32_t.
9997         (Arm_input_section::init): Add safe casts for section alignment
9998         and size.
9999         (Arm_input_section::set_final_data_size): Do not set address and
10000         offset of stub table.
10001         (Arm_output_section::fix_exidx_coverage): Change use of of
10002         Output_section::Simple_input_section to that of
10003         Output_section::Input_section.
10004         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
10005         except for the first pass.
10006         * output.cc (Output_section::get_input_sections): Change type of
10007         input_sections to std::list<Input_section>.
10008         (Output_section::add_script_input_section): Rename from
10009         Output_section::add_simple_input_section.  Change type of SIS
10010         parameter from Simple_input_section to Input_section.
10011         * output.h (Output_section::Simple_input_section): Remove class.
10012         (Output_section::Input_section): Change class visibility to public.
10013         (Output_section::Input_section::addralign): Use stored alignments
10014         for special input sections if set.
10015         (Output_section::Input_section::set_addralign): New method.
10016         (Output_section::get_input_sections): Change parameter type from
10017         list of Simple_input_section to list of Input_section.
10018         (Output_section::add_script_input_section): Rename from
10019         Output_section::add_simple_input_section. Change first parameter's
10020         type from Simple_input_section to Input_section and remove the
10021         second and third parameters.
10022         * script-sections.cc (Input_section::Input_section_list): Change
10023         type to list of Output_section::Input_section/
10024         (Input_section_info::Input_section_info): Change parameter type of
10025         INPUT_SECTION to Output_section::Input_section.
10026         (Input_section_info::input_section): Change return type.
10027         (Input_section_info::input_section_): Change type to
10028         Output_section::Input_section.
10029         (Output_section_element_input::set_section_addresses): Adjust code
10030         to use Output_section::Input_section instead of
10031         Output_section::Simple_input_section.  Adjust code for renaming
10032         of Output_section::add_simple_input_section.
10033         (Orphan_output_section::set_section_addresses): Ditto.
10034
10035 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10036
10037         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
10038         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
10039
10040 2010-05-18  Rafael Espindola  <espindola@google.com>
10041
10042         * options.cc (General_options::finalize): Handle -nostdlib.
10043         * options.h (nostdlib): New option.
10044         * script.cc (script_add_search_dir): Handle -nostdlib.
10045
10046 2010-05-12  Doug Kwan  <dougkwan@google.com>
10047
10048         * arm.cc (Target_arm::do_finalize_sections): Create an empty
10049         attributes section only if there no attributes section after merging.
10050         (Target_arm::merge_object_attributes): Move value of
10051         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
10052         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
10053         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
10054         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
10055         and arm_attr_merge_7.stdout.
10056         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
10057         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
10058         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
10059         arm_attr_merge_7b.o): New rules.
10060         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
10061         arm_attr_merge_7
10062         * testsuite/Makefile.in: Regenerate.
10063         * testsuite/arm_attr_merge.sh: New file.
10064         * testsuite/arm_attr_merge_[67][ab].s: Same.
10065
10066 2010-05-05  Nick Clifton  <nickc@redhat.com>
10067
10068         * po/es.po: Updated Spanish translation.
10069
10070 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
10071
10072         * Makefile.am (install-exec-local): Properly install gold as
10073         default cross linker.
10074         * Makefile.in: Regenerated.
10075
10076 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
10077             Nick Clifton  <nickc@redhat.com>
10078
10079         * configure.ac (install_as_default): Define and set to false
10080         unless --enable-gold or --enable-gold=both/gold has been
10081         specified.
10082         * configure: Regenerate.
10083
10084         * Makefile.am (install-exec-local): Install the executable as
10085         'ld.gold'.  If install_as_default is true then also install it as
10086         'ld'.
10087         * Makefile.in: Regenerated.
10088
10089 2010-04-24  Ian Lance Taylor  <iant@google.com>
10090
10091         * layout.cc (Layout::layout_reloc): In relocatable link don't
10092         combine reloc sections for grouped sections.
10093
10094 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
10095
10096         * gc.h (gc_process_relocs): Pass information on relocs pointing to
10097         sections that are not ordinary to icf.
10098         * icf.cc (get_section_contents): Handle relocation pointing to section
10099         with no object or shndx information.
10100         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
10101         * testsuite/Makefile.in: Regenerate.
10102         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
10103         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
10104
10105 2010-04-22  Ian Lance Taylor  <iant@google.com>
10106
10107         * expression.cc (Expression::Expression_eval_info): Add
10108         result_alignment_pointer field.
10109         (Expression::eval_with_dot): Add result_alignment_pointer
10110         parameter.  Change all callers.
10111         (Expression::eval_maybe_dot): Likewise.
10112         (class Binary_expression): Add alignment_pointer parameter to
10113         left_value and right_value.  Change all callers.
10114         (BINARY_EXPRESSION): Set result alignment.
10115         (class Trinary_expression): Add alignment_pointer parameter to
10116         arg2_value and arg3_value.  Change all callers.
10117         (Trinary_cond::value): Set result alignment.
10118         (Max_expression::value, Min_expression::value): Likewise.
10119         (Align_expression::value): Likewise.
10120         * script-sections.cc (class Sections_element): Add dot_alignment
10121         parameter to set_section_addresses virtual function.  Update
10122         instantiations.
10123         (class Output_section_element): Likewise.
10124         (Script_sections::create_segments): Add dot_alignment parameter.
10125         Change all callers.
10126         (Script_sections::create_segments_from_phdrs_clause): Likewise.
10127         (Script_sections::set_phdrs_clause_addresses): Likewise.
10128         * script-sections.h: Update declarations.
10129         * script.h: Update declarations.
10130         * output.h (Output_segment::set_minimum_p_align): Don't decrease
10131         min_p_align.
10132         * testsuite/script_test_3.t: Set large alignment.
10133         * testsuite/script_test_3.sh: Make sure that at least one LOAD
10134         segment has expected alignment.
10135
10136 2010-04-22  Nick Clifton  <nickc@redhat.com>
10137
10138         * po/gold.pot: Updated by the Translation project.
10139         * po/vi.po: Updated Vietnamese translation.
10140
10141 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
10142
10143         * testsuite/Makefile.am (check_PROGRAMS): Add
10144         icf_virtual_function_folding_test.
10145         * testsuite/Makefile.in: Regenerated.
10146
10147 2010-04-15  Andrew Haley  <aph@redhat.com>
10148
10149         * options.h (merge_exidx_entries): New option.
10150         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
10151         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
10152         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
10153         (Target_arm::merge_exidx_entries): New function.
10154         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
10155         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
10156         to Arm_exidx_fixup constructor.
10157         Add new arg, merge_exidx_entries.
10158         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
10159         Arm_output_section::fix_exidx_coverage.
10160
10161 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
10162
10163         * icf.cc (get_section_contents): Check for preemptible functions.
10164         Ignore addend when appropriate.
10165         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
10166         section folded.
10167         (add_from_relobj): Check for section folded.
10168         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
10169         * symtab.h (should_add_dynsym_entry): Add new parameter.
10170         * target-reloc.h (scan_relocs): Check for section folded.
10171         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
10172         Check reloc types for function pointers in shared objects.
10173         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
10174         case.
10175         (icf_preemptible_functions_test): New test case.
10176         (icf_string_merge_test): New test case.
10177         * testsuite.Makefile.in: Regenerate.
10178         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
10179         bar_glob.  Refactor code.
10180         * testsuite/icf_preemptible_functions_test.cc: New file.
10181         * testsuite/icf_preemptible_functions_test.sh: New file.
10182         * testsuite/icf_string_merge_test.cc: New file.
10183         * testsuite/icf_string_merge_test.sh: New file.
10184         * testsuite/icf_virtual_function_folding_test.cc: New file.
10185         * testsuite/icf_virtual_function_folding_test.sh: New file.
10186
10187 2010-04-14  Doug Kwan  <dougkwan@google.com>
10188
10189         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
10190         for local symbol recounting if we remove a section due to ICF.
10191         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
10192         there are no regular objects in input.
10193
10194 2010-04-13  Doug Kwan  <dougkwan@google.com>
10195
10196         * arm.cc (Arm_input_section::set_final_data_size): Compute
10197         accurate final data size instead of using current data size.
10198
10199 2010-04-09  Doug Kwan  <dougkwan@google.com>
10200
10201         * layout.cc (Layout::choose_output_section): Handle script section
10202         types.
10203         (Layout::make_output_section_for_script): Add section type parameter.
10204         Handle script section types.
10205         * layout.h (Layout::make_output_section_for_script): Add section
10206         type parameter.
10207         * output.cc (Output_section::Output_section): Initialize data member
10208         is_noload_.
10209         (Output_section::do_reset_address_and_file_offset): Do not set address
10210         to 0 if section is a NOLOAD section.
10211         * output.h (Output_section::is_noload): New method.
10212         (Output_section::set_is_noload): Ditto.
10213         (Output_section::is_noload_): New data member.
10214         * script-c.h (Script_section_type): New enum type.
10215         (struct Parser_output_section_header): Add new file section_type.
10216         * script-sections.cc (Sections_element::output_section_name): Add
10217         parameter for returning script section type.
10218         (Output_section_definition::output_section_name): Ditto.
10219         (Output_section_definition::section_type)P; New method.
10220         (Output_section_definiton::script_section_type_name): Ditto.
10221         (Output_section_definition::script_section_type_): New data member.
10222         (Output_section_definition::Output_section_definition): Initialize
10223         data member Output_section_definition::script_section_type_.
10224         (Output_section_definition::create_sections): Pass script section type
10225         to Layout::make_output_section_for_script.
10226         (Output_section_definition::output_section_name): Return script
10227         section type to caller.
10228         (Output_section_definition::set_section_address): Do not advance
10229         dot value and load address if section type is NOLOAD.  Set address
10230         of NOLOAD sections regardless of section flags.
10231         (Output_section_definition::print): Print section type if it is
10232         not SCRIPT_SECTION_TYPE_NONE.
10233         (Output_section_definition::section_type): New method.
10234         (Output_section_definition::script_section_type_name): Ditto.
10235         (Script_sections::output_section_name): Add new parameter
10236         PSECTION_TYPE for returning script section type.  Pass it to
10237         section elements.  Handle discard sections.
10238         (Sort_output_sections::operator()): Handle NOLOAD sections.
10239         * script-sections.h (Script_sections::Section_type): New enum type.
10240         (Script_sections::output_section_name): Add a new parameter for
10241         returning script section type.
10242         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
10243         INFO and NOLOAD.
10244         * yyscript.y (union): Add new field SECTION_TYPE.
10245         (COPY, DSECT, INFO, NOLOAD): New tokens.
10246         (opt_address_and_section_type): Change type to output_section_header.
10247         (section_type): New non-terminal
10248         (section_header): Handle section type.
10249         (opt_address_and_section_type): Return section type value.
10250
10251 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
10252
10253         * testsuite/plugin_common_test_1.c (foo): Add prototype.
10254         * testsuite/plugin_common_test_2.c (foo): Likewise.
10255
10256 2010-04-08  Doug Kwan  <dougkwan@google.com>
10257
10258         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
10259         Output_merge_data.
10260         * output.cc (Output_section::add_merge_input_section): Simplify
10261         code and return status of Output_merge_base::add_input_section.
10262         Update merge section map only if Output_merge_base::add_input_section
10263         returns true.
10264
10265 2010-04-07  Doug Kwan  <dougkwan@google.com>
10266
10267         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
10268         if section is marked as containing instructions but has no mapping
10269         symbols.
10270         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
10271         correct section index.
10272         (Arm_relobj::find_linked_text_section): Ditto.
10273
10274 2010-04-07  Cary Coutant  <ccoutant@google.com>
10275
10276         * archive.cc (include_member): Destroy Read_symbols_data object before
10277         releasing file.
10278         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
10279         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
10280         (Read_symbols_data::~Read_symbols_data) New destructor.
10281         (Section_relocs::Section_relocs) New constructor.
10282         (Section_relocs::~Section_relocs) New destructor.
10283         (Read_relocs_data::Read_relocs_data) New constructor.
10284         (Read_relocs_data::~Read_relocs_data) New destructor.
10285         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
10286         pointers to NULL after deleting.
10287
10288 2010-04-07  Doug Kwan  <dougkwan@google.com>
10289
10290         * arm.cc: Replace "endianity" with "endianness" in comments.
10291         (Arm_exidx_cantunwind): Ditto.
10292         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
10293         (Arm_relobj::merge_flags_and_attributes): New method.
10294         (Arm_relobj::merge_flags_and_attributes_): New data member.
10295         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
10296         (Arm_relobj::scan_sections_for_stubs): Ditto.
10297         (Arm_relobj::do_read_symbols): Check to see if we really want to
10298         merge processor-specific flags and attributes.  Exit early if
10299         an object is empty except for section names and the undefined symbol.
10300         (Target_arm::do_finalize_sections): Move check for ELF format to
10301         Arm_relobj::do_read_symbols.  Merge processor specific flags and
10302         attributes from a regular object only when we have determined that
10303         it is aapropriate.  Do not create an .ARM.attributes section in
10304         output if there is no regular input object.
10305         (Target_arm::merge_processor_specific_flags): Check
10306         --warn-mismatch before printing any error.
10307         (Target_arm::merge_object_attributes): Ditto.
10308         * gold.cc (queue_middle_tasks): Handle the case in which there is
10309         no regular object in input.
10310         * options.cc (General_options::parse_EB): New method.
10311         (General_options::parse_EL): Same.
10312         (General_options::General_options): Initialize endianness_.
10313         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
10314         New options.
10315         (General_options::Endianness): New enum.
10316         (General_options::endianness): New method.
10317         (General_options::endianness_): New data member.
10318         * parameters.cc (Parameters::set_options): Check target endianness.
10319         (Parameters::set_target_once): Ditto.
10320         (Parameters::check_target_endianness): New method.
10321         (parameters_force_valid_target): If either -EL or -EB is specified,
10322         use it to define endianness of default target.
10323         * parameters.h (Parameters::check_target_endianness): New method
10324         declaration.
10325         * target.h (class Target): Change "endianity" to "endianness"
10326         in comments.
10327
10328 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10329
10330         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
10331         * configure: Regenerate.
10332         * Makefile.in: Regenerate.
10333         * testsuite/Makefile.in: Regenerate.
10334
10335 2010-04-06  Cary Coutant  <ccoutant@google.com>
10336
10337         gcc PR lto/42757
10338         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
10339         prevailing definitions of common symbols.
10340         * testsuite/plugin_test_6.sh: New test case.
10341         * testsuite/plugin_common_test_1.c: New test case.
10342         * testsuite/plugin_common_test_2.c: New test case.
10343         * testsuite/Makefile.am (plugin_test_6): New test case.
10344         * testsuite/Makefile.in: Regenerate.
10345
10346 2010-04-06  Nick Clifton  <nickc@redhat.com>
10347
10348         * po/vi.po: New Vietnamese translation.
10349
10350 2010-03-30  Doug Kwan  <dougkwan@google.com>
10351
10352         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
10353
10354 2010-03-25  Doug Kwan  <dougkwan@google.com>
10355
10356         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
10357         to avoid a conversion warning on a 32-bit host.
10358
10359 2010-03-24  Ian Lance Taylor  <iant@google.com>
10360
10361         * testsuite/script_test_3.t: Add a TLS segment.
10362         * testsuite/Makefile.am (check_PROGRAMS): Add
10363         tls_phdrs_script_test.
10364         (tls_phdrs_script_test_SOURCES): Define.
10365         (tls_phdrs_script_test_DEPENDENCIES): Define.
10366         (tls_phdrs_script_test_LDFLAGS): Define.
10367         (tls_phdrs_script_test_LDADD): Define.
10368         * testsuite/Makefile.in: Rebuild.
10369
10370 2010-03-23  Cary Coutant  <ccoutant@google.com>
10371
10372         * fileread.cc (find_or_make_view): Fix comment.
10373
10374 2010-03-23  Ian Lance Taylor  <iant@google.com>
10375
10376         * script-sections.cc (class Orphan_section_placement): Define
10377         PLACE_TLS and PLACE_TLS_BSS.
10378         (Orphan_section_placement::Orphan_section_placement): Initialize
10379         new places.
10380         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
10381         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
10382         (tls_script_test_SOURCES): Define.
10383         (tls_script_test_DEPENDENCIES): Define.
10384         (tls_script_test_LDFLAGS): Define.
10385         (tls_script_test_LDADD): Define.
10386         * testsuite/Makefile.in: Rebuild.
10387
10388 2010-03-22  Doug Kwan  <dougkwan@google.com>
10389
10390         * arm.cc (Arm_relocate_functions::abs8,
10391         Arm_relocate_functions::abs16): Use correct check for overflow
10392         specified in the ARM ELF specs.
10393         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
10394         target of a BLX instruction specially.
10395         (Reloc_stub::stub_type_for_reloc): Ditto.
10396         (Relocate::relocate): Use symbolic names instead of numeric relocation
10397         codes to report error.
10398         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
10399         workaround.
10400         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
10401         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
10402         thumb2_blx_out_of_range.stdout
10403         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
10404         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
10405         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
10406         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
10407         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
10408         thumb2_blx_in_range, thumb2_blx_in_range.o,
10409         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
10410         thumb2_blx_out_of_range.o): New rules.
10411         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
10412         thumb2_blx_in_range and thumb2_blx_out_of_range.
10413         * testsuite/Makefile.in: Regenerate.
10414         * arm_branch_in_range.sh: Add tests for THUMB BLX.
10415         * testsuite/thumb_blx_in_range.s: New file.
10416         * testsuite/thumb_blx_out_of_range.s: New file.
10417
10418 2010-03-22  Rafael Espindola  <espindola@google.com>
10419
10420         * archive.cc (Should_include): Move to archive.h.
10421         (should_include_member): Make it a member of Archive.
10422         (Lib_group): New.
10423         (Add_lib_group_symbols): New.
10424         * archive.h: Include options.h.
10425         (Archive_member): Moved from Archive.
10426         (Should_include): Moved from archive.cc.
10427         (Lib_group): New.
10428         (Add_lib_group_symbols): New.
10429         * dynobj.cc (do_should_include_member): New.
10430         * dynobj.h (do_should_include_member): New.
10431         * gold.cc (queue_initial_tasks): Update call to queue.
10432         * main.cc (main): Print lib group stats.
10433         * object.cc (do_should_include_member): New.
10434         * object.h: Include archive.h.
10435         (Object::should_include_member): New.
10436         (Object::do_should_include_member): New.
10437         (Sized_relobj::do_should_include_member): New.
10438         * options.cc (General_options::parse_start_lib): New.
10439         (General_options::parse_end_lib): New.
10440         (Input_arguments::add_file): Handle lib groups.
10441         (Input_arguments::start_group): Check we are not in a lib.
10442         (Input_arguments::start_lib): New.
10443         (Input_arguments::end_lib): New.
10444         * options.h (General_options): Add start_lib and end_lib.
10445         (Input_argument::lib_): New.
10446         (Input_argument::lib): New.
10447         (Input_argument::is_lib): New.
10448         (Input_file_lib): New.
10449         (Input_arguments::in_lib_): New.
10450         (Input_arguments::in_lib): New.
10451         (Input_arguments::start_lib): New.
10452         (Input_arguments::end_lib_): New.
10453         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
10454         in unused members as preempted.
10455         (Sized_pluginobj::do_should_include_member): New.
10456         * plugin.h (Sized_pluginobj::do_should_include_member): New.
10457         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
10458         return the blocker.
10459         (Read_symbols::do_whole_lib_group): New.
10460         (Read_symbols::do_lib_group): New.
10461         (Read_symbols::do_read_symbols): Handle lib groups.
10462         (Read_symbols::get_name): Handle lib groups.
10463         * readsyms.h (Read_symbols): Add an archive member pointer.
10464         (Read_symbols::do_whole_lib_group): New.
10465         (Read_symbols::do_lib_group): New.
10466         (Read_symbols::member_): New.
10467         * script.cc (read_input_script): Update call to queue_soon.
10468
10469 2010-03-19  Doug Kwan  <dougkwan@google.com>
10470
10471         * arm.cc (Stub_table::Stub_table): Initialize new data members
10472         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10473         (Stub_table::add_reloc_stub): Assign stub offset and update
10474         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10475         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
10476         New data members.
10477         (Stub_table::update_data_size_and_addralign): Use
10478         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
10479         instead of going over all reloc stubs.
10480         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
10481         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10482         Stringpool_template::offset_ to size of Stringpool_char.
10483         (Stringpool_template::new_key_offset): Remove code to initialize
10484         Stringpool_template::offset_.
10485         * stringpool.h (Stringpool_template::set_no_zero_null): Set
10486         Stringpool_template::offset_ to zero.
10487
10488 2010-03-15  Doug Kwan  <dougkwan@google.com>
10489
10490         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10491         offset_.
10492         (Stringpool_template::new_key_offset): New method.
10493         (Stringpool_template::add_string): Assign offsets when adding new
10494         strings.
10495         (Stringpool_template::set_string_offsets): Do not set string offsets
10496         when not optimizing.
10497         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
10498         member size_.
10499         (Chunked_vector::clear): Clear size_.
10500         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
10501         (Chunked_vector::size): Return size_.
10502         (Chunked_vector::push_back): Use size_ to find insert position.
10503         (Chunked_vector::size_): New data member.
10504         (Stringpool_template::set_no_zero_null): Assert string set is empty.
10505         (Stringpool_template::new_key_offset): New method declaration.
10506         (Stringpool_template::offset_): New data member.
10507
10508 2010-03-15   Rafael Espindola  <espindola@google.com>
10509
10510         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
10511         Add_symbols' constructor.
10512         * readsyms.h (Add_symbols): Remove the input_group member.
10513
10514 2010-03-10  Ian Lance Taylor  <iant@google.com>
10515
10516         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
10517         target to ask whether a reference to a symbol requires a stack
10518         split.
10519         * target.h (Target::is_call_to_non_split): New function.
10520         (Target::do_is_call_to_non_split): Declare virtual function.
10521         * target.cc: Include "symtab.h".
10522         (Target::do_is_call_to_non_split): New function.
10523         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
10524
10525 2010-03-10  Cary Coutant  <ccoutant@google.com>
10526
10527         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
10528         (File_read::open[1]): Remove initial mapping of whole_file_view_.
10529         (File_read::open[2]): Add whole_file_view_ to list of views.
10530         (File_read::make_view): Remove test of whole_file_view_.
10531         (File_read::find_or_make_view): Create whole_file_view_ if
10532         necessary.
10533         (File_read::clear_views): Replace bool parameter with enum;
10534         adjust all callers.  Don't delete views with permanent data;
10535         do delete cached views and views from archives if
10536         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
10537         if clearing the corresponding view.
10538         * fileread.h (File_read::Clear_views_mode): New enum.
10539         (File_read::View::is_permanent_view): New method.
10540         (File_read::clear_views): Replace bool parameter
10541         with enum; adjust all callers.
10542         * options.h (General_options): Change keep_files_mapped option;
10543         add map_whole_files.
10544         * readsyms.cc (Add_symbols::run): Delete sd_ object before
10545         releasing the file.
10546         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
10547         the file.
10548
10549 2010-03-10  David S. Miller  <davem@davemloft.net>
10550
10551         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
10552
10553 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
10554
10555         * icf.cc (get_section_contents): Add '@' marker after processing the
10556         merge reloc.
10557
10558 2010-03-08  Doug Kwan  <dougkwan@google.com>
10559
10560         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
10561         due to a conversion warning.
10562         (Arm_relobj::update_output_local_symbol_count): Check for local
10563         symbol with unset output index.
10564
10565 2010-03-05  Ian Lance Taylor  <iant@google.com>
10566
10567         * options.h (class General_options): Add --spare-dynamic-tags.
10568         * output.cc (Output_data_dynamic::set_final_data_size): Implement
10569         --spare-dynamic-tags.
10570
10571 2010-03-05  Ian Lance Taylor  <iant@google.com>
10572
10573         * incremental.cc: Include "libiberty.h".
10574
10575 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
10576
10577         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
10578         function, is_info_ member.
10579         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
10580         (Versions::Versions): Update caller.
10581         (Versions::define_base_version): Likewise.
10582         (Versions::add_def): Likewise.
10583
10584 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
10585
10586         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
10587         (Scan::possible_function_pointer_reloc): New function.
10588         (Scan::local_reloc_may_be_function_pointer): Change to call
10589         possible_function_pointer_reloc.
10590         (Scan::global_reloc_may_be_function_pointer): Ditto.
10591         * icf.h (Icf::check_section_for_function_pointers): Change to reject
10592         relocations in ".data.rel.ro._ZTV" section.
10593         * testsuite/icf_safe_so_test.sh: Change to pass i386.
10594         * testsuite/icf_safe_so_test.cc: Ditto.
10595         * testsuite/icf_safe_test.cc: Ditto.
10596         * testsuite/icf_safe_test.sh: Ditto.
10597
10598 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10599             Ian Lance Taylor  <iant@google.com>
10600
10601         * target-reloc.h (relocate_section): Check the symbol table index
10602         for -1U before setting the local symbol index.
10603         (scan_relocatable_relocs): If copying the relocation, record that
10604         the local symbol is required.
10605         * object.h (Symbol_value::is_output_symtab_index_set): New
10606         function.
10607         (Symbol_value::may_be_discarded_from_output_symtab): New
10608         function.
10609         (Symbol_value::has_output_symtab_entry): New function.
10610         (Symbol_value::needs_output_symtab_entry): Remove.
10611         (Symbol_value::output_symtab_index): Make sure the symbol index is
10612         set.
10613         (Symbol_value::set_output_symtab_index): Make sure the symbol
10614         index is not set.  Make sure the new index is valid.
10615         (Symbol_value::set_must_have_output_symtab_entry): New function.
10616         (Symbol_value::has_output_dynsym_entry): New function.
10617         (Symbol_value::set_output_dynsym_index): Make sure the new index
10618         is valid.
10619         (Sized_relobj::set_must_have_output_symtab_entry): New function.
10620         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
10621         local symbol if permitted.
10622         (Sized_relobj::do_finalize_local_symbols): Call
10623         is_output_symtab_index_set rather than needs_output_symtab_entry.
10624         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
10625         rather than needs_output_symtab_entry.  Call
10626         has_output_dynsym_entry rather than needs_output_dynsym_entry.
10627         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
10628         is_output_symtab_index_set rather than needs_output_symtab_entry.
10629         * testsuite/discard_locals_relocatable_test.c: New file.
10630         * testsuite/discard_locals_test.sh: Test -r.
10631         * testsuite/Makefile.am (check_DATA): Add
10632         discard_locals_relocatable_test1.syms,
10633         discard_local_relocatable_test2.syms.
10634         (MOSTLYCLEANFILES): Likewise.  Also add
10635         discard_locals_relocatable_test1.lout and
10636         discard_locals_relocatable_test2.out.
10637         (discard_locals_relocatable_test1.syms): New target.
10638         (discard_locals_relocatable_test.o): New target.
10639         (discard_locals_relocatable_test1.out): New target.
10640         (discard_locals_relocatable_test2.syms): New target.
10641         (discard_locals_relocatable_test2.out): New target.
10642         (various): Add missing ../ld-new dependencies.
10643         * testsuite/Makefile.in: Rebuild.
10644
10645 2010-03-03  Nick Clifton  <nickc@redhat.com>
10646
10647         * po/fi.po: New Finnish translation.
10648
10649 2010-03-01  Doug Kwan  <dougkwan@google.com>
10650
10651         * layout.cc (Layout::Layout): Force section types of .init_array*,
10652         .preinit_array* and .fini_array* sections.
10653         * output.cc (Output_section::Input_section_sort_entry::has_priority):
10654         Fix check of return value of std::string::find.().
10655         (Output_section::Input_section_sort_compare::operator()): Remove
10656         comment about .init_array.
10657         (Output_section::Input_section_sort_init_fini_compare::operator()):
10658         New method.
10659         (Output_section::sort_attached_input_sections): Handle .init_array
10660         and .fini_array specially.
10661         * output.h (Output_section::Inut_section_sort_compare): Update
10662         comment.
10663         (Output_section::Input_section_sort_init_fini_compare): New struct.
10664
10665 2010-02-26  Doug Kwan  <dougkwan@google.com>
10666
10667         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
10668         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
10669         * testsuite/debug_msg.sh: Avoid matching source line number for
10670         use of global variable undef_int.
10671
10672 2010-02-26  Doug Kwan  <dougkwan@google.com>
10673
10674         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
10675         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
10676         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
10677         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
10678         * options.cc (General_options::General_options): Initialize member
10679         fix_v4bx_.
10680         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
10681         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
10682         and rm_no_fix_v4bx.stdout
10683         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
10684         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
10685         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
10686         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
10687         and arm_no_fix_v4bx.
10688         * Makefile.in: Regenerate.
10689         * testsuite/arm_fix_v4bx.s: New file.
10690         * testsuite/arm_fix_v4bx.sh: Ditto.
10691
10692 2010-02-24  Doug Kwan  <dougkwan@google.com>
10693
10694         * arm.cc (Target_arm::got_section): Make the .got section the first
10695         non RELRO section in the data segment.
10696         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
10697         suffixes of section names.
10698
10699 2010-02-24  Doug Kwan  <dougkwan@google.com>
10700
10701         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
10702         flags and attributes merging if an input file is a binary file.
10703         * fileread.cc (Input_file::open): Record format of original file.
10704         * fileread.h (Input_file::Format): New enum type.
10705         (Input_file::Input_file): Initialize data member format_.
10706         (Input_file::format): New method definition.
10707         (Input_file::format_):: New data member.
10708
10709 2010-02-24  Doug Kwan  <dougkwan@google.com>
10710
10711         * arm.cc (Arm_output_data_got): New class.
10712         (ARM_TCB_SIZE): New constant
10713         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
10714         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10715         If user uses a script with a SECTIONS clause, issue only a warning
10716         for a misplaced EXIDX input section.  Otherwise, issue an error.
10717         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
10718         garbage collection.
10719         (Target_arm::got_mode_index_entry): Handle static linking.
10720         (Target_arm::Scan::local): Ditto.
10721         (Target_arm::Scan::global): Ditto.
10722         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
10723         all incorrectly implemented relocations.
10724         (Target_arm::fix_exidx_coverage): Pass layout to
10725         Arm_output_section::fix_exidx_coverage.
10726         * layout.cc (Layout::section_name_mapping): Remove trailing dots
10727         from ".ARM.exidx." and ".ARM.extab.".
10728
10729 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10730
10731         * arm.cc (Target_arm::do_finalize_sections): Create attribute
10732         section if it does not already exist.
10733         * attributes.cc (Attributes_section_data::Attributes_section_data):
10734         Don't crash if size is zero.
10735
10736 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10737             Ian Lance Taylor  <iant@google.com>
10738
10739         * gold.cc (queue_middle_tasks): If no input files were opened,
10740         exit.
10741         * workqueue.h (Task_function::Task_function): Assert that there is
10742         a blocker.
10743
10744 2010-02-22  Doug Kwan  <dougkwan@google.com>
10745
10746         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
10747         * icf.cc (get_section_contents): Cast snprintf arguments to long long
10748         types to avoid warnings due to different uint64_t implementations
10749         on different hosts.
10750
10751 2010-02-21  Doug Kwan  <dougkwan@google.com>
10752
10753         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
10754         handling of the maximum backward branch offset.
10755         (Arm_relocate_functions::thumb_branch_common): Ditto.
10756         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
10757         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
10758         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
10759         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
10760         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
10761         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
10762         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
10763         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
10764         thumb_bl_out_of_range thumb_bl_out_of_range.o,
10765         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
10766         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
10767         thumb2_bl_out_of_range.o): New rules.
10768         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
10769         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
10770         thumb2_bl_out_of_range
10771         * testsuite/Makefile.in: Regenerate.
10772         * testsuite/arm_bl_in_range.s: New file.
10773         * testsuite/arm_bl_out_of_range.s: Ditto.
10774         * testsuite/arm_branch_in_range.sh: Ditto.
10775         * testsuite/arm_branch_range.t: Ditto.
10776         * testsuite/thumb2_branch_range.t: Ditto.
10777         * testsuite/thumb_bl_in_range.s: Ditto.
10778         * testsuite/thumb_bl_out_of_range.s: Ditto.
10779         * testsuite/thumb_branch_range.t: Ditto.
10780
10781 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
10782
10783         * gc.h (gc_process_relocs): Change vectors to point to the new list.
10784         Add reloc offset information.
10785         * icf.cc (get_section_contents): Change iterators to point to the new
10786         vectors. Add reloc offset information to the contents.
10787         * icf.h (Icf::Sections_reachable_info): New typedef.
10788         (Icf::Sections_reachable_list): New typedef.
10789         (Icf::Offset_info): New typedef.
10790         (Icf::Reloc_info): New struct typedef.
10791         (Icf::Reloc_info_list): New typedef.
10792         (Icf::symbol_reloc_list): Delete method.
10793         (Icf::addend_reloc_list): Delete method.
10794         (Icf::section_reloc_list): Delete method.
10795         (Icf::reloc_info_list): New method.
10796         (Icf::reloc_info_list_): New member.
10797
10798 2010-02-19  Doug Kwan  <dougkwan@google.com>
10799
10800         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
10801         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
10802         * arm.cc (Arm_relocation_functions): New forward declaration.
10803         (Target_arm::Target_arm): Initialize new data members
10804         got_mod_index_offset_ and tls_base_symbol_defined_.
10805         (Target_arm::Relocate::relocate_tls): New method.
10806         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
10807          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
10808         New methods.
10809         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
10810         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
10811         (Target_arm::got_mod_index_offset_,
10812         Target_arm::tls_base_symbol_defined_): New data members.
10813         (Target_arm::Scan::local, Target::Scan::global,
10814         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
10815         relocations.
10816
10817 2010-02-18  Doug Kwan  <dougkwan@google.com>
10818
10819         * arm.cc (Arm_relobj::find_linked_text_section): New method.
10820         (Arm_relobj::make_exidx_input_section): Pass section index of linked
10821         text section as a parameter becuase some broken tools may not set
10822         the link in section header.
10823         (Target_arm::has_got_section): New method.
10824         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
10825         without any mapping symbol as data only.  Remove warning.
10826         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
10827         link in its section header, try to discover the link by inspecting the
10828         REL31 relocation at the beginning of the section.
10829         (Target_arm::Scan::check_non_pic): Report name of offending relocation
10830         in error message.
10831         (Target_arm::Scan::global): Treat any reference to the symbol
10832         _GLOBAL_OFFSET_TABLE_ as a GOT access.
10833
10834 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
10835
10836         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
10837         (Scan::global_reloc_may_be_function_pointer): New function.
10838         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10839         (Scan::global_reloc_may_be_function_pointer): New function.
10840         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10841         (Scan::global_reloc_may_be_function_pointer): New function.
10842         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
10843         (Scan::global_reloc_may_be_function_pointer): New function.
10844         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
10845         (Scan::global_reloc_may_be_function_pointer): New function.
10846         (Scan::possible_function_pointer_reloc): New function.
10847         (Target_x86_64::can_check_for_function_pointers): New function.
10848         * gc.h (gc_process_relocs): Scan relocation types to determine if
10849         function pointers were taken for targets that support it.
10850         * icf.cc (Icf::find_identical_sections): Include functions for
10851         folding in safe ICF whose pointer is not taken.
10852         * icf.h (Secn_fptr_taken_set): New typedef.
10853         (fptr_section_id_): New member.
10854         (section_has_function_pointers): New function.
10855         (set_section_has_function_pointers): New function.
10856         (check_section_for_function_pointers): New function.
10857         * options.h: Fix comment for safe ICF option.
10858         * target.h (can_check_for_function_pointers): New function.
10859         * testsuite/Makefile.am: Add icf_safe_so_test test case.
10860         Modify icf_safe_test for X86-64.
10861         * testsuite/Makefile.in: Regenerate.
10862         * testsuite/icf_safe_so_test.cc: New file.
10863         * testsuite/icf_safe_so_test.sh: New file.
10864         * testsuite/icf_safe_test.cc (kept_func_3): New function.
10865         (main): Change to take pointer to function kept_func_3.
10866         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
10867         folding is done correctly for X86-64.
10868
10869 2010-02-12  David S. Miller  <davem@davemloft.net>
10870
10871         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
10872         is_symbolless parameter.
10873         (Output_reloc<SHT_REL>::is_symbolless): New.
10874         (Output_reloc<SHT_REL>::is_symbolless_): New.
10875         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
10876         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
10877         (Output_reloc<SHT_RELA>::is_symbolless): New.
10878         (Output_data_reloc::add_global): Handle is_symbolless.
10879         (Output_data_reloc::add_global_relative): Likewise.
10880         (Output_data_reloc::add_local): Likewise.
10881         (Output_data_reloc::add_local_relative): Likewise.
10882         (Output_data_reloc::add_symbolless_global_addend): New.
10883         (Output_data_reloc::add_symbolless_local_addend): New.
10884         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
10885         is_symbolless.
10886         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
10887         instead of ->is_relative_
10888         (Output_reloc::write): Likewise.
10889         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
10890         (Output_reloc::write_rel): Simplify.
10891
10892         * sparc.cc (Target_sparc::Scan::local): Use
10893         ->add_symbolless_local_addend as needed.
10894         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
10895         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
10896         based upon relocation offset.
10897
10898 2010-02-11  Doug Kwan  <dougkwan@google.com>
10899
10900         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
10901         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
10902         beginning of function.
10903         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
10904         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
10905         parameter is_32bit in calls to should_apply_static_reloc.
10906         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
10907         (check_DATA): Add arm_abs_global.stdout.
10908         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
10909         arm_abs_global.stdout): New rules.
10910         (MOSTLLYCLEANFILES): Add arm_abs_global
10911         * Makefile.in: Regenerate.
10912         * testsuite/arm_abs_global.s: New file.
10913         * testsuite/arm_abs_global.sh: Ditto.
10914         * testsuite/arm_abs_lib.s: Ditto.
10915
10916 2010-02-11  Ian Lance Taylor  <iant@google.com>
10917
10918         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
10919         Read_relocs task.
10920         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
10921         Allocate_commons_task first.
10922         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
10923         task, rather than symtab_lock_.
10924         (Gc_process_relocs::~Gc_process_relocs): New function.
10925         (Gc_process_relocs::is_runnable): Check this_blocker_.
10926         (Gc_process_relocs::locks): Use next_blocker_ rather than
10927         blocker_.
10928         (Scan_relocs::~Scan_relocs): New function.
10929         (Scan_relocs::is_runnable): Check this_blocker_ rather than
10930         symtab_lock_.
10931         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
10932         next_blocker_.
10933         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
10934         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
10935         constructor accordingly.
10936         (class Gc_process_relocs): Likewise.
10937         (class Scan_relocs): Likewise.
10938         * common.h (class Allocate_commons_task): Remove symtab_lock_
10939         field, and corresponding constructor parameter.
10940         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
10941         symtab_lock_.
10942         (Allocate_commons_task::locks): Likewise.
10943
10944 2010-02-11  Ian Lance Taylor  <iant@google.com>
10945
10946         * gold-threads.h (class Once): Define.
10947         (class Initialize_lock): Rewrite as child of Once.
10948         * gold-threads.cc (class Once_initialize): Define.
10949         (once_pointer_control): New static variable.
10950         (once_pointer, once_arg): New static variables.
10951         (c_run_once): New static function.
10952         (Once::Once, Once::run_once, Once::internal_run): New functions.
10953         (class Initialize_lock_once): Remove.
10954         (initialize_lock_control): Remove.
10955         (initialize_lock_pointer): Remove.
10956         (initialize_lock_once): Remove.
10957         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
10958         (Initialize_lock::initialize): Rewrite.
10959         (Initialize_lock::do_run_once): New function.
10960         * archive.cc (Archive::interpret_header): Only clear name if it is
10961         not already empty.
10962         * fileread.cc: Include "gold-threads.h"
10963         (file_counts_lock): New static variable.
10964         (file_counts_initialize_lock): Likewise.
10965         (File_read::release): Only increment counts when using --stats.
10966         Use a lock around the increment.
10967         * parameters.cc (class Set_parameters_target_once): Define.
10968         (set_parameters_target_once): New static variable.
10969         (Parameters::Parameters): Move here from parameters.h.
10970         (Parameters::set_target): Rewrite.
10971         (Parameters::set_target_once): New function.
10972         (Parameters::clear_target): Move here and rewrite.
10973         * parameters.h (class Parameters): Update declarations.  Add
10974         set_parameters_target_once_ field.
10975         (Parameters::Parameters): Move to parameters.cc.
10976         (Parameters::clear_target): Likewise.
10977         * readsyms.cc (Read_symbols::do_group): Create a Start_group
10978         task.
10979         (Start_group::~Start_group): New function.
10980         (Start_group::is_runnable): New function.
10981         (Start_group::locks, Start_group::run): New functions.
10982         (Finish_group::run): Change saw_undefined to size_t.
10983         * readsyms.h (class Start_group): Define.
10984         (class Finish_group): Change saw_undefined_ field to size_t.
10985         (Finish_group::Finish_group): Remove saw_undefined and
10986         this_blocker parameters.  Change all callers.
10987         (Finish_group::set_saw_undefined): New function.
10988         (Finish_group::set_blocker): New function.
10989         * symtab.h (class Symbol_table): Change saw_undefined to return
10990         size_t.  Change saw_undefined_ field to size_t.
10991         * target-select.cc (Set_target_once::do_run_once): New function.
10992         (Target_selector::Target_selector): Initialize set_target_once_
10993         field.  Don't initialize lock_ and initialize_lock_ fields.
10994         (Target_selector::instantiate_target): Rewrite.
10995         (Target_selector::set_target): New function.
10996         * target-select.h (class Set_target_once): Define.
10997         (class Target_selector): Update declarations.  Make
10998         Set_target_once a friend.  Remove lock_ and initialize_lock_
10999         fields.  Add set_target_once_ field.
11000
11001 2010-02-10  Ian Lance Taylor  <iant@google.com>
11002
11003         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
11004         queueing any tasks.
11005         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
11006         (queue_middle_tasks): Add all blockers before queueing any tasks.
11007         (queue_final_tasks): Likewise.
11008         * token.h (Task_token::add_blockers): New function.
11009         * object.h (Input_objects::number_of_relobjs): New function.
11010
11011 2010-02-10  Ian Lance Taylor  <iant@google.com>
11012
11013         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
11014         shared, not if not position independent.
11015         * x86_64.cc (Relocate::relocate_tls): Likewise.
11016         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
11017         (tls_pie_pic_test): New target.
11018         * testsuite/Makefile.in: Rebuild.
11019
11020         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
11021         (tls_test_main_pie.o, tls_test_pie.o): New targets.
11022         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
11023         * testsuite/Makefile.in: Rebuild.
11024
11025 2010-02-09  David S. Miller  <davem@davemloft.net>
11026
11027         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
11028         R_SPARC_RELATIVE using ->add_local_relative().
11029         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
11030
11031         * output.h (Output_data_dynamic::add_section_size): New method
11032         that takes two Output_data objects.
11033         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
11034         entry param.  Handle it in initializers.
11035         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
11036         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
11037         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
11038         arg.
11039         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
11040         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
11041         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
11042         for dynrel_includes_plt.
11043         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11044         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11045         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
11046         before .rela.plt
11047         (Target_sparc::do_finalize_sections): Update to pass true for
11048         dynrel_includes_plt.
11049         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
11050         output before .rela.plt
11051         (Target_powerpc::do_finalize_sections): Update to pass true for
11052         dynrel_includes_plt when 32-bit.
11053
11054 2010-02-08  Doug Kwan  <dougkwan@google.com>
11055
11056         * arm.cc (Arm_relobj::simple_input_section_output_address): New
11057         method.
11058         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
11059         Arm_relobj::scan_section_for_cortex_a8_stubs,
11060         Arm_relobj::do_relocation_section): Instead of calling
11061         Output_section::output_address, use faster
11062         Arm_relobj::simple_input_section_output_address.
11063
11064 2010-02-08  David S. Miller  <davem@davemloft.net>
11065
11066         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
11067         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
11068         relocation helper function.
11069
11070         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
11071         just like R_SPARC_GOT{10,13,22}.
11072         (Target_sparc::Scan::local): Likewise.
11073         (Target_sparc::Relocate:relocate): Likewise.
11074
11075 2010-02-06  Ian Lance Taylor  <iant@google.com>
11076
11077         * configure.ac: Rewrite targetobjs duplicate removal code to use
11078         only shell constructs.
11079         * configure: Rebuild.
11080
11081 2010-02-05  Doug Kwan  <dougkwan@google.com>
11082
11083         PR 11247
11084         * arm.cc (Arm_relobj::section_is_scannable): New method.
11085         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
11086         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
11087
11088 2010-02-04  Doug Kwan  <dougkwan@google.com>
11089
11090         PR 11247
11091         * arm-reloc-property.cc (cstdio): Include.
11092         * configure.ac (targetobjs): Remove duplicates.
11093         * configure: Regenerate.
11094         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
11095         big and little endian version for a given address size.
11096
11097 2010-02-03  Doug Kwan  <dougkwan@google.com>
11098
11099         * arm-reloc-property.cc
11100         (Arm_reloc_property_table::reloc_name_in_error_message): New method
11101         definition.
11102         * arm-reloc-property.h
11103         (Arm_reloc_property_table::get_implemented_static_reloc_property):
11104         New method definition.
11105         (Arm_reloc_property_table::reloc_name_in_error_message): New method
11106         declaration.
11107         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
11108         overflow to N.
11109         (GOT_PREL): Change implemented to Y.
11110         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
11111         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
11112         (Arm_relocate_functions::movw_abs_nc): Remove method.
11113         (Arm_relocate_functions::movt_abs): Ditto.
11114         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
11115         (Arm_relocate_functions::thm_movt_abs): Ditto.
11116         (Arm_relocate_functions::movw_rel_nc): Ditto.
11117         (Arm_relocate_functions::movw_rel): Ditto.
11118         (Arm_relocate_functions::movt_rel): Ditto.
11119         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
11120         (Arm_relocate_functions:thm_movw_rel): Ditto.
11121         (Arm_relocate_functions:thm_movt_rel): Ditto.
11122         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
11123         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
11124         New method definitions.
11125         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
11126         (Arm_relocation_functions::arm_grp_ldr): Ditto.
11127         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
11128         (Arm_relocation_functions::arm_grp_ldc): Ditto.
11129         (Target_arm::Relocate::relocate): Check for non-static or
11130         unimplemented relocation code and exit early.  Change calls to
11131         Target_arm::reloc_uses_thumb_bit and
11132         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
11133         instead.  Refactor code to handle similar relocations to increase
11134         code sharing.  Remove check for unsupported relocation code in switch
11135         statement.
11136         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
11137         relocation property table to find out size.  Change error message to
11138         print out the name of a relocation code instead of the numeric value.
11139         (Target_arm::scan_reloc_for_stub): Use relocation property table
11140         instead of calling Target_arm::reloc_uses_thumb_bit().
11141
11142 2010-02-02  Doug Kwan  <dougkwan@google.com>
11143
11144         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
11145         types of relaxed input section.
11146
11147 2010-02-02  Doug Kwan  <dougkwan@google.com>
11148
11149         * Makefile.am (HFILES): Add arm-reloc-property.h.
11150         (DEFFILES): New.
11151         (TARGETSOURCES): Add arm-reloc-property.cc
11152         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
11153         (libgold_a_SOURCES): $(DEFFILES)
11154         * Makefile.in: Regenerate.
11155         * arm-reloc-property.cc: New file.
11156         * arm-reloc-property.h: New file.
11157         * arm-reloc.def: New file.
11158         * arm.cc: Update comments.
11159         (arm-reloc-property.h): New included header.
11160         (arm_reloc_property_table): New global variable.
11161         (Target_arm::do_select_as_default_target): New method definition.
11162         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
11163         arm-reloc-property to targ_extra_obj.
11164         * parameters.cc (set_parameters_target): Call
11165         Target::select_as_default_target().
11166         * target.h (Target::select_as_default_target): New method definition.
11167         (Target::do_select_as_default_target): Same.
11168
11169 2010-02-01  Doug Kwan  <dougkwan@google.com>
11170
11171         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
11172         first_output_text_section_.
11173         (Arm_exidx_fixup::first_output_text_section): New method definition.
11174         (Arm_exidx_fixup::first_output_text_section_): New data member.
11175         (Arm_exidx_fixup::process_exidx_section): Record the first text
11176         output section seen.
11177         (Arm_output_section::fix_exidx_coverage): Set correct linked section
11178         and entsize in output section header.
11179
11180 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11181
11182         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
11183         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
11184         (Arm_relocate_functions::thm_alu11): New Method.
11185         (Arm_relocate_functions::thm_pc8): New Method.
11186         (Arm_relocate_functions::thm_pc12): New Method.
11187         (Target_arm::Scan::local): Handle the relocations.
11188         (Target_arm::Scan::global): Likewise.
11189         (Target_arm::Relocate::relocate): Likewise.
11190         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11191
11192 2010-01-29  Doug Kwan  <dougkwan@google.com>
11193
11194         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
11195         of relocation types as ld.
11196
11197 2010-01-29  Doug Kwan  <dougkwan@google.com>
11198
11199         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
11200         to public.
11201         (Arm_relocate_functions::thumb_branch_common): Ditto.
11202         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
11203         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
11204         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
11205         Arm_relocate_functions::jump24): Remove.
11206         (Target_arm::Relocate::relocate): Adjust code to call
11207         Arm_relocation_functions::arm_branch_common and
11208         Arm_relocation_functions::thumb_branch_common instead of their removed
11209         wrappers.  Merge switch-cases together to reduce source code size.
11210
11211 2010-01-29  Doug Kwan  <dougkwan@google.com>
11212
11213         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
11214         output_local_symbol_count_needs_update_.
11215         (Arm_relobj::output_local_symbol_count_needs_update,
11216          Arm_relobj::set_output_local_symbol_count_needs_update,
11217          Arm_relobj::update_output_local_symbol_count): New methods.
11218         (Arm_relobj::output_local_symbol_count_needs_update_): New data
11219         member.
11220         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
11221         of pointed function as in a R_ARM_PREL31 relocation.
11222         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
11223         for output local symbol count updating.
11224         (Target_arm::do_relax): Update output local symbol counts in objects
11225         if necessary.
11226         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
11227
11228 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11229
11230         * arm.cc: Added support for the ARM relocations:
11231         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
11232         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
11233         (Arm_relocate_functions::movw_rel_nc): Renamed (was
11234         movw_prel_nc).
11235         (Arm_relocate_functions::movw_rel): New method.
11236         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
11237         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
11238         thm_movw_prel_nc).
11239         (Arm_relocate_functions::thm_movw_rel): New method.
11240         (Arm_relocate_functions::thm_movt_rel): Renamed (was
11241         thm_movt_prel).
11242         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
11243         relocations.
11244         (Target_arm::Scan::global): Likewise.
11245         (Target_arm::Relocate::relocate): Likewise.
11246         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11247         Likewise.
11248
11249 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11250
11251         * arm.cc: Added support for ARM group relocations.
11252         (Target_arm::reloc_needs_sym_origin): New method.
11253         (Arm_relocate_functions::calc_grp_kn): New method.
11254         (Arm_relocate_functions::calc_grp_residual): New method.
11255         (Arm_relocate_functions::calc_grp_gn): New method.
11256         (Arm_relocate_functions::arm_grp_alu): New Method.
11257         (Arm_relocate_functions::arm_grp_ldr): New Method.
11258         (Arm_relocate_functions::arm_grp_ldrs): New Method.
11259         (Arm_relocate_functions::arm_grp_ldc): New Method.
11260         (Target_arm::Scan::local): Handle the ARM group relocations.
11261         (Target_arm::Scan::global): Likewise.
11262         (Target_arm::Relocate::relocate): Likewise.
11263         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11264         Likewise.
11265
11266 2010-01-26  Doug Kwan  <dougkwan@google.com>
11267
11268         * arm.cc (set): Include.
11269         (class Arm_exidx_fixup): Change type of last_input_section_ to const
11270         pointer type.
11271         (Arm_output_section::Text_section_list): New type.
11272         (Arm_output_section::append_text_sections_to_list): New method.
11273         (Arm_output_section::fix_exidx_coverage): Ditto.
11274         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
11275         (Arm_relobj::convert_input_section_to_relaxed_section): Use
11276         Relobj::set_section_offset() instead of
11277         Sized_relobj::invalidate_section_offset().
11278         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
11279         parameter for section headers. Ignore relocation sections for
11280         unallocated sections and EXIDX sections.
11281         (Target_arm::fix_exidx_coverage): New method.
11282         (Target_arm::output_section_address_less_than): New type.
11283         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
11284         linked text section instead of the EXIDX section.
11285         (Arm_output_section::create_stub_group): Add an assertion to check
11286         that this is not an EXIDX output section.
11287         (Arm_output_section::append_text_sections_to_list): New method.
11288         (Arm_output_section::fix_exidx_coverage): Ditto.
11289         (Arm_relobj::scan_sections_for_stubs): Adjust call to
11290         Arm_relobj::section_needs_reloc_stub_scanning.
11291         (Target_arm::do_relax): Fix EXIDX output section coverage in the
11292         first pass.
11293         (Target_arm::fix_exidx_coverage): New method.
11294         * object.h (Relobj::set_output_section): New method.
11295         (Sized_relobj::invalidate_section_offset): Remove method.
11296         (Sized_relobj::do_invalidate_section_offset): Remove method.
11297         (Sized_relobj::do_set_section_offset): Handle offset value -1.
11298
11299 2010-01-25  Doug Kwan  <dougkwan@google.com>
11300
11301         * arm.cc (Arm_exidx_merged_section::do_output_offset):
11302         Fix warning due to signed and unsigned comparison on a 32-bit host.
11303
11304 2010-01-22  Doug Kwan  <dougkwan@google.com>
11305
11306         * arm.cc (Target_arm::do_relax): Record an output section for section
11307         offset adjustment it contains any stub table that has changed.
11308         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
11309         offsets in an output section if necessary.
11310         * output.cc (Output_section::Output_section): Initialize
11311         section_offsets_need_adjustments_.
11312         (Output_section::add_input_section_for_script): Renamed to
11313         Output_section::add_simple_input_section.
11314         (Output_section::save_states): Add a comment.
11315         (Output_section::discard_states): New method defintion.
11316         (Output_section::adjust_section_offsets): Same.
11317         * output.h (Output_section::add_input_section_for_script): Renamed to
11318         Output_section::add_simple_input_section.
11319         (Output_section::discard_states): New method declaration.
11320         (Output_section::adjust_section_offsets): Same.
11321         (Output_section::section_offsets_need_adjustment,
11322         Output_section::set_section_offsets_need_adjustment): New method
11323         definitions.
11324         (Output_section::section_offsets_need_adjustment_): New data member.
11325         * script-sections.cc
11326         (Output_section_element_input::set_section_address): Adjust code for
11327         renaming of Output_section::add_input_section_for_script.
11328         (Orphan_output_section::set_section_address): Same.
11329
11330 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11331
11332         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
11333         Fix_v4bx enum values .
11334         * gold/options.h (General_options): New option definitions.
11335         (General_options::fix_v4bx): New method.
11336         (General_options::Fix_v4bx): New enum.
11337         * gold/options.cc (General_options::parse_fix_v4bx): New method.
11338         (General_options::parse_fix_v4bx_interworking): New method.
11339
11340 2010-01-22  Doug Kwan  <dougkwan@google.com>
11341
11342         * arm.cc (Arm_exidx_fixup): New class.
11343
11344 2010-01-21  Doug Kwan  <dougkwan@google.com>
11345
11346         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
11347         classes.
11348         (Arm_exidx_section_offset_map): New type.
11349
11350 2010-01-21  Doug Kwan  <dougkwan@google.com>
11351
11352         * arm.cc (Arm_exidx_input_section): New class.
11353         (Arm_relobj::exidx_input_section_by_link,
11354         Arm_relobj::exidx_input_section_by_shndx,
11355         Arm_relobj::make_exidx_input_section): New methods.
11356         (read_arm_attributes_section): Remove.
11357         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
11358         information about them.
11359         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
11360         to here.
11361
11362 2010-01-20  Doug Kwan  <dougkwan@google.com>
11363
11364         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
11365         Input_section_specifier to Section_id.
11366         (Target_arm::new_arm_input_section: Adjust code for change of key
11367         type.
11368         (Target_arm::find_arm_input_section): Ditto.
11369         * gc.h (object.h): Include for Section_id nand Section_id_hash.
11370         (Section_id): Remove.
11371         (Garbage_collection::Section_id_hash): Remove.
11372         * icf.h (object.h): Include for Section_id nand Section_id_hash.
11373         (Section_id): Remove.
11374         (Icf::Section_id_hash): Remove.
11375         * object.h (Section_id, Const_section_id, Section_id_hash,
11376         Const_section_id_hash): New type definitions.
11377         * output.cc (Output_section::add_relaxed_input_section): Change to
11378         use Const_section_id instead of Input_section_specifier as key type.
11379         (Output_section::add_merge_input_section): Ditto.
11380         (Output_section::build_relaxation_map): Change to use Section_id
11381         instead of Input_section_specifier as key type.
11382         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11383         Ditto.
11384         (Output_section::convert_input_sections_to_relaxed_sections): Change
11385         to use Const_section_id instead of Input_section_specifier as key type.
11386         (Output_section::find_merge_section): Ditto.
11387         (Output_section::find_relaxed_input_section): Ditto.
11388         * output.h (Input_section_specifier): Remove class.
11389         (Output_section::Output_section_data_by_input_section_map): Change
11390         key type to Const_section_id.
11391         (Output_section::Output_relaxed_input_section_by_input_section_map):
11392         Ditto.
11393         (Output_section::Relaxation_map): Change key type to Section_id.
11394
11395 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11396
11397         * gold/arm.cc: Added support for R_ARM_V4BX relocation
11398         (class Arm_v4bx_stub): New class.
11399         (DEF_STUBS): Updated definition to support v4_veneer_bx.
11400         (Stub_factory::make_arm_v4bx_stub): New method.
11401         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
11402         (Stub_table::empty): Handle v4bx stubs.
11403         (Stub_table::add_arm_v4bx_stub): New method.
11404         (Stub_table::find_arm_v4bx_stub): New method.
11405         (Arm_relocate_functions::v4bx): New method.
11406         (Target_arm::fix_v4bx): New method.
11407         (Target_arm::Target_arm): Handle R_ARM_V4BX.
11408         (Stub_table::relocate_stubs): Likewise.
11409         (Stub_table::do_write): Likewise.
11410         (Stub_table::update_data_size_and_addralign): Likewise.
11411         (Stub_table::finalize_stubs):  Likewise.
11412         (Target_arm::Scan::local): Likewise.
11413         (Target_arm::Scan::global): Likewise.
11414         (Target_arm::do_finalize_sections): Likewise.
11415         (Target_arm::Relocate::relocate): Likewise.
11416         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11417         Likewise.
11418         (Target_arm::scan_reloc_for_stub): Likewise.
11419         (Target_arm::scan_reloc_section_for_stubs): Likewise.
11420
11421 2010-01-19  Ian Lance Taylor  <iant@google.com>
11422
11423         * output.cc (Output_section_headers::do_sized_write): Write large
11424         segment count to sh_info field.
11425         (Output_file_header::do_sized_write): For large segment count,
11426         write PN_XNUM to e_phnum field.
11427
11428 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11429
11430         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
11431         (Arm_relocate_functions::thm_jump8): New function.
11432         (Arm_relocate_functions::thm_jump11): New function.
11433         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
11434         R_ARM_THM_JUMP11.
11435         (Target_arm::Scan::global): Likewise.
11436         (Target_arm::Relocate::relocate): Likewise.
11437         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11438         Likewise.
11439
11440 2010-01-14  Doug Kwan  <dougkwan@google.com>
11441
11442         * arm.cc (map, utility): Include headers.
11443         (Target_arm::apply_cortex_a8_workaround): New method.
11444         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
11445         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
11446         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
11447         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
11448         the --[no-]fix-cortex-a8 command line options.
11449         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
11450         (Target_arm::relocate_stub): Use addend in instruction template.
11451         * options.h (DEFINE_bool): Set the user-set flag.
11452         (General_options): Add --[no-]-fix-cortex options.
11453         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
11454         : Update fast look-up map after conversion.
11455
11456 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
11457
11458         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
11459         in the first pass of do_layout.
11460
11461 2010-01-13  Doug Kwan  <dougkwan@google.com>
11462
11463         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11464         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
11465         apparent compiler problem of not folding static constant integral
11466         data members of elfcpp::Elf_sizes<32>.
11467
11468 2010-01-13  Doug Kwan  <dougkwan@google.com>
11469
11470         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11471         Arm_relobj::section_needs_cortex_a8_stub_scanning,
11472         Arm_relobj::scan_section_for_cortex_a8_erratum,
11473         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
11474         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
11475         sections to scan for relocation stubs into a new method
11476         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
11477         relocation and Cortex-A8 stub scanning.
11478         (Target_arm::do_relax): Force stubs to be after stubbed sections
11479         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
11480         the beginning of a new relaxation pass.  Update a comment.
11481         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
11482
11483 2010-01-12  Ian Lance Taylor  <iant@google.com>
11484
11485         * target-reloc.h (visibility_error): New inline function.
11486         (relocate_section): Call visibility_error.
11487         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
11488         (MOSTLYCLEANFILES): Likewise.
11489         (protected_4_pic.o, protected_3.err): New targets.
11490         * testsuite/protected_4.cc: New file.
11491
11492 2010-01-12  Doug Kwan  <dougkwan@google.com>
11493
11494         * arm.cc (Cortex_a8_reloc): New class.
11495         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
11496         and cortex_a8_relocs_info_.
11497         (Target_arm::fix_cortex_a8): New method definition.
11498         (Target_arm::Cortex_a8_relocs_info): New type.
11499         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
11500         New data member declarations.
11501         (Target_arm::scan_reloc_for_stub): Record information about
11502         relocations for THUMB branches that might be exempted from the
11503         Cortex-A8 workaround.
11504         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
11505         at the beginning of a relaxation pass.
11506
11507 2010-01-12  Doug Kwan  <dougkwan@google.com>
11508
11509         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
11510         (Arm_relobj::Mapping_symbol_position,
11511          Arm_reloj::Mapping_symbol_position_less,
11512          Arm_relobj::Mapping_symbols_info): New types.
11513         (Target_arm::is_mapping_symbol_name): New method definition.
11514         (Arm_relobj::do_count_local_symbols): Save information about mapping
11515         symbols.
11516
11517 2010-01-11  Doug Kwan  <dougkwan@google.com>
11518
11519         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
11520         Arm_relocate_functions::thumb32_branch_upper,
11521         Arm_relocate_functions::thumb32_branch_lower,
11522         Arm_relocate_functions::thumb32_cond_branch_offset,
11523         Arm_relocate_functions::thumb32_cond_branch_upper,
11524         Arm_relocate_functions::thumb32_cond_branch_lower,
11525         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
11526         branch offset encoding.
11527         (Arm_relocate_functions::thumb_branch_common): Use new branch
11528         offset encoding methods to avoid code duplication.
11529         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
11530         (Stub_addend_reader::operator()): Use new branch encoding method
11531         to avoid code duplication.
11532
11533 2010-01-11  Doug Kwan  <dougkwan@google.com>
11534
11535         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
11536         (Target_arm::do_finalize_sections): Define special EXIDX section
11537         symbols only if referenced.
11538         * gc.h (Garbage_collection::add_reference): New method.
11539         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
11540         code duplication.
11541
11542 2010-01-11  Ian Lance Taylor  <iant@google.com>
11543
11544         * script.cc (Version_script_info::build_expression_list_lookup):
11545         Change complaing about duplicate wildcard match from error to
11546         warning.
11547
11548         * script.cc (class Lazy_demangler): Recreate--revert part of patch
11549         of 2009-12-30.
11550         (Version_script_info::Version_script_info): Initialize globs_,
11551         default_version_, default_is_global_, and exact_.  Don't
11552         initialize globals_ or locals_.
11553         (Version_script_info::build_lookup_tables): Build local symbols
11554         first.
11555         (Version_script_info::unquote): New function.
11556         (Version_script_info::add_exact_match): New function.
11557         (Version_script_info::build_expression_list_lookup): Remove lookup
11558         parameter.  Add is_global parameter.  Change all callers.  Handle
11559         wildcard pattern specially.  Unquote pattern.  Call
11560         add_exact_match.
11561         (Version_script_info::get_name_to_match): New function.
11562         (Version_script_info::get_symbol_version): New function.
11563         (Version_script_info::get_symbol_version_helper): Remove.
11564         (Version_script_info::check_unmatched_names): Call unquote.
11565         * script.h (class Version_script_info): Change get_symbol_version
11566         to be non-inline and add is_global parameter; change all callers.
11567         Rewrite symbol_is_local.  Update declarations.  Define struct
11568         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
11569         Remove globals_ and locals_ members.  Add exact_, globs_,
11570         default_version_, is_global_.
11571         (Version_script_info::Glob): Remove pattern, add expression and
11572         is_global.  Update constructor.  Change all callers.
11573         * dynobj.cc (Versions::finalize): Mark the version symbol as the
11574         default version.
11575         (Versions::symbol_section_contents): If a symbol is undefined, or
11576         defined in a dynamic object, set the version index to
11577         VER_NDX_LOCAL.
11578         * symtab.cc (Symbol_table::add_from_relobj): Don't call
11579         symbol_is_local.
11580         (Symbol_table::add_from_pluginobj): Likewise.
11581         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
11582
11583 2010-01-11  Doug Kwan  <dougkwan@google.com>
11584
11585         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
11586         (incremental_dump_LDADD): Add linking option for libintl.
11587         * Makefile.in: Regenerate.
11588
11589 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
11590
11591         PR gold/11144
11592         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
11593         instead of -Ds.
11594         * testsuite/Makefile.in: Regenerated.
11595
11596 2010-01-10  Doug Kwan  <dougkwan@google.com>
11597
11598         * options.h (DEFINE_var): Use parentheses around argument varname__
11599         in macro body to avoid any unintended subsequent substitutions.
11600
11601 2010-01-10  Ian Lance Taylor  <iant@google.com>
11602
11603         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
11604         candidates before doing symbol resolution.
11605
11606         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
11607         ODR candidates if only one is weak.
11608
11609 2010-01-08  Ian Lance Taylor  <iant@google.com>
11610
11611         * script.cc (Version_script_info::build_expression_list_lookup):
11612         Don't warn about ambiguous version, just record the ambiguity.
11613         (Version_script_info::get_symbol_version_helper): Give error if
11614         version is ambiguous.
11615
11616 2010-01-08  Doug Kwan  <dougkwan@google.com>
11617
11618         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
11619         prev_data_size_ and prev_addralign_.  Remove initializer for
11620         deleted data member has_been_changed_.
11621         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
11622         to determine if the table is empty.
11623         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
11624         Remove.
11625         (Stub_table::add_reloc_stub): Define method in class definition
11626         instead of just declaring it there.
11627         (Stub_table::add_cortex_a8_stub): New method definition.
11628         (Stub_table::update_data_size_and_addralign): Ditto.
11629         (Stub_table::finalize_stubs): Ditto.
11630         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
11631         (Stub_table::do_addralign_): Return address alignment in the
11632         (Stub_table::do_reset_address_and_file_offset): Define method in
11633         class definition instead of declaring it there.  Set current data
11634         size to be the data size of the previous pass.
11635         (Stub_table::set_final_data_size): Use current data size as the
11636         final data size.
11637         (Stub_table::relocate_stub): Change parameter type of stub from
11638         Reloc_stub pointer to Stub pointer.
11639         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
11640         (Stub_table::Cortex_a8_stub_list): New typedef.
11641         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
11642          Stub_table::prev_addralign_): New data member.
11643         (Arm_relobj::Arm_relobj): Initialize data member
11644         section_has_cortex_a8_workaround_.
11645         (Arm_relobj::section_has_cortex_a8_workaround,
11646          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
11647          definitions.
11648         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
11649         declarations.
11650         (Target_arm::relocate_stub): Change parameter type of stub from
11651         Reloc_stub pointer to Stub pointer.
11652         (Insn_template::size, Insn_template::alignment): Handle
11653         THUMB16_SPECIAL_TYPE.
11654         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
11655          Stub_table::update_data_size_and_addralign,
11656          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
11657         definitions.
11658         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
11659         (Stub_table::do_write): Ditto.
11660         (Target_arm::do_relax): Adjust code for changes in Stub_table.
11661
11662 2010-01-08  Ian Lance Taylor  <iant@google.com>
11663
11664         PR 11108
11665         * symtab.h (class Symbol): Remove fields is_target_special_ and
11666         has_plt_offset_.  Add field is_defined_in_discarded_section_.
11667         (Symbol::is_defined_in_discarded_section): New function.
11668         (Symbol::set_is_defined_in_discarded_section): New function.
11669         (Symbol::has_plt_offset): Rewrite.
11670         (Symbol::set_plt_offset): Verify that new offset is not -1U.
11671         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
11672         Don't initialize is_target_special_ or has_plt_offset_.
11673         Initialize is_defined_in_discarded_section_.
11674         (Symbol_table::add_from_relobj): If appropriate, set
11675         is_defined_in_discarded_section.
11676         * resolve.cc (Symbol::override_base_with_special): Don't test
11677         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
11678         * target-reloc.h (relocate_section): Do special handling for
11679         symbols defined in discarded sections for global symbols as well
11680         as local symbols.
11681
11682 2010-01-08  Ian Lance Taylor  <iant@google.com>
11683
11684         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
11685         the SHT_SYMTAB case.
11686
11687 2010-01-08  Ian Lance Taylor  <iant@google.com>
11688
11689         * object.cc (Sized_relobj::do_layout): Don't get confused if
11690         layout_eh_frame returns NULL.
11691
11692 2010-01-08  Ian Lance Taylor  <iant@google.com>
11693
11694         PR 11084
11695         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
11696         dynamic symbol table, use the normal symbol table.
11697         (Sized_dynobj::do_read_symbols): Remove assertion about type of
11698         symbol table.
11699
11700 2010-01-08  Ian Lance Taylor  <iant@google.com>
11701
11702         PR 11072
11703         * layout.cc (Layout::include_section): Remove .gnu_debuglink
11704         sections.
11705
11706 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
11707
11708         * version.cc (print_version): Change to "Copyright 2010".
11709
11710 2010-01-08  Ian Lance Taylor  <iant@google.com>
11711
11712         PR 10287
11713         PR 11063
11714         * i386.cc (class Target_i386): Change return type of plt_section
11715         to be non-const.
11716         (class Output_data_plt_i386): Add tls_desc_rel_ field.
11717         (Output_data_plt_i386::Output_data_plt_i386): Initialize
11718         tls_desc_rel_ field.
11719         (Output_data_plt_i386::rel_tls_desc): New function.
11720         (Target_i386::rel_tls_desc_section): New function.
11721         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
11722         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
11723         R_386_TLS_DESC reloc in rel_tls_desc_section.
11724         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
11725         Define struct Tlsdesc_info.
11726         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
11727         (Target_x86_64::do_reloc_symbol_index): New function.
11728         (Target_x86_64::add_tlsdesc_info): New function.
11729         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
11730         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
11731         tlsdesc_rel_ field.
11732         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
11733         all callers.
11734         (Output_data_plt_x86_64::rela_tlsdesc): New function.
11735         (Target_x86_64::rela_tlsdesc_section): New function.
11736         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
11737         handling.
11738         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
11739         (Target_x86_64::do_reloc_addend): New function.
11740         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
11741         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
11742         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
11743         (Output_reloc::type): New function.
11744         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
11745         (Output_reloc::is_target_specific): New function.
11746         (Output_reloc::target_arg): New function.
11747         (class Output_reloc) [SHT_RELA]: Add four new constructors for
11748         absolute relocs and target specific relocs.
11749         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
11750         add_target_specific.
11751         (class Output_data_reloc) [SHT_RELA]: Likewise.
11752         * output.cc (Output_reloc::Output_reloc): Add four new versions
11753         for absolute relocs and target specific relocs.
11754         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
11755         (Output_reloc::get_symbol_index): Likewise.
11756         (Output_reloc::local_section_offset): Check that local_sym_index_
11757         is not TARGET_CODE or 0.
11758         (Output_reloc::symbol_value): Likewise.
11759         (Output_reloc::write) [SHT_RELA]: Call target for target specific
11760         reloc.
11761         * target.h (class Target): Add reloc_symbol_index and reloc_addend
11762         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
11763         functions.
11764         * layout.cc (add_target_dynamic_tags): Use output section for
11765         DT_PLTRELSZ and DT_JMPREL.
11766
11767 2010-01-07  Ian Lance Taylor  <iant@google.com>
11768
11769         PR 11061
11770         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
11771         function.
11772         (class Output_data_reloc_generic): Define.
11773         (class Output_data_reloc_base): Change base class to
11774         Output_data_reloc_generic.  Change add() method to call
11775         bump_relative_reloc_count for a relative reloc.  Remove
11776         sort_relocs_ field.
11777         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
11778         to sort_relocs().
11779         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
11780         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
11781         appropriate.
11782         * layout.h (class Layout): Update declaration.
11783
11784 2010-01-07  Ian Lance Taylor  <iant@google.com>
11785
11786         * output.h (class Output_data): Add const version of
11787         output_section and do_output_section.
11788         (class Output_section_data): Add const version of
11789         do_output_section.
11790         (class Output_section): Likewise.
11791         * layout.cc (Layout::add_target_dynamic_tags): New function.
11792         * layout.h (class Layout): Update declarations.
11793         * arm.cc (Target_arm::do_finalize_sections): Use
11794         add_target_dynamic_tags.
11795         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11796         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11797         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11798         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11799
11800 2010-01-07  Ian Lance Taylor  <iant@google.com>
11801
11802         PR 11042
11803         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
11804         object as needed.
11805
11806 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
11807             Ian Lance Taylor  <iant@google.com>
11808
11809         PR 11019
11810         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
11811         Xindex::read_symtab_xindex.
11812
11813 2010-01-07  Doug Kwan  <dougkwan@google.com>
11814
11815         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
11816         (Insn_template::thumb16_bcond_insn): New method declaration.
11817         (Insn_template): Fix spelling.
11818         (Stub::thumb16_special): New method declaration.
11819         (Stub::do_write): Define virtual method which was previously pure
11820         virtual.
11821         (Stub::do_thumb16_special): New method declaration.
11822         (Stub::do_fixed_endian_write): New template member.
11823         (Reloc_stub::do_write): Remove.
11824         (Reloc_stub::do_fixed_endian_write): Remove.
11825         (Cortex_a8_stub): New class definition.
11826         (Stub_factory::make_cortex_a8_stub): New method definition.
11827         (Stub_factory::Stub_factory): Add missing static storage class
11828         qualifier for elf32_arm_stub_a8_veneer_blx.
11829
11830 2010-01-07  Ian Lance Taylor  <iant@google.com>
11831
11832         PR 10980
11833         * options.h (class General_options): Add --warn-unresolved-symbols
11834         and --error-unresolved-symbols.
11835         * errors.cc (Errors::undefined_symbol): Implement
11836         --warn-unresolved-symbols.
11837
11838         * options.h (class General_options): Add -z text and -z textoff.
11839         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
11840
11841 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
11842
11843         * gc.h (Garbage_collection::Cident_section_map): New typedef.
11844         (Garbage_collection::cident_sections): New function.
11845         (Garbage_collection::add_cident_section): New function.
11846         (Garbage_collection::cident_sections_): New member.
11847         (gc_process_relocs): Add references to sections whose names are C
11848         identifiers.
11849         * gold.h (cident_section_start_prefix): New constant.
11850         (cident_section_stop_prefix): New constant.
11851         (is_cident): New function.
11852         * layout.cc (Layout::define_section_symbols): Replace string constants
11853         with the newly defined constants.
11854         * object.cc (Sized_relobj::do_layout): Track sections whose names are
11855         C identifiers.
11856         * testsuite/Makefile.am: Add gc_orphan_section_test.
11857         * testsuite/Makefile.in: Regenerate.
11858         * testsuite/gc_orphan_section_test.cc: New file.
11859         * testsuite/gc_orphan_section_test.sh: New file.
11860
11861 2010-01-06  Ian Lance Taylor  <iant@google.com>
11862
11863         PR 10980
11864         * options.h (class General_options): Add --warn-shared-textrel.
11865         * layout.cc (Layout::finish_dynamic_section): Implement
11866         --warn-shared-textrel.
11867
11868         PR 10980
11869         * options.h (class General_options): Add --warn-multiple-gp.
11870
11871 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11872
11873         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
11874         $(THREADSLIB) and $(LIBDL).
11875         * Makefile.in: Rebuild.
11876
11877 2010-01-06  Ian Lance Taylor  <iant@google.com>
11878
11879         PR 10980
11880         * options.cc (General_options::parse_section_start): New function.
11881         (General_options::section_start): New function.
11882         (General_options::General_options): Initialize all members.
11883         * options.h: Include <map>
11884         (class General_options): Add --section-start.  Add section_starts_
11885         member.
11886         * layout.cc (Layout::attach_allocated_section_to_segment): If
11887         --section-start was used, set the address of the segment.  Remove
11888         local sort_sections.
11889         (Layout::relaxation_loop_body): If the address of the load segment
11890         has been set by --section-start, don't use it.
11891         * output.h (Output_segment::update_flags_for_output_section): New
11892         function.
11893         * output.cc (Output_segment::add_output_section): Call
11894         update_flags_for_output_section.
11895
11896 2010-01-05  Ian Lance Taylor  <iant@google.com>
11897
11898         PR 10980
11899         * options.h (class General_options): Add --undefined-version.
11900         * script.cc (struct Version_expression): Add was_matched_by_symbol
11901         field.
11902         (Version_script_info::matched_symbol): New function.
11903         (Version_script_info::get_symbol_version_helper): Call
11904         matched_symbol.
11905         (Version_script_info::check_unmatched_names): New function.
11906         * script.h (class Version_script_info): Update declarations.
11907         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
11908
11909         * options.h (class General_options): Use DEFINE_bool_alias for
11910         allow_multiple_definition.
11911         * resolve.cc (Symbol_table::should_override): Don't test
11912         allow_multiple_definition.
11913
11914         PR 10980
11915         * options.h (class General_options): Add --cref.
11916         * main.cc (main): Print cref table if --cref.  Don't close mapfile
11917         until after printing cref table.
11918         * cref.cc: Include "symtab.h".
11919         (class Cref_inputs): Define Cref_table_compare and Cref_table.
11920         (Cref_table_compare::operator()): New function.
11921         (Cref_inputs::gather_cref): New function.
11922         (filecol): New static const.
11923         (Cref_inputs::print_cref): New function.
11924         (Cref::print_cref): New function.
11925         * cref.h: Include <cstdio>.
11926         (class Cref): Update declarations.
11927         * mapfile.h (Mapfile::file): New function.
11928         * object.h (class Object): Define Symbols.  Declare virtual
11929         do_get_global_symbols.
11930         (Object::get_global_symbols): New function.
11931         * object.cc (Input_objects::add_object): Pass object to cref_ if
11932         --cref.
11933         (Input_objects::archive_start): Likewise.
11934         (Input_objects::archive_stop): Likewise.
11935         (Input_objects::print_cref): New function.
11936         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
11937         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
11938         --cref.
11939         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
11940         function.
11941         * plugin.h (class Sized_pluginobj): Update declarations.
11942
11943 2010-01-05  Ian Lance Taylor  <iant@google.com>
11944
11945         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
11946         to is_default_version.  Rename insdef to insdefault.
11947         (Symbol_table::add_from_relobj): Rename def to is_default_version
11948         and local to is_forced_local.
11949         (Symbol_table::add_from_pluginobj): Likewise.
11950         (Symbol_table::add_from_dynobj): Likewise.
11951         (Symbol_table::define_special_symbol): Rename insdef to
11952         insdefault.
11953
11954 2010-01-04  Ian Lance Taylor  <iant@google.com>
11955
11956         PR 10980
11957         * options.h (class General_options): Add
11958         --allow-multiple-definition and -z muldefs.
11959         * resolve.cc (Symbol_table::should_override): Don't warn about a
11960         multiple symbol definition if --allow-multiple-definition or -z
11961         muldefs.
11962
11963         PR 10980
11964         * options.h (class General_options): Add --add-needed and
11965         --copy-dt-needed-entries.  Tweak --as-needed help entry.
11966         * object.cc (Input_objects::check_dynamic_dependencies): Give an
11967         error if --copy-dt-needed-entries aka --add-needed is used and
11968         would cause a change in behaviour.
11969
11970         PR 10980
11971         * options.h (class General_options): Add -G as a short version of
11972         --shared.  Add no-op options -assert, -g, and -i.
11973
11974 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
11975
11976         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
11977         check for .text or .gnu.linkonce.t sections.
11978         * icf.cc (Icf::find_identical_sections): Ditto.
11979         Change the detection for mangled function name within the section
11980         name.
11981         * icf.h (is_section_foldable_candidate): New function.
11982
11983 2009-12-30  Ian Lance Taylor  <iant@google.com>
11984
11985         PR 10980
11986         * options.h (class General_options): Permit two dashes with
11987         --retain-symbols-file.
11988
11989 2009-12-30  Ian Lance Taylor  <iant@google.com>
11990
11991         PR 10979
11992         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
11993         don't put the file header and segment headers in the text
11994         segment.
11995
11996         PR 10979
11997         * common.cc (Sort_commons::operator()): Stabilize sort when both
11998         entries are NULL.
11999         (Symbol_table::do_allocate_commons_list): When allocating common
12000         symbols, skip a symbol which is no longer common.
12001         * symtab.h (Symbol::is_common): Test whether the symbol comes from
12002         an object before checking its type.
12003         * testsuite/common_test_2.c: New file.
12004         * testsuite/common_test_3.c: New file.
12005         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
12006         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
12007         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
12008         (common_test_2_pic.o, common_test_2.so): New targets.
12009         (common_test_3_pic.o, common_test_3.so): New targets.
12010         * testsuite/Makefile.in: Rebuild.
12011
12012         PR 10979
12013         * script.cc (read_input_script): If we see a new SECTIONS clause,
12014         and we have added an input section, give an error.
12015         * layout.h (class Layout): Add have_added_input_section function.
12016         Add have_added_input_section_ field.
12017         * layout.cc (Layout::Layout): Initialize
12018         have_added_input_section_.
12019         (Layout::layout): Set have_added_input_section_.
12020         (Layout::layout_eh_frame): Likewise.
12021
12022 2009-12-30  Ian Lance Taylor  <iant@google.com>
12023
12024         PR 10931
12025         * options.h (class General_options): Add --sort-common option.
12026         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
12027         * common.cc (Sort_common): Add sort_order parameter to
12028         constructor.  Add sort_order_ field.
12029         (Sort_commons::operator): Check sort_order_.
12030         (Symbol_table::allocate_commons): Determine the sort order.
12031         (Symbol_table::do_allocate_commons): Add sort_order parameter.
12032         Change all callers.
12033         (Symbol_table::do_allocate_commons_list): Likewise.
12034
12035 2009-12-30  Ian Lance Taylor  <iant@google.com>
12036
12037         PR 10916
12038         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
12039         symbols from this object, don't change the visibility of an
12040         undefined symbol.
12041         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
12042
12043 2009-12-30  Ian Lance Taylor  <iant@google.com>
12044
12045         PR 10861
12046         * script.h (class Version_script_info): Define Language enum.
12047         Update declarations.  Define Glob, Exact, and Lookup types.  Add
12048         new fields globals_, locals_, and is_finalized_.
12049         * script.cc: Various formatting fixes.
12050         (class Parser_closure): Change language_stack_ from a vector of
12051         std::string to one of Version_script_info::Language.  Adjust all
12052         uses accordingly.
12053         (class Lazy_demangler): Remove.
12054         (struct Version_expression): Change language from std::string to
12055         Version_script_info::Language.
12056         (Version_script_info::Version_script_info): New function.
12057         (Version_script_info::~Version_script_info): Don't call clear.
12058         (Version_script_info::finalize): New function.
12059         (Version_script_info::build_lookup_tables): New function.
12060         (Version_script_info::build_expression_list_lookup): New
12061         function.
12062         (Version_script_info::get_symbol_version_helper): Rewrite to use
12063         lookup tables.
12064         (Version_script_info::print_expression_list): Adjust to use
12065         Version_script_info::Language.
12066         (script_push_lex_into_version_mode): Check that the version script
12067         has not been finalized.
12068         (version_script_push_lang): Change language string to
12069         Version_script_info::Language.
12070         * options.cc (Command_line::version_script): New function.
12071         * options.h (class General_options): Add finalize_dynamic_list
12072         function.  Change version_script from declaration to definition.
12073         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
12074         * testsuite/version_script.map: Remove duplicate def of foo.
12075         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
12076         version_script.map.
12077         * testsuite/Makefile.in: Rebuild.
12078
12079 2009-12-30  Ian Lance Taylor  <iant@google.com>
12080
12081         PR 10843
12082         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
12083         if the input symbol index is 0, make the output symbol index 0.
12084
12085 2009-12-30  Ian Lance Taylor  <iant@google.com>
12086
12087         PR 10670
12088         * options.h (class General_options): Add -x/--discard-all.
12089         * object.cc (Sized_relobj::do_count_local_symbols): Handle
12090         --discard-all.  If the local symbol needs a dynamic entry, check
12091         that before handling --discard-locals.
12092
12093 2009-12-30  Ian Lance Taylor  <iant@google.com>
12094
12095         PR 10450
12096         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
12097         flags to PF_R.
12098         (Output_segment::add_output_section): Don't change the flags if
12099         the type is PT_TLS.
12100
12101         PR 10450
12102         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
12103         GNU hash table if they need a dynamic value.  Otherwise, don't add
12104         them if they are defined in a dynamic object or are forced local.
12105
12106 2009-12-29  Ian Lance Taylor  <iant@google.com>
12107
12108         PR 10450
12109         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
12110         .gnu.hash table for a 32-bit target.
12111
12112         PR 10450
12113         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
12114         regular and a dynamic object only needs a dynamic symbol table
12115         entry if it is externally visible.
12116
12117         PR 10450
12118         * i386.cc (class Target_i386): Initialize global_offset_table_ in
12119         constructor.  Add global_offset_table_ field.
12120         (Target_i386::got_section): Set global_offset_table_.
12121         (Target_i386::do_finalize_sections): Set global_offset_table_
12122         size.
12123         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
12124         in constructor.  Add global_offset_table_ field.
12125         (Target_x86_64::got_section): Set global_offset_table_.
12126         (Target_x86_64::do_finalize_sections): Set global_offset_table_
12127         size.
12128
12129         * layout.cc (Layout::Layout): Initialize increase_relro_.
12130         (Layout::get_output_section): Add is_relro, is_last_relro, and
12131         is_first_non_relro parameters.  Change all callers.
12132         (Layout::choose_output_section): Likewise.
12133         (Layout::add_output_section_data): Likewise.
12134         (Layout::make_output_section): Likewise.
12135         (Layout::set_segment_offsets): Clear increase_relro when using a
12136         linker script.
12137         * layout.h (class Layout): Add increase_relro method.  Add
12138         increase_relro_ field.  Update declarations.
12139         * output.cc (Output_section::Output_section): Initialize
12140         is_last_relro_ and is_first_non_relro_.
12141         (Output_segment::add_output_section): Group relro sections is
12142         do_sort is true.  Handle is_last_relro and is_first_non_relro.
12143         (Output_segment::maximum_alignment): Remove relro handling.
12144         (Output_segment::set_section_addresses): Add increase_relro
12145         parameter.  Change all callers.  Add initial alignment to align
12146         relro sections on separate page.  Remove old relro handling.
12147         (Output_segment::set_section_list_addresses): Remove in_relro
12148         parameter.  Change all callers.
12149         (Output_segment::set_offset): Add increase parameter.  Change all
12150         callers.  Remove old relro handling.
12151         * output.h (class Output_section): Add new methods: is_last_relro,
12152         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
12153         Add is_last_relro_ and is_first_non_relro_ fields.
12154         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
12155         Create separate .got.plt section.  Call increase_relro.
12156         * x86_64.cc (Target_x86_64::got_section): Likewise.
12157         * testsuite/relro_script_test.t: Add .got.plt.
12158
12159         PR 10450
12160         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
12161         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
12162         (Layout::finalize): Call set_dynamic_symbol_size.
12163         (Layout::set_dynamic_symbol_size): New function.
12164         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
12165         set_dynamic_symbol_size.
12166
12167         PR 10450
12168         * output.h (class Output_section): Add is_entsize_zero_ field.
12169         * output.cc (Output_section::Output_section): Initialize
12170         is_entsize_zero_.
12171         (Output_section::set_entsize): If two different entsizes are
12172         requested, force it to zero.
12173         (Output_section::add_input_section): Set flags for .debug_str
12174         before updating section flags.  Set entsize.
12175         (Output_section::update_flags_for_input_section): Set SHF_MERGE
12176         and SHF_STRING if all input sections have those flags.
12177
12178 2009-12-29   Rafael Espindola  <espindola@google.com>
12179
12180         * main.cc (main): Fix the sys time reporting.
12181         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
12182         reporting.
12183
12184 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
12185
12186         * options.cc (General_options::parse_version): Allow -v to exit
12187         without an error if there is nothing to link.
12188
12189 2009-12-29  Ian Lance Taylor  <iant@google.com>
12190
12191         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
12192         using a version of gcc before 4.1.
12193         * configure: Rebuild.
12194
12195 2009-12-28  Chris Demetriou  <cgd@google.com>
12196
12197         * attributes.cc (Output_attributes_section_data::do_write): Use
12198         std::vector::front rather than std::vector::data.
12199
12200 2009-12-28  Ian Lance Taylor  <iant@google.com>
12201
12202         * symtab.h (class Symbol_table): Add enum Defined.
12203         * resolve.cc (Symbol_table::should_override): Add defined
12204         parameter.  Change all callers.  Test whether object is NULL
12205         before calling a method on it.
12206         (Symbol_table::report_resolve_problem): Add defined parameter.
12207         Change all callers.
12208         (Symbol_table::should_override_with_special): Likewise.
12209         * symtab.cc (Symbol_table::define_in_output_data): Add defined
12210         parameter.  Change all callers.
12211         (Symbol_table::do_define_in_output_data): Likewise.
12212         (Symbol_table::define_in_output_segment): Likewise.
12213         (Symbol_table::do_define_in_output_segment): Likewise.
12214         (Symbol_table::define_as_constant): Likewise.
12215         (Symbol_table::do_define_as_constant): Likewise.
12216         * script.h (class Symbol_assignment): Add is_defsym parameter to
12217         constructor; change all callers.
12218         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
12219         parameter.  Change all callers.  Add is_defsym_ field.
12220         (class Parser_closure): Add parsing_defsym parameter to
12221         constructor; change all callers.  Add parsing_defsym accessor
12222         function.  Add parsing_defsym_ field.
12223
12224 2009-12-28  Ian Lance Taylor  <iant@google.com>
12225
12226         * gold.cc (queue_middle_tasks): Fix formatting.
12227         * object.cc (Relobj::is_section_name_included): Likewise.
12228
12229 2009-12-23  Ian Lance Taylor  <iant@google.com>
12230
12231         * i386.cc (Target_i386::do_calls_non_split): Recognize
12232         -fsplit-stack prologue for a function with a static chain.
12233         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
12234         -fsplit-stack prologue when using %r11.
12235
12236 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
12237
12238         * options.cc (General_options::parse_version): Make -v continue and do
12239         the link like GNU ld does.
12240
12241 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
12242
12243         * Makefile.am (CCFILES): Add timer.cc.
12244         (HFILES): Add timer.h.
12245         * configure.ac: Check for sysconf and times.
12246         * main.cc: include timer.h.
12247         (main): Use Timer instead of get_run_time.
12248         * timer.cc: New.
12249         * timer.h: New.
12250         * workqueue.cc: include timer.h.
12251         (Workqueue::find_and_run_task):
12252         Report user, sys and wall time.
12253         * Makefile.in: Regenerate.
12254         * config.in: Regenerate.
12255         * configure: Regenerate.
12256
12257 2009-12-16  Doug Kwan  <dougkwan@google.com>
12258
12259         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
12260         sections.
12261         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
12262         relaxed input sections.
12263         * output.cc (Output_section::find_relaxed_input_section): Change
12264         return type to Output_relaxed_input_section pointer.  Adjust code
12265         for new type of relaxed_input_section_map_.
12266         * output.h (Output_section::find_relaxed_input_section): Change
12267         return type to Output_relaxed_input_section pointer.
12268         (Output_section::Output_relaxed_input_section_by_input_section_map):
12269         New type.
12270         (Output_section::relaxed_input_section_map_): Change type to
12271         Output_section::Output_relaxed_input_section_by_input_section_map.
12272         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
12273         input section.
12274
12275 2009-12-15  Ian Lance Taylor  <iant@google.com>
12276
12277         * layout.cc (Layout::create_shstrtab): Only write out after input
12278         sections if we are compressing debug sections.
12279
12280 2009-12-15  Ian Lance Taylor  <iant@google.com>
12281
12282         * archive.cc (Archive::add_symbols): Only look up a symbol without
12283         a version if there is, in fact, a version.
12284
12285 2009-12-14  Ian Lance Taylor  <iant@google.com>
12286
12287         Revert -Wshadow changes, all changes from:
12288         2009-12-11  Doug Kwan  <dougkwan@google.com>
12289         2009-12-11  Nick Clifton  <nickc@redhat.com>
12290         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
12291
12292 2009-12-11  Doug Kwan  <dougkwan@google.com>
12293
12294         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
12295         due to -Wshadow.
12296         * attributes.cc (Object_attribute::size): Ditto.
12297         (Attributes_section_data::size): Ditto.
12298         (Attributes_section_data::Attributes_section_data): Ditto.
12299         (Output_attributes_section_data::do_write): Ditto.
12300         * attributes.h (Object_attribute::set_type): Ditto.
12301         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
12302
12303 2009-12-11  Nick Clifton  <nickc@redhat.com>
12304
12305         * archive.cc: Fix shadowed variable warnings.
12306         * arm.cc: Likewise.
12307         * compressed_output.cc: Likewise.
12308         * compressed_output.h: Likewise.
12309         * configure: Likewise.
12310         * dwarf_reader.cc: Likewise.
12311         * dynobj.cc: Likewise.
12312         * dynobj.h: Likewise.
12313         * ehframe.cc: Likewise.
12314         * ehframe.h: Likewise.
12315         * errors.cc: Likewise.
12316         * expression.cc: Likewise.
12317         * fileread.cc: Likewise.
12318         * fileread.h: Likewise.
12319         * freebsd.h: Likewise.
12320         * i386.cc: Likewise.
12321         * icf.cc: Likewise.
12322         * incremental.h: Likewise.
12323         * layout.cc: Likewise.
12324         * layout.h: Likewise.
12325         * mapfile.cc: Likewise.
12326         * merge.cc: Likewise.
12327         * merge.h: Likewise.
12328         * object.cc: Likewise.
12329         * object.h: Likewise.
12330         * options.h: Likewise.
12331         * output.cc: Likewise.
12332         * output.h: Likewise.
12333         * parameters.cc: Likewise.
12334         * plugin.cc: Likewise.
12335         * powerpc.cc: Likewise.
12336         * reduced_debug_output.cc: Likewise.
12337         * reduced_debug_output.h: Likewise.
12338         * reloc.cc: Likewise.
12339         * reloc.h: Likewise.
12340         * resolve.cc: Likewise.
12341         * script-sections.cc: Likewise.
12342         * script.cc: Likewise.
12343         * script.h: Likewise.
12344         * sparc.cc: Likewise.
12345         * symtab.cc: Likewise.
12346         * symtab.h: Likewise.
12347         * target-select.cc: Likewise.
12348         * target-select.h: Likewise.
12349         * token.h: Likewise.
12350         * workqueue.cc: Likewise.
12351         * workqueue.h: Likewise.
12352         * x86_64.cc: Likewise.
12353
12354 2009-12-10  Doug Kwan  <dougkwan@google.com>
12355
12356         * arm.cc (attributes.h): New include.
12357         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
12358         (Arm_relobj::~Arm_relobj): Delete object pointed by
12359         attributes_section_data_.
12360         (Arm_relobj::attributes_section_data): New method definition.
12361         (Arm_relobj::attributes_section_data_): New data member declaration.
12362         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
12363         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
12364         attributes_section_data_.
12365         (Arm_dynobj::attributes_section_data): New method definition.
12366         (Arm_dynobj::attributes_section_data_): New data member declaration.
12367         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
12368         initialization value of may_use_blx_ to false.
12369         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
12370         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
12371         object attributes to compute results instead of hard-coding.
12372         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
12373         Target_arm::get_secondary_compatible_arch,
12374         Target_arm::set_secondary_compatible_arch
12375         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12376         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
12377         New method declarations.
12378         (Target_arm::get_aeabi_object_attribute): New method definition.
12379         (Target_arm::attributes_section_data_): New data member declaration.
12380         (read_arm_attributes_section): New template definition.
12381         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
12382         (Arm_dynobj::do_read_symbols): Ditto.
12383         (Target_arm::do_finalize_sections): Merge attributes sections from
12384         input.  Check for BLX use after attributes section merging.
12385         Fix __exidx_start and __exidx_end visibility.  Create an
12386         .ARM.attributes section if necessary.
12387         (Target_arm::get_secondary_compatible_arch,
12388         Target_arm::set_secondary_compatible_arch,
12389         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12390         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
12391         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
12392         New method definitions.
12393
12394 2009-12-09  Ian Lance Taylor  <iant@google.com>
12395
12396         * plugin.cc (Plugin::load): Don't cast from void* to a function
12397         pointer.
12398
12399 2009-12-09  Ian Lance Taylor  <iant@google.com>
12400
12401         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
12402         information fields.
12403
12404 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
12405
12406         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
12407         Replace two_file_shared_1.so with two_file_shared_2.so.
12408         * testsuite/Makefile.in: Regenerated.
12409
12410 2009-12-08  Doug Kwan  <dougkwan@google.com>
12411
12412         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
12413         (HFILES): Add attributes.h and int_encoding.h.
12414         * Makefile.in: Regenerate.
12415         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
12416         function definitions to int_encoding.cc
12417         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
12418         prototypes to int_encoding.h
12419         * reduced_debug_output.cc (int_encoding.h): New include.
12420         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
12421         function definitions to int_encoding.cc
12422         (insert_into_vector, read_from_pointer): Move template definitions to
12423         int_encoding.h
12424         * attributes.cc: New file.
12425         * attributes.h: New file.
12426         * int_encoding.cc: New file.
12427         * int_encoding.h: New file.
12428
12429 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
12430
12431         PR gold/11055
12432         * incremental-dump.cc (dump_incremental_inputs): New.
12433         (main): Use dump_incremental_inputs.
12434
12435 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
12436
12437         PR gold/10893
12438         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
12439         checking elfcpp::STT_FUNC.
12440         (Target_i386::Relocate::relocate): Likewise.
12441         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
12442
12443         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
12444         symbols from shared libraries into normal FUNC symbols.
12445
12446         * symtab.h (Symbol): Add is_func and use it.
12447
12448 2009-12-05  Doug Kwan  <dougkwan@google.com>
12449
12450         * arm.cc (Target_arm::arm_info): Initialize new fields
12451         attributes_section and attributes_vendor.
12452         * i386.cc (Target_i386::i386_info): Same.
12453         * object.cc (Sized_relobj::do_layout): Skip attribute section.
12454         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
12455         fields attributes_section and attributes_vendor.
12456         * sparc.cc (Target_sparc::sparc_info): Same.
12457         * target.h (Target::attributes_section, Target::attributes_vendor,
12458         Target::is_attributes_section, Target::attribute_arg_type,
12459         Target::attributes_order): New method definitions.
12460         (Target::Target_info::attributes_section,
12461         Target::Target_info::attributes_vendor): New fields.
12462         (Target::do_attribute_arg_type, Target::do_attributes_order): New
12463         virtual method definitions.
12464         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
12465         attributes_section and attributes_vendor.
12466         * testsuite/testfile.cc (Target_test::test_target_info): Same.
12467
12468 2009-12-05  Doug Kwan  <dougkwan@google.com>
12469
12470         * arm.cc: Update comments about interworking and stub generation.
12471         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
12472         considered as non-PIC.
12473         (Arm_relocate_functions::base_abs): Fix formatting.
12474         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
12475         of function to use GOT entry address instead of offset.
12476         (Target_arm::Scan::global): Issue an error if a symbol would need a
12477         PLT does not get one because it is untyped.  Remove code to create
12478         dynamic symbols for relative branches.
12479         (Target_arm::Relocate::relocate: Use 0 instead of false since function
12480         takes unsigned integer instead of boolean.
12481
12482 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
12483
12484         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
12485         (two_file_test_LDADD): Likewise.
12486         (common_test_1_LDADD): Likewise.
12487         (exception_test_LDADD) Likewise.
12488         (weak_test_LDADD): Likewise.
12489         (many_sections_test_LDADD): Likewise.
12490         (initpri1_LDADD): Likewise.
12491         (script_test_1_LDADD): Likewise.
12492         (script_test_2_LDADD): Likewise.
12493         (justsyms_LDADD): Likewise.
12494         (binary_test_LDADD): Likewise.
12495         (large_LDADD): Likewise.
12496         * testsuite/Makefile.in: Regenerated.
12497
12498 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
12499
12500         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
12501         (Symbol_table::override_with_special): Likewise.
12502         (Symbol_table::add_from_object): Likewise.
12503
12504 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12505
12506         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12507         Don't set the data_offset twice.
12508
12509 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12510
12511         * testsuite/Makefile.in: Regenerate.
12512
12513 2009-12-03  Doug Kwan  <dougkwan@google.com>
12514
12515         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
12516         (Target_arm::do_finalize_sections): Add parameter for symbol table
12517         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
12518         * i386.cc (Target_i386::do_finalize_sections): Add an additional
12519         parameter for symbol table pointer.
12520         * layout.cc (Layout::finalize): Call Target::finalize_sections with
12521         an additional parameter for a pointer to symbol table.
12522         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
12523         parameter for a symbol table pointer.
12524         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
12525         * target.h (Target::finalize_sections, Target::do_finalize_sections):
12526         Ditto.
12527         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
12528         parameter for a symbol table pointer.
12529
12530 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
12531
12532         * incremental.cc (Incremental_inputs_header)
12533         (Incremental_inputs_header_write, Incremental_inputs_entry)
12534         (Incremental_inputs_entry_write): Move ...
12535         * incremental.h (Incremental_inputs_header)
12536         (Incremental_inputs_header_write, Incremental_inputs_entry)
12537         (Incremental_inputs_entry_write): here.
12538
12539 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12540
12541         * incremental.cc (make_sized_incremental_binary): Set the target.
12542         Error if it is incompatible.
12543         * output.h (Output_file): Add filename method.
12544
12545 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12546
12547         * incremental.cc (Incremental_inputs_entry): Remove unused argument
12548         from the get_* methods.
12549
12550 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12551
12552         * incremental-dump.cc (main): Check that the offeset of a script is 0.
12553         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12554         Write 0 for the data_offset of scripts.
12555
12556 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12557
12558         * testsuite/Makefile.am: Add the incremental_test.sh test.
12559         * testsuite/incremental_test.sh: New.
12560         * testsuite/incremental_test_1.c: New.
12561         * testsuite/incremental_test_2.c: New.
12562
12563 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
12564
12565         * incremental-dump.cc (main): Fix typos.
12566
12567 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
12568
12569         PR gold/11025
12570         * incremental-dump.cc (main): Use llu to print 64 bit values.
12571
12572 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
12573             H.J. Lu  <hongjiu.lu@intel.com>
12574
12575         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
12576         $(LIBDL).
12577         (incremental_dump_LDADD): Likewise.
12578         * Makefile.in: Regenerated.
12579
12580 2009-11-25  Doug Kwan  <dougkwan@google.com>
12581
12582         Revert:
12583
12584         2009-11-25  Doug Kwan  <dougkwan@google.com>
12585
12586                 * arm.cc (Target_arm::Target_arm): Move method definition
12587                 outside of class definition.  Add code to handle
12588                 --target1-rel, --target1-abs and --target2= options.
12589                 (Target_arm::get_reloc_reloc_type): Change method to be
12590                 non-static and const.
12591                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
12592                 New data member declaration.
12593                 (Target_arm::Scan::local, Target_arm::Scan::global,
12594                 Target_arm::Relocate::relocate,
12595                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12596                 Adjust call to Target_arm::get_real_reloc_type.
12597                 (Target_arm::get_real_reloc_type): Use command line options
12598                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12599                 * options.h (--target1-rel, --target1-abs, --target2): New
12600                 ARM-only options.
12601
12602 2009-11-25  Doug Kwan  <dougkwan@google.com>
12603
12604         * arm.cc (Target_arm::Target_arm): Move method definition outside of
12605         class definition.  Add code to handle --target1-rel, --target1-abs
12606         and --target2= options.
12607         (Target_arm::get_reloc_reloc_type): Change method to be non-static
12608         and const.
12609         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
12610         member declaration.
12611         (Target_arm::Scan::local, Target_arm::Scan::global,
12612         Target_arm::Relocate::relocate,
12613         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
12614         call to Target_arm::get_real_reloc_type.
12615         (Target_arm::get_real_reloc_type): Use command line options to
12616         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12617         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
12618         options.
12619
12620 2009-11-25  Doug Kwan  <dougkwan@google.com>
12621
12622         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
12623         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
12624         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
12625         formatting.
12626         (Arm_relocate_functions::thm_call): Replace body with a call to
12627         Arm_relocate_functions::thumb_branch_common.
12628         (Arm_relocate_functions::thm_jump24,
12629         Arm_relocate_functions::thm_xpc22): New method definitions.
12630         (Arm_relocate_functions::thumb_branch_common): New method definition.
12631         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
12632         operator.
12633         (Target_arm::Relocate::relocate): Adjust call to thm_call.
12634         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
12635
12636 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12637
12638         * Makefile.am: Build incremental-dump
12639         * Makefile.in: Regenerate.
12640         * incremental-dump.cc: New.
12641         * incremental.cc (Incremental_inputs_header_data,
12642         Incremental_inputs_entry_data): Move to incremental.h
12643         * incremental.h: (Incremental_inputs_header_data,
12644         Incremental_inputs_entry_data): Move from incremental.cc
12645
12646 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12647
12648         * incremental.cc (Incremental_inputs_header,
12649         Incremental_inputs_header_write, Incremental_inputs_entry,
12650         Incremental_inputs_entry_write): Add a typedef with the data type.
12651
12652 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12653
12654         * incremental.cc (Incremental_inputs_header,
12655         Incremental_inputs_header_write, Incremental_inputs_entry,
12656         Incremental_inputs_entry_write): Update comment about which
12657         type has the filed descriptions.
12658
12659 2009-11-15  Doug Kwan  <dougkwan@google.com>
12660
12661         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
12662         (Arm_relocate_functions::arm_branch_common): Change method defintion
12663         in class definition to a method declaration and update list of formal
12664         parameters.
12665         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
12666         Arm_relocation_functions::jump24): Adjust call to
12667         Arm_relocate_functions::arm_branch_common.  Update list of formal
12668         parameters.
12669         (Arm_relocate_functions::xpc25): New method definition.
12670         (Arm_relocate_functions::arm_branch_common): Move method defintion
12671         out from class definition.  Use stubs for mode-switching and extending
12672         branch ranges.
12673         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
12674         specially.  Change code to enable use of stubs in ARM branches.
12675
12676 2009-11-10  Doug Kwan  <dougkwan@google.com>
12677
12678         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
12679         in method declaration.
12680         (Target_arm::relocate_stub): New method declaration.
12681         (Target_arm::default_target): Change to return a pointer instead of
12682         a const reference.
12683         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
12684         Target_arm::default_target.
12685         (Arm_Relobj::do_relocate_sections): Remove options paramater in
12686         method definition.
12687         (Target_arm::relocate_section): Adjust view.
12688         (Target_arm::relocate_stub): New method definition.
12689
12690 2009-11-10  Doug Kwan  <dougkwan@google.com>
12691
12692         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
12693         a format warning.
12694         * incremental.cc (open_incremental_binary): Initialized local
12695         variables to avoid warnings.
12696         * object.cc (make_elf_object): Ditto.
12697         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
12698         a format warning.
12699
12700 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
12701
12702         PR gold/10930
12703         * testsuite/plugin_test.c: Include "config.h".
12704
12705 2009-11-09  Doug Kwan  <dougkwan@google.com>
12706
12707         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
12708         (arm_symbol_value): Remove.
12709         (Arm_relocate_functions::arm_branch_common,
12710         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
12711         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
12712         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
12713         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
12714         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12715         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12716         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12717         Arm_relocate_functions::thm_mobw_abs_nc,
12718         Arm_relocate_functions::thm_mov_abs,
12719         Arm_relocate_functions::movw_prel_nc,
12720         Arm_relocate_functions::thm_movt_abs,
12721         Arm_relocate_functions::movt_prel,
12722         Arm_relocate_functions::thm_movw_prel_nc,
12723         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
12724         (Target_arm::Relocate::relocate): Only decompose address into two
12725         parts if relocation type uses the thumb-bit and pass the actual
12726         bit instead of a flag indicating that the thumb-bit is used.  Adjust
12727         calls to methods in Arm_relocate_functions for this change.
12728
12729 2009-11-08  Ian Lance Taylor  <iant@google.com>
12730
12731         PR 10925
12732         * reloc.cc: Instantiate
12733         Sized_relobj::initialize_input_to_output_maps and
12734         Sized_relobj:free_input_to_output_maps.
12735
12736 2009-11-06  Ian Lance Taylor  <iant@google.com>
12737
12738         PR 10876
12739         * defstd.cc (in_segment): Set only_if_ref true for "end".
12740
12741 2009-11-06  Doug Kwan  <dougkwan@google.com>
12742
12743         * arm.cc (class Reloc_stub): Correct a comment.
12744         (Target_arm::Target_arm): Initialize arm_input_section_map_.
12745         (Target_arm::scan_section_for_stubs): New method declaration.
12746         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
12747         Change methods from private to protected.
12748         (Target_arm::do_may_relax): New method definition.
12749         (Target_arm::do_relax, Target_arm::group_sections,
12750         Target_arm::scan_reloc_for_stub,
12751         Target_arm::scan_reloc_section_for_stubs): New method declarations.
12752         (Target_arm::arm_input_section_map_): New data member declaration.
12753         (Target_arm::scan_reloc_for_stub,
12754         Target_arm::scan_reloc_section_for_stubs,
12755         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
12756         Target_arm::do_relax): New method definitions.
12757
12758 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
12759
12760         * configure.ac: Check for (struct stat)::st_mtim
12761         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
12762         * config.in: Regenerate.
12763         * configure: Regenerate.
12764
12765 2009-11-05  Ian Lance Taylor  <iant@google.com>
12766
12767         PR 10910
12768         * output.cc (Output_segment::add_output_section): Add missing
12769         return statement.
12770
12771 2009-11-04  Ian Lance Taylor  <iant@google.com>
12772
12773         PR 10880
12774         * object.h (class Object): Add is_needed and set_is_needed
12775         methods.  Add is_needed_ field.  Make bool fields into bitfields.
12776         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
12777         defined in a dynamic object and referenced by a regular object,
12778         set is_needed for the dynamic object.
12779         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
12780         if the file is marked with as_needed and it is not needed.
12781
12782 2009-11-04  Ian Lance Taylor  <iant@google.com>
12783
12784         PR 10887
12785         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
12786         tags if data is discarded by linker script.
12787         * i386.cc (Target_i386::do_finalize_sections): Likewise.
12788         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12789         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12790         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12791
12792 2009-11-04  Ian Lance Taylor  <iant@google.com>
12793
12794         * layout.cc (Layout::get_output_section): Add is_interp and
12795         is_dynamic_linker_section parameters.  Change all callers.
12796         (Layout::choose_output_section): Likewise.
12797         (Layout::make_output_section): Likewise.
12798         (Layout::add_output_section_data): Add is_dynamic_linker_section
12799         parameter.  Change all callers.
12800         * layout.h (class Layout): Update declarations.
12801         * output.h (class Output_section): Add is_interp, set_is_interp,
12802         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
12803         Add is_interp_, is_dynamic_linker_section_ fields.  Change
12804         generate_code_fills_at_write_ to a bitfield.
12805         * output.cc (Output_section::Output_sections): Initialize new
12806         fields.
12807         (Output_segment::add_output_section): Add do_sort parameter.
12808         Change all callers.
12809
12810 2009-11-03  Ian Lance Taylor  <iant@google.com>
12811
12812         PR 10860
12813         * options.h (class General_options): Add --warn-common.
12814         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
12815         merging two common symbols.
12816         (Symbol_table::should_override): Handle --warn-common when merging
12817         a common symbol with a defined symbol.  Use report_resolve_problem
12818         for multiple definitions.
12819         (Symbol_table::report_resolve_problem): New function.
12820         * symtab.h (class Symbol_table): Declare report_resolve_problem.
12821
12822 2009-11-03  Doug Kwan  <dougkwan@google.com>
12823
12824         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
12825         stub_factory_.
12826         (Target_arm::stub_factory): New method definition.
12827         (Target_arm::new_arm_input_section,
12828         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
12829         Target_arm::reloc_uses_thumb_bit): New method declarations.
12830         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
12831         New type definitions.
12832         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
12833         member declarations.
12834         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
12835         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
12836         New method definitions.
12837
12838 2009-11-03  Ian Lance Taylor  <iant@google.com>
12839
12840         * options.h (class General_options): Add --warn_constructors.
12841
12842 2009-11-03  Ian Lance Taylor  <iant@google.com>
12843
12844         PR 10893
12845         * defstd.cc (in_section): Add entries for __rel_iplt_start,
12846         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
12847
12848 2009-11-03  Ian Lance Taylor  <iant@google.com>
12849
12850         PR 10895
12851         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
12852         --msgid-bugs-address.
12853         (install-pdf): New target.
12854         (install-data_yes): Look up one directory to find mkinstalldirs.
12855
12856 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
12857
12858         * po/Make-in (.po.gmo): Don't generate .gmo files in source
12859         tree.
12860
12861 2009-10-30  Doug Kwan  <dougkwan@google.com>
12862
12863         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
12864
12865 2009-10-30  Doug Kwan  <dougkwan@google.com>
12866
12867         * arm.cc (Stub_addend_reader): New struct template definition
12868         and partial specializations.
12869         (Stub_addend_reader::operator()): New method definition for a
12870         partially specialized template.
12871
12872 2009-10-30  Doug Kwan  <dougkwan@google.com>
12873
12874         * arm.cc (Arm_relobj::processor_specific_flags): New method
12875         definition.
12876         (Arm_relobj::do_read_symbols): New method declaration.
12877         (Arm_relobj::processor_specific_flags_): New data member declaration.
12878         (Arm_dynobj): New class definition.
12879         (Target_arm::do_finalize_sections): Add input_objects parameter.
12880         (Target_arm::do_adjust_elf_header): New method declaration.
12881         (Target_arm::are_eabi_versions_compatible,
12882         (Target_arm::merge_processor_specific_flags): New method declaration.
12883         (Target_arm::do_make_elf_object): New overloaded method definitions
12884         and declaration.
12885         (Arm_relobj::do_read_symbols): New method definition.
12886         (Arm_dynobj::do_read_symbols): Ditto.
12887         (Target_arm::do_finalize_sections): Add input_objects parameters.
12888         Merge processor-specific flags from all input objects.
12889         (Target_arm::are_eabi_versions_compatible,
12890         Target_arm::merge_processor_specific_flags,
12891         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
12892         New method definitions.
12893         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
12894         Input_objects pointer type parameter.
12895         * layout.cc (Layout::finalize): Pass input objects to target's.
12896         finalize_sections function.
12897         * output.cc (Output_file_header::do_sized_write): Set ELF file
12898         header's processor-specific flags.
12899         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
12900         Input_objects pointer type parameter.
12901         * sparc.cc (Target_sparc::do_finalize_sections): Same.
12902         * target.h (Input_objects): New forward class declaration.
12903         (Target::processor_specific_flags,
12904         Target::are_processor_specific_flags_sect): New method definitions.
12905         (Target::finalize_sections): Add input_objects parameter.
12906         (Target::Target): Initialize processor_specific_flags_ and
12907         are_processor_specific_flags_set_.
12908         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
12909         parameter.
12910         (Target::set_processor_specific_flags): New method definition.
12911         (Target::processor_specific_flags_,
12912         Target::are_processor_specific_flags_set_): New data member
12913         declarations.
12914         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
12915         Input_objects pointer type parameter.
12916
12917 2009-10-30  Doug Kwan  <dougkwan@google.com>
12918
12919         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
12920
12921 2009-10-28  Ian Lance Taylor  <iant@google.com>
12922
12923         * object.h (class Relobj): Drop options parameter from
12924         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
12925         do_scan_relocs, do_relocate.  Change all callers.
12926         (class Sized_relobj): Drop options parameters from
12927         do_gc_process_relocs, do_scan_relocs, do_relocate,
12928         do_relocate_sections, relocate_sections, emit_relocs_scan,
12929         emit_relocs_scan_reltype.  Change all callers.
12930         (struct Relocate_info): Remove options field and all references to
12931         it.
12932         * reloc.h (class Read_relocs): Remove options constructor
12933         parameter and options_ field.  Change all callers.
12934         (class Gc_process_relocs, class Scan_relocs): Likewise.
12935         (class Relocate_task): Likewise.
12936         * target-reloc.h (scan_relocs): Remove options parameter.  Change
12937         all callers.
12938         (scan_relocatable_relocs): Likewise.
12939         * target.h (class Sized_target): Remove options parameter from
12940         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
12941         all callers.
12942         * gc.h (gc_process_relocs): Remove options parameter.  Change all
12943         callers.
12944         * arm.cc: Update functions to remove options parameters.
12945         * i386.cc: Likewise.
12946         * powerpc.cc: Likewise.
12947         * sparc.cc: Likewise.
12948         * x86_64.cc: Likewise.
12949         * testsuite/testfile.cc: Likewise.
12950
12951 2009-10-28  Doug Kwan  <dougkwan@google.com>
12952
12953         * arm.cc (Arm_relobj): New class definition.
12954         (Arm_relobj::scan_sections_for_stubs,
12955         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
12956         New method definitions.
12957
12958 2009-10-28  Cary Coutant  <ccoutant@google.com>
12959
12960         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
12961         (Plugin::cleanup_done_): New member.
12962         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
12963         (Plugin_manager::cleanup_done_): Remove.
12964         (Plugin_manager::add_input_file): Edit error message.
12965         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
12966         (Plugin_manager::cleanup): Remove use of cleanup_done_.
12967
12968 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
12969
12970         * fileread.cc: (File_read::View::~View): Use the new
12971         data_ownership_ filed.
12972         (File_read::~File_read): Dispose the new whole_file_view_.
12973         (File_read::open): Mmap the whole file if needed.
12974         (File_read::open): Use whole_file_view_ instead of contents_.
12975         (File_read::find_view): Use whole_file_view_ if applicable.
12976         (File_read::do_read): Use whole_file_view_ instead of contents_.
12977         (File_read::make_view): Use whole_file_view_ instead of contents_,
12978         update File_read::View::View call.
12979         (File_read::find_or_make_view): Update File_read::View::View
12980         call.
12981         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
12982         remove contents_
12983         (File_read::View::Data_ownership): New enum.
12984         (File_read::View::View): Replace bool mapped_ with Data_ownership
12985         argument.
12986         (File_read::View::mapped_): Remove (replaced by data_ownership_).
12987         (File_read::View::data_ownership_): New field.
12988         (File_read::contents_): Remove (replaced by whole_file_view_).
12989         (File_read::whole_file_view_): New field.
12990         * options.h (class General_options): Add --keep-files-mapped.
12991
12992 2009-10-27  Cary Coutant  <ccoutant@google.com>
12993
12994         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
12995         * testsuite/Makefile.am (plugin_test_5): New test case.
12996         * testsuite/Makefile.in: Regenerate.
12997
12998 2009-10-25  Doug Kwan  <dougkwan@google.com>
12999
13000         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
13001         from private to protected to allow access by child class.
13002         (Sized_relobj::do_relocate_sections): New method declaration.
13003         (Sized_relobj::relocate_sections): Virtualize.
13004         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
13005         Sized_relobj::relocate_sections.  Instantiate template explicitly
13006         for different target sizes and endianity.
13007
13008 2009-10-24  Doug Kwan  <dougkwan@google.com>
13009
13010         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
13011         (Arm_input_section::as_arm_input_section): New method.
13012         (Arm_output_section): New class definition.
13013         (Arm_output_section::create_stub_group,
13014         Arm_output_section::group_sections): New method definitions.
13015
13016 2009-10-22  Doug Kwan  <dougkwan@google.com>
13017
13018         * arm.cc (Arm_input_section): New class definition.
13019         (Arm_input_section::init, Arm_input_section:do_write,
13020         Arm_input_section::set_final_data_size,
13021         Arm_input_section::do_reset_address_and_file_offset): New method
13022         definitions.
13023
13024 2009-10-21  Doug Kwan  <dougkwan@google.com>
13025
13026         * arm.cc (Stub_table, Arm_input_section): New forward class
13027         declarations.
13028         (Stub_table): New class defintion.
13029         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
13030         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
13031         New method definition.
13032
13033 2009-10-21  Doug Kwan  <dougkwan@google.com>
13034
13035         * arm.cc: Update copyright comments.
13036         (Target_arm): New forward class template declaration.
13037         (Arm_address): New type.
13038         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
13039         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
13040         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
13041         constants.
13042         (Insn_template): Same.
13043         (DEF_STUBS): New macro.
13044         (Stub_type): New enum type.
13045         (Stub_template): New class definition.
13046         (Stub): Same.
13047         (Reloc_stub): Same.
13048         (Stub_factory): Same.
13049         (Target_arm::Target_arm): Initialize may_use_blx_ and
13050         should_force_pic_veneer_.
13051         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
13052         Target_arm::should_force_pic_veneer,
13053         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
13054         Target_arm::using_thumb_only, Target_arm:;default_target): New
13055         method defintions.
13056         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
13057         New data member declarations.
13058         (Insn_template::size, Insn_template::alignment): New method defintions.
13059         (Stub_template::Stub_template): New method definition.
13060         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
13061         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
13062         (Stub_factory::Stub_factory): New method definition.
13063         * gold.h (string_hash): New template.
13064         * output.h (Input_section_specifier::hash_value): Use
13065         gold::string_hash.
13066         (Input_section_specifier::string_hash): Remove.
13067         * stringpool.cc (Stringpool_template::string_hash): Use
13068         gold::string_hash.
13069
13070 2009-10-20  Doug Kwan  <dougkwan@google.com>
13071
13072         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
13073         symbols of relaxed input sections.
13074         * output.h (Output_section::find_relaxed_input_section): Make
13075         method public.
13076
13077 2009-10-16  Doug Kwan  <dougkwan@google.com>
13078
13079         * dynobj.cc (Versions::Versions): Initialize version_script_.
13080         Only insert base version symbol definition for a shared object
13081         if version script defines any version versions.
13082         (Versions::define_base_version): New method definition.
13083         (Versions::add_def): Check that base version is not needed.
13084         (Versions::add_need): Define base version lazily.
13085         * dynobj.h (Versions::define_base_version): New method declaration.
13086         (Versions::needs_base_version_): New data member declaration.
13087         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
13088         (check_DATA): Add no_version_test.stdout.
13089         (libno_version_test.so, no_version_test.o no_version_test.stdout):
13090         New make rules.
13091         * testsuite/Makefile.in: Regenerate.
13092         * testsuite/no_version_test.c: New file.
13093         * testsuite/no_version_test.sh: Ditto.
13094
13095 2009-10-16  Doug Kwan  <dougkwan@google.com>
13096
13097         * expression.cc (class Segment_start_expression): New class definition.
13098         (Segment_start_expression::value): New method definition.
13099         (script_exp_function_segment_start): Return a new
13100         Segment_start_expression.
13101         * gold/script-c.h (script_saw_segment_start_expression): New function
13102         prototype.
13103         * script-sections.cc (Script_sections::Script_sections): Initialize
13104         SAW_SEGMENT_START_EXPRESSION_ to false.
13105         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
13106         and -Tbbs options to specify section addresses if given in
13107         command line and no SEGMENT_START expression is seen in a script.
13108         * script-sections.h (Script_sections::saw_segment_start_expression,
13109         Script_sections::set_saw_segment_start_expression): New method
13110         definition.
13111         (Script_sections::saw_segment_start_expression_): New data member
13112         declaration.
13113         * script.cc (script_saw_segment_start_expression): New function.
13114         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
13115         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
13116         script_test_7.sh and script_test_8.sh.
13117         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
13118         script_test_8.stdout.
13119         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
13120         (script_test_6, script_test_6.stdout, script_test_7,
13121         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
13122         * Makefile.in: Regenerate.
13123         * testsuite/script_test_6.sh: New file.
13124         * testsuite/script_test_6.t: Same.
13125         * testsuite/script_test_7.sh: Same.
13126         * testsuite/script_test_7.t: Same.
13127         * testsuite/script_test_8.sh: Same.
13128
13129 2009-10-16  Doug Kwan  <dougkwan@google.com>
13130
13131         * output.cc (Output_segment::set_section_list_address): Cast
13132         expressions to unsigned long long type to avoid format warnings.
13133
13134 2009-10-15  Ian Lance Taylor  <iant@google.com>
13135
13136         * script.cc (Script_options::add_symbol_assignment): Always add a
13137         dot assignment to script_sections_.
13138         * script-sections.cc (Script_sections::add_dot_assignment):
13139         Initialize if necessary.
13140
13141         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
13142         program headers with no load segment if there is a linker script.
13143
13144         * layout.cc (Layout::set_segment_offsets): Align the file offset
13145         to the segment aligment for -N or -n with no load segment.
13146         * output.cc (Output_segment::add_output_section): Don't crash if
13147         the first section is a TLS section.
13148         (Output_segment::set_section_list_addresses): Print an error
13149         message if the address moves backward in a linker script.
13150         * script-sections.cc
13151         (Output_section_element_input::set_section_addresses): Don't
13152         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
13153         (Orphan_output_section::set_section_addresses): Likewise.
13154
13155 2009-10-15  Doug Kwan  <dougkwan@google.com>
13156
13157         * layout.cc (Layout::finish_dynamic_section): Generate tags
13158         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
13159         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
13160         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
13161
13162 2009-10-14  Ian Lance Taylor  <iant@google.com>
13163
13164         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
13165         fields.
13166         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
13167         data_shdr fields of relinfo.
13168         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
13169         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
13170         R_386_TLS_LDO_32, adjust based on section flags.
13171         (Target_i386::Relocate::fix_up_ldo): Remove.
13172
13173 2009-10-13  Ian Lance Taylor  <iant@google.com>
13174
13175         Add support for -pie.
13176         * options.h (class General_options): Add -pie and
13177         --pic-executable.
13178         (General_options::output_is_position_independent): Test -pie.
13179         (General_options::output_is_executable): Return true if not shared
13180         and not relocatable.
13181         (General_options::output_is_pie): Remove.
13182         * options.cc (General_options::finalize): Reject incompatible uses
13183         of -pie.
13184         * gold.cc (queue_middle_tasks): A -pie link is not static.
13185         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
13186         * symtab.cc (Symbol::final_value_is_known): Return false if
13187         output_is_position_independent.
13188         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
13189         output_is_position_independent.
13190         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
13191         output_is_position_independent.
13192         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
13193         output_is_position_independent.
13194         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
13195         two_file_pie_test.
13196         (basic_pie_test.o, basic_pie_test): New targets.
13197         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
13198         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
13199         (two_file_pie_test): New target.
13200         * testsuite/Makefile.in: Rebuild.
13201         * README: Remove note saying that -pie is not supported.
13202
13203 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
13204
13205         * options.h (class General_options): Add -init and -fini.
13206         * layout.cc (Layout::finish_dynamic_section): Emit
13207         given init and fini functions.
13208
13209 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
13210
13211         * gc.h (gc_process_relocs): Check if icf is enabled using new
13212         function.
13213         * gold.cc (queue_initial_tasks): Likewise.
13214         (queue_middle_tasks): Likewise.
13215         * object.cc (do_layout): Likewise.
13216         * symtab.cc (is_section_folded): Likewise.
13217         * main.cc (main): Likewise.
13218         * reloc.cc (Read_relocs::run): Likewise.
13219         (Sized_relobj::do_scan_relocs): Likewise.
13220         * icf.cc (is_function_ctor_or_dtor): New function.
13221         (Icf::find_identical_sections): Check if function is ctor or dtor when
13222         safe icf is chosen.
13223         * options.h (General_options::icf): Change option to be an enum.
13224         (Icf_status): New enum.
13225         (icf_enabled): New method.
13226         (icf_safe_folding): New method.
13227         (set_icf_status): New method.
13228         (icf_status_): New variable.
13229         * (options.cc) (General_options::finalize): Set icf_status_.
13230         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
13231         icf_test and icf_keep_unique_test to use the --icf enum flag.
13232         * testsuite/icf_safe_test.sh: New file.
13233         * testsuite/icf_safe_test.cc: New file.
13234
13235 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
13236
13237         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
13238         includes to gc.h and icf.h.
13239         * arm.cc: Include gc.h.
13240         * gold.cc: Likewise.
13241         * i386.cc: Likewise.
13242         * powerpc.cc: Likewise.
13243         * sparc.cc: Likewise.
13244         * x86_64.cc: Likewise.
13245         * gc.h: Include icf.h.
13246
13247 2009-10-11  Ian Lance Taylor  <iant@google.com>
13248
13249         * plugin.cc: Include "gold.h" before other header files.
13250
13251 2009-10-10  Chris Demetriou  <cgd@google.com>
13252
13253         * options.h (Input_file_argument::Input_file_type): New enum.
13254         (Input_file_argument::is_lib_): Replace with...
13255         (Input_file_argument::type_): New member.
13256         (Input_file_argument::Input_file_argument): Take Input_file_type
13257         'type' rather than boolean 'is_lib' as second argument.
13258         (Input_file_argument::is_lib): Use type_.
13259         (Input_file_argument::is_searched_file): New function.
13260         (Input_file_argument::may_need_search): Handle is_searched_file.
13261         * options.cc (General_options::parse_library): Support -l:filename.
13262         (General_options::parse_just_symbols): Update for Input_file_argument
13263         changes.
13264         (Command_line::process): Likewise.
13265         * archive.cc (Archive::get_file_and_offset): Likewise.
13266         * plugin.cc (Plugin_manager::release_input_file): Likewise.
13267         * script.cc (read_script_file, script_add_file): Likewise.
13268         * fileread.cc (Input_file::Input_file): Likewise.
13269         (Input_file::will_search_for): Handle is_searched_file.
13270         (Input_file::open): Likewise.
13271         * readsyms.cc (Read_symbols::get_name): Likewise.
13272         * testsuite/Makefile.am (searched_file_test): New test.
13273         * testsuite/Makefile.in: Regenerate.
13274         * testsuite/searched_file_test.cc: New file.
13275         * testsuite/searched_file_test_lib.cc: New file.
13276
13277 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13278             Ian Lance Taylor  <iant@google.com>
13279
13280         * descriptor.cc: Include <cstdio> and "binary-io.h".
13281         (Descriptors::open): Open the files in binary mode always.
13282         * script.cc (Lex::get_token): Treat \r as whitespace.
13283
13284 2009-10-09  Ian Lance Taylor  <iant@google.com>
13285
13286         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
13287
13288 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13289             Ian Lance Taylor  <iant@google.com>
13290
13291         * configure.ac: Check for readv function also.
13292         * fileread.cc (readv): Define if not HAVE_READV.
13293         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
13294         does not exist.
13295         * config.in: Regenerate.
13296         * configure: Regenerate.
13297
13298 2009-10-09  Doug Kwan  <dougkwan@google.com>
13299
13300         * layout.cc (Layout::make_output_section): Call target hook to make
13301         ordinary output section.
13302         (Layout::finalize): Adjust parameter list of call the
13303         Target::may_relax().
13304         * layout.h (class Layout::section_list): New method.
13305         * merge.h (Output_merge_base::entsize): Change visibility to public.
13306         (Output_merge_base::is_string, Output_merge_base::do_is_string):
13307         New methods.
13308         (Output_merge_string::do_is_string): New method.
13309         * object.cc (Sized_relobj::do_setup): renamed from
13310         Sized_relobj::set_up.
13311         * object.h (Sized_relobj::adjust_shndx,
13312         Sized_relobj::initializ_input_to_output_maps,
13313         Sized_relobj::free_input_to_output_maps): Change visibilities to
13314         protected.
13315         (Sized_relobj::setup): Virtualize.
13316         (Sized_relobj::do_setup): New method declaration.
13317         (Sized_relobj::invalidate_section_offset,
13318         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
13319         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
13320         * options.cc (parse_int): New function.
13321         * options.h (parse_int): New declaration.
13322         (DEFINE_int): New macro.
13323         (stub_group_size): New option.
13324         * output.cc (Output_section::Output_section): Initialize memebers
13325         merge_section_map_, merge_section_by_properties_map_,
13326         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
13327         (Output_section::add_input_section): Handled deferred code-fill
13328         generation and remove an old comment.
13329         (Output_section::add_relaxed_input_section): New method definition.
13330         (Output_section::add_merge_input_section): Use merge section by
13331         properties map to speed to search.  Update merge section maps
13332         as appropriate.
13333         (Output_section::build_relaxation_map): New method definition.
13334         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
13335         Same.
13336         (Output_section::relax_input_section): Renamed to
13337         Output_section::convert_input_sections_to_relaxed_sections and change
13338         interface to take a vector of pointers to relaxed sections.
13339         (Output_section::find_merge_section,
13340         Output_section::find_relaxed_input_section): New method definitions.
13341         (Output_section::is_input_address_mapped,
13342         Output_section::output_offset, Output_section::output_address):
13343         Use output section data maps to speed up searching.
13344         (Output_section::find_starting_output_address): Add comments.
13345         (Output_section::do_write,
13346         Output_section::write_to_postprocessing_buffer): Do code-fill
13347         generation as appropriate.
13348         (Output_section::get_input_sections): Invalidate relaxed input section
13349         map.
13350         (Output_section::restore_states): Adjust type of checkpoint .
13351         Invalidate relaxed input section map.
13352         * output.h (Output_merge_base): New class declaration.
13353         (Input_section_specifier): New class defintion.
13354         (class Output_relaxed_input_section) Change base class to
13355         Output_section_data_build.
13356         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
13357         base class initializer.
13358         (Output_section::add_relaxed_input_section): New method declaration.
13359         (Output_section::Input_section): Change visibility to protected.
13360         (Output_section::Input_section::relobj,
13361         Output_section::Input_section::shndx): Handle relaxed input sections.
13362         Output_section::input_sections) Change visibility to protected.  Also
13363         define overload to return a non-const pointer.
13364         (Output_section::Merge_section_properties): New class defintion.
13365         (Output_section::Merge_section_by_properties_map,
13366         Output_section::Output_section_data_by_input_section_map,
13367         Output_section::Relaxation_map): New types.
13368         (Output_section::relax_input_section): Rename method to
13369         Output_section::convert_input_sections_to_relaxed_sections and change
13370         interface to take a vector of relaxed section pointers.
13371         (Output_section::find_merge_section,
13372         Output_section::find_relaxed_input_section,
13373         Output_section::build_relaxation_map,
13374         Output_section::convert_input_sections_in_list_to_relaxed_sections):
13375         New method declarations.
13376         (Output_section::merge_section_map_
13377         Output_section::merge_section_by_properties_map_,
13378         Output_section::relaxed_input_section_map_,
13379         Output_section::is_relaxed_input_section_map_valid_,
13380         Output_section::generate_code_fills_at_write_): New data members.
13381         * script-sections.cc
13382         (Output_section_element_input::set_section_addresses): Call
13383         current_data_size and addralign methods of relaxed input sections.
13384         (Orphan_output_section::set_section_addresses): Call current_data_size
13385         and addralign methods of relaxed input sections.
13386         * symtab.cc (Symbol_table::compute_final_value): Extract template
13387         from the body of Symbol_table::sized_finalize_symbol.
13388         (Symbol_table::sized_finalized_symbol): Call
13389         Symbol_table::compute_final_value.
13390         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
13391         (Symbol_table::compute_final_value): New templated method declaration.
13392         * target.cc (Target::do_make_output_section): New method defintion.
13393         * target.h (Target::make_output_section): New method declaration.
13394         (Target::relax): Add more parameters for input objects, symbol table
13395         and layout.  Adjust call to do_relax.
13396         (Target::do_make_output_section): New method declaration.
13397         (Target::do_relax): Add parameters for input objects, symbol table
13398         and layout.
13399
13400 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13401
13402         * pread.c: Include stdio.h.
13403
13404 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13405
13406         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
13407         defined.
13408
13409 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13410
13411         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
13412         Change read_shndx type to unsigned int.
13413         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13414         int.
13415         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13416         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
13417         Change read_shndx type to unsigned int.
13418         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13419         int.
13420         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13421         * layout.cc (Layout::create_symtab_sections): Cast the result of
13422         local_symcount * symsize to off_t in the gold_assert.
13423
13424 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13425
13426         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
13427         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
13428         R_ARM_BASE_ABS.
13429         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
13430         (Arm_relocate_functions::thm_abs5): New function.
13431         (Arm_relocate_functions::abs12): New function.
13432         (Arm_relocate_functions::abs16): New function.
13433         (Arm_relocate_functions::base_abs): New function.
13434         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
13435         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
13436         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
13437         R_ARM_BASE_ABS.
13438         (Scan::global): Likewise.
13439         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
13440         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
13441         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
13442         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
13443         R_ARM_BASE_ABS.
13444
13445 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13446
13447         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
13448         (Arm_relocate_functions::movt_prel): New function.
13449         (Arm_relocate_functions::thm_movw_prel_nc): New function.
13450         (Arm_relocate_functions::thm_movt_prel): New function.
13451         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
13452         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
13453         (Scan::global, Relocate::relocate): Likewise.
13454         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13455
13456 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13457
13458         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
13459         Incremental_checker.
13460         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
13461         unsigned int.
13462         (class Incremental_inputs_header): New class.
13463         (Incremental_inputs_header_writer): Edit comment.
13464         (Incremental_inputs_entry): New class.
13465         (Incremental_inputs_entry_writer): Edit comment.
13466         (Sized_incremental_binary::do_find_incremental_inputs_section):
13467         Add *strtab_shndx parameter, fill it.
13468         (Sized_incremental_binary::do_check_inputs): New method.
13469         (Incremental_checker::can_incrementally_link_output_file): Use
13470         Sized_incremental_binary::check_inputs.
13471         (Incremental_inputs::report_command_line): Save command line in
13472         command_line_.
13473         * incremental.h:
13474         (Incremental_binary::find_incremental_inputs_section): New
13475         method.
13476         (Incremental_binary::do_find_incremental_inputs_section): Add
13477         strtab_shndx parameter.
13478         (Incremental_binary::do_check_inputs): New pure virtual method.
13479         (Sized_incremental_binary::do_check_inputs): Declare.
13480         (Incremental_checker::Incremental_checker): Add incremental_inputs
13481         parameter, use it to initialize incremental_inputs_.
13482         (Incremental_checker::incremental_inputs_): New field.
13483         (Incremental_checker::command_line): New method.
13484         (Incremental_checker::inputs): New method.
13485         (Incremental_checker::command_line_): New field.
13486
13487 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13488
13489         * incremental.cc: Include <cstdarg> and "target-select.h".
13490         (vexplain_no_incremental): New function.
13491         (explain_no_incremental): New function.
13492         (Incremental_binary::error): New method.
13493         (Sized_incremental_binary::do_find_incremental_inputs_section): New
13494         method.
13495         (make_sized_incremental_binary): New function.
13496         (open_incremental_binary): New function.
13497         (can_incrementally_link_file): Add checks if output is ELF and has
13498         inputs section.
13499         * incremental.h: Include "elfcpp_file.h" and "output.h".
13500         (Incremental_binary): New class.
13501         (Sized_incremental_binary): New class.
13502         (open_incremental_binary): Declare.
13503         * object.cc (is_elf_object): Use
13504         elfcpp::Elf_recognizer::is_elf_file.
13505         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
13506         * output.h (Output_file::filesize): New method.
13507
13508 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13509
13510         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
13511         New function.
13512         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
13513         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
13514         function.
13515         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
13516         function.
13517         (Arm_relocate_functions::movw_abs_nc): New function.
13518         (Arm_relocate_functions::movt_abs): New function.
13519         (Arm_relocate_functions::thm_movw_abs_nc): New function.
13520         (Arm_relocate_functions::thm_movt_abs): New function.
13521         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
13522         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
13523         (Scan::global): Likewise.
13524         (Relocate::relocate): Likewise.
13525         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13526
13527 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13528
13529         * arm.cc (Arm_relocate_functions::got_prel) New function.
13530         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
13531         (Relocate::relocate): Likewise.
13532         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13533
13534 2009-10-06  Ian Lance Taylor  <iant@google.com>
13535
13536         * options.h (class General_options): Define
13537         split_stack_adjust_size parameter.
13538         * object.h (class Object): Add uses_split_stack_ and
13539         has_no_split_stack_ fields.  Add uses_split_stack and
13540         has_no_split_stack accessor functions.  Declare
13541         handle_split_stack_section.
13542         (class Reloc_symbol_changes): Define.
13543         (class Sized_relobj): Define Function_offsets.  Declare
13544         split_stack_adjust, split_stack_adjust_reltype, and
13545         find_functions.
13546         * object.cc (Object::handle_split_stack_section): New function.
13547         (Sized_relobj::do_layout): Call handle_split_stack_section.
13548         * dynobj.cc (Sized_dynobj::do_layout): Call
13549         handle_split_stack_section.
13550         * reloc.cc (Sized_relobj::relocate_sections): Call
13551         split_stack_adjust for executable sections in split_stack
13552         objects.  Pass reloc_map to relocate_section.
13553         (Sized_relobj::split_stack_adjust): New function.
13554         (Sized_relobj::split_stack_adjust_reltype): New function.
13555         (Sized_relobj::find_functions): New function.
13556         * target-reloc.h: Include "object.h".
13557         (relocate_section): Add reloc_symbol_changes parameter.  Change
13558         all callers.
13559         * target.h (class Target): Add calls_non_split method.  Declare
13560         do_calls_non_split virtual method.  Declare match_view and
13561         set_view_to_nop.
13562         * target.cc: Include "elfcpp.h".
13563         (Target::do_calls_non_split): New function.
13564         (Target::match_view): New function.
13565         (Target::set_view_to_nop): New function.
13566         * gold.cc (queue_middle_tasks): Give an error if mixing
13567         split-stack and non-split-stack objects with -r.
13568         * i386.cc (Target_i386::relocate_section): Add
13569         reloc_symbol_changes parameter.
13570         (Target_i386::do_calls_non_split): New function.
13571         * x86_64.cc (Target_x86_64::relocate_section): Add
13572         reloc_symbol_changes parameter.
13573         (Target_x86_64::do_calls_non_split): New function.
13574         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
13575         parameter.
13576         * powerpc.cc (Target_powerpc::relocate_section): Add
13577         reloc_symbol_changes parameter.
13578         * sparc.cc (Target_sparc::relocate_section): Add
13579         reloc_symbol_changes parameter.
13580         * configure.ac: Call AM_CONDITIONAL for the default target.
13581         * configure: Rebuild.
13582         * testsuite/Makefile.am (TEST_AS): New variable.
13583         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
13584         (check_DATA): Add split_i386 and split_x86_64 files.
13585         (SPLIT_DEFSYMS): Define.
13586         (split_i386_[1234n].o): New targets.
13587         (split_i386_[124]): New targets.
13588         (split_i386_[1234r].stdout): New targets.
13589         (split_x86_64_[1234n].o): New targets.
13590         (split_x86_64_[124]): New targets.
13591         (split_x86_64_[1234r].stdout): New targets.
13592         (MOSTLYCLEANFILES): Add new executables.
13593         * testsuite/split_i386.sh: New file.
13594         * testsuite/split_x86_64.sh: New file.
13595         * testsuite/split_i386_1.s: New file.
13596         * testsuite/split_i386_2.s: New file.
13597         * testsuite/split_i386_3.s: New file.
13598         * testsuite/split_i386_4.s: New file.
13599         * testsuite/split_i386_n.s: New file.
13600         * testsuite/split_x86_64_1.s: New file.
13601         * testsuite/split_x86_64_2.s: New file.
13602         * testsuite/split_x86_64_3.s: New file.
13603         * testsuite/split_x86_64_4.s: New file.
13604         * testsuite/split_x86_64_n.s: New file.
13605         * testsuite/testfile.cc (Target_test): Update relocation_section
13606         function.
13607         * testsuite/Makefile.in: Rebuild.
13608
13609 2009-10-06  Ian Lance Taylor  <iant@google.com>
13610
13611         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
13612         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
13613         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
13614         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
13615         the address on ldo_addrs_.
13616         (Target_i386::Relocate::fix_up_ldo): New function.
13617
13618 2009-10-06   Rafael Espindola  <espindola@google.com>
13619
13620         * plugin.cc (add_input_library): New.
13621         (Plugin::load): Add add_input_library to tv.
13622         (Plugin_manager::add_input_file): Add the is_lib argument.
13623         (add_input_file): Update call to Plugin_manager::add_input_file.
13624         (add_input_library): New.
13625         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
13626
13627 2009-09-30  Doug Kwan  <dougkwan@google.com>
13628
13629         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
13630         symbol and call Symbol::may_need_copy_reloc to determine if
13631         a copy reloc is needed.
13632         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
13633         nocopyreloc is given in command line.
13634         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
13635         given in command line.
13636         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
13637         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
13638         of the removed Target_i386::may_need_copy_reloc.
13639         * options.h (copyreloc): New option with default value false.
13640         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13641         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
13642         instead of the removed Target_powerpc::may_need_copy_reloc.
13643         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13644         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
13645         instead of the removed Target_sparc::may_need_copy_reloc.
13646         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
13647         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
13648         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
13649         instead of the removed Target_x86_64::may_need_copy_reloc.
13650
13651 2009-09-30  Ian Lance Taylor  <iant@google.com>
13652
13653         * object.h (class Object): Remove target_ field, and target,
13654         sized_target, and set_target methods.
13655         (Object::sized_target): Remove.
13656         (class Sized_relobj): Update declarations.  Remove sized_target.
13657         * object.cc (Sized_relobj::setup): Remove target parameter.
13658         Change all callers.
13659         (Input_objects::add_object): Don't do anything with the target.
13660         (make_elf_sized_object): Add punconfigured parameter.  Change all
13661         callers.  Set or test parameter target.
13662         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
13663         Change all callers.
13664         * parameters.cc (Parameters::set_target): Change parameter type to
13665         be non-const.
13666         (Parameters::default_target): Remove.
13667         (set_parameters_target): Change parameter type to be non-const.
13668         (parameters_force_valid_target): New function.
13669         (parameters_clear_target): New function.
13670         * parameters.h (class Parameters): Update declarations.  Remove
13671         default_target method.  Add sized_target and clear_target
13672         methods.  Change target_ to be non-const.
13673         (set_parameters_target): Update declaration.
13674         (parameters_force_valid_target): Declare.
13675         (parameters_clear_target): Declare.
13676         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
13677         as NULL if we aren't searching.
13678         (Add_symbols::run): Don't check for compatible target.
13679         * fileread.cc (Input_file::open_binary): Call
13680         parameters_force_valid_target.
13681         * gold.cc (queue_middle_tasks): Likewise.
13682         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
13683         set_target on object.
13684         * dynobj.h (class Sized_dynobj): Update declarations.
13685         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
13686         make_elf_object returns NULL.
13687         (Archive::include_member): Don't check whether object target is
13688         compatible.
13689         * output.cc (Output_section::add_input_section): Get target from
13690         parameters.
13691         (Output_section::relax_input_section): Likewise.
13692         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
13693         parameters.
13694         (Sized_relobj::do_scan_relocs): Likewise.
13695         (Sized_relobj::relocate_sections): Likewise.
13696         * resolve.cc (Symbol_table::resolve): Likewise.
13697         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
13698         parameter.  Change all callers.
13699         (Symbol_table::add_from_object): Get target from parameters.
13700         (Symbol_table::add_from_relobj): Don't check object target.
13701         (Symbol_table::add_from_dynobj): Likewise.
13702         (Symbol_table::define_special_symbol): Get target from
13703         parameters.
13704         * symtab.h (class Symbol_table): Update declaration.
13705         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
13706         parameter.  Change all callers.  Clear parameter target.
13707         (Binary_test): Test target here.
13708         * testsuite/object_unittest.cc (gold_testsuite): Remove
13709         target_test_pointer parameter.  Change all callers.
13710         (Object_test): Test target here.
13711
13712 2009-09-26  Ian Lance Taylor  <iant@google.com>
13713
13714         * testsuite/initpri1.c: Don't try to use constructor priorities if
13715         compiling with gcc before 4.3.
13716
13717 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
13718
13719         * testsuite/retain_symbols_file_test.sh (check_present): Change
13720         output file name to retain_symbols_file_test.stdout.
13721         (check_absent): Likewise.
13722
13723 2009-09-18  Craig Silverstein  <csilvers@google.com>
13724
13725         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
13726         * options.cc: Include <cerrno> and <fstream>.
13727         (General_options::finalize): Parse -retain-symbols-file tag.
13728         * options.h: New flag.
13729         (General_options): New method should_retain_symbol, new
13730         variable symbols_to_retain.
13731         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
13732         should_retain_symbol map.
13733         * testsuite/Makefile.am (retain_symbols_file_test): New test.
13734         * testsuite/Makefile.in: Regenerate.
13735         * testsuite/retain_symbols_file_test.sh: New file.
13736
13737 2009-09-18  Nick Clifton  <nickc@redhat.com>
13738
13739         * po/es.po: Updated Spanish translation.
13740
13741 2009-09-17  Doug Kwan  <dougkwan@google.com>
13742
13743         * debug.h (DEBUG_RELAXATION): New constant.
13744         (DEBUG_ALL): Add DEBUG_RELAXATION.
13745         (debug_string_to_enum): Add relaxation debug option.
13746         * layout.cc
13747         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
13748         Layout::Relaxation_debug_check::read_sections,
13749         Layout::Relaxation_debug_check::read_sections): New method definitions.
13750         (Layout::Layout): Initialize data members
13751         record_output_section_data_from_scrips_,
13752         script_output_section_data_list_ and relaxation_debug_check_.
13753         (Layout::save_segments, Layout::restore_segments,
13754         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13755         Layout::relaxation_loop_body): New method definitions.
13756         (Layout::finalize): Support relaxation.  Move section layout code to
13757         Layout::relaxation_loop_body.
13758         (Layout::set_asection_address_from_script): Move code for orphan
13759         section placement out.
13760         (Layout::place_orphan_sections_in_script): New method definition.
13761         * layout.h (Output_segment_headers, Output_file_header):
13762         New forward class declarations.
13763         (Layout::~Layout): Define.
13764         (Layout::new_output_section_data_from_script): New method definition.
13765         (Layout::place_orphan_sections_in_script): New method declaration.
13766         (Layout::Segment_states): New type declaration.
13767         (Layout::save_segments, Layout::restore_segments,
13768         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13769         Layout::relaxation_loop_body): New method declarations.
13770         (Layout::Output_section_data_list): New type declaration.
13771         (Layout::Relaxation_debug_check): New class definition.
13772         (Layout::record_output_section_data_from_script_,
13773         Layout::script_output_section_data_list_, Layout::segment_states_,
13774         Layout::relaxation_debug_check_): New data members.
13775         * output.cc: (Output_section_headers::do_size): New method definition.
13776         (Output_section_headers::Output_section_headers): Move size
13777         computation to Output_section_headers::do_size.
13778         (Output_segment_headers::do_size): New method definition.
13779         (Output_file_header::Output_file_header): Move size computation to
13780         Output_file_header::do_size and call it.
13781         (Output_file_header::do_size): New method definition.
13782         (Output_data_group::Output_data_group): Adjust call to
13783         Output_section_data.
13784         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
13785         (Output_symtab_xindex::do_write): Add array bound check.
13786         (Output_section::Input_section::print_to_mapfile): Handle
13787         RELAXED_INPUT_SECTION_CODE.
13788         (Output_section::Output_section): Initialize data member checkpoint_.
13789         (Output_section::~Output_section): Delete checkpoint object pointed
13790         by checkpoint_.
13791         (Output_section::add_input_section): Always add an Input_section if
13792         relaxing.
13793         (Output_section::add_merge_input_section): Add assert.
13794         (Output_section::relax_input_section): New method definition.
13795         (Output_section::set_final_data_size): Set load address to zero for
13796         an unallocated section.
13797         (Output_section::do_address_and_file_offset_have_reset_values):
13798         New method definition.
13799         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
13800         Handle relaxed input section.
13801         (Output_section::sort_attached_input_sections): Checkpoint input
13802         section list lazily.
13803         (Output_section::get_input_sections): Change type of input_sections to
13804         list of Simple_input_section pointers.  Checkpoint input section list
13805         lazily.  Also handle relaxed input sections.
13806         (Output_section::add_input_section_for_script): Take a reference to
13807         a Simple_input_section object instead of Relobj pointer and section
13808         index as parameter.  Handle relaxed input sections.
13809         (Output_section::save_states, Output_section::restore_states): New
13810         method definitions.
13811         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
13812         (Output_data::is_data_size_fixed): New method definition.
13813         (Output_data::reset_addresss_and_file_offset): Do not reset data size
13814         if it is fixed.
13815         (Output_data::address_and_file_offset_have_reset_values): New method
13816         definition.
13817         (Output_data::do_address_and_file_offset_have_reset_values): New method
13818         definition.
13819         (Output_data::set_data_size): Check that data size is not fixed.
13820         (Output_data::fix_data_size): New method definition.
13821         (Output_data::is_data_size_fixed_): New data member.
13822         (Output_section_headers::set_final_data_size): New method definition.
13823         (Output_section_headers::do_size): New method declaration.
13824         (Output_segment_headers::set_final_data_size): New method definition.
13825         (Output_segment_headers::do_size): New method declaration.
13826         (Output_file_header::set_final_data_size)::New method definition.
13827         (Output_file_header::do_size)::New method declaration.
13828         (Output_section_data::Output_section_data): Add new parameter
13829         is_data_size_fixed and use it to fix data size.
13830         (Output_data_const::Output_data_const): Adjust call to base class
13831         constructor and fix data size.
13832         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
13833         base class constructor and fix data size.
13834         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
13835         base class constructor and fix data size.
13836         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
13837         class constructor and fix data size.
13838         (Output_data_group::set_final_data_size): New method definition.
13839         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
13840         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
13841         class constructor and fix data size.
13842         (Output_relaxed_input_section): New class definition.
13843         (Output_section::Simple_input_section): New class definition.
13844         (Output_section::get_input_sections): Adjust parameter list.
13845         (Output_section::add_input_section_for_script): Same.
13846         (Output_section::save_states, Output_section::restore_states,
13847         Output_section::do_address_and_file_offset_have_reset_values,
13848         (Output_section::Input_section::Input_section): Handle
13849         RELAXED_INPUT_SECTION_CODE.  Add new overload for
13850         Output_relaxed_input_section.
13851         (Output_section::Input_section::is_input_section,
13852         Output_section::Input_section::set_output_section): Handle relaxed
13853         input section.
13854         (Output_section::Input_section::is_relaxed_input_section,
13855         Output_section::Input_section::output_section_data,
13856         Output_section::Input_section::relaxed_input_section): New method
13857         definitions.
13858         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
13859         value.
13860         (Output_section::Input_section::u1_): Update comments.
13861         (Output_section::Input_section::u2_): Add new union member poris.
13862         (Output_section::Checkpoint_output_section): New classs definition.
13863         (Output_section::relax_input_section): New method declaration.
13864         (Output_section::checkpoint_): New data member.
13865         (Output_segment): Update comments.
13866         (Output_segment::Output_segment): Un-privatize copy constructor.
13867         (Output_segment::operator=): Un-privatize.
13868         * script-sections.cc (Output_section_element::Input_section_list):
13869         Change element type to Output_section::Simple_input_section.
13870         (Output_section_element_dot_assignment::set_section_addresses):
13871         Register output section data for relaxation clean up.
13872         (Output_data_exression::Output_data_expression): Adjust call to base
13873         constructor to fix data size.
13874         (Output_section_element_data::set_section_addresses): Register
13875         Output_data_expression object for relaxation clean up.
13876         (struct Input_section_info): Replace Relobj pointer and section index
13877         pair with Output_section::Simple_input_section and Convert struct to a
13878         class.
13879         (Input_section_sorter::operator()): Adjust access to
13880         Input_section_info data member to use accessors.
13881         (Output_section_element_input::set_section_addresses): Use layout
13882         parameter.  Adjust code to use Output_section::Simple_input_section
13883         and Input_secction_info classes.  Register filler for relaxation
13884         clean up.
13885         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
13886         and section index pair with Output_section::Simple_input_section
13887         class.  Adjust code accordingly.
13888         (Phdrs_element::release_segment): New method definition.
13889         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
13890         segment list.
13891         (Script_sections::release_segments): New method definition.
13892         * gold/script-sections.h (Script_sections::release_segments): New
13893         method declaration.
13894         * gold/target.h (Target::may_relax, Target::relax,
13895         Target::do_may_relax, Target::do_relax): New method definitions.
13896
13897 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13898
13899         * arm.cc (has_signed_unsigned_overflow): New function.
13900         (Arm_relocate_functions::abs8): New function.
13901         (Target_arm::Scan::local): Handle R_ARM_ABS8.
13902         (Target_arm::Scan::global): Likewise.
13903         (Target_arm::relocate::relocate): Likewise.
13904         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
13905         Likewise.
13906
13907 2009-09-16  Cary Coutant  <ccoutant@google.com>
13908
13909         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
13910         * testsuite/Makefile.in: Regenerate.
13911
13912 2009-09-11  Nick Clifton  <nickc@redhat.com>
13913
13914         * po/gold.pot: Updated by the Translation project.
13915
13916 2009-09-08  Cary Coutant  <ccoutant@google.com>
13917
13918         * output.cc (Output_file::open): Add execute permission to empty file.
13919         * testsuite/Makefile.am (permission_test): New test.
13920         * testsuite/Makefile.in: Regenerate.
13921
13922 2009-09-02  Ian Lance Taylor  <iant@google.com>
13923
13924         * output.cc (Output_file::resize): Call map_no_anonymous rather
13925         than map.
13926
13927 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
13928
13929         * gold.cc: Include "incremental.h".
13930         (queue_initial_tasks): Call Incremental_checker methods.
13931         * incremental.cc: Include "output.h".
13932         (Incremental_checker::can_incrementally_link_output_file): New
13933         method.
13934         * incremental.h (Incremental_checker): New class.
13935
13936         * output.cc (Output_file::open_for_modification): New method.
13937         (Output_file::map_anonymous): Changed return type to bool.  Record
13938         map in base_ field.
13939         (Output_file::map_no_anonymous): New method, broken out of map.
13940         (Output_file::map): Use map_no_anonymous and map_anonymous.
13941         * output.h (class Output_file): Update declarations.
13942
13943 2009-08-24  Cary Coutant  <ccoutant@google.com>
13944
13945         * options.h (Command_line::Pre_options): New class.
13946         (Command_line::pre_options): New member.
13947         * options.cc (gold::options::ready_to_register): New variable.
13948         (One_option::register_option): Do nothing if not registering options.
13949         Assert if same short option registered twice.
13950         (General_options::General_options): Turn off option registration when
13951         done constructing.
13952         (Command_line::Pre_options::Pre_options): New constructor.
13953
13954 2009-08-24  Cary Coutant  <ccoutant@google.com>
13955
13956         * options.h (General_options::no_keep_memory): Remove incorrect
13957         short option.
13958
13959 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13960
13961         * Makefile.am (am__skiplex, am__skipyacc): New.
13962         * Makefile.in: Regenerate.
13963
13964 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13965
13966         * Makefile.am (AM_CPPFLAGS): Renamed from ...
13967         (INCLUDES): ... this.
13968         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
13969         (AM_CPPFLAGS): Renamed from ...
13970         (INCLUDE): ... this.
13971         * Makefile.in, testsuite/Makefile.in: Regenerate.
13972
13973         * Makefile.in: Regenerate.
13974         * aclocal.m4: Likewise.
13975         * config.in: Likewise.
13976         * configure: Likewise.
13977         * testsuite/Makefile.in: Likewise.
13978
13979         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13980         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13981         * Makefile.in: Regenerate.
13982         * testsuite/Makefile.in: Regenerate.
13983
13984 2009-08-19  Cary Coutant  <ccoutant@google.com>
13985
13986         * resolve.cc (Symbol_table::resolve): Don't complain about defined
13987         symbols in shared libraries overridden by hidden or internal symbols
13988         in the main program.
13989
13990 2009-08-19  Chris Demetriou  <cgd@google.com>
13991
13992         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
13993         checking source file names in error messages.
13994
13995 2009-08-18  Doug Kwan  <dougkwan@google.com>
13996
13997         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
13998         an elcpp::Ehdr as parameter.  Adjust call to set_target.
13999         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
14000         an elfcpp::Ehdr as parameter.
14001         * object.cc (Object::set_target): Remove the version that looks up
14002         a target and sets it.
14003         (Sized_relobj::setup): Take a Target object instead of
14004         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
14005         (make_elf_sized_object): Find target and ask target to
14006         make an ELF object.
14007         * object.h: (Object::set_target): Remove the version that looks up
14008         a target and sets it.
14009         (Sized_relobj::setup): Take a Target object instead of
14010         an elfcpp:Ehdr as parameter.
14011         * target.cc: Include dynobj.h.
14012         (Target::do_make_elf_object_implementation): New.
14013         (Target::do_make_elf_object): New.
14014         * target.h (Target::make_elf_object): New template declaration.
14015         (Target::do_make_elf_object): New method declarations.
14016         (Target::do_make_elf_object_implementation): New template declaration.
14017
14018 2009-08-14  Ian Lance Taylor  <iant@google.com>
14019
14020         * gold.h (FUNCTION_NAME): Define.
14021         (gold_unreachable): Use FUNCTION_NAME.
14022
14023 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
14024
14025         * icf.cc (Icf::find_identical_sections): Issue a warning when a
14026         symbol in the --keep-unique list is not found.
14027
14028 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
14029
14030         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
14031         been maked as --keep-unique.
14032         (Icf::unfold_section): New function.
14033         * icf.h (Icf::unfold_section): New function.
14034         * options.h (General_options::keep_unique): New option.
14035         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
14036         * testsuite/Makefile.in: Regenerate.
14037         * testsuite/icf_keep_unique_test.sh: New file.
14038         * testsuite/icf_keep_unique_test.cc: New file.
14039
14040 2009-08-12  Cary Coutant  <ccoutant@google.com>
14041
14042         PR 10471
14043         * resolve.cc (Symbol_table::resolve): Check for references from
14044         dynamic objects to hidden and internal symbols.
14045         * testsuite/Makefile.am (hidden_test.sh): New test.
14046         * testsuite/Makefile.in: Regenerate.
14047         * testsuite/hidden_test.sh: New script.
14048         * testsuite/hidden_test_1.c: New test source.
14049         * testsuite/hidden_test_main.c: New test source.
14050
14051 2009-08-11  Doug Kwan  <dougkwan@google.com>
14052
14053         * arm.cc: Update comments.
14054         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
14055         segment to locate the .ARM.exidx section if present.
14056
14057 2009-08-09  Doug Kwan  <dougkwan@google.com>
14058
14059         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
14060         patch.
14061
14062 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
14063         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
14064         compiler warnings.
14065
14066 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
14067
14068         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
14069         valid tls_segment only for non-debug-section relocations.
14070         * testsuite/Makefile.am: Add gc_tls_test.
14071         * testsuite/Makefile.in: Regenerate.
14072         * testsuite/gc_tls_test.cc: New file.
14073         * testsuite/gc_tls_test.sh: New file.
14074
14075 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
14076
14077         * icf.cc: New file.
14078         * icf.h: New file.
14079         * Makefile.am (CCFILES): Add icf.cc.
14080         (HFILES): Add icf.h
14081         * Makefile.in: Regenerate.
14082         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
14083         * gc.h (gc_process_relocs): Populate lists used by icf to contain
14084         section, symbol and addend information for the relocs.
14085         * gold.cc (queue_middle_tasks): Call identical code folding.
14086         * gold.h: Add defines for multimap.
14087         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
14088         to the call of finalize_local_symbols.
14089         * main.cc (main): Create object of class Icf.
14090         * object.cc (Sized_relobj::do_layout): Allow this function to be
14091         called twice during icf.
14092         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
14093         to sections marked as identical by icf.
14094         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
14095         when available.
14096         (Sized_relobj::do_section_entsize): New function.
14097         * object.h (Object::section_entsize): New function.
14098         (Object::do_section_entsize): New pure virtual function.
14099         (Relobj::finalize_local_symbols): Add new parameter.
14100         (Relobj::do_section_entsize): New function.
14101         * options.h (General_options::icf): New option.
14102         (General_options::icf_iterations): New option.
14103         (General_options::print_icf_sections): New option.
14104         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
14105         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
14106         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
14107         icf.
14108         * symtab.cc (Symbol_table::is_section_folded): New function.
14109         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
14110         to sections marked as identical by icf.
14111         * symtab.h (Symbol_table::set_icf): New function.
14112         (Symbol_table::icf): New function.
14113         (Symbol_table::is_section_folded): New function.
14114         (Symbol_table::icf_): New data member.
14115         * target-reloc.h (relocate_section): Ignore sections folded by icf.
14116         * testsuite/Makefile.am: Add commands to build icf_test.
14117         * testsuite/Makefile.in: Regenerate.
14118         * testsuite/icf_test.sh: New file.
14119         * testsuite/icf_test.cc: New file.
14120
14121 2009-07-24  Chris Demetriou  <cgd@google.com>
14122
14123         * layout.cc (is_compressible_debug_section): Fix incorrect
14124         comment about compressed section names.
14125
14126 2009-07-20  Ian Lance Taylor  <ian@airs.com>
14127
14128         PR 10419
14129         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
14130
14131 2009-07-16  Ian Lance Taylor  <iant@google.com>
14132
14133         PR 10400
14134         * layout.h: #include <map>.
14135         (class Kept_section): Change from struct to class.  Add accessors
14136         and setters.  Add section size to Comdat_group mapping.  Change
14137         Comdat_group to std::map.  Add is_comdat_ field.  Add
14138         linkonce_size field in union.
14139         (class Layout): Update declaration of find_or_add_kept_section.
14140         Don't declare find_kept_object.
14141         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
14142         parameter.  Add object, shndx, is_comdat, and is_group_name
14143         parameters.  Change all callers.  Adjust for new Kept_section.
14144         (Layout::find_kept_object): Remove.
14145         * object.cc (Sized_relobj::include_section_group): Update use of
14146         Kept_section.  Rename secnum to shndx.  Only record
14147         Kept_comdat_section if sections are the same size.
14148         (Sized_relobj::include_linkonce_section): Update use of
14149         Kept_section.  Only record Kept_comdat_section if sections are the
14150         same size.  Set size of linkonce section.
14151         (Sized_relobj::map_to_kept_section): Update call to
14152         get_kept_comdat_section.
14153         * object.h (class Sized_relobj): Rename fields in
14154         Kept_comdat_section to drop trailing underscores; change object
14155         field to Relobj*.  Change Kept_comdat_section_table to store
14156         struct rather than pointer.
14157         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
14158         Add kept_object and kept_shndx parameters.  Change all callers.
14159         (Sized_relobj::get_kept_comdat_section): Change return type to
14160         bool.  Add kept_object and kept_shndx parameters.  Change all
14161         callers.
14162         * plugin.cc (Pluginobj::include_comdat_group): Update call to
14163         Layout::find_or_add_kept_section.
14164
14165 2009-07-09  Ian Lance Taylor  <iant@google.com>
14166
14167         * merge.cc (Object_merge_map::initialize_input_to_output_map):
14168         Reserve space in the hash table.
14169
14170 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
14171
14172         * fileread.cc (File_read::get_mtime): New method.
14173         * fileread.h (Timespec): New structure.
14174         (File_read::get_mtime): New method.
14175         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
14176         Renamed from timestamp_nsec.
14177         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
14178         Elf_Xword.
14179         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
14180         timestamp_nsec.
14181         (Incremental_inputs::report_archive): Save mtime; style fix.
14182         (Incremental_inputs::report_obejct): Save mtime; style fix.
14183         (Incremental_inputs::report_script): Save mtime; style fix.
14184         (Incremental_inputs::finalize_inputs): Style fix.
14185         (Incremental_inputs::finalize): Style fix.
14186         (Incremental_inputs::create_input_section_data): Store inputs
14187         mtime.
14188         * incremental.h (Incremental_inputs::report_script): Add mtime
14189         argument.
14190         (Incremental_inputs::Input_info::Input_info): Intialize only one
14191         union member.
14192         (Incremental_inputs::Input_info::archive): Move to nameless
14193         union.
14194         (Incremental_inputs::Input_info::obejct): Move to nameless union.
14195         (Incremental_inputs::Input_info::script): Move to nameless union.
14196         (Incremental_inputs::mtime): New field.
14197         * script.cc (read_input_script): Pass file mtime to
14198         Incremental_input.
14199         * script.h (Script_info::inputs): Style fix.
14200
14201 2009-07-01  Ian Lance Taylor  <ian@airs.com>
14202
14203         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
14204         instead of 32.
14205
14206 2009-06-24  Ian Lance Taylor  <iant@google.com>
14207
14208         PR 10156
14209         * layout.cc (Layout::choose_output_section): If we find an
14210         existing section, update the flags.
14211         (Layout::create_notes): New function, broken out of
14212         Layout::finalize.
14213         (Layout::finalize): Don't create note sections.
14214         (Layout::create_note): Don't crash if linker script discards
14215         section.
14216         (Layout::create_gold_note): Likewise.
14217         (Layout::create_build_id): Likewise.  Don't set
14218         after_input_sections on the section.
14219         (Layout::create_executable_stack_info): Remove target parameter.
14220         Change caller.
14221         * layout.h (class Layout): Declare create_notes.  Update
14222         declaration of create_executable_stack_info.
14223         * gold.cc (queue_middle_tasks): Call create_notes.
14224         * output.cc (Output_section::update_flags_for_input_section): Move
14225         here from output.h.  If SHF_ALLOC flag is newly set, mark address
14226         invalid.
14227         * output.h (Output_data::mark_address_invalid): New function.
14228         (class Output_section): Only declare, not define,
14229         update_flags_for_input_section.  Remove set_flags.
14230
14231 2009-06-24  Ian Lance Taylor  <iant@google.com>
14232
14233         * script-sections.cc (Output_section_definition::
14234         set_section_addresses): Rename shadowing local load_address to
14235         laddr.
14236
14237 2009-06-24  Ian Lance Taylor  <iant@google.com>
14238
14239         PR 10244
14240         * reloc.cc (relocate_sections): Skip empty relocation sections.
14241
14242 2009-06-23  Ian Lance Taylor  <iant@google.com>
14243
14244         PR 10156
14245         * layout.cc (Layout::create_note): Use choose_output_section
14246         rather than make_output_section.
14247
14248 2009-06-23  Ian Lance Taylor  <iant@google.com>
14249
14250         PR 10237
14251         * options.cc (General_options::parse_V): Set printed_version_.
14252         (General_options::General_options): Initialize printed_version_.
14253         * options.h (class General_options): Add printed_version_ field.
14254         * gold.cc (queue_initial_tasks): If there are no input files,
14255         don't give a fatal error if we printed the version information.
14256         (queue_middle_tasks): If using -r with a shared object, give a
14257         fatal error rather than an ordinary error.
14258
14259 2009-06-23  Ian Lance Taylor  <iant@google.com>
14260
14261         PR 10219
14262         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
14263         (Layout::make_output_section): Set have_stabstr_section_ if we see
14264         a .stab*str section.
14265         (Layout::finalize): Call link_stabs_sections.
14266         (Layout::link_stabs_sections): New file.
14267         * layout.h (class Layout): Add have_stabstr_section_ field.
14268         Declare link_stabs_sections.
14269
14270 2009-06-23  Doug Kwan  <dougkwan@google.com>
14271
14272         * Makefile.am (libgold_a_LIBADD): New.
14273         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
14274         * Makefile.in: Regenerate.
14275         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
14276         * configure: Regenerate.
14277         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
14278         * fileread.cc: Include sys/state.h
14279         * gold.h: Declare memmem and strndup if found missing.
14280         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
14281
14282 2009-06-23  Ian Lance Taylor  <iant@google.com>
14283
14284         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
14285         * configure: Rebuild.
14286
14287 2009-06-23  Ian Lance Taylor  <iant@google.com>
14288
14289         PR 10147
14290         * object.cc (Object::section_contents): Don't try to get a view if
14291         the section has length zero.
14292         (Object::handle_gnu_warning_section): If the section is empty, use
14293         the name of the section as the warning.
14294
14295 2009-06-23  Ian Lance Taylor  <iant@google.com>
14296
14297         PR 10133
14298         * stringpool.h (class Stringpool_template): Add optimize_ field.
14299         (Stringpool_template::set_optimize): New function.
14300         * stringpool.cc (Stringpool_template::Stringpool_template):
14301         Initialize optimize_ field.
14302         (Stringpool_template::set_string_offsets): Test local optimize
14303         fild rather than parameter.
14304         * layout.cc (Layout::Layout): Call set_optimize on the section
14305         name stringpool.
14306
14307 2009-06-22  Ian Lance Taylor  <iant@google.com>
14308
14309         PR 10030
14310         * yyscript.y: Parse TARGET.
14311         * script.cc (script_set_target): New function.
14312         * script-c.h (script_set_target): Declare.
14313         * options.cc (General_options::string_to_object_format): Rename
14314         from string_to_object_format in anonymous namespace.  Change
14315         callers.
14316         * options.h (class General_options): Declare
14317         string_to_object_format.
14318
14319 2009-06-22  Ian Lance Taylor  <iant@google.com>
14320
14321         * script-sections.cc (Script_sections::create_segments): Don't put
14322         program headers in a PT_LOAD segment if -n or -N.
14323
14324 2009-06-22  Ian Lance Taylor  <iant@google.com>
14325
14326         PR 10141
14327         * options.h (class General_options): Add -z lazy and -z now.  Sort
14328         -z options into alphabetical order.
14329         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
14330
14331 2009-06-21  Ian Lance Taylor  <iant@google.com>
14332
14333         * layout.cc (Layout::make_output_section): Call
14334         Target::new_output_section.
14335         (Layout::attach_allocated_section_to_segment): Put large section
14336         sections in a separate load segment with the large segment flag
14337         set.
14338         (Layout::segment_precedes): Sort large data segments after other
14339         load segments.
14340         (align_file_offset): New static function.
14341         (Layout::set_segment_offsets): Use align_file_offset.
14342         * output.h (class Output_section): Add is_small_section_ and
14343         is_large_section_ fields.
14344         (Output_section::is_small_section): New function.
14345         (Output_section::set_is_small_section):  New function.
14346         (Output_section::is_large_section): New function.
14347         (Output_section::set_is_large_section): New function.
14348         (Output_section::is_large_data_section): New function.
14349         (class Output_segment): Add is_large_data_segment_ field.
14350         (Output_segment::is_large_data_segment): New function.
14351         (Output_segment::set_is_large_data_segment): New function.
14352         * output.cc (Output_section::Output_section): Initialize new
14353         fields.
14354         (Output_segment::Output_segment): Likewise.
14355         (Output_segment::add_output_section): Add assertion that large
14356         data sections always go in large data segments.  Force small data
14357         sections to the end of the list of data sections.  Force small BSS
14358         sections to the start of the list of BSS sections.  For large BSS
14359         sections to the end of the list of BSS sections.
14360         * symtab.h (class Symbol): Declare is_common_shndx.
14361         (Symbol::is_defined): Check Symbol::is_common_shndx.
14362         (Symbol::is_common): Likewise.
14363         (class Symbol_table): Define enum Commons_section_type.  Update
14364         declarations.  Add small_commons_ and large_commons_ fields.
14365         * symtab.cc (Symbol::is_common_shndx): New function.
14366         (Symbol_table::Symbol_table): Initialize new fields.
14367         (Symbol_table::add_from_object): Put small and large common
14368         symbols in the right list.
14369         (Symbol_table::sized_finalized_symbol): Check
14370         Symbol::is_common_shndx.
14371         (Symbol_table::sized_write_globals): Likewise.
14372         * common.cc (Symbol_table::do_allocate_commons): Allocate new
14373         common symbol lists.  Don't call do_allocate_commons_list if the
14374         list is empty.
14375         (Symbol_table::do_allocate_commons_list): Remove is_tls
14376         parameter.  Add comons_section_type parameter.  Change all
14377         callers.  Handle small and large common symbols.
14378         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
14379         Symbol::is_common_shndx.
14380         * resolve.cc (symbol_to_bits): Likewise.
14381         * target.h (Target::small_common_shndx): New function.
14382         (Target::small_common_section_flags): New function.
14383         (Target::large_common_shndx): New function.
14384         (Target::large_common_section_flags): New function.
14385         (Target::new_output_section): New function.
14386         (Target::Target_info): Add small_common_shndx, large_common_shndx,
14387         small_common_section_flags, and large_common_section_flags
14388         fields.
14389         (Target::do_new_output_section): New virtual function.
14390         * arm.cc (Target_arm::arm_info): Initialize new fields.
14391         * i386.cc (Target_i386::i386_info): Likewise.
14392         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
14393         Likewise.
14394         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
14395         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14396         (Target_x86_64::do_new_output_section): New function.
14397         * configure.ac: Define conditional MCMODEL_MEDIUM.
14398         * testsuite/Makefile.am (check_PROGRAMS): Add large.
14399         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
14400         (large_LDFLAGS): Define.
14401         * testsuite/large.c: New file.
14402         * testsuite/testfile.cc (Target_test::test_target_info):
14403         Initialize new fields.
14404         * configure, testsuite/Makefile.in: Rebuild.
14405
14406 2009-06-05  Doug Kwan  <dougkwan@google.com>
14407
14408         * Makefile.am (CCFILES): Add target.cc.
14409         * Makefile.in: Regenerate.
14410         * i386.cc (class Target_i386): Define new virtual method to
14411         override do_is_local_label_name in parent.
14412         * object.cc (Sized_relobj::do_count_local_symbols): Discard
14413         local symbols if --discard-locals or -X is given.
14414         * options.h (class General_options): Declare new options
14415         '--discard-locals' and '-X' for discarding locals.
14416         * target.h (class Target): Define new methods is_local_label_name.
14417         Declare new virtual method do_is_local_label_name.
14418         * target.cc: New file.
14419         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
14420         (check_SCRIPTS): Add discard_locals_test.sh.
14421         (check_DATA): Add discard_local_tests.syms.
14422         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
14423         (discard_local_tests.syms, discard_locals_test.o): New make rules.
14424         * testsuite/Makefile.in: Regenerate.
14425         * testsuite/discard_locals_test.c: New file.
14426         * testsuite/discard_locals_test.sh: Same.
14427
14428 2009-06-05  Doug Kwan  <dougkwan@google.com>
14429
14430         * object.cc (Sized_relobj::Sized_relobj): Initialize
14431         discarded_eh_frame_shndx_ to -1U.
14432         (Sized_relobj::do_layout): Record index of a discard .eh_frame
14433         section.
14434         (Sized_relobj::do_count_local_symbols): Skip local symbols in
14435         a discarded .eh_frame section.
14436         (Sized_relobj::do_finalize_local_symbols): Ditto.
14437         * object.h (class Sized_relobj): Declare new member
14438         discarded_eh_frame_shndx_.
14439         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
14440         (local_labels_test.o, local_labels_test): New rules.
14441         * testsuite/Makefile.in: Regenerate.
14442
14443 2009-06-04  Doug Kwan  <dougkwan@google.com>
14444
14445         * layout.cc (Layout::section_name_mapping): Add mapping for
14446         special ARM sections.
14447
14448 2009-06-03  Doug Kwan  <dougkwan@google.com>
14449
14450         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
14451         (utils::has_overflow): Same.
14452
14453 2009-06-03  Ian Lance Taylor  <iant@google.com>
14454
14455         * layout.cc (Layout::section_name_mapping): New array, replacing
14456         Layout::linkonce_mapping.
14457         (Layout::section_name_mapping_count): New variable, replacing
14458         Layout::linkonce_mapping_count.
14459         (Layout::linkonce_output_name): Remove.
14460         (Layout::output_section_name): Rewrite.
14461         * layout.h (class Layout): Rename Linkonce_mapping to
14462         Section_name_mapping, linkonce_mapping to section_name_mapping,
14463         linkonce_mapping_count to section_name_mapping_count.  Don't
14464         declare linkonce_output_name.
14465
14466 2009-06-03  Doug Kwan  <dougkwan@google.com>
14467
14468         * gold/arm.cc (namespace utils): New.
14469         (Target_arm::reloc_is_non_pic): Define new method.
14470         (class Arm_relocate_functions): New.
14471         (Target_arm::Relocate::relocate): Handle relocation types used by
14472         Android.
14473
14474 2009-06-03  Ian Lance Taylor  <iant@google.com>
14475
14476         * arm.cc (Target_arm::scan::global): Use || instead of |.
14477
14478 2009-06-02  Doug Kwan  <dougkwan@google.com>
14479
14480         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
14481         issued_non_pic_error_.
14482         (class Target_arm::Scan): Declare new method check_non_pic.
14483         Define new method symbol_needs_plt_entry.
14484         Declare new data member issued_non_pic_error_.
14485         (class Target_arm::Relocate): Declare new method
14486         should_apply_static_reloc.
14487         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
14488         (Target_arm::Scan::check_non_pic): Define new method.
14489         (Target_arm::Scan::local): Handle a small subset of reloc types used
14490         by Android.
14491         (Target_arm::Scan::local): Same.
14492         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
14493
14494 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
14495
14496         * incremental.cc (Incremental_inputs::report_command_line): Filter
14497         out --incremental-* options.
14498
14499 2009-05-29  Doug Kwan  <dougkwan@google.com>
14500
14501         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
14502         template class.
14503         (class Target_arm): Update comment.
14504         (Target_arm::Target_arm): Initialize new data members GOT_,
14505         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
14506         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
14507         and Target_arm::rel_dyn_section.
14508         Declare new_enum Target_arm::Got_type.
14509         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
14510         and DYNBSS_.
14511         Update commments for member do_dynsym_value.
14512         (Target_arm::got_size, Target_arm::plt_section,
14513         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
14514         new methods inside class defintion.
14515         (Target_arm::got_section): Define new method.
14516         (Target_arm::rel_dyn_section): Same.
14517         (Output_data_plt_arm): New template class.
14518         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
14519         (Output_data_plt_arm:do_adjust_output_section): Define new method.
14520         (Output_data_plt_arm::add_entry): Same.
14521         (Output_data_plt_arm::first_plt_entry): Define new
14522         static data member for PLT instruction template.
14523         (Output_data_plt_arm::plt_entry): Same.
14524         (Output_data_plt_arm::do_write): Define new method.
14525         (Target_arm::make_plt_entry): Same.
14526         (Target_arm::do_finalize_sections): Same.
14527         (Target_arm::do_dynsym_value): Same.
14528
14529 2009-05-28  Doug Kwan  <dougkwan@google.com>
14530
14531         * Makefile.am (TARGETSOURCES): Add arm.cc.
14532         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
14533         * Makefile.in: Regenerate.
14534         * arm.cc: New file.
14535         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
14536
14537 2009-05-26  Doug Kwan  <dougkwan@google.com>
14538
14539         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
14540         (General_options::check_excluded_libs): Strip off directories in
14541         archive name before matching like GNU ld does.
14542         * testsuite/Makefile.am (MOSTLYCLEANFILES,
14543         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
14544         (exclude_libs_test_LDFLAGS): Add linker option
14545         -Wl,--exclude-libs,libexclude_libs_test_3
14546         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
14547         an explicit archive without using -l.
14548         (alt/libexclude_libs_test_3.a): New make rule.
14549         * testsuite/Makefile.in: Regenerate.
14550         * testsuite/exclude_libs_test.c : Declare lib3_default().
14551         (main): Call it.
14552         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
14553         * exclude_libs_test_3.c: New file.
14554
14555 2009-05-26  Nick Clifton  <nickc@redhat.com>
14556
14557         * po/id.po: New Indonesian translation.
14558         * po/gold.pot: Updated template file.
14559
14560 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
14561
14562         * testsuite/Makefile.am: Add -ffunction-sections to compile
14563         gc_comdat_test files.  Add -Wl,--gc-sections to build
14564         gc_comdat_test.
14565         * testsuite/Makefile.in: Regenerate.
14566         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
14567
14568 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
14569
14570         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
14571         kept comdat section was garbage collected.
14572         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
14573         * testsuite/Makefile.in: Regenerate.
14574         * testsuite/gc_comdat_test.sh: New file.
14575         * testsuite/gc_comdat_test_1.cc: New file.
14576         * testsuite/gc_comdat_test_2.cc: New file.
14577
14578 2009-05-19  Doug Kwan  <dougkwan@google.com>
14579
14580         * archive.cc (Archive::Archive): Move constructor from archive.h
14581         to here.  Initialize no_export_.
14582         (Archive::get_elf_object_for_member): Set no_export flag of object.
14583         * archive.h (Archive::Archive): Move constructor body to
14584         archive.cc.
14585         (Archive::no_export): New method.
14586         (Archive::no_export_): New field.
14587         * object.h (Object::Object): Initialize no_export_ to false.
14588         (Object::no_export, Object::set_no_export): New methods.
14589         (Object::no_export_): New field.
14590         * options.cc (General_options::parse_exclude_libs): New method.
14591         (General_options::check_excluded_libs) Same.
14592         * options.h (exclude_libs): New option.
14593         (General_options::check_excluded_libs): New method declaration.
14594         (General_options::excluded_libs_): New field.
14595         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
14596         default or protected visibility if an object has no-export flag set.
14597         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
14598         (check_SCRIPTS): Add exclude_libs_test.sh.
14599         (check_DATA): Add exclude_libs_test.syms.
14600         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
14601         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
14602         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
14603         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
14604         (exclude_libs_test.syms, libexclude_libs_test_1.a,
14605         libexclude_libs_test_2.a): New rules.
14606         * testsuite/Makefile.in: Regenerate.
14607         * testsuite/exclude_libs_test.c: New file.
14608         * testsuite/exclude_libs_test.sh: Ditto.
14609         * testsuite/exclude_libs_test_1.c: Ditto.
14610         * testsuite/exclude_libs_test_2.c: Ditto.
14611
14612 2009-05-15  Ian Lance Taylor  <iant@google.com>
14613
14614         * configure.ac: Check for declarations for cases where libiberty.h
14615         checks HAVE_DECL_xxx.
14616         * configure, config.in: Rebuild.
14617
14618 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
14619
14620         * gold.h (Incremental_argument_list): Remove (invalid) forward
14621         declaration.
14622         * incremental.cc (Incremental_inputs::report_achive): New method.
14623         (Incremental_inputs::report_object): New method.
14624         (Incremental_inputs::report_script): New method.
14625         (Incremental_inputs::finalize_inputs): New method.
14626         (Incremental_inputs::finalize): Call finalize_inputs().
14627         (Incremental_inputs::sized_create_incremental_inputs_section_data):
14628         Create inputs entries.
14629         * incremental.h (Incremental_input_type): New enum.
14630         (Incremental_inputs::Incremental_input): Initialize new fields.
14631         (Incremental_inputs::report_inputs): New method.
14632         (Incremental_inputs::report_achive): New method.
14633         (Incremental_inputs::report_object): New method.
14634         (Incremental_inputs::report_script): New method.
14635         (Incremental_inputs::finalize_inputs): New method.
14636         (Incremental_inputs::Input_info): New struct.
14637         (Incremental_inputs::Input_info_map): New typedef.
14638         (Incremental_inputs::lock_): New field.
14639         (Incremental_inputs::Inputs_): New field.
14640         (Incremental_inputs::Inputs_map): New field.
14641         * main.cc (main): Call Incremental_input::report_inputs.
14642         * options.h (Input_argument_list): Typedef moved from
14643         Input_arguments.
14644         (Input_file_group::Files): Remove, use ::Input_argument_list.
14645         (Input_file_group::Input_argument_list): Remove, use
14646         ::Input_argument_list.
14647         * plugin.cc (Plugin_manager::add_input_file): Add error in
14648         incremental build.
14649         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
14650         functions.
14651         * script.cc (read_input_script): Call
14652         Incremental_input::report_script.
14653         * script.h (Script_info): New class.
14654
14655 2009-04-27  Ian Lance Taylor  <iant@google.com>
14656
14657         * x86_64.cc (do_adjust_output_section): Set entsize to
14658         plt_entry_size.
14659
14660 2009-04-23  Elliott Hughes  <enh@google.com>
14661
14662         * output.cc (Output_file::close): After short writes, continue
14663         writing from the correct offset in the buffer being written.
14664
14665 2009-04-23  Chris Demetriou  <cgd@google.com>
14666
14667         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
14668         * configure: Regenerate.
14669         * config.in: Regenerate.
14670         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
14671         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
14672
14673 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
14674
14675         * incremental.cc (Incremental_inputs_header_data): Renamed from
14676         Incremental_input_header_data.
14677         (Incremental_inputs_header_data::data_size): New field.
14678         (Incremental_inputs_header_data::put_input_file_count): Renamed
14679         from input_file_count.
14680         (Incremental_inputs_header_data::put_command_line_offset): Renamed
14681         from command_line_offset.
14682         (Incremental_inputs_header_data::put_reserved): Renamed from
14683         put_reserved.
14684         (Incremental_inputs_entry_data): Renamed from
14685         Incremental_input_entry_data.
14686         (Incremental_inputs_entry_data::data_size): New field.
14687         (Incremental_inputs::report_command_line): New method.
14688         (Incremental_inputs::finalize): New method.
14689         (Incremental_inputs::create_incremental_inputs_data): New method.
14690         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
14691         * incremental.h: New file.
14692         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
14693         (Layout::finalize): Create incremental inputs section in
14694         incremental builds.
14695         (Layout::create_incremental_info_sections): New method.
14696         * layout.h (Layout::incremental_inputs): New method.
14697         (Layout::create_incremental_info_sections): New method.
14698         (Layout::incremental_inputs_): New field.
14699         * main.cc (main): Notify Incremental_input of the command line.
14700
14701 2009-04-01  Ian Lance Taylor  <iant@google.com>
14702             Mikolaj Zalewski  <mikolajz@google.com>
14703
14704         * gold.h (reserve_unordered_map): Define, three versions, one for
14705         each version of Unordered_map.
14706         * layout.cc (Layout::Layout): Remove options parameter.  Add
14707         number_of_input_files parameter.  Don't initialize options_.
14708         Initialize number_of_input_files_ and resized_signatures_.  Move
14709         sections_are_attached_.
14710         (Layout::layout_group): Reserve space for group_signatures_.
14711         (Layout::find_or_add_kept_section): Change name parameter to be a
14712         reference.  Resize signatures_ map when it gets large enough.
14713         (Layout::layout_eh_frame): Use parameters->options() instead of
14714         this->options_.
14715         (Layout::make_output_section): Likewise.
14716         (Layout::attach_allocated_section_to_segment): Likewise.
14717         (Layout::finalize, Layout::create_executable_stack): Likewise.
14718         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
14719         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
14720         * layout.h (class Layout): Update declarations.  Remove options_
14721         field.  Add number_of_input_files_ and resized_signatures_
14722         fields.  Move sections_are_attached_ field.
14723         * main.cc (main): Pass number of input files to Layout
14724         constructor.  Don't pass options.
14725
14726 2009-03-30  Ian Lance Taylor  <iant@google.com>
14727
14728         * ffsll.c (ffsll): Correct implementation.
14729
14730 2009-03-27  Ian Lance Taylor  <iant@google.com>
14731
14732         * ffsll.c: New file.
14733         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
14734         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
14735         * ftruncate.c (ftruncate): Declare before definition.
14736         * mremap.c (mremap): Likewise.
14737         * pread.c (pread): Likewise.
14738         * configure, Makefile.in, config.in: Rebuild.
14739
14740         * mremap.c: New file.
14741         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
14742         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
14743         (mremap): Declare if HAVE_MREMAP is not defined.
14744         * configure, Makefile.in, config.in: Rebuild.
14745
14746 2009-03-27  Cary Coutant  <ccoutant@google.com>
14747
14748         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
14749         position independent.
14750         * sparc.cc (Target_sparc::check_non_pic): Likewise.
14751         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
14752
14753 2009-03-24  Cary Coutant  <ccoutant@google.com>
14754
14755         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
14756         an executable.
14757         (needs_dynamic_reloc): Likewise.
14758
14759 2009-03-24  Ian Lance Taylor  <iant@google.com>
14760
14761         * yyscript.y (file_cmd): Recognize EXTERN.
14762         (extern_name_list, extern_name_list_body): New nonterminals.
14763         * script.cc (script_add_extern): Define.
14764         * script-c.h (script_add_extern): Declare.
14765
14766 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
14767
14768         * object.cc (is_elf_object): Define.
14769         * object.h (is_elf_object): Declare.
14770         * archive.cc (Archive::get_elf_object_for_member): Call
14771         is_elf_object.
14772         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
14773
14774 2009-03-24  Elliott Hughes  <enh@google.com>
14775
14776         * output.cc (Output_file::map_anonymous): Define.
14777         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
14778         try an anonymous one.  Report the size if the mmap fails.
14779         * output.h (class Output_file): Declare map_anonymous.
14780
14781 2009-03-24  Ian Lance Taylor  <iant@google.com>
14782
14783         * target-select.cc (instantiate_target): Don't acquire the lock if
14784         the instantiated_target_ field has already been set.
14785
14786 2009-03-23  Ian Lance Taylor  <iant@google.com>
14787
14788         * gold-threads.h (class Initialize_lock): Define.
14789         * gold-threads.cc (class Initialize_lock_once): Define.
14790         (initialize_lock_control): New static variable.
14791         (initialize_lock_pointer): New static variable.
14792         (initialize_lock_once): New static function.
14793         (Initialize_lock::Initialize_lock): Define.
14794         (Initialize_lock::initialize): Define.
14795         * target-select.h: Include "gold-threads.h".
14796         (class Target_selector): Add lock_ and initialize_lock_ fields.
14797         Don't define instantiate_target, just declare it.
14798         * target-select.cc (Target_selector::Target_selector): Initialize
14799         new fields.
14800         (Target_selector::instantiate_target): Define.
14801         * descriptors.h: Include "gold-threads.h".
14802         (class Descriptors): Add initialize_lock_ field.
14803         * descriptors.cc (Descriptors::Descriptors): Initialize new
14804         field.
14805         (Descriptors::open): Use initialize_lock_ field
14806         * errors.h (class Errors): Add initialize_lock_ field.
14807         * errors.cc (Errors::Errors): Initialize new field.
14808         (Errors::initialize_lock): Use initialize_lock_ field.
14809         * powerpc.cc (class Target_selector_powerpc): Remove
14810         instantiated_target_ field.  In do_recognize call
14811         instantiate_target rather than do_instantiate_target.  In
14812         do_instantiate_target just allocate a new target.
14813         * sparc.cc (class Target_selector_sparc): Likewise.
14814
14815         * freebsd.h: New file.
14816         * i386.cc: Include "freebsd.h".
14817         (Target_i386): Derive from Target_freebsd rather than
14818         Sized_target.
14819         (Target_selector_i386): Derive from Target_selector_freebsd rather
14820         than Target_selector.
14821         * x86_64.cc: Include "freebsd.h".
14822         (Target_x86_64): Derive from Target_freebsd rather than
14823         Sized_target.
14824         (Target_selector_x86_64): Derive from Target_selector_freebsd
14825         rather than Target_selector.
14826         * target.h (class Target): Add adjust_elf_header and
14827         do_adjust_elf_header.
14828         * output.cc (Output_file_header:: do_sized_write): Call target
14829         adjust_elf_header routine.
14830         * configure.tgt: Set targ_osabi.
14831         * configure.ac: Define GOLD_DEFAULT_OSABI.
14832         * parameters.cc (Parameters::default_target): Pass
14833         GOLD_DEFAULT_OSABI to select_target.
14834         * target-select.h (class Target_selector): Make instantiate_target
14835         protected rather than private.
14836         * Makefile.am (HFILES): Add freebsd.h.
14837         * configure, Makefile.in, config.in: Rebuild.
14838
14839         * merge.cc (do_add_input_section): Correct pend value.  Change
14840         message about last entry not being null terminated from error to
14841         warning.
14842
14843 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
14844
14845         * incremental.cc: New file.
14846         * Makefile.am (CCFILES): Add incremental.cc.
14847         * Makefile.in: Rebuild.
14848
14849 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
14850
14851         * layout.cc (Layout::output_section_name): Preserve names
14852         of '.note.' sections.
14853
14854 2009-03-19  Ian Lance Taylor  <iant@google.com>
14855
14856         * descriptors.cc (Descriptors::open): Check that the options are
14857         valid before using them.
14858
14859 2009-03-18  Ian Lance Taylor  <iant@google.com>
14860
14861         * script-sections.h: Include <list>.
14862         (class Script_sections): Change Sections_elements from std::vector
14863         to std::list.  Typedef public Elements_iterator.  Add
14864         orphan_section_placement_, data_segment_align_start_, and
14865         saw_data_segment_align_ fields.  Remove data_segment_align_index_
14866         field.
14867         * script-sections.cc (class Orphan_section_placement): New class.
14868         (class Sections_element): Add virtual functions is_relro and
14869         orphan_section_init.  Remove virtual function place_orphan_here.
14870         (class Output_section_definition): Add is_relro and
14871         orphan_section_init.  Remove place_orphan_here.
14872         (class Orphan_output_section): Likewise.
14873         (Script_sections::Script_sections): Update for field changes.
14874         (Script_sections::data_segment_align): Set saw_data_segment_align_
14875         and data_segment_align_start_, not data_segment_align_index.
14876         (Script_sections::data_segment_relro_end): Check
14877         saw_data_segment_align_.  Use data_segment_align_start_ rather
14878         than data_segment_align_index_.
14879         (Script_sections::place_orphan): Rewrite to use
14880         Orphan_section_placement.
14881
14882 2009-03-17  Ian Lance Taylor  <iant@google.com>
14883
14884         * archive.cc (Archive::add_symbols): Check for a version attached
14885         to the symbol name in the archive map.
14886         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
14887         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
14888         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
14889         (ver_test_11.a): New target.
14890         * testsuite/Makefile.in: Rebuild.
14891
14892         * configure.ac: Check for chsize and posix_fallocate.  Replace
14893         ftruncate.
14894         * ftruncate.c: New file, from gnulib.
14895         * output.cc (posix_fallocate): Define dummy version if not
14896         HAVE_POSIX_FALLOCATE.
14897         (Output_file::map): Call posix_fallocate rather than lseek and
14898         write.
14899         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
14900         * configure, Makefile.in, config.in: Rebuild.
14901
14902 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
14903
14904         * layout.h (Layout::create_note): Add section_name parameter.
14905         * layout.cc (Layout::create_note): Likewise.
14906         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
14907
14908 2009-03-17  Ian Lance Taylor  <iant@google.com>
14909
14910         * descriptors.cc: Include "options.h".
14911         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
14912         (Descriptors::open): Always use O_CLOEXEC when opening a new
14913         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
14914         then set FD_CLOEXEC.
14915
14916         * sparc.cc (class Target_sparc): Add has_got_section.
14917         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
14918         make sure we have a GOT section.
14919
14920         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
14921         (Target_sparc::Scan::local): Likewise.
14922         (Target_sparc::Scan::global): Likewise.
14923         (Target_sparc::Relocate::relocate): Likewise.
14924         (Target_sparc::Relocate::relocate_tls): Likewise.
14925
14926         * symtab.cc (Symbol_table::define_default_version): New function,
14927         broken out of add_from_object.
14928         (Symbol_table::add_from_object): Call define_default_version.
14929         (Symbol_table::define_special_symbol): Add resolve_oldsym
14930         parameter.  Change all callers.  If the version for a symbol comes
14931         from a version script, resolve it with the symbol with the same
14932         name with no version.  Also add the symbol without a version if
14933         appropriate.
14934         (do_define_in_output_data): If resolving with oldsym, don't delete
14935         sym.
14936         (do_define_in_output_segment): Likewise.
14937         (do_define_as_constant): Likewise.
14938         * symtab.h (class Symbol_table): Update declarations.
14939
14940 2009-03-13  Ian Lance Taylor  <iant@google.com>
14941
14942         * readsyms.cc (Read_symbols::incompatible_warning): New function.
14943         (Read_symbols::requeue): New function.
14944         (Read_symbols::do_read_symbols): If make_elf_object fails because
14945         the target type is not configured, and the file was searched for,
14946         issue a warning and retry with the next directory.
14947         (Add_symbols::run): If the file has an incompatible format, and
14948         it was searched for, requeue the Read_symbols task.  On error,
14949         release the object.
14950         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
14951         dirindex parameter to constructor.  Change all callers.  Declare
14952         incompatible_warning and requeue.
14953         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
14954         input_argument_ and input_group_ fields.  Add them to
14955         constructor.  Change all callers.
14956         (class Read_script): Add dirindex_ field.  Add it to constructor.
14957         Change all callers.
14958         * archive.cc (Archive::setup): Remove input_objects parameter.
14959         Change all callers.
14960         (Archive::get_file_and_offset): Likewise.
14961         (Archive::read_all_symbols): Likewise.
14962         (Archive::read_symbols): Likewise.
14963         (Archive::get_elf_object_for_member): Remove input_objects
14964         parameter.  Add punconfigured parameter.  Change all callers.
14965         (Archive::add_symbols): Change return type to bool.  Check return
14966         value of include_member.
14967         (Archive::include_all_members): Likewise.
14968         (Archive::include_member): Change return type to bool.  Return
14969         false if first included object has incompatible target.  Set
14970         included_member_ field.
14971         (Add_archive_symbols::run): If add_symbols returns false, requeue
14972         Read_symbols task.
14973         * archive.h (class Archive): Add included_member_ field.
14974         Initialize it in constructor.  Add input_file and searched_for
14975         methods.  Update declarations.
14976         (class Add_archive_symbols): Add dirpath_, dirindex_, and
14977         input_argument_ fields.  Add them to constructor.  Change all
14978         callers.
14979         * script.cc: Include "target-select.h".
14980         (class Parser_closure): Add skip_on_incompatible_target_ and
14981         found_incompatible_target_ fields.  Add
14982         skip_on_incompatible_target parameter to constructor.  Change all
14983         callers.  Add methods skip_on_incompatible_target,
14984         clear_skip_on_incompatible_target, found_incompatible_target, and
14985         set_found_incompatible_target.
14986         (read_input_script): Add dirindex parameter.  Change all callers.
14987         If parser finds an incompatible target, requeue Read_symbols
14988         task.
14989         (script_set_symbol): Clear skip_on_incompatible_target in
14990         closure.
14991         (script_add_assertion, script_parse_option): Likewise.
14992         (script_start_sections, script_add_phdr): Likewise.
14993         (script_check_output_format): New function.
14994         * script.h (read_input_script): Update declaration.
14995         * script-c.h (script_check_output_format): Declare.
14996         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
14997         (ignore_cmd): Remove OUTPUT_FORMAT.
14998         * fileread.cc (Input_file::Input_file): Add explicit this.
14999         (Input_file::will_search_for): New function.
15000         (Input_file::open): Add pindex parameter.  Change all callers.
15001         * fileread.h (class Input_file): Add input_file_argument method.
15002         Declare will_search_for.  Update declarations.
15003         * object.cc (make_elf_object): Add punconfigured parameter.
15004         Change all callers.
15005         * object.h (class Object): Make input_file public.  Add
15006         searched_for method.
15007         (make_elf_object): Update declaration.
15008         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
15009         restart search.
15010         * dirsearch.h (class Dirsearch): Update declaration.
15011         * options.h (class General_options): Add --warn-search-mismatch.
15012         * parameters.cc (Parameters::is_compatible_target): New function.
15013         * parameters.h (class Parameters): Declare is_compatible_target.
15014         * workqueue.cc (Workqueue::add_blocker): New function.
15015         * workqueue.h (class Workqueue): Declare add_blocker.
15016
15017         * fileread.cc (Input_file::open): Remove options parameter.
15018         Change all callers.
15019         (Input_file::open_binary): Likewise.
15020         * script.cc (read_input_script): Likewise.
15021         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
15022         options parameter from constructor.  Change all callers.
15023         (class Read_script): Likewise.
15024         * fileread.h (class Input_file): Update declarations.
15025         * script.h (read_input_script): Update declaration.
15026
15027 2009-03-10  Nick Clifton  <nickc@redhat.com>
15028
15029         * po/es.po: New Spanish translation.
15030
15031 2009-03-06  Cary Coutant  <ccoutant@google.com>
15032
15033         * options.cc (parse_short_option): Keep dash_z from registering itself.
15034
15035 2009-03-03  Ian Lance Taylor  <iant@google.com>
15036
15037         PR 9918
15038         * target-reloc.h (relocate_section): Pass output_section to
15039         relocate.
15040         * i386.cc (Target_i386::should_apply_static_reloc): Add
15041         output_section parameter.  Change all callers.
15042         (Target_i386::Relocate::relocate): Add output_section parameter.
15043         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15044         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
15045         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
15046         * testsuite/two_file_shared.sh: New script.
15047         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
15048         (check_DATA): Add two_file_shared.dbg.
15049         (two_file_shared.dbg): New target.
15050         * testsuite/Makefile.in: Rebuild.
15051
15052 2009-03-01  Ian Lance Taylor  <iant@google.com>
15053
15054         * configure.ac: Check for byteswap.h.
15055         * configure: Rebuild.
15056         * config.in: Rebuild.
15057
15058 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
15059
15060         * layout.cc (Layout::find_or_add_kept_section): New function.
15061         (Layout::add_comdat): Removed.
15062         * layout.h (struct Kept_section): Move out of class Layout.
15063         Remove trailing underscores from field names.  Add group_sections
15064         field.  Rename group_ field to is_group.  Change all uses.
15065         (class Layout): Declare find_or_add_kept_section, not add_comdat.
15066         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
15067         comdat_groups_ field.
15068         (Sized_relobj::include_section_group): Use
15069         find_or_add_kept_section and Kept_section::group_sections.
15070         (Sized_relobj::include_linkonce_section): Likewise.
15071         * object.cc (class Sized_relobj): Don't define Comdat_group or
15072         Comdat_group_table.  Remove find_comdat_group and
15073         add_comdat_group.  Remove comdat_groups_ field.
15074         * plugin.cc (include_comdat_group): Use
15075         Layout::find_or_add_kept_section.
15076
15077 2009-02-28  Ian Lance Taylor  <iant@google.com>
15078
15079         * README: --gc-sections and map files are now supported.  Document
15080         some build requirements.
15081
15082         PR 6992
15083         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
15084         relocatable link set the value of the section symbol to zero.
15085         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
15086         relocatable link don't include the section address in the local
15087         symbol value.
15088
15089 2009-02-27  Ian Lance Taylor  <iant@google.com>
15090
15091         PR 6811
15092         * options.h (class Search_directory): Add is_system_directory.
15093         (class General_options): Declare is_in_system_directory.
15094         * options.cc (get_relative_sysroot): Make static.
15095         (get_default_sysroot): Make static.
15096         (General_optoins::is_in_system_directory): New function.
15097         * fileread.cc (Input_file::is_in_system_directory): New function.
15098         * fileread.h (class Input_file): Declare is_in_system_directory.
15099         * object.h (class Object): Add is_in_system_directory.
15100         (class Input_objects): Remove system_library_directory_ field.
15101         * object.cc (Input_objects::add_object): Don't set
15102         system_library_directory_.
15103         (input_objects::found_in_system_library_directory): Remove.
15104         * symtab.cc (Symbol_table::write_globals): Remove input_objects
15105         parameter.  Change all callers.
15106         (Symbol_table::sized_write_globals): Likewise.
15107         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
15108         Call Object::is_in_system_directory.
15109         * symtab.h (class Symbol_table): Update declarations.
15110
15111         PR 5990
15112         * descriptors.h (Open_descriptor): Add is_on_stack field.
15113         * descriptors.cc (Descriptors::open): If the descriptor is on the
15114         top of the stack, remove it.  Initialize is_on_stack field.
15115         (Descriptors::release): Only add pod to stack if it is not on the
15116         stack already.
15117         (Descriptors::close_some_descriptor): Clear stack_next and
15118         is_on_stack fields.
15119
15120         PR 7091
15121         * output.cc (Output_section::find_starting_output_address): Rename
15122         from starting_output_address; add PADDR parameter; change return
15123         type.
15124         * output.h (class Output_section): Declare
15125         find_starting_output_address instead of starting_output_address.
15126         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
15127         section symbol for which we can't find a merge section.
15128
15129         PR 9836
15130         * symtab.cc (Symbol_table::add_from_object): If the visibility is
15131         hidden or internal, force the symbol to be local.
15132         * resolve.cc (Symbol::override_visibility): Define.
15133         (Symbol::override_base): Use override_visibility.
15134         (Symbol_table::resolve): Likewise.
15135         (Symbol::override_base_with_special): Likewise.
15136         (Symbol_table::override_with_special): If the visibility is hidden
15137         or internal, force the symbol to be local.
15138         * symtab.h (class Symbol): Add set_visibility and
15139         override_visibility.
15140         * testsuite/ver_test_1.sh: New file.
15141         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
15142         (check_DATA): Add ver_test_1.syms.
15143         (ver_test_1.syms): New target.
15144         * testsuite/Makefile.in: Rebuild.
15145
15146 2009-02-25  Cary Coutant  <ccoutant@google.com>
15147
15148         * layout.cc (Layout::choose_output_section): Don't rename sections
15149         when using a linker script that has a SECTIONS clause.
15150         * Makefile.in: Regenerate.
15151
15152         * testsuite/Makefile.am (script_test_5.sh): New test case.
15153         * testsuite/Makefile.in: Regenerate.
15154         * testsuite/script_test_5.cc: New file.
15155         * testsuite/script_test_5.sh: New file.
15156         * testsuite/script_test_5.t: New file.
15157
15158 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
15159
15160         * archive.cc (Archive::include_member): Update calls to add_symbols.
15161         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
15162         the Layout argument.
15163         * dynobj.h (do_add_symbols): Add the Layout argument.
15164         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
15165         Layout argument.
15166         * object.h (Object::add_symbols): Add the Layout argument.
15167         (Object::do_add_symbols): Add the Layout argument.
15168         (Sized_relobj::do_add_symbols): Add the Layout argument.
15169         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
15170         Unify the two versions.
15171         (Add_plugin_symbols): Remove.
15172         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
15173         (Sized_pluginobj::do_add_symbols): Unify the two versions.
15174         (Add_plugin_symbols): Remove.
15175         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
15176         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
15177         (Add_symbols::run): Make it work with Pulginobj.
15178
15179 2009-02-06  Ian Lance Taylor  <iant@google.com>
15180
15181         * object.cc (Sized_relobj::do_layout): Make info message start
15182         with lower case letter.
15183
15184 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
15185
15186         * binary.cc: Fix file comment.
15187
15188         * options.h (enum Incremental_disposition): Define.
15189         (class General_options): Add new options: --incremental,
15190         --incremental_changed, --incremental_unchanged,
15191         --incremental_unknown.  Add incremental_disposition_ and
15192         implicit_incremental_ fields.
15193         (General_options::incremental_disposition): New function.
15194         (class Position_dependent_options): Add incremental_disposition
15195         option.
15196         (Position_dependent_options::copy_from_options): Set incremental
15197         dispositions.
15198         * options.cc (General_options::parse_incremental_changed): New
15199         function.
15200         (General_options::parse_incremental_unchanged): New function.
15201         (General_options::parse_incremental_unknown): New function.
15202         (General_options::General_options): Initialize new fields
15203         incremental_disposition_ and implicit_incremental_.
15204         (General_options::finalize): Check for uasge of --incremental-*
15205         without --incremental.
15206
15207 2009-02-06  Chris Demetriou  <cgd@google.com>
15208
15209         * gold.h (gold_undefined_symbol): Change to take only a Symbol
15210         pointer and to report location as the file name associated with
15211         the symbol.
15212         (gold_undefined_symbol_at_location): New function to replace the
15213         old gold_undefined_symbol functionality.
15214         * target-reloc.h (relocate_section): Update to use
15215         gold_undefined_symbol_at_location.
15216         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15217         Call gold_undefined_symbol function rather than gold_error.
15218         * errors.h (Errors::undefined_symbol): Take location as a
15219         string, rather than calculating it from a relocation.
15220         * errors.cc (Errors::fatal): Print "fatal error:" before the
15221         formatted message.
15222         (Errors::error, Errors::error_at_location): Print "error: "
15223         before the formatted message.
15224         (Errors::undefined_symbol): Take location as a string, rather
15225         than calculating it from a relocation.
15226         (gold_undefined_symbol_at_location): New function akin to
15227         old gold_undefined_symbol, calculates location from relocation.
15228         (gold_undefined_symbol): Change to take only a Symbol pointer
15229         and to report location as the file name associated with the symbol.
15230         * testsuite/debug_msg.sh: Update for changed error messages.
15231         * testsuite/undef_symbol.sh: Likewise.
15232
15233 2009-02-04  Duncan Sands  <baldrick@free.fr>
15234
15235         PR 9812
15236         * reduced_debug_output.h
15237         (Output_reduced_debug_abbrev_section::failed): Use format for
15238         gold_warning.
15239         (Output_reduced_debug_info_section::faild): Likewise.
15240
15241 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
15242
15243         * script.cc (Lazy_demangler): New class.
15244         (Version_script_info::get_symbol_version_helper): Demangle a
15245         symbol only once.
15246
15247 2009-01-29  Cary Coutant  <ccoutant@google.com>
15248
15249         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
15250         to __tls_get_addr.
15251         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15252
15253 2009-01-28  Ian Lance Taylor  <iant@google.com>
15254
15255         * version.cc (version_string): Bump to 1.9.
15256
15257         * gold.h: Include <cstring> and <stdint.h>.
15258         * version.cc: Include <cstdio>.
15259         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
15260         warning.
15261         * reduced_debug_output.cc (insert_into_vector): Rename from
15262         Insert_into_vector; change all callers.  Use Swap_unaligned to
15263         avoid aliasing issue; remove union since it is unnecessary.
15264
15265 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
15266
15267         * Makefile.am (CCFILES): Add gc.cc.
15268         (HFILES): Add gc.h.
15269         * Makefile.in: Regenerate.
15270         * gold.cc (Gc_runner): New class.
15271         (queue_initial_tasks): Call garbage collection related tasks
15272         when corresponding options are invoked.
15273         (queue_middle_gc_tasks): New function.
15274         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
15275         processed early before laying out sections during garbage collection.
15276         * gold.h (queue_middle_gc_tasks): New function.
15277         (is_prefix_of): Move from "layout.cc".
15278         * i386.cc (Target_i386::gc_process_relocs): New function.
15279         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
15280         * main.cc (main): Create object of class "Garbage_collection".
15281         * object.cc (Relobj::copy_symbols_data): New function.
15282         (Relobj::is_section_name_included): New function.
15283         (Sized_relobj::do_layout): Allow this function to be called twice
15284         during garbage collection and defer layout of section during the
15285         first call.
15286         * object.h (Relobj::get_symbols_data): New function.
15287         (Relobj::is_section_name_included): New function.
15288         (Relobj::copy_symbols_data): New function.
15289         (Relobj::set_symbols_data): New function.
15290         (Relobj::get_relocs_data): New function.
15291         (Relobj::set_relocs_data): New function.
15292         (Relobj::is_output_section_offset_invalid): New pure virtual function.
15293         (Relobj::gc_process_relocs): New function.
15294         (Relobj::do_gc_process_relocs): New pure virtual function.
15295         (Relobj::sd_): New data member.
15296         (Sized_relobj::is_output_section_offset_invalid): New function.
15297         (Sized_relobj::do_gc_process_relocs): New function.
15298         * options.h (General_options::gc_sections): Modify to not be a no-op.
15299         (General_options::print_gc_sections): New option.
15300         * plugin.cc (Plugin_finish::run): Remove function call to
15301         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
15302         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
15303         * reloc.cc (Read_relocs::run): Add task to process relocs and
15304         determine unreferenced sections when doing garbage collection.
15305         (Gc_process_relocs): New class.
15306         (Sized_relobj::do_gc_process_relocs): New function.
15307         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
15308         sections that are garbage collected.
15309         * reloc.h (Gc_process_relocs): New class.
15310         * sparc.cc (Target_sparc::gc_process_relocs): New function.
15311         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
15312         symbols whose corresponding sections are garbage collected.
15313         (Symbol_table::Symbol_table): Add new parameter for the garbage
15314         collection object.
15315         (Symbol_table::gc_mark_undef_symbols): New function.
15316         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15317         (Symbol_table::gc_mark_dyn_syms): New function.
15318         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
15319         as garbage.
15320         (Symbol_table::add_from_object): Likewise.
15321         (Symbol_table::add_from_relobj): When building shared objects, do not
15322         treat externally visible symbols as garbage.
15323         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
15324         table information for static and relocatable links.
15325         * symtab.h (Symbol_table::set_gc): New function.
15326         (Symbol_table::gc): New function.
15327         (Symbol_table::gc_mark_undef_symbols): New function.
15328         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15329         (Symbol_table::gc_mark_dyn_syms): New function.
15330         (Symbol_table::gc_): New data member.
15331         * target.h (Sized_target::gc_process_relocs): New pure virtual
15332         function.
15333         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
15334         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
15335
15336 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
15337
15338         * options.h (General_options::gc_sections): Define as a no-op for now.
15339         (General_options::no_keep_memory): Ditto.
15340         (General_options::Bshareable): Define.
15341         * options.cc (General_options::finalize): Honor -Bshareable.
15342
15343 2009-01-20  Andreas Schwab  <schwab@suse.de>
15344
15345         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
15346         read the value in the contents, since we don't use it.  Use the
15347         template endianness when writing.
15348         (Relocate::relocate): Use it for R_PPC_REL16_HA.
15349
15350 2009-01-19  Andreas Schwab  <schwab@suse.de>
15351
15352         * configure.tgt (powerpc64-*): Fix targ_obj.
15353
15354 2009-01-15  Ian Lance Taylor  <iant@google.com>
15355
15356         * object.cc (Sized_relobj::write_local_symbols): Don't write out
15357         local symbols when stripping all symbols.
15358
15359 2009-01-14  Cary Coutant  <ccoutant@google.com>
15360
15361         * output.cc (Output_reloc): Add explicit instantiations.
15362
15363 2009-01-14  Cary Coutant  <ccoutant@google.com>
15364
15365         * archive.cc (Archive::get_elf_object_for_member): Remove call
15366         to File_read::claim_for_plugin.
15367         * descriptors.cc (Descriptors::open): Remove reference to
15368         is_claimed.
15369         (Descriptors::claim_for_plugin): Remove.
15370         * descriptors.h (Descriptors::claim_for_plugin): Remove.
15371         (Descriptors::is_claimed): Remove.
15372         (claim_descriptor_for_plugin): Remove.
15373         * fileread.cc (File_read::claim_for_plugin): Remove.
15374         * fileread.h (File_read::claim_for_plugin): Remove.
15375         (File_read::descriptor): Reopen descriptor if necessary.
15376         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
15377         (Plugin_manager::all_symbols_read): Add task parameter. Change
15378         all callers.
15379         (Plugin_manager::get_input_file): New function.
15380         (Plugin_manager::release_input_file): New function.
15381         (Pluginobj::Pluginobj): Add filesize parameter and initialize
15382         corresponding data member.
15383         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
15384         and pass to base constructor. Change all callers.
15385         (get_input_file, release_input_file): New functions.
15386         (make_sized_plugin_object): Add filesize parameter. Change all callers.
15387         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
15388         (Plugin_manager::all_symbols_read): Add task parameter.
15389         (Plugin_manager::get_input_file): New function.
15390         (Plugin_manager::release_input_file): New function.
15391         (Plugin_manager::task_): New data member.
15392         (Pluginobj::Pluginobj): Add filesize parameter.
15393         (Pluginobj::filename): New function.
15394         (Pluginobj::descriptor): New function.
15395         (Pluginobj::filesize): New function.
15396         (Pluginobj::filesize_): New data member.
15397         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
15398         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
15399         File_read::claim_for_plugin; use Object::unlock to unlock the file.
15400
15401         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
15402         with archive libraries.
15403         * testsuite/Makefile.in: Regenerate.
15404         * testsuite/plugin_test.c (struct sym_info): New type.
15405         (get_input_file, release_input_file): New static variables.
15406         (onload): Capture new transfer vector entries.
15407         (claim_file_hook): Stop reading at end of file according to filesize.
15408         Factor out parsing of readelf output into separate function.
15409         (all_symbols_read_hook): Exercise get_input_file and release_input_file
15410         APIs and get the source file name from the symbol table.  Convert
15411         source file name to corresponding object file name.  Print info
15412         message when adding new input files.
15413         (parse_readelf_line): New function.
15414         * testsuite/plugin_test_1.sh: Add checks for new info messages.
15415         * testsuite/plugin_test_2.sh: Likewise.
15416         * testsuite/plugin_test_3.sh: Likewise.
15417         * testsuite/plugin_test_4.sh: New test case.
15418
15419 2009-01-07  Ian Lance Taylor  <iant@google.com>
15420
15421         * version.cc (version_string): Bump to 1.8.
15422
15423 2008-12-23  Cary Coutant  <ccoutant@google.com>
15424
15425         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
15426         * plugin.cc (Plugin_manager::finish): Rename as
15427         layout_deferred_objects.  Move cleanup to separate function.
15428         (Plugin_manager::cleanup): New function.
15429         (Plugin_finish::run): Call layout_deferred_objects and cleanup
15430         separately.
15431         * plugin.h (Plugin_manager::finish): Rename as
15432         layout_deferred_objects.
15433         (Plugin_manager::cleanup): New function.
15434         (Plugin_manager::cleanup_done): New field.
15435
15436 2008-12-23  Cary Coutant  <ccoutant@google.com>
15437
15438         * plugin.cc (is_visible_from_outside): New function.
15439         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
15440         so we don't return "IR only" status for exported symbols or -r links.
15441
15442         * testsuite/Makefile.am (plugin_test_3): New test case.
15443         * testsuite/Makefile.in: Regenerate.
15444         * testsuite/plugin_test_3.sh: New file.
15445
15446 2008-12-22  Cary Coutant  <ccoutant@google.com>
15447
15448         * object.cc (Sized_relobj::layout_section): New function.
15449         (Sized_relobj::do_layout): Defer layout of input sections until after
15450         plugin has provided replacement files.
15451         (Sized_relobj::do_layout_deferred_sections): New function.
15452         * object.h (Relobj::set_section_offset): Remove virtual keyword.
15453         (Relobj::layout_deferred_sections): New function.
15454         (Relobj::do_layout_deferred_sections): New function.
15455         (Sized_relobj::do_layout_deferred_sections): New function.
15456         (Sized_relobj::layout_section): New function.
15457         (Sized_relobj::Deferred_layout): New structure.
15458         (Sized_relobj::deferred_layout_): New field.
15459         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
15460         Change all callers.  Layout deferred sections.
15461         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
15462         references.
15463         (Plugin_hook::run): Move code from do_plugin_hook inline.
15464         (Plugin_hook::do_plugin_hook): Remove.
15465         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
15466         (Plugin_manager::finish): Renamed, was cleanup.
15467         (Plugin_manager::should_defer_layout): New function.
15468         (Plugin_manager::add_deferred_layout_object): New function.
15469         (Plugin_manager::Deferred_layout_list): New type.
15470         (Plugin_manager::deferred_layout_objects_): New field.
15471         (Plugin_hook::do_plugin_hook): Remove.
15472
15473 2008-12-17  Ian Lance Taylor  <iant@google.com>
15474
15475         * options.h (class General_options): Add --no case for
15476         --export-dynamic.
15477
15478 2008-12-16  Cary Coutant  <ccoutant@google.com>
15479
15480         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
15481         vector.
15482         (Plugin_manager::claim_file): Create plugin object even if
15483         plugin did not call the add_symbols callback.
15484         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
15485         asking for more symbols than were added.
15486         * testsuite/Makefile.am (plugin_test_1): Add test case with
15487         no global symbols.
15488         (empty.syms): New target.
15489         * testsuite/Makefile.in: Regenerate.
15490         * testsuite/plugin_test.c (claim_file_hook): Add new debug
15491         message. Don't call add_symbols if no globals.
15492         (all_symbols_read_hook): Don't provide replacement for empty
15493         claimed file.
15494
15495 2008-12-12  Ian Lance Taylor  <iant@google.com>
15496
15497         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
15498         r_type == 0 for a local symbol with r_sym == 0.
15499         (scan_relocatable_relocs): Pass r_sym to
15500         local_non_section_strategy.
15501         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
15502         r_sym parameter.
15503
15504         * configure.ac: Update test for TLS descriptors: they are
15505         supported as of glibc 2.9.
15506         * configure: Rebuild.
15507
15508 2008-12-11  Ian Lance Taylor  <iant@google.com>
15509
15510         PR 7091
15511         * target-reloc.h (Default_scan_relocatable_relocs): For each
15512         function, map r_type == 0 to RELOC_DISCARD.
15513
15514 2008-12-10  Cary Coutant  <ccoutant@google.com>
15515
15516         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
15517         object to override a kept COMDAT group from a plugin object.
15518
15519 2008-12-09  Ian Lance Taylor  <iant@google.com>
15520
15521         PR 7088
15522         * yyscript.y (file_cmd): Handle INPUT.
15523
15524         * testsuite/initpri1.c: Change all declarations to be full
15525         prototypes by adding void, to avoid compiler warnings.
15526
15527 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
15528
15529         * options.cc (General_options::parse_plugin_opt): New.
15530         (General_options::add_plugin): The argument now is just the filename.
15531         (General_options::add_plugin_option): New.
15532         * options.h (plugin_opt): New.
15533         (add_plugin): Change argument name.
15534         (add_plugin_option): New.
15535         * plugin.cc (Plugin::load): Don't parse the plugin option.
15536         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
15537         (Plugin::add_option): New.
15538         (Plugin::args_): Change type.
15539         (Plugin::filename_): New.
15540         (Plugin_manager::add_plugin_option): New.
15541         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
15542         * testsuite/Makefile.in: Regenerate.
15543
15544 2008-12-05  Cary Coutant  <ccoutant@google.com>
15545
15546         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
15547         Handle --strip-lto-sections option.
15548         * options.h (strip_lto_sections): New option.
15549
15550 2008-12-01  Cary Coutant  <ccoutant@google.com>
15551
15552         * plugin.cc (ld_plugin_message): Change format parameter to const.
15553         Fix mismatch between new[] and delete.
15554
15555 2008-11-14  Cary Coutant  <ccoutant@google.com>
15556
15557         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
15558         instead of -1U.
15559
15560 2008-11-05  Craig Silverstein  <csilvers@google.com>
15561
15562         * options.cc (General_options::parse_dynamic_list): New function.
15563         * options.h (General_options): New flags dynamic_list,
15564         dynamic_list_data, dynamic_list_cpp_new, and
15565         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
15566         (General_options::in_dynamic_list): New function.
15567         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
15568         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
15569         (Lex::can_continue_name): Likewise.
15570         (yylex): Likewise.
15571         (read_script_file): New parameter script_options.
15572         (read_dynamic_list): New function.
15573         (Script_options::define_dynamic_list): New function.
15574         (dynamic_list_keyword_parsecodes): New variable.
15575         (dynamic_list_keywords): New variable.
15576         * script.h (Script_options::define_dynamic_list): New function
15577         prototype.
15578         (read_dynamic_list): New function prototype.
15579         * symtab.cc (strprefix): New macro.
15580         (Symbol::should_add_dynsym_entry): Support dynamic_list,
15581         dynamic_list_data, dynamic_list_cpp_new, and
15582         dynamic_list_cpp_typeinfo.
15583         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
15584         (dynamic_list_expr): New rule.
15585         (dynamic_list_nodes): Likewise.
15586         (dynamic_list_node): Likewise.
15587         * testsuite/Makefile.am (dynamic_list): New test.
15588         * testsuite/Makefile.in: Regenerated.
15589         * testsuite/dynamic_list.t: New file.
15590         * testsuite/dynamic_list.sh: New file.
15591
15592 2008-11-05  Craig Silverstein  <csilvers@google.com>
15593
15594         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
15595         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
15596         (t11_last): Likewise.
15597         * testsuite/ver_test_6.c (main): Likewise.
15598
15599 2008-10-07  Cary Coutant  <ccoutant@google.com>
15600
15601         * options.c (General_options::finalize): Add check for -static and
15602         -shared.
15603         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
15604         is not empty.
15605
15606 2008-10-02  Cary Coutant  <ccoutant@google.com>
15607
15608         * plugin.cc (make_sized_plugin_object): Fix conditional
15609         compilation to work when not all targets are enabled.
15610
15611 2008-09-29  Cary Coutant  <ccoutant@google.com>
15612
15613         * archive.cc (Archive::get_file_and_offset): Use filename instead
15614         of name to get library path.
15615         (Archive::include_member): Unlock external member of a thin archive.
15616
15617         * testsuite/Makefile.am (TEST_AR): New variable.
15618         (thin_archive_test_1): New test.
15619         (thin_archive_test_2): New test.
15620         * testsuite/Makefile.in: Regenerate.
15621         * testsuite/thin_archive_main.cc: New file.
15622         * testsuite/thin_archive_test_1.cc: New file.
15623         * testsuite/thin_archive_test_2.cc: New file.
15624         * testsuite/thin_archive_test_3.cc: New file.
15625         * testsuite/thin_archive_test_4.cc: New file.
15626
15627 2008-09-29  Cary Coutant  <ccoutant@google.com>
15628
15629         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
15630         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
15631         instead of -1U.
15632         (Sized_relobj::do_finalize_local_symbols): Likewise.
15633         (Sized_relobj::map_to_kept_section): Likewise.
15634         * object.h (Sized_relobj::invalid_address): New constant.
15635         (Sized_relobj::do_output_section_offset): Check for invalid_address
15636         and return -1ULL.
15637         * output.cc (Output_reloc::local_section_offset): Use constant
15638         invalid_address instead of -1U.
15639         (Output_reloc::get_address): Likewise.
15640         (Output_section::output_address): Change -1U to -1ULL.
15641         * output.h (Output_reloc::invalid_address): New constant.
15642         * reloc.cc (Sized_relobj::write_sections): Use constant
15643         invalid_address instead of -1U.
15644         (Sized_relobj::relocate_sections): Likewise.
15645         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
15646         values for merge sections.
15647         * target-reloc.h (relocate_for_relocatable): Use constant
15648         invalid_address instead of -1U.
15649
15650 2008-09-19  Cary Coutant  <ccoutant@google.com>
15651
15652         Add plugin functionality for link-time optimization (LTO).
15653         * configure.ac (plugins): Add --enable-plugins option.
15654         * configure: Regenerate.
15655         * config.in: Regenerate.
15656         * Makefile.am (LIBDL): New variable.
15657         (CCFILES): Add plugin.cc.
15658         (HFILES): Add plugin.h.
15659         (ldadd_var): Add LIBDL.
15660         * Makefile.in: Regenerate.
15661
15662         * archive.cc: Include "plugin.h".
15663         (Archive::setup): Don't preread archive symbols when using a plugin.
15664         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
15665         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
15666         files.
15667         (Archive::include_member): Add symbols from plugin objects.
15668         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
15669         * descriptors.cc (Descriptors::open): Check for file descriptors
15670         abandoned by plugins.
15671         (Descriptors::claim_for_plugin): New function.
15672         * descriptors.h (Descriptors::claim_for_plugin): New function.
15673         (Open_descriptor::is_claimed): New field.
15674         (claim_descriptor_for_plugin): New function.
15675         * fileread.cc (File_read::claim_for_plugin): New function.
15676         * fileread.h (File_read::claim_for_plugin): New function.
15677         (File_read::descriptor): New function.
15678         * gold.cc: Include "plugin.h".
15679         (queue_initial_tasks): Add task to call plugin hooks for generating
15680         new object files.
15681         * main.cc: Include "plugin.h".
15682         (main): Load plugin libraries.
15683         * object.h (Pluginobj): Declare.
15684         (Object::pluginobj): New function.
15685         (Object::do_pluginobj): New function.
15686         (Object::set_target): New function.
15687         * options.cc: Include "plugin.h".
15688         (General_options::parse_plugin): New function.
15689         (General_options::General_options): Initialize plugins_ field.
15690         (General_options::add_plugin): New function.
15691         * options.h (Plugin_manager): Declare.
15692         (General_options): Add --plugin option.
15693         (General_options::has_plugins): New function.
15694         (General_options::plugins): New function.
15695         (General_options::add_plugin): New function.
15696         (General_options::plugins_): New field.
15697         * plugin.cc: New file.
15698         * plugin.h: New file.
15699         * readsyms.cc: Include "plugin.h".
15700         (Read_symbols::do_read_symbols): Check for archive before checking
15701         for ELF file.  Call plugin hooks to claim files.
15702         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
15703         from a real object file; force override when processing replacement
15704         files.
15705         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
15706         (Symbol::init_base_object): Likewise.
15707         (Symbol::init_base_output_data): Likewise.
15708         (Symbol::init_base_output_segment): Likewise.
15709         (Symbol::init_base_constant): Likewise.
15710         (Symbol::init_base_undefined): Likewise.
15711         (Symbol::output_section): Assert that object is not a plugin.
15712         (Symbol_table::add_from_pluginobj): New function.
15713         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15714         undefined.
15715         (Symbol_table::sized_write_globals): Likewise.
15716         (Symbol_table::add_from_pluginobj): Instantiate template.
15717         * symtab.h (Sized_pluginobj): Declare.
15718         (Symbol::in_real_elf): New function.
15719         (Symbol::set_in_real_elf): New function.
15720         (Symbol::in_real_elf_): New field.
15721         (Symbol_table::add_from_pluginobj): New function.
15722
15723         * testsuite/Makefile.am (AM_CFLAGS): New variable.
15724         (LIBDL): New variable.
15725         (LDADD): Add LIBDL.
15726         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
15727         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
15728         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
15729         (MOSTLYCLEANFILES): Likewise.
15730         * testsuite/Makefile.in: Regenerate.
15731         * testsuite/plugin_test.c: New file.
15732         * testsuite/plugin_test_1.sh: New file.
15733         * testsuite/plugin_test_2.sh: New file.
15734
15735 2008-09-16  Ian Lance Taylor  <iant@google.com>
15736
15737         * target-reloc.h (relocate_section): Check whether a symbol is
15738         defined by the ABI before reporting an undefined symbol error.
15739         * target.h (Target::is_defined_by_abi): Make parameter const.
15740         (Target::do_is_defined_by_abi): Likewise.
15741         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
15742         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
15743         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
15744         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
15745         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
15746         * testsuite/Makefile.in: Rebuild.
15747
15748         * fileread.cc (make_view): Add casts to avoid warning.
15749
15750 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15751
15752         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
15753         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15754
15755 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15756
15757         * options.h (General_options::output_is_executable): New.
15758         (General_options::output_is_pie): New.
15759         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
15760         for shared libraries.
15761         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15762
15763 2008-09-11  Chris Demetriou  <cgd@google.com>
15764
15765         * options.h (origin): New -z option.
15766         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
15767         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
15768         in DT_FLAGS_1.
15769
15770 2008-09-05  Cary Coutant  <ccoutant@google.com>
15771
15772         * fileread.cc (File_read::make_view): Add check for attempt to map
15773         beyond end of file.
15774
15775 2008-09-05  Cary Coutant  <ccoutant@google.com>
15776
15777         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
15778         explicit instantiations.
15779
15780 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
15781
15782         PR gold/6858
15783         * options.cc (General_options::finalize): Allow undefined symbols
15784         in shlibs if linking -shared.
15785
15786         PR gold/6859
15787         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
15788         symbols as not needing a dynsym entry.
15789
15790 2008-08-20  Craig Silverstein  <csilvers@google.com>
15791
15792         * fileread.cc (File_read::open): Do not lock the file unless it
15793         was successfully opened.
15794
15795 2008-08-14  Cary Coutant  <ccoutant@google.com>
15796
15797         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
15798         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
15799         * testsuite/tls_test.cc (struct int128): 128-bit struct
15800         for testing TLS relocs with non-zero addend.
15801         (v12): New TLS variable.
15802         (t12): New test.
15803         (t_last): Add check for v12.
15804         * testsuite/tls_test.h (t12): New function.
15805         * testsuite/tls_test_main.cc (thread_routine): Call new test.
15806
15807 2008-08-13  Ian Lance Taylor  <iant@google.com>
15808
15809         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
15810         set tls_segment_ or relro_segment_.
15811         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
15812         when appropriate.
15813         * output.h (Output_section::clear_is_relro): New function.
15814         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
15815         sections specially even when output_data_ is empty.
15816         (Output_segment::maximum_alignment): When first section is relro,
15817         only force alignment for PT_LOAD segments.
15818         * script.cc (script_data_segment_align): New function.
15819         (script_data_segment_relro_end): New function.
15820         * script-c.h (script_data_segment_align): Declare.
15821         (script_data_segment_relro_end): Declare.
15822         * script-sections.h (class Script_sections): Declare
15823         data_segment_align and data_segment_relro_end.  Add fields
15824         segment_align_index_ and saw_relro_end_.
15825         * script-sections.cc (class Sections_element): Add set_is_relro
15826         virtual function.  Add new bool* parameter to place_orphan_here.
15827         Add get_output_section virtual function.
15828         (class Output_section_definition): Add set_is_relro.  Add new
15829         bool* parameter to place_orphan_here.  Add get_output_section.
15830         Add is_relro_ field.
15831         (Output_section_definition::Output_section_definition): Initialize
15832         evaluated_address_, evaluated_load_address, evaluated_addralign_,
15833         and is_relro_ fields.
15834         (Output_section_definition::place_orphan_here): Add is_relro
15835         parameter.
15836         (Output_section_definition::set_section_addresses): Set relro for
15837         output section.
15838         (Output_section_definition::alternate_constraint): Likewise.
15839         (class Orphan_output_section): Add new bool* parameter to
15840         place_orphan_here.  Add get_output_section.
15841         (Orphan_output_section::place_orphan_here): Add is_relro
15842         parameter.
15843         (Script_sections::Script_sections): Initialize
15844         data_segment_align_index_ and saw_relro_end_.
15845         (Script_sections::data_segment_align): New function.
15846         (Script_sections::data_segment_relro_end): New function.
15847         (Script_sections::place_orphan): Set or clear is_relro.
15848         (Script_sections::set_section_addresses): Force alignment of first
15849         TLS section.
15850         * yyscript.y (exp): Call script_data_segment_align and
15851         script_data_segment_relro_end.
15852         * testsuite/relro_script_test.t: New file.
15853         * testsuite/relro_test.cc (using_script): Declare.
15854         (t1, t2): Test using_script.
15855         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
15856         (relro_script_test_SOURCES): Define.
15857         (relro_script_test_DEPENDENCIES): Define.
15858         (relro_script_test_LDFLAGS): Define.
15859         (relro_script_test_LDADD): Define.
15860         (relro_script_test.so): New target.
15861         * testsuite/Makefile.in: Rebuild.
15862
15863 2008-08-06  Cary Coutant <ccoutant@google.com>
15864
15865         * archive.cc (Archive::total_archives, Archive::total_members)
15866         (Archive::total_members_loaded): New variables.
15867         (Archive::setup): Add parameter.  Add option to preread
15868         archive symbols.
15869         (Archive::read_armap): Add counter.
15870         (Archive::get_file_and_offset): New function.
15871         (Archive::get_elf_object_for_member): New function.
15872         (Archive::read_all_symbols): New function.
15873         (Archive::read_symbols): New function.
15874         (Archive::add_symbols): Add counters.
15875         (Archive::include_all_members): Use armap to find members if it's
15876         already built.
15877         (Archive::include_member): Skip reading symbols if already read.
15878         Factored code into Archive::get_file_and_offset and
15879         Archive::get_elf_object_for_member.  Changed call to
15880         Mapfile::report_include_archive_member.
15881         (Archive::print_stats): New function.
15882         * archive.h: Declare Object and Read_symbols_data classes.
15883         (Archive::Archive): Add initializers for new members.
15884         (Archive::setup): Add parameter.
15885         (Archive::print_stats): New function.
15886         (Archive::total_archives, Archive::total_members)
15887         (Archive::total_members_loaded): New variables.
15888         (Archive::get_file_and_offset): New function.
15889         (Archive::get_elf_object_for_member): New function.
15890         (Archive::read_all_symbols): New function.
15891         (Archive::read_symbols): New function.
15892         (Archive::Archive_member): New class.
15893         (Archive::members_): New member.
15894         (Archive::num_members_): New member.
15895         * main.cc: Include archive.h.
15896         (main): Call Archive::print_stats.
15897         * mapfile.cc (Mapfile::report_include_archive_member): Delete
15898         archive parameter; member_name is now the fully-decorated name.
15899         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
15900         * options.h: (General_options): Add --preread-archive-symbols option.
15901         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
15902         Archive::setup.
15903
15904 2008-08-04  Ian Lance Taylor  <iant@google.com>
15905
15906         * symtab.h (Symbol::use_plt_offset): New function.
15907         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
15908         * powerpc.cc (Relocate::relocate): Likewise.
15909         * sparc.cc (Relocate::relocate): Likewise.
15910         * x86_64.cc (Relocate::relocate): Likewise.
15911         * testsuite/weak_plt.sh: New test.
15912         * testsuite/weak_plt_main.cc: New test.
15913         * testsuite/weak_plt_shared.cc: New test.
15914         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
15915         (check_PROGRAMS): Add weak_plt.
15916         (check_DATA): Add weak_plt_shared.so.
15917         (weak_plt_main_pic.o, weak_plt): New targets.
15918         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
15919         * testsuite/Makefile.in: Rebuild.
15920
15921         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
15922         gcctestdir/ld.
15923         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
15924         * testsuite/Makefile.in: Rebuild.
15925
15926 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
15927
15928         * Makefile.am (POTFILES.in): Set LC_ALL=C.
15929         * Makefile.in: Regenerate.
15930         * po/POTFILES.in: Regenerate.
15931
15932 2008-07-29  Ian Lance Taylor  <iant@google.com>
15933
15934         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
15935         symbols before other symbols.
15936         * testsuite/script_test_2.cc (test_addr): Declare.
15937         (test_addr_alias): Declare.
15938         (main): Check that test_addr and test_addr_alias have the right
15939         values.
15940         * testsuite/script_test_2.t: Define test_addr_alias and
15941         test_addr.
15942
15943 2008-07-24  Ian Lance Taylor  <iant@google.com>
15944
15945         PR 5990
15946         * descriptors.cc: New file.
15947         * descriptors.h: New file.
15948         * gold-threads.h (class Hold_optional_lock): New class.
15949         * fileread.cc: Include "descriptors.h".
15950         (File_read::~File_read): Release descriptor rather than closing
15951         it.
15952         (File_read::open) [file]: Call open_descriptor rather than open.
15953         Set is_descriptor_opened_.
15954         (File_read::open) [memory]: Assert that descriptor is not open.
15955         (File_read::reopen_descriptor): New function.
15956         (File_read::release): Release descriptor.
15957         (File_read::do_read): Make non-const.  Reopen descriptor.
15958         (File_read::read): Make non-const.
15959         (File_read::make_view): Reopen descriptor.
15960         (File_read::do_readv): Likewise.
15961         * fileread.h (class File_read): Add is_descriptor_opened_ field.
15962         Update declarations.
15963         * layout.cc: Include "descriptors.h".
15964         (Layout::create_build_id): Use open_descriptor rather than open.
15965         * output.cc: Include "descriptors.h".
15966         (Output_file::open): Use open_descriptor rather than open.
15967         * archive.cc (Archive::const_iterator): Change Archive to be
15968         non-const.
15969         (Archive::begin, Archive::end): Make non-const.
15970         (Archive::count_members): Likewise.
15971         * archive.h (class Archive): Update declarations.
15972         * object.h (Object::read): Make non-const.
15973         * Makefile.am (CCFILES): Add descriptors.cc.
15974         (HFILES): Add descriptors.h.
15975         * Makefile.in: Rebuild.
15976
15977         PR 6716
15978         * gold.h: Always include <clocale>.  Add Solaris workarounds
15979         following code in binutils/sysdep.h.
15980
15981         PR 6048
15982         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
15983         this->eh_frame_hdr_ is NULL before using it.
15984
15985         * dynobj.cc (Versions::Versions): Update comment.
15986
15987         * dynobj.cc (Versions::Versions): If there is an soname, use it as
15988         the base version name.
15989
15990         * stringpool.cc (Stringpool_template::add_with_length): Set key to
15991         array size plus one.
15992         (Stringpool_template::set_string_offsets): Subtract one from key
15993         before using it as an array index.
15994         (Stringpool_template::get_offset_with_length): Likewise.
15995         (Stringpool_template::write_to_buffer): Likewise.
15996         * stringpool.h (Stringpool_template::get_offset_from_key):
15997         Likewise.
15998
15999 2008-07-23  Ian Lance Taylor  <iant@google.com>
16000
16001         PR 6658
16002         * object.h (Merged_symbol_value::value): Do our best to handle a
16003         negative addend.
16004
16005         PR 6647
16006         * script.cc (Version_script_info::get_versions): Don't add empty
16007         version tag to return value.
16008         (Version_script_info::get_symbol_version_helper): Change return
16009         type to bool.  Add pversion parameter.  Change all callers.
16010         (script_register_vers_node): Don't require a non-NULL tag.
16011         * script.h (class Version_script_info): Update declarations.
16012         (Version_script_info::get_symbol_version): Change return type to
16013         bool.  Add version parameter.  Change all callers.
16014         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
16015         handling.  Handle an empty version from a version script.
16016         (Symbol_table::define_special_symbol): Likewise.
16017         * testsuite/ver_test_10.script: New file.
16018         * testsuite/ver_test_10.sh: New file.
16019         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
16020         (check_DATA): Add ver_test_10.syms.
16021         (ver_test_10.syms, ver_test_10.so): New target.
16022         * testsuite/Makefile.in: Rebuild.
16023
16024 2008-07-23  Simon Baldwin  <simonb@google.com>
16025
16026         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
16027         to zero for undefined symbols from dynamic libraries.
16028
16029 2008-07-23  Ian Lance Taylor  <iant@google.com>
16030
16031         * symtab.cc (Symbol_table::resolve): Remove version parameter.
16032         Change all callers.
16033         * symtab.h (class Symbol_table): Update declaration.
16034         * testsuite/ver_test_9.cc: New file.
16035         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
16036         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
16037         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
16038         (ver_test_9.so, ver_test_9.o): New targets.
16039         * testsuite/Makefile.in: Rebuild.
16040
16041 2008-07-22  Ian Lance Taylor  <iant@google.com>
16042
16043         * options.h (class General_options): Define --check-sections.
16044         * layout.cc (Layout::set_segment_offsets): Handle
16045         --check-sections.
16046
16047         * options.h (class General_options): Define -n/--nmagic and
16048         -N/--omagic.
16049         * options.cc (General_options::finalize): For -n/--nmagic or
16050         -N/--omagic, set -static.
16051         * layout.cc (Layout::attach_allocated_section_to_segment): If
16052         -N/--omagic, don't put read-only and read-write sections in
16053         different segments.
16054         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
16055         finding a read-only segment.
16056         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
16057         don't set the minimum segment alignment to the common page size,
16058         and don't set the file offset to the address modulo the page size.
16059         * script-sections.cc (Script_sections::create_segments): If
16060         -n/--omagic, don't put read-only and read-write sections in
16061         different segments.
16062
16063         * cref.cc: New file.
16064         * cref.h: New file.
16065         * options.h (class General_options): Add --print-symbol-counts.
16066         * main.cc (main): Issue defined symbol report if requested.
16067         * archive.cc (Archive::interpret_header): Make into a const member
16068         function.
16069         (Archive::add_symbols): Call Input_objects::archive_start and
16070         archive_stop.
16071         (Archive::const_iterator): Define new class.
16072         (Archive::begin, Archive::end): New functions.
16073         (Archive::include_all_members): Rewrite to use iterator.
16074         (Archive::count_members): New function.
16075         * archive.h (class Archive): Update declarations.
16076         (Archive::filename): New function.
16077         * object.cc: Include "cref.h".
16078         (Sized_relobj::Sized_relobj): Initialize defined_count_.
16079         (Sized_relobj::do_get_global_symbol_counts): New function.
16080         (Input_objects::add_object): Add object to cross-referencer.
16081         (Input_objects::archive_start): New function.
16082         (Input_objects::archive_stop): New function.
16083         (Input_objects::print_symbol_counts): New function.
16084         * object.h: Declare Cref and Archive.
16085         (Object::get_global_symbol_counts): New function.
16086         (Object::do_get_global_symbol_counts): New pure virtual function.
16087         (class Sized_relobj): Add defined_count_ field.  Update
16088         declarations.
16089         (class Input_objects): Add cref_ field.  Update constructor.
16090         Update declarations.
16091         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
16092         defined_count_.
16093         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
16094         symbol counts.
16095         (Sized_dynobj::do_get_global_symbol_counts): New function.
16096         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
16097         defined_count_.  Update declarations.  Define Symbols typedef.
16098         * symtab.cc (Symbol_table::add_from_relobj): Add defined
16099         parameter.  Change all callers.
16100         (Symbol_table::add_from_dynobj): Add sympointers and defined
16101         parameters.  Change all callers.
16102         * symtab.h (class Symbol_table): Update declarations.
16103         * Makefile.am (CCFILES): Add cref.cc.
16104         (HFILES): Add cref.h.
16105         * Makefile.in: Rebuild.
16106
16107 2008-07-22  Simon Baldwin  <simonb@google.com>
16108
16109         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
16110         to zero when writing undefined symbols.
16111
16112 2008-07-22  Ian Lance Taylor  <iant@google.com>
16113
16114         * output.cc (Output_section::add_input_section): Don't try to
16115         merge empty merge sections.
16116
16117 2008-07-21  Craig Silverstein  <csilvers@google.com>
16118
16119         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
16120         Include symbol version in error message.
16121
16122 2008-07-20  Chris Demetriou  <cgd@google.com>
16123
16124         * configure.ac (gold_cv_c_random_seed): New configured variable.
16125         (RANDOM_SEED_CFLAGS): New substituted variable.
16126         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
16127         * configure: Rebuild.
16128         * Makefile.in: Likewise.
16129         * testsuite/Makefile.in: Likewise.
16130
16131 2008-07-18  Ian Lance Taylor  <iant@google.com>
16132
16133         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
16134         where we see NAME/NULL and NAME/VERSION  as separate symbols.
16135         * testsuite/ver_test_main.cc (main): Call t4.
16136         (t4, t4_2a): Define.
16137         * testsuite/ver_test_2.cc (t4_2): Define.
16138         * testsuite/ver_test_2.script: Put t4_2a in VER2.
16139         * testsuite/ver_test_4.cc (t4_2a): Define.
16140         * testsuite/ver_test_4.script: Put t4_2a in VER2.
16141         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
16142
16143 2008-07-17  Ian Lance Taylor  <iant@google.com>
16144
16145         * dynobj.cc (Versions::add_def): If we give an error about a
16146         missing version, go ahead and create the version anyhow.
16147
16148 2008-07-10  Ian Lance Taylor  <iant@google.com>
16149
16150         Handle output sections with more than 0x7fffffff bytes.
16151         * object.h (class Relobj): Change map_to_output_ to
16152         output_sections_, and just keep a section pointer.  Change all
16153         uses.  Move comdat group support to Sized_relobj.
16154         (Relobj::is_section_specially_mapped): Remove.
16155         (Relobj::output_section): Remove poff parameter.  Change all
16156         callers.
16157         (Relobj::output_section_offset): New function.
16158         (Relobj::set_section_offset): Rewrite.
16159         (Relobj::map_to_output): Remove.
16160         (Relobj::output_sections): New function.
16161         (Relobj::do_output_section_offset): New pure virtual function.
16162         (Relobj::do_set_section_offset): Likewise.
16163         (class Sized_relobj): Add section_offsets_ field.  Add comdat
16164         group support from Relobj.  Update declarations.
16165         (Sized_relobj::get_output_section_offset): New function.
16166         (Sized_relobj::do_output_section_offset): New function.
16167         (Sized_relobj::do_set_section_offset): New function.
16168         * object.cc (Relobj::output_section_address): Remove.
16169         (Sized_relobj::Sized_relobj): Initialize new fields.
16170         (Sized_relobj::include_section_group): Cast find_kept_object to
16171         Sized_relobj.
16172         (Sized_relobj::include_linkonce_section): Likewise.
16173         (Sized_relobj::do_layout): Use separate arrays for output section
16174         and output offset.
16175         (Sized_relobj::do_count_local_symbols): Change map_to_output to
16176         output_sections.
16177         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
16178         output_sections and section_offsets.
16179         (Sized_relobj::write_local_symbols): Likewise.
16180         (map_to_kept_section): Compute output address directly.
16181         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
16182         output_sections and section_offsets.
16183         (Sized_relobj::write_sections): Likewise.
16184         (Sized_relobj::relocate_sections): Likewise.
16185         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
16186         * output.h (class Output_reloc): Update declarations.  Change
16187         u2_.relobj to Sized_relobj*.
16188         (class Output_data_reloc): Change add functions to use
16189         Sized_relobj*.
16190         * output.cc (Output_reloc::Output_reloc): Change relobj to
16191         Sized_relobj*.
16192         (Output_reloc::local_section_offset): Change return type to
16193         Elf_Addr.  Use get_output_section_offset.
16194         (Output_reloc::get_address): Likewise.
16195         (Output_section::is_input_address_mapped): Don't call
16196         is_section_specially_mapped.
16197         (Output_section::output_offset): Likewise.
16198         (Output_section::output_address): Likewise.
16199         (Output_section::starting_output_address): Likewise.
16200         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
16201         parameter to Sized_relobj*.
16202         (Copy_relocs::need_copy_reloc): Likewise.
16203         (Copy_relocs::save): Likewise.
16204         * copy-relocs.h (class Copy_relocs): Update declarations.
16205         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
16206         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
16207         * target-reloc.h (relocate_for_relocatable): Change
16208         offset_in_output_section type to Elf_Addr.  Change code that uses
16209         it as well.
16210         * layout.cc (Layout::layout): Always set *off.
16211         * mapfile.cc (Mapfile::print_input_section): Use
16212         output_section_offset.
16213         * i386.cc (Target_i386::copy_reloc): Change object parameter to
16214         Sized_relobj*.
16215         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
16216         * sparc.cc (Target_sparc::copy_reloc): Likewise.
16217         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
16218
16219 2008-07-03  Ian Lance Taylor  <iant@google.com>
16220
16221         * layout.cc (Layout::include_section): Do not discard unrecognized
16222         SHT_STRTAB sections.
16223
16224 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
16225
16226         * script.cc (Lex::can_continue_name): Make '?' allowable in
16227         version-script names.
16228         * testsuite/version_script.map: Change glob pattern to use '?'
16229
16230 2008-06-30  Manish Singh  <yosh@gimp.org>
16231
16232         PR 6585
16233         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
16234         Correct typo.
16235
16236 2008-06-30  Ian Lance Taylor  <iant@google.com>
16237
16238         PR 6660
16239         PR 6682
16240         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
16241         versions]: Don't try to read the value in the contents, since we
16242         don't use it.  Use the template endianness when writing.
16243
16244 2008-06-25  Cary Coutant  <ccoutant@google.com>
16245
16246         * fileread.cc (File_read::make_view): Assert on zero-length view.
16247         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
16248         symbol table when there are no symbols to read.
16249
16250 2008-06-23  Craig Silverstein  <csilvers@google.com>
16251
16252         * version.cc (version_string): Bump to 1.7
16253
16254 2008-06-18  Craig Silverstein  <csilvers@google.com>
16255
16256         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
16257         constant 0xFFFF to type Valtype.
16258         (Powerpc_relocate_functions::rel16_ha): Likewise.
16259
16260 2008-06-17  Ian Lance Taylor  <iant@google.com>
16261
16262         * output.h (Output_section::Input_section): Initialize p2align_ to
16263         zero for Output_section_data constructors.
16264         (Output_section::Input_section::addralign): If not an input
16265         section, return the alignment of the Output_section_data.
16266         * testsuite/copy_test.cc: New file.
16267         * testsuite/copy_test_1.cc: New file.
16268         * testsuite/copy_test_2.cc: New file.
16269         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
16270         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
16271         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
16272         (copy_test_1_pic.o, copy_test_1.so): New targets.
16273         (copy_test_2_pic.o, copy_test_2.so): New targets.
16274         * testsuite/Makefile.in: Rebuild.
16275
16276         * script-sections.cc (Script_sections::place_orphan): Initialize
16277         local variable exact.
16278
16279 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
16280
16281         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
16282
16283 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
16284             David S. Miller  <davem@davemloft.net>
16285
16286         * powerpc.cc: New file.
16287         * Makefile.am (TARGETSOURCES): Add powerpc.cc
16288         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
16289         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
16290         * Makefile.in: Rebuild.
16291
16292 2008-06-09  Ian Lance Taylor  <iant@google.com>
16293
16294         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
16295         <exception>.
16296         (throwing, orig_terminate): New static variables.
16297         (terminate_handler): New static function.
16298         (t2): Set terminate handler.
16299
16300 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
16301
16302         PR 6584
16303         * binary.cc (Binary_to_elf::sized_convert): Fix .data
16304         alignment.
16305
16306 2008-05-30  Cary Coutant  <ccoutant@google.com>
16307
16308         * archive.cc (Archive::include_all_members) Correct to step
16309         over symbol table and extended name table in thin archives.
16310
16311 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
16312
16313         PR 6407
16314         * target-reloc.h (relocate_for_relocatable): Fix new_offset
16315         calculation.
16316
16317 2008-05-28  Caleb Howe  <cshowe@google.com>
16318
16319         * reduced_debug_output.cc: New file.
16320         * reduced_debug_output.h: New file.
16321         * options.h (class General_options): Add --strip-debug-non-line.
16322         * options.cc (General_options::finalize): Add strip_debug_non_line
16323         to the strip heirarchy.
16324         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
16325         fields.
16326         * layout.cc: Include "reduced_debug_output.h".
16327         (Layout::Layout): Initialize new fields.
16328         (line_only_debug_sections): New static array.
16329         (is_lines_only_debug_sections): New static inline function.
16330         (Layout::include_section): Handle --strip-debug-non-line.
16331         (Layout::make_output_section): If --strip-debug-non-line, build
16332         new output sections for .debug_abbrev and .debug_info.
16333         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
16334         gold.  Warn about possible overflow.
16335         (read_signed_LEB_128): Likewise.
16336         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
16337         (read_signed_LEB_128): Declare.
16338         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
16339         (HFILES): Add reduced_debug_output.h.
16340         * Makefile.in: Rebuild.
16341
16342 2008-05-21  Ian Lance Taylor  <iant@google.com>
16343
16344         * mapfile.cc: New file.
16345         * mapfile.h: New file.
16346         * options.h (class General_options): Add -M/--print-map and -Map.
16347         * options.cc (General_options::finalize): Make -M equivalent to
16348         -Map -.
16349         * main.cc: Include <cstdio> and "mapfile.h".
16350         (main): Open mapfile if requested.
16351         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
16352         constructor.  Change caller.
16353         (queue_initial_tasks): Add mapfile parameter.  Change caller.
16354         (queue_middle_tasks): Likewise.
16355         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
16356         declarations.
16357         * archive.cc: Include "mapfile.h".
16358         (Archive::add_symbols): Add mapfile parameter.  Change all
16359         callers.  Pass mapfile, symbol, and reason to include_member.
16360         (Archive::include_all_members): Add mapfile parameter.  Change all
16361         callers.
16362         (Archive::include_member): Add mapfile, sym, and why parameters.
16363         Change all callers.  Report inclusion to map file.
16364         * archive.h: Include "fileread.h".
16365         (class Archive): Update declarations.
16366         (Archive::file): New const method.
16367         (class Add_archive_symbols): Add mapfile_ field.  Update
16368         constructor.  Change all callers.
16369         * readsyms.h (class Read_symbols): Likewise.
16370         (class Finish_group): Likewise.
16371         (class Read_script): Likewise.
16372         * common.cc: Include "mapfile.h".
16373         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
16374         all callers.
16375         (Symbol_table::do_allocate_commons): Likewise.
16376         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
16377         symbol allocation to mapfile.
16378         * common.h (class Allocate_commons_task): Add mapfile_ field.
16379         Update constructor.  Change all callers.
16380         * symtab.h (class Symbol_table): Update declarations.
16381         * layout.cc: Include "mapfile.h".
16382         (Layout_task_runner::run): Print information to mapfile.
16383         (Layout::create_gold_note): Change Output_data_fixed_space to
16384         Output_data_zero_fill.
16385         (Layout::create_build_id): Likewise.
16386         (Layout::print_to_mapfile): New function.
16387         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
16388         constructor.  Change caller.
16389         (class Layout): Declare print_to_mapfile.
16390         * output.cc (Output_section::Input_section::print_to_mapfile): New
16391         function.
16392         (Output_section::add_input_section): If producing a map, always
16393         add to input_sections_ list.
16394         (Output_section::do_print_to_mapfile): New function.
16395         (Output_segment::print_sections_to_mapfile): New function.
16396         (Output_segment::print_section_list_to_mapfile): New function.
16397         * output.h: Include "mapfile.h".
16398         (Output_data::print_to_mapfile): New function.
16399         (Output_data::do_print_to_mapfile): New virtual function.
16400         (Output_segment_headers::do_print_to_mapfile): New function.
16401         (Output_file_header::do_print_to_mapfile): New function.
16402         (Output_data_const::do_print_to_mapfile): New function.
16403         (class Output_data_const_buffer): Add map_name_ field.  Update
16404         constructor.  Change all callers.  Add do_print_to_mapfile
16405         function.
16406         (class Output_data_fixed_space): Likewise.
16407         (class Output_data_space): Likewise.
16408         (class Output_data_zero_fill): New class.
16409         (Output_data_strtab::do_print_to_mapfile): New function.
16410         (Output_data_reloc_base::do_print_to_mapfile): New function.
16411         (Output_relocatable_relocs::do_print_to_mapfile): New function.
16412         (Output_data_group::do_print_to_mapfile): New function.
16413         (Output_data_got::do_print_to_mapfile): New function.
16414         (Output_data_dynamic::do_print_to_mapfile): New function.
16415         (Output_symtab_xindex::do_print_to_mapfile): New function.
16416         (class Output_section): Declare do_print_to_mapflie.  Declare
16417         print_to_mapfile in Input_section.
16418         (class Output_segment): Declare new functions.
16419         * object.h (Sized_relobj::symbol_count): New function.
16420         * script-sections.cc
16421         (Output_section_element_dot_assignment::set_section_addresses):
16422         Change Output_data_fixed_space to Output_data_zero_fill.
16423         (Output_data_expression::do_print_to_mapfile): New function.
16424         * script.cc (read_input_script): Add mapfile parameter.  Change
16425         all callers.
16426         * script.h (read_input_script): Update declaration.
16427         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
16428         (Eh_frame::do_print_to_mapfile): New function.
16429         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
16430         (Output_merge_string::do_print_to_mapfile): New function.
16431         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
16432         function.
16433         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
16434         function.
16435         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
16436         function.
16437         * Makefile.am (CCFILES): Add mapfile.cc.
16438         (HFILES): Add mapfile.h.
16439         * Makefile.in: Rebuild.
16440
16441 2008-05-19  Ian Lance Taylor  <iant@google.com>
16442
16443         * options.h (class General_options): Add -z relro.
16444         * layout.cc (Layout::Layout): Initialize relro_segment_.
16445         (Layout::add_output_section_data): Return the output section.
16446         (Layout::make_output_section): Rcognize relro sections and mark
16447         them appropriately.
16448         (Layout::attach_allocated_section_to_segment): Put relro sections
16449         in a PT_GNU_RELRO segment.
16450         (Layout::create_initial_dynamic_sections): Mark the .dynamic
16451         section as relro.
16452         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
16453         PT_TLS segments.
16454         (Layout::linkonce_mapping): Map d.rel.ro.local to
16455         .data.rel.ro.local.
16456         (Layout::output_section_name): Us .data.rel.ro.local for any
16457         section which begins with that.
16458         * layout.h (class Layout): Update add_output_section_data
16459         declaration.  Add relro_segment_ field.
16460         * output.cc (Output_section::Output_section): Initialize is_relro_
16461         and is_relro_local_ fields.
16462         (Output_segment::add_output_section): Group relro sections.
16463         (Output_segment::is_first_section_relro): New function.
16464         (Output_segment::maximum_alignment): If there is a relro section,
16465         align the segment to the common page size.
16466         (Output_segment::set_section_addresses): Track whether we are
16467         looking at relro sections.  If the last section is a relro
16468         section, align to the common page size.
16469         (Output_segment::set_section_list_addresses): Add in_relro
16470         parameter.  Change all callers.  Align to the page size when
16471         moving from relro to non-relro section.
16472         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
16473         segment.
16474         * output.h (class Output_section): Add is_relro_ and
16475         is_relro_local_ fields.
16476         (Output_section::is_relro): New function.
16477         (Output_section::set_is_relro): New function.
16478         (Output_section::is_relro_local): New function.
16479         (Output_section::set_is_relro_local): New function.
16480         (class Output_segment): Update declarations.
16481         * i386.cc (Target_i386::got_section): Mark .got section as relro.
16482         * sparc.cc (Target_sparc::got_section): Likewise.
16483         * x86_64.cc (Target_x86_64::got_section): Likewise.
16484         * testsuite/relro_test_main.cc: New file.
16485         * testsuite/relro_test.cc: New file.
16486         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
16487         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
16488         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
16489         (relro_test.so, relro_test_pic.o): New targets.
16490         * testsuite/Makefile.in: Rebuild.
16491
16492 2008-05-16  Ian Lance Taylor  <iant@google.com>
16493
16494         * output.cc (Output_segment::add_output_section): Remove front
16495         parameter.
16496         * output.h (class Output_segment): Remove
16497         add_initial_output_section and overloaded add_output_section.
16498         Update declaration of remaining add_output_section.
16499         * layout.cc (Layout::create_interp): Call add_output_section
16500         rather than add_initial_output_section.
16501         (Layout::finish_dynamic_section): Likewise.
16502
16503         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
16504         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
16505         know the dynamic type.
16506         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
16507         field.  Initialize it in constructor.
16508         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
16509         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
16510         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
16511         reloc.
16512
16513         * output.cc (Output_reloc::get_address): Change return type to
16514         Elf_Addr.
16515         * output.h (class Output_reloc): Update get_address declaration.
16516         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
16517         for section addresses.
16518
16519 2008-05-09  Ian Lance Taylor  <iant@google.com>
16520
16521         PR 6493
16522         * gold.cc (gold_nomem): Use return value of write.
16523
16524 2008-05-08  Ian Lance Taylor  <iant@google.com>
16525
16526         * symtab.c (Symbol::init_base_output_data): Add version
16527         parameter.  Change all callers.
16528         (Symbol::init_base_output_segment): Likewise.
16529         (Symbol::init_base_constant): Likewise.
16530         (Symbol::init_base_undefined): Likewise.
16531         (Sized_symbol::init_output_data): Likewise.
16532         (Sized_symbol::init_output_segment): Likewise.
16533         (Sized_symbol::init_constant): Likewise.
16534         (Sized_symbol::init_undefined): Likewise.
16535         (Symbol_table::do_define_in_output_data): If the new symbol has a
16536         version, mark it as the default.
16537         (Symbol_table::do_define_in_output_segment): Likewise.
16538         (Symbol_table::do_define_as_constant): Likewise.
16539         * symtab.h (class Symbol): Update declarations.
16540         (class Sized_symbol): Likewise.
16541         * resolve.cc (Symbol::override_version): New function.
16542         (Symbol::override_base): Call override_version.
16543         (Symbol::override_base_with_special): Likewise.
16544         * testsuite/ver_script_8.script: New file.
16545         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
16546         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
16547         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
16548         (ver_test_8_1.so, ver_test_8_2.so): New targets.
16549
16550 2008-05-06  Ian Lance Taylor  <iant@google.com>
16551
16552         PR 6049
16553         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
16554         functions.
16555         (class General_options): Remove existing --undefined, and add
16556         --no-undefined instead.  Add new --undefined as synonym for -u.
16557         * archive.cc (Archive::add_symbols): Check whether symbol was
16558         named with -u.
16559         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
16560         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
16561         all uses.  Add IS_UNDEFINED.  Update declarations to split
16562         different versions of init_base.  Declare init_base_undefined.
16563         (Symbol::is_defined): Handle IS_UNDEFINED.
16564         (Symbol::is_undefined): Likewise.
16565         (Symbol::is_weak_undefined): Call is_undefined.
16566         (Symbol::is_absolute): Handle IS_CONSTANT.
16567         (class Sized_symbol): Update declarations to split different
16568         versions of init.  Declare init_undefined.
16569         (class Symbol_table): Declare new functions.
16570         * symtab.cc (Symbol::init_base_object): Rename from init_base.
16571         Change all callers.
16572         (Symbol::init_base_output_data): Likewise.
16573         (Symbol::init_base_output_segment): Likewise.
16574         (Symbol::init_base_constant): Likewise.
16575         (Symbol::init_base_undefined): New function.
16576         (Sized_symbol::init_object): Rename from init.  Change all
16577         callers.
16578         (Sized_symbol::init_output_data): Likewise.
16579         (Sized_symbol::init_output_segment): Likewise.
16580         (Sized_symbol::init_constant): Likewise.
16581         (Sized_symbol::init_undefined): New function.
16582         (Symbol_table::add_undefined_symbols_from_command_line): New
16583         function.
16584         (Symbol_table::do_add_undefined_symbols_from_command_line): New
16585         function.
16586         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
16587         (Symbol::output_section): Likewise.
16588         (Symbol::set_output_section): Likewise.
16589         (Symbol_table::sized_finalize_symbol): Likewise.
16590         (Symbol_table::sized_write_globals): Likewise.
16591         * resolve.cc (Symbol_table::should_override): Likewise.
16592         (Symbol::override_base_with_special): Likewise.
16593
16594         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
16595         symbol, change it to have default visibility.
16596         * testsuite/protected_1.cc: New file.
16597         * testsuite/protected_2.cc: New file.
16598         * testsuite/protected_3.cc: New file.
16599         * testsuite/protected_main_1.cc: New file.
16600         * testsuite/protected_main_2.cc: New file.
16601         * testsuite/protected_main_3.cc: New file.
16602         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
16603         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
16604         (protected_1_LDFLAGS, protected_1_LDADD): Define.
16605         (protected_1.so): New target.
16606         (protected_1_pic.o, protected_2_pic.o): New targets.
16607         (protected_3_pic.o): New target.
16608         (check_PROGRAMS): Add protected_2.
16609         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
16610         (protected_2_LDFLAGS, protected_2_LDADD): Define.
16611         * testsuite/Makefile.in: Rebuild.
16612
16613         * options.h (DEFINE_var): Add set_user_set_##varname__.
16614         (DEFINE_bool_alias): New macro.
16615         (class General_options): Define -Bstatic using DEFINE_bool_alias
16616         rather than DEFINE_special.  Add --undefined as an alias for -z
16617         defs.
16618         * options.cc (General_options::parse_Bstatic): Remove.
16619
16620         * options.h (class General_options): Add --fatal-warnings.
16621         * main.cc (main): Implement --fatal-warnings.
16622         * errors.h (Errors::warning_count): New function.
16623
16624         * options.h (class General_options): Add -Bsymbolic-functions.
16625         * symtab.h (Symbol::is_preemptible): Check for
16626         -Bsymbolic-functions.
16627
16628 2008-05-05  Ian Lance Taylor  <iant@google.com>
16629
16630         * options.h (DEFINE_bool): For DASH_Z, create the negative option
16631         as noVARNAME rather than no-VARNAME.
16632         (class General_options): Add option -z combreloc.
16633         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
16634         get_address.
16635         (Output_reloc::sort_before) [SHT_REL]: New function.
16636         (Output_reloc::sort_before) [SHT_RELA]: New function.
16637         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
16638         Sort_relocs_comparison.
16639         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
16640         parameter.  Change all callers.
16641         (Output_data_reloc::Output_data_reloc) [both versions]: Add
16642         sort_relocs parameter.  Change all callers.
16643         * output.cc (Output_reloc::get_address): New function, broken out
16644         of write_rel.
16645         (Output_reloc::write_rel): Call it.
16646         (Output_reloc::compare): New function.
16647         (Output_data_reloc_base::do_write): Optionally sort relocs.
16648
16649         * configure.ac: If targ_extra_obj is set, link it in.
16650         * configure.tgt: Initialize all variables.
16651         (x86_64*): Set targ_extra_obj and targ_extra_size.
16652         * configure: Rebuild.
16653
16654         * object.cc (Sized_relobj::include_section_group): Adjust section
16655         indexes read from group data.  Build vector to pass to
16656         layout_group.
16657         * layout.cc (Layout::layout_group): Add flags and shndxes
16658         parameters.  Remove contents parameter.  Change caller.  Update
16659         explicit instantiations.
16660         * layout.h (class Layout): Update layout_group declaration.
16661         * output.cc (Output_data_group::Output_data_group): Add flags and
16662         input_shndxes parameters.  Remove contents parameter.  Change
16663         caller.
16664         (Output_data_group::do_write): Change input_sections_ to
16665         input_shndxes_.
16666         * output.h (class Output_data_group): Update constructor
16667         declaration.  Rename input_sections_ to input_shndxes_.
16668         * testsuite/many_sections_test.cc: Add template.
16669
16670 2008-04-30  Cary Coutant  <ccoutant@google.com>
16671
16672         * target-reloc.h (relocate_section): Fix dead-pointer bug.
16673
16674         * layout.cc (Layout::include_section): Refactored check for debug
16675         info section.
16676         (Layout::add_comdat): Add new parameters.  Change type
16677         of signature parameter.  Add object and shndx to signatures table.
16678         (Layout::find_kept_object): New function.
16679         * layout.h: Include <cstring>.
16680         (Layout::is_debug_info_section): New function.
16681         (Layout::add_comdat): Add new parameters.
16682         (Layout::find_kept_object): New function.
16683         (Layout::Kept_section): New struct.
16684         (Layout::Signatures): Change type of map range.
16685         * object.cc (Relobj::output_section_address): New function.
16686         (Sized_relobj::include_section_group): Add new parameters.  Change
16687         calls to Layout::add_comdat.  Change to build table of kept comdat
16688         groups and table mapping discarded sections to kept sections.
16689         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
16690         (Sized_relobj::do_layout): Change calls to include_section_group and
16691         include_linkonce_section.
16692         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
16693         value to zero when section is discarded.
16694         (Sized_relobj::map_to_kept_section): New function.
16695         * object.h (Relobj::output_section_address): New function.
16696         (Relobj::Comdat_group): New type.
16697         (Relobj::find_comdat_group): New function.
16698         (Relobj::Comdat_group_table): New type.
16699         (Relobj::Kept_comdat_section): New type.
16700         (Relobj::Kept_comdat_section_table): New type.
16701         (Relobj::add_comdat_group): New function.
16702         (Relobj::set_kept_comdat_section): New function.
16703         (Relobj::get_kept_comdat_section): New function.
16704         (Relobj::comdat_groups_): New field.
16705         (Relobj::kept_comdat_sections_): New field.
16706         (Symbol_value::input_value): Update comment.
16707         (Sized_relobj::map_to_kept_section) New function.
16708         (Sized_relobj::include_linkonce_section): Add new parameter.
16709         * target-reloc.h (Comdat_behavior): New type.
16710         (get_comdat_behavior): New function.
16711         (relocate_section): Add code to map a discarded section to the
16712         corresponding kept section when applying a relocation.
16713
16714 2008-04-30  Craig Silverstein  <csilvers@google.com>
16715
16716         * dwarf_reader.cc (next_generation_count): New static var.
16717         (Addr2line_cache_entry): New struct.
16718         (addr2line_cache): New static var.
16719         (Dwarf_line_info::one_addr2line): Added caching.
16720         (Dwarf_line_info::clear_addr2line_cache): New function.
16721         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
16722         cache-size parameter.
16723         (Dwarf_line_info::one_addr2line_cache): New function.
16724         * symtab.cc (Symbol_table::detect_odr_violations): Pass
16725         new cache-size argument to one_addr2line(), and clear cache.
16726
16727 2008-04-28  Cary Coutant  <ccoutant@google.com>
16728
16729         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
16730         R_386_PC8 relocations.
16731
16732 2008-04-23  Ian Lance Taylor  <iant@google.com>
16733
16734         * object.cc (Sized_relobj::include_section_group): Check for
16735         invalid section group.
16736
16737         * object.cc (make_elf_object): Correct test for 64-bit ELF file
16738         header size.
16739
16740         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
16741         than read for file header.
16742         * archive.cc (Archive::include_member): Likewise.
16743
16744 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
16745
16746         * aclocal.m4: Regenerate.
16747         * configure: Regenerate.
16748
16749 2008-04-19  Ian Lance Taylor  <iant@google.com>
16750
16751         * version.cc (version_string): Bump to 1.6.
16752
16753         * testsuite/Makefile.am (many_sections_r_test): New target.
16754         (many_sections_r_test_SOURCES): Remove.
16755         (many_sections_r_test_DEPENDENCIES): Remove.
16756         (many_sections_r_test_LDFLAGS): Remove.
16757         (many_sections_r_test_LDADD): Remove.
16758
16759         * object.cc (Sized_relobj::do_add_symbols): Always pass
16760         local_symbol_count_ to add_from_relobj.
16761
16762         * testsuite/Makefile.am (many_sections_check.h): Only check one in
16763         every thousand variables.
16764         * testsuite/Makefile.in: Rebuild.
16765
16766         * object.cc (Xindex::initialize_symtab_xindex): New function.
16767         (Xindex::read_symtab_xindex): New function.
16768         (Xindex::sym_xindex_to_shndx): New function.
16769         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
16770         available.
16771         (Sized_relobj::do_initialize_xindex): New function.
16772         (Sized_relobj::do_read_symbols): Adjust section links.
16773         (Sized_relobj::symbol_section_and_value): Add is_ordinary
16774         parameter.  Change all callers.
16775         (Sized_relobj::include_section_group): Adjust section links and
16776         symbol section indexes.
16777         (Sized_relobj::do_layout): Adjust section links.
16778         (Sized_relobj::do_count_local_symbols): Adjust section links and
16779         symbol section indexes.
16780         (Sized_relobj::do_finalize_local_symbols): Distinguish between
16781         ordinary and special symbols.
16782         (Sized_relobj::write_local_symbols): Add symtab_xindex and
16783         dynsym_xindex parameters.  Change all callers.  Adjust section
16784         links.  Use SHN_XINDEX when needed.
16785         (Sized_relobj::get_symbol_location_info): Adjust section links.
16786         Don't get fooled by special symbols.
16787         * object.h (class Xindex): Define.
16788         (class Object): Add xindex_ parameter.  Declare virtual functoin
16789         do_initialize_xindex.
16790         (Object::adjust_sym_shndx): New function.
16791         (Object::set_xindex): New protected function.
16792         (class Symbol_value): Add is_ordinary_shndx_ field.
16793         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
16794         (Symbol_value::value): Assert ordinary section.
16795         (Symbol_value::initialize_input_to_output_map): Likewise.
16796         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
16797         Change all callers.
16798         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
16799         all callers.
16800         (class Sized_relobj): Update declarations.
16801         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
16802         parameter.  Change all callers.
16803         (Sized_relobj::adjust_shndx): New function.
16804         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
16805         field.
16806         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
16807         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
16808         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
16809         (Sized_dynobj::read_dynsym_section): Adjust section links.
16810         (Sized_dynobj::read_dynamic): Likewise.
16811         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
16812         section links.
16813         (Sized_dynobj::do_initialize_xindex): New function.
16814         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
16815         do_initialize_xindex.
16816         (Sized_dynobj::adjust_shndx): New function.
16817         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
16818         dynsym_xindex_ fields.
16819         (Layout::finalize): Add a call to set_section_indexes before
16820         creating the symtab sections.
16821         (Layout::set_section_indexes): Don't do anything if the section
16822         already has a section index.
16823         (Layout::create_symtab_sections): Add shnum parameter.  Change
16824         caller.  Create .symtab_shndx section if needed.
16825         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
16826         caller.
16827         (Layout::allocated_output_section_count): New function.
16828         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
16829         needed.
16830         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
16831         fields.  Update declarations.
16832         (Layout::symtab_xindex): New function.
16833         (Layout::dynsym_xindex): New function.
16834         (class Write_symbols_task): Add layout_ field.
16835         (Write_symbols_task::Write_symbols_task): Add layout parameter.
16836         Change caller.
16837         * output.cc (Output_section_headers::Output_section_headers): Add
16838         shstrtab_section parameter.  Change all callers.
16839         (Output_section_headers::do_sized_write): Store overflow values
16840         for section count and section string table section index in
16841         section header zero.
16842         (Output_file_header::do_sized_write): Check for overflow of
16843         section count and section string table section index.
16844         (Output_symtab_xindex::do_write): New function.
16845         (Output_symtab_xindex::endian_do_write): New function.
16846         * output.h (class Output_section_headers): Add shstrtab_section_.
16847         Update declarations.
16848         (class Output_symtab_xindex): Define.
16849         (Output_section::has_out_shndx): New function.
16850         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
16851         field.
16852         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
16853         Change all callers.
16854         (Sized_symbol::init): Likewise.
16855         (Symbol::output_section): Check for ordinary symbol.
16856         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
16857         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
16858         callers.
16859         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
16860         Change all callers.  Simplify handling of symbols from sections
16861         not included in the link.
16862         (Symbol_table::add_from_dynobj): Handle ordinary symbol
16863         distinction.
16864         (Weak_alias_sorter::operator()): Assert that symbols are
16865         ordinary.
16866         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
16867         distinction.
16868         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
16869         parameters.  Change all callers.
16870         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
16871         symbol distinction.  Use SHN_XINDEX when needed.
16872         (Symbol_table::write_section_symbol): Add symtab_xindex
16873         parameter.  Change all callers.
16874         (Symbol_table::sized_write_section_symbol): Likewise.  Use
16875         SHN_XINDEX when needed.
16876         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
16877         declarations.
16878         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
16879         (Symbol::is_defined): Check is_ordinary.
16880         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
16881         (Symbol::is_absolute, Symbol::is_common): Likewise.
16882         (class Sized_symbol): Update declarations.
16883         (class Symbol_table): Update declarations.
16884         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
16885         parameters.  Change all callers.
16886         (Sized_symbol::override): Likewise.
16887         (Symbol_table::override): Likewise.
16888         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
16889         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
16890         is_ordinary, and orig_st_shndx parameters.  Change all callers.
16891         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
16892         to be in an ordinary section.
16893         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
16894         object and is_ordinary parameters.  Change all callers.
16895         (Sized_dwarf_line_info::read_relocs): Add object parameter.
16896         Change all callers.  Don't add undefined or non-ordinary symbols
16897         to reloc_map_.
16898         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
16899         Change all callers.
16900         * dwarf_reader.h (class Sized_dwarf_line_info): Update
16901         declarations.
16902         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
16903         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
16904         (Sized_relobj::relocate_sections): Likewise.
16905         * target-reloc.h (scan_relocs): Adjust section symbol index.
16906         (scan_relocatable_relocs): Likewise.
16907         * i386.cc (Scan::local): Check for ordinary symbols.
16908         * sparc.cc (Scan::local): Likewise.
16909         * x86_64.cc (Scan::local): Likewise.
16910         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
16911         to symbol_section_and_value.
16912         * testsuite/many_sections_test.cc: New file.
16913         * testsuite/Makefile.am (BUILT_SOURCES): Define.
16914         (check_PROGRAMS): Add many_sections_test.
16915         (many_sections_test_SOURCES): Define.
16916         (many_sections_test_DEPENDENCIES): Define.
16917         (many_sections_test_LDFLAGS): Define.
16918         (BUILT_SOURCES): Add many_sections_define.h.
16919         (many_sections_define.h): New target.
16920         (BUILT_SOURCES): Add many_sections_check.h.
16921         (many_sections_check.h): New target.
16922         (check_PROGRAMS): Add many_sections_r_test.
16923         (many_sections_r_test_SOURCES): Define.
16924         (many_sections_r_test_DEPENDENCIES): Define.
16925         (many_sections_r_test_LDFLAGS): Define.
16926         (many_sections_r_test_LDADD): Define.
16927         (many_sections_r_test.o): New target.
16928         * testsuite/Makefile.in: Rebuild.
16929
16930 2008-04-17  Cary Coutant  <ccoutant@google.com>
16931
16932         * errors.cc (Errors::info): New function.
16933         (gold_info): New function.
16934         * errors.h (Errors::info): New function.
16935         * gold.h (gold_info): New function.
16936         * object.cc (Input_objects::add_object): Print trace output.
16937         * options.cc (options::parse_set): New function.
16938         (General_options::parse_wrap): Deleted.
16939         (General_options::General_options): Deleted initializer.
16940         * options.h (options::String_set): New typedef.
16941         (options::parse_set): New function.
16942         (DEFINE_set): New macro.
16943         (General_options::wrap): Changed to use DEFINE_set. Changed
16944         callers of any_wrap_symbols and is_wrap_symbol.
16945         (General_options::trace, General_options::trace_symbol):
16946         New options.
16947         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
16948         (General_options::wrap_symbols_): Deleted.
16949         * symtab.cc (Symbol_table::add_from_object): Print trace output.
16950
16951 2008-04-17  David S. Miller  <davem@davemloft.net>
16952
16953         * options.cc (General_options::parse_V): New function.
16954         * options.h: Add entries for -V and -Qy.
16955
16956 2008-04-17  Ian Lance Taylor  <iant@google.com>
16957
16958         * common.cc (Symbol_table::allocate_commons): Remove options
16959         parameter.  Change caller.
16960         (Symbol_table::do_allocate_commons): Remove options parameter.
16961         Change caller.  Just call do_allocate_commons_list twice.
16962         (Symbol_table::do_allocate_commons_list): New function, broken out
16963         of do_allocate_commons.
16964         * common.h (class Allocate_commons_task): Remove options_ field.
16965         Update constructor.
16966         * symtab.cc (Symbol_table::Symbol_table): Initialize
16967         tls_commons_.
16968         (Symbol_table::add_from_object): Put TLS common symbols on
16969         tls_commons_ list.
16970         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
16971         which are IN_OUTPUT_DATA.
16972         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
16973         allocate_commons and do_allocate_commons declarations.  Declare
16974         do_allocate_commons_list.
16975         * gold.cc (queue_middle_tasks): Update creation of
16976         Allocate_commons_task to not pass options.
16977         * testsuite/Makefile.am (INCLUDES): Add -I.. .
16978         (TLS_TEST_C_FLAGS): New variable.
16979         (tls_test_c_pic.o): New target.
16980         (tls_test_shared.so): Link in tls_test_c_pic.o.
16981         (tls_test_c_pic_ie.o): New target.
16982         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
16983         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
16984         (tls_test_c.o): New target.
16985         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
16986         (tls_pic_test_LDADD): Likewise.
16987         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
16988         (tls_shared_gd_to_ie_test_LDADD): Likewise.
16989         (tls_test_c_gnu2.o): New target.
16990         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
16991         tls_test_c_gnu2.o.
16992         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
16993         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
16994         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
16995         * testsuite/tls_test.cc: Include "config.h".
16996         (t_last): Call t11_last.
16997         * testsuite/tls_test.h (t11, t11_last): Declare.
16998         * testsuite/tls_test_c.c: New file.
16999         * testsuite/tls_test_main.cc (thread_routine): Call t11.
17000         * configure.ac: Check for OpenMP support.
17001         * configure, config.in, Makefile.in: Rebuild.
17002         * testsuite/Makefile.in: Rebuild.
17003
17004 2008-04-16  Cary Coutant  <ccoutant@google.com>
17005
17006         * i386.cc (Target_i386::define_tls_base_symbol): New function.
17007         (Target_i386::tls_base_symbol_defined_): New field.
17008         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
17009         (Target_i386::Scan::global): Likewise.
17010         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
17011         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
17012         (Target_x86_64::tls_base_symbol_defined_): New field.
17013         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
17014         (Target_x86_64::Scan::global): Likewise.
17015
17016 2008-04-16  Cary Coutant  <ccoutant@google.com>
17017
17018         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
17019         (Symbol::needs_plt_entry): Allow weak undefined symbols.
17020         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
17021         building shared libraries.
17022         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
17023         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
17024         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
17025         * testsuite/Makefile.in: Rebuild.
17026         * testsuite/weak_undef.h: New file.
17027         * testsuite/weak_undef_file1.cc: Add extra test cases.
17028         * testsuite/weak_undef_file2.cc: Likewise.
17029         * testsuite/weak_undef_test.cc: Likewise.
17030
17031 2008-04-16  David S. Miller  <davem@davemloft.net>
17032
17033         * sparc.cc (Target_sparc::Scan): Change from struct to class.
17034         Add issued_non_pic_error_ field.  Declare check_non_pic.
17035         (Target_sparc::Scan::check_non_pic): New function.
17036         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
17037         (Target_sparc::Scan::global): Likewise.
17038
17039         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
17040         * configure: Rebuild.
17041
17042         * options.h (DEFINE_enable): New macro.
17043         (new_dtags): New enable option.
17044         (initfirst, interpose, loadfltr, nodefaultlib,
17045         nodelete, nodlopen, nodump): New -z options.
17046         * layout.cc (Layout:finish_dynamic_section): If new
17047         dtags enabled, emit DT_RUNPATH.  Also, emit a
17048         DT_FLAGS_1 containing any specified -z flags.
17049
17050 2008-04-16  Ian Lance Taylor  <iant@google.com>
17051
17052         * copy-relocs.cc: New file.
17053         * copy-relocs.h: New file.
17054         * reloc.cc: Remove Copy_relocs code.
17055         * reloc.h: Likewise.
17056         * reloc-types.h (struct Reloc_types) [both versions]: Add
17057         get_reloc_addend_noerror.
17058         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
17059         variants of add_global which take an addend which must be zero.
17060         * i386.cc: Include "copy-relocs.h".
17061         (class Target_i386): Change type of copy_relocs_ to variable,
17062         update initializer.
17063         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
17064         Change all callers.
17065         (Target_i386::do_finalize_sections): Change handling of
17066         copy_relocs_.
17067         * sparc.cc: Include "copy-relocs.h".
17068         (class Target_sparc): Change type of copy_relocs_ to variable,
17069         update initializer.
17070         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
17071         Change all callers.
17072         (Target_sparc::do_finalize_sections): Change handling of
17073         copy_relocs_.
17074         * x86_64.cc: Include "copy-relocs.h".
17075         (class Target_x86_64): Change type of copy_relocs_ to variable,
17076         update initializer.
17077         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
17078         class.  Change all callers.
17079         (Target_x86_64::do_finalize_sections): Change handling of
17080         copy_relocs_.
17081         * Makefile.am (CCFILES): Add copy-relocs.cc.
17082         (HFILES): Add copy-relocs.h.
17083
17084         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
17085
17086         * testsuite/script_test_4.sh: Permit leading zeroes.
17087
17088 2008-04-15  Ian Lance Taylor  <iant@google.com>
17089
17090         * script-sections.cc (Script_sections::create_segments): Use
17091         header_size_adjustment even when there is enough room for the
17092         headers.
17093         * testsuite/script_test_4.sh: New file.
17094         * testsuite/script_test_4.t: New file.
17095         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
17096         (check_DATA): Add script_test_4.stdout.
17097         (MOSTLYCLEANFILES): Likewise.
17098         (script_test_4): New target.
17099         (script_test_4.stdout): New target.
17100         * testsuite/Makefile.in: Rebuild.
17101
17102         * sparc.cc: Add definitions for Output_data_plt_sparc class
17103         constants.
17104
17105 2008-04-14  David S. Miller  <davem@davemloft.net>
17106
17107         * sparc.cc: New file.
17108         * Makefile.am (TARGETSOURCES): Add sparc.cc
17109         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
17110         * configure.tgt: Document targ_extra_size and
17111         targ_extra_big_endian.  Add entries for sparc-* and
17112         sparc64-*.
17113         * configure.ac: Handle targ_extra_size and
17114         targ_extra_big_endian.
17115         * Makefile.in: Rebuild.
17116         * configure: Likewise.
17117         * po/POTFILES.in: Likewise.
17118         * po/gold.pot: Likewise.
17119
17120 2008-04-14  Ian Lance Taylor  <iant@google.com>
17121
17122         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
17123         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
17124         in the name/type/flags to section mapping.  Don't call
17125         allocate_output_section.
17126         (Layout::choose_output_section): Change parameter from adjust_name
17127         to is_input_section.  Don't permit input sections after sections
17128         are attached to segments.  Don't call allocate_output_section.
17129         (Layout::layout_eh_frame): Call update_flags_for_input_section,
17130         not write_enable_output_section.
17131         (Layout::make_output_section): Don't push to
17132         unattached_section_list_ nor call attach_to_segment.  Call
17133         attach_section_to_segment if sections are attached.
17134         (Layout::attach_sections_to_segments): New function.
17135         (Layout::attach_section_to_segment): New function.
17136         (Layout::attach_allocated_section_to_segment): Rename from
17137         attach_to_segment.  Remove flags parameter.
17138         (Layout::allocate_output_section): Remove function.
17139         (Layout::write_enable_output_section): Remove function.
17140         * layout.h (class Layout): Update for above changes.  Add new
17141         field sections_are_attached_.
17142         * output.h (Output_section::update_flags_for_input_section): New
17143         function.
17144         * output.cc (Output_section::add_input_section): Call
17145         update_flags_for_input_section.
17146         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
17147
17148 2008-04-11  Cary Coutant  <ccoutant@google.com>
17149
17150         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
17151         thought unnecessary.
17152         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
17153
17154 2008-04-11  Ian Lance Taylor  <iant@google.com>
17155
17156         * output.h (class Output_section_data): Remove inline definition
17157         of set_addralign.
17158         * output.cc (Output_section_data::set_addralign): New function.
17159
17160 2008-04-11  Cary Coutant  <ccoutant@google.com>
17161
17162         Add support for TLS descriptors for i386 and x86_64.
17163         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
17164         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
17165         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
17166         GOT_TYPE_TLS_DESC.
17167         (Target_i386::got_mod_index_entry): Remove unnecessary code.
17168         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
17169         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
17170         relocations.
17171         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
17172         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
17173         Fix problem with initial-exec relocations.
17174         (Target_i386::Relocate::relocate_tls): Likewise.
17175         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
17176         relaxation.
17177         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
17178         support for section-plus-offset dynamic table entries.
17179         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
17180         (Output_data_dynamic::Dynamic_entry): Add support for
17181         section-plus-offset dynamic table entries.
17182         (Output_data_dynamic::Classification): Likewise.
17183         (Output_data_dynamic::classification_): Renamed offset_.
17184         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
17185         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
17186         (Target_x86_64::make_plt_section): New function.
17187         (Target_x86_64::reserve_tlsdesc_entries): New function.
17188         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
17189         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
17190         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
17191         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
17192         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
17193         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
17194         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
17195         add extra PLT entry for TLS descriptors.
17196         (Output_data_plt_x86_64::got_): New field.
17197         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
17198         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
17199         fields.
17200         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
17201         descriptors.
17202         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
17203         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
17204         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
17205         R_386_TLS_DESC_CALL relocations.
17206         (Target_x86_64::Scan::global): Likewise.
17207         (Target_x86_64::do_finalize_sections): Add dynamic table entries
17208         for TLS descriptors.
17209         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
17210         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
17211         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
17212         GD-to-IE relaxation.
17213         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
17214         and TLS_DESCRIPTORS.
17215         * Makefile.in: Rebuild.
17216         * configure: Rebuild.
17217         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
17218         (tls_test_shared2.so): New target.
17219         (tls_shared_gd_to_ie_test_SOURCES): New variable.
17220         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
17221         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
17222         (tls_shared_gd_to_ie_test_LDADD): New variable.
17223         (tls_shared_gnu2_gd_to_ie_test): New target.
17224         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
17225         New targets.
17226         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
17227         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
17228         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
17229         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
17230         (tls_shared_gnu2_test): New target.
17231         (tls_test_gnu2_shared.so): New target.
17232         (tls_shared_gnu2_test_SOURCES): New variable.
17233         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
17234         (tls_shared_gnu2_test_LDFLAGS): New variable.
17235         (tls_shared_gnu2_test_LDADD): New variable.
17236         * testsuite/Makefile.in: Rebuild.
17237         * testsuite/Makefile.
17238
17239 2008-04-11  Ian Lance Taylor  <iant@google.com>
17240
17241         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
17242         justsyms.t.
17243         * testsuite/Makefile.in: Rebuild.
17244
17245         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
17246         long.
17247         * testsuite/script_test_2.cc (main): Adjust test.
17248
17249 2008-04-11  David S. Miller  <davem@davemloft.net>
17250             Ian Lance Taylor  <iant@google.com>
17251
17252         * options.h (General_options): Add entries for '-Y' and
17253         '-relax'.
17254         * options.cc (General_options:finalize): If -Y was used, add those
17255         entries to the library path instead of the default "/lib" and
17256         "/usr/lib".
17257
17258 2008-04-11  David S. Miller  <davem@davemloft.net>
17259
17260         * testsuite/justsyms.t: Start at 0x100.
17261         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
17262         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
17263         long.
17264         * testsuite/script_test_2.cc: Adjust string and section length
17265         checks.
17266
17267 2008-04-09  Ian Lance Taylor  <iant@google.com>
17268
17269         PR gold/5996
17270         * script-sections.cc (Sections_element::allocate_to_segment): Add
17271         orphan parameter.
17272         (Output_section_definition::allocate_to_segment): Likewise.
17273         (Orphan_output_section::allocate_to_segment): Likewise.
17274         (Script_sections::attach_sections_using_phdrs_clause): Don't
17275         propagate non-PT_LOAD segments to orphan sections.
17276         * testsuite/Makefile.am (script_test_3.stdout): Generate using
17277         readelf rather than objdump.
17278         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
17279         .interp section and PT_INTERP segment are the same size.
17280         * testsuite/Makefile.in: Rebuild.
17281
17282         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
17283         aliases for symbols defined in the same object.
17284         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
17285         (weak_alias_test_SOURCES): New variable.
17286         (weak_alias_test_DEPENDENCIES): New variable.
17287         (weak_alias_test_LDFLAGS): New variable.
17288         (weak_alias_test_LDADD): New variable.
17289         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
17290         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
17291         (weak_alias_test_3.o): New target.
17292         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
17293         * testsuite/weak_alias_test_main.cc: New file.
17294         * testsuite/weak_alias_test_1.cc: New file.
17295         * testsuite/weak_alias_test_2.cc: New file.
17296         * testsuite/weak_alias_test_3.cc: New file.
17297
17298 2008-04-08  Ian Lance Taylor  <iant@google.com>
17299
17300         * options.h (class General_options): Add --noinhibit-exec option.
17301         * main.cc (main): Check --noinhibit-exec.
17302
17303         * options.h (class General_options): Define --wrap as a special
17304         option.  Add wrap_symbols_ field.
17305         (General_options::any_wrap_symbols): New function.
17306         (General_options::is_wrap_symbol): New function.
17307         * options.cc (General_options::parse_wrap): New function.
17308         (General_options::General_options): Initialize wrap_symbols_.
17309         * symtab.cc (Symbol_table::wrap_symbol): New function.
17310         (Symbol_table::add_from_object): Handle --wrap.
17311         * symtab.h (class Symbol_table): Declare wrap_symbol.
17312         * target.h (Target::wrap_char): New function.
17313         (Target::Target_info): Add wrap_char field.
17314         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
17315         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
17316         * testsuite/testfile.cc (Target_test::test_target_info):
17317         Likewise.
17318
17319         * errors.cc (Errors::undefined_symbol): Mention symbol version if
17320         there is one.
17321
17322         * layout.h (class Layout): Add added_eh_frame_data_ field.
17323         * layout.cc (Layout::Layout): Initialize new field.
17324         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
17325         output section until we find a section we merged successfully.
17326         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
17327         that the size be non-zero.
17328
17329         * merge.cc (Object_merge_map::get_output_offset): Remove inline
17330         qualifier.
17331
17332 2008-04-08  Craig Silverstein  <csilvers@google.com>
17333
17334         * configure.ac: Export new conditional variable HAVE_ZLIB.
17335         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
17336         on HAVE_ZLIB.
17337         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
17338         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17339
17340 2008-04-07  Ian Lance Taylor  <iant@google.com>
17341
17342         * version.cc (version_string): Set to "1.5".
17343
17344         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
17345         Add issued_non_pic_error_ field.  Declare check_non_pic.
17346         (Target_x86_64::Scan::check_non_pic): New function.
17347         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
17348         (Target_x86_64::Scan::global): Likewise.
17349
17350         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
17351         addend parameter.  Change caller.  Handle merge sections.
17352         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
17353         Address to Addend.  Don't add in the result of
17354         local_section_offset, pass down the addend and use the returned
17355         value.
17356         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
17357         Update declarations of local_section_offset and symbol_value.
17358         * testsuite/two_file_test_1.cc (t18): New function.
17359         * testsuite/two_file_test_2.cc (f18): New function.
17360         * testsuite/two_file_test_main.cc (main): Call t18.
17361         * testsuite/two_file_test.h (t18, f18): Declare.
17362
17363         * configure.ac: Don't test for objdump, c++filt, or readelf.
17364         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
17365         conditionals.
17366         (TEST_READELF): New variable.
17367         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
17368         (check_PROGRAMS): Add two_file_strip_test.
17369         (two_file_strip_test): New target.
17370         (check_PROGRAMS): Add two_file_same_shared_strip_test.
17371         (two_file_same_shared_strip_test_SOURCES): New variable.
17372         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
17373         (two_file_same_shared_strip_test_LDFLAGS): New variable.
17374         (two_file_same_shared_strip_test_LDADD): New variable.
17375         (two_file_shared_strip.so): New target.
17376         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
17377         (ver_test_5.syms, ver_test_7.syms): Likewise.
17378         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
17379         (strip_test_3.stdout): Use TEST_OBJDUMP.
17380         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17381
17382 2008-04-04  Cary Coutant  <ccoutant@google.com>
17383
17384         * symtab.h (Symbol::is_weak_undefined): New function.
17385         (Symbol::is_strong_undefined): New function.
17386         (Symbol::is_absolute): New function.
17387         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
17388         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
17389         absolute symbols.
17390         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
17391         (weak_undef_test): New target.
17392         * testsuite/Makefile.in: Rebuild.
17393         * testsuite/weak_undef_file1.cc: New file.
17394         * testsuite/weak_undef_file2.cc: New file.
17395         * testsuite/weak_undef_test.cc: New file.
17396
17397 2008-04-03  Craig Silverstein  <csilvers@google.com>
17398
17399         * compressed_output.h (class Output_compressed_section): Use
17400         unsigned buffer.
17401         * compressed_output.cc (zlib_compress): Use unsigned buffers,
17402         add zlib header.
17403         (zlib_compressed_suffix): Removed.
17404         (Output_compressed_section::set_final_data_size): Use unsigned
17405         buffers.
17406         * testsuite/Makefile.am (flagstest_compress_debug_sections):
17407         Fix linker invocation.
17408         (flagstest_o_specialfile_and_compress_debug_sections):
17409         Likewise.
17410         * testsuite/Makefile.in: Regenerated.
17411
17412 2008-04-02  David S. Miller  <davem@davemloft.net>
17413
17414         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
17415         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
17416
17417 2008-04-02  Craig Silverstein  <csilvers@google.com>
17418
17419         * TODO: New file.
17420
17421 2008-04-02  Ian Lance Taylor  <iant@google.com>
17422
17423         * fileread.cc (File_read::find_view): Add byteshift and vshifted
17424         parameters.  Update for new key type to views_.  Change all
17425         callers.
17426         (File_read::read): Adjust for byteshift in returned view.
17427         (File_read::add_view): New function, broken out of
17428         find_and_make_view.
17429         (File_read::make_view): New function, broken out of
17430         find_and_make_view.
17431         (File_read::find_or_make_view): Add offset and aligned
17432         parameters.  Rewrite accordingly.  Change all callers.
17433         (File_read::get_view): Add offset and aligned parameters.  Adjust
17434         for byteshift in return value.
17435         (File_read::get_lasting_view): Likewise.
17436         * fileread.h (class File_read): Update declarations.
17437         (class File_read::View): Add byteshift_ field.  Add byteshift to
17438         constructor.  Add byteshift method.
17439         * archive.h (Archive::clear_uncached_views): New function.
17440         (Archive::get_view): Add aligned parameter.  Change all callers.
17441         * object.h (Object::get_view): Add aligned parameter.  Change all
17442         callers.
17443         (Object::get_lasting_view): Likewise.
17444
17445         * fileread.cc (File_read::release): Don't call clear_views if
17446         there are multiple objects.
17447         * fileread.h (File_read::clear_uncached_views): New function.
17448         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
17449         on the archive.
17450
17451 2008-03-31  Cary Coutant  <ccoutant@google.com>
17452
17453         Add thin archive support.
17454         * archive.cc (Archive::armagt): New const.
17455         (Archive::setup): Remove task parameter and calls to unlock.
17456         (Archive::unlock_nested_archives): New function.
17457         (Archive::read_header): Add nested_off parameter. Change
17458         all callers.
17459         (Archive::interpret_header): Likewise.
17460         (Archive::include_all_members): Change to handle thin
17461         archives.
17462         (Archive::include_member): Likewise.
17463         * archive.h (Archive::Archive): Add new parameters and
17464         initializers.
17465         (Archive::armagt): New const.
17466         (Archive::setup): Remove task parameter.
17467         (Archive::unlock_nested_archives): New function.
17468         (Archive::read_header): Add nested_off parameter.
17469         (Archive::interpret_header): Likewise.
17470         (Archive::Nested_archive_table): New typedef.
17471         (Archive::is_thin_archive_): New field.
17472         (Archive::nested_archives_): New field.
17473         (Archive::options_): New field.
17474         (Archive::dirpath_): New field.
17475         (Archive::task_): New field.
17476         * readsyms.cc (Read_symbols::do_read_symbols): Add check
17477         for thin archives.  Pass additional parameters to
17478         Archive::Archive.  Unlock the archive file after calling
17479         Archive::setup.
17480
17481 2008-03-29  Ian Lance Taylor  <iant@google.com>
17482
17483         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
17484         version symbol to be local.
17485         * testsuite/ver_test_4.sh: New file.
17486         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
17487         (check_DATA): Add ver_test_4.syms.
17488         (ver_test_4.syms): New target.
17489         * testsuite/Makefile.in: Rebuild.
17490
17491         * output.cc
17492         (Output_section::Input_section_sort_entry::has_priority): New
17493         function.
17494         (Output_section::Input_section_sort_entry::match_file_name): New
17495         function.
17496         (Output_section::Input_section_sort_entry::match_section_name):
17497         Remove.
17498         (Output_section::Input_section_sort_entry::match_section_name_prefix):
17499         Remove.
17500         (Output_section::Input_section_sort_entry::match_section_file):
17501         Remove.
17502         (Output_section::Input_section_sort_compare::operator()): Rewrite
17503         using new Input_section_sort_entry functions.  Sort crtbegin and
17504         crtend first.  Sort sections with no priority before sections with
17505         a priority.
17506         * testsuite/initpri1.c (d3): Check j != 4.
17507         (cd5): New constructor/destructor function.
17508         (main): Check j != 2.
17509
17510         * symtab.cc (Symbol_table::add_from_object): If we don't use the
17511         new symbol when resolving, don't call set_is_default.
17512         * testsuite/ver_test_7.cc: New file.
17513         * testsuite/ver_test_7.sh: New file.
17514         * testsuite/Makefile.am (ver_test_7.so): New target.
17515         (ver_test_7.o): New target.
17516         (check_SCRIPTS): Add ver_test_7.sh.
17517         (check_DATA): Add ver_test_7.syms.
17518         (ver_test_7.syms): New target.
17519
17520 2008-03-28  Ian Lance Taylor  <iant@google.com>
17521
17522         * layout.cc (Layout::layout): If we see an input section with a
17523         name that needs sorting, set the must_sort flag for the output
17524         section.
17525         (Layout::make_output_section): If the name of the output section
17526         indicates that it might require sorting, set the may_sort flag.
17527         * output.h (Output_section::may_sort_attached_input_sections): New
17528         function.
17529         (Output_section::set_may_sort_attached_input_sections): New
17530         function.
17531         (Output_section::must_sort_attached_input_sections): New
17532         function.
17533         (Output_section::set_must_sort_attached_input_sections): New
17534         function.
17535         (class Output_section): Declare Input_section_sort_entry.  Define
17536         Input_section_sort_compare.  Declare
17537         sort_attached_input_sections.  Add new fields:
17538         may_sort_attached_input_sections_,
17539         must_sort_attached_input_sections_,
17540         attached_input_sections_are_sorted_.
17541         * output.cc (Output_section::Output_section): Initialize new
17542         fields.
17543         (Output_section::add_input_section): Add an entry to
17544         input_sections_ if may_sort or must_sort are true.
17545         (Output_section::set_final_data_size): Call
17546         sort_attached_input_sections if necessary.
17547         (Output_section::Input_section_sort_entry): Define new class.
17548         (Output_section::Input_section_sort_compare::operator()): New
17549         function.
17550         (Output_section::sort_attached_input_sections): New function.
17551         * configure.ac: Check whether the compiler supports constructor
17552         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
17553         * testsuite/initpri1.c: New file.
17554         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
17555         CONSTRUCTOR_PRIORITY.
17556         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
17557         (initpri1_LDFLAGS): New variable.
17558         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17559
17560 2008-03-27  Ian Lance Taylor  <iant@google.com>
17561
17562         * common.cc (Sort_commons::operator): Correct sorting algorithm.
17563         * testsuite/common_test_1.c: New file.
17564         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
17565         (common_test_1_SOURCES): New variable.
17566         (common_test_1_DEPENDENCIES): New variable.
17567         (common_test_1_LDFLAGS): New variable.
17568
17569         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
17570         and commons_ correctly when NAME/VERSION does not override
17571         NAME/NULL.
17572         * testsuite/ver_test_6.c: New file.
17573         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
17574         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
17575         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
17576
17577 2008-03-26  Ian Lance Taylor  <iant@google.com>
17578
17579         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
17580         of an undefined symbol from a version script.
17581         * testsuite/Makefile.am (ver_test_5.so): New target.
17582         (ver_test_5.o): New target.
17583         (check_SCRIPTS): Add ver_test_5.sh.
17584         (check_DATA): Add ver_test_5.syms.
17585         (ver_test_5.syms): New target.
17586         * testsuite/ver_test_5.cc: New file.
17587         * testsuite/ver_test_5.script: New file.
17588         * testsuite/ver_test_5.sh: New file.
17589         * Makefile.in, testsuite/Makefile.in: Rebuild.
17590
17591         PR gold/5986
17592         Fix problems building gold with gcc 4.3.0.
17593         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
17594         (gold_error_at_location, gold_warning_at_location): Use it.
17595         * configure.ac: Check whether we can compile and use a template
17596         function with a printf attribute.
17597         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
17598         when jumping over bytes.
17599         * object.cc: Instantiate Object::read_section_data.
17600         * debug.h: Include <cstring>
17601         * dwarf_reader.cc: Include <algorithm>
17602         * main.cc: Include <cstring>.
17603         * options.cc: Include <cstring>.
17604         * output.cc: Include <cstring>.
17605         * script.cc: Include <cstring>.
17606         * script.h: Include <string>.
17607         * symtab.cc: Include <cstring> and <algorithm>.
17608         * target-select.cc: Include <cstring>.
17609         * version.cc: Include <string>.
17610         * testsuite/testmain.cc: Include <cstdlib>.
17611         * configure, config.in: Rebuild.
17612
17613 2008-03-25  Ian Lance Taylor  <iant@google.com>
17614
17615         * options.cc: Include "../bfd/bfdver.h".
17616         (options::help): Print bug reporting address.
17617
17618         * version.cc (print_version): Adjust output for current value of
17619         BFD_VERSION_STRING.
17620
17621         * NEWS: New file.
17622
17623         * options.cc (options::help): Print list of supported targets.
17624         * target-select.h: Include <vector>.
17625         (class Target_selector): Make machine_, size_, and is_big_endian_
17626         fields const.  Add bfd_name_ and instantiated_target_ fields.
17627         (Target_selector::Target_selector): Add bfd_name parameter.
17628         (Target_selector::recognize): Make non-virtual, call
17629         do_recognize.
17630         (Target_selector::recognize_by_name): Make non-virtual, call
17631         do_recognize_by_name.
17632         (Target_selector::supported_names): New function.
17633         (Target_selector::bfd_name): New function.
17634         (Target_selector::do_instantiate_target): New pure virtual
17635         function.
17636         (Target_selector::do_recognize): New virtual function.
17637         (Target_selector::do_recognize_by_name): New virtual function.
17638         (Target_selector::instantiate_target): New private function.
17639         (supported_target_names): Declare.
17640         * target-select.cc (Target_selector::Target_selector): Update for
17641         new parameter and fields.
17642         (select_target_by_name): Check that the name matches before
17643         calling recognize_by_name.
17644         (supported_target_names): New function.
17645         * i386.cc (class Target_selector_i386): Update Target_selector
17646         constructor call.  Remove recognize and recognize_by_name.  Add
17647         do_instantiate_target.
17648         * x86_64.cc (class Target_selector_x86_64): Likewise.
17649         * testsuite/testfile.cc (class Target_selector_test): Update for
17650         changes to Target_selector.
17651
17652         * README: Rewrite, with some notes on unsupported features.
17653
17654 2008-03-24  Cary Coutant  <ccoutant@google.com>
17655
17656         * i386.cc (Target_i386::Got_type): New enum declaration.
17657         (Target_i386::Scan::local): Updated callers of Output_data_got
17658         member functions.
17659         (Target_i386::Scan::global): Likewise.
17660         (Target_i386::Relocate::relocate): Likewise.
17661         (Target_i386::Relocate::relocate_tls): Likewise.
17662         * object.h (Got_offset_list): New class.
17663         (Sized_relobj::local_has_got_offset): Added got_type parameter.
17664         (Sized_relobj::local_got_offset): Likewise.
17665         (Sized_relobj::set_local_got_offset): Likewise.
17666         (Sized_relobj::local_has_tls_got_offset): Removed.
17667         (Sized_relobj::local_tls_got_offset): Removed.
17668         (Sized_relobj::set_local_tls_got_offset): Removed.
17669         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
17670         * output.cc (Output_data_got::add_global): Added got_type parameter.
17671         (Output_data_got::add_global_with_rel): Likewise.
17672         (Output_data_got::add_global_with_rela): Likewise.
17673         (Output_data_got::add_global_pair_with_rel): New function.
17674         (Output_data_got::add_global_pair_with_rela): New function.
17675         (Output_data_got::add_local): Added got_type parameter.
17676         (Output_data_got::add_local_with_rel): Likewise.
17677         (Output_data_got::add_local_with_rela): Likewise.
17678         (Output_data_got::add_local_pair_with_rel): New function.
17679         (Output_data_got::add_local_pair_with_rela): New function.
17680         (Output_data_got::add_global_tls): Removed.
17681         (Output_data_got::add_global_tls_with_rel): Removed.
17682         (Output_data_got::add_global_tls_with_rela): Removed.
17683         (Output_data_got::add_local_tls): Removed.
17684         (Output_data_got::add_local_tls_with_rel): Removed.
17685         (Output_data_got::add_local_tls_with_rela): Removed.
17686         * output.h (Output_data_got::add_global): Added got_type parameter.
17687         (Output_data_got::add_global_with_rel): Likewise.
17688         (Output_data_got::add_global_with_rela): Likewise.
17689         (Output_data_got::add_global_pair_with_rel): New function.
17690         (Output_data_got::add_global_pair_with_rela): New function.
17691         (Output_data_got::add_local): Added got_type parameter.
17692         (Output_data_got::add_local_with_rel): Likewise.
17693         (Output_data_got::add_local_with_rela): Likewise.
17694         (Output_data_got::add_local_pair_with_rel): New function.
17695         (Output_data_got::add_local_pair_with_rela): New function.
17696         (Output_data_got::add_global_tls): Removed.
17697         (Output_data_got::add_global_tls_with_rel): Removed.
17698         (Output_data_got::add_global_tls_with_rela): Removed.
17699         (Output_data_got::add_local_tls): Removed.
17700         (Output_data_got::add_local_tls_with_rel): Removed.
17701         (Output_data_got::add_local_tls_with_rela): Removed.
17702         * resolve.cc (Symbol::override_base_with_special): Removed
17703         reference to has_got_offset_ field.
17704         * symtab.cc (Symbol::init_fields): Replaced initialization
17705         of got_offset_ with got_offsets_.  Removed initialization
17706         of has_got_offset_
17707         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
17708         (Symbol::got_offset): Likewise.
17709         (Symbol::set_got_offset): Likewise.
17710         (Symbol::has_tls_got_offset): Removed.
17711         (Symbol::tls_got_offset): Removed.
17712         (Symbol::set_tls_got_offset): Removed.
17713         (Symbol::got_offset_): Removed.
17714         (Symbol::tls_mod_got_offset_): Removed.
17715         (Symbol::tls_pair_got_offset_): Removed.
17716         (Symbol::got_offsets_): New field.
17717         (Symbol::has_got_offset): Removed.
17718         (Symbol::has_tls_mod_got_offset): Removed.
17719         (Symbol::has_tls_pair_got_offset): Removed.
17720         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
17721         (Target_x86_64::Scan::local): Updated callers of Output_data_got
17722         member functions.
17723         (Target_x86_64::Scan::global): Likewise.
17724         (Target_x86_64::Relocate::relocate): Likewise.
17725         (Target_x86_64::Relocate::relocate_tls): Likewise.
17726
17727 2008-03-25  Ben Elliston  <bje@au.ibm.com>
17728
17729         * yyscript.y: Fix spelling error in comment.
17730
17731 2008-03-24  Ian Lance Taylor  <iant@google.com>
17732
17733         * options.h (class General_options): Define build_id option.
17734         * layout.h (class Layout): Declare write_build_id, create_note,
17735         create_build_id.  Add build_id_note_ member.
17736         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
17737         "libiberty.h", "md5.h", "sha1.h".
17738         (Layout::Layout): Initialize eh_frame_data_,
17739         eh_frame_hdr_section_, and build_id_note_.
17740         (Layout::finalize): Call create_build_id.
17741         (Layout::create_note): New function, broken out of
17742         Layout::create_gold_note.
17743         (Layout::create_gold_note): Call create_note.
17744         (Layout::create_build_id): New function.
17745         (Layout::write_build_id): New function.
17746         (Close_task_runner::run): Call write_build_id.
17747
17748         * x86_64.cc: Correct license to GPLv3.
17749
17750 2008-03-23  Ian Lance Taylor  <iant@google.com>
17751
17752         * options.cc: Include "demangle.h".
17753         (parse_optional_string): New function.
17754         (parse_long_option): Handle takes_optional_argument.
17755         (parse_short_option): Update dash_z initializer.  Handle
17756         takes_optional_argument.
17757         (General_options::General_options): Initialize do_demangle_.
17758         (General_options::finalize): Set do_demangle_.  Handle demangling
17759         style.
17760         * options.h (parse_optional_string): Declare.
17761         (struct One_option): Add optional_arg field.  Update constructor.
17762         Update call constructor calls.  Add takes_optional_argument
17763         function.
17764         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
17765         (DEFINE_optional_string): Define.
17766         (General_options::demangle): Change from DEFINE_bool to
17767         DEFINE_optional_string.
17768         (General_options::no_demangle): New function.
17769         (General_options::do_demangle): New function.
17770         (General_options::set_do_demangle): New function.
17771         (General_options::execstack_status_): Move definition to end of
17772         class definition.
17773         (General_options::static_): Likewise.
17774         (General_options::do_demangle_): New field.
17775         * object.cc (big_endian>::get_symbol_location_info): Call
17776         Options::do_demangle, not Options::demangle.
17777         * symtab.cc (demangle): Likewise.
17778
17779 2008-03-22  Ian Lance Taylor  <iant@google.com>
17780
17781         * gold.h: Include <cstddef> and <sys/types.h>
17782         * options.h: Include <cstring>.
17783
17784 2008-03-21  Ian Lance Taylor  <iant@google.com>
17785
17786         * Added source code to GNU binutils.
17787 \f
17788 Copyright (C) 2008-2015 Free Software Foundation, Inc.
17789
17790 Copying and distribution of this file, with or without modification,
17791 are permitted in any medium without royalty provided the copyright
17792 notice and this notice are preserved.
17793
17794 Local Variables:
17795 mode: change-log
17796 left-margin: 8
17797 fill-column: 74
17798 version-control: never
17799 End: