[GOLD] PowerPC style fix
[external/binutils.git] / gold / ChangeLog
1 2015-12-09  Alan Modra  <amodra@gmail.com>
2
3         * powerpc.cc (Target_powerpc::Relocate::relocate): New constant
4         d_offset.  Use throughout.
5         (Target_powerpc::relocate_relocs): Likewise.
6
7 2015-12-09  Alan Modra  <amodra@gmail.com>
8
9         * powerpc.cc (Target_powerpc::Relocate::relocate): Edit ELFv2
10         entry code.
11         (Target_powerpc::relocate_relocs): Edit relocs to suit.
12
13 2015-12-09  Alan Modra  <amodra@gmail.com>
14
15         * object.h (struct Relocate_info): Add "rr".
16         * reloc.h (Relocatable_relocs::set_strategy): New accessor.
17         * reloc.cc (Sized_relobj_file::do_relocate_sections): Init
18         relinfo.rr for relocate_section and relocate_relocs.
19         * powerpc.cc (relocate): Add rel_type and preloc parameters.
20         Delete rela and r_type params, instead recalculate these from
21         preloc.
22         (relocate_relocs): Delete Relocatable_relocs* param, instead
23         use relinfo->rr.
24         * aarch64.cc: Likewise.
25         * arm.cc: Likewise.
26         * i386.cc: Likewise.
27         * mips.cc: Likewise.
28         * s390.cc: Likewise.
29         * sparc.cc: Likewise.
30         * target.h: Likewise.
31         * tilegx.cc: Likewise.
32         * x86_64.cc: Likewise.
33         * testsuite/testfile.cc: Likewise.
34         * target-reloc.h (relocate_section): Adjust to suit.
35         (apply_relocation, relocate_relocs): Likewise.
36
37 2015-12-07  Alan Modra  <amodra@gmail.com>
38
39         * powerpc.cc (add_2_2_12, ld_2_12, lis_2): Define.
40         (Target_powerpc::Scan::local, global): Handle R_PPC64_ENTRY.
41         (Target_powerpc::Relocate::relocate): Edit code at R_PPC64_ENTRY.
42
43 2015-12-03  Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
44
45         * object.cc (Sized_relobj::do_for_all_local_got_entries): Use
46         Local_got_entry_key for searching in local_got_offsets_.
47         * object.h (class Local_got_entry_key): New class.
48         (Relobj::local_has_got_offset): New overloaded method.
49         (Relobj::local_got_offset): Likewise.
50         (Relobj::set_local_got_offset): Likewise.
51         (Relobj::do_local_has_got_offset): Add addend argument.
52         (Relobj::do_local_got_offset): Likewise.
53         (Relobj::do_set_local_got_offset): Likewise.
54         (Sized_relobj::do_local_has_got_offset): Add addend argument, and use
55         Local_got_entry_key for searching through local_got_offsets_.
56         (Sized_relobj::do_local_got_offset): Likewise.
57         (Sized_relobj::do_set_local_got_offset): Likewise.
58         (Sized_relobj::Local_got_offsets): Change type of the key from
59         unsigned int to Local_got_entry_key, and add hash and equal_to.
60         * output.cc (Got_entry::write): Take addend into account for
61         calculating value of the local symbol for GOT.
62         (Output_data_got::add_local): New definition of overloaded method.
63         (Output_data_got::add_local_with_rel): Likewise.
64         (Output_data_got::add_local_pair_with_rel): Likewise.
65         * output.h (Output_data_got::add_local): New declaration of overloaded
66         method.
67
68 2015-11-25  Cary Coutant  <ccoutant@gmail.com>
69
70         PR gold/19291
71         * object.cc (Sized_relobj_file::write_local_symbols): If relocatable,
72         subtract section address from symbol value.
73
74 2015-11-25  Alan Modra  <amodra@gmail.com>
75
76         * powerpc.cc (Output_data_got_powerpc::Output_data_got_powerpc): Align
77         to 256 byte boundary.
78
79 2015-11-19  Alan Modra  <amodra@gmail.com>
80
81         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): Correct
82         GOT16 and TOC16 relocs to RELATIVE_REF.
83
84 2015-11-14  Cary Coutant  <ccoutant@gmail.com>
85
86         PR gold/19244
87         PR gold/18548
88         * symtab.cc (Symbol_table::do_define_in_output_data): Check for forced
89         local symbols only for predefined symbols.
90
91 2015-11-11  Alan Modra  <amodra@gmail.com>
92             Peter Bergner <bergner@vnet.ibm.com>
93
94         * gold/powerpc.cc (Powerpc_relocate_functions::addr16_dq): New function.
95         (Powerpc_relocate_functions::addr16dx_ha): Likewise.
96         (Target_powerpc::Scan::local): Handle R_POWERPC_REL16DX_HA.
97         (Target_powerpc::Scan::global): Likewise.
98         (Target_powerpc::Relocate::relocate): Likewise.
99
100 2015-11-09  Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
101
102         * layout.h (Layout::is_debug_info_section): Recognize .pdr debug
103         sections.
104
105 2015-11-09  Cary Coutant  <ccoutant@gmail.com>
106             Vladimir Radosavljevic <Vladimir.Radosavljevic@imgtec.com>
107
108         * copy-relocs.h (Copy_relocs::copy_reloc): Replace reloc parameter
109         with type, offset, addend.
110         (Copy_relocs::save): Likewise.
111         * copy-relocs.cc (Copy_relocs::copy_reloc): Likewise.
112         (Copy_relocs::save): Likewise.
113         * aarch64.cc (Target_aarch64::copy_reloc): Pass r_type, r_offset,
114         and r_addend to Copy_relocs::copy_reloc.
115         * arm.cc (Target_arm::copy_reloc): Likewise.
116         * i386.cc (Target_i386::copy_reloc): Likewise.
117         * mips.cc (Target_mips::copy_reloc): Likewise.
118         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
119         * s390.cc (Target_s390::copy_reloc): Likewise.
120         * sparc.cc (Target_sparc::copy_reloc): Likewise.
121         * tilegx.cc (Target_tilegx::copy_reloc): Likewise.
122         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
123
124 2015-11-05  Cary Coutant  <ccoutant@gmail.com>
125
126         PR gold/19119
127         PR gold/19172
128         PR gold/19197
129         Revert commit 6457197210144f50a696097c0d308d81d46d5510:
130         2015-10-16  H.J. Lu  <hongjiu.lu@intel.com>
131                 * options.h (General_options): Remove "obsolete" from -m.
132                 * parameters.cc (set_parameters_target): Check if input target
133                 is compatible with output emulation set by "-m emulation".
134
135 2015-11-05  Cary Coutant  <ccoutant@gmail.com>
136
137         PR gold/19163
138         * aarch64.cc (Target_aarch64::Relocate::relocate): Don't apply
139         certain relocations if --no-apply-dynamic-relocs is set.
140         * options.h (--apply-dynamic-relocs): New aarch64-specific option.
141
142 2015-11-03  Alan Modra  <amodra@gmail.com>
143
144         * po/POTFILES.in: Regenerate.
145
146 2015-10-30  Nick Clifton  <nickc@redhat.com>
147
148         * po/zh_CN.po: New (simplified) Chinese translation.
149
150 2015-10-29  H.J. Lu  <hongjiu.lu@intel.com>
151
152         PR gold/19184
153         * incremental.cc (Got_plt_view_info): Add got_entry_size.
154         (Local_got_offset_visitor::visit): Replace got_entry_size_
155         with info_.got_entry_size.
156         (Local_got_offset_visitor::got_entry_size_): Removed.
157         (Global_got_offset_visitor::visit): Replace got_entry_size_
158         with info_.got_entry_size.
159         (Global_got_offset_visitor::got_entry_size_): Removed.
160         (Output_section_incremental_inputs::write_got_plt): Initialize
161         view_info.got_entry_size.
162         * target.h (Sized_target::got_entry_size): New virtual function.
163         * x86_64.cc (Target_x86_64::got_entry_size): New function.
164
165 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
166
167         * testsuite/binary_test.cc: Add __attribute__((aligned(1))).
168         * testsuite/script_test_12a.c: Likewise.
169         * testsuite/script_test_1a.cc: Likewise.
170         * testsuite/script_test_2.cc: Likewise.
171
172 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
173
174         * testsuite/debug_msg.sh: Accept more fuzz in line numbers.
175
176 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
177
178         PR gold/18959
179         * stringpool.cc (Stringpool_template::new_key_offset): Align all
180         strings, even zero-length.
181         (Stringpool_template::set_string_offsets): Likewise.
182
183 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
184
185         * s390.cc: New file.
186         * Makefile.am (TARGETSOURCES): Add s390.cc.
187         (ALL_TARGETOBJS): Add s390.o.
188         * Makefile.in: Regenerate.
189         * configure.ac: Add s390 support.
190         * configure: Regenerate.
191         * configure.tgt: Add s390-*-* and s390x-*-*.
192         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Add s390
193         support.
194
195 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
196
197         * archive.cc (Archive::sym64name): New const.
198         (Archive::setup): Add support for SYM64 armap.
199         (Archive::read_armap): Likewise.
200         (Archive::interpret_header): Likewise.
201         (Archive::const_iterator::read_next_header): Likewise.
202         * archive.h (Archive::sym64name): New const.
203         (Archive::read_armap): Add mapsize template parameter.
204
205 2015-10-28  Marcin Kościelnicki  <koriakin@0x04.net>
206
207         * dynobj.cc (Dynobj::create_elf_hash_table): Create hash table with
208         target-specific entry size.
209         (Dynobj::sized_create_elf_hash_table): Add size template parameter.
210         * dynobj.h (Dynobj::sized_create_elf_hash_table): Likewise.
211         * layout.cc (Layout::create_dynamic_symtab): Set entsize to
212         hash_entry_size.
213         * target.h (Target::hash_entry_size): New method.
214         (Target::Target_info::hash_entry_size): New data member.
215
216         * aarch64.cc (Target_aarch64::aarch64_info): Add hash_entry_size.
217         * arm.cc (Target_arm::arm_info): Likewise.
218         (Target_arm_nacl::arm_nacl_info): Likewise.
219         * i386.cc (Target_i386::i386_info): Likewise.
220         (Target_i386_nacl::i386_nacl_info): Likewise.
221         (Target_iamcu::iamcu_info): Likewise.
222         * mips.cc (Target_mips::mips_info): Likewise.
223         (Target_mips_nacl::mips_nacl_info): Likewise.
224         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
225         * sparc.cc (Target_sparc::sparc_info): Likewise.
226         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
227         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
228         (Target_x86_64_nacl::x86_64_nacl_info): Likewise.
229         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
230
231 2015-10-28  H.J. Lu  <hongjiu.lu@intel.com>
232
233         PR gold/19177
234         * i386.cc (Target_i386::Relocate::relocate): Check R_386_GOT32
235         and R_386_GOT32X relocations without base register.
236
237 2015-10.27  Han Shen  <shenhan@google.com>
238
239         PR gold/19042 - unsupported reloc 311/312.
240
241         * aarch64.cc (Target_aarch64::Scan::local): Add support for
242         reloc 311/312.
243
244 2015-10-22  H.J. Lu  <hongjiu.lu@intel.com>
245
246         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
247         Treat R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX the same
248         as R_X86_64_GOTPCREL.
249         (Target_x86_64<size>::Scan::local): Likewise.
250         (Target_x86_64<size>::Scan::possible_function_pointer_reloc):
251         Likewise.
252         (Target_x86_64<size>::Scan::global): Likewise.
253         (Target_x86_64<size>::Relocate::relocate): Likewise.
254         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
255         Likewise.
256
257 2015-10-22  H.J. Lu  <hongjiu.lu@intel.com>
258
259         * i386.cc (Target_i386::Scan::get_reference_flags(): Treat
260         R_386_GOT32X the same as R_386_GOT32.
261         (Target_i386::Scan::local): Likewise.
262         (Target_i386::Scan::possible_function_pointer_reloc): Likewise.
263         (Target_i386::Scan::global): Likewise.
264         (Target_i386::Relocate::relocate): Likewise.
265         (Target_i386::Relocatable_size_for_reloc::get_size_for_reloc):
266         Likewise.
267
268 2015-10-20  H.J. Lu  <hongjiu.lu@intel.com>
269
270         * testsuite/Makefile.am (x86_64_mov_to_lea11): Replace
271         x86_64_mov_to_lea1.o with x86_64_mov_to_lea2.o.
272         (x86_64_mov_to_lea12): Replace x86_64_mov_to_lea2.o with
273         x86_64_mov_to_lea1.o.
274         * testsuite/Makefile.in: Regenerated.
275
276 2015-10-16  H.J. Lu  <hongjiu.lu@intel.com>
277
278         PR gold/19119
279         * options.h (General_options): Remove "obsolete" from -m.
280         * parameters.cc (set_parameters_target): Check if input target
281         is compatible with output emulation set by "-m emulation".
282
283 2015-10-13  H.J. Lu  <hongjiu.lu@intel.com>
284
285         PR gold/19118
286         * i386.cc (Target_iamcu): New class.
287         (Target_selector_iamcu): Likewise.
288         (Target_iamcu::iamcu_info): New variable.
289         (target_selector_iamcu): Likewise.
290
291 2015-10-07  Andreas Schwab  <schwab@suse.de>
292
293         * aarch64.cc (aarch64_info): Set abi_pagesize to 64K.
294
295 2015-10-06  Cary Coutant  <ccoutant@gmail.com>
296
297         PR gold/18855
298         * sparc.cc (Sparc_relocate_functions::gdop_hix22): Remove addend
299         parameter.
300         (Sparc_relocate_functions::gdop_lox10): Likewise.
301         (Target_sparc::Relocate::relocate): Use addend when computing
302         symbol value for R_SPARC_GOTDATA_OP*.
303
304 2015-09-07  Cary Coutant  <ccoutant@gmail.com>
305
306         PR gold/18930
307         PR gold/18886
308         * resolve.cc (Symbol::override_base): Don't convert IFUNC symbols here.
309         * symtab.cc (Symbol_table::add_from_dynobj): Convert them here instead.
310
311 2015-09-02  H.J. Lu  <hongjiu.lu@intel.com>
312
313         PR gold/18886
314         * resolve.cc (Symbol::override_base): Turn IFUNC symbols from
315         shared libraries into normal FUNC symbols.
316         * symtab.cc (Symbol_table::sized_write_symbol): Assert IFUNC
317         symbols aren't from shared libraries.
318
319 2015-09-02  Alan Modra  <amodra@gmail.com>
320
321         PR 18878
322         * powerpc.cc (Target_powerpc): Add savres_section_ and accessor.
323         (Target_powerpc::Branch_info::make_stub): Determine whether long
324         branch stub is for save/restore function.
325         (Branch_stub_ent): Add save_res_, and extra parm to constructor.
326         (Stub_table): Add need_save_res_.
327         (Stub_table:clear_stubs): Clear need_save_res_.
328         (Stub_table:set_address_and_size): Add save/restore section size.
329         (Stub_table::add_long_branch_entry): Add save_res param.  Set
330         need_save_res_, but don't add space for save/restore stubs.
331         (Stub_table::find_long_branch_entry): Return offset to local copy
332         of save/restore func.
333         (Stub_table::do_write): Don't output save/restore stubs.  Instead
334         copy the save/restore functions.
335         (Output_data_save_res:contents): New accessor.
336         (Target_powerpc::define_save_restore_funcs): Set savres_section_.
337
338 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
339
340         PR gold/18847
341         * script-sections.cc (Memory_region::set_address): New method.
342         (Script_sections::find_memory_region): Add explicit_only parameter.
343         (Output_section_definition::set_section_addresses): Handle case where
344         script specifies both address and vma region.
345         * script-sections.h (Script_sections::find_memory_region): Add
346         explicit_only parameter.
347
348 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
349
350         PR gold/18859
351         * object.cc (Input_objects::add_object): Store objects in a map,
352         indexed by soname; update as-needed flag when necessary.
353         * object.h (Object::clear_as_needed): New method.
354         (Input_objects::so_names_): Change from set to map.
355
356 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
357
358         PR gold/14746
359         * expression.cc (Expression::Expression_eval_info): Add
360         is_valid_pointer field.
361         (Expression::eval_maybe_dot): Add is_valid_pointer parameter.
362         Adjust all callers.
363         (Addr_expression::value_from_output_section): Check whether address
364         is valid.
365         * script.cc (Symbol_assignment::set_if_absolute): Defer assignment
366         if evaluation failed due to address that is not yet valid.
367         * script.h: (Expression::eval_maybe_dot): Add is_valid_pointer
368         parameter.
369
370 2015-08-25  Cary Coutant  <ccoutant@gmail.com>
371
372         PR gold/18866
373         PR gold/18703
374         * symtab.cc (Symbol_table): Reorder conditions to avoid internal error.
375
376 2015-08-20  Alan Modra  <amodra@gmail.com>
377
378         PR gold/18846
379         * target-reloc.h (relocate_relocs <RELOC_ADJUST_FOR_SECTION_RELA>):
380         Subtract os->address() from addend.
381         * powerpc.cc (relocate_relocs): Likewise.
382
383 2015-08-12  Simon Dardis  <simon.dardis@imgtec.com>
384
385         * mips.cc (plt0_entry_o32, plt0_entry_n32, plt0_entry_n64,
386         lazy_stub_normal_1, lazy_stub_normal_1_n64,
387         lazy_stub_normal_2, lazy_stub_normal_2_n64, lazy_stub_big,
388         lazy_stub_big_n64, lazy_stub_micromips32_normal_1_n64,
389         lazy_stub_micromips32_normal_2_n64, lazy_stub_micromips32_big,
390         lazy_stub_micromips32_big_n64): Update to use 'or' for move instead
391         of 'addu/daddu'.
392
393 2015-07-27  H.J. Lu  <hongjiu.lu@intel.com>
394
395         * configure: Regenerated.
396
397 2015-07-26  Doug Kwan  <dougkwan@google.com>
398
399         * testsuite/arm_unaligned_reloc.{s,sh}: Make test less sensitive to
400           disassembler output format.
401
402 2015-07-23  Ian Coolidge  <icoolidge@google.com>
403         Plumb --pic-veneer option for gold.
404
405         * arm.cc (Reloc_stub::stub_type_for_reloc): Plumb to stub
406         generation.
407         * options.h (General_options): Add --pic-veneer option.
408
409 2015-07-22  H.J. Lu  <hongjiu.lu@intel.com>
410
411         PR gold/18663
412         * testsuite/Makefile.am (script_test_1_SOURCES): Set to
413         script_test_1a.cc script_test_1b.cc.
414         (script_test_11_r.o): Replace script_test_11.o with
415         script_test_11a.o script_test_11b.o.
416         (script_test_11.o): Removed.
417         (script_test_11a.o): New.
418         (script_test_11b.o): Likewise.
419         * testsuite/Makefile.in: Regenerated.
420         * testsuite/script_test_1.h: New file.
421         * testsuite/script_test_1b.cc: Likewise.
422         * testsuite/script_test_11.h: Likewise.
423         * testsuite/script_test_11b.c: Likewise.
424         * testsuite/script_test_1.cc: Renamed to ...
425         * testsuite/script_test_1a.cc: This.
426         Include "script_test_1.h".
427         (main): Call check_int and check_ptr.
428         * testsuite/script_test_11.c: Renamed to ...
429         * testsuite/script_test_11a.c: This.
430         Include "script_test_11.h".
431         (main): Call ptr_equal.
432
433 2015-07-22  H.J. Lu  <hongjiu.lu@intel.com>
434
435         PR gold/18628
436         * testsuite/ifuncdep2.c (global): Change protected to hidden.
437         * testsuite/ifuncmod1.c (global): Likewise.
438         * testsuite/ifuncmod5.c (global): Likewise.
439
440 2015-07-22  Alan Modra  <amodra@gmail.com>
441
442         * aarch64.cc (try_fix_erratum_843419_optimized): Warning fix.
443
444 2015-07-21  Cary Coutant  <ccoutant@gmail.com>
445
446         PR gold/18548
447         * symtab.cc (Symbol_table::do_define_in_output_data): Check for
448         forced local symbol even when oldsym != NULL.
449         (Symbol_table::do_define_in_output_segment): Likewise.
450         (Symbol_table::do_define_as_constant): Likewise.
451
452 2015-07-21  Cary Coutant  <ccoutant@gmail.com>
453
454         PR gold/18698
455         * archive.cc (Library_base::should_include_member): Don't use entry
456         point for relocatable links, or if target is not yet valid.
457         * parameters.cc (Parameters::entry): Check target_valid().
458
459 2015-07-20  Han Shen  <shenhan@google.com>
460
461         Optimize erratum 843419 fix.
462
463         * aarch64.cc (AArch64_insn_utilities::is_adr): New method.
464         (AArch64_insn_utilities::aarch64_adr_encode_imm): New method.
465         (AArch64_insn_utilities::aarch64_adrp_decode_imm): New method.
466         (E843419_stub): New sub-class of Erratum_stub.
467         (AArch64_relobj::try_fix_erratum_843419_optimized): New method.
468         (AArch64_relobj::section_needs_reloc_stub_scanning): Try optimized fix.
469         (AArch64_relobj::create_erratum_stub): Add 1 argument.
470         (Target_aarch64::scan_erratum_843419_span): Pass in adrp insn offset.
471
472 2015-07-20  Han Shen  <shenhan@google.com>
473
474         Fix arm elf header flags wrt hardfp bit.
475
476         * arm.cc (Target_arm::do_adjust_elf_header): Set flags into view.
477
478 2015-07-20  H.J. Lu  <hongjiu.lu@intel.com>
479
480         PR gold/18689
481         * layout.cc (Layout::layout): Clear the SHF_COMPRESSED flag bit
482         from input group section for relocatable link.
483         * testsuite/Makefile.am (check_SCRIPTS): Add pr18689.sh.
484         (check_DATA): Add pr18689.stdout.
485         (MOSTLYCLEANFILES): Add pr18689a.o pr18689b.o.
486         (pr18689.stdout): New rule.
487         (pr18689a.o): Likewise.
488         (pr18689b.o): Likewise.
489         (pr18689.o): Likewise.
490         * testsuite/pr18689.c: New file.
491         * testsuite/pr18689.sh: Likewise.
492         * testsuite/Makefile.in: Regenerated.
493
494 2015-07-20  Yiran Wang  <yiran@google.com>
495         Cary Coutant  <ccoutant@gmail.com>
496
497         PR gold/15574
498         * resolve.cc (Symbol_table): Remove warning about references
499         from shared objects to hidden symbols.
500         * testsuite/Makefile.am (hidden_test): Add hidden_test.syms.
501         * testsuite/Makefile.in: Regenerate.
502         * testsuite/hidden_test.sh: Check dynamic symbol table; update
503         expected error messages.
504
505 2015-07-14  H.J. Lu  <hongjiu.lu@intel.com>
506
507         * compressed_output.cc (Output_compressed_section::set_final_data_size):
508         Make --compress-debug-sections=zlib the same as
509         --compress-debug-sections=zlib-gabi.
510         * testsuite/Makefile.am (flagstest_compress_debug_sections.check):
511         Expect ".debug_.*" with the SHF_COMPRESSED bit, instead of
512         ".zdebug_".
513         * testsuite/Makefile.in: Regenerated.
514
515 2015-07-12  H.J. Lu  <hongjiu.lu@intel.com>
516
517         PR gold/18322
518         * compressed_output.cc (zlib_compress): Add argument for
519         compression header size.  Set header size to compression header
520         size if it isn't 0.  Don't write out the zlib header here.
521         (Output_compressed_section::set_final_data_size): Support
522         zlib-gnu and zlib-gabi compressions.  Pass compression header
523         size to zlib_compress and write out compression header.  Set
524         the SHF_COMPRESSED bit for zlib-gabi compression.  Otherwise
525         clear the SHF_COMPRESSED bit
526         * options.h (compress_debug_sections): Add zlib-gnu and
527         zlib-gabi.
528         * output.h (Output_section::set_flags): New.
529         * testsuite/Makefile.am (check_PROGRAMS): Add
530         flagstest_compress_debug_sections_none,
531         flagstest_compress_debug_sections_gnu and
532         flagstest_compress_debug_sections_gabi.
533         (check_DATA): Add flagstest_compress_debug_sections_none.stdout.
534         flagstest_compress_debug_sections.stdout,
535         flagstest_compress_debug_sections.cmp,
536         flagstest_compress_debug_sections.check,
537         flagstest_compress_debug_sections_gnu.stdout,
538         flagstest_compress_debug_sections_gnu.cmp,
539         flagstest_compress_debug_sections_gnu.check,
540         flagstest_compress_debug_sections_gabi.stdout,
541         flagstest_compress_debug_sections_gabi.cmp and
542         flagstest_compress_debug_sections_gabi.check.
543         (flagstest_compress_debug_sections_none): New.
544         (flagstest_compress_debug_sections_none.stdout): Likewise.
545         (flagstest_compress_debug_sections.stdout): Likewise.
546         (flagstest_compress_debug_sections.check): Likewise.
547         (flagstest_compress_debug_sections.cmp): Likewise.
548         (flagstest_compress_debug_sections_gnu): Likewise.
549         (flagstest_compress_debug_sections_gnu.stdout): Likewise.
550         (flagstest_compress_debug_sections_gnu.check): Likewise.
551         (flagstest_compress_debug_sections_gnu.cmp): Likewise.
552         (flagstest_compress_debug_sections_gabi): Likewise.
553         (flagstest_compress_debug_sections_gabi.stdout): Likewise.
554         (flagstest_compress_debug_sections_gnu.check): Likewise.
555         (flagstest_compress_debug_sections_gnu.cmp): Likewise.
556         * testsuite/Makefile.in: Regenerated.
557
558 2015-07-12  H.J. Lu  <hongjiu.lu@intel.com>
559
560         PR gold/18321
561         * compressed_output.h (decompress_input_section): Add arguments
562         for ELF class, big endian and sh_flags.
563         * compressed_output.cc (decompress_input_section): Likewise.
564         Support the SHF_COMPRESSED section.
565         * dynobj.h (Dynobj): Add elfsize and is_big_endian member
566         functions.
567         * plugin.h (Pluginobj): Likewise.
568         * layout.cc (Layout::get_output_section_flags): Also clear the
569         SHF_COMPRESSED bit.
570         * object.h (Compressed_section_info): Add flag to store sh_flags.
571         (Object): Add pure virtual elfsize and is_big_endian member
572         functions.
573         * object.cc (need_decompressed_section): Don't skip the ".zdebug"
574         prefix here.
575         (build_compressed_section_map): Check SHF_COMPRESSED for
576         uncompressed size.  Store sh_flags in Compressed_section_info.
577         Pass size, big_endian and sh_flags to decompress_input_section.
578         Skip the ".debug"/".zdebug" prefix when passing section name to
579         need_decompressed_section.
580         (Sized_relobj_file<size, big_endian>::do_find_special_section):
581         Don't check ".zdebug_*" sections.
582         (Object::decompressed_section_contents): Pass ELF class, big
583         endian and sh_flags to decompress_input_section.
584         * reloc.cc (Sized_relobj_file<size, big_endian>::write_sections):
585         Likewise.
586         * testsuite/Makefile.am (check_DATA): Add
587         debug_msg_cdebug_gabi.err and gdb_index_test_2_gabi.stdout.
588         (MOSTLYCLEANFILES): Add debug_msg_cdebug_gabi.err and
589         gdb_index_test_2_gabi.stdout.
590         (debug_msg_cdebug_gabi.o): New.
591         (odr_violation1_cdebug_gabi.o): Likewise.
592         (odr_violation2_cdebug_gabi.o): Likewise.
593         (debug_msg_cdebug_gabi.err): Likewise.
594         (check_SCRIPTS): Add gdb_index_test_2_gabi.sh.
595         (gdb_index_test_cdebug_gabi.o): Likewise.
596         (gdb_index_test_2_gabi): Likewise.
597         (gdb_index_test_2_gabi.stdout): Likewise.
598         * testsuite/gdb_index_test_2_gabi.sh: New file.
599         * testsuite/Makefile.in: Regenerated.
600
601 2015-07-09  Han Shen  <shenhan@google.com>
602
603         Use "gold_info" instead of "gold_warning" for erratum fix.
604
605         * aarch64.cc (Target_aarch64::scan_erratum_843419_span): Use
606         'gold_info'.
607         (Target_aarch64::scan_erratum_835769_span): USe 'gold_info'.
608
609 2015-07-09  Han Shen  <shenhan@google.com>
610
611         Drop missing symbol warning for arm/aarch64.
612
613         * aarch64.cc (AArch64_relobj::scan_errata): Drop missing symbol warning.
614         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Drop missing
615         symbol warning.
616
617 2015-07-07  Han Shen  <shenhan@google.com>
618
619         Make gold aarch64 accept long form of mapping symbols.
620
621         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Make legal
622         of mapping symbols.
623
624 2015-06-29  Doug Kwan  <dougkwan@google.com>
625
626         * testsuite/arm_bl_out_of_range.s: Align stub table so that it appears
627           at address expected by test.
628         * testsuite/arm_cortex_a8_b.s: Ditto.
629         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
630         * testsuite/arm_cortex_a8_bl.s: Ditto.
631         * testsuite/arm_cortex_a8_blx.s: Ditto.
632         * testsuite/arm_cortex_a8_local.s: Ditto.
633         * testsuite/arm_fix_v4bx.s: Ditto.
634         * testsuite/arm_unaligned_reloc.s: Ditto.
635         * testsuite/thumb_bl_out_of_range.s: Ditto.
636         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
637         * testsuite/thumb_blx_out_of_range.s: Ditto.
638
639 2015-06-29  Han Shen  <shenhan@google.com>
640
641         Patch for erratum 843419 internal error.
642
643         * aarch64.cc (Erratum_stub::Insn_utilities): New typedef.
644         (Erratum_stub::update_erratum_insn): New method.
645         (Stub_table::relocate_stubs): Modified to place relocated insn.
646         (AArch64_relobj::fix_errata): Modified gold_assert.
647
648 2015-06-12  Han Shen  <shenhan@google.com>
649
650         Fix erratum 835769.
651
652         * aarch64.cc (AArch64_insn_utilities::BYTES_PER_INSN): Move
653         defintion outside class definition.
654         (AArch64_insn_utilities::AARCH64_ZR): New static constant.
655         (AArch64_insn_utilities::aarch64_op31): New member.
656         (AArch64_insn_utilities::aarch64_ra): New member.
657         (AArch64_insn_utilities::aarch64_mac): New member.
658         (AArch64_insn_utilities::aarch64_mlxl): New member.
659         (ST_E_835769): New global enum member.
660         (Stub_table::relocate_stubs): Add 835769 handler.
661         (Stub_template_repertoire::Stub_template_repertoire): Install new
662         stub type.
663         (AArch64_relobj::scan_errata): This func is renamed from
664         scan_erratum_843419.
665         (AArch64_relobj::do_count_local_symbols): Add 835769 handler.
666         (AArch64_relobj::do_relocate_sections): Add 835769 handler.
667         (AArch64_relobj::scan_sections_for_stubs): Add 835769 handler.
668         (Target_aarch64::scan_erratum_835769_span): New method.
669         (Target_aarch64::create_erratum_stub): New method.
670         (Target_aarch64::is_erratum_835769_sequence): New method.
671         (Target_aarch64::scan_erratum_843419_sequence): Move part of the
672         code into create_erratum_stub.
673         * options.h (fix_cortex_a53_835769): New option.
674
675 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
676
677         * aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
678         outside class body.
679         (Reloc_stub::STUB_ADDR_ALIGN): Likewise.
680
681 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
682
683         PR gold/17731
684         * layout.cc (corresponding_uncompressed_section_name): New function.
685         (Layout::choose_output_section): Call it.
686         * layout.h (corresponding_uncompressed_section_name): New function.
687         * script-sections.cc (Input_section_info::set_section_name): Check
688         for compressed debug section (.zdebug style).
689
690 2015-06-11  Jing Yu  <jingyu@google.com>
691
692         * testsuite/Makefile.am: Add -O0 for script_test_12 test.
693         * testsuite/Makefile.in: Regenerate.
694
695 2015-06-11  Davide Italiano  <dccitaliano@gmail.com>
696
697         * gold.h (is_cident): Correct typo.
698
699 2015-06-10  Han Shen  <shenhan@google.com>
700         Patch for erratum-843419 (2 of 2 - fix erratum occurrences).
701
702         Now fixing for 843419 is fully functional.
703
704         The first part of the erratum fix CL is here -
705         https://sourceware.org/ml/binutils/2015-04/msg00229.html
706
707         * aarch64.cc(global enum): New constants representing stub types.
708         (Stub_template): New POD struct.
709         (Stub_template_repertoire): New class.
710         (Stub_base): New class.
711         (Erratum_stub): New class.
712         (Reloc_stub): Refactored to be a subclass of Stub_base.
713         (Reloc_stub::Stub_type): Removed.
714         (Reloc_stub::offset): Moved to Stub_base.
715         (Reloc_stub::set_offset): Moved to Stub_base.
716         (Reloc_stub::destination_address): Moved to Stub_base.
717         (Reloc_stub::set_destination_address): Moved to Stub_base.
718         (Reloc_stub::reset_destination_address): Moved to Stub_base.
719         (Reloc_stub::stub_type): Renamed and moved to Stub_base.
720         (Reloc_stub::stub_size): Renamed and moved to Stub_base.
721         (Reloc_stub::stub_insns): Renamed and moved to Stub_base.
722         (Reloc_stub::write): Moved to Stub_base.
723         (Reloc_stub::invalid_offset): Moved to Stub_base.
724         (Reloc_stub::invalid_address): Moved to Stub_base.
725         (Reloc_stub::stub_type_): Renamed and moved to Stub_base.
726         (Reloc_stub::stub_insns_): Moved to Stub_base.
727         (Reloc_stub::offset_): Moved to Stub_base.
728         (Reloc_stub::destination_address_): Moved to Stub_base.
729         (Stub_table::The_aarch64_relobj): New typedef.
730         (Stub_table::The_erratum_stub): New typedef.
731         (Stub_table::The_erratum_stub_less): New typedef.
732         (Stub_table::The_erratum_stub_set): New typedef.
733         (Stub_table::The_erratum_stub_set_iter): New typedef.
734         (Stub_table::empty): Added emptiness testing for erratum stubs.
735         (Stub_table::add_erratum_stub): New method to add an erratum stub.
736         (Stub_table::find_erratum_stub): New method.
737         (Stub_table::find_erratum_stubs_for_input_section): New method.
738         (Stub_table::erratum_stub_address): New method.
739         (Stub_table::update_date_size_changed_p): Modified to handle erratum stubs.
740         (Stub_table::do_addralign): Modified to handle erratum stubs.
741         (Stub_table::erratum_stubs_): New member.
742         (Stub_table::erratum_stub_size_): New member.
743         (Stub_table::relocate_stubs): Modified to handle erratum stubs.
744         (Stub_table::do_write): Modified to handle erratum stubs.
745         (AArch64_relobj::The_erratum_stub): New typedef.
746         (AArch64_relobj::Erratum_stub_set_iter): New typedef.
747         (AArch64_relobj::fix_errata): New method.
748         (Target_aarch64::The_reloc_stub_type): Removed.
749         (Target_aarch64::The_erratum_stub): New typede.
750         (AArch64_relocate_functions::construct_b): New method.
751
752 2015-06-08  Nick Clifton  <nickc@redhat.com>
753
754         * po/fr.po: New French Translation.
755
756 2015-06-07  Cary Coutant  <ccoutant@gmail.com>
757
758         PR gold/18288
759         * resolve.cc (symbol_to_bits): Remove type parameter; adjust all
760         callers. Don't use STT_COMMON to check for common symbols.
761         (Symbol_table::resolve): Warn if relocatable object has STT_COMMON
762         symbol that's not in a common section.
763         * symtab.h (Symbol::is_common): Don't use STT_COMMON to check for
764         common symbols.
765
766 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
767
768         PR gold/18200
769         * Makefile.am (diststuff): Add target.
770         * Makefile.in: Regenerate.
771
772 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
773
774         PR gold/17498
775         * object.cc (Sized_relobj_file::do_count_local_symbols): Discard
776         temporary locals in merge sections.
777         * options.cc (General_options::parse_discard_all): New method.
778         (General_options::parse_discard_locals): New method.
779         (General_options::parse_discard_none): New method.
780         (General_options::General_options): Initialize discard_locals_.
781         * options.h (--discard-all): Convert to special option.
782         (--discard-locals): Likewise.
783         (--discard-none): New option.
784         (General_options::discard_all): New method.
785         (General_options::discard_locals): New method.
786         (General_options::discard_sec_merge): New method.
787         (General_options::Discard_locals): New enum.
788         (General_options::discard_locals_): New data member.
789
790 2015-06-03  Cary Coutant  <cary@google.com>
791
792         * script-sections.cc (Script_sections::Script_sections): Initialize
793         segments_created_.
794         (Script_sections::create_note_and_tls_segments): Set flag when
795         segments are created.
796         (Script_sections::expected_segment_count): Count PT_INTERP.
797         (Script_sections::attach_sections_using_phdrs_clause): Set flag when
798         segments are created.
799         * script-sections.h (Script_sections::segments_created_): New data
800         member.
801
802 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
803
804         PR gold/15370
805         * script-sections.cc
806         (Output_section_element_input::set_section_addresses): When there
807         are several patterns with no sort spec, put all sections in the same
808         bin.
809         * testsuite/Makefile.am (script_test_12): New testcase.
810         (script_test_12i): New testcase.
811         * testsuite/Makefile.in: Regenerate.
812         * testsuite/script_test_12.t: New test linker script.
813         * testsuite/script_test_12i.t: New test linker script.
814         * testsuite/script_test_12a.c: New test source file.
815         * testsuite/script_test_12b.c: New test source file.
816
817 2015-06-02  Cary Coutant  <ccoutant@gmail.com>
818
819         * nacl.h (Sniff_file): Switch parameters to get_view to get an
820         aligned view.
821
822 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
823
824         PR gold/17819
825         * gold.cc (queue_final_tasks): When --build-id=tree, queue a
826         separate task to schedule the build id computation.
827         * layout.cc (Hash_task::Hash_task): Remove build_id_blocker,
828         add Output_file and offset.
829         (Hash_task::run): Get and release the input views.
830         (Hash_task::is_runnable): Always return NULL (always runnable).
831         (Layout::queue_build_id_tasks): Remove.
832         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
833         parameters; use them instead of class members.
834         (Build_id_task_runner::run): New function.
835         (Close_task_runner::run): Pass array_of_hashes and size_of_hashes
836         to write_build_id.
837         * layout.h (Layout::queue_build_id_tasks): Remove.
838         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
839         parameters.
840         (Layout::array_of_hashes_): Remove.
841         (Layout::size_of_array_of_hashes_): Remove.
842         (Layout::input_view_): Remove.
843         (Build_id_task_runner): New class.
844         (Close_task_runner::Close_task_runner): Add array_of_hashes and
845         size_of_hashes parameters.
846         (Close_task_runner::array_of_hashes_): New data member.
847         (Close_task_runner::size_of_hashes_): New data member.
848         * testsuite/Makefile.am
849         (flagstest_compress_debug_sections_and_build_id_tree): New test.
850         * testsuite/Makefile.in: Regenerate.
851
852 2015-06-01  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
853
854         * merge.cc (get_input_merge_map): Update for data structure change.
855         (get_or_make_input_merge_map): Update for data structure change.
856         * merge.h (Object_merge_map): Use a std::vector<std::pair>> instead of
857         a std::map. Remove first_shnum_, first_map_, second_shnum_, second_map_.
858
859 2015-05-16  Alan Modra  <amodra@gmail.com>
860
861         * reloc.cc (Sized_relobj_file::find_functions): Use function_location.
862         * powerpc.cc (Target_powerpc::do_calls_non_split): New function.
863         (addi_12_1, addis_2_12, addis_12_1, cmpld_7_12_0): New constants.
864         (lis_0): Rename from lis_0_0.
865
866 2015-04-29  Cary Coutant  <cary@google.com>
867             Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
868
869         * gc.h (Garbage_collection::is_section_garbage): Change Object*
870         to Relobj*.
871         (Garbage_collection::add_reference): Likewise.
872         (Garbage_collection::gc_process_relocs): Likewise. Don't push
873         object/shndx pair onto *secvec for dynamic objects. Don't follow
874         relocations pointing to dynamic objects for GC.
875         * icf.cc (Icf::find_identical_sections): Change Object* to Relobj*.
876         (Icf::unfold_section): Likewise.
877         (Icf::is_section_folded): Likewise.
878         (Icf::get_folded_section): Likewise.
879         * icf.h: (Icf::get_folded_section): Likewise.
880         (Icf::unfold_section): Likewise.
881         (Icf::is_section_folded): Likewise.
882         (Icf::section_has_function_pointers): Likewise.
883         (Icf::set_section_has_function_pointers): Likewise.
884         * object.h (Section_id): Likewise.
885         (Const_section_id): Likewise.
886         * output.cc (Output_section::update_section_layout): Likewise.
887         * output.h: (Output_section_lookup_maps::find_relaxed_input_section):
888         Likewise.
889         * plugin.cc (update_section_order): Likewise.
890         (unique_segment_for_sections): Likewise.
891         * powerpc.cc (Powerpc_relobj::add_reference): Likewise.
892         (Target_powerpc::do_gc_add_reference): Likewise.
893         (Target_powerpc::gc_process_relocs): Likewise.
894         (Target_powerpc::do_gc_add_reference): Likewise.
895         * symtab.cc (Symbol_table::is_section_folded): Likewise.
896         (Symbol_table::gc_mark_symbol): Likewise.
897         * symtab.h: (Symbol_table::is_section_folded): Likewise.
898         * target.h: (Sized_target::gc_add_reference): Likewise.
899         (Sized_target::do_gc_add_reference): Likewise.
900
901 2015-04-29  Nick Clifton  <nickc@redhat.com>
902
903         * po/fi.po: Updated Finnish translation.
904
905 2015-04-28  Alan Modra  <amodra@gmail.com>
906
907         * powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather
908         than unsigned int for find_global_entry result temp.  Compare
909         against invalid_address.
910         (Target_powerpc::do_plt_address_for_global): Likewise.
911         (Target_powerpc::Relocate::relocate): Likewise.  Don't assert
912         on plt call stub existence for debug info.  Do assert for plt
913         and global entry stub existence if an alloc section.
914
915 2015-04-28  Alan Modra  <amodra@gmail.com>
916
917         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert
918         on missing global entry stub due to bogus debug info.
919
920 2015-04-27  Han Shen  <shenhan@google.com>
921
922         * options.h (--fix-cortex-a53-843419): Rename option.
923         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Use renamed
924         option.
925         (AArch64_relobj::scan_sections_for_stubs): Use renamed option.
926
927 2015-04-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
928
929         PR gold/18327
930         * output.cc (Output_section::is_input_address_mapped): Assume a missing
931         entry is mapped.
932         * testsuite/Makefile.am: Add the eh_test test.
933         * testsuite/Makefile.in: Regenerate.
934         * testsuite/eh_test_a.cc: New test.
935         * testsuite/eh_test_b.cc: New test.
936
937 2015-04-23  Sriraman Tallam  <tmsriram@google.com>
938
939         * options.h (--weak-unresolved-symbols): New option.
940         * symtab.cc (Symbol_table::sized_write_globals): Change symbol
941         binding to weak with new option.
942         * symtab.h (is_weak_undefined): Check for new option.
943         (is_strong_undefined): Check for new option.
944         * testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
945         * testsuite/Makefile.in: Regenerate.
946         * testsuite/weak_unresolved_symbols_test.cc: New file.
947
948 2015-04-20  Ian Coolidge  <icoolidge@google.com>
949
950         * symtab.cc (Symbol::should_add_dynsym_entry): Return true for
951         GNU_UNIQUE.
952
953 2015-04-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
954
955         * gc.cc (Garbage_collection::do_transitive_closure): Use back and
956         push_back.
957         * gc.h (Garbage_collection): Use a std::vector instead of a std::queue.
958         * object.cc (Sized_relobj_file::do_layout): Use push_back.
959         * powerpc.cc (process_gc_mark): Use push_back.
960         (Target_powerpc::do_gc_mark_symbol): Use push_back.
961         * symtab.cc (Symbol_table::gc_mark_symbol): Use push_back.
962
963 2015-04-16  Han Shen  <shenhan@google.com>
964
965         * aarch64.cc (AArch64_insn_utilities): New utility class.
966         (AArch64_relobj::Mapping_symbol_position): New struct.
967         (AArch64_relobj::Mapping_symbol_info): New typedef.
968         (AArch64_relobj::do_count_local_symbols): New function overriding
969         parent's implementation.
970         (AArch64_relobj::mapping_symbol_info_): New member
971         (AArch64_relobj::scan_erratum_843419): New method.
972         (Target_aarch64::scan_erratum_843419_span): New method.
973         (Target_aarch64::is_erratum_843419_sequence): New method.
974         * options.h (fix_cortex_a53): New option.
975
976 2015-04-09  Cary Coutant  <ccoutant@google.com>
977
978         * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
979         in a PIE link.
980         * testsuite/Makefile.am (tls_pie_test.sh): New test.
981         * testsuite/Makefile.in: Regenerate.
982         * testsuite/tls_pie_test.sh: New.
983
984 2015-04-09  Cary Coutant  <ccoutant@google.com>
985
986         * debug.h (DEBUG_LOCATION): New.
987         (DEBUG_ALL): Include DEBUG_LOCATION.
988         (debug_string_to_enum): Add DEBUG_LOCATION.
989         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
990         output to print correct context.
991         (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
992         up to 4 more locations at the beginning of the function.
993         * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
994         result before sorting list of line numbers.
995         * testsuite/debug_msg.sh: Allow range of line numbers for
996         canonical results on optimized code.
997
998 2015-04-07  HC Yen <hc.yen@mediatek.com>
999
1000         Add AArch32 support for gold linker.
1001         gold/
1002         * arm.cc: Add V8 arch combine table.
1003
1004 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1005
1006         * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
1007
1008 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1009
1010         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
1011         to find by using the return value of insert.
1012
1013 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1014
1015         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
1016         constructor call.
1017
1018 2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>
1019
1020         PR gold/17641
1021         * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
1022         (Target_x86_64::Scan::local): Don't create GOT entry, when we
1023         can convert mov to lea.
1024         (Target_x86_64::Scan::global): Ditto.
1025         (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
1026         %reg to lea foo(%rip), %reg if possible.
1027         * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
1028         * testsuite/x86_64_mov_to_lea1.s: New.
1029         * testsuite/x86_64_mov_to_lea2.s: Ditto.
1030         * testsuite/x86_64_mov_to_lea3.s: Ditto.
1031         * testsuite/x86_64_mov_to_lea4.s: Ditto.
1032         * testsuite/x86_64_mov_to_lea.sh: Ditto.
1033
1034 2015-04-02  H.J. Lu  <hongjiu.lu@intel.com>
1035
1036         * configure: Regenerated.
1037
1038 2015-04-01  Ilya Tocar  <ilya.tocar@intel.com>
1039
1040         PR gold/17640
1041         * i386.cc (Target_i386::can_convert_mov_to_lea): New.
1042         (Target_i386::Scan::local): Don't create GOT entry, when we
1043         can convert GOT to GOTOFF.
1044         (Target_i386::Scan::global): Ditto.
1045         (Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
1046         lea foo@GOTOFF(%reg), %reg if possible.
1047         * testsuite/Makefile.am (i386_mov_to_lea): New test.
1048         * testsuite/i386_mov_to_lea1.s: New.
1049         * testsuite/i386_mov_to_lea2.s: Ditto.
1050         * testsuite/i386_mov_to_lea3.s: Ditto.
1051         * testsuite/i386_mov_to_lea4.s: Ditto.
1052         * testsuite/i386_mov_to_lea5.s: Ditto.
1053         * testsuite/i386_mov_to_lea.sh: Ditto.
1054
1055 2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>
1056
1057         * Makefile.am (ZLIB): New.
1058         (ZLIBINC): Likewise.
1059         (AM_CFLAGS): Add $(ZLIBINC).
1060         (AM_CXXFLAGS): Likewise.
1061         (ldadd_varldadd_var): Add $(ZLIB).
1062         (incremental_dump_LDADD): Likewise.
1063         (dwp_LDADD): Likewise.
1064         * compressed_output.cc: Don't check HAVE_ZLIB_H to include
1065         <zlib.h>.
1066         (zlib_compress): Don't check HAVE_ZLIB_H.
1067         (zlib_decompress): Likewise.
1068         * options.h (compress_debug_sections): Likewise.
1069         * configure.ac (AM_CONDITIONAL): Removed.
1070         * testsuite/Makefile.am (ZLIB): New.
1071         (LDADD): Add $(ZLIB).
1072         Don't check HAVE_ZLIB.
1073         * Makefile.in: Regenerated.
1074         * config.in: Likewise.
1075         * configure: Likewise.
1076         * testsuite/Makefile.in: Likewise.
1077
1078 2015-03-30  Jing Yu  <jingyu@google.com>
1079
1080         * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
1081         TLSLD_ADD_DTPREL_LO12_NC.
1082         * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
1083         _TLS_MODULE_BASE_ point to the start of tls segment.
1084         (Target_aarch64::optimize_tls_reloc): Add cases for
1085         R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
1086         R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
1087         (Target_aarch64::Scan::local): Likewise.
1088         (Target_aarch64::Scan::global): Likewise.
1089         (Target_aarch64::Relocate::relocate): Likewise.
1090         (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
1091         subtracting tls segment size from symbol value for TLSLD_*_DTPREL
1092         relocations.
1093
1094 2015-03-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1095
1096         * merge.cc (Object_merge_map::add_mapping): call
1097         Object_merge_map::Input_merge_map::add_mapping.
1098         (Object_merge_map::Input_merge_map::add_mapping): New.
1099         (Output_merge_data::do_add_input_section): Call
1100         get_or_make_input_merge_map before a loop.
1101         (Output_merge_string<Char_type>::finalize_merged_data): Call
1102         get_or_make_input_merge_map before a loop.
1103         * merge.h (Object_merge_map): Make Input_merge_map public.
1104         * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
1105         (Relobj::get_or_create_merge_map): New.
1106         * object.h (Relobj::get_or_create_merge_map): New.
1107
1108 2015-03-24  Alan Modra  <amodra@gmail.com>
1109
1110         PR 18147
1111         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
1112         relocation errors for branches to strong undefined symbols.
1113
1114 2015-03-23  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1115
1116         * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
1117         (Object_merge_map::is_merge_section_for): Remove.
1118         (Object_merge_map::find_merge_section): New.
1119         * merge.h (Object_merge_map::is_merge_section_for): Remove.
1120         (Object_merge_map::find_merge_section): New.
1121         (Object_merge_map::get_input_merge_map): Add a const version.
1122         * object.cc (Relobj::is_merge_section_for): Remove.
1123         (Relobj::find_merge_section): New.
1124         * object.h (Relobj::is_merge_section_for): Remove.
1125         (Relobj::find_merge_section): New.
1126         * output.cc
1127         (Output_section::Input_section::is_merge_section_for): Remove.
1128         (Output_section::add_merge_input_section): Don't call
1129         add_merge_input_section.
1130         (Output_section::find_merge_section): Return const. Use
1131         object->find_merge_section.
1132         (Output_section::build_lookup_maps): Don't build a map for
1133         merge sections.
1134         (Output_section::is_input_address_mapped): Return false if
1135         section is not found.
1136         (Output_section::find_starting_output_address): Use
1137         find_merge_section instead of is_merge_section_for.
1138         (Output_section::add_script_input_section):  Don't build a map for
1139         merge sections.
1140         * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
1141         (Output_section_lookup_maps::find_merge_section): Remove.
1142         (Output_section_lookup_maps::add_merge_input_section) Remove.
1143         (Output_section::find_merge_section): Return const.
1144
1145 2015-03-22  Cary Coutant  <cary@google.com>
1146
1147         PR gold/18106
1148         * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
1149         non-SIB form of lea, with nop after the call.
1150
1151 2015-03-21  Cary Coutant  <cary@google.com>
1152
1153         PR gold/14217
1154         * output.cc (Output_segment::is_first_section_relro): Don't ignore
1155         .tdata section.
1156         (Output_segment::set_section_addresses): Don't align size of relro
1157         segment for .tbss.
1158
1159 2015-03-21  Cary Coutant  <cary@google.com>
1160
1161         PR gold/18010
1162         * stringpool.cc (Stringpool_template): Don't optimize if section
1163         alignment is greater than sizeof(char).
1164
1165 2015-03-21  Cary Coutant  <cary@google.com>
1166
1167         PR gold/18048
1168         * script-c.h (script_include_directive): Add first_token parameter.
1169         * script.cc (script_include_directive): Add first_token parameter, and
1170         pass it to read_script_file.
1171         * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
1172         (PARSING_MEMORY_DEF): New tokens.
1173         (top): Add new productions for INCLUDE files.
1174         (file_cmd): Replace file_or_sections_cmd with copy of its productions.
1175         Pass PARSING_LINKER_SCRIPT to script_include_directive.
1176         (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
1177         (section_cmd): Pass PARSING_SECTION_CMDS.
1178         (file_or_sections_cmd): Remove.
1179         (memory_def): Pass PARSING_MEMORY_DEF.
1180         * testsuite/Makefile.am (memory_test_2): New test.
1181         * testsuite/Makefile.in: Regenerate.
1182         * testsuite/memory_test_inc.t: New script file.
1183         * testsuite/memory_test_inc_1.t.src: New script file.
1184         * testsuite/memory_test_inc_2.t.src: New script file.
1185         * testsuite/memory_test_inc_3.t.src: New script file.
1186
1187 2015-03-21  Cary Coutant  <cary@google.com>
1188
1189         * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
1190         (Sized_relobj_dwo::setup): Build compressed section map.
1191         (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
1192         * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
1193         section map.
1194         * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
1195         compressed_sections_ field.
1196         (build_compressed_section_map): Take Object instead of
1197         Sized_relobj_file parameter; add decompress_if_needed parameter.
1198         (Sized_relobj_file::do_find_special_sections): Store compressed
1199         section map in parent Object.
1200         (Sized_relobj_file::do_decompressed_section_contents): Move
1201         implementation to Object::decompressed_section_contents.
1202         (Sized_relobj_file::do_discard_decompressed_sections): Move
1203         implementation to Object::discard_decompressed_sections.
1204         * object.h (build_compressed_section_map): Declare.
1205         (Object::Object): Add compressed_sections_ field.
1206         (Object::section_is_compressed): Move implementation here.
1207         (Object::decompressed_section_contents): De-virtualize.
1208         (Object::discard_decompressed_sections): De-virtualize.
1209         (Object::do_section_is_compressed): Delete.
1210         (Object::do_decompressed_section_contents): Delete.
1211         (Object::set_compressed_sections): New method.
1212         (Object::compressed_sections): New method.
1213         (Object::compressed_sections_): New data member.
1214         (Compressed_section_info, Compressed_section_map): Move to top of file.
1215         (Sized_relobj_file::do_section_is_compressed): Delete.
1216         (Sized_relobj_file::do_decompressed_section_contents): Delete.
1217         (Sized_relobj_file::do_discard_decompressed_sections): Delete.
1218         (Sized_relobj_file::compressed_sections_): Move to Object class.
1219
1220 2015-03-21  Cary Coutant  <ccoutant@google.com>
1221
1222         PR gold/18152
1223         * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
1224         deferred objects.
1225
1226 2015-03-11  Cary Coutant  <ccoutant@google.com>
1227
1228         * options.cc (General_options::finalize): Don't allow -z relro
1229         with incremental linking.
1230         * testsuite/Makefile.am (incremental_test): Add -z norelro.
1231         (incremental_test_2): Likewise.
1232         (incremental_test_3): Likewise.
1233         (incremental_test_4): Likewise.
1234         (incremental_test_5): Likewise.
1235         (incremental_test_6): Likewise.
1236         (incremental_copy_test): Likewise.
1237         (incremental_common_test_1): Likewise.
1238         (incremental_comdat_test_1): Likewise.
1239         * testsuite/Makefile.in: Regenerate.
1240
1241 2015-03-09  Cary Coutant  <ccoutant@google.com>
1242
1243         PR gold/14675
1244         * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
1245         return enum indicating whether .eh_frame section is empty, optimizable,
1246         unrecognized, or an end marker. Adjust explicit instantiations.
1247         * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
1248         (Eh_frame::add_ehframe_input_section): Change return type.
1249         * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
1250         * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
1251         to the .eh_frame output section until we see the end marker.
1252         (Layout::finalize_eh_frame_section): New.
1253         * layout.h: (Layout::finalize_eh_frame_section): New.
1254
1255 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
1256
1257         * output.cc (Relobj::initialize_input_to_output_map<size>):
1258         Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
1259
1260 2015-03-04  Cary Coutant  <ccoutant@google.com>
1261
1262         * parameters.cc (Parameters::set_target_once): Call
1263         Target::select_as_default_target just once from here...
1264         (set_parameters_target): ...instead of from here.
1265
1266 2015-03-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1267
1268         * ehframe.cc (Cie::set_output_offset): Pass in and use a
1269         Output_section_data instead of a Merge_map.
1270         (Eh_frame::Eh_frame): Don't initialize merge_map_.
1271         (Eh_frame::read_cie): Use add_merge_mapping instead of
1272         Merge_map::add_mapping.
1273         (Eh_frame::read_fde): Ditto.
1274         (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
1275         (Eh_frame::do_output_offset): Use merge_output_offset istead of
1276         merge_map_->get_output_offset.
1277         (Eh_frame::do_is_merge_section_for): Delete.
1278         * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
1279         instead of a Merge_map.
1280         (Cie::set_output_offset): Pass in a Output_section_data instead of a
1281         Merge_map.
1282         (Eh_frame::do_is_merge_section_for): Delete.
1283         (Eh_frame::merge_map_): Delete.
1284         * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
1285         and use a Output_section_data instead of a Merge_map.
1286         (Object_merge_map::add_mapping): Ditto.
1287         (Object_merge_map::get_output_offset): Remove the merge_map argument.
1288         (Object_merge_map::is_merge_section_for): Pass in and use a
1289         Output_section_data instead of a Merge_map.
1290         (Merge_map): Delete.
1291         (Output_merge_base::do_output_offset): Use merge_output_offset instead
1292         of merge_map_.get_output_offset.
1293         (Output_merge_base::do_is_merge_section_for): Delete.
1294         (Output_merge_data::do_add_input_section): Use
1295         object->add_merge_mapping instead of add_mapping.
1296         (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
1297         * merge.h (Merge_map): Delete forward declaration.
1298         (Object_merge_map::add_mapping): Pass in and use a Output_section_data
1299         instead of a Merge_map.
1300         (Object_merge_map::get_output_offset): Remove the merge_map argument.
1301         (Object_merge_map::is_merge_section_for): Pass in and use a
1302         Output_section_data instead of a Merge_map.
1303         (Input_merge_map::Object_merge_map::merge_map): Replace with
1304         output_data.
1305         (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
1306         Output_section_data instead of a Merge_map.
1307         (Merge_map): Delete.
1308         (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
1309         (Output_merge_base::do_is_merge_section_for): Delete.
1310         (Output_merge_base::add_mapping): Delete.
1311         (Output_merge_base::merge_map_): Delete.
1312         * object.cc (Relobj::initialize_input_to_output_map): New.
1313         (Relobj::initialize_input_to_output_map): New.
1314         (Relobj::merge_output_offset): New.
1315         (Relobj::is_merge_section_for): New.
1316         (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
1317         bits.
1318         * object.h (Relobj::merge_map): Delete.
1319         (initialize_input_to_output_map): New.
1320         (set_merge_map): Delete.
1321         (add_merge_mapping): New.
1322         (merge_output_offset): New.
1323         (is_merge_section_for): New.
1324         * output.cc (Output_section::Input_section::is_merge_section_for):
1325         Use object->is_merge_section_for.
1326         * output.h (Output_section_data::is_merge_section_for): Delete.
1327         (Output_section_data::do_is_merge_section_for): Delete.
1328         * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
1329         Use object->initialize_input_to_output_map.
1330         (Merged_symbol_value<size>::value_from_output_section): Use
1331         object->merge_output_offset.
1332
1333 2015-03-02  Peter Collingbourne  <pcc@google.com>
1334             Cary Coutant  <ccoutant@google.com>
1335
1336         * output.cc (Output_section::add_merge_input_section): Do not
1337         attempt to merge sections with an entsize of 0.
1338
1339 2015-03-02  Khem Raj  <raj.khem@gmail.com>
1340
1341         * attributes.h (class Output_attributes_section_data ): Add
1342         do_print_to_mapfile function.
1343
1344 2015-02-24  Alan Modra  <amodra@gmail.com>
1345
1346         PR 18010
1347         * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
1348         complain if value is not a multiple of four.
1349         (Target_powerpc::Relocate::relocate): Correct handling of
1350         R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
1351
1352 2015-02-21  H.J. Lu  <hongjiu.lu@intel.com>
1353
1354         * configure.ac (default_size): Set to 32 for x32.
1355         * configure: Regenerated.
1356
1357 2015-02-18  Alan Modra  <amodra@gmail.com>
1358
1359         PR 17954
1360         * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
1361         visibility.
1362
1363 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1364
1365         * gc.h (Garbage_collection::add_reference): Don't use find.
1366
1367 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1368
1369         * object.cc (write_local_symbols): avoid std::vector copy.
1370
1371 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1372
1373         * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
1374
1375 2015-02-09  Mark Wielaard  <mjw@redhat.com>
1376
1377         * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
1378         DW_LANG_Fortran03 and DW_LANG_Fortran08.
1379
1380 2015-02-16  Cary Coutant  <ccoutant@google.com>
1381
1382         PR gold/13577
1383         PR gold/16992
1384         * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
1385         DF_SYMBOLIC if --dynamic-list option is used.
1386         * options.cc (General_options::finalize): --dynamic-list is not
1387         mutually exclusive with -Bsymbolic.
1388         * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
1389         listed in --dynamic-list.
1390         * testsuite/Makefile.am (dynamic_list_lib2.so): Add
1391         -Bsymbolic-functions.
1392         * testsuite/Makefile.in: Regenerate.
1393
1394 2015-02-16  Cary Coutant  <ccoutant@google.com>
1395
1396         PR gold/17971
1397         * incremental.cc: Remove redundant include of "output.h".
1398
1399 2015-02-12  Jing Yu  <jingyu@google.com>
1400
1401         * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
1402         TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
1403         New relocation.
1404         * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
1405         TLSLE_MOVW_* relocations.
1406         (Target_aarch64::Scan::global): Likewise.
1407         (Target_aarch64::Relocate::relocate): Likewise.
1408         (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
1409         for new TLSLE_MOVW_* relocations.
1410
1411 2015-02-11  Will Newton  <will.newton@linaro.org>
1412
1413         PR gold/13321
1414         * arm.cc (Target_arm::make_plt_section): Create an ARM
1415         state mapping symbol at the start of the PLT.
1416
1417 2015-02-09  H.J. Lu  <hongjiu.lu@intel.com>
1418
1419         * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
1420         Replace two_file_shared_2.so with two_file_shared_1.so.
1421         * testsuite/Makefile.in: Regenerated.
1422
1423 2015-02-09  Alan Modra  <amodra@gmail.com>
1424
1425         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
1426         plugin_test_thin.a and defsym_test.
1427         * testsuite/Makefile.in: Regenerate.
1428
1429 2015-02-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1430
1431         * merge.cc (do_add_input_section): Combine loop epilogue into main loop
1432         body.
1433
1434 2015-02-04  Peter Collingbourne  <pcc@google.com>
1435
1436         * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
1437         forwarding symbols when computing symbol resolution info for plugins.
1438         * plugin.h (Plugin_manager::symtab): New method.
1439         (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
1440
1441 2015-02-03  Cary Coutant  <ccoutant@google.com>
1442             Peter Collingbourne  <pcc@google.com>
1443
1444         PR gold/15660
1445         * archive.cc (Thin_archive_object_unlocker): New class.
1446         (Archive::include_member): Unlock external members of thin archives.
1447         * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
1448         (plugin_test_2): Likewise.
1449         (plugin_test_3): Likewise.
1450         (plugin_test_4): Likewise.
1451         (plugin_test_5): Likewise.
1452         (plugin_test_6): Likewise.
1453         (plugin_test_7): Likewise.
1454         (plugin_test_8): Likewise.
1455         (plugin_test_9): Likewise.
1456         (plugin_test_10): Likewise.
1457         (plugin_test_11): New test case.
1458         * testsuite/Makefile.in: Regenerate.
1459         * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
1460         file to decide whether to claim file.
1461         (all_symbols_read_hook): Likewise.
1462         * testsuite/plugin_test_1.sh: Adjust expected output.
1463         * testsuite/plugin_test_2.sh: Likewise.
1464         * testsuite/plugin_test_3.sh: Likewise.
1465         * testsuite/plugin_test_6.sh: Likewise.
1466         * testsuite/plugin_test_tls.sh: Likewise.
1467         * testsuite/plugin_test_11.sh: New testcase.
1468
1469 2015-02-03  Cary Coutant  <ccoutant@google.com>
1470
1471         * descriptors.cc (Descriptors::open): Set artificially-low limit for
1472         file descriptors when debugging enabled. Add debug output.
1473         (Descriptors::release): Add debug output.
1474         (Descriptors::close_some_descriptor): Likewise.
1475         (Descriptors::close_all): Likewise.
1476         * fileread.cc (File_read::lock): Likewise.
1477         (File_read::unlock): Likewise.
1478
1479 2015-02-02  Cary Coutant  <ccoutant@google.com>
1480
1481         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
1482         executable output file.
1483
1484 2015-01-22  Han Shen  <shenhan@google.com>
1485
1486         * arm.cc (Target_arm::Target_arm): Add initialization for new members.
1487         (Target_arm::do_plt_address_for_global): New method.
1488         (Target_arm::do_plt_address_for_local): New method.
1489         (Target_arm::rel_irelative_section): New method.
1490         (Target_arm::make_data_plt): Add more parameters for plt ctor.
1491         (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
1492         (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
1493         (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
1494         (Target_arm::Scan::check_non_pic): Add ifunc support.
1495         (Target_arm::Scan::local): Add ifunc support.
1496         (Target_arm::Scan::global): Add ifunc support.
1497         (Target_arm::make_plt_section): New method.
1498         (Target_arm::make_plt_entry): Change to call to make_plt_section.
1499         (Target_arm::make_local_ifunc_plt_entry): New method.
1500         (Target_arm::got_irelative_): New member.
1501         (Target_arm::rel_irelative_): New member.
1502         (Target_arm::got_section): Add creation for got_irelative_.
1503         (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
1504         (Target_arm::Relocate::relocate): Properly set local ifunc address.
1505         (Target_arm::do_dynsym_value): Properly set global ifunc address.
1506         (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
1507         (Output_data_plt_arm::IRelative_data): New type.
1508         (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
1509         (Output_data_plt_arm::add_entry): Add more parameters.
1510         (Output_data_plt_arm::add_relocation): New method.
1511         (Output_data_plt_arm::add_local_ifunc_entry): New method.
1512         (Output_data_plt_arm::rel_irelative): New method.
1513         (Output_data_plt_arm::entry_count): Modified.
1514         (Output_data_plt_arm::address_for_global): New method.
1515         (Output_data_plt_arm::address_for_local): New method.
1516 gold/
1517         (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
1518         (Output_data_plt_arm::insert_irelative_data): New method.
1519         (Output_data_plt_arm::irelative_rel_): New member.
1520         (Output_data_plt_arm::got_): New member.
1521         (Output_data_plt_arm::got_irelative_): New member.
1522         (Output_data_plt_arm::irelative_count_): New member.
1523         (Output_data_plt_arm::IRelative_data_vec): New typedef.
1524         (Output_data_plt_arm::irelative_data_vec_): New member.
1525         (Output_data_plt_arm::do_write): Write out irelative entries.
1526         (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
1527         more parameters to ctor.
1528         (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
1529         more parameters to ctor.
1530         * output.h (Output_data_reloc::add_local_relative): New method.
1531         * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
1532
1533 2015-01-29  Alan Modra  <amodra@gmail.com>
1534
1535         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
1536         and GOT_TLSGD to LE optimization.
1537
1538 2015-01-28  Cary Coutant  <ccoutant@google.com>
1539
1540         * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
1541         for undef TLS symbols.
1542         (Target_x86_64::Relocate::relocate_tls): Likewise.
1543         (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
1544
1545 2015-01-25  Cary Coutant  <ccoutant@google.com>
1546
1547         * output.cc (Output_segment::set_section_addresses): Fix calculation
1548         of size of relro segment.
1549
1550 2015-01-22  Alan Modra  <amodra@gmail.com>
1551
1552         * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
1553         condition for need of ifunc plt entry.
1554         (Target_powerpc::Scan::global <got relocs>): Likewise.
1555
1556 2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1557
1558         * mips.cc (reloc_high): Add r_sym.
1559         (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
1560         reloc_high constructor.
1561         (Mips_relocate_functions::relgot16_local): Likewise.
1562         (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
1563         r_type to decide whether LO16 matches HI16.
1564         (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
1565         rello16 and relgot16_local.
1566
1567 2015-01-09  Cary Coutant  <ccoutant@google.com>
1568
1569         * layout.cc (Layout::set_segment_offsets): Don't align start of segment
1570         unless alignment is larger than page size.
1571
1572 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1573             Cary Coutant  <ccoutant@google.com>
1574
1575         PR gold/17729
1576         * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
1577         (DEFAULT_TARGET_X32): Set for x32.
1578         * x86_64.cc (cmp_insn_32): New.
1579         (lea_r10_insn_32): Likewise.
1580         (lea_r11_insn_32): Likewise.
1581         (cmp_insn_64): Likewise.
1582         (lea_r10_insn_64): Likewise.
1583         (lea_r11_insn_64): Likewise.
1584         (Target_x86_64<size>::do_calls_non_split): Handle x32.
1585         * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
1586         (check_DATA): Add split_x32 files.
1587         (split_x32_[1234n].o): New targets.
1588         (split_x32_[124]): New targets.
1589         (split_x32_[1234r].stdout): New targets.
1590         * testsuite/split_x32.sh: New file.
1591         * testsuite/split_x32_1.s: Likewise.
1592         * testsuite/split_x32_2.s: Likewise.
1593         * testsuite/split_x32_3.s: Likewise.
1594         * testsuite/split_x32_4.s: Likewise.
1595         * testsuite/split_x32_n.s: Likewise.
1596         * configure: Regenerated.
1597         * testsuite/Makefile.in: Likewise.
1598
1599 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1600
1601         PR gold/17809
1602         * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
1603         x32.
1604
1605 2015-01-02  Alan Modra  <amodra@gmail.com>
1606
1607         * version.cc (print_version): Just print current year.
1608         * dwp.cc (print_version): Likewise.
1609
1610 2015-01-01  Alan Modra  <amodra@gmail.com>
1611
1612         Update year range in copyright notice of all files.
1613
1614 2014-12-25  Alan Modra  <amodra@gmail.com>
1615
1616         * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
1617         new enums.
1618         (Target_arm::merge_object_attributes, ): Likewise.
1619
1620 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
1621
1622         * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
1623         as hard float only when Tag_ABI_VFP_args is 1, using new enum value
1624         AEABI_VFP_args_vfp to check that.
1625         (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
1626         value and replace hardcoded values by enum values.
1627
1628 2014-12-22  Cary Coutant  <ccoutant@google.com>
1629
1630         * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
1631
1632 2014-12-20  H.J. Lu  <hongjiu.lu@intel.com>
1633
1634         PR gold/14608
1635         * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
1636         to "return i * i * 3;".
1637
1638 2014-12-16  Cary Coutant  <ccoutant@google.com>
1639
1640         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
1641         (Mapfile::print_output_data): Use current_data_size() to avoid
1642         assert for sections requiring postprocessing; if address is not valid,
1643         print 0.
1644         (Mapfile::print_output_section): Use current_data_size(); print note
1645         that addresses and sizes are before compression.
1646
1647 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
1648
1649         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1650         Cast current_group_size to unsigned long when reporting error.
1651
1652 2014-12-10  Jing Yu  <jingyu@google.com>
1653
1654         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
1655         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
1656         Update error message.
1657         (Target_aarch64::do_relax): Use absolute value of option
1658         stub_group_size. Replace local variable with class member
1659         stub_group_size_.
1660
1661 2014-12-04  Alan Modra  <amodra@gmail.com>
1662
1663         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
1664         addend of PLTREL24 reloc when not generating a plt stub.  Make
1665         max_branch_offset an "Address".
1666         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
1667         (Target_powerpc::Relocate::relocate): Likewise.
1668
1669 2014-12-04  Alan Modra  <amodra@gmail.com>
1670
1671         PR 17670
1672         * symtab.cc (Symbol::set_undefined): Remove assertion.
1673         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1674         on symbols defined in discarded sections, instead return false.
1675         Rearrange params, update all callers.
1676         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
1677         branches to syms in discarded sections.
1678         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
1679         undefined and flag as discarded.
1680         (Target_powerpc::Relocate::relocate): Localize variable.
1681
1682 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
1683
1684         PR gold/17675
1685         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
1686         * testsuite/Makefile.in: Regenerated.
1687
1688 2014-12-03  Alan Modra  <amodra@gmail.com>
1689
1690         PR 17566
1691         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
1692         when adding dynamic relocations against section symbols.
1693
1694 2014-12-01  Dimitry Ivanov <dimitry@google.com>
1695
1696         * layout.cc (Layout::finish_dynamic_section): When '-z global'
1697         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
1698         * options.h (General_options): New -z option (global).
1699
1700 2014-12-01  Cary Coutant  <ccoutant@google.com>
1701
1702         PR gold/17578
1703         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
1704         is given.
1705         (Layout::create_executable_stack_info): Warn when -z noexecstack is
1706         given but some inputs require executable stack.
1707
1708 2014-11-26  Cary Coutant  <ccoutant@google.com>
1709
1710         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
1711         .debug_str_offsets; strip .debug_gnu_pubnames and
1712         .debug_gnu_pubtypes.
1713         (lines_only_debug_sections): Strip all four new sections.
1714
1715 2014-11-26  Jing Yu  <jingyu@google.com>
1716
1717         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
1718         register to be x0 when to relax TLSDESC_LD64_LO12.
1719
1720 2014-11-26  Alan Modra  <amodra@gmail.com>
1721
1722         * powerpc.cc (struct Stub_table_owner): New.
1723         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
1724         unsigned int vector.  Update all references.
1725         (powerpc_relobj::set_stub_table): Take an unsigned int param
1726         rather than a Stub_table.  Update callers.
1727         (Powerpc_relobj::clear_stub_table): New function.
1728         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
1729         stub_group_size_ vars.
1730         (Target_powerpc::new_stub_table): Delete.
1731         (max_branch_delta): New function, extracted from..
1732         (Target_powerpc::Relocate::relocate): ..here..
1733         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
1734         status on whether stub created successfully.
1735         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
1736         default sizing to..
1737         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
1738         reduce on relax failure.
1739         (Target_powerpc::group_sections): Add "no_size_errors" param.
1740         Use stub_group_size_.  Set up group info in a temp vector,
1741         before building Stub_table vector.  Account for input sections
1742         possibly already converted to relaxed sections.
1743         (Stub_table::init): Delete.  Merge into..
1744         (Stub_table::Stub_table): ..here.
1745         (Stub_table::can_reach_stub): New function.
1746         (Stub_table::add_plt_call_entry): Add "from" parameter and
1747         return true iff stub could be reached.
1748         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
1749         param too.
1750         (Stub_table::clear_stubs): Add "all" param.
1751
1752 2014-11-26  Alan Modra  <amodra@gmail.com>
1753
1754         * powerpc.cc (Stub_control::set_output_and_owner): New function.
1755         (Target_powerpc::group_sections): Use it.
1756
1757 2014-11-25  Cary Coutant  <ccoutant@google.com>
1758
1759         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
1760         (Binary_to_elf::write_symbol): Add st_size parameter.
1761         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
1762
1763 2014-11-25  Cary Coutant  <ccoutant@google.com>
1764
1765         PR gold/17639
1766         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
1767         (Sized_relobj_file::do_layout): Handle deferred sections properly
1768         during GC pass 1. Don't add reloc sections to deferred list twice.
1769         * object.h (Sized_relobj_file::is_deferred_layout): New function.
1770         (Sized_relobj_file::is_deferred_layout_): New data member.
1771
1772 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
1773
1774         PR gold/17619
1775         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
1776         Check PC-relative offset overflow in PLT entry.
1777
1778 2014-11-21  Alan Modra  <amodra@gmail.com>
1779
1780         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
1781         for undefined weaks.
1782
1783 2014-11-20  Alan Modra  <amodra@gmail.com>
1784
1785         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
1786         from --stub-group-size parameter divided by 1024.
1787         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
1788         template parameter.  Update all uses.
1789         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
1790         has_stub_value.  Set for long branches.  Don't report overflow for
1791         branch to undefined weak symbols.  Print info message on
1792         overflowing branch to stub.
1793
1794 2014-11-20  Alan Modra  <amodra@gmail.com>
1795
1796         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
1797
1798 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
1799
1800         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
1801         entry for R_X86_64_GOTPLT64.
1802         (Target_x86_64<size>::Relocate::relocate): Update comments for
1803         R_X86_64_GOTPLT64.
1804
1805 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
1806
1807         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
1808         * plugin.h: add lock definition
1809
1810 2014-10-29  Han Shen  <shenhan@google.com>
1811             Jing Yu   <jingyu@google.com>
1812
1813         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
1814         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1815         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
1816         Symbol::TLS_REF.
1817         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
1818         method.
1819         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
1820         (Target_aarch64::tls_ld_to_le): New method.
1821         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
1822         for 64bit targets.
1823         (Output_data_plt_aarch64::irelative_rel_): New data member.
1824         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
1825         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
1826         (Output_data_plt_aarch64::add_relocation): New method.
1827         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
1828         offset. Add got_irelative size to got size.
1829         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
1830         type string with the new typename.
1831         (AArch64_relocate_functions::update_adr): Replace parameter x with
1832         immed.
1833         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
1834         (AArch64_relocate_functions::reloc_common): New method.
1835         (AArch64_relocate_funcsions::rela_general): Extract common part out
1836         into reloc_common method.
1837         (AArch64_relocate_functions::rela_general): Likewise.
1838         (AArch64_relocate_functions::pcrela_general): Likewise.
1839         (AArch64_relocate_functions::adr): New method.
1840         (AArch64_relocate_functions::adrp): Calculate immed before calling
1841         update_adr.
1842         (AArch64_relocate_functions::adrp): Likewise.
1843         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
1844         comparing x to 0. Calculate immed from ~x when x < 0.
1845         (Target_aarch64::optimize_tls_reloc): Add new cases for
1846         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1847         TLSLD_MOVW_DTPREL_G0_NC.
1848         (Target_aarch64::possible_function_pointer_reloc): Implement this
1849         method.
1850         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
1851         comment.
1852         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
1853         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1854         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1855         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
1856         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1857         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1858         (Target_aarch64::make_plt_entry): Call add_entry with two more
1859         parameters.
1860         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1861         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
1862         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1863         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1864         (Target_aarch64::Relocate::relocate_tls): Add cases for
1865         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1866         TLSLD_MOVW_DTPREL_G0_NC.
1867         * testsuite/icf_safe_so_test.cc: Correct test comment.
1868         * testsuite/icf_safe_test.sh: Add AArch64 arch.
1869
1870 2014-10-22  Alan Modra  <amodra@gmail.com>
1871
1872         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
1873         thread_starter.
1874
1875 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
1876
1877         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
1878
1879 2014-10-17  Cary Coutant  <ccoutant@google.com>
1880
1881         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1882         Add "typename" keyword.
1883
1884 2014-10-15  Han Shen  <shenhan@google.com>
1885             Jing Yu   <jingyu@google.com>
1886
1887         Patch for gold aarch64 backend to support relaxation.
1888         * aarch64-reloc.def: Change format.
1889         * aarch64.cc (class Reloc_stub): New class.
1890         (class Stub_table): New class.
1891         (class AArch64_relobj): New class.
1892         (class AArch64_input_section): New class.
1893         (class AArch64_output_section): New class.
1894         (Target_aarch64::new_stub_table): New method.
1895         (Target_aarch64::new_aarch64_input_section): New method.
1896         (Target_aarch64::find_aarch64_input_section): New method.
1897         (Target_aarch64::scan_section_for_stubs): New method.
1898         (Target_aarch64::scan_reloc_section_for_stubs): New method.
1899         (Target_aarch64::relocate_stub): New method.
1900         (Target_aarch64::current_target): New method.
1901         (Target_aarch64::do_make_elf_object): New method.
1902         (Target_aarch64::do_may_relax): New method.
1903         (Target_aarch64::do_relax): New method.
1904         (Target_aarch64::group_sections): New method.
1905         (Target_aarch64::scan_reloc_for_stub): New method.
1906         (Target_aarch64::do_make_output_section): New method.
1907         (Target_aarch64::stub_tables_): New data member.
1908         (Target_aarch64::aarch64_input_section_map_): New data member.
1909         (AArch64_relocate_functions::maybe_apply_stub): New method.
1910
1911 2014-09-30  Cary Coutant  <ccoutant@google.com>
1912
1913         PR gold/17432
1914         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
1915
1916 2014-09-30  Kito Cheng  <kito@0xlab.org>
1917
1918         PR gold/13597
1919         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
1920         hash table before sysv-style hash table.
1921
1922 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
1923
1924         * options.h (--pic-executable): Add negative to alias to -no-pie.
1925
1926 2014-09-26  Cary Coutant  <ccoutant@google.com>
1927
1928         PR gold/16773
1929         * object.cc (Sized_relobj_file): Compute value of section symbols
1930         for TLS sections the same as TLS symbols.
1931
1932 2014-09-25  Cary Coutant  <ccoutant@google.com>
1933
1934         PR gold/17432
1935         * resolve.cc (Symbol_table::resolve): Override common placeholder
1936         symbols, but adjust sizes.
1937         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
1938         symbols to common lists.
1939
1940 2014-09-24  Alan Modra  <amodra@gmail.com>
1941
1942         * po/POTFILES.in: Regenerate.
1943
1944 2014-09-23  Taiju Tsuiki  <tzik@google.com>
1945             Cary Coutant  <ccoutant@google.com>
1946
1947         PR gold/14860
1948         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
1949         on input_sections_blocker.
1950         * layout.cc (Write_sections_task::locks): Unblock
1951         input_sections_blocker_.
1952         * layout.h (Write_sections_task::Write_sections_task): Add
1953         input_sections_blocker.
1954         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
1955         to DEPENDENCIES.
1956         * testsuite/Makefile.in: Regenerate.
1957
1958 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1959
1960         * testsuite/Makefile.am (plugin_test_10): New test.
1961         * testsuite/Makefile.in: Regenerate
1962         * testsuite/plugin_common_test_2.c (c1): Align to 8.
1963         * testsuite/plugin_test_10.sh: New file.
1964
1965 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1966
1967         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
1968         * resolve.cc (Symbol_table::resolve): Don't override common symbols
1969         during the replacement phase.
1970
1971 2014-09-17  Han Shen  <shenhan@google.com>
1972             Jing Yu  <jingyu@google.com>
1973
1974         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
1975         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
1976         * aarch64.cc (Target_aarch64): Add data members
1977         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
1978         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
1979         constructor.
1980         (Target_aarch64::do_reloc_symbol_index): New method.
1981         (Target_aarch64::do_reloc_addend): New method.
1982         (Target_aarch64::add_tlsdesc_info): New method.
1983         (Target_aarch64::do_dynsym_value): New method.
1984         (Target_aarch64::do_make_data_plt): Add new parameters: got,
1985         got_irelative. Pass them to Output_data_plt_aarch64_standard.
1986         (Target_aarch64::make_data_plt): Add new parameters: got,
1987         got_irelative. Pass them to do_make_data_plt.
1988         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
1989         (Target_aarch64::Relocate:tls_gd_to_le): New method.
1990         (Target_aarch64::Relocate:tls_ie_to_le): New method.
1991         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
1992         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
1993         (Target_aarch64::got_tlsdesc_section): New method.
1994         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1995         (Target_aarch64::define_tls_base_symbol): New method.
1996         (Target_aarch64::reserve_tlsdesc_entries): New method.
1997         (Target_aarch64::got_mod_index_entry): New method.
1998         (Target_aarch64::rela_tlsdesc_section): New method.
1999         (Target_aarch64::rela_irelative_section): New method.
2000         (Target_aarch64::Tlsdesc_info): New struct.
2001         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
2002         relocations and tlsdesc relocations.
2003         (Target_aarch64::optimize_tls_reloc): Implement method.
2004         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
2005         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
2006         in constructor.
2007         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
2008         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
2009         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
2010         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
2011         (Output_data_plt_aarch64::rela_tlsdesc): New method.
2012         (Output_data_plt_aarch64::rela_irelative): New method.
2013         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
2014         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
2015         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
2016         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
2017         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
2018         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
2019         (Output_data_plt_aarch64_standard): New member variables:
2020         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
2021         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
2022         New parameter: got, got_irelative.
2023         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
2024         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
2025         (Output_data_plt_aarch64::do_write): Replace got_address with
2026         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
2027         (AArch64_relocate_functions::update_movnz): New method.
2028         (AArch64_relocate_functions): Correct format.
2029         (AArch64_relocate_functions::movnz): New method.
2030         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
2031         before the switch. Add new cases to switch.
2032         Check ie_to_le relaxation on tlsie relocations. Add code handling
2033         tlsgd tlsdesc cases.
2034         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
2035         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
2036         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
2037         Call reloc_name_in_error_message to print unsupported reloc.
2038         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
2039         make_data_plt.
2040         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
2041         relocs. Fill in some more dynamic tags.
2042         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
2043         Skip call tls_get_addr when tlsgd is relaxed.
2044         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
2045         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
2046         tlsdesc->ie relaxation.
2047
2048 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2049
2050         * mips.cc (Target_mips_nacl): New class.
2051         (Target_selector_mips_nacl): New class.
2052         (target_selector_mips32): Rename from target_selector_mips32be and use
2053         Target_selector_mips_nacl instead of Target_selector_mips.
2054         (target_selector_mips32el): Rename from target_selector_mips32 and use
2055         Target_selector_mips_nacl instead of Target_selector_mips.
2056         (target_selector_mips64): Rename from target_selector_mips64be and use
2057         Target_selector_mips_nacl instead of Target_selector_mips.
2058         (target_selector_mips64el): Rename from target_selector_mips64 and use
2059         Target_selector_mips_nacl instead of Target_selector_mips.
2060         (Target_mips::mips_info): Add const attribute.
2061
2062 2014-09-02  Cary Coutant  <ccoutant@google.com>
2063
2064         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
2065         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
2066         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
2067         (Sized_incr_dynobj::do_section_name): Likewise.
2068         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
2069         (Sized_incr_dynobj::do_section_name): Likewise.
2070         * object.h (Object::section_name): Likewise.
2071         (Object::do_section_name): Likewise.
2072         (Sized_relobj_file::do_section_name): Likewise.
2073         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
2074         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
2075
2076 2014-09-02  Cary Coutant  <ccoutant@google.com>
2077
2078         PR gold/17005
2079         * ehframe.cc (Fde::write): Add output_offset parameter.
2080         (Cie::write): Likewise.
2081         (Eh_frame::set_final_data_size): Account for offset within output
2082         section.
2083         (Eh_frame::do_sized_write): Likewise.
2084         * ehframe.h (Fde::write): Add output_offset parameter.
2085         (Cie::write): Likewise.
2086         * output.cc (Output_section::Input_section_sort_entry): Remove
2087         section_has_name_; add output_section_name parameter. Use
2088         output section name for non-input sections.
2089         (Output_section::Input_section_sort_entry::section_has_name): Remove.
2090         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
2091         (Output_section::Input_section_sort_compare): Remove logic for
2092         sections without names.
2093         (Output_section::Input_section_sort_init_fini_compare): Likewise.
2094         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
2095         Likewise.
2096         (Output_section::Input_section_sort_section_name_compare): Likewise.
2097
2098 2014-08-29 Han Shen <shenhan@google.com>
2099            Jing Yu <jingyu@google.com>
2100
2101         * aarch64-reloc-property.cc
2102         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
2103         reference reloc property in the table.
2104         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
2105         3 other entries.
2106         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
2107         2 new overloaded methods.
2108         (Output_data_got_aarch64::do_write): Add code to write out
2109         static relocs.
2110         (class Output_data_got_aarch64::Static_reloc): New class to wrap
2111         static relocs.
2112         (Output_data_got_aarch64::static_relocs): New vector to
2113         hold static relocs.
2114         (Target_aarch64::TCB_SIZE): New const static memeber.
2115         (Target_aarch64::tcb_size): New method.
2116         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
2117         (Target_aarch64::Relocate::relocate_tls): New method.
2118         (Target_aarch64::Scan::local): Add code handling new reloc types.
2119         (Target_aarch64::Scan::global): Add code handling new reloc types.
2120
2121 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
2122
2123         * options.h (-no-pie): Add option.
2124
2125 2014-08-08  Jing Yu  <jingyu@google.com>
2126             Han Shen  <shenhan@google.com>
2127
2128         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
2129         (DEFFILES): add aarch64-reloc.def.
2130         (TARGETSOURCES): Add aarch64-reloc-property.cc.
2131         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
2132         * Makefile.in: Regenerate.
2133         * aarch64-reloc-property.cc: New file.
2134         * aarch64-reloc-property.h: New file.
2135         * aarch64-reloc.def: New file.
2136         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
2137         with tab to make the format consistent.
2138         (Output_data_got_aarch64::symbol_table_): New method.
2139         (Target_aarch64::do_plt_address_for_global): New method.
2140         (Target_aarch64::do_plt_address_for_local): New method.
2141         (Target_aarch64::do_select_as_default_target): New method.
2142         (Target_aarch64::do_make_data_plt): New method.
2143         (Target_aarch64::make_data_plt): New method.
2144         (Output_data_plt_aarch64::has_irelative_section): New method.
2145         (Output_data_plt_aarch64::address_for_global): New method.
2146         (Output_data_plt_aarch64::address_for_local): New method.
2147         (Output_data_plt_aarch64::irelative_rel_): New parameter.
2148         (Output_data_plt_aarch64::add_entry): Implement contents.
2149         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
2150         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
2151         the got_pov entry to plt0.
2152         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
2153         Implement contents.
2154         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
2155         (AArch64_howto): New struct.
2156         (aarch64_howto[]): New static const array.
2157         (AArch64_relocate_functions): New class.
2158         (Target_aarch64::Scan::get_reference_flags): Remove method.
2159         (Target_aarch64::Scan::local): Implement to support a few relocations.
2160         (Target_aarch64::Scan::global): Implement to support a few relocations.
2161         (Target_aarch64::make_plt_section): Implement contents.
2162         (Target_aarch64::make_plt_entry): Implement contents.
2163         (Target_aarch64::do_finalize_sections): Implement contents.
2164         (Target_aarch64::Relocate::relocate): Implement a few relocations.
2165         (Target_aarch64::relocate_section): Implement contents.
2166
2167 2014-08-06  Alan Modra  <amodra@gmail.com>
2168
2169         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
2170
2171 2014-08-06  Alan Modra  <amodra@gmail.com>
2172
2173         PR 13227
2174         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
2175
2176 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
2177
2178         * object.cc (Relobj::is_section_name_included): Add
2179         ".rodata.nptl_version" to not garbage collect this section.
2180
2181 2014-07-08  Cary Coutant  <ccoutant@google.com>
2182
2183         * expression.cc (struct Expression::Expression_eval_info): Add
2184         new fields type_pointer, vis_pointer, and nonvis_pointer.
2185         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
2186         nonvis_pointer parameters. Adjust all calls.
2187         (Symbol_expression::value): Update type, visibility, and nonvis bits
2188         in caller.
2189         * script.cc (Symbol_assignment::sized_finalize): Update type,
2190         visibility, and remaining st_other bits for new symbol.
2191         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
2192         vis_pointer, and nonvis_pointer parameters.
2193         * symtab.h (Symbol::set_type): New method.
2194
2195         * testsuite/Makefile.am (defsym_test): New test.
2196         * testsuite/Makefile.in: Regenerate.
2197         * testsuite/defsym_test.c: New file.
2198         * testsuite/defsym_test.sh: New file.
2199
2200 2014-07-08  Cary Coutant  <ccoutant@google.com>
2201
2202         PR gold/15639
2203         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
2204         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
2205         (Sized_dynobj::base_read_symbols): ...new method.
2206         * object.h (Sized_relobj_file::base_read_symbols): New method.
2207         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
2208         (Sized_relobj_file::base_read_symbols): ...new method.
2209         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
2210         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
2211         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
2212
2213 2014-07-04  Alan Modra  <amodra@gmail.com>
2214
2215         * po/POTFILES.in: Regenerate.
2216
2217 2014-07-02  Jing Yu  <jingyu@google.com>
2218
2219         * aarch64.cc: New file
2220         * Makefile.am (TARGETSOURCES): Add aarch64.cc
2221         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
2222         * Makefile.in: Regenerate.
2223         * configure.tgt: Add entries for aarch64*.
2224         * configure.ac:  Likewise.
2225         * configure: Likewise.
2226
2227 2014-06-27  Alan Modra  <amodra@gmail.com>
2228
2229         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
2230
2231 2014-06-24  Cary Coutant  <ccoutant@google.com>
2232
2233         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
2234         sections.
2235         (Dwo_file::sized_read_unit_index): Likewise.
2236
2237 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2238
2239         * mips.cc: New file.
2240         * Makefile.am (TARGETSOURCES): Add mips.cc
2241         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
2242         * configure.tgt: Add entries for mips*.
2243         * configure.ac: Likewise.
2244         * Makefile.in: Regenerate.
2245         * configure: Likewise.
2246
2247 2014-06-09  Cary Coutant  <ccoutant@google.com>
2248
2249         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
2250         unit_length is within section bounds.
2251
2252 2014-06-09  Cary Coutant  <ccoutant@google.com>
2253
2254         PR gold/16980
2255         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
2256         map.
2257
2258 2014-06-07  Alan Modra  <amodra@gmail.com>
2259
2260         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
2261
2262 2014-06-06  Cary Coutant  <ccoutant@google.com>
2263
2264         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
2265         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
2266         (Dwarf_pubnames_table::read_header): Likewise.
2267         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
2268         .debug_gnu_pubtypes.
2269
2270 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
2271
2272         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
2273         * Makefile.in, configure: Regenerate.
2274
2275 2014-06-03  Alan Modra  <amodra@gmail.com>
2276
2277         * powerpc.cc (addis_12_2): Define.
2278         (Stub_table::do_write): Support fusion on ELFv2 stubs.
2279
2280 2014-06-03  Alan Modra  <amodra@gmail.com>
2281
2282         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
2283         st_other output.
2284
2285 2014-06-02  Alan Modra  <amodra@gmail.com>
2286
2287         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
2288         Only ignore relocs on ELFv1.
2289         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
2290
2291 2014-05-30  Cary Coutant  <ccoutant@google.com>
2292
2293         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
2294         * testsuite/Makefile.in: Regenerate.
2295         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
2296
2297 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
2298
2299         PR gold/16945
2300         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
2301         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
2302
2303 2014-05-15  Alan Modra  <amodra@gmail.com>
2304
2305         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
2306         Compare FDE contents with DW_CFA_nop rather than 0.
2307
2308 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
2309
2310         * symtab.h (may_need_copy_reloc): Remove check for position independent
2311         code.
2312         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
2313         position independence before pc absolute may_need_copy_reloc call.
2314         Add check for executable output befor pc relative may_need_copy_reloc
2315         call.
2316         * i386.cc: Ditto.
2317         * arm.cc: Ditto.
2318         * sparc.cc: Ditto.
2319         * tilegx.cc: Ditto.
2320         * powerpc.cc: Add check for no position independence before
2321         may_need_copy_reloc calls.
2322         * testsuite/pie_copyrelocs_test.cc: New file.
2323         * testsuite/pie_copyrelocs_shared_test.cc: New file.
2324         * Makefile.am (pie_copyrelocs_test): New test.
2325         * Makefile.in: Regenerate.
2326
2327 2014-05-08  Martin Liška  <mliska@suse.cz>
2328
2329         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
2330
2331 2014-05-06  Cary Coutant  <ccoutant@google.com>
2332
2333         PR gold/16900
2334         * i386.cc (Output_data_got_plt_i386): New class.
2335         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
2336         parameter. Change all callers.
2337         (Output_data_plt_i386::layout_): Remove.
2338         (Output_data_plt_i386::got_plt_): Change type.
2339         (Target_i386::got_plt_): Change type. Change all references.
2340         (Target_i386::got_section): Create instance of new class.
2341         (Output_data_got_plt_i386::do_write): New function.
2342         * x86_64.cc (Output_data_got_plt_x86_64): New class.
2343         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
2344         parameter. Change all callers.
2345         (Output_data_plt_x86_64::layout_): Remove.
2346         (Output_data_plt_x86_64::got_plt_): Change type.
2347         (Target_x86_64::got_plt_): Change type. Change all references.
2348         (Target_x86_64::got_section): Create instance of new class.
2349         (Output_data_got_plt_x86_64::do_write): New function.
2350         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
2351         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
2352         class.
2353
2354 2014-05-05  Cary Coutant  <ccoutant@google.com>
2355
2356         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
2357         if we have pubnames/pubtypes.
2358
2359 2014-05-02  Cary Coutant  <ccoutant@google.com>
2360
2361         * defstd.cc (in_segment): Define __ehdr_start here...
2362         * layout.cc (Layout::finalize): ...Instead of here.  Set the
2363         output segment when known.
2364         * resolve.cc (Symbol::override_base_with_special): Remember
2365         the original binding.
2366         * symtab.cc (Symbol::set_output_segment): New function.
2367         (Symbol::set_undefined): New function.
2368         * symtab.h (Symbol::is_weak_undefined): Check original undef
2369         binding.
2370         (Symbol::is_strong_undefined): New function.
2371         (Symbol::set_output_segment): New function.
2372         (Symbol::set_undefined): New function.
2373         * target-reloc.h (is_strong_undefined): Remove.
2374         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
2375         Check for hidden undefs.
2376         (relocate_section): Call Symbol::is_strong_undefined.
2377
2378         * testsuite/Makefile.am (ehdr_start_test_1)
2379         (ehdr_start_test_2, ehdr_start_test_3)
2380         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
2381         * testsuite/Makefile.in: Regenerate.
2382         * testsuite/ehdr_start_def.cc: New source file.
2383         * testsuite/ehdr_start_test.cc: New source file.
2384         * testsuite/ehdr_start_test.t: New linker script.
2385         * testsuite/ehdr_start_test_4.sh: New shell script.
2386
2387 2014-04-23  Cary Coutant  <ccoutant@google.com>
2388
2389         PR gold/16870
2390         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
2391
2392 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2393
2394         * layout.cc (Layout::include_section): Allow a target to decide
2395         whether to include a section.
2396         * target.h (Target::should_include_section): New function.
2397         (Target::do_should_include_section): New function.
2398
2399 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2400
2401         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
2402         inline into ...
2403         (Copy_relocs::emit): ... here.
2404         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
2405         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
2406         (Copy_reloc_entry::entries_): Change from private to protected.
2407
2408 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
2409
2410         * icf.cc (get_section_contents): Replace copies of reloc
2411         vectors with const references.
2412
2413 2014-04-02  Cary Coutant  <ccoutant@google.com>
2414
2415         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
2416         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
2417         * configure: Regenerate.
2418         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
2419         -fno-use-linker-plugin.
2420         (LINK1, CXXLINK1): Add it to the link command.
2421         * testsuite/Makefile.in: Regenerate.
2422
2423 2014-03-12  Alan Modra  <amodra@gmail.com>
2424
2425         * Makefile.in: Regenerate.
2426
2427 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2428
2429         * symtab.h (Symbol::set_nonvis): New function.
2430
2431 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2432
2433         * symtab.cc (Sized_symbol<32>::init_output_data):
2434         Instantiate the template.
2435         (Sized_symbol<64>::init_output_data): Likewise.
2436
2437 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2438
2439         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
2440         adjust dynamic symbol value.
2441         * target.h (Target::adjust_dyn_symbol): New function.
2442         (Target::do_adjust_dyn_symbol): New function.
2443
2444 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2445
2446         * output.cc (Output_data_dynamic::Dynamic_entry::write):
2447         Get the value of DYNAMIC_CUSTOM dynamic entry.
2448         * output.h (Output_data_dynamic::add_custom): New function.
2449         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
2450         dynamic entry.
2451         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
2452         * target.h (Target::dynamic_tag_custom_value): New function.
2453         (Target::do_dynamic_tag_custom_value): New function.
2454
2455 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2456
2457         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
2458         dynsym indexes.
2459         * target.h (Target::has_custom_set_dynsym_indexes): New function.
2460         (Target::do_has_custom_set_dynsym_indexes): New function.
2461         (Target::set_dynsym_indexes): New function.
2462         (Target::do_set_dynsym_indexes): New function.
2463
2464 2014-03-07  Alan Modra  <amodra@gmail.com>
2465
2466         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
2467         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
2468         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
2469         (Powerpc_relocate_functions::has_overflow_bitfield,
2470         overflowed): Use the above.
2471         (Target_powerpc::Relocate::relocate): Correct overflow checking
2472         for a number of relocations.  Modify overflow test for 16-bit
2473         fields in instructions to signed/unsigned according to whether
2474         the field takes a signed or unsigned value.
2475
2476 2014-03-05  Alan Modra  <amodra@gmail.com>
2477
2478         Update copyright years.
2479
2480 2014-03-05  Alan Modra  <amodra@gmail.com>
2481
2482         * powerpc.cc (Target_powerpc::Scan::local, global): Support
2483         R_PPC64_ADDR64_LOCAL.
2484         (Target_powerpc::Relocate::relocate): Likewise.
2485
2486 2014-03-03  Alan Modra  <amodra@gmail.com>
2487
2488         * dwp.cc (print_version): Update copyright year to current.
2489
2490 2014-02-10  Alan Modra  <amodra@gmail.com>
2491
2492         * po/gold.pot: Regenerate.
2493
2494 2014-02-06  Cary Coutant  <ccoutant@google.com>
2495
2496         Fix problem where -u is ignored when a weak undef is seen.
2497
2498         * archive.cc (Library_base::should_include_member): Reorder
2499         code to check for -u option if a weak undef has already been seen.
2500         * testsuite/Makefile.am (weak_undef_test_2): New test case.
2501         * testsuite/Makefile.in: Regenerate.
2502         * testsuite/weak_undef_file3.cc: New file.
2503         * testsuite/weak_undef_file4.cc: New file.
2504         * testsuite/weak_undef_test_2.cc: New file.
2505
2506 2014-02-05  Cary Coutant  <ccoutant@google.com>
2507
2508         Fix issues with gold undefined symbol diagnostics.
2509
2510         PR binutils/15435
2511         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
2512         check to here.
2513         * target-reloc.h (is_strong_undefined): New function.
2514         (relocate_section): Move undef vtable symbol check from here.
2515         Check for is_strong_undefined.
2516
2517 2014-02-05  Cary Coutant  <ccoutant@google.com>
2518
2519         Fix problems with the --dynamic-list option.
2520
2521         PR gold/13577
2522         * options.cc (General_options::parse_dynamic_list):
2523         Set have_dynamic_list_.
2524         (General_options::General_options): Initialize have_dynamic_list_.
2525         (General_options::finalize): Turn off -Bsymbolic and
2526         -Bsymbolic-functions if --dynamic-list provided.
2527         * options.h (General_options::have_dynamic_list): New function.
2528         (General_options::have_dynamic_list_): New data member.
2529         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
2530         correctly.
2531
2532         PR gold/16530
2533         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
2534         in --dynamic-list, mark it.
2535
2536         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
2537         (dynamic_list_2): New test case.
2538         * testsuite/Makefile.in: Regenerate.
2539         * testsuite/dynamic_list_2.cc: New file.
2540         * testsuite/dynamic_list_2.t: New file.
2541         * testsuite/dynamic_list_lib1.cc: New file.
2542         * testsuite/dynamic_list_lib2.cc: New file.
2543         * testsuite/gc_dynamic_list_test.c: New file.
2544         * testsuite/gc_dynamic_list_test.sh: New file.
2545         * testsuite/gc_dynamic_list_test.t: New file.
2546
2547 2014-01-28  Cary Coutant  <ccoutant@google.com>
2548
2549         Add .gdb_index version 7 support.
2550
2551         * gold/dwarf_reader.cc: include <utility> (for make_pair).
2552         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
2553         debug sections.
2554         (Dwarf_ranges_table::read_ranges_table): Likewise.
2555         (Dwarf_pubnames_table::read_section): Check for GNU-style
2556         sections, and for compressed debug sections.
2557         (Dwarf_pubnames_table::read_header): Compute end address of table.
2558         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
2559         for end of list by offset, not by offset == 0.
2560         (Dwarf_info_reader::do_read_string_table): Check for compressed
2561         debug sections.
2562         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2563         Initialize new data members.
2564         (Dwarf_pubnames_table::next_name): return flag_byte.
2565         (Dwarf_pubnames_table::end_of_table_): New data member.
2566         (Dwarf_pubnames_table::is_gnu_style_): New data member.
2567         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
2568         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
2569         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
2570         read skeleton type unit DIEs.
2571         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
2572         (Gdb_index::do_write): Write flag_byte.
2573         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
2574         (Gdb_index::Cu_vector): Store flags along with cu indexes.
2575         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
2576         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
2577
2578 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
2579
2580         * version.cc (print_version): Update copyright year to 2014.
2581
2582 2013-12-19  Dimitry Andric  <dimitry@andric.com>
2583
2584         * stringpool.cc (Stringpool_template::reserve): Add
2585         HAVE_UNORDERED_MAP case.
2586         * stringpool.cc (Stringpool_template::print_stats): Likewise.
2587
2588 2013-12-18  Cary Coutant  <ccoutant@google.com>
2589
2590         * configure.ac: Check for <unordered_set> and <unordered_map>.
2591         * config.in: Regenerate.
2592         * configure: Regenerate.
2593         * system.h: Use <unordered_set> and <unordered_map> if available.
2594
2595 2013-12-10  Roland McGrath  <mcgrathr@google.com>
2596
2597         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
2598         with $(INSTALL_PROGRAM_ENV).
2599         * Makefile.in: Regenerate.
2600
2601 2013-11-22  Cary Coutant  <ccoutant@google.com>
2602
2603         * configure.ac: Add check for which library is needed for
2604         dlopen.
2605         * configure: Regenerate.
2606
2607 2013-11-22  Cary Coutant  <ccoutant@google.com>
2608
2609         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
2610         assembler.
2611         * testsuite/Makefile.in: Regenerate.
2612
2613 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
2614
2615         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
2616         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
2617         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
2618         (Target_x86_64<size>::Scan::local): Likewise.
2619         (Target_x86_64<size>::Scan::global): Likewise.
2620         (Target_x86_64<size>::Relocate::relocate): Likewise.
2621         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
2622         Likewise.
2623         (Target_x86_64<size>::Scan::check_non_pic(): Handle
2624         R_X86_64_PC32_BND.
2625
2626         * testsuite/Makefile.am (check_PROGRAMS): Add
2627         exception_x86_64_bnd_test.
2628         (exception_x86_64_bnd_test_SOURCES): New macro.
2629         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
2630         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
2631         (exception_x86_64_bnd_test_LDADD): Likewise.
2632         (exception_x86_64_bnd_1.o): New rule.
2633         (exception_x86_64_bnd_2.o): Likewise.
2634         * testsuite/Makefile.in: Regenerated.
2635
2636 2013-11-15  Alan Modra  <amodra@gmail.com>
2637
2638         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
2639         accessor.
2640         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
2641         Only call ppc64_local_entry_offset for 64-bit.  Restrict
2642         symval_for_branch lookup to ELFv1.
2643         (Stub_table::add_plt_call_entry): Use unsigned int off.
2644         (Output_data_glink::Address, invalid_address): New.
2645         (Output_data_glink::add_eh_frame): Move out of line.  Add
2646         support for ELFv2.
2647         (Output_data_glink::add_global_entry, find_global_entry,
2648         global_entry_address): New functions.
2649         (Output_data_glink::global_entry_stubs_, end_branch_table_,
2650         ge_size): New variables.
2651         (Output_data_glink::set_final_data_size): Add global entry
2652         stub sizing.
2653         (Output_data_glink::do_write): Write global entry stubs.
2654         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
2655         parameter.  Return true for ELFv2.  Adjust callers.
2656         (Target_powerpc::Scan::local, global): Restrict opd lookup to
2657         ELFv1.  Similarly for ifunc and dynamic relocation processing
2658         specific to ELFv1.  Recognize that symbols are defined on
2659         their plt entries for ELFv2.
2660         (Target_powerpc::symval_for_branch): Assert if called for
2661         ELFv2 or ppc32.
2662         (Target_powerpc::Relocate::relocate): Use global entry plt
2663         stub for symbol value if such exists on ELFv2.
2664         (Target_powerpc::Relocate::relocate): Don't call
2665         symval_for_branch when ELFv2.  Do adjust for local entry
2666         offset when ELFv2.
2667         (Target_powerpc::do_dynsym_value): Set symbols to global entry
2668         plt stub for ELFv2.
2669         (Target_powerpc::do_plt_address_for_global): Similarly.
2670
2671 2013-11-14  Cary Coutant  <ccoutant@google.com>
2672
2673         Revert patch -- this did not fix the problem, and there is
2674         no race there.
2675
2676         2013-11-14  Cary Coutant  <ccoutant@google.com>
2677
2678             PR gold/14860
2679             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2680             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2681             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2682             updating fde_offsets_.
2683             (Eh_frame_hdr::lock_): New data member.
2684
2685 2013-11-14  Cary Coutant  <ccoutant@google.com>
2686
2687         * dwp.cc (Dwo_file_entry): New type.
2688         (File_list): Use Dwo_file_entry.
2689         (Dwo_file::verify): New function.
2690         (Dwo_file::verify_dwo_list): New function.
2691         (Dwo_file::sized_verify_dwo_list): New function.
2692         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
2693         list.
2694         (Dwp_options): New enum type.
2695         (dwp_options): Add --verify-only.
2696         (usage): Likewise.
2697         (main): Likewise.
2698         * dwp.h (gold_info): Add declaration.
2699
2700 2013-11-14  Cary Coutant  <ccoutant@google.com>
2701
2702         PR gold/14860
2703         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2704         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2705         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2706         updating fde_offsets_.
2707         (Eh_frame_hdr::lock_): New data member.
2708
2709 2013-11-06  Cary Coutant  <ccoutant@google.com>
2710
2711         PR gold/15758
2712         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
2713         before reloc sections.
2714
2715 2013-11-04  Alan Modra  <amodra@gmail.com>
2716
2717         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
2718         (Symbol::needs_dynamic_reloc): Test new flag.
2719         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
2720         (Target_powerpc::Scan::get_reference_flags): Add target param.
2721         Return FUNC_DESC_ABI for 64-bit ELFv1.
2722         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
2723         call.
2724         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
2725         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
2726
2727 2013-10-31  Cary Coutant  <ccoutant@google.com>
2728
2729         Restore support for dwp v2 DWARF package file format.
2730
2731         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2732         tu_length parameter.  Adjust all callers.
2733         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2734         * dwp.cc: Include dwarf.h.
2735         (Section_bounds): New struct type.
2736         (Unit_set): New struct type.
2737         (Dwo_file::Dwo_file): Initialize new data member.
2738         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2739         Combine and rename to...
2740         (Dwo_file::read_unit_index): ...this.
2741         (Dwo_file::sized_read_compunit_index)
2742         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2743         (Dwo_file::sized_read_unit_index): ...this.
2744         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2745         parameters; add section_id parameter.
2746         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2747         (Dwo_file::add_unit_set): ...this.
2748         (Dwo_file::shndx_map_): Remove.
2749         (Dwo_file::sect_offsets_): New data member.
2750         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2751         (Dwp_output_file::add_section): Rename to...
2752         (Dwp_output_file::add_contribution): ...this.
2753         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2754         (Dwp_output_file::add_tu_set): Likewise.
2755         (Dwp_output_file::Contribution): New type.
2756         (Dwp_output_file::Section::contributions): New data member.
2757         (Dwp_output_file::Cu_or_tu_set): Remove.
2758         (Dwp_output_file::Section::Section): New ctor.
2759         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2760         (Dwp_output_file::Dwp_index::Section_table): New type.
2761         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2762         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2763         parameter.
2764         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2765         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2766         (Dwp_output_file::Dwp_index::section_table): New member function.
2767         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2768         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2769         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2770         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2771         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2772         (Dwp_output_file::Dwp_index::section_table_): New data member.
2773         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2774         (Dwp_output_file::add_output_section): New member function.
2775         (Dwp_output_file::write_new_section): New member function.
2776         (Dwp_output_file::write_contributions): New member function.
2777         (Dwp_output_file::section_id_map_): New data member.
2778         (class Dwo_id_info_reader): Remove.
2779         (class Unit_reader): New class.
2780         (get_dwarf_section_name): New function.
2781         (Dwo_file::read_executable): Adjust initializations of class data.
2782         (Dwo_file::read): Add support for v2 package file format.
2783         (Dwo_file::read_unit_index): Likewise.
2784         (Dwo_file::sized_read_unit_index): Likewise.
2785         (Dwo_file::copy_section): Likewise.
2786         (Dwo_file::add_unit_set): Likewise.
2787         (Dwp_output_file::add_output_section): Likewise.
2788         (Dwp_output_file::add_contribution): Likewise.
2789         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2790         for empty slot.
2791         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2792         file format.
2793         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2794         slot.
2795         (Dwp_output_file::initialize): Remove unused function.
2796         (Dwp_output_file::finalize): Add support for v2 package file format.
2797         (Dwp_output_file::write_index): Likewise.
2798         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2799         function prototype.
2800
2801 2013-10-31  Cary Coutant  <ccoutant@google.com>
2802
2803         * configure.ac: Fix check for -fmerge-constants.
2804         * configure.ac: Regenerate.
2805
2806 2013-10-30  Roland McGrath  <mcgrathr@google.com>
2807
2808         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
2809         Correct 9-byte nop sequence to match what the assembler generates.
2810
2811 2013-10-30  Alan Modra  <amodra@gmail.com>
2812
2813         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
2814         ppc64_local_entry_offset, ppc64_local_entry_offset,
2815         do_read_symbols): New functions.
2816         (Powerpc_relobj::e_flags_, st_other_): New vars.
2817         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
2818         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
2819         (Powerpc_relobj::e_flags_): New var.
2820         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
2821         and adjust for ELFv2.
2822         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
2823         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
2824         (Powerpc_dynobj::do_find_special_sections): Likewise.
2825         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
2826         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
2827         to ELFv2 local entry.
2828         (Target_powerpc::do_relax): No thread safe barriers needed for
2829         ELFv2.
2830         (Output_data_plt_powerpc::initial_plt_entry_size_,
2831         plt_entry_size): Delete.  Replace all uses with
2832         first_plt_entry_offset() and plt_entry_size().
2833         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
2834         reserved_size parm.  Update callers.
2835         (Output_data_plt_powerpc::entry_count): Update.
2836         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
2837         and use Target_powerpc::first_plt_entry_offset().
2838         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
2839         rename to plt_entry_size.
2840         (Output_data_plt_powerpc::add_ifunc_entry,
2841         add_local_ifunc_entry): Adjust reloc for ELFv2.
2842         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
2843         (glink_eh_frame_fde_64v2): New.
2844         (Stub_table::plt_call_size): Support ELFv2 sizing.
2845         (Output_data_glink::add_eh_frame): Use the new FDE.
2846         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
2847         (Stub_table::do_write): Write ELFv2 stubs and glink.
2848         (Target_powerpc::Relocate::relocate): Replaces nop after call
2849         with ld 2,24(1) and adjust local offset destination for ELFv2.
2850
2851 2013-10-30  Alan Modra  <amodra@gmail.com>
2852
2853         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
2854         (Target_powerpc::Scan::global, local): Likewise.
2855         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
2856         on all ppc64 @h and @ha relocs.
2857
2858 2013-10-14  Alan Modra  <amodra@gmail.com>
2859
2860         * output.h (Output_data_got::add_constant): Tidy.
2861         (Output_data_got::add_constant_pair): New function.
2862         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
2863         methods used so as to first call reserve_ent().
2864
2865 2013-10-11  Roland McGrath  <mcgrathr@google.com>
2866
2867         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
2868         add_got_entry and add_got_entry_pair.
2869
2870         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
2871         (HAVE_PUBNAMES): Likewise.
2872         * configure: Regenerate.
2873
2874         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
2875         * testsuite/Makefile.in: Regenerate.
2876
2877         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
2878         Remove const from declaration.
2879         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
2880         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
2881         * output.h (Output_file_header): Remove const from member target_
2882         and corresponding constructor argument.
2883         * output.cc (Output_file_header::Output_file_header): Update prototype.
2884         (Output_file_header::do_sized_write): Use this->target_ in place
2885         of parameters()->target().
2886
2887         * testsuite/undef_symbol.cc (Foo::get_a): New method.
2888
2889         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
2890         * configure: Regenerate.
2891         * Makefile.in: Regenerate.
2892         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
2893         * testsuite/merge_string_literals_2.c: Likewise.
2894         * testsuite/Makefile.am
2895         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
2896         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
2897         literal -fmerge-constants.
2898         * testsuite/Makefile.in: Regenerate.
2899
2900         * i386.cc (Target_i386): Remove unused member dynbss_.
2901         * arm.cc (Target_arm): Likewise.
2902         * powerpc.cc (Target_powerpc): Likewise.
2903         * sparc.cc (Target_sparc): Likewise.
2904         * tilegx.cc (Target_tilegx): Likewise.
2905         * x86_64.cc (Target_x86_64): Likewise.
2906         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
2907         type_signature_, type_offset_.
2908         * plugin.h (Plugin_hook): Remove unused member layout_.
2909         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
2910         mapfile_.
2911         (Read_member): Remove unused members input_objects_, symtab_,
2912         mapfile_, layout_.
2913         (Check_library): Remove unused member symtab_.
2914         * archive.h (Lib_group): Remove unused member lib_.
2915         * archive.cc (Lib_group::Lib_group): Update initializer.
2916         * incremental.h (Incremental_binary): Remove unused member target_.
2917         (Incremental_script_entry): Removed unused member script_.
2918         * layout.h (Write_symbols_task): Remove unused member input_objects_.
2919         * icf.h (Icf): Remove unused member num_tracked_relocs.
2920
2921         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
2922         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
2923         its only use.
2924         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
2925
2926         * archive.h: Use struct rather than class for forward declaration
2927         of Read_symbols_data.
2928
2929 2013-10-07  Cary Coutant  <ccoutant@google.com>
2930
2931         PR gold/16010
2932         * testsuite/Makefile.am (icf_test): Fix dependencies.
2933         (icf_safe_test): Likewise.
2934         (icf_safe_so_test): Likewise.
2935         (large_symbol_alignment): Add empty _LDADD rule.
2936         * testsuite/Makefile.in: Regenerate.
2937
2938 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
2939
2940         PR gold/15927
2941         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
2942         relocation for R_X86_64_32 on x32.
2943
2944 2013-08-27  Roland McGrath  <mcgrathr@google.com>
2945
2946         * output.cc (Output_segment::set_section_addresses): Take new
2947         Target* argument.  If target->isolate_execinstr() and the segment
2948         is executable and starts at a target->abi_pagesize() boundary,
2949         pad its end out to a target->abi_pagesize() boundary with code fill.
2950         * output.h (Output_segment::set_section_addresses): Update decl.
2951         * layout.h (Layout::check_output_data_for_reset_values): Take new
2952         argument RELAX_OUTPUTS.
2953         (Layout): New member relax_output_list_.
2954         (Layout::add_relax_output): New method.
2955         * layout.cc (Layout::Layout): Update constructor.
2956         (Layout::reset_relax_output): New method.
2957         (Layout::clean_up_after_relaxation): Call it.
2958         (Layout::prepare_for_relaxation): Update caller.
2959         (Layout::set_segment_offsets): Update callers of set_section_addresses.
2960         Call reset_relax_output before re-processing segments for
2961         isolate_execinstr case.
2962         (Layout::write_data): Handle relax_output_list_.
2963         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
2964         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
2965
2966 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
2967
2968         PR binutils/15834
2969         * object.h: Fix typos.
2970
2971 2013-08-16  Roland McGrath  <mcgrathr@google.com>
2972
2973         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
2974         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
2975
2976 2013-08-07  Cary Coutant  <ccoutant@google.com>
2977
2978         Revert support for v2 DWP files:
2979
2980         2013-03-01  Cary Coutant  <ccoutant@google.com>
2981
2982             Add dwp support for v2 DWARF package file format.
2983             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2984             tu_length parameter.  Adjust all callers.
2985             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2986             * dwp.cc: Include dwarf.h.
2987             (Section_bounds): New struct type.
2988             (Unit_set): New struct type.
2989             (Dwo_file::Dwo_file): Initialize new data member.
2990             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2991             Combine and rename to...
2992             (Dwo_file::read_unit_index): ...this.
2993             (Dwo_file::sized_read_compunit_index)
2994             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2995             (Dwo_file::sized_read_unit_index): ...this.
2996             (Dwo_file::copy_section): Remove section_name, is_str_offsets
2997             parameters; add section_id parameter.
2998             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2999             (Dwo_file::add_unit_set): ...this.
3000             (Dwo_file::shndx_map_): Remove.
3001             (Dwo_file::sect_offsets_): New data member.
3002             (Dwp_output_file::Dwp_output_file): Initialize new data members.
3003             (Dwp_output_file::add_section): Rename to...
3004             (Dwp_output_file::add_contribution): ...this.
3005             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
3006             (Dwp_output_file::add_tu_set): Likewise.
3007             (Dwp_output_file::Contribution): New type.
3008             (Dwp_output_file::Section::contributions): New data member.
3009             (Dwp_output_file::Cu_or_tu_set): Remove.
3010             (Dwp_output_file::Section::Section): New ctor.
3011             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
3012             (Dwp_output_file::Dwp_index::Section_table): New type.
3013             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
3014             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
3015             parameter.
3016             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
3017             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
3018             (Dwp_output_file::Dwp_index::section_table): New member function.
3019             (Dwp_output_file::Dwp_index::section_table_end): New member function.
3020             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
3021             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
3022             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
3023             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
3024             (Dwp_output_file::Dwp_index::section_table_): New data member.
3025             (Dwp_output_file::Dwp_index::section_mask_): New data member.
3026             (Dwp_output_file::add_output_section): New member function.
3027             (Dwp_output_file::write_new_section): New member function.
3028             (Dwp_output_file::write_contributions): New member function.
3029             (Dwp_output_file::section_id_map_): New data member.
3030             (class Dwo_id_info_reader): Remove.
3031             (class Unit_reader): New class.
3032             (get_dwarf_section_name): New function.
3033             (Dwo_file::read_executable): Adjust initializations of class data.
3034             (Dwo_file::read): Add support for v2 package file format.
3035             (Dwo_file::read_unit_index): Likewise.
3036             (Dwo_file::sized_read_unit_index): Likewise.
3037             (Dwo_file::copy_section): Likewise.
3038             (Dwo_file::add_unit_set): Likewise.
3039             (Dwp_output_file::add_output_section): Likewise.
3040             (Dwp_output_file::add_contribution): Likewise.
3041             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
3042             for empty slot.
3043             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
3044             file format.
3045             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
3046             slot.
3047             (Dwp_output_file::initialize): Remove unused function.
3048             (Dwp_output_file::finalize): Add support for v2 package file format.
3049             (Dwp_output_file::write_index): Likewise.
3050             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
3051             function prototype.
3052
3053 2013-07-31  Cary Coutant  <ccoutant@google.com>
3054
3055         * object.cc (Sized_relobj::do_output_section_address): New function.
3056         (Sized_relobj): Instantiate explicitly.
3057         * object.h (Object::output_section_address): New function.
3058         (Object::do_output_section_address): New function.
3059         (Sized_relobj::do_output_section_address): New function.
3060         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
3061
3062 2013-07-30  Cary Coutant  <ccoutant@google.com>
3063             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
3064
3065         * parameters.cc (Parameters::entry): Return target-specific entry
3066         symbol name.
3067         * target.h (Target::entry_symbol_name): New function.
3068         (Target_info::entry_symbol_name): New data member.
3069
3070         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
3071         * i386.cc (Target_i386::i386_info): Likewise.
3072         (Target_i386_nacl::i386_nacl_info): Likewise.
3073         * sparc.cc (Target_sparc::sparc_info): Likewise.
3074         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
3075         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
3076         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
3077         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3078
3079 2013-07-22  Sterling Augustine  <saugustine@google.com>
3080
3081         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
3082         Convert parameter shndx to local variable. Add parameters symtab
3083         and symtab_size.  Scan over section names.  Find relocation
3084         section corresponding to current section.  Create and initialize
3085         reloc_mapper_ and reloc_type_.
3086         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
3087         unit_length to off_t.  Initialize member unit_length_.  Fill in field
3088         cu_offset_.
3089         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
3090         Initialize new fields unit_length_ and cu_offset_.
3091         (Dwarf_pubnames_table::read_section): Update prototype.
3092         (Dwarf_pubnames_table::cu_offset): New member function.
3093         (Dwarf_pubnames_table::subsection_size): Likewise.
3094         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
3095         New fields.
3096         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
3097         member functions public.
3098         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
3099         Update comment.  Rework logic.  Move repeated parts to...
3100         (Gdb_index_info_reader::read_pubtable): ...here. New function.
3101         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
3102         pubtypes_table_, and stmt_list_offset.
3103         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
3104         Gdb_index::find_pubtype_offset,
3105         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
3106         (Gdb_index::pubnames_read): Update prototype and rework logic.
3107         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
3108         Forward declare.
3109         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
3110         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
3111         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
3112         Gdb_index::map_pubtable_to_dies):
3113         Declare functions.
3114         (Gdb_index::pubnames_read): Update declaration.
3115         (Gdb_index::Pubname_offset_map): New type.
3116         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
3117         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
3118         Gdb_index::stmt_list_offset): Declare.
3119         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
3120         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
3121         Gdb_index::pubtypes_offset_): Remove.
3122
3123 2013-07-19  Roland McGrath  <mcgrathr@google.com>
3124
3125         * options.h (General_options): Add -Trodata-segment option.
3126         * parameters.cc (Parameters::check_rodata_segment): New function.
3127         (Parameters::set_target_once): Call it.
3128         * parameters.h (Parameters): Declare it (private member function).
3129         * layout.cc (load_seg_unusable_for_headers): New function, broken
3130         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
3131         then validate rodata segment rather than text segment.
3132         (relaxation_loop_body): Call that.
3133         (is_text_segment): New function.  Don't admit a non-executable
3134         segment if TARGET->isolate_execinstr().
3135         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
3136
3137 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
3138
3139         PR gold/15070
3140         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
3141         * nacl.h (Sniff_file::View::View): Request aligned view.
3142
3143 2013-07-11  Cary Coutant  <ccoutant@google.com>
3144
3145         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
3146         correct BRLT entry size.
3147
3148 2013-07-03  Alan Modra  <amodra@gmail.com>
3149
3150         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
3151         comment.
3152
3153 2013-07-01  Cary Coutant  <ccoutant@google.com>
3154
3155         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
3156         reloc_type_.
3157         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
3158         (Dwarf_ranges_table::lookup_reloc): New function.
3159         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
3160         reloc_type_.
3161         (Dwarf_ranges_table::lookup_reloc): New function.
3162         (Dwarf_ranges_table::reloc_type_): New data member.
3163
3164 2013-06-27  Jing Yu  <jingyu@google.com>
3165
3166         PR gold/15662
3167         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
3168         function.
3169         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
3170         (Target_powerpc::do_relax): Call the above.
3171
3172 2013-06-27  Cary Coutant  <ccoutant@google.com>
3173
3174         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
3175         on garbage collected .opd section.
3176
3177 2013-06-27  Alan Modra  <amodra@gmail.com>
3178
3179         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
3180         is non-zero.
3181         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
3182         (Target_powerpc::do_function_location): Likewise for loc->shndx.
3183
3184 2013-06-14  Cary Coutant  <ccoutant@google.com>
3185
3186         * resolve.cc (Symbol::override_base): Don't override st_type
3187         from plugin placeholder symbols.
3188         (Symbol_table::resolve): Likewise.
3189         (Symbol_table::should_override): Don't complain about TLS mismatch
3190         if the TO symbol is a plugin placeholder.
3191         * testsuite/Makefile.am (plugin_test_tls): New test.
3192         * testsuite/Makefile.in: Regenerate.
3193         * testsuite/plugin_test_tls.sh: New test script.
3194         * testsuite/two_file_test_2_tls.cc: New test source.
3195         * testsuite/two_file_test_tls.cc: New test source.
3196
3197 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3198
3199         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
3200         the maximum segment alignment is larger than the page size.
3201         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
3202         correctly aligns the symbols with large alignemnt.
3203         * testsuite/Makefile.in: Regenerate.
3204         * testsuite/large_symbol_alignment.cc: New file.
3205
3206 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3207             Sriraman Tallam  <tmsriram@google.com>
3208
3209         * options.h (sort_section): New option.
3210         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
3211         Rename from Input_section_sort_section_name_special_ordering_compare.
3212         (Input_section_sort_section_name_compare): New struct.
3213         * output.cc (Output_section::Input_section_sort_section_name_compare::
3214         operator()): New function.
3215         (Output_section::sort_attached_input_sections): Use new sort function
3216         for .text if --sort-section=name is specified.
3217         * layout.cc (Layout::make_output_section):
3218         Add sorting by name when --sort-section=name is specified.
3219         * testsuite/Makefile.am (text_section_grouping): Test option
3220         --sort-section=name.
3221         * testsuite/Makefile.in: Regenerate.
3222         * testsuite/section_sorting_name.cc: New file.
3223         * testsuite/section_sorting_name.sh: New file.
3224
3225 2013-05-21  Cary Coutant  <ccoutant@google.com>
3226
3227         * symtab.h (Symbol::is_cxx_vtable): New function.
3228         * target-reloc.h (relocate_section): Check for vtable symbol.
3229         * testsuite/Makefile.am (missing_key_func.sh): New test case.
3230         * testsuite/Makefile.in: Regenerate.
3231         * testsuite/missing_key_func.cc: New test source.
3232         * testsuite/missing_key_func.sh: New test script.
3233
3234 2013-05-21  Cary Coutant  <ccoutant@google.com>
3235
3236         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
3237         type of enclosing symbol.
3238         (Relocate_info::location): Check symbol type when describing symbol.
3239         * object.h (Symbol_location_info): Remove unused line_number;
3240         add enclosing_symbol_type.
3241         * testsuite/debug_msg.sh: Adjust expected output.
3242
3243 2013-05-13  Cary Coutant  <ccoutant@google.com>
3244
3245         * configure.ac: Export DEFAULT_TARGET.
3246         * configure: Regenerate.
3247         * Makefile.in: Regenerate.
3248         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
3249         * testsuite/Makefile.in: Regenerate.
3250         * testsuite/debug_msg.sh: Delete duplicate tests.
3251         Don't check undef_int error message match for powerpc where the
3252         source file and line number aren't available.
3253
3254 2013-05-10  Roland McGrath  <mcgrathr@google.com>
3255
3256         * options.h (General_options): Add --rosegment-gap option.
3257         * options.cc (finalize): --rosegment-gap implies --rosegment.
3258         * layout.cc (set_segment_offsets): Let user option override
3259         target->rosegment_gap().
3260
3261 2013-05-10  Roland McGrath  <mcgrathr@google.com>
3262
3263         * options.h (General_options): Remove leading space from help
3264         messages for -nostdlib and --rosegment.
3265
3266 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
3267
3268         PR ld/15365
3269         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
3270
3271 2013-05-03  Alan Modra  <amodra@gmail.com>
3272
3273         * merge.cc (Output_merge_string::do_add_input_section): Correct
3274         scan for number of strings.  Rename vars to avoid shadowing.
3275         Include missing terminator in input_size_.
3276
3277 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
3278
3279         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
3280         Restore empty string handling.
3281
3282 2013-05-01  Cary Coutant  <ccoutant@google.com>
3283
3284         * stringpool.cc (Stringpool_template::new_key_offset): Fix
3285         uninitialized warning.
3286
3287 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
3288
3289         * output.cc (Output_section::add_merge_input_section): Allow
3290         to merge sections if the alignment is more than character size.
3291         * merge.h (Output_merge_string::Output_merge_string): Remove
3292         assert.
3293         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
3294         only not-null strings. Check the alignment of strings.
3295         * stringpool.h
3296         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
3297         alignment as the argument.
3298         (Stringpool_template<Stringpool_char>::addralign_): New class member.
3299         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
3300         Align non-zero length strings according to the addralign_.
3301         (Stringpool_template<Stringpool_char>::set_string_offsets):
3302         Updating offsets according to the given alignment.
3303         * testsuite/Makefile.am (text_section_grouping): Test if string
3304         literals are getting merged.
3305         * testsuite/Makefile.in: Regenerate.
3306         * testsuite/merge_string_literals_1.c: New file.
3307         * testsuite/merge_string_literals_2.c: Ditto.
3308         * testsuite/merge_string_literals.sh: Ditto.
3309
3310 2013-04-26  Ian Lance Taylor  <iant@google.com>
3311
3312         * target-reloc.h (relocate_section): If the reloc offset is out of
3313         range, pass VIEW as NULL to relocate.relocate.
3314         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
3315         * i386.cc (Target_i386::Relocate::relocate): Likewise.
3316         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
3317         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
3318         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
3319         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
3320
3321 2013-04-26  Geoff Pike  <gpike@chromium.org>
3322
3323         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
3324         * layout.cc (Hash_task): New class.
3325         (Layout::queue_build_id_tasks): New function.
3326         (Layout::write_build_id): Handle single-thread portion of build ID
3327         computation.  (In some cases, all of it is single-threaded.)  Replace
3328         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
3329         functionality in fewer lines of code.
3330         * layout.h (Layout::queue_build_id_tasks): New function declaration.
3331         * options.h (General_options): make "--build-id" default to tree
3332         rather than sha1.  Add two new options related to --build-id=tree:
3333         --build-id-chunk-size-for-treehash and
3334         --build-id-min-file-size-for-treehash.
3335         * Makefile.am: add testing of --build-id=tree and related new options
3336         (these tests will be invoked by "make check").
3337         * Makefile.in: Regenerate.
3338
3339 2013-04-25  Alan Modra  <amodra@gmail.com>
3340
3341         * configure.tgt: Add powerpcle and powerpc64le.
3342
3343 2013-04-22  Alan Modra  <amodra@gmail.com>
3344
3345         PR gold/15355
3346         * layout.cc (Layout::segment_precedes): Allow more than one
3347         segment with the same type and flags.
3348
3349 2013-04-15  Cary Coutant  <ccoutant@google.com>
3350
3351         * layout.cc (Layout::set_relocatable_section_offsets): Don't
3352         allocate space in file for BSS sections.
3353
3354 2013-04-15  Cary Coutant  <ccoutant@google.com>
3355
3356         * script-sections.cc (Orphan_output_section): Reset address
3357         to zero after each orphaned section for relocatable links.
3358
3359 2013-04-15  Cary Coutant  <ccoutant@google.com>
3360
3361         * symtab.cc (Symbol_table::sized_write_globals): Subtract
3362         section starting address for relocatable link.
3363         * testsuite/Makefile.am (script_test_11): New test.
3364         * testsuite/Makefile.in: Regenerate.
3365         * testsuite/script_test_11.c: New source file.
3366         * testsuite/script_test_11.t: New linker script.
3367
3368 2013-04-13  Alan Modra  <amodra@gmail.com>
3369
3370         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
3371         owner when sections are not adjacent and exceed group size.
3372         (Target_powerpc::group_sections): Handle corner case.
3373         (Target_powerpc::Branch_info::make_stub): Handle case where
3374         stub table doesn't exist due to branches in non-exec sections.
3375         (Target_powerpc::Relocate::relocate): Likewise.
3376
3377 2013-04-11  Alan Modra  <amodra@gmail.com>
3378
3379         PR gold/15354
3380         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
3381         .branch_lt to match bfd ld.  Adjust comments throughout file.
3382
3383 2013-04-04  Ian Lance Taylor  <iant@google.com>
3384
3385         GCC PR c++/56840
3386         * object.cc (do_layout_deferred_sections): Handle .eh_frame
3387         sections before checking whether they are included in the link.
3388
3389 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
3390
3391         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
3392         object before calling the plugin claim_file handler.  Pass the elf
3393         object of the archive to the plugin. Delete the elf object if the
3394         plugin claims the file.
3395
3396 2013-03-21  Alan Modra  <amodra@gmail.com>
3397
3398         * layout.cc (Layout::set_segment_offsets): Accept writable .text
3399         segment when omagic.
3400
3401 2013-03-21  Alan Modra  <amodra@gmail.com>
3402
3403         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
3404         comparison warning.
3405         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
3406         uninitialized" warning.
3407
3408 2013-03-20  Alan Modra  <amodra@gmail.com>
3409
3410         * symtab.h (Symbol::clear_version): New function.
3411         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
3412         is_needed by weak references.  Clear version for symbols defined
3413         in as-needed objects that are not needed.
3414
3415 2013-03-15  Alan Modra  <amodra@gmail.com>
3416
3417         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
3418         static and public.  Add report_err param.  Return false for data refs.
3419         (Target_powerpc::rela_dyn_section): New overloaded function.
3420         (Target_powerpc::plt_, iplt_): Elucidate.
3421         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
3422         (Output_data_plt_powerpc::do_write): Don't write .iplt.
3423         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
3424         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
3425         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
3426         push_branch and make_plt_entry for ifunc syms when
3427         reloc_needs_plt_for_ifunc.
3428         (Target_powerpc::Relocate::relocate): Don't use plt entry value
3429         for ifunc unless reloc_needs_plt_for_ifunc.
3430
3431 2013-03-15  Alan Modra  <amodra@gmail.com>
3432
3433         * gc.h (gc_process_relocs): Don't look through function descriptors.
3434         * icf.cc (get_section_contents): Do so here instead.
3435
3436 2013-03-13  Alan Modra  <amodra@gmail.com>
3437
3438         * powerpc.cc (is_branch_reloc): Forward declare.
3439         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
3440         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
3441         false for 64-bit, true for 32-bit non-branch relocs.
3442         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
3443         * testsuite/Makefile.am (icf_test): Use linker map file instead of
3444         nm output.
3445         (icf_safe_test): Generate linker map file as well as nm output.
3446         (icf_safe_so_test): Likewise.
3447         * testsuite/Makefile.in: Regenerate.
3448         * testsuite/icf_test.sh: Parse linker map file to determine
3449         section folding.
3450         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
3451         * testsuite/icf_safe_so_test.sh: Likewise.
3452         (X86_32_or_ARM_specific_safe_fold): Merge into..
3453         (arch_specific_safe_fold): ..this.
3454         (X86_64_specific_safe_fold): Delete unused function.
3455
3456 2013-03-12  Alan Modra  <amodra@gmail.com>
3457
3458         * gc.h (gc_process_relocs): Look through function descriptors
3459         to determine shndx, symvalue and addend used by ICF.  Tidy
3460         variable duplication.
3461
3462 2013-03-11  Alan Modra  <amodra@gmail.com>
3463
3464         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
3465         * layout.cc (Layout_task_runner::run): ..to here.
3466         * symtab.h (struct Symbol_location): Extract from..
3467         (class Symbol_table): ..here.
3468         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
3469         * target.h (class Target): Add function_location and
3470         do_function_location functions.
3471         (class Sized_target): Add do_function_location.
3472         * object.h (class Sized_relobj_file): Move find_shdr..
3473         (class Object): ..to here.
3474         * object.cc: Likewise.  Update to suit.  Instantiate.
3475         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
3476         * powerpc.cc (class Powerpc_dynobj): New.
3477         (Target_powerpc::do_function_location): New function.
3478         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
3479         (Powerpc_dynobj::do_read_symbols): New function.
3480         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
3481
3482 2013-03-08  Ian Lance Taylor  <iant@google.com>
3483
3484         * options.cc (General_options::string_to_object_format): Accept
3485         "default".
3486
3487 2013-03-08  Alan Modra  <amodra@gmail.com>
3488
3489         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
3490         pointer to Post_fde.
3491         (struct Post_fde): Move definition to here..
3492         * ehframe.cc (struct Post_fde): ..from here.
3493         (Cie::write): Don't alloc Post_fde.
3494         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
3495
3496 2013-03-07  Alan Modra  <amodra@gmail.com>
3497
3498         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
3499         relocation referencing .LC0.
3500         * testsuite/discard_locals_test.sh: Remove FIXMEs.
3501
3502 2013-03-07  Alan Modra  <amodra@gmail.com>
3503
3504         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
3505         always_inline.  Add assembly for powerpc to avoid GOT.
3506
3507 2013-03-07  Alan Modra  <amodra@gmail.com>
3508
3509         * testsuite/script_test_10.sh: Don't test .bss section
3510         header number.
3511
3512 2013-03-06  Alan Modra  <amodra@gmail.com>
3513
3514         * powerpc.cc (class Powerpc_relobj): Move some member functions.
3515         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
3516         all callers.  Handle folded sections.
3517         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
3518         to Powerpc_relobj.
3519         (Global_symbol_visitor_opd::operator()): Likewise.
3520
3521 2013-03-04  Alan Modra  <amodra@gmail.com>
3522
3523         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
3524         * testsuite/Makefile.in: Regenerate.
3525
3526 2013-03-01  Cary Coutant  <ccoutant@google.com>
3527
3528         Add dwp support for v2 DWARF package file format.
3529         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
3530         tu_length parameter.  Adjust all callers.
3531         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
3532         * dwp.cc: Include dwarf.h.
3533         (Section_bounds): New struct type.
3534         (Unit_set): New struct type.
3535         (Dwo_file::Dwo_file): Initialize new data member.
3536         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
3537         Combine and rename to...
3538         (Dwo_file::read_unit_index): ...this.
3539         (Dwo_file::sized_read_compunit_index)
3540         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
3541         (Dwo_file::sized_read_unit_index): ...this.
3542         (Dwo_file::copy_section): Remove section_name, is_str_offsets
3543         parameters; add section_id parameter.
3544         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
3545         (Dwo_file::add_unit_set): ...this.
3546         (Dwo_file::shndx_map_): Remove.
3547         (Dwo_file::sect_offsets_): New data member.
3548         (Dwp_output_file::Dwp_output_file): Initialize new data members.
3549         (Dwp_output_file::add_section): Rename to...
3550         (Dwp_output_file::add_contribution): ...this.
3551         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
3552         (Dwp_output_file::add_tu_set): Likewise.
3553         (Dwp_output_file::Contribution): New type.
3554         (Dwp_output_file::Section::contributions): New data member.
3555         (Dwp_output_file::Cu_or_tu_set): Remove.
3556         (Dwp_output_file::Section::Section): New ctor.
3557         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
3558         (Dwp_output_file::Dwp_index::Section_table): New type.
3559         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
3560         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
3561         parameter.
3562         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
3563         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
3564         (Dwp_output_file::Dwp_index::section_table): New member function.
3565         (Dwp_output_file::Dwp_index::section_table_end): New member function.
3566         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
3567         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
3568         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
3569         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
3570         (Dwp_output_file::Dwp_index::section_table_): New data member.
3571         (Dwp_output_file::Dwp_index::section_mask_): New data member.
3572         (Dwp_output_file::add_output_section): New member function.
3573         (Dwp_output_file::write_new_section): New member function.
3574         (Dwp_output_file::write_contributions): New member function.
3575         (Dwp_output_file::section_id_map_): New data member.
3576         (class Dwo_id_info_reader): Remove.
3577         (class Unit_reader): New class.
3578         (get_dwarf_section_name): New function.
3579         (Dwo_file::read_executable): Adjust initializations of class data.
3580         (Dwo_file::read): Add support for v2 package file format.
3581         (Dwo_file::read_unit_index): Likewise.
3582         (Dwo_file::sized_read_unit_index): Likewise.
3583         (Dwo_file::copy_section): Likewise.
3584         (Dwo_file::add_unit_set): Likewise.
3585         (Dwp_output_file::add_output_section): Likewise.
3586         (Dwp_output_file::add_contribution): Likewise.
3587         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
3588         for empty slot.
3589         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
3590         file format.
3591         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
3592         slot.
3593         (Dwp_output_file::initialize): Remove unused function.
3594         (Dwp_output_file::finalize): Add support for v2 package file format.
3595         (Dwp_output_file::write_index): Likewise.
3596         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
3597         function prototype.
3598
3599 2013-03-01  Cary Coutant  <ccoutant@google.com>
3600
3601         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
3602         function into class definition in header file.
3603         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
3604         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
3605         New function.
3606         (Dwarf_info_reader::check_buffer): Move here from .cc file.
3607
3608 2013-02-28  Alan Modra  <amodra@gmail.com>
3609
3610         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
3611         * target.cc (Target::do_plt_fde_location): New function.
3612         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
3613         accessor function, and constructor param.
3614         (struct Post_fde, Post_fdes): Declare.
3615         (Cie::write): Add post_fdes param.
3616         * ehframe.cc (Fde::write): Use plt_fde_location.
3617         (struct Post_fde): Define.
3618         (Cie::write): Stash FDEs added post merge mapping.
3619         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
3620         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
3621         (Eh_frame::do_sized_write): Arrange to write post map FDES after
3622         other FDEs.
3623         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
3624         (Target_powerpc::has_glink): New function.
3625         (Target_powerpc::do_relax): Add eh_frame info for stubs.
3626         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
3627         glink_eh_frame_fde_32, default_fde): New data.
3628         (Stub_table::eh_frame_added_): New var.
3629         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
3630         Make const.
3631         (Stub_table::add_eh_frame): New function.
3632         (Output_data_glink::add_eh_frame): New function.
3633         (Target_powerpc::make_glink_section): Call add_eh_frame.
3634
3635 2013-02-15  Ian Lance Taylor  <iant@google.com>
3636
3637         * options.h (DEFINE_uint64_alias): Define.
3638         (class General_options): Add -Ttext-segment as an alias for
3639         -Ttext.
3640
3641 2013-02-15  Alan Modra  <amodra@gmail.com>
3642
3643         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
3644         (Stub_table::do_write): ..here, two places.
3645         (Stub_table::plt_call_size): Use it here too.
3646
3647 2013-02-11  Ian Lance Taylor  <iant@google.com>
3648
3649         * descriptors.cc (Descriptors::close_all): New function.
3650         * descriptors.h (class Descriptors): Declare close_all.
3651         (close_all_descriptors): New inline function.
3652         * plugin.cc: Include "descriptors.h".
3653         (Plugin_manager::cleanup): Call close_all_descriptors.
3654
3655 2013-02-06  Alan Modra  <amodra@gmail.com>
3656
3657         * README: Update coding style link.
3658
3659 2013-01-28  Cary Coutant  <ccoutant@google.com>
3660
3661         * dwp.cc (File_list): New typedef.
3662         (Dwo_name_info_reader): New class.
3663         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
3664         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
3665         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
3666         (Dwo_file::read_executable): New function.
3667         (Dwo_file::read): Move common setup code to ...
3668         (Dwo_file::make_object): ... here.
3669         (dwp_options): Add --exec/-e.
3670         (usage): Likewise.
3671         (main): Likewise.
3672
3673 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
3674
3675         * layout.cc (Layout::layout): Check for option text_reorder.
3676         (Layout::make_output_section): Ditto.
3677         * options.h (text_reorder): New option.
3678         * output.cc (Input_section_sort_compare): Remove special ordering
3679         of section names.
3680         (Output_section::
3681          Input_section_sort_section_name_special_ordering_compare::
3682          operator()): New function.
3683         (Output_section::sort_attached_input_sections): Use new sort function
3684         for .text.
3685         * output.h (Input_section_sort_section_name_special_ordering_compare):
3686         New struct.
3687         * testsuite/Makefile.am (text_section_grouping): Test option
3688         --no-text-reorder
3689         * testsuite/Makefile.in: Regenerate.
3690         * testsuite/text_section_grouping.sh: Check order of functions without
3691         default text reordering.
3692
3693 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3694
3695         * options.h (General_options): Change default to true for new_dtags.
3696
3697 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3698
3699         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
3700         when enable_new_dtags is false.  Only add DT_RUNPATH when
3701         enable_new_dtags is true.
3702
3703 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
3704
3705         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
3706         used in declaration and definition consistent.
3707         (Target_powerpc::symval_for_branch): Ditto.
3708
3709 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3710
3711         * testsuite/plugin_final_layout.cc: Fix comment.
3712
3713 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3714
3715         * layout.cc (Layout::layout): Do not do default sorting for
3716         text sections when section ordering is specified.
3717         (make_output_section): Ditto.
3718         * testsuite/plugin_final_layout.cc: Name the function sections
3719         to catch reordering issues.
3720
3721 2013-01-15  Alan Modra  <amodra@gmail.com>
3722
3723         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
3724         plt-thread-safe.
3725
3726 2013-01-15  Alan Modra  <amodra@gmail.com>
3727
3728         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
3729         * testsuite/Makefile.in: Regenerate.
3730
3731 2013-01-14  Alan Modra  <amodra@gmail.com>
3732
3733         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
3734         * testsuite/Makefile.in: Regenerate.
3735
3736 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
3737
3738         PR bfd/14430
3739         Fix mingw gold build with plugins enabled
3740         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
3741         * configure.ac: Export DLOPEN_LIBS and add headers check.
3742         * plugin.cc: Handle non-dlfcn case.
3743         * Makefile.in: Regenerate.
3744         * config.in: Regenerate.
3745         * configure: Regenerate.
3746         * testsuite/Makefile.in: Regenerate.
3747
3748 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
3749
3750         * output.h (sort_attached_input_sections): Change to be public.
3751         * script-sections.cc
3752         (Output_section_definition::set_section_addresses): Sort
3753         attached input sections according to section order before linker
3754         script assigns section addresses.
3755         (Orphan_output_section::set_section_addresses): Sort
3756         attached input sections according to section order before linker
3757         script assigns section addresses.
3758         * Makefile.am (final_layout.sh): Use a simple linker script to
3759         check if section ordering still works.
3760         * Makefile.in: Regenerate.
3761
3762 2013-01-09  Ben Cheng  <bccheng@google.com>
3763
3764         * arm.cc (Target_arm::attributes_accept_div): New function.
3765         (Target_arm::attributes_forbid_div): New function.
3766         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
3767         attribute using the same new functions as what bfd/elf32_arm.c
3768         does.
3769
3770 2013-01-07  Cary Coutant  <ccoutant@google.com>
3771
3772         PR gold/14993
3773         * output.cc (Output_section::add_input_section): For incremental
3774         updates, don't track input sections that are allocated from patch
3775         space.
3776
3777 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3778             Ian Lance Taylor  <iant@google.com>
3779
3780         PR gold/14897
3781         * configure.ac (--enable-ld): Removed.
3782         (install_as_default): Set to yes only for --enable-gold=default
3783         or --disable-ld.
3784         * configure: Regenerated.
3785
3786 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3787
3788         * options.h (General_options): Add -fuse-ld= for GCC linker
3789         option compatibility.
3790
3791 2013-01-04  Cary Coutant  <ccoutant@google.com>
3792
3793         * configure.ac: Fix typo restoring CXXFLAGS.
3794         * configure: Regenerate.
3795
3796 2013-01-04  Cary Coutant  <ccoutant@google.com>
3797
3798         * testsuite/Makefile.am (CXXLINK_S): New macro.
3799         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
3800         * testsuite/Makefile.in: Regenerate.
3801
3802 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
3803
3804         * version.cc (print_version): Update copyright year to 2013.
3805
3806 2012-12-20  Ian Lance Taylor  <iant@google.com>
3807
3808         * layout.cc (Layout::special_ordering_of_input_section): New
3809         function.
3810         (Layout::layout): If input section requires special ordering, must
3811         sort input sections.
3812         (Layout::make_output_section): May sort .text input sections.
3813         (Layout::is_section_name_prefix_grouped): Remove.
3814         * layout.h (class Layout): Declare
3815         special_ordering_of_input_section.  Don't declare
3816         is_section_name_prefix_grouped.
3817         * output.cc (Output_section::add_input_section): Revert last
3818         change.
3819         (Output_section::Input_section_sort::match_file_name): Don't crash
3820         if called on output section data.
3821         (Output_section::Input_section_sort_compare): Sort based on
3822         special ordering.
3823         (Output_section::Input_section_sort_section_order_index_compare):
3824         Revert last patch.
3825         (Output_section::sort_attached_input_sections): Likewise.
3826
3827 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
3828
3829         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
3830         * layout.h (Layout::is_section_name_prefix_grouped): New function.
3831         * output.cc (Output_section::add_input_section): Check if section
3832         name contains special prefix.  Keep input sections to sort such
3833         sections.
3834         (Output_section::Input_section_sort_section_order_index_compare
3835          ::operator()): Group sections according to prefixes.
3836         (Output_section::sort_attached_input_sections): Add condition to
3837         Input_section_entry constructor call.
3838         * testsuite/Makefile.am (text_section_grouping): New test.
3839         * testsuite/Makefile.in: Regenerate.
3840         * testsuite/text_section_grouping.cc: New file.
3841         * testsuite/text_section_grouping.sh: New file.
3842
3843 2012-12-17  Nick Clifton  <nickc@redhat.com>
3844
3845         * Makefile.am: Add copyright notice.
3846         * NEWS: Likewise.
3847         * README: Likewise.
3848         * configure.ac: Likewise.
3849         * ftruncate.c: Likewise.
3850         * Makefile.in: Regenerate.
3851
3852 2012-12-14  Cary Coutant  <ccoutant@google.com>
3853
3854         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
3855         --no-as-needed flag.
3856         (exception_separate_shared_12_test): Likewise.
3857         (incremental_copy_test): Likewise.
3858         * testsuite/Makefile.in: Regenerate.
3859
3860 2012-12-14  Cary Coutant  <ccoutant@google.com>
3861
3862         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
3863         (Dwp_output_file::Dwp_index::enter_set): Add assert.
3864
3865 2012-12-12  Alan Modra  <amodra@gmail.com>
3866
3867         * powerpc.cc (class Track_tls): New.
3868         (class Relocate, class Scan): Inherit Track_tls.
3869         (Target_powerpc::Scan::local, global): Track tls optimization
3870         and avoid creating plt entry for __tls_get_addr if all uses
3871         are optimized away.
3872         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
3873
3874 2012-12-12  Alan Modra  <amodra@gmail.com>
3875
3876         * options.h (General_options): Add --toc-sort/--no-toc-sort.
3877         Replace no_toc_optimize with toc_optimize.
3878         * output.h (Output_section::input_sections): Provide non-const variant.
3879         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
3880         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
3881         accessors.
3882         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
3883         (class Sort_toc_sections): New.
3884         (Target_powerpc::do_finalize_sections): Sort toc sections.
3885         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
3886
3887 2012-12-10  Roland McGrath  <mcgrathr@google.com>
3888
3889         * testsuite/binary_unittest.cc (read_all): New function.
3890         (Sized_binary_test): Use it instead of ::read.
3891         * fileread.cc (do_read): Don't assume pread always reads the whole
3892         amount in a single call.
3893
3894 2012-12-10  Alan Modra  <amodra@gmail.com>
3895
3896         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
3897         Set EM_PPC64 or EM_PPC here.
3898         (Target_selector_powerpc::do_recognize): Delete.
3899
3900 2012-12-10  Alan Modra  <amodra@gmail.com>
3901
3902         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
3903         stub_table_.
3904         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
3905
3906 2012-12-07  Roland McGrath  <mcgrathr@google.com>
3907
3908         * testsuite/binary_unittest.cc (Sized_binary_test):
3909         Use open_descriptor rather than ::open.
3910
3911 2012-12-07  Alan Modra  <amodra@gmail.com>
3912
3913         * powerpc.cc (Stub_table::do_write): Delete redundant Address
3914         typedef and invalid_address constant.
3915         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
3916         instantiate constants.
3917
3918 2012-12-06  Roland McGrath  <mcgrathr@google.com>
3919
3920         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
3921         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
3922         * aclocal.m4: Regenerate.
3923         * configure: Regenerate.
3924         * Makefile.in: Regenerate.
3925         * testsuite/Makefile.in: Regenerate.
3926
3927 2012-12-07  Alan Modra  <amodra@gmail.com>
3928
3929         * options.h (General_options): Add no_toc_optimize.
3930         * powerpc.cc (ok_lo_toc_insn): New function.
3931         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
3932
3933 2012-12-06  Alan Modra  <amodra@gmail.com>
3934
3935         * options.h (General_options): Add plt_align, plt_static_chain,
3936         plt_thread_safe.  Update stub_group_size help text.
3937         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
3938         for new plt_thread_safe_ var.
3939         (use_plt_offset): Correct comments.
3940         (Target_powerpc::do_relax): Look for thread creation symbols to
3941         determine default plt_thread_safe value.  Clear plt call stubs
3942         as well as branch stubs each iteration.
3943         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
3944         insn constants.
3945         (l, hi, ha, write_insn): Move earlier.
3946         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
3947         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
3948         plt stubs too.
3949         (Stub_table::update_size): Adjust.
3950         (Stub_table::prev_size, set_prev_size): Delete.
3951         (Stub_table::stub_align): Let --plt-align affect result.
3952         (Stub_table::plt_call_size): Calculate sizes for various stubs.
3953         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
3954         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
3955         (Stub_table::do_write): Support more stub variants.
3956
3957 2012-12-04  Alan Modra  <amodra@gmail.com>
3958
3959         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
3960         (Target_powerpc::do_define_standard_symbols): New function.
3961
3962 2012-12-03  Alan Modra  <amodra@gmail.com>
3963
3964         * output.h: Formatting, whitespace.
3965
3966 2012-12-03  Alan Modra  <amodra@gmail.com>
3967
3968         * layout.h (Layout::get_executable_sections): Declare.
3969         * layout.cc (Layout::get_executable_sections): New function.
3970         * arm.cc (Target_arm::group_sections): Use it.
3971         (Arm_output_section::group_sections): Delete now redundant test.
3972         * output.cc (Output_reloc::Output_reloc): Add is_relative.
3973         param to handle relative relocs.
3974         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
3975         (Output_data_reloc::add_absolute): Adjust.
3976         (Output_data_reloc::add_relative): New function.
3977         (Output_data::reset_data_size): New function.
3978         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
3979         (Output_section::set_addralign): New function.
3980         (Output_section::checkpoint_set_addralign): New function.
3981         (Output_section::clear_section_offsets_need_adjustment): New function.
3982         (Output_section::input_sections): Make public.
3983         * powerpc.cc (class Output_data_brlt_powerpc): New.
3984         (class Stub_table, class Stub_control): New.
3985         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
3986         stub_table_, set_stub_table, stub_table): New vectors and accessor
3987         functions.
3988         (Target_powerpc::do_may_relax, do_relax, push_branch,
3989         new_stub_table, stub_tables, brlt_section, group_sections,
3990         add_branch_lookup_table, find_branch_lookup_table,
3991         write_branch_lookup_table, make_brlt_section): New functions.
3992         (Target_powerpc::struct Sort_sections, class Branch_info): New.
3993         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
3994         branch_info_): New vars.
3995         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
3996         make call stubs here.
3997         (Output_data_glink): Remove all call stub handling from this class.
3998         (Target_powerpc::Scan::local, global): Save interesting branch
3999         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
4000         (Target_powerpc::do_finalize_sections): Only make reg save/restore
4001         functions on final link.
4002         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
4003         Handle long branch destinations too.
4004         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
4005         do_plt_address_for_local): Adjust lookup of plt call stubs.
4006
4007 2012-11-30  Alan Modra  <amodra@gmail.com>
4008
4009         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
4010         relocs against protected symbols when building 32-bit shared libs.
4011
4012 2012-11-30  Alan Modra  <amodra@gmail.com>
4013
4014         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
4015         param.  Call got_section() to make .got.  Update all callers
4016         and their callers and so on.
4017
4018 2012-11-30  Alan Modra  <amodra@gmail.com>
4019
4020         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
4021         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
4022         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
4023         value if it already exists.
4024
4025 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
4026
4027         PR gold/14858
4028         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
4029
4030 2012-11-14  Roland McGrath  <mcgrathr@google.com>
4031
4032         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
4033         than bfc instruction for data sandboxing.
4034
4035 2012-11-08  Alan Modra  <amodra@gmail.com>
4036
4037         * po/POTFILES.in: Regenerate.
4038
4039 2012-11-05  Alan Modra  <amodra@gmail.com>
4040
4041         * configure.ac: Apply 2012-09-10 change to config.in here.
4042         * configure: Regenerate.
4043
4044 2012-11-05  Alan Modra  <amodra@gmail.com>
4045
4046         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
4047         (struct Opd_ent): Use "Address" rather than "Offset".
4048         (Output_data_got_powerpc::got_base_offset): Return Valtype.
4049         (Target_powerpc::got_section): Make public.
4050         (Target_powerpc::scan_relocs): Move code setting symbols..
4051         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
4052         Create _SDA_BASE_ only when referenced.
4053
4054 2012-11-02  Roland McGrath  <mcgrathr@google.com>
4055
4056         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
4057         from last change.
4058
4059 2012-11-01  Roland McGrath  <mcgrathr@google.com>
4060
4061         * target.h (Sized_target::relocate_relocs): Use Elf_Off
4062         for offset_in_output_section parameter.
4063         (Sized_target::relocate_special_relocatable): Likewise.
4064         * arm.cc (Target_arm::relocate_relocs): Likewise.
4065         (Target_arm::relocate_special_relocatable): Likewise.
4066         * i386.cc (Target_i386::relocate_relocs): Likewise.
4067         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
4068         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
4069         * target-reloc.h (relocate_relocs): Likewise.
4070         * testsuite/testfile.cc (Target_test): Likewise.
4071         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
4072         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
4073
4074         * system.h: Move inclusion of <clocale> to after <libintl.h> in
4075         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
4076
4077         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
4078         parameter, which is unused in the [!F_SETFD] case.
4079
4080         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
4081         SYMNDX to off_t before comparing it to this->data_size().
4082         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
4083         * incremental.cc (Output_section_incremental_inputs::do_write):
4084         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
4085
4086         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
4087
4088 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
4089
4090         * gold.cc (Target_arm::do_adjust_elf_header): Add the
4091         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
4092         in EABI_VER5.
4093
4094 2012-10-29  Cary Coutant  <ccoutant@google.com>
4095
4096         * dwp.cc (usage): Add file and exit status parameters;
4097         add --help and --version options.
4098         (print_version): New function.
4099         (main): Add --help and --version options.
4100
4101 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4102
4103         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
4104         final_layout_sequence.txt.
4105         * testsuite/Makefile.in: Regenerated.
4106
4107 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4108
4109         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
4110         COMPILE generated by automake.
4111         (LINK1): Likewise.
4112         (CXXCOMPILE1): Likewise.
4113         (CXXLINK1): Likewise.
4114         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
4115         (LINK): Likewise.
4116         (CXXCOMPILE): Likewise.
4117         (CXXLINK): Likewise.
4118         * testsuite/Makefile.in: Regenerated.
4119
4120 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4121
4122         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
4123         on bad fwrite return.
4124
4125 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
4126
4127         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
4128         on val.
4129
4130 2012-10-23  Cary Coutant  <ccoutant@google.com>
4131
4132         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
4133         * testsuite/Makefile.in: Regenerate.
4134         * testsuite/dwp_test.h: New source file.
4135         * testsuite/dwp_test_1.cc: New source file.
4136         * testsuite/dwp_test_1.s: New source file.
4137         * testsuite/dwp_test_1.sh: New source file.
4138         * testsuite/dwp_test_1b.cc: New source file.
4139         * testsuite/dwp_test_1b.s: New source file.
4140         * testsuite/dwp_test_2.cc: New source file.
4141         * testsuite/dwp_test_2.s: New source file.
4142         * testsuite/dwp_test_2.sh: New source file.
4143         * testsuite/dwp_test_main.cc: New source file.
4144         * testsuite/dwp_test_main.s: New source file.
4145
4146 2012-10-23  Cary Coutant  <ccoutant@google.com>
4147
4148         * dwp.h: New header file.
4149         * dwp.cc: New source file.
4150         * gold.h: Move shared declarations to system.h.
4151         * system.h: New header file.
4152         * Makefile.am: Add dwp.
4153         * Makefile.in: Regenerate.
4154
4155 2012-10-23  Cary Coutant  <ccoutant@google.com>
4156
4157         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
4158         Dwarf_info_reader::read_from_pointer.
4159         (Dwarf_pubnames_table::read_header): Likewise.
4160         (Dwarf_pubnames_table::next_name): Likewise.
4161         (Dwarf_die::read_attributes): Likewise.
4162         (Dwarf_die::skip_attributes): Likewise.
4163         (Dwarf_info_reader::read_from_pointer): New function template.
4164         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
4165         (Dwarf_pubnames_table): Likewise.
4166         (Dwarf_info_reader::read_from_pointer): New function template.
4167         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
4168         Dwarf_pubnames_table ctor.
4169
4170 2012-10-23  Cary Coutant  <ccoutant@google.com>
4171
4172         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
4173         abbrev_shndx.
4174         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
4175         abbrev_shndx_.
4176         (Dwarf_info_reader::set_abbrev_shndx): New method.
4177         (Dwarf_info_reader::abbrev_shndx_): New data member.
4178
4179 2012-10-23  Cary Coutant  <ccoutant@google.com>
4180
4181         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
4182         from object, not parameters.
4183         (Dwarf_info_reader::parse): Likewise.
4184         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
4185         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
4186         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
4187         methods.
4188
4189 2012-10-23  Cary Coutant  <ccoutant@google.com>
4190
4191         * fileread.cc (Input_file::Input_file): New constructor.
4192         * fileread.h (class Input_file): Add new constructor.
4193
4194 2012-10-18  Alan Modra  <amodra@gmail.com>
4195
4196         PR gold/14727
4197         * object.cc (Relobj::is_section_name_included): Also match
4198         .sdata personality section.
4199
4200 2012-10-18  Alan Modra  <amodra@gmail.com>
4201
4202         * target-reloc.h (class Default_comdat_behavior): New, package up..
4203         (get_comdat_behaviour): ..this.
4204         (relocate_section): Add Relocate_comdat_behavior template arg,
4205         adjust code to suit.
4206         * arm.cc (Target_arm::relocate_section): Adjust to suit.
4207         (Target_arm::scan_reloc_section): Likewise.
4208         * i386.cc (Target_i386::relocate_section): Likewise.
4209         * sparc.cc (Target_sparc::relocate_section): Likewise.
4210         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
4211         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
4212         * powerpc.cc (class Relocate_comdat_behavior): New.
4213         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
4214         gold::relocate_section with new template arg.
4215
4216 2012-10-18  Alan Modra  <amodra@gmail.com>
4217
4218         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
4219         dynamic relocs for GOT_TPREL got entries, without symbol if
4220         resolving locally.
4221         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
4222         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
4223         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
4224
4225 2012-10-17  Alan Modra  <amodra@gmail.com>
4226
4227         PR gold/14726
4228         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
4229
4230 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
4231
4232         * layout.cc (Layout::include_section): Keep sections marked
4233         SHF_EXCLUDE when doing relocatable links.
4234
4235 2012-10-16  Alan Modra  <amodra@gmail.com>
4236
4237         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
4238         (Target_powerpc::do_finalize_sections): Call it.
4239         (Output_data_save_res): New class and supporting functions.
4240         (Target_powerpc::symval_for_branch): Only look up .opd entry for
4241         normal symbols defined in object files.
4242
4243 2012-10-12  Alan Modra  <amodra@gmail.com>
4244
4245         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
4246         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
4247         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
4248         section if scan_opd_relocs not yet called.
4249         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
4250
4251 2012-10-12  Alan Modra  <amodra@gmail.com>
4252
4253         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
4254         add_local_ifunc_entry): Revert last change.
4255         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
4256
4257 2012-10-05  Alan Modra  <amodra@gmail.com>
4258
4259         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
4260         do_plt_address_for_global): New functions.
4261         (Output_data_got_powerpc::do_write): Don't segfault when linking
4262         statically.
4263         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
4264         add_local_ifunc_entry): Return true on adding entry..
4265         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
4266         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
4267         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
4268         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
4269         set up symbols here.
4270         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
4271         syms here.  Do so even when no .iplt.  Don't segfault when linking
4272         statically.
4273         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
4274         new variants without reloc param.
4275         (Glink_sym_ent::Glink_sym_ent): Likewise.
4276         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
4277         reloc when refs will resolve to plt call stub.
4278         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
4279         R_PPC_PLTREL24 to resolve locally.
4280         (Target_powerpc::Scan::global): Correct ifunc handling.
4281         (Target_powerpc::Relocate::relocate): Correct local sym glink
4282         lookup.  Don't destroy "value" when we have a plt call stub,
4283         and when checking plt call validity.
4284         (Target_powerpc::do_dynsym_value): Simplify.
4285
4286 2012-10-05  Alan Modra  <amodra@gmail.com>
4287
4288         * i386.cc (Output_data_plt_i386::address_for_global,
4289         address_for_local): Add plt offset to returned value.  Adjust uses.
4290         * sparc.cc (Output_data_plt_sparc::address_for_global,
4291         address_for_local): Likewise.
4292         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
4293         address_for_local): Likewise.
4294         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
4295         address_for_local): Likewise.
4296         * target.h (Target::plt_address_for_global, plt_address_for_local):
4297         Update comment.
4298         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
4299         (Output_data_got::Got_entry::write): Nor here.
4300         * output.h: Comment fix.
4301
4302 2012-10-02  Jiong Wang  <jiwang@tilera.com>
4303
4304         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
4305         global_offset_table_ value for larget got.
4306         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
4307
4308 2012-09-29  Alan Modra  <amodra@gmail.com>
4309
4310         * powerpc.cc (Target_powerpc::iplt_): New output section.
4311         (Target_powerpc::iplt_section, make_iplt_section,
4312         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
4313         (Target_powerpc::make_plt_entry): Handle ifunc syms.
4314         Target_powerpc::plt_entry_count): Count iplt entries too.
4315         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
4316         reloc section in constructor.  New params.
4317         (Target_powerpc::make_plt_section): Create reloc section here instead.
4318         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
4319         functions.
4320         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
4321         (Output_data_glink::add_entry, find_entry): New functions to
4322         deal with local syms.
4323         (Glink_sym_ent): Add support for local syms.
4324         (Output_data_glink::do_write): Handle ifunc plt entries.
4325         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4326         (Target_powerpc::Scan::local, global): Handle ifunc syms.
4327         (Target_powerpc::Relocate::relocate): Likewise.
4328         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
4329
4330 2012-09-25  Alan Modra  <amodra@gmail.com>
4331
4332         * object.h (Sized_relobj_file::adjust_local_symbol,
4333         do_adjust_local_symbol): New functions.
4334         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
4335         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
4336         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
4337         and irregular opd entry spacing.
4338         (Powerpc_relobj::do_read_relocs): Add opd size checks.
4339         (Global_symbol_visitor_opd): New functor.
4340         (Target_powerpc::do_finalize_sections): Omit global symbols defined
4341         on deleted opd entries.
4342
4343 2012-09-15  Jiong Wang  <jiwang@tilera.com>
4344
4345         * tilegx.cc: New file.
4346         * Makefile.am (TARGETSOURCES): Add tilegx.cc
4347         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
4348         * configure.tgt: Add entries for tilegx*.
4349         * configure.ac: Likewise.
4350         * Makefile.in: Rebuild.
4351         * configure: Likewise.
4352         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
4353         tilegx.
4354
4355 2012-09-13  Alan Modra  <amodra@gmail.com>
4356
4357         * target-reloc.h (scan_relocs): Call scan.local for relocs
4358         against symbols in discarded sections.  Pass is_discarded
4359         param.
4360         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
4361         Add is_discarded param.
4362         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
4363         is_discarded to flag opd entry as discarded.  Don't emit dyn
4364         relocs on such entries.
4365         (Target_powerpc::Scan::global): Similarly detect and handle
4366         such opd entries.
4367         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
4368         opd_ent_.  Update all uses.
4369         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
4370         (Target_powerpc::relocate_section): Zero out discarded opd
4371         entry relocs.
4372
4373 2012-09-12  Ian Lance Taylor  <iant@google.com>
4374
4375         PR gold/14570
4376         * output.cc: Rename Output_data_got template parameter from size
4377         to got_size for all functions.  Compile all variants of
4378         Output_data_got.
4379         (Output_data_got::Got_entry::write): Correct use of size for
4380         symbol value.  Use local_is_tls rather than casting to
4381         Sized_relobj_file.
4382         * object.h (class Object): Add local_is_tls and do_local_is_tls.
4383         (class Sized_relobj_file): Add do_local_is_tls.
4384         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
4385
4386 2012-09-11  Alan Modra  <amodra@gmail.com>
4387
4388         PR gold/14566
4389         * layout.cc (Layout::set_segment_offsets): When using
4390         common-page-size alignment, ensure we are on a new max-page-size
4391         page.
4392         * output.cc (Output_segment::set_section_addresses): Use
4393         abi_pagesize, not common_pagesize for relro boundary.
4394         (Output_segment::set_offset): Likewise.
4395
4396 2012-09-11  Alan Modra  <amodra@gmail.com>
4397
4398         * output.h (Output_data_got::add_global_tls, add_local_tls,
4399         add_local_tls_pair): New functions.
4400         (Output_data_got::add_local_pair_with_rel): Remove second
4401         reloc param.  Expand comment.
4402         (Output_data_got::Got_entry): Rename use_plt_offset_ to
4403         use_plt_or_tls_offset_, similarly for constructor param.
4404         (Output_data_got::Got_entry::write): Add got_index param.
4405         * output.cc (Output_data_got::add_global_tls, add_local_tls,
4406         add_local_tls_pair): New functions.
4407         (Output_data_got::Got_entry::write): Handle tls symbols
4408         with use_plt_or_tls_offset_ set specially.
4409         (Output_data_got::add_local_pair_with_rel): Only one reloc.
4410         (Output_data_got::do_write): Replace iterator with index, pass
4411         index to entry write function.
4412         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
4413         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
4414         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
4415         call.
4416         * i386.cc (Target_i386::Scan::local): Likewise.
4417         * sparc.cc (Target_sparc::Scan::local): Likewise.
4418         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
4419         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
4420         do_tls_offset_for_global): New functions.
4421         (Target_powerpc::Scan::local): Correct TLS relocations and got
4422         entry values.
4423         (Target_powerpc::Scan::global): Don't emit unnecessary
4424         dynamic relocations on TLS GOT entries.
4425
4426 2012-09-10  Matthias Klose  <doko@ubuntu.com>
4427
4428         * config.in: Disable sanity check for kfreebsd.
4429
4430 2012-09-10  Sterling Augustine  <saugustine@google.com>
4431
4432         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
4433         (Gdb_index::pubtypes_read): New parameter.
4434         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
4435         to calls.
4436         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
4437         pubtypes_object_.
4438
4439 2012-09-09  Alan Modra  <amodra@gmail.com>
4440
4441         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
4442         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
4443         * gc.h (gc_process_relocs): Call target gc_add_reference.
4444         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
4445         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
4446         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
4447         unnecessary cast.
4448         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
4449         to cater for when we don't need code offset.  Update use.
4450         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
4451         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
4452         set_opd_valid): New functions.
4453         (Target_powerpc::do_gc_add_reference): New function.
4454         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
4455         stashed refs.
4456         (Target_powerpc::do_gc_mark_symbol): New function.
4457
4458 2012-09-06  Cary Coutant  <ccoutant@google.com>
4459
4460         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
4461         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
4462         (Dwarf_die::skip_attributes): Likewise.
4463         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
4464         * testsuite/gdb_index_test.cc (inline_func_1): New function.
4465         (main): Call it.
4466         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
4467
4468 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
4469
4470         * testsuite/script_test_3.t: Add .got.plt output section
4471         statement.
4472         * testsuite/script_test_4.t: Likewise.
4473
4474 2012-09-05  Alan Modra  <amodra@gmail.com>
4475
4476         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
4477         update all uses and lose "enum" when using type.
4478
4479 2012-09-05  Alan Modra  <amodra@gmail.com>
4480
4481         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
4482         * configure: Regenerate.
4483         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
4484         (plugin_final_layout.stdout): Likewise.
4485         (memory_test): Set page sizes to 0x1000.
4486         * testsuite/Makefile.in: Regenerate.
4487         * testsuite/discard_locals_test.sh: Add FIXME comment.
4488         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
4489         * testsuite/pr14265.t: Add .got output section statement.
4490         * testsuite/script_test_2.t: Likewise.
4491         * testsuite/script_test_3.t: Likewise.
4492         * testsuite/script_test_4.t: Likewise.
4493         * testsuite/script_test_5.t: Likewise.
4494         * testsuite/script_test_6.t: Likewise.
4495         * testsuite/script_test_7.t: Likewise.
4496         * testsuite/script_test_9.t: Likewise.
4497
4498 2012-09-05  Alan Modra  <amodra@gmail.com>
4499
4500         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
4501         (Powerpc_relocate_functions::Status): New typedef.
4502         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4503         (Target_powerpc::Scan::local): Handle REL64.
4504         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
4505         for REL32 and REL64.
4506         (Target_powerpc::symval_for_branch): New function, extracted from..
4507         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
4508         checks.  Report overflow errors.
4509
4510 2012-09-05  Alan Modra  <amodra@gmail.com>
4511
4512         * object.h (Sized_relobj_file::emit_relocs): Delete.
4513         (Sized_relobj_file::emit_relocs_reltype): Delete.
4514         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
4515         relocate_relocs for --emit-relocs.
4516         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
4517         * output.h: Update comment.
4518         (Output_segment::first_section): New function.
4519         (Output_segment::first_section_load_address): Use first_section.
4520         * output.cc (Output_segment::first_section): New function extracted..
4521         (Output_segment::first_section_load_address): ..from here.  Delete.
4522         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
4523         * target.h (Sized_target::relocate_for_relocatable): Likewise.
4524         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
4525         adjust call to target.h function.
4526         * i386.cc (Target_i386): Likewise.
4527         * sparc.cc (Target_sparc): Likewise.
4528         * x86_64.cc (Target_x86_64): Likewise.
4529         * powerpc.cc (Target_powerpc): Likewise.
4530         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
4531         first tls section has section symbol for optimised local dynamic
4532         output relocs.
4533         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
4534         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
4535         optimised tls code.
4536         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
4537         Rename to relocate_relocs.  Update error message.
4538
4539 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
4540
4541         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
4542         --just-symbols.
4543
4544 2012-08-31  Alan Modra  <amodra@gmail.com>
4545
4546         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
4547         (Powerpc_relobj::toc_base_offset): New stub function.
4548         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
4549         got_mod_index_offset to tlsld_got_offset.  Update all refs.
4550         (Target_powerpc::Relocate::enum skip_tls): New.
4551         (Target_powerpc::call_tls_get_addr_): New var.
4552         (Target_powerpc::is_branch_reloc): Move to file scope.
4553         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
4554         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
4555         New functions.
4556         (Target_powerpc::enum Got_type): Delete old values, add new ones.
4557         (powerpc_info): Correct common_pagesize for ppc64.
4558         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
4559         (Powerpc_relocate_functions): Add overflow check enums and functions.
4560         Add non-shift version of rela, rela_ua.  Delete all rel public
4561         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
4562         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
4563         addr16_ha3, addr14 functions.
4564         (Output_data_got_powerpc::add_constant_pair): New function.
4565         (Output_data_got_powerpc::got_base_offset): Likewise.
4566         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
4567         (instruction constants): Sort, add some more.
4568         (Output_data_glink::do_write): Add and use Address typedef.  Use
4569         object->toc_base_offset() stub for 64-bit.
4570         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
4571         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4572         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
4573         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
4574         Always treat .opd relocs as against locally defined symbol.
4575         Correct condition for RELATIVE relocs.
4576         (Target_powerpc::do_finalize_sections): Test for NULL sections.
4577         (Target_powerpc::Relocate::relocate): Use plt call stub as value
4578         for 32-bit syms with a plt entry.  Correct ppc64 toc base
4579         calculations.  Handle TLS relocs, and more.  Add overflow
4580         checking and adjust for Powerpc_relocate_functions changes.
4581         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
4582         Reinstate --emit-relocs code with FIXME.
4583
4584 2012-08-30  Alan Modra  <amodra@gmail.com>
4585
4586         * layout.cc (Layout::set_segment_offsets): Set p_align to
4587         abi_pagesize, not common_pagesize.
4588         (Layout::relaxation_loop_body): Similarly use abi_pagesize
4589         to determine whether file header can go in segment.
4590
4591 2012-08-30  Alan Modra  <amodra@gmail.com>
4592
4593         * output.h (Output_reloc::Output_reloc <output section>): Add
4594         is_relative param.  Adjust calls.
4595         (Output_reloc::add_output_section_relative): New functions.
4596         * output.cc (Output_reloc::Output_reloc <output section>): Handle
4597         is_relative.
4598         (Output_reloc::symbol_value): Handle SECTION_CODE.
4599
4600 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
4601
4602         * gold.cc (queue_middle_tasks): Call layout again when unique
4603         segments for sections is desired.
4604         * layout.cc (Layout::Layout): Initialize new members.
4605         (Layout::get_output_section_flags): New function.
4606         (Layout::choose_output_section): Call get_output_section_flags.
4607         (Layout::layout): Make output section for mapping to a unique segment.
4608         (Layout::insert_section_segment_map): New function.
4609         (Layout::attach_allocated_section_to_segment): Make unique segment for
4610         output sections marked so.
4611         (Layout::segment_precedes): Check for unique segments when sorting.
4612         * layout.h (Layout::Unique_segment_info): New struct.
4613         (Layout::Section_segment_map): New typedef.
4614         (Layout::insert_section_segment_map): New function.
4615         (Layout::get_output_section_flags): New function.
4616         (Layout::is_unique_segment_for_sections_specified): New function.
4617         (Layout::set_unique_segment_for_sections_specified): New function.
4618         (Layout::unique_segment_for_sections_specified_): New member.
4619         (Layout::section_segment_map_): New member.
4620         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
4621         Rename is_gc_pass_one to is_pass_one.
4622         Rename is_gc_pass_two to is_pass_two.
4623         Rename is_gc_or_icf to is_two_pass.
4624         Check for which pass based on whether symbols data is present.
4625         Make it two pass when unique segments for sections is desired.
4626         * output.cc (Output_section::Output_section): Initialize new
4627         members.
4628         * output.h (Output_section::is_unique_segment): New function.
4629         (Output_section::set_is_unique_segment): New function.
4630         (Output_section::is_unique_segment_): New member.
4631         (Output_section::extra_segment_flags): New function.
4632         (Output_section::set_extra_segment_flags): New function.
4633         (Output_section::extra_segment_flags_): New member.
4634         (Output_section::segment_alignment): New function.
4635         (Output_section::set_segment_alignment): New function.
4636         (Output_section::segment_alignment_): New member.
4637         (Output_segment::Output_segment): Initialize is_unique_segment_.
4638         (Output_segment::is_unique_segment): New function.
4639         (Output_segment::set_is_unique_segment): New function.
4640         (Output_segment::is_unique_segment_): New member.
4641         * plugin.cc (allow_unique_segment_for_sections): New function.
4642         (unique_segment_for_sections): New function.
4643         (Plugin::load): Add new functions to transfer vector.
4644         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
4645         * Makefile.in: Regenerate.
4646         * testsuite/plugin_final_layout.sh: Check if unique segment
4647         functionality works.
4648         * testsuite/plugin_section_order.c (onload): Check if new interfaces
4649         are available.
4650         (allow_unique_segment_for_sections): New global.
4651         (unique_segment_for_sections): New global.
4652         (claim_file_hook): Call allow_unique_segment_for_sections.
4653         (all_symbols_read_hook): Call unique_segment_for_sections.
4654
4655 2012-08-22  Cary Coutant  <ccoutant@google.com>
4656
4657         * layout.cc (Layout::include_section): Don't assert on GROUP
4658         sections with --emit-relocs.
4659
4660 2012-08-21  Cary Coutant  <ccoutant@google.com>
4661
4662         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
4663         if --export-dynamic-symbol names an undef symbol.
4664
4665 2012-08-18  Alan Modra  <amodra@gmail.com>
4666
4667         * powerpc.cc: Formatting and white space.
4668         (Powerpc_relobj): Rename got2_section_ to special_.
4669         Add opd_ent_shndx_ and opd_ent_off_ vectors.
4670         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
4671         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
4672         (Target_powerpc): Add Address typedef and invalid_address.  Use
4673         throughout.
4674         (Target_powerpc::is_branch_reloc): New function.
4675         (Powerpc_relocate_functions): Add Address typedef, use throughout.
4676         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
4677         for dst_mask, value and addend.
4678         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
4679         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
4680         (Output_data_glink::do_write): Correct toc base.  Don't try to use
4681         uint16_t for 24-bit offset.  Use get_output_section_offset and
4682         check return.
4683         (Target_powerpc::Scan::local): Handle more relocs.
4684         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
4685         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
4686         Plug in toc restoring insn after plt calls.  Translate branches
4687         to function descriptor symbols to corresponding entry point.
4688         (Target_powerpc::relocate_for_relocatable): Check return from
4689         get_output_section_offset.
4690         * symtab.h: Comment typo.
4691
4692 2012-08-14  Ian Lance Taylor  <iant@google.com>
4693
4694         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
4695         unsupported_relocal_local to call unsupported_reloc_global.
4696
4697 2012-08-14  Nick Clifton  <nickc@redhat.com>
4698
4699         PR ld/14265
4700         * script-sections.cc (Sections_element::output_section_name): Add
4701         keep return parameter.
4702         (Output_section_element::match_name): Add keep return parameter.
4703         Return the value of the keep_ member.
4704         * script-sections.h (class Output_section): Update
4705         output_section_name prototype.
4706         * layout.cc (Layout::keep_input_section): New public member
4707         function.
4708         (Layout::choose_output_section): Pass keep parameter to
4709         output_section_name.
4710         * layout.h (class Layout): Add keep_input_section.
4711         * object.cc (Sized_relobj_file::do_layout): Check for kept input
4712         sections.
4713         * testsuite/Makefile.am: Add a test.
4714         * testsuite/Makefile.in: Regenerate.
4715         * testsuite/pr14265.c: Source file for the test.
4716         * testsuite/pr14265.t: Linker script for the test.
4717         * testsuite/pr14265.sh: Shell script for the test.
4718
4719 2012-08-14  Alan Modra  <amodra@gmail.com>
4720
4721         * target.h (Target::output_section_name): New function.
4722         (Target::do_output_section_name): New function.
4723         * layout.cc (Layout::choose_output_section): Call the above.
4724         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
4725
4726 2012-08-14  Alan Modra  <amodra@gmail.com>
4727
4728         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
4729         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
4730         for replace_constant call.
4731         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
4732         (Output_data_glink::do_print_to_mapfile): New function.
4733         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
4734         (Target_powerpc::Relocate::relocate): Likewise.
4735
4736 2012-08-14  Alan Modra  <amodra@gmail.com>
4737
4738         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
4739         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
4740         (Output_data_glink::add_entry,find_entry): Remove shndx param.
4741         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
4742         all references to shndx_.  Handle special case for R_PPC_PLTREL24
4743         here.
4744         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
4745         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
4746         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
4747         here.
4748         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
4749         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
4750
4751 2012-08-12  Alan Modra  <amodra@gmail.com>
4752
4753         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
4754         (glink insn constants): Use uint32_t.
4755         (Output_data_glink::add_entry): Use insert, not [] operator.
4756
4757 2012-08-11  Alan Modra  <amodra@gmail.com>
4758
4759         * object.h (Sized_relobj_file::find_shdr): New function.
4760         (Sized_relobj_file::find_special_sections): New function.
4761         * object.cc (Sized_relobj_file::find_shdr): New function.
4762         (Sized_relobj_file::find_eh_frame): Use find_shdr.
4763         (Sized_relobj_file::find_special_sections): New function, split out..
4764         (Sized_relobj_file::do_read_symbols): ..from here.
4765         * output.h (Output_data_got::replace_constant): New function.
4766         (Output_data_got::num_entries): New function.
4767         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
4768         (Output_data_got::got_offset): Protected rather than private.
4769         (Output_data_got::replace_got_entry): New function.
4770         * output.cc (Output_data_got::replace_got_entry): New function.
4771         * powerpc.cc (class Powerpc_relobj): New.
4772         (class Powerpc_relocate_functions): Delete all psymval variants or
4773         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
4774         Implement _ha functions using corresponding _hi function.
4775         (Powerpc_relobj::find_special_sections): New function.
4776         (Target_powerpc::do_make_elf_object): New function.
4777         (class Output_data_got_powerpc): New.
4778         (class Output_data_glink): New.
4779         (class Powerpc_scan_relocatable_reloc): New.
4780         Many more changes througout file.
4781
4782 2012-08-09  Nick Clifton  <nickc@redhat.com>
4783
4784         * po/vi.po: Updated Vietnamese translation.
4785
4786 2012-08-07  Ian Lance Taylor  <iant@google.com>
4787
4788         * layout.cc (Layout::add_target_dynamic_tags): If
4789         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
4790         plt_rel.
4791
4792 2012-07-30  Nick Clifton  <nickc@redhat.com>
4793
4794         * po/gold.pot: Updated template.
4795         * po/es.po: Updated Spanish translation.
4796
4797 2012-07-18  Cary Coutant  <ccoutant@google.com>
4798
4799         PR gold/14344
4800         * configure.ac: Add check for -gpubnames support.
4801         * configure: Regenerate.
4802         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
4803         support; force -gno-pubnames.
4804         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
4805         support.
4806         (gdb_index_test_4): New test.
4807         * testsuite/Makefile.in: Regenerate.
4808         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
4809         * testsuite/gdb_index_test_2.sh: Likewise.
4810         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
4811         * testsuite/gdb_index_test_4.sh: New script.
4812         * testsuite/gdb_index_test_comm.sh: New script with common code;
4813         don't look for space after colon.
4814
4815 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
4816
4817         * gold.cc (queue_middle_tasks): Update function order only after
4818         deferred objects due to plugins are processed.
4819
4820 2012-07-11  Ian Lance Taylor  <iant@google.com>
4821
4822         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
4823         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
4824         (Target_arm::scan_reloc_for_stub): Likewise.
4825         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
4826         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
4827         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
4828         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
4829         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
4830
4831 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
4832             Ian Lance Taylor  <iant@google.com>
4833
4834         PR gold/14309
4835         * configure.ac: Test whether std::tr1::hash<off_t> works.
4836         * gold.h: Add a specialization for std::tr1::hash<off_t> if
4837         needed.
4838         * output.h (class Output_fill): Add virtual destructor.
4839         * configure, config.in: Rebuild.
4840
4841 2012-06-22  Roland McGrath  <mcgrathr@google.com>
4842
4843         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
4844
4845 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
4846
4847         * plugin.cc (Plugin::load): Handle position independent executables.
4848
4849 2012-06-06  Cary Coutant  <ccoutant@google.com>
4850
4851         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
4852         add .debug_macro.
4853         (lines_only_debug_sections): Likewise.
4854         (gdb_fast_lookup_sections): New static array.
4855         (is_gdb_debug_section): Rename formal parameter.
4856         (is_lines_only_debug_section): Likewise.
4857         (is_gdb_fast_lookup_section): New function.
4858         (Layout::include_section): Check for ".zdebug_" prefix; pass
4859         section name suffix to is_gdb_debug_section, et al.; check for
4860         fast-lookup sections when building .gdb_index.
4861         * options.h (--strip-debug-gdb): Update GDB version number.
4862
4863 2012-06-06  Cary Coutant  <ccoutant@google.com>
4864
4865         * configure.ac: Add check for fallocate.
4866         * configure: Regenerate.
4867         * config.in: Regenerate.
4868
4869         * options.h (class General_options): Add --mmap-output-file and
4870         --posix-fallocate options.
4871         * output.cc: (posix_fallocate): Remove; replace with...
4872         (gold_fallocate): New function.
4873         (Output_file::map_no_anonymous): Call gold_fallocate.
4874         (Output_file::map): Check --mmap-output-file option.
4875
4876 2012-06-05  Jing Yu  <jingyu@google.com>
4877
4878         * gold.h (textdomain): Add do {} to empty while(0).
4879         (bindtextdomain): Likewise.
4880
4881 2012-06-04  Cary Coutant  <ccoutant@google.com>
4882
4883         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
4884         has_dynsym_index.
4885
4886 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
4887
4888         * symtab.cc (Symbol_table::define_special_symbol):
4889         Initialize *poldsym to prevent uninitialized variable errors.
4890
4891 2012-05-23  Cary Coutant  <ccoutant@google.com>
4892
4893         * layout.cc (Layout::section_name_mapping): Add rules to handle
4894         exact match on .data.rel.ro.local or .data.rel.ro.
4895         (Layout::output_section_name): Check for exact matches.
4896
4897 2012-05-23  Cary Coutant  <ccoutant@google.com>
4898
4899         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
4900         more carefully.
4901
4902 2012-05-22  Cary Coutant  <ccoutant@google.com>
4903
4904         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
4905         object before exporting symbol.
4906
4907 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
4908
4909         * testsuite/tls_test.cc: Include "config.h" first.
4910         * testsuite/tls_test_c.c: Likewise.
4911
4912 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
4913             Nick Clifton  <nickc@redhat.com>
4914
4915         PR 14072
4916         * configure.in: Add check that sysdep.h has been included before
4917         any system header files.
4918         * configure: Regenerate.
4919         * config.in: Regenerate.
4920
4921 2012-05-14  Cary Coutant  <ccoutant@google.com>
4922
4923         * layout.cc (Layout::make_output_section): Mark .tdata section
4924         as RELRO.
4925         * testsuite/relro_test.cc: Add a TLS variable.
4926
4927 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
4928
4929         PR gold/14091
4930         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
4931         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
4932         R_X86_64_64.
4933
4934 2012-05-08  Cary Coutant  <ccoutant@google.com>
4935
4936         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
4937         (lines_only_debug_sections): Likewise.
4938
4939 2012-05-02  Roland McGrath  <mcgrathr@google.com>
4940
4941         * nacl.cc: New file.
4942         * nacl.h: New file.
4943         * Makefile.am (CCFILES, HFILES): Add them.
4944         * Makefile.in: Regenerate.
4945         * i386.cc (Output_data_plt_i386_nacl): New class.
4946         (Output_data_plt_i386_nacl_exec): New class.
4947         (Output_data_plt_i386_nacl_dyn): New class.
4948         (Target_i386_nacl): New class.
4949         (Target_selector_i386_nacl): New class.
4950         (target_selector_i386): Use it instead of Target_selector_i386.
4951         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
4952         (Target_x86_64_nacl): New class.
4953         (Target_selector_x86_64_nacl): New class.
4954         (target_selector_x86_64, target_selector_x32): Use it instead of
4955         Target_selector_x86_64.
4956         * arm.cc (Output_data_plt_arm_nacl): New class.
4957         (Target_arm_nacl): New class.
4958         (Target_selector_arm_nacl): New class.
4959         (target_selector_arm, target_selector_armbe): Use it instead of
4960         Target_selector_arm.
4961
4962         * target-select.cc (select_target): Take new Input_file* and off_t
4963         arguments, pass them on to recognize method of selector.
4964         * object.cc (make_elf_sized_object): Update caller.
4965         * parameters.cc (parameters_force_valid_target): Likewise.
4966         * incremental.cc (make_sized_incremental_binary): Likewise.
4967         * target-select.h: Update decl.
4968         (Target_selector::recognize): Take new Input_file* argument,
4969         pass it on to do_recognize.
4970         (Target_selector::do_recognize): Take new Input_file* argument.
4971         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
4972         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
4973         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
4974         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
4975
4976         * target.h (Target::Target_info): New members isolate_execinstr
4977         and rosegment_gap.
4978         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
4979         * arm.cc (Target_arm::arm_info): Update initializer.
4980         * i386.cc (Target_i386::i386_info): Likewise.
4981         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
4982         * sparc.cc (Target_sparc::sparc_info): Likewise.
4983         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4984         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
4985         * layout.cc (Layout::attach_allocated_section_to_segment):
4986         Take new const Target* argument.  If target->isolate_execinstr(), act
4987         like --rosegment.
4988         (Layout::find_first_load_seg): Take new const Target* argument;
4989         if target->isolate_execinstr(), reject PF_X segments.
4990         (Layout::relaxation_loop_body): Update caller.
4991         (Layout::set_segment_offsets): If target->isolate_execinstr(),
4992         reset file offset to zero when we hit LOAD_SEG, and then do a second
4993         loop over the segments before LOAD_SEG to reassign offsets after
4994         addresses have been determined.  Handle target->rosegment_gap().
4995         (Layout::attach_section_to_segment): Take new const Target* argument;
4996         pass it to attach_allocated_section_to_segment.
4997         (Layout::make_output_section): Update caller.
4998         (Layout::attach_sections_to_segments): Take new const Target* argument;
4999         pass it to attach_section_to_segment.
5000         * gold.cc (queue_middle_tasks): Update caller.
5001         * layout.h (Layout): Update method decls with new arguments.
5002
5003         * arm.cc (Target_arm::Target_arm): Take optional argument for the
5004         Target_info pointer to use.
5005         (Target_arm::do_make_data_plt): New virtual method.
5006         (Target_arm::make_data_plt): New method that calls it.
5007         (Target_arm::make_plt_entry): Use it.
5008         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
5009         for the section alignment.
5010         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
5011         method.
5012         (Output_data_plt_arm::first_plt_entry_offset): Call it.
5013         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
5014         method.
5015         (Output_data_plt_arm::get_plt_entry_size): Call it.
5016         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
5017         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
5018         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
5019         method.
5020         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
5021         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
5022         method instead of sizeof(plt_entry).
5023         (Output_data_plt_arm::add_entry): Likewise.
5024         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
5025         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
5026         than static method.
5027         (Target_arm::plt_entry_size): Likewise.
5028         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
5029         Move to ...
5030         (Output_data_plt_arm_standard): ... here, new class.
5031         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
5032         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
5033         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
5034
5035         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5036         Take additional argument for the PLT entry size.
5037         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
5038         Use get_plt_entry_size method rather than plt_entry_size variable.
5039         (Output_data_plt_x86_64::reserve_slot): Likewise.
5040         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
5041         (Output_data_plt_x86_64::add_entry): Likewise.
5042         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
5043         (Output_data_plt_x86_64::address_for_global): Likewise.
5044         (Output_data_plt_x86_64::address_for_local): Likewise.
5045         (Output_data_plt_x86_64::set_final_data_size): Likewise.
5046         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
5047         Make method non-static.
5048         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
5049         method.
5050         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
5051         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
5052         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
5053         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
5054         virtual method.
5055         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
5056         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
5057         virtual method.
5058         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
5059         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
5060         virtual method.
5061         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
5062         (Output_data_plt_x86_64::plt_entry_size)
5063         (Output_data_plt_x86_64::first_plt_entry)
5064         (Output_data_plt_x86_64::plt_entry)
5065         (Output_data_plt_x86_64::tlsdesc_plt_entry)
5066         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
5067         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
5068         (Output_data_plt_x86_64_standard): ... here, new class.
5069         (Target_x86_64::Target_x86_64): Take optional argument for the
5070         Target_info pointer to use.
5071         (Target_x86_64::do_make_data_plt): New virtual method.
5072         (Target_x86_64::make_data_plt): New method to call it.
5073         (Target_x86_64::init_got_plt_for_update): Use that.
5074         Call this->plt_->add_eh_frame method here.
5075         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
5076         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
5077         rather than static method.
5078         (Target_x86_64::plt_entry_size): Likewise.
5079         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
5080         rather than plt_entry_size variable.  Move guts of PLT filling to...
5081         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
5082         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
5083         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
5084
5085         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
5086         additional argument for the section alignment.
5087         Don't do add_eh_frame_for_plt here.
5088         (Output_data_plt_i386::first_plt_entry_offset): Make the method
5089         non-static.  Use get_plt_entry_size method rather than plt_entry_size
5090         variable.
5091         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
5092         method.
5093         (Output_data_plt_i386::get_plt_entry_size): Call it.
5094         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
5095         (Output_data_plt_i386::add_eh_frame): New method to call it.
5096         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
5097         method.
5098         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
5099         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
5100         method.
5101         (Output_data_plt_i386::fill_plt_entry): New method to call it.
5102         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
5103         method instead of plt_entry_size.
5104         (Output_data_plt_i386::plt_entry_size)
5105         (Output_data_plt_i386::plt_eh_frame_fde_size)
5106         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
5107         (Output_data_plt_i386_standard): ... here, new class.
5108         (Output_data_plt_i386_exec): New class.
5109         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
5110         (Output_data_plt_i386_exec::first_plt_entry): ... here.
5111         (Output_data_plt_i386::exec_plt_entry): Move to ...
5112         (Output_data_plt_i386_exec::plt_entry): ... here.
5113         (Output_data_plt_i386_dyn): New class.
5114         (Output_data_plt_i386::first_plt_entry): Move to ...
5115         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
5116         (Output_data_plt_i386::dyn_plt_entry): Move to ...
5117         (Output_data_plt_i386_dyn::plt_entry): ... here.
5118         (Target_i386::Target_i386): Take optional argument for the Target_info
5119         pointer to use.
5120         (Target_i386::do_make_data_plt): New virtual method.
5121         (Target_i386::make_data_plt): New method to call it.
5122         (Target_i386::make_plt_section): Use that.
5123         Call this->plt_->add_eh_frame method here.
5124         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
5125         rather than plt_entry_size variable.
5126         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
5127         (Output_data_plt_i386::address_for_local): Likewise.
5128         (Output_data_plt_i386::do_write): Likewise.
5129         Move guts of PLT filling to...
5130         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
5131         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
5132         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
5133         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
5134
5135 2012-05-01  Cary Coutant  <ccoutant@google.com>
5136
5137         * dwarf_reader.cc (Dwarf_die::read_attributes)
5138         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
5139         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
5140         * reduced_debug_output.cc
5141         (Output_reduced_debug_info_section::get_die_end): Remove
5142         DW_FORM_GNU_ref_index.  Add default case.
5143
5144 2012-04-26  Mark Wielaard  <mjw@redhat.com>
5145
5146         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
5147         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
5148         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
5149         DW_AT_high_pc as offset from DW_AT_low_pc.
5150
5151         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
5152         * testsuite/Makefile.in: Regenerate.
5153         * testsuite/gdb_index_test_3.c: New test source file.
5154         * testsuite/gdb_index_test_3.sh: New test source file.
5155
5156 2012-04-25  Ian Lance Taylor  <iant@google.com>
5157
5158         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
5159         pointer.
5160         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
5161         as a class, not a struct.
5162         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
5163         (Target_arm::apply_cortex_a8_workaround): Likewise.
5164         * gc.h: Declare Reloc_types as a struct, not a class.
5165         * object.h: Declare Symbols_data as a struct.
5166         * reloc.h: Declare Read_relocs_data as a struct.
5167         * target.h: Declare Relocate_info as a struct.
5168
5169 2012-04-24  David S. Miller  <davem@davemloft.net>
5170
5171         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
5172         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
5173         and R_SPARC_WPLT30.
5174
5175 2012-04-24  Cary Coutant  <ccoutant@google.com>
5176
5177         * incremental-dump.cc (find_input_containing_global): Replace
5178         magic number with symbolic constant.
5179         (dump_incremental_inputs): Update version number.
5180         * incremental.cc (Output_section_incremental_inputs): Update version
5181         number; import symbolic constants from Incremental_inputs_reader.
5182         (Incremental_inputs::create_data_sections): Align relocations
5183         section correctly for 64-bit targets.
5184         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
5185         constants; add padding.
5186         (Output_section_incremental_inputs::write_header): Add assert for
5187         header_size.
5188         (Output_section_incremental_inputs::write_input_files): Add assert
5189         for input_entry_size.
5190         (Output_section_incremental_inputs::write_info_blocks): Add padding;
5191         add assert for object_info_size, input_section_entry_size,
5192         global_sym_entry_size.
5193         * incremental.h (Incremental_inputs_reader): Add symbolic constants
5194         for data structure sizes; use them.
5195         (Incremental_input_entry_reader): Import symbolic constants from
5196         Incremental_inputs_reader; use them.
5197
5198 2012-04-23  David S. Miller  <davem@davemloft.net>
5199
5200         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
5201         and elf_flags_set_.
5202         (Target_sparc::Target_sparc): Initialize new fields.
5203         (Target_sparc::do_make_elf_object): New function.
5204         (Target_sparc::do_adjust_elf_header): New function.
5205
5206 2012-04-23  Cary Coutant  <ccoutant@google.com>
5207
5208         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
5209         CU range table of gdb index.
5210
5211 2012-04-20  David S. Miller  <davem@davemloft.net>
5212
5213         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
5214         instead of false.
5215
5216 2012-04-16  David S. Miller  <davem@davemloft.net>
5217
5218         * sparc.cc (Target_sparc::got_address): New function.
5219         (Sparc_relocate_functions::gdop_hix22): New function.
5220         (Sparc_relocate_functions::gdop_lox10): New function.
5221         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
5222         relocs.
5223         (Target_sparc::Scan::local): Likewise if the global symbol is not
5224         preemptible and is not IFUNC.
5225         (Target_sparc::Relocate::relocate): Perform GOTDATA code
5226         transformations for local and non-preemptible non-IFUNC global
5227         symbols.
5228
5229         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
5230         writing out 64-bit part of ranges.
5231
5232         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
5233         -fpic and -fpie respectively.
5234         * Makefile.in: Regenerate.
5235
5236         * sparc.cc (class Target_sparc): Add rela_ifunc_.
5237         (Target_sparc::Target_sparc): Initialize new field.
5238         (Target_sparc::do_plt_section_for_global): New function.
5239         (Target_sparc::do_plt_section_for_local): New function.
5240         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
5241         (Target_sparc::make_plt_section): New function, broken out of
5242         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
5243         (Target_sparc::make_plt_entry): Call make_plt_section.
5244         (Target_sparc::make_local_ifunc_plt_entry): New function.
5245         (Target_sparc::rela_ifunc_section): New function.
5246         (Target_sparc::plt_section): Remove const.
5247         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
5248         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
5249         and ifunc_count_ fields.
5250         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
5251         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
5252         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
5253         (Output_data_plt_sparc::rela_ifunc): New function.
5254         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
5255         (Output_data_plt_sparc::has_ifunc_section): New function.
5256         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
5257         (Output_data_plt_sparc::address_for_global): New function.
5258         (Output_data_plt_sparc::address_for_local): New function.
5259         (Output_data_plt_sparc::plt_index_to_offset): New function.
5260         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
5261         and entry_count.
5262         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
5263         entry_count.
5264         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
5265         R_SPARC_JMP_IREL to switch.
5266         (Target_sparc::Scan::check_non_pic): Likewise.
5267         (Target_sparc::Scan::local): Handle IFUNC symbols.
5268         (Target_sparc::Scan::local): Likewise.
5269         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
5270         and plt_address_for_local.
5271         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
5272         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
5273
5274         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
5275         (class Output_data_reloc): Adjust calls to Output_reloc_type.
5276         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
5277         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
5278         global relocs too.
5279         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
5280         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
5281         calls.
5282         * sparc.cc (Target_sparc::Scan::global): Likewise.
5283         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5284
5285 2012-04-16  Cary Coutant  <ccoutant@google.com>
5286
5287         * archive.cc (Library_base::should_include_member): Check for
5288         --export-dynamic-symbol.
5289         * options.h (class General_options): Add --export-dynamic-symbol.
5290         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
5291         --export-dynamic-symbol.
5292         (Symbol_table::gc_mark_undef_symbols): Likewise.
5293         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
5294
5295 2012-04-12  David S. Miller  <davem@davemloft.net>
5296
5297         * sparc.cc (Reloc::wdisp10): New relocation method.
5298         (Reloc::h34): Likewise.
5299         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
5300         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
5301         R_SPARC_WDISP10.
5302         (Target_sparc::Scan::local): Likewise.
5303         (Target_sparc::Scan::global): Likewise.
5304         (Target_sparc::Relocate::relocate): Likewise.
5305
5306 2012-04-09  Cary Coutant  <ccoutant@google.com>
5307
5308         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
5309         low_pc == 0.
5310
5311 2012-04-06  Ian Lance Taylor  <iant@google.com>
5312
5313         * timer.cc: #include <unistd.h>.
5314
5315 2012-04-06  Roland McGrath  <mcgrathr@google.com>
5316
5317         * configure.in (AC_CHECK_HEADERS): Add locale.h.
5318         * config.in: Regenerate.
5319         * configure: Regenerate.
5320
5321 2012-04-05  Nick Clifton  <nickc@redhat.com>
5322
5323         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
5324         (AM_LC_MESSAGES): Add.
5325         * aclocal.m4: Regenerate.
5326         * config.in: Regenerate.
5327         * configure: Regenerate.
5328
5329 2012-03-21  Cary Coutant  <ccoutant@google.com>
5330
5331         * Makefile.am: Add gdb-index.cc, gdb-index.h.
5332         * Makefile.in: Regenerate.
5333         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
5334         (Sized_elf_reloc_mapper::symbol_section): New function.
5335         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
5336         (make_elf_reloc_mapper): New function.
5337         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
5338         (Dwarf_abbrev_table::do_read_abbrevs): New function.
5339         (Dwarf_abbrev_table::do_get_abbrev): New function.
5340         (Dwarf_ranges_table::read_ranges_table): New function.
5341         (Dwarf_ranges_table::read_range_list): New function.
5342         (Dwarf_pubnames_table::read_section): New function.
5343         (Dwarf_pubnames_table::read_header): New function.
5344         (Dwarf_pubnames_table::next_name): New function.
5345         (Dwarf_die::Dwarf_die): New function.
5346         (Dwarf_die::read_attributes): New function.
5347         (Dwarf_die::skip_attributes): New function.
5348         (Dwarf_die::set_name): New function.
5349         (Dwarf_die::set_linkage_name): New function.
5350         (Dwarf_die::attribute): New function.
5351         (Dwarf_die::string_attribute): New function.
5352         (Dwarf_die::int_attribute): New function.
5353         (Dwarf_die::uint_attribute): New function.
5354         (Dwarf_die::ref_attribute): New function.
5355         (Dwarf_die::child_offset): New function.
5356         (Dwarf_die::sibling_offset): New function.
5357         (Dwarf_info_reader::check_buffer): New function.
5358         (Dwarf_info_reader::parse): New function.
5359         (Dwarf_info_reader::do_parse): New function.
5360         (Dwarf_info_reader::do_read_string_table): New function.
5361         (Dwarf_info_reader::lookup_reloc): New function.
5362         (Dwarf_info_reader::get_string): New function.
5363         (Dwarf_info_reader::visit_compilation_unit): New function.
5364         (Dwarf_info_reader::visit_type_unit): New function.
5365         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
5366         Sized_elf_reloc_mapper.
5367         (Sized_dwarf_line_info::symbol_section): Remove function.
5368         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
5369         (Sized_dwarf_line_info::read_line_mappings): Remove object
5370         parameter, adjust callers.
5371         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
5372         * dwarf_reader.h: Include <sys/types.h>.
5373         (class Track_relocs): Remove forward declaration.
5374         (class Elf_reloc_mapper): New class.
5375         (class Sized_elf_reloc_mapper): New class.
5376         (class Dwarf_abbrev_table): New class.
5377         (class Dwarf_range_list): New class.
5378         (class Dwarf_ranges_table): New class.
5379         (class Dwarf_pubnames_table): New class.
5380         (class Dwarf_die): New class.
5381         (class Dwarf_info_reader): New class.
5382         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
5383         (Sized_dwarf_line_info::symbol_section): Remove member function.
5384         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
5385         base class.
5386         * gdb-index.cc: New source file.
5387         * gdb-index.h: New source file.
5388         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
5389         and .debug_types sections, call Layout::add_to_gdb_index.
5390         (Sized_relobj_incr::do_section_name): Implement.
5391         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
5392         return type; Implement.
5393         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
5394         return type.
5395         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
5396         parameter list and return type.
5397         (Sized_incr_dynobj::do_section_contents): Likewise.
5398         * layout.cc: Include gdb-index.h.
5399         (Layout::Layout): Initialize gdb_index_data_.
5400         (Layout::init_fixed_output_section): Check for .gdb_index section.
5401         (Layout::add_to_gdb_index): New function. Instantiate.
5402         * layout.h: Add forward declaration for class Gdb_index.
5403         (Layout::add_to_gdb_index): New member function.
5404         (Layout::gdb_index_data_): New data member.
5405         * main.cc: Include gdb-index.h.
5406         (main): Print statistics for gdb index.
5407         * object.cc (Object::section_contents): Move code into
5408         do_section_contents.
5409         (need_decompressed_section): Check for sections needed when building
5410         gdb index.
5411         (build_compressed_section_map): Likewise.
5412         (Sized_relobj_file::do_read_symbols): Need local symbols when building
5413         gdb index.
5414         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
5415         sections; call Layout::add_to_gdb_index.
5416         (Sized_relobj_file::do_decompressed_section_contents): Call
5417         do_section_contents directly.
5418         * object.h (Object::do_section_contents): Adjust parameter list and
5419         return type.
5420         (Object::do_decompressed_section_contents): Call do_section_contents
5421         directly.
5422         (Sized_relobj_file::do_section_contents): Adjust parameter list and
5423         return type.
5424         * options.h (class General_options): Add --gdb-index option.
5425         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
5426         list and return type.
5427         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
5428         * reloc.h (Track_relocs::checkpoint): New function.
5429         (Track_relocs::reset): New function.
5430
5431         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
5432         New test cases.
5433         * testsuite/Makefile.in: Regenerate.
5434         * testsuite/gdb_index_test.cc: New test source file.
5435         * testsuite/gdb_index_test_1.sh: New test source file.
5436         * testsuite/gdb_index_test_2.sh: New test source file.
5437
5438 2012-03-19  Doug Kwan  <dougkwan@google.com>
5439
5440         * arm.cc (Target_arm::do_define_standard_symbols): New method.
5441         (Target_arm::do_finalize_sections): Remove code which defines
5442         __exidx_start and __exidx_end.  Make symbol table parameter
5443         anonymous as it is not used.
5444         * gold.cc (queue_middle_tasks): Call target hook to define any
5445         target-specific symbols.
5446         * target.h (Target::define_standard_symbols): New method.
5447         (Target::do_define_standard_symbols): Same.
5448         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
5449         * testsuite/Makefile.in: Regenerate.
5450         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
5451         and __exidx_end.
5452         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
5453         relocations are generated for __exidx_start and __exidx_end.
5454
5455 2012-03-16  Doug Kwan  <dougkwan@google.com>
5456
5457         * testsuite/Makefile.am: Disable test initpri3b.
5458         * testsuite/Makefile.in: Regenerate.
5459
5460 2012-03-15  Doug Kwan  <dougkwan@google.com>
5461
5462         * arm.cc (Target_arm::got_section): Make .got section read-only
5463         if -z now is given.
5464
5465 2012-03-15  Ian Lance Taylor  <iant@google.com>
5466
5467         PR gold/13850
5468         * layout.cc (Layout::make_output_section): Correctly mark
5469         SHT_INIT_ARRAY, et. al., as relro.
5470
5471 2012-03-14  Doug Kwan  <dougkwan@google.com>
5472
5473         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
5474         dynamic relocations for protected symbols in shared objects.
5475
5476 2012-03-13  Ian Lance Taylor  <iant@google.com>
5477
5478         * resolve.cc (Symbol_table::resolve): When merging common symbols,
5479         keep the larger alignment.
5480
5481 2012-03-12  Cary Coutant  <ccoutant@google.com>
5482
5483         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
5484         handling of DW_LNE_define_file.
5485
5486 2012-03-12  Cary Coutant  <ccoutant@google.com>
5487
5488         * reduced_debug_output.cc
5489         (Output_reduced_debug_info_section::get_die_end): Add new FORM
5490         codes to switch.
5491
5492 2012-02-29  Cary Coutant  <ccoutant@google.com>
5493
5494         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
5495
5496 2012-02-29  Cary Coutant  <ccoutant@google.com>
5497
5498         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5499         Call Object::decompressed_section_contents.
5500         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
5501         New dtor.
5502         (Sized_dwarf_line_info::buffer_start_): New data member.
5503         * merge.cc (Output_merge_data::do_add_input_section): Call
5504         Object::decompressed_section_contents.
5505         (Output_merge_string::do_add_input_section): Likewise.
5506         * object.cc (need_decompressed_section): New function.
5507         (build_compressed_section_map): Decompress sections needed later.
5508         (Sized_relobj_file::do_decompressed_section_contents): New function.
5509         (Sized_relobj_file::do_discard_decompressed_sections): New function.
5510         * object.h (Object::decompressed_section_contents): New function.
5511         (Object::discard_decompressed_sections): New function.
5512         (Object::do_decompressed_section_contents): New function.
5513         (Object::do_discard_decompressed_sections): New function.
5514         (Compressed_section_info): New type.
5515         (Compressed_section_map): Include decompressed section contents.
5516         (Sized_relobj_file::do_decompressed_section_contents): New function.
5517         (Sized_relobj_file::do_discard_decompressed_sections): New function.
5518
5519 2012-02-16  Cary Coutant  <ccoutant@google.com>
5520
5521         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
5522         * testsuite/Makefile.in: Regenerate.
5523
5524 2012-02-14  Cary Coutant  <ccoutant@google.com>
5525
5526         * options.cc (General_options::finalize): Disallow -pie and -static.
5527
5528 2012-02-03  Doug Kwan  <dougkwan@google.com>
5529
5530         * arm.cc (Arm_relocate_functions::abs8,
5531         Arm_relocate_functions::abs16): Use
5532         Bits::has_signed_unsigned_overflow32.
5533         (Arm_relocate_functions::thm_abs8): Correct range of
5534         overflow check.
5535         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
5536         in assertions.
5537
5538 2012-02-02  Doug Kwan  <dougkwan@google.com>
5539
5540         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
5541         position independent outputs, not just shared objects.
5542
5543 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
5544
5545         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
5546         * configure: Regenerated.
5547
5548 2012-01-27  Ian Lance Taylor  <iant@google.com>
5549
5550         * reloc.h (Bits): New class with static functions, copied from
5551         namespace utils in arm.cc.
5552         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
5553         instead.
5554
5555 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5556
5557         * incremental.cc (write_info_blocks): Correct relocation offset.
5558
5559 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5560
5561         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
5562         (Relocate::tls_gd_to_le): Likewise.
5563
5564 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5565
5566         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
5567
5568 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5569
5570         * configure.ac: Check if -mcmodel=medium works.
5571         * configure: Regenerated.
5572
5573 2012-01-24  Cary Coutant  <ccoutant@google.com>
5574
5575         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
5576         definition and ...
5577         (read_unsigned_LEB_128_x): ... this new function.
5578         (read_signed_LEB_128): Replaced with inline definition and ...
5579         (read_signed_LEB_128_x): ... this new function.
5580         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
5581         (read_unsigned_LEB_128): Add inline definition.
5582         (read_signed_LEB_128_x): New function.
5583         (read_signed_LEB_128): Add inline definition.
5584         * testsuite/Makefile.am (leb128_unittest): New unit test.
5585         * testsuite/Makefile.in: Regenerate.
5586         * testsuite/leb128_unittest.cc: New unit test.
5587
5588 2012-01-23  Ian Lance Taylor  <iant@google.com>
5589
5590         PR gold/13617
5591         * i386.cc (Target_i386::do_code_fill): When using a jmp
5592         instruction, pad with nop instructions.
5593         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5594
5595 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
5596
5597         * x86_64.cc (gc_process_relocs): Add typename on types used in
5598         template.
5599         (scan_relocs): Likewise.
5600         (relocate_section): Likewise.
5601         (apply_relocation): Likewise.
5602
5603 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
5604
5605         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
5606         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
5607         under x32.
5608
5609 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
5610
5611         * x86_64.cc: Initial support for x32.
5612
5613 2012-01-03  Cary Coutant  <ccoutant@google.com>
5614
5615         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
5616         Use abstract base class for GOT.
5617         * gold/output.h (class Output_data_got_base): New abstract base class.
5618         (class Output_data_got): Derive from new base class, adjust ctors.
5619         (Output_data_got::reserve_slot): Make virtual; rename to
5620         do_reserve_slot; Adjust callers.
5621         * gold/target.h (Sized_target::init_got_plt_for_update): Return
5622         pointer to abstract base class.
5623         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
5624
5625 2011-12-18  Ian Lance Taylor  <iant@google.com>
5626
5627         * object.h (Relobj::local_symbol_value): New function.
5628         (Relobj::local_plt_offset): New function.
5629         (Relobj::local_has_got_offset): New function.
5630         (Relobj::local_got_offset): New function.
5631         (Relobj::set_local_got_offset): New function.
5632         (Relobj::do_local_symbol_value): New pure virtual function.
5633         (Relobj::do_local_plt_offset): Likewise.
5634         (Relobj::do_local_has_got_offset): Likewise.
5635         (Relobj::do_local_got_offset): Likewise.
5636         (Relobj::do_set_local_got_offset): Likewise.
5637         (Sized_relobj::do_local_has_got_offset): Rename from
5638         local_has_got_offset.
5639         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
5640         (Sized_relobj::do_set_local_got_offset): Rename from
5641         set_local_got_offset.
5642         (Sized_relobj_file::do_local_plt_offset): Rename from
5643         local_plt_offset.
5644         (Sized_relobj_file::do_local_symbol_value): New function.
5645         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
5646         local_plt_offset.
5647         * output.cc (Output_data_got::Got_entry::write): Change object to
5648         Relobj.  Use local_symbol_value.
5649         (Output_data_got::add_global_with_rel): Change rel_dyn to
5650         Output_data_reloc_generic*.  Use add_global_generic.
5651         (Output_data_got::add_global_with_rela): Remove.  Change all
5652         callers to use add_global_with_rel.
5653         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
5654         Output_data_reloc_generic*.  Use add_global_generic.
5655         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
5656         callers to use add_global_pair_with_rel.
5657         (Output_data_got::add_local): Change object to Relobj*.
5658         (Output_data_got::add_local_plt): Likewise.
5659         (Output_data_got::add_local_with_rel): Change object to Relobj*,
5660         change rel_dyn to Output_data_reloc_generic*.  Use
5661         add_local_generic.
5662         (Output_data_got::add_local_with_rela): Remove.  Change all
5663         callers to use all_local_with_rel.
5664         (Output_data_got::add_local_pair_with_rel): Change object to
5665         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
5666         add_output_section_generic.
5667         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
5668         callers to use add_local_pair_with_rel.
5669         (Output_data_got::reserve_local): Change object to Relobj*.
5670         * output.h: (class Output_data_reloc_generic): Add pure virtual
5671         declarations for add_global_generic, add_local_generic,
5672         add_output_section_generic.
5673         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
5674         functions for Output_data_reloc_generic.  Update declarations for
5675         changes listed in output.cc.
5676         (class Output_data_got): Change template parameter to got_size.
5677         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
5678         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
5679         function.
5680         (Sized_relobj_incr::do_local_plt_offset): New function.
5681         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
5682         add_global_generic.
5683
5684 2011-12-17  Cary Coutant  <ccoutant@google.com>
5685
5686         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
5687         * resolve.cc (Symbol_table::resolve): Likewise.
5688         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
5689         arrays.
5690         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5691
5692 2011-12-16  Ian Lance Taylor  <iant@google.com>
5693
5694         * output.h (Output_data_reloc_generic::add): Only call
5695         add_dynamic_reloc if this is a dynamic reloc section.
5696
5697 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
5698
5699         PR gold/13505
5700         * target-reloc.h (apply_relocation): Replace <64, false> with
5701         <size, big_endian>.
5702
5703 2011-11-25  Nick Clifton  <nickc@redhat.com>
5704
5705         * po/it.po: New Italian translation.
5706
5707 2011-11-17  Sterling Augustine  <saugustine@google.com>
5708
5709         * script.cc (script_include_directive): Implement.
5710         (read_script_file): New local variables name and search_path. Update
5711         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
5712         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
5713         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
5714
5715 2011-11-11  Sterling Augustine  <saugustine@google.com>
5716
5717         * yyscript.y (section_cmd): Add support for INCLUDE directive.
5718         (file_or_sections_cmd): Likewise.
5719
5720 2011-11-11  Doug Kwan  <dougkwan@google.com>
5721
5722         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
5723         if --just-symbols is given.
5724
5725 2011-11-10  Doug Kwan  <dougkwan@google.com>
5726
5727         PR gold/13362
5728         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
5729         when processing data relocs.
5730         * reloc.h (Relocate_functions::rel_unaligned): New method.
5731         (Relocate_functions::pcrel_unaligned): Ditto.
5732         (Relocate_functions::rel32_unaligned): Ditto.
5733         (Relocate_functions::pcrel32_unaligned): Ditto.
5734
5735 2011-11-09  Doug Kwan  <dougkwan@google.com>
5736
5737         PR gold/13362
5738         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
5739         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
5740         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
5741         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5742         (Relocate_functions::rel_unaligned): New.
5743         (Relocate_functions::rel32_unaligned): New.
5744         * target-reloc.h (relocate_for_relocatable): Add code to handle
5745         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5746         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
5747         arm_unaligned_reloc_r): New targets.
5748         * testsuite/Makefile.in: Regenerate.
5749         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
5750         linking.
5751
5752 2011-11-02  Ian Lance Taylor  <iant@google.com>
5753
5754         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
5755         NATIVE_LINKER.
5756         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
5757         * options.cc (General_options::finalize): Use library search path
5758         from configure script if specified.  If not native and no sysroot,
5759         only search TOOLLIBDIR.
5760         * options.h (Search_directory::Search_directory): Change name to
5761         const std::string&.
5762         (General_options::add_to_library_path_with_sysroot): Change arg to
5763         const std::string&.
5764         * configure, Makefile.in, config.in: Rebuild.
5765
5766 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5767
5768         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
5769         we are working around the ARM1176 Erratum.
5770         * options.h (General_options::fix_arm1176): Add option.
5771         * testsuite/Makefile.am: Add testcases, and keep current ones
5772         working.
5773         * testsuite/Makefile.in: Regenerate.
5774         * testsuite/arm_fix_1176.s: New file.
5775         * testsuite/arm_fix_1176.sh: Likewise.
5776
5777 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5778
5779         * arm.cc (Target_arm::Target_arm): Remove initialisation of
5780         may_use_blx_.
5781         (Target_arm::may_use_blx): Remove method.
5782         (Target_arm::set_may_use_blx): Likewise.
5783         (Target_arm::may_use_v4t_interworking): New method.
5784         (Target_arm::may_use_v5t_interworking): Likewise.
5785         (Target_arm::may_use_blx_): Remove member variable.
5786         (Arm_relocate_functions::arm_branch_common): Check for v5T
5787         interworking.
5788         (Arm_relocate_functions::thumb_branch_common): Likewise.
5789         (Reloc_stub::stub_type_for_reloc): Likewise.
5790         (Target_arm::do_finalize_sections): Correct interworking checks.
5791         * testsuite/Makefile.am: Add new tests.
5792         * testsuite/Makefile.in: Regenerate.
5793         * testsuite/arm_farcall_arm_arm.s: New test.
5794         * testsuite/arm_farcall_arm_arm.sh: Likewise.
5795         * testsuite/arm_farcall_arm_thumb.s: Likewise.
5796         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
5797         * testsuite/arm_farcall_thumb_arm.s: Likewise.
5798         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
5799         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
5800         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
5801
5802 2011-10-31  Cary Coutant  <ccoutant@google.com>
5803
5804         PR gold/13023
5805         * expression.cc (Expression::eval_with_dot): Add
5806         is_section_dot_assignment parameter.
5807         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
5808         absolute and assigning to dot within a section.
5809         * script-sections.cc
5810         (Output_section_element_assignment::set_section_addresses): Pass
5811         dot_section to set_if_absolute.
5812         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
5813         as is_section_dot_assignment flag to eval_with_dot.
5814         (Output_section_element_dot_assignment::set_section_addresses):
5815         Likewise.
5816         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
5817         parameter.  Also set value if relative to dot_section; set the
5818         symbol's output_section.
5819         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
5820         parameter.  Adjust all callers.
5821         (Expression::eval_maybe_dot): Likewise.
5822         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
5823         Adjust all callers.
5824         * testsuite/script_test_2.t: Test assignment of an absolute value
5825         to dot within an output section element.
5826
5827 2011-10-31  Cary Coutant  <ccoutant@google.com>
5828
5829         * options.h (class General_options): Add --[no-]gnu-unique options.
5830         * symtab.cc (Symbol_table::sized_write_globals): Convert
5831         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
5832
5833 2011-10-31  Cary Coutant  <ccoutant@google.com>
5834
5835         PR gold/13359
5836         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
5837         unnecessary assertion.
5838         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
5839
5840 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
5841
5842         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5843         gc_mark_symbol.
5844         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5845         gc_mark_symbol.
5846         Change to just keep the section associated with symbol.
5847         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
5848         they are externally visible and --export-dynamic is turned on.
5849         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
5850
5851 2011-10-19  Ian Lance Taylor  <iant@google.com>
5852
5853         PR gold/13163
5854         * script-sections.cc
5855         (Output_section_element_dot_assignment::needs_output_section): New
5856         function.
5857
5858 2011-10-19  Ian Lance Taylor  <iant@google.com>
5859
5860         PR gold/13204
5861         * layout.cc (Layout::segment_precedes): Don't assert failure if a
5862         --section-start option was seen.
5863         * options.h (General_options::any_section_start): New function.
5864
5865 2011-10-18  David S. Miller  <davem@davemloft.net>
5866
5867         PR binutils/13301
5868         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
5869         member to track relocation locations that have moved during TLS
5870         reloc optimizations.
5871         (Target_sparc::Relocate::Relocate): Initialize to NULL.
5872         (Target_sparc::Relocate::relocate): Adjust view down by 4
5873         bytes if it matches reloc_adjust_addr_.
5874         (Target_sparc::Relocate::relocate_tls): Always move the
5875         __tls_get_addr call delay slot instruction forward 4 bytes when
5876         performing relaxation.
5877
5878 2011-10-18  Cary Coutant  <ccoutant@google.com>
5879
5880         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
5881         (Output_file::map_no_anonymous): Check for non-zero
5882         return code from posix_fallocate.
5883
5884 2011-10-17  Cary Coutant  <ccoutant@google.com>
5885
5886         PR gold/13245
5887         * plugin.cc (is_visible_from_outside): Check for symbols
5888         referenced from dynamic objects.
5889         * resolve.cc (Symbol_table::resolve): Don't count references
5890         from dynamic objects as references from real ELF files.
5891         * testsuite/plugin_test_2.sh: Adjust expected result.
5892
5893 2011-10-17  Cary Coutant  <ccoutant@google.com>
5894
5895         * gold.cc: Include timer.h.
5896         (queue_middle_tasks): Stamp time.
5897         (queue_final_tasks): Likewise.
5898         * main.cc (main): Store timer in parameters.  Print timers
5899         for each pass.
5900         * parameters.cc (Parameters::Parameters): Initialize timer_.
5901         (Parameters::set_timer): New function.
5902         (set_parameters_timer): New function.
5903         * parameters.h (Parameters::set_timer): New function.
5904         (Parameters::timer): New function.
5905         (Parameters::timer_): New data member.
5906         (set_parameters_timer): New function.
5907         * timer.cc (Timer::stamp): New function.
5908         (Timer::get_pass_time): New function.
5909         * timer.h (Timer::stamp): New function.
5910         (Timer::get_pass_time): New function.
5911         (Timer::pass_times_): New data member.
5912
5913 2011-10-17  Cary Coutant  <ccoutant@google.com>
5914
5915         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
5916         task for members of lib groups.
5917
5918 2011-10-17  Cary Coutant  <ccoutant@google.com>
5919
5920         PR gold/13288
5921         * fileread.cc (File_read::find_view): Add assert.
5922         (File_read::make_view): Move bounds check (replace with assert)...
5923         (File_read::find_or_make_view): ... to here.
5924
5925 2011-10-12  Cary Coutant  <ccoutant@google.com>
5926
5927         * output.cc (Output_file::open_base_file): Handle case where
5928         ::read returns less than requested size.
5929
5930 2011-10-10  Cary Coutant  <ccoutant@google.com>
5931
5932         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
5933         Initialize defined_count_.
5934         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
5935         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
5936         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
5937         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
5938         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
5939         * incremental.h (Sized_relobj_incr::defined_count_): New data
5940         member.
5941         (Sized_incr_dynobj::defined_count_): New data member.
5942         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
5943         Return zeroes instead of internal error.
5944
5945 2011-10-10  Cary Coutant  <ccoutant@google.com>
5946
5947         PR gold/13249
5948         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
5949         (Output_reloc::symbol_value): Return PLT offset if flag is set.
5950         * output.h (class Output_reloc): Add use_plt_offset flag.
5951         (Output_reloc::type_): Adjust size of bit field.
5952         (Output_reloc::use_plt_offset_): New bit field.
5953         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
5954         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
5955         flag.  Adjust all callers.
5956         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
5957         creating RELATIVE relocations.
5958
5959 2011-10-10  Nick Clifton  <nickc@redhat.com>
5960
5961         * po/es.po: Updated Spanish translation.
5962         * po/fi.po: Updated Finnish translation.
5963
5964 2011-10-03   Diego Novillo  <dnovillo@google.com>
5965
5966         * options.cc (parse_uint): Fix dereference of RETVAL.
5967
5968 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
5969
5970         * layout.h (section_order_map_): New member.
5971         (get_section_order_map): New member function.
5972         * output.cc (Output_section::add_input_section): Check for patterns
5973         only when --section-ordering-file is specified.
5974         * gold.cc (queue_middle_tasks): Delay updating order of sections till
5975         output_sections have been formed.
5976         * layout.cc (Layout_Layout): Initialize section_order_map_.
5977         * plugin.cc (update_section_order): Store order in order_map. Do not
5978         update the order.
5979         * testsuite/Makefile.am: Add test case for plugin_final_layout.
5980         * testsuite/Makefile.in: Regenerate.
5981         * testsuite/plugin_section_order.c: New file.
5982         * testsuite/plugin_final_layout.cc: New file.
5983         * testsuite/plugin_final_layout.sh: New file.
5984
5985 2011-09-29  Cary Coutant  <ccoutant@google.com>
5986
5987         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5988         Check for NULL.
5989         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
5990         symbols during incremental update.
5991         (Symbol_table::add_from_dynobj): Likewise.
5992
5993 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5994             Ian Lance Taylor  <iant@google.com>
5995
5996         * symtab.cc (Symbol_table::define_special_symbol): Always
5997         canonicalize version string.
5998
5999 2011-09-26  Cary Coutant  <ccoutant@google.com>
6000
6001         * gold.cc (queue_initial_tasks): Move option checks ...
6002         * options.cc (General_options::finalize): ... to here. Disable
6003         some options; make others fatal.
6004
6005 2011-09-26  Cary Coutant  <ccoutant@google.com>
6006
6007         gcc PR lto/47247
6008         * plugin.cc (get_symbols_v2): New function.
6009         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
6010         (is_referenced_from_outside): New function.
6011         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
6012         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
6013         (get_symbols): Pass version parameter.
6014         (get_symbols_v2): New function.
6015         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
6016         parameter.
6017         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
6018         (onload): Add LDPT_GET_SYMBOLS_V2.
6019         (all_symbols_read_hook): Use get_symbols_v2; check for
6020         LDPR_PREVAILING_DEF_IRONLY_EXP.
6021         * testsuite/plugin_test_3.sh: Update expected results.
6022
6023 2011-09-23  Simon Baldwin  <simonb@google.com>
6024
6025         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
6026         configuration options.
6027         * configure: Regenerate.
6028         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
6029         * Makefile.in: Regenerate.
6030         * testsuite/Makefile.in: Regenerate.
6031
6032 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
6033
6034         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
6035
6036 2011-09-19  Cary Coutant  <ccoutant@google.com>
6037
6038         * incremental.cc (can_incremental_update): Fix typo in comment.
6039         * incremental.h (can_incremental_update): Likewise.
6040
6041 2011-09-18  Cary Coutant  <ccoutant@google.com>
6042
6043         * incremental.cc (can_incremental_update): New function.
6044         * incremental.h (can_incremental_update): New function.
6045         * layout.cc (Layout::init_fixed_output_section): Call it.
6046         (Layout::make_output_section): Don't allow patch space in .eh_frame.
6047         * object.cc (Sized_relobj_file::do_layout): Call
6048         can_incremental_update.
6049
6050 2011-09-13  Cary Coutant  <ccoutant@google.com>
6051
6052         * configure.ac: Check for glibc support for gnu_indirect_function
6053         support with static linking, setting automake conditional
6054         IFUNC_STATIC.
6055         * Makefile.in: Regenerate.
6056         * configure: Regenerate.
6057
6058         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
6059         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
6060         for IFUNC_STATIC.
6061         * testsuite/Makefile.in: Regenerate.
6062
6063 2011-09-13  Cary Coutant  <ccoutant@google.com>
6064
6065         * incremental.cc (Sized_relobj_incr::do_layout): Call
6066         report_comdat_group for kept comdat sections.
6067         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
6068         * testsuite/Makefile.in: Regenerate.
6069         * testsuite/incr_comdat_test_1.cc: New source file.
6070         * testsuite/incr_comdat_test_2_v1.cc: New source file.
6071         * testsuite/incr_comdat_test_2_v2.cc: New source file.
6072         * testsuite/incr_comdat_test_2_v3.cc: New source file.
6073
6074 2011-09-13  Ian Lance Taylor  <iant@google.com>
6075
6076         * object.cc (Sized_relobj_file::do_layout): Remove unused local
6077         variable external_symbols_offset.
6078
6079 2011-09-12  Ian Lance Taylor  <iant@google.com>
6080
6081         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
6082         triggered if object has no symbols.
6083
6084 2011-09-09  David S. Miller  <davem@davemloft.net>
6085
6086         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
6087         (Output_fill_debug_line::do_write): Likewise.
6088
6089 2011-08-29  Cary Coutant  <ccoutant@google.com>
6090
6091         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
6092         casts to match formatting specs.
6093         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
6094
6095 2011-08-26  Cary Coutant  <ccoutant@google.com>
6096
6097         * layout.cc (Free_list::allocate): Provide guarantee of minimum
6098         remaining hole size when allocating.
6099         (Layout::make_output_section): Set fill methods for debug sections.
6100         * layout.h (Free_list::Free_list_node): Move from private to
6101         public.
6102         (Free_list::set_min_hole_size): New function.
6103         (Free_list::begin, Free_list::end): New functions.
6104         (Free_list::min_hole_): New data member.
6105         * output.cc: Include dwarf.h.
6106         (Output_fill_debug_info::do_minimum_hole_size): New function.
6107         (Output_fill_debug_info::do_write): New function.
6108         (Output_fill_debug_line::do_minimum_hole_size): New function.
6109         (Output_fill_debug_line::do_write): New function.
6110         (Output_section::Output_section): Initialize new data member.
6111         (Output_section::set_final_data_size): Ensure patch space is larger
6112         than minimum hole size.
6113         (Output_section::do_write): Fill holes in debug sections.
6114         * output.h (Output_fill): New class.
6115         (Output_fill_debug_info): New class.
6116         (Output_fill_debug_line): New class.
6117         (Output_section::set_free_space_fill): New function.
6118         (Output_section::free_space_fill_): New data member.
6119         * testsuite/Makefile.am (incremental_test_3): Add
6120         --incremental-patch option.
6121         (incremental_test_4): Likewise.
6122         (incremental_test_5): Likewise.
6123         (incremental_test_6): Likewise.
6124         (incremental_copy_test): Likewise.
6125         (incremental_common_test_1): Likewise.
6126         * testsuite/Makefile.in: Regenerate.
6127
6128 2011-08-26  Nick Clifton  <nickc@redhat.com>
6129
6130         * po/es.po: Updated Spanish translation.
6131
6132 2011-08-01  Cary Coutant  <ccoutant@google.com>
6133
6134         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
6135         * gold/testsuite/Makefile.in: Regenerate.
6136         * gold/testsuite/justsyms_exec.c: New source file.
6137         * gold/testsuite/justsyms_lib.c: New source file.
6138
6139 2011-08-01  Cary Coutant  <ccoutant@google.com>
6140
6141         * layout.cc (Layout::set_segment_offsets): Don't realign text
6142         segment if -Ttext was specified.
6143         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
6144         file type.
6145         * object.h (Sized_relobj_file::e_type): New function.
6146         (Sized_relobj_file::e_type_): New data member.
6147         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
6148         base address for ET_EXEC files.
6149         * target.cc (Target::do_make_elf_object_implementation): Allow
6150         ET_EXEC files with --just-symbols option.
6151
6152 2011-07-28  Cary Coutant  <ccoutant@google.com>
6153
6154         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
6155         Add thread_number parameter.
6156         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
6157         * workqueue-threads.cc
6158         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
6159         current thread if its thread number is greater than desired thread
6160         count.
6161         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
6162         Add thread_number parameter.
6163         (Workqueue::should_cancel_thread): Likewise.
6164         (Workqueue::find_runnable_or_wait): Pass thread_number to
6165         should_cancel_thread.
6166         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
6167         parameter.
6168
6169 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
6170
6171         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
6172         only after checking if it cannot be forced local.
6173         * symtab.h (is_externally_visible): Check if the symbol is not forced
6174         local.
6175
6176 2011-07-15  Ian Lance Taylor  <iant@google.com>
6177
6178         * options.h (class General_options): Add --print-output-format.
6179         Move -EL next to -EB, for  better --help output.
6180         * target-select.cc: Include <cstdio>, "options.h", and
6181         "parameters.h".
6182         (Target_selector::do_target_bfd_name): New function.
6183         (print_output_format): New function.
6184         * target-select.h (class Target_selector): Update declarations.
6185         (Target_selector::target_bfd_name): New function.
6186         (print_output_format): Declare.
6187         * main.cc: Include "target-select.h".
6188         (main): Handle --print-output-format.
6189         * gold.cc: Include "target-select.h".
6190         (queue_initial_tasks): Handle --print-output-format when there are
6191         no input files.
6192         * parameters.cc (parameters_force_valid_target): Give a better
6193         error message if -EB/-EL does not match target.
6194         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
6195         function.
6196
6197 2011-07-15  Ian Lance Taylor  <iant@google.com>
6198
6199         * i386.cc (class Output_data_plt_i386): Add layout_ field.
6200         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
6201         (Output_data_plt_i386::do_write): Write address of .dynamic
6202         section to first entry in .got.plt section.
6203         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
6204         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
6205         Initialize layout_.
6206         (Output_data_plt_x86_64::do_write): Write address of .dynamic
6207         section to first entry in .got.plt section.
6208         * layout.h (Layout::dynamic_section): New function.
6209
6210 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
6211
6212         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
6213         to claim_file call.
6214         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
6215         input_section_position_, and input_section_glob_.
6216         (read_layout_from_file): Call function section_ordering_specified.
6217         * layout.h (is_section_ordering_specified): New function.
6218         (section_ordering_specified): New function.
6219         (section_ordering_specified_): New boolean member.
6220         * main.cc(main): Call load_plugins after layout object is defined.
6221         * output.cc (Output_section::add_input_section): Use
6222         function section_ordering_specified to check if section ordering is
6223         needed.
6224         * output.cc (Output_section::add_relaxed_input_section): Use
6225         function section_ordering_specified to check if section ordering is
6226         needed.
6227         (Output_section::update_section_layout): New function.
6228         (Output_section::sort_attached_input_sections): Check if input section
6229         must be reordered.
6230         * output.h (Output_section::update_section_layout): New function.
6231         * plugin.cc (get_section_count): New function.
6232         (get_section_type): New function.
6233         (get_section_name): New function.
6234         (get_section_contents): New function.
6235         (update_section_order): New function.
6236         (allow_section_ordering): New function.
6237         (Plugin::load): Add the new interfaces to the transfer vector.
6238         (Plugin_manager::load_plugins): New parameter.
6239         (Plugin_manager::all_symbols_read): New parameter.
6240         (Plugin_manager::claim_file): New parameter. Save the elf object for
6241         unclaimed objects.
6242         (Plugin_manager::get_elf_object): New function.
6243         (Plugin_manager::get_view): Change to directly use the bool to check
6244         if get_view is called from claim_file_hook.
6245         * plugin.h (input_objects): New function
6246         (Plugin__manager::load_plugins): New parameter.
6247         (Plugin_manager::claim_file): New parameter.
6248         (Plugin_manager::get_elf_object): New function.
6249         (Plugin_manager::in_claim_file_handler): New function.
6250         (Plugin_manager::in_claim_file_handler_): New member.
6251         (layout): New function.
6252         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
6253         handler with an extra parameter. Make the elf object before calling
6254         claim_file handler.
6255         * testsuite/plugin_test.c (get_section_count): New function pointer.
6256         (get_section_type): New function pointer.
6257         (get_section_name): New function pointer.
6258         (get_section_contents): New function pointer.
6259         (update_section_order): New function pointer.
6260         (allow_section_ordering): New function pointer.
6261         (onload): Check if the new interfaces exist.
6262
6263 2011-07-13  Ian Lance Taylor  <iant@google.com>
6264
6265         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
6266         relro section.
6267         * x86_64.cc (Target_x86_64::got_section): Likewise.
6268         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
6269         (relro_now_test_SOURCES): New variable.
6270         (relro_now_test_DEPENDENCIES): New variable.
6271         (relro_now_test_LDFLAGS): New variable.
6272         (relro_now_test_LDADD): New variable.
6273         (relro_now_test.so): New target.
6274         * testsuite/Makefile.in: Rebuild.
6275
6276 2011-07-12  Ian Lance Taylor  <iant@google.com>
6277
6278         PR gold/12980
6279         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
6280         GLOB_DAT relocation rather than a RELATIVE relocation for a
6281         protected symbol when creating a shared library.
6282         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
6283         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
6284         * testsuite/protected_main_1.cc (main): Test that protected
6285         function has same address.
6286
6287 2011-07-11  Ian Lance Taylor  <iant@google.com>
6288
6289         PR gold/12979
6290         * options.h (class General_options): Add -Bgroup.
6291         * options.cc (General_options::finalize): If -Bgroup is set,
6292         default to --unresolved-symbols=report-all.
6293         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
6294         * target-reloc.h (issue_undefined_symbol_error): Handle
6295         --unresolved-symbols=report-all.
6296
6297 2011-07-08  Ian Lance Taylor  <iant@google.com>
6298
6299         PR gold/11985
6300         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
6301         if linker script discards key sections.
6302         (Layout::create_dynamic_symtab): Likewise.
6303         (Layout::assign_local_dynsym_offsets): Likewise.
6304         (Layout::sized_create_version_sections): Likewise.
6305         (Layout::create_interp): Likewise.
6306         (Layout::finish_dynamic_section): Likewise.
6307         (Layout::set_dynamic_symbol_size): Likewise.
6308
6309 2011-07-08  Ian Lance Taylor  <iant@google.com>
6310
6311         PR gold/12386
6312         * options.h (class General_options): Add --unresolved-symbols.
6313         * target-reloc.h (issue_undefined_symbol_error): Check
6314         --unresolved-symbols.  Add comments.
6315
6316 2011-07-08  Ian Lance Taylor  <iant@google.com>
6317
6318         * testsuite/odr_violation2.cc (Ordering::operator()): Make
6319         expression more complex.
6320
6321 2011-07-08  Ian Lance Taylor  <iant@google.com>
6322
6323         PR gold/11317
6324         * target-reloc.h (issue_undefined_symbol_error): New inline
6325         function, broken out of relocate_section.
6326         (relocate_section): Call issue_undefined_symbol_error.
6327         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
6328         there is no TLS segment if we are about to issue an undefined
6329         symbol error.
6330         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
6331
6332 2011-07-08  Ian Lance Taylor  <iant@google.com>
6333
6334         PR gold/12279
6335         * resolve.cc (Symbol_table::should_override): Add fromtype
6336         parameter.  Change all callers.  Give error when linking together
6337         TLS and non-TLS symbol.
6338         (Symbol_table::should_override_with_special): Add fromtype
6339         parameter.  Change all callers.
6340         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
6341         there is no TLS segment if we have reported some errors.
6342         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
6343
6344 2011-07-08  Ian Lance Taylor  <iant@google.com>
6345
6346         PR gold/12372
6347         * target.h (Target::plt_address_for_global): New function.
6348         (Target::plt_address_for_local): New function.
6349         (Target::plt_section_for_global): Remove.
6350         (Target::plt_section_for_local): Remove.
6351         (Target::do_plt_address_for_global): New virtual function.
6352         (Target::do_plt_address_for_local): New virtual function.
6353         (Target::do_plt_section_for_global): Remove.
6354         (Target::do_plt_section_for_local): Remove.
6355         (Target::register_global_plt_entry): Add Symbol_table and Layout
6356         parameters.
6357         * output.cc (Output_data_got::Got_entry::write): Use
6358         plt_address_for_global and plt_address_for_local.
6359         * layout.cc (Layout::add_target_dynamic_tags): Use size and
6360         address of output section.
6361         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
6362         got_irelative_, and irelative_count_ fields.  Update
6363         declarations.
6364         (Output_data_plt_i386::has_irelative_section): New function.
6365         (Output_data_plt_i386::entry_count): Add irelative_count_.
6366         (Output_data_plt_i386::set_final_data_size): Likewise.
6367         (class Target_i386): Add got_irelative_ and rel_irelative_
6368         fields.  Update declarations.
6369         (Target_i386::Target_i386): Initialize new fields.
6370         (Target_i386::do_plt_address_for_global): New function replacing
6371         do_plt_section_for_global.
6372         (Target_i386::do_plt_address_for_local): New function replacing
6373         do_plt_section_for_local.
6374         (Target_i386::got_section): Create got_irelative_.
6375         (Target_i386::rel_irelative_section): New function.
6376         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
6377         fields.  Don't define __rel_iplt_{start,end}.
6378         (Output_data_plt_i386::add_entry): Add symtab and layout
6379         parameters.  Change all callers.  Use different PLT and GOT for
6380         IFUNC symbols.
6381         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
6382         layout parameters.  Change all callers.  Use different PLT and
6383         GOT.
6384         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
6385         (Output_data_plt_i386::rel_irelative): New function.
6386         (Output_data_plt_i386::address_for_global): New function.
6387         (Output_data_plt_i386::address_for_local): New function.
6388         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
6389         IRELATIVE GOT when changing IFUNC GOT entries.
6390         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
6391         reloc.
6392         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
6393         if we didn't create an IRELATIVE GOT.
6394         (Target_i386::Relocate::relocate): Use plt_address_for_global and
6395         plt_address_for_local.
6396         (Target_i386::do_dynsym_value): Use plt_address_for_global.
6397         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
6398         got_irelative_, and irelative_count_ fields.  Update
6399         declarations.
6400         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
6401         Initialize new fields.  Remove symtab parameter.  Change all
6402         callers.
6403         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
6404         irelative_count_.
6405         (Output_data_plt_x86_64::has_irelative_section): New function.
6406         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
6407         (class Target_x86_64): Add got_irelative_ and rel_irelative_
6408         fields.  Update declarations.
6409         (Target_x86_64::Target_x86_64): Initialize new fields.
6410         (Target_x86_64::do_plt_address_for_global): New function replacing
6411         do_plt_section_for_global.
6412         (Target_x86_64::do_plt_address_for_local): New function replacing
6413         do_plt_section_for_local.
6414         (Target_x86_64::got_section): Create got_irelative_.
6415         (Target_x86_64::rela_irelative_section): New function.
6416         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
6417         all callers.  Don't create __rel_iplt_{start,end}.
6418         (Output_data_plt_x86_64::add_entry): Add symtab and layout
6419         parameters.  Change all callers.  Use different PLT and GOT for
6420         IFUNC symbols.
6421         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
6422         layout parameters.  Change all callers.  Use different PLT and
6423         GOT.
6424         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
6425         parameters.  Change all callers.  Use different PLT and GOT for
6426         IFUNC symbols.
6427         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
6428         (Output_data_plt_x86_64::rela_irelative): New function.
6429         (Output_data_plt_x86_64::address_for_global): New function.
6430         (Output_data_plt_x86_64::address_for_local): New function.
6431         (Output_data_plt_x86_64::set_final_data_size): Likewise.
6432         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
6433         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
6434         (Target_x86_64::register_global_plt_entry): Add symtab and layout
6435         parameters.
6436         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
6437         reloc.
6438         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
6439         symbols if we didn't create an IRELATIVE GOT.
6440         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
6441         plt_address_for_local.
6442         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
6443         * testsuite/ifuncvar1.c: New test file.
6444         * testsuite/ifuncvar2.c: New test file.
6445         * testsuite/ifuncvar3.c: New test file.
6446         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
6447         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
6448         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
6449         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
6450         * testsuite/Makefile.in: Rebuild.
6451
6452 2011-07-07  Cary Coutant  <ccoutant@google.com>
6453
6454         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
6455         (two_file_test_1_ndebug.o): Likewise.
6456         (two_file_test_1b_ndebug.o): Likewise.
6457         (two_file_test_2_ndebug.o): Likewise.
6458         (two_file_test_main_ndebug.o): Likewise.
6459         (incremental_test_2): Link with no-debug versions.
6460
6461 2011-07-06  Cary Coutant  <ccoutant@google.com>
6462
6463         * gold/incremental.cc
6464         (Output_section_incremental_inputs::write_info_blocks): Check for
6465         hidden and internal symbols.
6466
6467 2011-07-06  Cary Coutant  <ccoutant@google.com>
6468
6469         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
6470         Check disposition for startup file.
6471         (Incremental_inputs::report_command_line): Ignore
6472         --incremental-startup-unchanged option.
6473         * options.cc (General_options::parse_incremental_startup_unchanged):
6474         New function.
6475         (General_options::General_options): Initialize new data member.
6476         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
6477         (General_options): Add --incremental-startup-unchanged option.
6478         (General_options::incremental_startup_disposition): New function.
6479         (General_options::incremental_startup_disposition_): New data member.
6480
6481 2011-07-06  Cary Coutant  <ccoutant@google.com>
6482
6483         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
6484         input file index to Script_info ctor.
6485         (Sized_incremental_binary::do_file_has_changed): Find the
6486         command-line argument for files named in scripts.
6487         * incremental.h (Script_info::Script_info): New ctor
6488         with input file index.
6489         (Script_info::input_file_index): New function.
6490         (Script_info::input_file_index_): New data member.
6491         (Incremental_binary::get_library): Add const.
6492         (Incremental_binary::get_script_info): Add const.
6493         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
6494         * testsuite/Makefile.am (incremental_test_5): New test case.
6495         (incremental_test_6): New test case.
6496         * testsuite/Makefile.in: Regenerate.
6497
6498 2011-07-06  Cary Coutant  <ccoutant@google.com>
6499
6500         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
6501         debug output when command lines differ.
6502
6503 2011-07-06  Cary Coutant  <ccoutant@google.com>
6504
6505         * incremental.cc (Incremental_inputs::report_command_line): Ignore
6506         --incremental-patch option.
6507         * layout.cc (Free_list::allocate): Extend allocation beyond original
6508         end if enabled.
6509         (Layout::make_output_section): Mark sections that should get
6510         patch space.
6511         * options.cc (parse_percent): New function.
6512         * options.h (parse_percent): New function.
6513         (DEFINE_percent): New macro.
6514         (General_options): Add --incremental-patch option.
6515         * output.cc (Output_section::Output_section): Initialize new data
6516         members.
6517         (Output_section::add_input_section): Print section name when out
6518         of patch space.
6519         (Output_section::add_output_section_data): Likewise.
6520         (Output_section::set_final_data_size): Add patch space when
6521         doing --incremental-full.
6522         (Output_section::do_reset_address_and_file_offset): Remove patch
6523         space.
6524         (Output_segment::set_section_list_addresses): Print debug output
6525         only if --incremental-update.
6526         * output.h (Output_section::set_is_patch_space_allowed): New function.
6527         (Output_section::is_patch_space_allowed_): New data member.
6528         (Output_section::patch_space_): New data member.
6529         * parameters.cc (Parameters::incremental_full): New function.
6530         * parameters.h (Parameters::incremental_full): New function
6531         * testsuite/Makefile.am (incremental_test_2): Add test for
6532         --incremental-patch option.
6533         * testsuite/Makefile.in: Regenerate.
6534         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
6535         (t18): Remove function body.
6536
6537 2011-07-05  Doug Kwan  <dougkwan@google.com>
6538
6539         PR gold/12771
6540         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
6541         Arm_Address type for relocation result.
6542         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
6543         overflow check.
6544         (Arm_relocate_functions::abs32): Use unaligned access.
6545         (Arm_relocate_functions::rel32): Ditto.
6546         (Arm_relocate_functions::prel31): Ditto.
6547         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
6548         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
6549         static data relocations.
6550         * testsuite/Makefile.in: Regnerate.
6551         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
6552
6553 2011-07-05  Ian Lance Taylor  <iant@google.com>
6554
6555         PR gold/12392
6556         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
6557         symbols if necessary.
6558         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6559
6560 2011-07-05  Ian Lance Taylor  <iant@google.com>
6561
6562         PR gold/12952
6563         * resolve.cc (Symbol::override_base_with_special): Simply override
6564         version with special symbol version, ignoring previous version.
6565
6566 2011-07-05  Ian Lance Taylor  <iant@google.com>
6567
6568         * object.cc (Sized_relobj_file::include_section_group): Add
6569         information to comment about signature location.
6570
6571 2011-07-02  Ian Lance Taylor  <iant@google.com>
6572
6573         PR gold/12957
6574         * options.h (class General_options): Add -f and -F.
6575         * options.cc (General_options::finalize): Fatal error if -f/-F
6576         are used without -shared.
6577         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
6578
6579 2011-07-02  Ian Lance Taylor  <iant@google.com>
6580
6581         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
6582
6583 2011-07-01  Ian Lance Taylor  <iant@google.com>
6584
6585         PR gold/12525
6586         PR gold/12952
6587         * resolve.cc (Symbol::override_base_with_special): Don't override
6588         the version if the overriding symbol has a different name.
6589         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
6590         all callers.  If we give an error about an undefined version,
6591         define the base version if necessary.
6592         * dynobj.h (class Versions): Update declaration.
6593         * testsuite/weak_alias_test_5.cc: New file.
6594         * testsuite/weak_alias_test.script: New file.
6595         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
6596         and versioned_alias have the right value, and call t2.
6597         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
6598         weak_alias_test_5.so.
6599         (weak_alias_test_LDADD): Likewise.
6600         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
6601         * testsuite/Makefile.in: Rebuild.
6602
6603 2011-07-01  Ian Lance Taylor  <iant@google.com>
6604
6605         PR gold/12525
6606         * options.h (class General_options): Support -z notext.
6607         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
6608         -Wl,-z,notext.
6609         (two_file_shared_nonpic.so): Likewise.
6610         (two_file_shared_mixed.so): Likewise.
6611         (two_file_shared_mixed_1.so): Likewise.
6612         (weak_undef_lib_nonpic.so): Likewise.
6613         (alt/weak_undef_lib_nonpic.so): Likewise.
6614         (tls_test_shared_nonpic.so): Likewise.
6615         * testsuite/Makefile.in: Rebuild.
6616
6617 2011-07-01  Ian Lance Taylor  <iant@google.com>
6618
6619         PR gold/12525
6620         * configure.ac: Test whether static linking works, setting
6621         the automake conditional HAVE_STATIC.
6622         * testsuite/Makefile.am: Disable tests using -static if
6623         HAVE_STATIC is not true.
6624         * configure, testsuite/Makefile.in: Rebuild.
6625
6626 2011-07-01  Ian Lance Taylor  <iant@google.com>
6627
6628         PR gold/12525
6629         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
6630         Assert if we see DW_EH_PE_indirect.
6631         * target.h (Target::ehframe_datarel_base): New function.
6632         (Target::do_ehframe_datarel_base): New target function.
6633         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
6634         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
6635         function.
6636
6637 2011-07-01  Ian Lance Taylor  <iant@google.com>
6638
6639         PR gold/12571
6640         * options.h (class General_options): Add
6641         --ld-generated-unwind-info.
6642         * ehframe.cc (Fde::write): Add address parameter.  Change all
6643         callers.  If associated with PLT, fill in address and size.
6644         (Cie::set_output_offset): Only add merge mapping if there is an
6645         object.
6646         (Cie::write): Add address parameter.  Change all callers.
6647         (Eh_frame::add_ehframe_for_plt): New function.
6648         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
6649         input_offset_ fields into union u_, with new plt field.
6650         (Fde::Fde): Adjust for new union field.
6651         (Fde::Fde) [Output_data version]: New constructor.
6652         (Fde::add_mapping): Only add merge mapping if there is an object.
6653         (class Cie): Update declarations.
6654         (class Eh_frame): Declare add_ehframe_for_plt.
6655         * layout.cc (Layout::layout_eh_frame): Break out code into
6656         make_eh_frame_section, and call it.
6657         (Layout::make_eh_frame_section): New function.
6658         (Layout::add_eh_frame_for_plt): New function.
6659         * layout.h (class Layout): Update declarations.
6660         * merge.cc (Merge_map::add_mapping): Add assertion.
6661         * i386.cc: Include "dwarf.h".
6662         (class Output_data_plt_i386): Make first_plt_entry,
6663         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
6664         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6665         and plt_eh_frame_fde.
6666         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
6667         boundary.  Call add_eh_frame_for_plt if appropriate.
6668         * x86_64.cc: Include "dwarf.h".
6669         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
6670         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
6671         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6672         and plt_eh_frame_fde.
6673         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
6674         appropriate.
6675
6676 2011-06-29  Ian Lance Taylor  <iant@google.com>
6677
6678         PR gold/12629
6679         * object.cc (Sized_relobj_file::layout_section): Change shdr
6680         parameter to be const.
6681         (Sized_relobj_file::layout_eh_frame_section): New function, broken
6682         out of do_layout.
6683         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
6684         appropriate.  Call layout_eh_frame_section.
6685         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
6686         sections.
6687         * object.h (class Sized_relobj_file): Update declarations.
6688
6689 2011-06-29  Ian Lance Taylor  <iant@google.com>
6690
6691         PR gold/12652
6692         * script.cc (Token::integer_value): Accept trailing M/m/K/k
6693         modifier.
6694         (Lex::gather_token): Accept trailing M/m/K/k for integers.
6695
6696 2011-06-29  Ian Lance Taylor  <iant@google.com>
6697
6698         PR gold/12675
6699         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
6700         SHT_X86_64_UNWIND.
6701         * layout.cc (Layout::layout_eh_frame): Likewise.
6702
6703 2011-06-29  Ian Lance Taylor  <iant@google.com>
6704
6705         PR gold/12695
6706         * layout.cc (Layout::symtab_section_shndx): New function.
6707         * layout.h (class Layout): Declare symtab_section_shndx.
6708         * output.cc (Output_section::write_header): Call it.
6709
6710 2011-06-29  Ian Lance Taylor  <iant@google.com>
6711
6712         PR gold/12818
6713         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
6714         symbols which are not used in a relocation.
6715
6716 2011-06-28  Ian Lance Taylor  <iant@google.com>
6717
6718         PR gold/12898
6719         * layout.cc (Layout::segment_precedes): Don't crash if a linker
6720         script create indistinguishable segments.
6721         (Layout::set_segment_offsets): Use stable_sort when sorting
6722         segments.  Pass this to Compare_segments constructor.
6723         * layout.h (class Layout): Make segment_precedes non-static.
6724         (class Compare_segments): Change from struct to class.  Add
6725         layout_ field.  Add constructor.
6726         * script-sections.cc
6727         (Script_sections::attach_sections_using_phdrs_clause): Rename
6728         local orphan to is_orphan.  Don't report failure to put empty
6729         section in segment.  On attachment failure, report name of
6730         section, and attach to first PT_LOAD segment.
6731
6732 2011-06-28  Ian Lance Taylor  <iant@google.com>
6733
6734         PR gold/12934
6735         * target-select.cc (Target_selector::Target_selector): Add
6736         emulation parameter.  Change all callers.
6737         (select_target_by_bfd_name): Rename from select_target_by_name.
6738         Change all callers.
6739         (select_target_by_emulation): New function.
6740         (supported_emulation_names): New function.
6741         * target-select.h (class Target_selector): Add emulation_ field.
6742         Update declarations.
6743         (Target_selector::recognize_by_bfd_name): Rename from
6744         recognize_by_name.  Change all callers.
6745         (Target_selector::supported_bfd_names): Rename from
6746         supported_names.  Change all callers.
6747         (Target_selector::recognize_by_emulation): New function.
6748         (Target_selector::supported_emulations): New function.
6749         (Target_selector::emulation): New function.
6750         (Target_selector::do_recognize_by_bfd_name): Rename from
6751         do_recognize_by_name.  Change all callers.
6752         (Target_selector::do_supported_bfd_names): Rename from
6753         do_supported_names.  Change all callers.
6754         (Target_selector::do_recognize_by_emulation): New function.
6755         (Target_selector::do_supported_emulations): New function.
6756         (select_target_by_bfd_name): Change name in declaration.
6757         (select_target_by_emulation): Declare.
6758         (supported_emulation_names): Declare.
6759         * parameters.cc (parameters_force_valid_target): Try to find
6760         target based on emulation from -m option.
6761         * options.h (class General_options): Change doc string for -m.
6762         * options.cc (help): Print emulations.
6763         (General_options::parse_V): Likewise.
6764         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
6765         Add emulation parameter.  Change all callers.
6766
6767 2011-06-28  Ian Lance Taylor  <iant@google.com>
6768
6769         * target.h (class Target): Add osabi_ field.
6770         (Target::osabi): New function.
6771         (Target::set_osabi): New function.
6772         (Target::Target): Initialize osabi_.
6773         (Target::do_adjust_elf_header): Make pure virtual.
6774         (Sized_target::do_adjust_elf_header): Declare.
6775         * target.cc (Sized_target::do_adjust_elf_header): New function.
6776         (class Sized_target): Instantiate all versions.
6777         * freebsd.h (class Target_freebsd): Remove.
6778         (Target_selector_freebsd::do_recognize): Call set_osabi on
6779         Target.
6780         (Target_selector_freebsd::do_recognize_by_name): Likewise.
6781         (Target_selector_freebsd::set_osabi): Remove.
6782         * i386.cc (class Target_i386): Inherit from Sized_target rather
6783         than Target_freebsd.
6784         * x86_64.cc (class Target_x86_64): Likewise.
6785
6786 2011-06-28  Ian Lance Taylor  <iant@google.com>
6787
6788         * target.h (Target::can_check_for_function_pointers): Rewrite.
6789         Make non-virtual.
6790         (Target::can_icf_inline_merge_sections): Likewise.
6791         (Target::section_may_have_icf_unsafe_poineters): Likewise.
6792         (Target::Target_info): Add can_icf_inline_merge_sections field.
6793         (Target::do_can_check_for_function_pointers): New virtual
6794         function.
6795         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
6796         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
6797         from can_check_for_function_pointers, move in file.
6798         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
6799         section_may_have_icf_unsafe_poineters, move in file.
6800         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
6801         * i386.cc (Target_i386::do_can_check_for_function_pointers):
6802         Rename from can_check_for_function_pointers, move in file.
6803         (Target_i386::can_icf_inline_merge_sections): Remove.
6804         (Target_i386::i386_info): Initialize
6805         can_icf_inline_merge_sections.
6806         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6807         Initialize can_icf_inline_merge_sections.
6808         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
6809         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
6810         Rename from can_check_for_function_pointers, move in file.
6811         (Target_x86_64::can_icf_inline_merge_sections): Remove.
6812         (Target_x86_64::x86_64_info): Initialize
6813         can_icf_inline_merge_sections.
6814         * testsuite/testfile.cc (Target_test::test_target_info):
6815         Likewise.
6816         * icf.cc (get_section_contents): Correct formatting.
6817
6818 2011-06-27  Ian Lance Taylor  <iant@google.com>
6819
6820         * symtab.cc (Symbol::versioned_name): New function.
6821         (Symbol_table::add_to_final_symtab): Use versioned_name when
6822         appropriate.
6823         (Symbol_table::sized_write_symbol): Likewise.
6824         * symtab.h (class Symbol): Declare versioned_name.
6825         * stringpool.h (class Stringpool_template): Add variant of add
6826         which takes a std::basic_string.
6827         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
6828         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
6829         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
6830         (ver_test_12.o): New target.
6831         * testsuite/Makefile.in: Rebuild.
6832
6833 2011-06-27  Doug Kwan  <dougkwan@google.com>
6834
6835         * arm.cc (Arm_relocate_functions::thm_jump8,
6836         Arm_relocate_functions::thm_jump11): Use a wider signed
6837         type to compute offset.
6838         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
6839         arm_thm_jump8.
6840         * testsuite/Makefile.in: Regenerate.
6841         * testsuite/arm_branch_in_range.sh: Check test results of
6842         arm_thm_jump11 and arm_thm_jump8.
6843         * testsuite/arm_thm_jump11.s: New test source file.
6844         * testsuite/arm_thm_jump11.t: New linker script.
6845         * testsuite/arm_thm_jump8.s: New test source file.
6846         * testsuite/arm_thm_jump8.t: New linker script.
6847
6848 2011-06-24  Ian Lance Taylor  <iant@google.com>
6849
6850         * layout.cc: Include "object.h".
6851         (ctors_sections_in_init_array): New static variable.
6852         (Layout::is_ctors_in_init_array): New function.
6853         (Layout::layout): Add entry to ctors_sections_in_init_array if
6854         appropriate.
6855         * layout.h (class Layout): Declare is_ctors_in_init_array.
6856         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
6857         is_ctors_reverse_view is set.
6858         (Sized_relobj_file::write_sections): Add layout parameter.  Change
6859         all callers.  Set is_ctors_reverse_view field of View_size.
6860         (Sized_relobj_file::reverse_words): New function.
6861         * object.h (Sized_relobj_file::View_size): Add
6862         is_ctors_reverse_view field.
6863         (class Sized_relobj_file): Update declarations.
6864         * testsuite/initpri3.c: New test.
6865         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
6866         initpri3b.
6867         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
6868         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
6869         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
6870         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
6871         * testsuite/Makefile.in: Rebuild.
6872
6873 2011-06-24  Cary Coutant  <ccoutant@google.com>
6874
6875         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
6876         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
6877         (debug_msg_cdebug.err): New targets.
6878         * testsuite/Makefile.in: Regenerate.
6879         * testsuite/debug_msg.sh: Check output of link with compressed debug.
6880         Fix checks for link with shared library.
6881
6882 2011-06-24  Doug Kwan  <dougkwan@google.com>
6883
6884         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
6885         skip empty text sections.
6886         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
6887
6888 2011-06-22  Ian Lance Taylor  <iant@google.com>
6889
6890         PR gold/12910
6891         * options.h (class General_options): Add --ctors-in-init-array.
6892         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
6893         friends as SHT_PROGBITS for merging sections.
6894         (Layout::layout): Remove special handling of .init_array and
6895         friends.  Don't sort if doing relocatable link.  Sort for .ctors
6896         and .dtors if ctors_in_init_array.
6897         (Layout::make_output_section): Force correct section types for
6898         .init_array and friends.  Don't sort if doing relocatable link,
6899         Don't sort .ctors and .dtors if ctors_in_init_array.
6900         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
6901         (Layout::output_section_name): Add relobj parameter.  Change all
6902         callers.  Handle .ctors. and .dtors. in code rather than table.
6903         Handle .ctors and .dtors if ctors_in_init_array.
6904         (Layout::match_file_name): New function, moved from output.cc.
6905         * layout.h (class Layout): Update declarations.
6906         * output.cc: Include "layout.h".
6907         (Input_section_sort_entry::get_priority): New function.
6908         (Input_section_sort_entry::match_file_name): Just call
6909         Layout::match_file_name.
6910         (Output_section::Input_section_sort_init_fini_compare::operator()):
6911         Handle .ctors and .dtors.  Sort by explicit priority rather than
6912         by name.
6913         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
6914         * testsuite/initpri2.c: New test.
6915         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
6916         (check_PROGRAMS): Add initpri2.
6917         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
6918         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
6919         * configure, testsuite/Makefile.in: Rebuild.
6920
6921 2011-06-19  Ian Lance Taylor  <iant@google.com>
6922
6923         PR gold/12880
6924         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
6925         .interp section to a PT_INTERP segment even if we have seen a
6926         --dynamic-linker option.  Don't do it if we have seen a PHDRS
6927         clause in a linker script.
6928         (Layout::finalize): Don't create a .interp section if we've
6929         already create a PT_INTERP segment.
6930         (Layout::create_interp): Always call choose_output_section (revert
6931         patch of 2011-06-17).  Don't create PT_INTERP segment.
6932         * script-sections.cc
6933         (Script_sections::create_note_and_tls_segments): Add a .interp
6934         section to a PT_INTERP segment even if we have seen a
6935         --dynamic-linker option.
6936
6937 2011-06-18  Ian Lance Taylor  <iant@google.com>
6938
6939         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
6940         merely because a non-PT_LOAD segment has a dynamic reloc.
6941
6942 2011-06-18  Ian Lance Taylor  <iant@google.com>
6943
6944         * layout.cc (Layout::finish_dynamic_section): Don't create
6945         DT_FLAGS entry if not needed.
6946
6947 2011-06-18  Ian Lance Taylor  <iant@google.com>
6948
6949         PR gold/12745
6950         * layout.cc (Layout::layout_eh_frame): Correct handling of
6951         writable .eh_frame section.
6952
6953 2011-06-17  Ian Lance Taylor  <iant@google.com>
6954
6955         PR gold/12893
6956         * resolve.cc (Symbol_table::resolve): Don't give an error if a
6957         symbol is redefined with the exact same object and value.
6958
6959 2011-06-17  Ian Lance Taylor  <iant@google.com>
6960
6961         PR gold/12880
6962         * layout.h (class Layout): Add interp_segment_ field.
6963         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
6964         (Layout::attach_allocated_section_to_segment): If making shared
6965         library, put .interp section in PT_INTERP segment.
6966         (Layout::finalize): Also call create_interp if -dynamic-linker
6967         option was used.
6968         (Layout::create_interp): Assert that there is no PT_INTERP
6969         segment.  If not using a SECTIONS clause, use make_output_section.
6970         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
6971         * script-sections.cc
6972         (Script_sections::create_note_and_tls_segments): If making shared
6973         library, put .interp section in PT_INTERP segment.
6974
6975 2011-06-17  Ian Lance Taylor  <iant@google.com>
6976
6977         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
6978         when making a shared library.
6979
6980 2011-06-17  Ian Lance Taylor  <iant@google.com>
6981
6982         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
6983         parameter.  Change all callers.  Don't issue warning about PC32
6984         against locally defined symbol.
6985
6986 2011-06-16  Ian Lance Taylor  <iant@google.com>
6987
6988         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
6989         occurs in same object.
6990
6991 2011-06-14  Alan Modra  <amodra@gmail.com>
6992
6993         * po/POTFILES.in: Regenerate.
6994
6995 2011-06-09  Ian Lance Taylor  <iant@google.com>
6996
6997         * script-sections.cc
6998         (Orphan_output_section::set_section_addresses): For a relocatable
6999         link set address to 0.
7000
7001 2011-06-09  Cary Coutant  <ccoutant@google.com>
7002
7003         PR gold/12804
7004         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
7005         used with --compress-debug-sections.
7006         * gold/object.cc (Sized_relobj_file::do_layout): Report
7007         uncompressed size of compressed input sections.
7008
7009 2011-06-08  Cary Coutant  <ccoutant@google.com>
7010
7011         PR gold/12804
7012         * testsuite/two_file_test_2_v1.cc: Change initialization of
7013         v2 to keep it in .data.
7014
7015 2011-06-07  Cary Coutant  <ccoutant@google.com>
7016
7017         * common.cc (Symbol_table::do_allocate_commons_list): Call
7018         gold_fallback.
7019         * errors.cc (Errors::fatal): Adjust call to gold_exit.
7020         (Errors::fallback): New function.
7021         (gold_fallback): New function.
7022         * errors.h (Errors::fallback): New function.
7023         * gold.cc (gold_exit): Change status parameter to enum; adjust
7024         all callers.
7025         (queue_initial_tasks): Call gold_fallback.
7026         * gold.h: Include cstdlib.
7027         (Exit_status): New enum type.
7028         (gold_exit): Change status parameter to enum.
7029         (gold_fallback): New function.
7030         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
7031         (Layout::create_symtab_sections): Likewise.
7032         (Layout::create_shdrs): Likewise.
7033         * main.cc (main): Adjust call to gold_exit.
7034         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
7035         (Output_data_got::add_got_entry_pair): Likewise.
7036         (Output_section::add_input_section): Likewise.
7037         (Output_section::add_output_section_data): Likewise.
7038         (Output_segment::set_section_list_addresses): Likewise.
7039         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
7040
7041 2011-06-07  Cary Coutant  <ccoutant@google.com>
7042
7043         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
7044         for incremental links.
7045         * output.cc (Output_segment::set_section_list_addresses): Remove
7046         FIXME and test for TLS or BSS.
7047
7048 2011-06-07  Cary Coutant  <ccoutant@google.com>
7049
7050         * testsuite/Makefile.am: Add incremental_copy_test,
7051         incremental_common_test_1.
7052         * testsuite/Makefile.in: Regenerate.
7053         * testsuite/common_test_1_v1.c: New source file.
7054         * testsuite/common_test_1_v2.c: New source file.
7055         * testsuite/copy_test_v1.cc: New source file.
7056
7057 2011-06-07  Cary Coutant  <ccoutant@google.com>
7058
7059         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
7060         update, allocate common from bss section's free list.
7061         * incremental-dump.cc (dump_incremental_inputs): Print flag for
7062         linker-defined symbols.
7063         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
7064         Skip GOT and PLT entries that are no longer referenced.
7065         (Output_section_incremental_inputs::write_info_blocks): Mark
7066         linker-defined symbols.
7067         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
7068         * output.cc (Output_section::allocate): New function.
7069         * output.h (Output_section::allocate): New function.
7070         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
7071         linker-defined symbols.
7072         (Symbol::override_base_with_special): Copy is_predefined_ flag.
7073         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
7074         (Symbol::init_base_output_data): Likewise.
7075         (Symbol::init_base_output_segment): Likewise.
7076         (Symbol::init_base_constant): Likewise.
7077         (Sized_symbol::init_output_data): Likewise.
7078         (Sized_symbol::init_output_segment): Likewise.
7079         (Sized_symbol::init_constant): Likewise.
7080         (Symbol_table::do_define_in_output_data): Likewise.
7081         (Symbol_table::do_define_in_output_segment): Likewise.
7082         (Symbol_table::do_define_as_constant): Likewise.
7083         * symtab.h (Symbol::is_predefined): New function.
7084         (Symbol::init_base_output_data): Add is_predefined parameter.
7085         (Symbol::init_base_output_segment): Likewise.
7086         (Symbol::init_base_constant): Likewise.
7087         (Symbol::is_predefined_): New data member.
7088         (Sized_symbol::init_output_data): Add is_predefined parameter.
7089         (Sized_symbol::init_output_segment): Likewise.
7090         (Sized_symbol::init_constant): Likewise.
7091         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
7092
7093 2011-06-07  Cary Coutant  <ccoutant@google.com>
7094
7095         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
7096         instead of emit_copy_reloc.
7097         (Copy_relocs::emit_copy_reloc): Refactor.
7098         (Copy_relocs::make_copy_reloc): New function.
7099         (Copy_relocs::add_copy_reloc): Remove.
7100         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
7101         section.
7102         (Copy_relocs::make_copy_reloc): New function.
7103         (Copy_relocs::add_copy_reloc): Remove.
7104         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
7105         unchanged input files.
7106         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
7107         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
7108         Reserve BSS space for COPY relocations.
7109         (Sized_incremental_binary::do_emit_copy_relocs): New function.
7110         (Output_section_incremental_inputs::write_info_blocks): Record
7111         whether a symbol is copied from a shared object.
7112         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
7113         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
7114         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
7115         (Incremental_input_entry_reader::get_output_symbol_index): Add
7116         is_copy parameter.
7117         (Incremental_binary::emit_copy_relocs): New function.
7118         (Incremental_binary::do_emit_copy_relocs): New function.
7119         (Sized_incremental_binary::Sized_incremental_binary): Initialize
7120         new data member.
7121         (Sized_incremental_binary::add_copy_reloc): New function.
7122         (Sized_incremental_binary::do_emit_copy_relocs): New function.
7123         (Sized_incremental_binary::Copy_reloc): New struct.
7124         (Sized_incremental_binary::Copy_relocs): New typedef.
7125         (Sized_incremental_binary::copy_relocs_): New data member.
7126         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
7127         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
7128         * target.h (Sized_target::emit_copy_reloc): New function.
7129         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
7130
7131 2011-06-02  Cary Coutant  <ccoutant@google.com>
7132
7133         PR gold/12163
7134         * gold/archive.cc (Archive::Archive): Initialize new data member.
7135         (Archive::include_all_members): Return if archive has already been
7136         included.
7137         * gold/archive.h (Archive::include_all_members_): New data member.
7138
7139 2011-06-02  Nick Clifton  <nickc@redhat.com>
7140
7141         * dynobj.h: Fix spelling mistake in comment.
7142         * output.cc: Likewise.
7143
7144 2011-05-31  Doug Kwan  <dougkwan@google.com>
7145             Asier Llano
7146
7147         PR gold/12826
7148         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
7149         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
7150         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
7151         redundant arm_exidx_test.so.
7152         * testsuite/Makefile.in: Regenerate.
7153         (check_SCRIPTS): Add pr12826.sh
7154         (check_DATA): Add pr12826.stdout
7155         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
7156         * testsuite/pr12826.sh: New file.
7157         * testsuite/pr12826_1.s: Ditto.
7158         * testsuite/pr12826_1.s: Ditto.
7159
7160 2011-05-30  Ian Lance Taylor  <iant@google.com>
7161
7162         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
7163         sections.
7164
7165 2011-05-29  Ian Lance Taylor  <iant@google.com>
7166
7167         PR gold/12804
7168         * testsuite/Makefile.am: Use different file name for two_file_test
7169         temporary file for each incremental test.
7170         * testsuite/Makefile.in: Rebuild.
7171
7172 2011-05-29  Ian Lance Taylor  <iant@google.com>
7173
7174         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
7175         binary input file is empty.
7176
7177 2011-05-27  Ian Lance Taylor  <iant@google.com>
7178
7179         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
7180         (ver_test_9.so): Likewise.
7181         * testsuite/Makefile.in: Rebuild.
7182
7183 2011-05-26 Cary Coutant  <ccoutant@google.com>
7184
7185         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
7186         * incremental.cc (Incremental_inputs::report_input_section): Fix
7187         comment, indentation.
7188         (Incremental_inputs::report_comdat_group): New function.
7189         (Output_section_incremental_inputs::set_final_data_size): Adjust size
7190         of data for incremental input file entry.
7191         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
7192         group count, COMDAT group signatures.
7193         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
7194         an unchanged input file.
7195         * incremental.h (Incremental_object_entry::Incremental_object_entry):
7196         Initialize new data member.
7197         (Incremental_object_entry::add_comdat_group): New function.
7198         (Incremental_object_entry::get_comdat_group_count): New function.
7199         (Incremental_object_entry::get_comdat_signature_key): New function.
7200         (Incremental_object_entry::groups_): New data member.
7201         (Incremental_inputs::report_comdat_group): New function.
7202         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
7203         data for incremental input file entry.
7204         (Incremental_input_entry_reader::get_comdat_group_count): New function.
7205         (Incremental_input_entry_reader::get_input_section): Adjust size of
7206         data for incremental input file entry.
7207         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
7208         (Incremental_input_entry_reader::get_comdat_group_signature): New
7209         function.
7210         * object.cc (Sized_relobj::include_section_group): Report kept
7211         COMDAT groups for incremental links.
7212
7213 2011-05-24  David Meyer  <pdox@google.com>
7214
7215         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
7216         with name parameter.  Add found_name parameter.
7217         * fileread.cc (Input_file::find_file): Adjust code accordingly.
7218         * dirsearch.h (class Dirsearch): Update declaration.
7219
7220 2011-05-24  Ian Lance Taylor  <iant@google.com>
7221
7222         * archive.cc (Library_base::should_include_member): Pull in object
7223         from archive if it defines the entry symbol.
7224         * parameters.cc (Parameters::entry): New function.
7225         * parameters.h (class Parameters): Declare entry.
7226         * output.h (class Output_file_header): Remove entry_ field.
7227         * output.cc (Output_file_header::Output_file_header): Remove entry
7228         parameter.  Change all callers.
7229         (Output_file_header::entry): Use parameters->entry.
7230         * gold.cc (queue_middle_tasks): Likewise.
7231         * plugin.cc (Plugin_hook::run): Likewise.
7232
7233 2011-05-24 Cary Coutant  <ccoutant@google.com>
7234
7235         * gold.cc (queue_initial_tasks): Pass incremental base filename
7236         to Output_file::open_base_file; don't print error message.
7237         * incremental-dump.cc (main): Adjust call to
7238         Output_file::open_for_modification.
7239         * incremental-dump.cc (main): Likewise.
7240         * incremental.cc (Incremental_inputs::report_command_line):
7241         Ignore --incremental-base option when comparing command lines.
7242         Ignore parameter when given as separate argument.
7243         * options.h (class General_options): Add --incremental-base.
7244         * output.cc (Output_file::Output_file):
7245         (Output_file::open_base_file): Add base_name and writable parameters;
7246         read base file into new file; print error message here.
7247         (Output_file::map_no_anonymous): Add writable parameter; adjust all
7248         callers.
7249         * output.h (Output_file::open_for_modification): Rename to...
7250         (Output_file::open_base_file): ...this; add base_name and
7251         writable parameters; adjust all callers.
7252         (Output_file::map_no_anonymous): Add writable parameter; adjust all
7253         callers.
7254         * testsuite/Makefile.am (incremental_test_4): Test
7255         --incremental-base.
7256         * testsuite/Makefile.in: Regenerate.
7257
7258 2011-05-24 Cary Coutant  <ccoutant@google.com>
7259
7260         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
7261         incremental_test_4.
7262         * testsuite/Makefile.in: Regenerate.
7263         * testsuite/two_file_test_1_v1.cc: New test source file.
7264         * testsuite/two_file_test_1b_v1.cc: New test source file.
7265         * testsuite/two_file_test_2_v1.cc: New test source file.
7266
7267 2011-05-24 Cary Coutant  <ccoutant@google.com>
7268
7269         * dynobj.h (Dynobj::do_dynobj): New function.
7270         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
7271         flag and soname for shared objects.
7272         * incremental.cc (Incremental_inputs::report_object): Make
7273         either Incremental_object_entry or Incremental_dynobj_entry; add
7274         soname to string table.
7275         (Incremental_inputs::report_input_section): Add assertion.
7276         (Output_section_incremental_inputs::set_final_data_size): Adjust
7277         type of input file entry for shared libraries; adjust size of
7278         shared library info entry.
7279         (Output_section_incremental_inputs::write_input_files): Write
7280         as_needed flag for shared libraries.
7281         (Output_section_incremental_inputs::write_info_blocks): Adjust type
7282         of input file entry for shared libraries; write soname.
7283         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
7284         soname from incremental info.
7285         * incremental.h (enum Incremental_input_flags): Add
7286         INCREMENTAL_INPUT_AS_NEEDED.
7287         (Incremental_input_entry::Incremental_input_entry): Initialize new
7288         data member.
7289         (Incremental_input_entry::set_as_needed): New function.
7290         (Incremental_input_entry::as_needed): New function.
7291         (Incremental_input_entry::do_dynobj_entry): New function.
7292         (Incremental_input_entry::as_needed_): New data member.
7293         (Incremental_object_entry::Incremental_object_entry): Don't check
7294         for shared library.
7295         (Incremental_object_entry::do_type): Likewise.
7296         (class Incremental_dynobj_entry): New class.
7297         (Incremental_input_entry_reader::as_needed): New function.
7298         (Incremental_input_entry_reader::get_soname): New function.
7299         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
7300         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
7301         size of shared library info entry.
7302         * layout.cc (Layout::finish_dynamic_section): Don't test for
7303         incremental link when adding DT_NEEDED entries.
7304         * object.h (Object::Object): Initialize new data member.
7305         (Object::dynobj): New function.
7306         (Object::set_as_needed): New function.
7307         (Object::as_needed): New function.
7308         (Object::do_dynobj): New function.
7309         (Object::as_needed_): New data member.
7310
7311 2011-05-24 Cary Coutant  <ccoutant@google.com>
7312
7313         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
7314         info; adjust display of GOT entries.
7315         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7316         vector of input objects; remove file_status_.
7317         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
7318         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
7319         got_plt reader; call target hooks to reserve GOT entries.
7320         (Output_section_incremental_inputs::set_final_data_size): Adjust size
7321         of input file info header and GOT info entry.
7322         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
7323         relocation info.
7324         (Got_plt_view_info::got_descriptor): Remove.
7325         (Got_plt_view_info::sym_index): New data member.
7326         (Got_plt_view_info::input_index): New data member.
7327         (Local_got_offset_visitor::visit): Write input file index.
7328         (Global_got_offset_visitor::visit): Write 0 for input file index.
7329         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
7330         with sym_index and input_index.
7331         (Output_section_incremental_inputs::write_got_plt): Adjust size of
7332         incremental info GOT entry; replace got_descriptor with input_index.
7333         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
7334         map from input file index to object.
7335         (Sized_relobj_incr::do_layout): Replace direct data member reference
7336         with accessor function.
7337         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
7338         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
7339         Adjust size of input file info header.
7340         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
7341         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
7342         (Incremental_input_entry_reader::get_input_section): Adjust size of
7343         input file info header.
7344         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
7345         of incremental info GOT entry.
7346         (Incremental_got_plt_reader::get_got_desc): Remove.
7347         (Incremental_got_plt_reader::get_got_symndx): New function.
7348         (Incremental_got_plt_reader::get_got_input_index): New function.
7349         (Sized_incremental_binary::Sized_incremental_binary): Remove
7350         file_status_; add input_objects_.
7351         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
7352         (Sized_incremental_binary::set_file_is_unchanged): Remove.
7353         (Sized_incremental_binary::file_is_unchanged): Remove.
7354         (Sized_incremental_binary::set_input_object): New function.
7355         (Sized_incremental_binary::input_object): New function.
7356         (Sized_incremental_binary::file_status_): Remove.
7357         (Sized_incremental_binary::input_objects_): New data member.
7358         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
7359         references.
7360         (Sized_relobj_incr::invalid_address): Move to base class.
7361         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
7362         class.
7363         (Sized_relobj_incr::do_output_section_offset): Likewise.
7364         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
7365         (Sized_relobj_incr::section_offsets_): Likewise.
7366         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
7367         function.
7368         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
7369         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
7370         with accessor function.
7371         (Sized_relobj_file::do_layout): Likewise.
7372         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
7373         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
7374         (Sized_relobj_file::compute_final_local_value): Replace refs to
7375         section_offsets_ with accessor function.
7376         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
7377         * object.h (Relobj::Relobj): Initialize new data members.
7378         (Relobj::add_dyn_reloc): New function.
7379         (Relobj::first_dyn_reloc): New function.
7380         (Relobj::dyn_reloc_count): New function.
7381         (Relobj::first_dyn_reloc_): New data member.
7382         (Relobj::dyn_reloc_count_): New data member.
7383         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
7384         references.
7385         (Sized_relobj::Address): New typedef.
7386         (Sized_relobj::invalid_address): Move here from child class.
7387         (Sized_relobj::Sized_relobj): Initialize new data members.
7388         (Sized_relobj::sized_relobj): New function.
7389         (Sized_relobj::is_output_section_offset_invalid): Move here from
7390         child class.
7391         (Sized_relobj::get_output_section_offset): Likewise.
7392         (Sized_relobj::local_has_got_offset): Likewise.
7393         (Sized_relobj::local_got_offset): Likewise.
7394         (Sized_relobj::set_local_got_offset): Likewise.
7395         (Sized_relobj::do_for_all_local_got_entries): Likewise.
7396         (Sized_relobj::clear_got_offsets): New function.
7397         (Sized_relobj::section_offsets): Move here from child class.
7398         (Sized_relobj::do_output_section_offset): Likewise.
7399         (Sized_relobj::do_set_section_offset): Likewise.
7400         (Sized_relobj::Local_got_offsets): Likewise.
7401         (Sized_relobj::local_got_offsets_): Likewise.
7402         (Sized_relobj::section_offsets_): Likewise.
7403         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
7404         references.
7405         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
7406         class.
7407         (Sized_relobj_file::sized_relobj): New function
7408         (Sized_relobj_file::local_has_got_offset): Move to base class.
7409         (Sized_relobj_file::local_got_offset): Likewise.
7410         (Sized_relobj_file::set_local_got_offset): Likewise.
7411         (Sized_relobj_file::get_output_section_offset): Likewise.
7412         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
7413         (Sized_relobj_file::do_output_section_offset): Likewise.
7414         (Sized_relobj_file::do_set_section_offset): Likewise.
7415         (Sized_relobj_file::Local_got_offsets): Likewise.
7416         (Sized_relobj_file::local_got_offsets_): Likewise.
7417         (Sized_relobj_file::section_offsets_): Likewise.
7418         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
7419         (all constructors).
7420         (set_needs_dynsym_index): Convert relobj to derived class pointer.
7421         (Output_reloc::get_symbol_index): Likewise.
7422         (Output_reloc::local_section_offset): Likewise.
7423         (Output_reloc::get_address): Likewise.
7424         (Output_reloc::symbol_value): Likewise.
7425         (Output_data_got::reserve_slot): Move to class definition.
7426         (Output_data_got::reserve_local): New function.
7427         (Output_data_got::reserve_slot_for_global): Remove.
7428         (Output_data_got::reserve_global): New function.
7429         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
7430         (all constructors, two instantiations).
7431         (Output_reloc::get_relobj): New function (two instantiations).
7432         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
7433         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
7434         (Output_data_reloc::add_global): Adjust type of relobj.
7435         (Output_data_reloc::add_global_relative): Likewise.
7436         (Output_data_reloc::add_symbolless_global_addend): Likewise.
7437         (Output_data_reloc::add_local): Likewise.
7438         (Output_data_reloc::add_local_relative): Likewise.
7439         (Output_data_reloc::add_symbolless_local_addend): Likewise.
7440         (Output_data_reloc::add_local_section): Likewise.
7441         (Output_data_reloc::add_output_section): Likewise.
7442         (Output_data_reloc::add_absolute): Likewise.
7443         (Output_data_reloc::add_target_specific): Likewise.
7444         (Output_data_got::reserve_slot): Move definition here.
7445         (Output_data_got::reserve_local): New function.
7446         (Output_data_got::reserve_global): New function.
7447         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
7448         section_offsets_ with accessor function.
7449         (Sized_relobj_file::write_sections): Likewise.
7450         (Sized_relobj_file::do_relocate_sections): Likewise.
7451         * target.h (Sized_target::reserve_local_got_entry): New function.
7452         (Sized_target::reserve_global_got_entry): New function.
7453         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
7454         (Target_x86_64::reserve_global_got_entry): New function.
7455         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
7456
7457 2011-05-23 Cary Coutant  <ccoutant@google.com>
7458
7459         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
7460         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
7461         bit when checking got_type.
7462         * incremental.cc (Sized_incremental_binary::setup_readers):
7463         Store symbol table and string table locations; initialize bit vector
7464         of file status flags.
7465         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
7466         unchanged files.
7467         (Sized_incremental_binary::do_process_got_plt): New function.
7468         (Sized_incremental_binary::get_symtab_view): Use stored locations.
7469         (Output_section_incremental_inputs::set_final_data_size): Record
7470         file index for each input file.
7471         (Output_section_incremental_inputs::write_got_plt): Store file index
7472         instead of input entry offset for each GOT entry.
7473         * incremental.h
7474         (Incremental_input_entry::Incremental_input_entry): Initialize new
7475         data member.
7476         (Incremental_input_entry::set_offset): Store file index.
7477         (Incremental_input_entry::get_file_index): New function.
7478         (Incremental_input_entry::file_index_): New data member.
7479         (Incremental_binary::process_got_plt): New function.
7480         (Incremental_binary::do_process_got_plt): New function.
7481         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7482         data members.
7483         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
7484         (Sized_incremental_binary::set_file_is_unchanged): New function.
7485         (Sized_incremental_binary::file_is_unchanged): New function.
7486         (Sized_incremental_binary::do_process_got_plt): New function.
7487         (Sized_incremental_binary::file_status_): New data member.
7488         (Sized_incremental_binary::main_symtab_loc_): New data member.
7489         (Sized_incremental_binary::main_strtab_loc_): New data member.
7490         * output.cc (Output_data_got::Got_entry::write): Add case
7491         RESERVED_CODE.
7492         (Output_data_got::add_global): Call add_got_entry.
7493         (Output_data_got::add_global_plt): Likewise.
7494         (Output_data_got::add_global_with_rel): Likewise.
7495         (Output_data_got::add_global_with_rela): Likewise.
7496         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
7497         (Output_data_got::add_global_pair_with_rela): Likewise.
7498         (Output_data_got::add_local): Call add_got_entry.
7499         (Output_data_got::add_local_plt): Likewise.
7500         (Output_data_got::add_local_with_rel): Likewise.
7501         (Output_data_got::add_local_with_rela): Likewise.
7502         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
7503         (Output_data_got::add_local_pair_with_rela): Likewise.
7504         (Output_data_got::reserve_slot): New function.
7505         (Output_data_got::reserve_slot_for_global): New function.
7506         (Output_data_got::add_got_entry): New function.
7507         (Output_data_got::add_got_entry_pair): New function.
7508         (Output_section::add_output_section_data): Edit FIXME.
7509         * output.h
7510         (Output_section_data_build::Output_section_data_build): New
7511         constructor with size parameter.
7512         (Output_data_space::Output_data_space): Likewise.
7513         (Output_data_got::Output_data_got): Initialize new data member; new
7514         constructor with size parameter.
7515         (Output_data_got::add_constant): Call add_got_entry.
7516         (Output_data_got::reserve_slot): New function.
7517         (Output_data_got::reserve_slot_for_global): New function.
7518         (class Output_data_got::Got_entry): Add RESERVED_CODE.
7519         (Output_data_got::add_got_entry): New function.
7520         (Output_data_got::add_got_entry_pair): New function.
7521         (Output_data_got::free_list_): New data member.
7522         * target.h (Sized_target::init_got_plt_for_update): New function.
7523         (Sized_target::register_global_plt_entry): New function.
7524         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
7525         Initialize new data member; call init; add constructor with PLT count.
7526         (Output_data_plt_x86_64::init): New function.
7527         (Output_data_plt_x86_64::add_relocation): New function.
7528         (Output_data_plt_x86_64::reserve_slot): New function.
7529         (Output_data_plt_x86_64::free_list_): New data member.
7530         (Target_x86_64::init_got_plt_for_update): New function.
7531         (Target_x86_64::register_global_plt_entry): New function.
7532         (Output_data_plt_x86_64::add_entry): Allocate from free list for
7533         incremental updates.
7534         (Output_data_plt_x86_64::add_relocation): New function.
7535         * testsuite/object_unittest.cc (Object_test): Set default options.
7536
7537 2011-05-16  Ian Lance Taylor  <iant@google.com>
7538
7539         * options.h (class General_options): Make -i a synonym for -r.
7540
7541 2011-05-16  Ian Lance Taylor  <iant@google.com>
7542
7543         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
7544
7545 2011-05-10 Cary Coutant  <ccoutant@google.com>
7546
7547         * object.cc (Sized_relobj::do_count_local_symbols): Check for
7548         strip_all (-s).
7549
7550 2011-05-06  Ian Lance Taylor  <iant@google.com>
7551
7552         * layout.cc (Layout::layout): If the output section flags change,
7553         update the ordering.
7554
7555 2011-04-25 Cary Coutant  <ccoutant@google.com>
7556
7557         * incremental-dump.cc (dump_incremental_inputs): Print local
7558         symbol info for each input file.
7559         * incremental.cc
7560         (Output_section_incremental_inputs::set_final_data_size): Add local
7561         symbol info to input file entries in incremental info.
7562         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7563         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
7564         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
7565         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
7566         implementation.
7567         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
7568         (Sized_incr_relobj::do_relocate): Write the local symbols.
7569         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
7570         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
7571         Adjust size of input file header.
7572         (Incremental_inputs_reader::get_local_symbol_offset): New function.
7573         (Incremental_inputs_reader::get_local_symbol_count): New function.
7574         (Incremental_inputs_reader::get_input_section): Adjust size of input
7575         file header.
7576         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
7577         (Sized_incr_relobj::This): New typedef.
7578         (Sized_incr_relobj::sym_size): New const data member.
7579         (Sized_incr_relobj::Local_symbol): New struct.
7580         (Sized_incr_relobj::do_output_local_symbol_count): New function.
7581         (Sized_incr_relobj::do_local_symbol_offset): New function.
7582         (Sized_incr_relobj::local_symbol_count_): New data member.
7583         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
7584         (Sized_incr_relobj::local_symbol_index_): New data member.
7585         (Sized_incr_relobj::local_symbol_offset_): New data member.
7586         (Sized_incr_relobj::local_dynsym_offset_): New data member.
7587         (Sized_incr_relobj::local_symbols_): New data member.
7588         * object.h (Relobj::output_local_symbol_count): New function.
7589         (Relobj::local_symbol_offset): New function.
7590         (Relobj::do_output_local_symbol_count): New function.
7591         (Relobj::do_local_symbol_offset): New function.
7592         (Sized_relobj::do_output_local_symbol_count): New function.
7593         (Sized_relobj::do_local_symbol_offset): New function.
7594
7595 2011-04-22  Vladimir Simonov  <sv@sw.ru>
7596
7597         * descriptors.cc (set_close_on_exec): New function.
7598         (Descriptors::open): Use set_close_on_exec.
7599         * output.cc (S_ISLNK): Define if not defined.
7600
7601 2011-04-22 Cary Coutant  <ccoutant@google.com>
7602
7603         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7604         global symbol map.
7605         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7606         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
7607         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
7608         relocations.
7609         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
7610         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
7611         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
7612         * incremental.h
7613         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
7614         function.
7615         (Incremental_binary::apply_incremental_relocs): New function.
7616         (Incremental_binary::do_apply_incremental_relocs): New function.
7617         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7618         data member.
7619         (Sized_incremental_binary::add_global_symbol): New function.
7620         (Sized_incremental_binary::global_symbol): New function.
7621         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7622         (Sized_incremental_binary::symbol_map_): New data member.
7623         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
7624         * target.h (Sized_target::apply_relocation): New function.
7625         * target-reloc.h (apply_relocation): New function.
7626         * x86_64.cc (Target_x86_64::apply_relocation): New function.
7627
7628 2011-04-22  Doug Kwan  <dougkwan@google.com>
7629
7630         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
7631         flag of a SHT_ARM_EXIDX section.
7632         * testsuite/Makefile.am (arm_exidx_test): New test rules.
7633         * testsuite/Makefile.in: Regenerate.
7634         * testsuite/arm_exidx_test.s: New file.
7635         * testsuite/arm_exidx_test.sh: Same.
7636
7637 2011-04-20 Cary Coutant  <ccoutant@google.com>
7638
7639         PR gold/12689
7640         * archive.h (Incremental_archive_entry::Archive_member):
7641         Initialize arg_serial_ (second constructor).
7642
7643 2011-04-17  Ian Lance Taylor  <iant@google.com>
7644
7645         * object.cc (Relocate_info::location): Simplify location string.
7646         * errors.cc (Errors::error_at_location): Don't print program
7647         name.
7648         (Errors::warning_at_location): Likewise.
7649         (Errors::undefined_symbol): Likewise.
7650         * testsuite/debug_msg.sh: Update accordingly.
7651
7652 2011-04-14 Cary Coutant  <ccoutant@google.com>
7653
7654         * gold/layout.cc (Layout::symtab_section_offset): New function.
7655         * gold/layout.h (Layout::symtab_section_offset): New function.
7656         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
7657
7658 2011-04-12  Ian Lance Taylor  <iant@google.com>
7659
7660         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
7661         with MREMAP_MAYMOVE.
7662         * output.h (class Output_file): Add map_is_allocated_ field.
7663         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
7664         not available, provide stubs.  If mremap is not available, #define
7665         it to gold_mremap.
7666         (MREMAP_MAYMOVE): Define if not defined.
7667         (Output_file::Output_file): Initialize map_is_allocated_.
7668         (Output_file::resize): Check map_is_allocated_.
7669         (Output_file::map_anonymous): If mmap fails, use malloc.
7670         (Output_file::unmap): Don't do anything for an anonymous map.
7671         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
7672         is not available, provide stubs.
7673         (File_read::View::~View): Use free rather than delete[].
7674         (File_read::make_view): Use malloc rather than new[].  If mmap
7675         fails, use malloc.
7676         (File_read::find_or_make_view): Use malloc rather than new[].
7677         * gold.h: Remove HAVE_REMAP code.
7678         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
7679         exists.  Rename mremap to gold_mremap.  If mmap is not available
7680         don't do anything.
7681         * configure, config.in: Rebuild.
7682
7683 2011-04-11  Ian Lance Taylor  <iant@google.com>
7684
7685         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
7686         initialize local variable v.
7687
7688 2011-04-11  Cary Coutant  <ccoutant@google.com>
7689
7690         * archive.cc (Archive::include_member): Adjust call to
7691         report_object.
7692         (Add_archive_symbols::run): Track argument serial numbers.
7693         (Lib_group::include_member): Likewise.
7694         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
7695         * archive.h (Incremental_archive_entry::Archive_member):
7696         Initialize arg_serial_.
7697         (Archive_member::arg_serial_): New data member.
7698         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
7699         (Sized_dynobj::do_add_symbols): Track symbols when doing an
7700         incremental link.
7701         (Sized_dynobj::do_for_all_local_got_entries): New function.
7702         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
7703         function.
7704         * fileread.cc (get_mtime): New function.
7705         * fileread.h (get_mtime): New function.
7706         * gold.cc (queue_initial_tasks): Check for incremental update.
7707         (process_incremental_input): New function.
7708         (queue_middle_tasks): Don't force valid target for incremental
7709         update.
7710         * incremental-dump.cc (find_input_containing_global): Adjust
7711         size of symbol info entry.
7712         (dump_incremental_inputs): Dump argument serial number and
7713         in_system_directory flag; bias shndx by 1; print symbol names
7714         when dumping per-file symbol lists; use new symbol info readers.
7715         * incremental.cc
7716         (Output_section_incremental_inputs:update_data_size): New function.
7717         (Sized_incremental_binary::setup_readers): Setup input readers
7718         for each input file; build maps for files added from libraries
7719         and scripts.
7720         (Sized_incremental_binary::check_input_args): New function.
7721         (Sized_incremental_binary::do_check_inputs): Build map of argument
7722         serial numbers to input arguments.
7723         (Sized_incremental_binary::do_file_has_changed): Rename
7724         do_file_is_unchanged to this; compare file modification times.
7725         (Sized_incremental_binary::do_init_layout): New function.
7726         (Sized_incremental_binary::do_reserve_layout): New function.
7727         (Sized_incremental_binary::do_get_input_reader): Remove.
7728         (Sized_incremental_binary::get_symtab_view): New function.
7729         (Incremental_checker::can_incrementally_link_output_file): Remove.
7730         (Incremental_inputs::report_command_line): Exclude --debug options.
7731         (Incremental_inputs::report_archive_begin): Add parameter; track
7732         argument serial numbers; don't put input file entry for archive
7733         before archive members.
7734         (Incremental_inputs::report_archive_end): Put input file entry
7735         for archive after archive members.
7736         (Incremental_inputs::report_object): Add parameter; track argument
7737         serial numbers and in_system_directory flag.
7738         (Incremental_inputs::report_script): Add parameter; track argument
7739         serial numbers.
7740         (Output_section_incremental_inputs::set_final_data_size): Adjust
7741         size of symbol info entry; check for forwarding symbols.
7742         (Output_section_incremental_inputs::write_input_files): Write
7743         in_system_directory flag and argument serial number.
7744         (Output_section_incremental_inputs::write_info_blocks): Map section
7745         indices between incremental info and original input file; store
7746         input section index for each symbol.
7747         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
7748         change operator() to visit().
7749         (class Global_got_offset_visitor): Likewise.
7750         (class Global_symbol_visitor_got_plt):
7751         (Output_section_incremental_inputs::write_got_plt): Use new visitor
7752         classes.
7753         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
7754         (Sized_incr_relobj::do_read_symbols): New function.
7755         (Sized_incr_relobj::do_layout): New function.
7756         (Sized_incr_relobj::do_layout_deferred_sections): New function.
7757         (Sized_incr_relobj::do_add_symbols): New function.
7758         (Sized_incr_relobj::do_should_include_member): New function.
7759         (Sized_incr_relobj::do_for_all_global_symbols): New function.
7760         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
7761         (Sized_incr_relobj::do_section_size): New function.
7762         (Sized_incr_relobj::do_section_name): New function.
7763         (Sized_incr_relobj::do_section_contents): New function.
7764         (Sized_incr_relobj::do_section_flags): New function.
7765         (Sized_incr_relobj::do_section_entsize): New function.
7766         (Sized_incr_relobj::do_section_address): New function.
7767         (Sized_incr_relobj::do_section_type): New function.
7768         (Sized_incr_relobj::do_section_link): New function.
7769         (Sized_incr_relobj::do_section_info): New function.
7770         (Sized_incr_relobj::do_section_addralign): New function.
7771         (Sized_incr_relobj::do_initialize_xindex): New function.
7772         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
7773         (Sized_incr_relobj::do_read_relocs): New function.
7774         (Sized_incr_relobj::do_gc_process_relocs): New function.
7775         (Sized_incr_relobj::do_scan_relocs): New function.
7776         (Sized_incr_relobj::do_count_local_symbols): New function.
7777         (Sized_incr_relobj::do_finalize_local_symbols): New function.
7778         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
7779         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
7780         (Sized_incr_relobj::do_relocate): New function.
7781         (Sized_incr_relobj::do_set_section_offset): New function.
7782         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
7783         (Sized_incr_dynobj::do_read_symbols): New function.
7784         (Sized_incr_dynobj::do_layout): New function.
7785         (Sized_incr_dynobj::do_add_symbols): New function.
7786         (Sized_incr_dynobj::do_should_include_member): New function.
7787         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
7788         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
7789         (Sized_incr_dynobj::do_section_size): New function.
7790         (Sized_incr_dynobj::do_section_name): New function.
7791         (Sized_incr_dynobj::do_section_contents): New function.
7792         (Sized_incr_dynobj::do_section_flags): New function.
7793         (Sized_incr_dynobj::do_section_entsize): New function.
7794         (Sized_incr_dynobj::do_section_address): New function.
7795         (Sized_incr_dynobj::do_section_type): New function.
7796         (Sized_incr_dynobj::do_section_link): New function.
7797         (Sized_incr_dynobj::do_section_info): New function.
7798         (Sized_incr_dynobj::do_section_addralign): New function.
7799         (Sized_incr_dynobj::do_initialize_xindex): New function.
7800         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
7801         (make_sized_incremental_object): New function.
7802         (Incremental_library::copy_unused_symbols): New function.
7803         (Incremental_library::do_for_all_unused_symbols): New function.
7804         * incremental.h (enum Incremental_input_flags): New type.
7805         (class Incremental_checker): Remove.
7806         (Incremental_input_entry::Incremental_input_entry): Add argument
7807         serial number.
7808         (Incremental_input_entry::arg_serial): New function.
7809         (Incremental_input_entry::set_is_in_system_directory): New function.
7810         (Incremental_input_entry::is_in_system_directory): New function.
7811         (Incremental_input_entry::arg_serial_): New data member.
7812         (Incremental_input_entry::is_in_system_directory_): New data member.
7813         (class Script_info): Move here from script.h.
7814         (Script_info::Script_info): Add filename parameter.
7815         (Script_info::filename): New function.
7816         (Script_info::filename_): New data member.
7817         (Incremental_script_entry::Incremental_script_entry): Add argument
7818         serial number.
7819         (Incremental_object_entry::Incremental_object_entry): Likewise.
7820         (Incremental_object_entry::add_input_section): Build list of input
7821         sections with map to original shndx.
7822         (Incremental_object_entry::get_input_section_index): New function.
7823         (Incremental_object_entry::shndx_): New data member.
7824         (Incremental_object_entry::name_key_): Rename; adjust all refs.
7825         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
7826         (Incremental_archive_entry::Incremental_archive_entry): Add argument
7827         serial number.
7828         (Incremental_inputs::report_archive_begin): Likewise.
7829         (Incremental_inputs::report_object): Likewise.
7830         (Incremental_inputs::report_script): Likewise.
7831         (class Incremental_global_symbol_reader): New class.
7832         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
7833         and store flags and input file type.
7834         (Incremental_input_entry_reader::arg_serial): New function.
7835         (Incremental_input_entry_reader::type): Extract type from flags.
7836         (Incremental_input_entry_reader::is_in_system_directory): New function.
7837         (Incremental_input_entry_reader::get_input_section_count): Call
7838         accessor function for type.
7839         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
7840         function for type; adjust size of global symbol entry.
7841         (Incremental_input_entry_reader::get_global_symbol_count): Call
7842         accessor function for type.
7843         (Incremental_input_entry_reader::get_object_count): Likewise.
7844         (Incremental_input_entry_reader::get_object_offset): Likewise.
7845         (Incremental_input_entry_reader::get_member_count): Likewise.
7846         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
7847         (Incremental_input_entry_reader::get_member_offset): Likewise.
7848         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
7849         (Incremental_input_entry_reader::Global_symbol_info): Remove.
7850         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
7851         (Incremental_input_entry_reader::get_global_symbol_reader): New
7852         function.
7853         (Incremental_input_entry_reader::get_output_symbol_index): New
7854         function.
7855         (Incremental_input_entry_reader::type_): Remove.
7856         (Incremental_input_entry_reader::flags_): New data member.
7857         (Incremental_inputs_reader::input_file_offset): New function.
7858         (Incremental_inputs_reader::input_file_index): New function.
7859         (Incremental_inputs_reader::input_file): Call input_file_offset.
7860         (Incremental_inputs_reader::input_file_at_offset): New function.
7861         (Incremental_relocs_reader::get_r_type): Reformat.
7862         (Incremental_relocs_reader::get_r_shndx): Reformat.
7863         (Incremental_relocs_reader::get_r_offset): Reformat.
7864         (Incremental_relocs_reader::data): New function.
7865         (Incremental_binary::Incremental_binary): Initialize new data members.
7866         (Incremental_binary::check_inputs): Add cmdline parameter.
7867         (Incremental_binary::file_is_unchanged): Remove.
7868         (Input_reader::arg_serial): New function.
7869         (Input_reader::get_unused_symbol_count): New function.
7870         (Input_reader::get_unused_symbol): New function.
7871         (Input_reader::do_arg_serial): New function.
7872         (Input_reader::do_get_unused_symbol_count): New function.
7873         (Input_reader::do_get_unused_symbol): New function.
7874         (Incremental_binary::input_file_count): New function.
7875         (Incremental_binary::get_input_reader): Change signature to use
7876         index instead of filename.
7877         (Incremental_binary::file_has_changed): New function.
7878         (Incremental_binary::get_input_argument): New function.
7879         (Incremental_binary::get_library): New function.
7880         (Incremental_binary::get_script_info): New function.
7881         (Incremental_binary::init_layout): New function.
7882         (Incremental_binary::reserve_layout): New function.
7883         (Incremental_binary::output_file): New function.
7884         (Incremental_binary::do_check_inputs): New function.
7885         (Incremental_binary::do_file_is_unchanged): Remove.
7886         (Incremental_binary::do_file_has_changed): New function.
7887         (Incremental_binary::do_init_layout): New function.
7888         (Incremental_binary::do_reserve_layout): New function.
7889         (Incremental_binary::do_input_file_count): New function.
7890         (Incremental_binary::do_get_input_reader): Change signature.
7891         (Incremental_binary::input_args_map_): New data member.
7892         (Incremental_binary::library_map_): New data member.
7893         (Incremental_binary::script_map_): New data member.
7894         (Sized_incremental_binary::Sized_incremental_binary): Initialize
7895         new data members.
7896         (Sized_incremental_binary::output_section): New function.
7897         (Sized_incremental_binary::inputs_reader): Add const.
7898         (Sized_incremental_binary::symtab_reader): Add const.
7899         (Sized_incremental_binary::relocs_reader): Add const.
7900         (Sized_incremental_binary::got_plt_reader): Add const.
7901         (Sized_incremental_binary::get_symtab_view): New function.
7902         (Sized_incremental_binary::Inputs_reader): New typedef.
7903         (Sized_incremental_binary::Input_entry_reader): New typedef.
7904         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
7905         (Sized_incremental_binary::do_file_is_unchanged): Remove.
7906         (Sized_incremental_binary::do_file_has_changed): New function.
7907         (Sized_incremental_binary::do_init_layout): New function.
7908         (Sized_incremental_binary::do_reserve_layout): New function.
7909         (Sized_input_reader::Inputs_reader): Remove.
7910         (Sized_input_reader::Input_entry_reader): Remove.
7911         (Sized_input_reader::do_arg_serial): New function.
7912         (Sized_input_reader::do_get_unused_symbol_count): New function.
7913         (Sized_input_reader::do_get_unused_symbol): New function.
7914         (Sized_incremental_binary::do_input_file_count): New function.
7915         (Sized_incremental_binary::do_get_input_reader): Change signature;
7916         use index instead of filename.
7917         (Sized_incremental_binary::section_map_): New data member.
7918         (Sized_incremental_binary::input_entry_readers_): New data member.
7919         (class Sized_incr_relobj): New class.
7920         (class Sized_incr_dynobj): New class.
7921         (make_sized_incremental_object): New function.
7922         (class Incremental_library): New class.
7923         * layout.cc (Free_list::num_lists): New static data member.
7924         (Free_list::num_nodes): New static data member.
7925         (Free_list::num_removes): New static data member.
7926         (Free_list::num_remove_visits): New static data member.
7927         (Free_list::num_allocates): New static data member.
7928         (Free_list::num_allocate_visits): New static data member.
7929         (Free_list::init): New function.
7930         (Free_list::remove): New function.
7931         (Free_list::allocate): New function.
7932         (Free_list::dump): New function.
7933         (Free_list::print_stats): New function.
7934         (Layout_task_runner::run): Resize output file for incremental updates.
7935         (Layout::Layout): Initialize new data members.
7936         (Layout::set_incremental_base): New function.
7937         (Layout::init_fixed_output_section): New function.
7938         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
7939         incremental updates.
7940         (Layout::create_gold_note): Do not create gold note section for
7941         incremental updates.
7942         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
7943         for incremental updates.
7944         (Layout::set_section_offsets): For incremental updates, allocate space
7945         from free list.
7946         (Layout::create_symtab_sections): Layout with offsets relative to
7947         start of section; for incremental updates, allocate space from free
7948         list.
7949         (Layout::create_shdrs): For incremental updates, allocate space from
7950         free list.
7951         (Layout::finish_dynamic_section): For incremental updates, do not
7952         check --as-needed (fixed in subsequent patch).
7953         * layout.h (class Free_list): New class.
7954         (Layout::set_incremental_base): New function.
7955         (Layout::incremental_base): New function.
7956         (Layout::init_fixed_output_section): New function.
7957         (Layout::allocate): New function.
7958         (Layout::incremental_base_): New data member.
7959         (Layout::free_list_): New data member.
7960         * main.cc (main): Print Free_list statistics.
7961         * object.cc (Relobj::finalize_incremental_relocs): Add
7962         clear_counts parameter; clear counts only when clear_counts is set.
7963         (Sized_relobj::Sized_relobj): Initialize new base class.
7964         (Sized_relobj::do_layout): Don't report special sections.
7965         (Sized_relobj::do_for_all_local_got_entries): New function.
7966         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
7967         symtab_off to all symbol table offsets.
7968         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
7969         * object.h (class Got_offset_list): Move to top of file.
7970         (Object::Object): Allow case where input_file == NULL.
7971         (Object::~Object): Likewise.
7972         (Object::input_file): Assert that input_file != NULL.
7973         (Object::lock): Allow case where input_file == NULL.
7974         (Object::unlock): Likewise.
7975         (Object::is_locked): Likewise.
7976         (Object::token): Likewise.
7977         (Object::release): Likewise.
7978         (Object::is_incremental): New function.
7979         (Object::get_mtime): New function.
7980         (Object::for_all_local_got_entries): New function.
7981         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
7982         (Object::set_is_in_system_directory): New function.
7983         (Object::is_in_system_directory): New function.
7984         (Object::do_is_incremental): New function.
7985         (Object::do_get_mtime): New function.
7986         (Object::do_for_all_local_got_entries): New function.
7987         (Object::is_in_system_directory_): New data member.
7988         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
7989         (class Sized_relobj_base): New class.
7990         (class Sized_relobj): Derive from Sized_relobj_base.
7991         (class Sized_relobj::Symbols): Redeclare from base class.
7992         (class Sized_relobj::local_got_offset_list): Remove.
7993         (class Sized_relobj::Output_sections): Redeclare from base class.
7994         (class Sized_relobj::do_for_all_local_got_entries): New function.
7995         (class Sized_relobj::write_local_symbols): Add offset parameter.
7996         (class Sized_relobj::local_symbol_offset_): Update comment.
7997         (class Sized_relobj::local_dynsym_offset_): Update comment.
7998         * options.cc (Input_arguments::add_file): Remove const.
7999         * options.h (Input_file_argument::Input_file_argument):
8000         Initialize arg_serial_ (all constructors).
8001         (Input_file_argument::set_arg_serial): New function.
8002         (Input_file_argument::arg_serial): New function.
8003         (Input_file_argument::arg_serial_): New data member.
8004         (Input_arguments::Input_arguments): Initialize file_count_.
8005         (Input_arguments::add_file): Remove const.
8006         (Input_arguments::number_of_input_files): New function.
8007         (Input_arguments::file_count_): New data member.
8008         (Command_line::number_of_input_files): Call
8009         Input_arguments::number_of_input_files.
8010         * output.cc (Output_segment_headers::Output_segment_headers):
8011         Set current size.
8012         (Output_section::Input_section::current_data_size): New function.
8013         (Output_section::Output_section): Initialize new data members.
8014         (Output_section::add_input_section): Don't do merge sections for
8015         an incremental link; allocate space from free list for an
8016         incremental update.
8017         (Output_section::add_output_section_data): Allocate space from
8018         free list for an incremental update.
8019         (Output_section::update_data_size): New function.
8020         (Output_section::set_fixed_layout): New function.
8021         (Output_section::reserve): New function.
8022         (Output_segment::set_section_addresses): Remove const.
8023         (Output_segment::set_section_list_addresses): Remove const; allocate
8024         space from free list for an incremental update.
8025         (Output_segment::set_offset): Adjust size of RELRO segment for an
8026         incremental update.
8027         * output.h (Output_data::current_data_size): Move here from
8028         child classes.
8029         (Output_data::pre_finalize_data_size): New function.
8030         (Output_data::update_data_size): New function.
8031         (Output_section_headers::update_data_size): new function.
8032         (Output_section_data_build::current_data_size): Move to Output_data.
8033         (Output_data_strtab::update_data_size): New function.
8034         (Output_section::current_data_size): Move to Output_data.
8035         (Output_section::set_fixed_layout): New function.
8036         (Output_section::has_fixed_layout): New function.
8037         (Output_section::reserve): New function.
8038         (Output_section::update_data_size): New function.
8039         (Output_section::has_fixed_layout_): New data member.
8040         (Output_section::free_list_): New data member.
8041         (Output_segment::set_section_addresses): Remove const.
8042         (Output_segment::set_section_list_addresses): Remove const.
8043         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
8044         New function.
8045         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
8046         New function.
8047         * readsyms.cc (Read_symbols::do_read_symbols): Add library
8048         parameter when calling Add_symbols constructor; store argument
8049         serial number for members of a lib group.
8050         (Add_symbols::locks): Allow case where token == NULL.
8051         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
8052         (Read_member::~Read_member): New function.
8053         (Read_member::is_runnable): New function.
8054         (Read_member::locks): New function.
8055         (Read_member::run): New function.
8056         (Check_script::~Check_script): New function.
8057         (Check_script::is_runnable): New function.
8058         (Check_script::locks): New function.
8059         (Check_script::run): New function.
8060         (Check_library::~Check_library): New function.
8061         (Check_library::is_runnable): New function.
8062         (Check_library::locks): New function.
8063         (Check_library::run): New function.
8064         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
8065         (Add_symbols::library_): New data member.
8066         (class Read_member): New class.
8067         (class Check_script): New class.
8068         (class Check_library): New class.
8069         * reloc.cc (Read_relocs::is_runnable): Allow case where
8070         token == NULL.
8071         (Read_relocs::locks): Likewise.
8072         (Scan_relocs::locks): Likewise.
8073         (Relocate_task::locks): Likewise.
8074         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
8075         to clear counters.
8076         (Sized_relobj::incremental_relocs_scan): Fix comment.
8077         (Sized_relobj::do_relocate): Pass output file offset to
8078         write_local_symbols.
8079         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
8080         from class declaration.
8081         * script.cc (read_input_script): Allocate Script_info; pass
8082         argument serial number to report_script.
8083         * script.h (class Script_info): Move to incremental.h.
8084         * symtab.cc (Symbol_table::add_from_incrobj): New function.
8085         * symtab.h (Symbol_table::add_from_incrobj): New function.
8086         (Symbol_table::set_file_offset): New function.
8087
8088 2011-04-05  Cary Coutant  <ccoutant@google.com>
8089
8090         * incremental-dump.cc (dump_incremental_inputs): Change signature
8091         to take a Sized_incremental_binary; change caller.  Use readers
8092         in Sized_incremental_binary.
8093         * incremental.cc
8094         (Sized_incremental_binary::find_incremental_inputs_sections):
8095         Rename do_find_incremental_inputs_sections to this.
8096         (Sized_incremental_binary::setup_readers): New function.
8097         (Sized_incremental_binary::do_check_inputs): Check
8098         has_incremental_info_ flag; move setup code to setup_readers;
8099         use input readers.
8100         (Sized_incremental_binary::do_file_is_unchanged): New function.
8101         (Sized_incremental_binary::do_get_input_reader): New function.
8102         * incremental.h (class Incremental_binary): Move to end of file.
8103         (Incremental_binary::file_is_unchanged): New function.
8104         (Incremental_binary::do_file_is_unchanged): New function.
8105         (Incremental_binary::Input_reader): New class.
8106         (Incremental_binary::get_input_reader): New function.
8107         (class Sized_incremental_binary): Move to end of file.
8108         (Sized_incremental_binary::Sized_incremental_binary): Setup the
8109         input section reader classes.
8110         (Sized_incremental_binary::has_incremental_info): New function.
8111         (Sized_incremental_binary::inputs_reader): New function.
8112         (Sized_incremental_binary::symtab_reader): New function.
8113         (Sized_incremental_binary::relocs_reader): New function.
8114         (Sized_incremental_binary::got_plt_reader): New function.
8115         (Sized_incremental_binary::do_file_is_unchanged): New function.
8116         (Sized_incremental_binary::Sized_input_reader): New class.
8117         (Sized_incremental_binary::get_input_reader): New function.
8118         (Sized_incremental_binary::find_incremental_inputs_sections):
8119         Rename do_find_incremental_inputs_sections to this.
8120         (Sized_incremental_binary::setup_readers): New function.
8121         (Sized_incremental_binary::has_incremental_info_): New data member.
8122         (Sized_incremental_binary::inputs_reader_): New data member.
8123         (Sized_incremental_binary::symtab_reader_): New data member.
8124         (Sized_incremental_binary::relocs_reader_): New data member.
8125         (Sized_incremental_binary::got_plt_reader_): New data member.
8126         (Sized_incremental_binary::current_input_file_): New data member.
8127
8128 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
8129
8130         PR gold/12640
8131         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
8132         violation.
8133
8134 2011-03-30  Cary Coutant  <ccoutant@google.com>
8135
8136         * archive.cc (Archive::include_member): Adjust call to report_object.
8137         (Add_archive_symbols::run): Add script_info to call to
8138         report_archive_begin.
8139         (Lib_group::include_member): Adjust call to report_object.
8140         (Add_lib_group_symbols::run): Adjust call to report_object.
8141         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
8142         blocks.  Add object count for script input files.
8143         * incremental.cc (Incremental_inputs::report_archive_begin): Add
8144         script_info parameter; change all callers.
8145         (Incremental_inputs::report_object): Add script_info parameter;
8146         change all callers.
8147         (Incremental_inputs::report_script): Store backpointer to
8148         incremental info entry.
8149         (Output_section_incremental_inputs::set_final_data_size): Record
8150         additional information for scripts.
8151         (Output_section_incremental_inputs::write_info_blocks): Likewise.
8152         * incremental.h (Incremental_script_entry::add_object): New function.
8153         (Incremental_script_entry::get_object_count): New function.
8154         (Incremental_script_entry::get_object): New function.
8155         (Incremental_script_entry::objects_): New data member; adjust
8156         constructor.
8157         (Incremental_inputs::report_archive_begin): Add script_info parameter.
8158         (Incremental_inputs::report_object): Add script_info parameter.
8159         (Incremental_inputs_reader::get_object_count): New function.
8160         (Incremental_inputs_reader::get_object_offset): New function.
8161         * options.cc (Input_arguments::add_file): Return reference to
8162         new input argument.
8163         * options.h (Input_argument::set_script_info): New function.
8164         (Input_argument::script_info): New function.
8165         (Input_argument::script_info_): New data member; adjust all
8166         constructors.
8167         (Input_file_group::add_file): Return reference to new input argument.
8168         (Input_file_lib::add_file): Likewise.
8169         (Input_arguments::add_file): Likewise.
8170         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
8171         * script.cc (Parser_closure::Parser_closure): Add script_info
8172         parameter; adjust all callers.
8173         (Parser_closure::script_info): New function.
8174         (Parser_closure::script_info_): New data member.
8175         (read_input_script): Report scripts earlier to incremental info.
8176         (script_add_file): Set script_info in Input_argument.
8177         (script_add_library): Likewise.
8178         * script.h (Script_options::Script_info): Rewrite class.
8179
8180 2011-03-29  Cary Coutant  <ccoutant@google.com>
8181
8182         * archive.cc (Library_base::should_include_member): Move
8183         method here from class Archive.
8184         (Archive::Archive): Initialize base class.
8185         (Archive::should_include_member): Move to base class.
8186         (Archive::do_for_all_unused_symbols): New function.
8187         (Add_archive_symbols::run): Remove redundant access to
8188         incremental_inputs.
8189         (Lib_group::Lib_group): Initialize base class.
8190         (Lib_group::do_filename): New function.
8191         (Lib_group::include_member): Pass pointer to Lib_group to
8192         report_object.
8193         (Lib_group::do_for_all_unused_symbols): New function.
8194         (Add_lib_group_symbols::run): Report archive information for
8195         incremental links.
8196         * archive.h (class Library_base): New base class.
8197         (class Archive): Derive from Library_base.
8198         (Archive::filename): Move to base class.
8199         (Archive::set_incremental_info): Likewise.
8200         (Archive::incremental_info): Likewise.
8201         (Archive::Should_include): Likewise.
8202         (Archive::should_include_member): Likewise.
8203         (Archive::Armap_entry): Remove.
8204         (Archive::Unused_symbol_iterator): Remove.
8205         (Archive::unused_symbols_begin): Remove.
8206         (Archive::unused_symbols_end): Remove.
8207         (Archive::do_filename): New function.
8208         (Archive::do_get_mtime): New function.
8209         (Archive::do_for_all_unused_symbols): New function.
8210         (Archive::task_): Move to base class.
8211         (Archive::incremental_info_): Likewise.
8212         (class Lib_group): Derive from Library_base.
8213         (Lib_group::do_filename): New function.
8214         (Lib_group::do_get_mtime): New function.
8215         (Lib_group::do_for_all_unused_symbols): New function.
8216         (Lib_group::task_): Move to base class.
8217         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
8218         function.
8219         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
8220         function.
8221         * incremental.cc (Incremental_inputs::report_archive_begin):
8222         Use Library_base; call library's get_mtime; add incremental inputs
8223         entry before members.
8224         (class Unused_symbol_visitor): New class.
8225         (Incremental_inputs::report_archive_end): Use Library_base; use
8226         visitor class to record unused symbols; don't add incremental inputs
8227         entry after members.
8228         (Incremental_inputs::report_object): Use Library_base.
8229         * incremental.h
8230         (Incremental_archive_entry::Incremental_archive_entry): Remove
8231         unused Archive parameter.
8232         (Incremental_inputs::report_archive_begin): Use Library_base.
8233         (Incremental_inputs::report_archive_end): Likewise.
8234         (Incremental_inputs::report_object): Likewise.
8235         * object.cc (Sized_relobj::do_for_all_global_symbols): New
8236         function.
8237         * object.h (Object::for_all_global_symbols): New function.
8238         (Object::do_for_all_global_symbols): New function.
8239         (Sized_relobj::do_for_all_global_symbols): New function.
8240         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
8241         function.
8242         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
8243         function.
8244
8245 2011-03-27  Ian Lance Taylor  <iant@google.com>
8246
8247         * archive.cc (Archive::interpret_header): Return -1 if something
8248         goes wrong.  Change callers accordingly.
8249
8250 2011-03-25  Cary Coutant  <ccoutant@google.com>
8251
8252         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
8253         * testsuite/Makefile.in: Regenerate.
8254
8255 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
8256
8257         * plugin.cc (get_view): New.
8258         (Plugin::load): Pass get_view to the plugin.
8259         (Plugin_manager::get_view): New.
8260
8261 2011-03-21  Ian Lance Taylor  <iant@google.com>
8262
8263         * testsuite/final_layout.sh: Rewrite to not use dc.
8264         * testsuite/relro_test.sh: Fail if dc is not present.
8265
8266 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
8267
8268         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
8269         Change == to -eq.
8270         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
8271         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
8272         Change == to -eq.
8273         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
8274         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
8275
8276 2011-03-14  Ian Lance Taylor  <iant@google.com>
8277
8278         * script-sections.cc (Sort_output_sections::script_compare):
8279         Rename from is_before, change return type.
8280         (Sort_output_sections::operator()): Adjust accordingly.
8281
8282 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
8283
8284         PR gold/12572
8285         * testsuite/odr_violation2.cc: Add comment to make all error line
8286         numbers double digits.
8287         * testsuite/debug_msg.sh: Adjust expected errors.
8288
8289 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
8290
8291         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
8292         but mark earlier ones as non-canonical
8293         (offset_to_iterator): Update search target and example
8294         (do_addr2line): Return extra lines in a vector*
8295         (format_file_lineno): Extract from do_addr2line
8296         (one_addr2line): Add vector* out-param
8297         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
8298         when a lineno entry appeared last for its instruction
8299         (Dwarf_line_info): Add vector* out-param
8300         * object.cc (Relocate_info): Pass NULL for the vector* out-param
8301         * symtab.cc (Odr_violation_compare): Include the lineno in the
8302         comparison again.
8303         (linenos_from_loc): New. Combine the canonical line for an
8304         address with its other lines.
8305         (True_if_intersect): New. Helper functor to make
8306         std::set_intersection a query.
8307         (detect_odr_violations): Compare sets of lines instead of just
8308         one line for each function. This became less deterministic, but
8309         has fewer false positives.
8310         * symtab.h: Declarations.
8311         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
8312         mix an optimized and non-optimized object in the same binary
8313         (odr_violation2.so): Same.
8314         * testsuite/Makefile.in: Regenerate from Makefile.am.
8315         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
8316         * testsuite/debug_msg.sh: Update line numbers and add
8317         assertions.
8318         * testsuite/odr_violation1.cc: Use OdrDerived, in a
8319         non-optimized context.
8320         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
8321         isn't inlined, and use OdrDerived in an optimized context.
8322         * testsuite/odr_header1.h: Defines OdrDerived, where
8323         optimization will change the
8324         first-instruction-in-the-destructor's file and line number.
8325         * testsuite/odr_header2.h: Defines OdrBase.
8326
8327 2011-03-09  Ian Lance Taylor  <iant@google.com>
8328
8329         * fileread.cc (File_read::clear_views): Don't delete the whole
8330         file view.
8331
8332 2011-03-08  Ian Lance Taylor  <iant@google.com>
8333
8334         PR gold/12525
8335         * fileread.cc: #include <climits>.
8336         (GOLD_IOV_MAX): Define.
8337         (File_read::read_multiple): Limit number of entries by iov_max.
8338         * fileread.h (class File_read): Always set max_readv_entries to
8339         128.
8340
8341 2011-03-07  Ian Lance Taylor  <iant@google.com>
8342
8343         PR gold/12525
8344         * options.h (class General_options): Add -dy and -dn.
8345
8346 2011-03-02  Cary Coutant  <ccoutant@google.com>
8347
8348         * testsuite/script_test_9.t: Add TLS segment.
8349
8350 2011-03-02  Simon Baldwin  <simonb@google.com>
8351
8352         * configure.ac: Add check for gnu_indirect_function support in
8353         the toolchain building binutils.
8354         * configure: Rebuild.
8355
8356 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
8357
8358         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
8359         plugin only symbols.
8360         (Symbol_table::sized_finalize_symbol) Mark symbol only present
8361         in plugin files as not needed in the symbol table.
8362
8363 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
8364
8365         * output.cc (Output_section::add_input_section): Delay fill
8366         generation for section ordering.
8367
8368 2011-02-09  Ian Lance Taylor  <iant@google.com>
8369
8370         PR gold/12316
8371         * object.h (class Sized_relobj): Remove clear_local_symbols.
8372         * reloc.cc (Sized_relobj::do_relocate): Don't call
8373         clear_local_symbols.
8374
8375 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
8376
8377         * plugin.cc (is_visible_from_outside): Return true for symbols
8378         in the -u option.
8379
8380 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
8381
8382         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
8383         filename.
8384
8385 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
8386
8387         * icf.h (is_section_foldable_candidate): Change type of parameter
8388         to std::string.
8389         * icf.cc (Icf::find_identical_sections): Change type of local variable
8390         section_name to be std::string.
8391         (is_function_ctor_or_dtor): Change type of parameter to std::string.
8392
8393 2011-01-25  Ian Lance Taylor  <iant@google.com>
8394
8395         * script.cc (script_add_extern): Rewrite to use
8396         add_symbol_reference.
8397
8398 2011-01-25  Doug Kwan  <dougkwan@google.com>
8399
8400         * icf.cc (get_section_contents): Always lock section's object.
8401
8402 2011-01-24  Ian Lance Taylor  <iant@google.com>
8403
8404         * options.h (class General_options): Accept
8405         --no-detect-odr-violations.
8406
8407 2011-01-24  Ian Lance Taylor  <iant@google.com>
8408
8409         * version.cc (version_string): Bump to 1.11.
8410
8411 2011-01-24  Ian Lance Taylor  <iant@google.com>
8412
8413         * plugin.cc (class Plugin_rescan): Define new class.
8414         (Plugin_manager::claim_file): Set any_claimed_.
8415         (Plugin_manager::save_archive): New function.
8416         (Plugin_manager::save_input_group): New function.
8417         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
8418         necessary.
8419         (Plugin_manager::new_undefined_symbol): New function.
8420         (Plugin_manager::rescan): New function.
8421         (Plugin_manager::rescannable_defines): New function.
8422         (Plugin_manager::add_input_file): Set any_added_.
8423         * plugin.h (class Plugin_manager): define new fields rescannable_,
8424         undefined_symbols_, any_claimed_, and any_added_.  Declare
8425         Plugin_rescan as friend.  Declare new functions.
8426         (Plugin_manager::Rescannable): Define type.
8427         (Plugin_manager::Rescannable_list): Define type.
8428         (Plugin_manager::Undefined_symbol_list): Define type.
8429         (Plugin_manager::Plugin_manager): Initialize new fields.
8430         * archive.cc (Archive::defines_symbol): New function.
8431         (Add_archive_symbols::run): Pass archive to plugins if any.
8432         * archive.h (class Archive): Declare defines_symbol.
8433         * readsyms.cc (Input_group::~Input_group): New function.
8434         (Finish_group::run): Pass input_group to plugins if any.
8435         * readsyms.h (class Input_group): Declare destructor.
8436         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
8437         any.
8438
8439 2011-01-10  Ian Lance Taylor  <iant@google.com>
8440
8441         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
8442         section as relro.
8443         (Layout::set_segment_offsets): Reset increase_relro before calling
8444         set_section_addresses a second time.
8445
8446 2011-01-04  Cary Coutant  <ccoutant@google.com>
8447
8448         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
8449         sections before NOBITS sections.
8450
8451 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
8452
8453         * version.cc (print_version): Update copyright to 2011.
8454
8455 2010-12-23  Cary Coutant  <ccoutant@google.com>
8456
8457         * output.h (Output_data_reloc::add_output_section): Pass OD instead
8458         of OS to this->add.  Add OD parameter to second form of the function.
8459
8460 2010-12-20  Ian Lance Taylor  <iant@google.com>
8461
8462         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
8463         second of two consecutive entries with same offset.
8464
8465 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8466
8467         * testsuite/Makefile.am (ifuncmain2static_LDADD)
8468         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
8469         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
8470         to avoid unneeded links against $(LDADD).
8471         * testsuite/Makefile.in: Regenerate.
8472
8473 2010-12-15  Ian Lance Taylor  <iant@google.com>
8474
8475         PR gold/12324
8476         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
8477         for R_X86_64_32 and R_X86_64_PC32.
8478         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
8479         ver_matching_def_pic.o.
8480         (ver_matching_def_pic.o): New target.
8481
8482 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8483
8484         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
8485         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
8486         Move definition before File_read::View member definitions.
8487         (File_read::View::~View): Initialize and hold lock before
8488         updating current_mapped_bytes.
8489
8490 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8491
8492         * dwarf_reader.cc: Remove outdated comment.
8493         * gold-threads.cc: Fix typo in error message.
8494         * archive.cc: Fix typos in comments.
8495         * archive.h: Likewise.
8496         * arm-reloc-property.cc: Likewise.
8497         * arm-reloc-property.h: Likewise.
8498         * arm-reloc.def: Likewise.
8499         * arm.cc: Likewise.
8500         * attributes.h: Likewise.
8501         * cref.cc: Likewise.
8502         * ehframe.cc: Likewise.
8503         * fileread.h: Likewise.
8504         * gold.h: Likewise.
8505         * i386.cc: Likewise.
8506         * icf.cc: Likewise.
8507         * incremental.h: Likewise.
8508         * int_encoding.cc: Likewise.
8509         * layout.h: Likewise.
8510         * main.cc: Likewise.
8511         * merge.h: Likewise.
8512         * object.cc: Likewise.
8513         * object.h: Likewise.
8514         * options.cc: Likewise.
8515         * readsyms.cc: Likewise.
8516         * reduced_debug_output.cc: Likewise.
8517         * reloc.cc: Likewise.
8518         * script-sections.cc: Likewise.
8519         * sparc.cc: Likewise.
8520         * symtab.h: Likewise.
8521         * target-reloc.h: Likewise.
8522         * target.cc: Likewise.
8523         * target.h: Likewise.
8524         * timer.cc: Likewise.
8525         * timer.h: Likewise.
8526         * x86_64.cc: Likewise.
8527
8528 2010-12-09  Cary Coutant  <ccoutant@google.com>
8529
8530         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
8531         stack.
8532         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
8533         parameter; change all callers.
8534         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
8535         * options.h (warn_execstack): New option.
8536
8537 2010-12-07  Doug Kwan  <dougkwan@google.com>
8538
8539         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
8540         like function call relocations.
8541
8542 2010-12-07  Ian Lance Taylor  <iant@google.com>
8543
8544         * archive.cc (Archive::get_elf_object_for_member): Permit
8545         punconfigured to be NULL.
8546         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
8547         (Archive::include_member): Pass NULL to get_elf_object_for_member
8548         if we searched for the archive and this is the first included
8549         object.
8550
8551 2010-12-01  Ian Lance Taylor  <iant@google.com>
8552
8553         * dwarf_reader.h (class Sized_dwarf_line_info): Add
8554         track_relocs_type_ field.
8555         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8556         Set track_relocs_type_.
8557         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
8558         contents when using RELA relocs.
8559         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
8560         reloc_map_.
8561         * reloc.cc (Track_relocs::next_addend): New function.
8562         * reloc.h (class Track_relocs): Declare next_addend.
8563
8564 2010-12-01  Ian Lance Taylor  <iant@google.com>
8565
8566         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
8567         virtual destructor.
8568
8569 2010-12-01  Ian Lance Taylor  <iant@google.com>
8570
8571         * README: Update compilers known to work and fail.
8572
8573 2010-11-23  Matthias Klose  <doko@ubuntu.com>
8574
8575         * configure.in: For --enable-gold, handle value `default' instead of
8576         `both*'.  Always install ld as ld.bfd, install as ld if gold is
8577         not the default.
8578         * configure: Regenerate.
8579
8580 2010-11-18  Doug Kwan  <dougkwan@google.com>
8581
8582         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
8583         and right_alignment to be zero.  Store result alignment only if it is
8584         greater than existing alignment.
8585
8586 2010-11-16  Cary Coutant  <ccoutant@google.com>
8587
8588         PR gold/12220
8589         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8590         Check for ".zdebug_line".
8591
8592 2010-11-16  Doug Kwan  <dougkwan@google.com>
8593             Cary Coutant  <ccoutant@google.com>
8594
8595         * output.h (Output_segment::set_section_addresses): Pass increase_relro
8596         by reference; adjust all callers.
8597         * output.cc (Output_segment::set_section_addresses): Adjust references
8598         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
8599         list is empty.
8600         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
8601         end at page boundary.
8602
8603 2010-11-16  Cary Coutant  <ccoutant@google.com>
8604
8605         PR gold/12220
8606         * layout.cc (Layout::choose_output_section): Transform names of
8607         compressed sections even when using a script with a SECTIONS clause.
8608         (Layout::output_section_name): Remove code to transform
8609         compressed debug section names.
8610         * output.cc (Output_section::add_input_section): Use uncompressed
8611         section size when tracking input sections.
8612
8613 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
8614
8615         * symtab.h (Symbol::NON_PIC_REF): Remove.
8616         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
8617         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
8618         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
8619         (Symbol::use_plt_offset): Take a flags argument and pass it
8620         directly to needs_dynamic_reloc.  Restrict check for undefined
8621         weak symbols to function calls.
8622         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
8623         (Target_arm::Scan::global): Use it.
8624         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
8625         (Target_arm::Relocate::relocate): Likewise.
8626         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
8627         parameter with an r_type parameter.  Use get_reference_flags
8628         to get the flags.
8629         (Target_arm::Relocate::relocate): Update accordingly.
8630         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
8631         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
8632         (Target_i386::Scan::global): Likewise.
8633         (Target_i386::Relocate::relocate): Likewise.
8634         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
8635         parameter with an r_type parameter.  Use get_reference_flags
8636         to get the flags.
8637         (Target_i386::Relocate::relocate): Update accordingly.
8638         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
8639         (Target_powerpc::Scan::global): Use it.
8640         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
8641         (Target_powerpc::Relocate::relocate): Likewise.
8642         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
8643         (Target_sparc::Scan::global): Use it.
8644         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
8645         (Target_sparc::Relocate::relocate): Likewise.
8646         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
8647         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
8648         (Target_x86_64::Scan::global): Likewise.
8649         (Target_x86_64::Relocate::relocate): Likewise.
8650
8651 2010-11-08  Doug Kwan  <dougkwan@google.com>
8652             Cary Coutant  <ccoutant@google.com>
8653
8654         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
8655         (Arm_exidx_merge_section::section_contents_): New data member.
8656         (Arm_input_section::Arm_input_section): Initialize original_contents_.
8657         (Arm_input_section::~Arm_input_section): De-allocate memory.
8658         (Arm_input_section::original_contents_): New data member.
8659         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
8660         in parameters instead of calling Object::section_contents without
8661         locking.
8662         (Arm_output_section::group_section): New parameter TASK.  Pass it
8663         to callees that need locking objects.
8664         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
8665         to lock EXIDX input sections.  Fix a formatting issue.  Call
8666         Arm_exidx_merged_section::build_contents to create merged section
8667         contents.
8668         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
8669         to lock object of stub table owner.
8670         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
8671         TEXT_SIZE to initialize data member TEXT_SIZE_.
8672         (Arm_exidx_input_section::addralign): Fix typo in comment.
8673         (Arm_exidx_input_section::text_size): New method.
8674         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
8675         that require locking objects.  Lock objects before scanning for stubs
8676         and updating local symbols.
8677         (Arm_input_section<big_endian>::init): Copy contents of original
8678         input section.
8679         (Arm_input_section<big_endian>::do_write): Use saved contents of
8680         original input section instead of calling Object::section_contents
8681         without locking.
8682         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
8683         size without calling Object::section_size().
8684         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
8685         for size.  Allocate a buffer for merged EXIDX entries.
8686         (Arm_exidx_merged_section::build_contents): New method.
8687         (Arm_exidx_merged_section::do_write): Move merge section contents
8688         building code to Arm_exidx_merged_section::build_contetns.  Write
8689         out contetns in buffer instead of building it on the fly.
8690         (Arm_relobj::make_exidx_input_section): Also pass text section size
8691         to Arm_exidx_input_section constructor.
8692         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
8693         (Arm_dynobj::do_read_symbols): Fix memory leak.
8694         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
8695         * target.h: (class Task): Add forward declaration.
8696         (Target::relax): Add new parameter TASK and pass it to
8697         Target::do_relax().
8698         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
8699
8700 2010-11-05  Cary Coutant  <ccoutant@google.com>
8701
8702         PR gold/10708
8703         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
8704         object when reading from the file.
8705         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
8706         second layout pass.
8707         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
8708         when reading section contents.
8709         (get_section_contents): Likewise.
8710         (icf::find_identical_sections): Likewise.
8711         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
8712         object when reading from the file.
8713         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
8714         the object when doing deferred section layout.
8715
8716 2010-11-03  Nick Clifton  <nickc@redhat.com>
8717
8718         PR gold/12001
8719         * script.h (class Symbol_assignment: name): New member.  Returns
8720         the name of the symbol.
8721         * scrfipt.cc (Script_options::is_pending_assignment): New member.
8722         Returns true if the given symbol name is on the list of
8723         assignments wating to be processed.
8724         * archive.cc (should_incldue_member): If the symbol is undefined,
8725         check to see if it is on the list of symbols pending assignment.
8726
8727 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
8728
8729         * script-sections.cc (Script_sections::find_memory_region): Check
8730         for a NULL output section pointer.
8731
8732 2010-10-29  Doug Kwan  <dougkwan@google.com>
8733
8734         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
8735         Output_section::add_relaxed_input_section.
8736         * output.cc (Output_section::add_relaxed_input_section): Add new
8737         arguments LAYOUT and NAME.  Set section order index.
8738         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8739         Copy section order index.
8740         * output.h (Output_section::add_relaxed_input_section): Add new
8741         arguments LAYOUT and NAME.
8742
8743 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8744
8745         * testsuite/Makefile.am: Move gcctestdir/ld rule to
8746         NATIVE_OR_CROSS_LINKER.
8747         * testsuite/Makefile.in: Regenerate.
8748
8749 2010-10-20  Doug Kwan  <dougkwan@google.com>
8750
8751         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
8752         without SHF_LINK_ORDER flags.
8753         * layout.cc (Layout::choose_output_section): Do not filter
8754         SHF_LINK_ORDER flag in a relocatable link.
8755
8756 2010-10-17  Cary Coutant  <ccoutant@google.com>
8757
8758         * output.h (Output_segment::set_section_addresses): Change function
8759         signature.  Update all callers.
8760         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
8761         sections.
8762         (Output_segment::set_section_addresses): Align after last TLS
8763         section.  Add padding before last relro section instead of after.
8764
8765 2010-10-17  Doug Kwan  <dougkwan@google.com>
8766
8767         * gold/arm.cc (Target_arm::got_section): Use correct order and set
8768         GOT output section to be writable.
8769
8770 2010-10-14  Cary Coutant  <ccoutant@google.com>
8771
8772         * debug.h (DEBUG_INCREMENTAL): New flag.
8773         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
8774         * gold.cc (queue_initial_tasks): Check parameters for incremental link
8775         mode.
8776         * incremental.cc (report_command_line): Ignore all forms of
8777         --incremental.
8778         * layout.cc (Layout::Layout): Check parameters for incremental link
8779         mode.
8780         * options.cc (General_options::parse_incremental): New function.
8781         (General_options::parse_no_incremental): New function.
8782         (General_options::parse_incremental_full): New function.
8783         (General_options::parse_incremental_update): New function.
8784         (General_options::incremental_mode_): New data member.
8785         (General_options::finalize): Check incremental_mode_.
8786         * options.h (General_options): Update help text for --incremental.
8787         Add --no-incremental, --incremental-full, --incremental-update.
8788         (General_options::Incremental_mode): New enum type.
8789         (General_options::incremental_mode): New function.
8790         (General_options::incremental_mode_): New data member.
8791         * parameters.cc (Parameters::incremental_mode_): New data member.
8792         (Parameters::set_options): Set incremental_mode_.
8793         (Parameters::set_incremental_full): New function.
8794         (Parameters::incremental): New function.
8795         (Parameters::incremental_update): New function.
8796         (set_parameters_incremental_full): New function.
8797         * parameters.h (Parameters::set_incremental_full): New function.
8798         (Parameters::incremental): New function.
8799         (Parameters::incremental_update): New function.
8800         (Parameters::incremental_mode_): New data member.
8801         (set_parameters_incremental_full): New function.
8802         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
8803         incremental link mode.
8804         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
8805         (Sized_relobj::do_relocate_sections): Likewise.
8806         * testsuite/Makefile.am (incremental_test): Use --incremental-full
8807         option.
8808         * testsuite/Makefile.in: Regenerate.
8809         * testsuite/incremental_test.sh: Filter all forms of --incremental.
8810
8811 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8812
8813         * script-sections.h (class Script_sections): Make
8814         Sections_elements typedef public.
8815         * script-sections.cc (class Sort_output_sections): Add elements_
8816         field.  Add constructor which sets it; change all callers.
8817         (Sort_output_sections::is_before): New function.
8818         (Sort_output_sections::operator()): Call is_before.
8819         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
8820         conditional.
8821         * testsuite/script_test_10.sh: New test. Test script section
8822         order.
8823         * testsuite/script_test_10.t: Likewise.
8824         * testsuite/script_test_10.s: Likewise.
8825         * testsuite/Makefile.am: Wrap the cross linker tests and the
8826         common tests into NATIVE_OR_CROSS_LINKER.
8827         (check_SCRIPTS): Add script_test_10.sh.
8828         (check_DATA): Add script_test_10.stdout.
8829         (script_test_10.o, script_test_10): New targets.
8830         (script_test_10.stdout): New target.
8831         * configure, testsuite/Makefile.in: Regenerate.
8832
8833 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8834
8835         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
8836         error for the deprecated relocations.
8837         (Target_arm::Scan::global): Likewise.
8838         (Target_arm::Relocate::relocate): Likewise.
8839
8840 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
8841
8842         * fileread.cc (Input_file::find_file): Initialize *found_name
8843         and *namep when using the fallback search for case 4.
8844
8845 2010-10-11  Cary Coutant  <ccoutant@google.com>
8846
8847         * options.h (class General_options): Redefine -z lazy as an alias for
8848         the negation of -z now.
8849
8850 2010-10-11  Ian Lance Taylor  <iant@google.com>
8851
8852         * resolve.cc (symbol_to_bits): Report the value of the unsupported
8853         binding.
8854
8855 2010-10-06  Nick Clifton  <nickc@redhat.com>
8856
8857         * script-sections.cc(class Memory_region): Remove
8858         current_lma_offset_ field.  Rename current_vma_offset_ to
8859         current_offset_.  Add last_section_ field.
8860         (Memory_region::get_current_vma_address): Rename to
8861         get_current_address.
8862         (Memory_region::get_current_lma_address): Delete.
8863         (Memory_region::increment_vma_offset): Rename to
8864         increment_offset.
8865         (Memory_region::increment_lma_offset): Delete.
8866         (Memory_region::attributes_compatible): New method.  Returns
8867         true if the provided section is compatible with the region.
8868         (Memory_region::get_last_section): New method.  Returns the last
8869         section to use the region.
8870         (Memory_region::set_last_section): New method.  Stores the last
8871         section to use the region.
8872         (Script_sections::block_in_region): New method.  Returns true if
8873         a block of memory is contained within a region.
8874         (Script_sections::find_memory_region): New method.  Locates a
8875         memory region to be used to set a VMA or LMA address.
8876         (Output_section_definition::set_section_addresses): Add code to
8877         check for addresses set by memory regions.
8878         (Output_segment::set_section_addresses): Remove memory region
8879         walking code.
8880         (Script_sections::create_segment): Add a warning if a header
8881         segment is created outside of any region.
8882         * script-sections.h (class Script_sections): Add prototypes for
8883         find_memory_region and block_in_region methods.
8884         * testsuite/memory_test.s: Use .long instead of .word.
8885         * testsuite/memory_test.t: Add some more output sections.
8886         * testsuite/memory_test.sh: Update expected output.
8887
8888 2010-10-02  Doug Kwan  <dougkwan@google.com>
8889
8890         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
8891         defintion to symtab.h
8892         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
8893         declaration to defintion.
8894
8895 2010-10-01  Nick Clifton  <nickc@redhat.com>
8896
8897         * expression.cc (eval): Replace dummy argument with NULL.
8898         (eval_maybe_dot): Check for a NULL result section pointer.
8899         (Symbol_expression::value): Likewise.
8900         (Dot_expression::value): Likewise.
8901         (BINARY_EXPRESSION): Likewise.
8902         (Max_expression::value): Likewise.
8903         (Min_expression::value): Likewise.
8904         (Absolute_expression::value): Likewise.
8905         (Addr_expression::value_from_output_section): Likewise.
8906         (Loaddddr_expression::value_from_output_section): Likewise.
8907         (Segment_start_expression::value): Likewise.
8908         * script-sections.cc
8909         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
8910         argument with NULL.
8911         (Sections_elememt_dot_assignment::set_section_addresses):
8912         Likewise.
8913         (Output_data_expression::do_write_to_buffer): Likewise.
8914         (Output_section_definition::finalize_symbols): Likewise.
8915         (Output_section_definition::set_section_addresses): Likewise.
8916
8917 2010-09-30  Doug Kwan  <dougkwan@google.com>
8918
8919         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
8920
8921 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
8922
8923         * target.h (Target::can_icf_inline_merge_sections): New virtual
8924         function.
8925         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
8926         virtual function.
8927         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
8928         virtual function.
8929         * icf.cc (get_section_contents): Inline merge sections only when
8930         target allows it.
8931
8932 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8933
8934         * configure: Regenerate.
8935
8936 2010-09-17  Ian Lance Taylor  <iant@google.com>
8937
8938         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
8939         * testsuite/Makefile.am (memory_test.o): New target.
8940         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
8941         memory_test.t.
8942         * testsuite/Makefile.in: Rebuild.
8943
8944 2010-09-17  Doug Kwan  <dougkwan@google.com>
8945
8946         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
8947         defintion if relocation uses GOT entries of the symbol.
8948         * testsuite/icf_safe_test.sh: Fix test.
8949         * testsuite/icf_safe_so_test.sh: Fix test.
8950
8951 2010-09-16  Cary Coutant  <ccoutant@google.com>
8952
8953         * script_sections.cc (class Memory_region): Remove "NULL" from
8954         vector initializations.
8955
8956 2010-09-15  Cary Coutant  <ccoutant@google.com>
8957
8958         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
8959         Resolve forwarding symbols.
8960
8961 2010-09-15  Doug Kwan  <dougkwan@google.com>
8962
8963         * gold/testsuite/script_test_3.t: Add ARM special sections.
8964         * gold/testsuite/script_test_4.t: Same.
8965         * gold/testsuite/script_test_5.t: Same.
8966         * gold/testsuite/script_test_6.t: Same.
8967         * gold/testsuite/script_test_7.t: Same.
8968         * gold/testsuite/script_test_7.t: Same.
8969         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
8970
8971 2010-09-14  Cary Coutant  <ccoutant@google.com>
8972
8973         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
8974         (Target_x86_64::Relocate::relocate_tls): Replace check for
8975         saw_tls_block_reloc_ with test for executable section.
8976
8977 2010-09-12  Cary Coutant  <ccoutant@google.com>
8978
8979         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
8980         position-independent executables to shared libraries need dynamic
8981         relocations.
8982         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
8983         position-independent executables.
8984         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
8985         * testsuite/Makefile.in: Regenerate.
8986
8987 2010-09-10  Nick Clifton  <nickc@redhat.com>
8988
8989         PR gold/11997
8990         * testsuite/memory_test.t: Discard any sections that are not
8991         needed.
8992
8993 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
8994
8995         PR gold/11996
8996         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8997         "This::" to work around a bug in gcc 4.2.
8998
8999         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
9000
9001 2010-09-09  Rafael Espindola  <espindola@google.com>
9002
9003         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
9004         sections with different PF_X flags in the same segment.
9005         (Layout::find_first_load_seg): Search all segments to find the first
9006         one.
9007         * options.h (rosegment): New.
9008
9009 2010-09-08  Rafael Espindola  <espindola@google.com>
9010
9011         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
9012
9013 2010-09-08  Doug Kwan  <dougkwan@google.com>
9014
9015         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
9016         (Arm_relobj::do_relocate_sections): Add new parameter for output
9017         file to match the parent.
9018         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
9019         of local symbols instead of input values.  Update code to track
9020         changes in gold::relocate_section.
9021         * object.cc (Sized_relobj::compute_final_local_value): New methods.
9022         (Sized_relobj::compute_final_local_value_internal): New methods.
9023         (Sized_relobj::do_finalize_local_symbols): Move code from loop
9024         body into private version of Sized_relobj::compute_final_local_value.
9025         Call the inline method.
9026         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
9027         merged symbol value if there is one.
9028         (Symbol_value::has_output_value): New method defintiion.
9029         (Sized_relobj::Compute_final_local_value_status): New enum type.
9030         (Sized_relobj::compute_final_local_value): New methods.
9031         (Sized_relobj::compute_final_local_value_internal): New methods.
9032         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
9033         and arm_cortex_a8.sh.
9034         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
9035         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
9036         New tests.
9037         * Makefile.in: Regenerate.
9038         * testsuite/arm_bl_out_of_range.s: Update test.
9039         * testsuite/thumb_bl_out_of_range.s: Ditto.
9040         * testsuite/thumb_blx_out_of_range.s: Ditto.
9041         * testsuite/arm_branch_out_of_range.sh: New file.
9042         * testsuite/arm_cortex_a8.sh: Ditto.
9043         * testsuite/arm_cortex_a8_b.s: Ditto.
9044         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
9045         * testsuite/arm_cortex_a8_b_local.s: Ditto.
9046         * testsuite/arm_cortex_a8_bl.s: Ditto.
9047         * testsuite/arm_cortex_a8_blx.s: Ditto.
9048         * testsuite/arm_cortex_a8_local.s: Ditto.
9049         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
9050         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
9051
9052 2010-09-08  Rafael Espindola  <espindola@google.com>
9053
9054         * Makefile.am (memory_test.stdout): Run readelf with -W.
9055         * Makefile.in: Regenerate.
9056         * testsuite/memory_test.sh: Make the regexps accept both 32 and
9057         64 bit output.
9058
9059 2010-09-08  Rafael Espindola  <espindola@google.com>
9060
9061         * script-sections.cc (Script_sections::add_memory_region): Convert
9062         field precision to int.
9063         * script.cc (script_set_section_region, script_set_section_region):
9064         Convert field precision to int.
9065
9066 2010-09-08  Rafael Espindola  <espindola@google.com>
9067
9068         * arm.cc (do_finalize_sections): Create the __exidx_start and
9069         __exdix_end symbols even when the section is missing.
9070
9071 2010-09-08  Nick Clifton  <nickc@redhat.com>
9072
9073         * README: Remove claim that MEMORY is not supported.
9074         * expression.cc (script_exp_function_origin)
9075         (script_exp_function_length): Move from here to ...
9076         * script.cc: ... here.
9077         (script_set_section_region, script_add_memory)
9078         (script_parse_memory_attr, script_include_directive): New
9079         functions.
9080         * script-sections.cc
9081         (class Memory_region): New class.
9082         (class Output_section_definition): Add set_memory_region,
9083         set_section_vma, set_section_lma and get_section_name methods.
9084         (class Script_Sections): Add add_memory_region,
9085         find_memory_region, find_memory_region_origin,
9086         find_memory_region_length and set_memory_region methods.
9087         Have set_section_addresses method walk the list of set memory
9088         regions.
9089         Extend the print methos to display memory regions.
9090         * script-sections.h: Add prototypes for new methods.
9091         Add enum for MEMORY region attributes.
9092         * yyscript.y: Add support for parsing MEMORY regions.
9093         * script-c.h: Add prototypes for new functions.
9094         * testsuite/Makefile.am: Add test of MEMORY region functionality.
9095         * testsuite/Makefile.in: Regenerate.
9096         * testsuite/memory_test.sh: New script.
9097         * testsuite/memory_test.s: New assembler source file.
9098         * testsuite/memory_test.t: New linker script.
9099
9100 2010-08-27  Doug Kwan  <dougkwan@google.com>
9101
9102         * gold/resolve.cc (Symbol_table::should_override): Let a weak
9103         reference override an existing dynamic weak reference.
9104         * testsuite/Makefile.am: Add new test dyn_weak_ref.
9105         * testsuite/Makefile.in: Regenerate.
9106         * testsuite/dyn_weak_ref.sh: New file.
9107         * testsuite/dyn_weak_ref_1.c: Ditto.
9108         * testsuite/dyn_weak_ref_2.c: Ditto.
9109
9110 2010-08-27  Ian Lance Taylor  <iant@google.com>
9111
9112         * incremental.h (class Incremental_input_entry): Add virtual
9113         destructor.
9114
9115 2010-08-27  Ian Lance Taylor  <iant@google.com>
9116
9117         * testsuite/start_lib_test_3.c: Mark t3 as used.
9118
9119 2010-08-27  Nick Clifton  <nickc@redhat.com>
9120
9121         * options.cc (version_script): Fix small typo in previous
9122         whitespace tidyup.
9123
9124 2010-08-25  Nick Clifton  <nickc@redhat.com>
9125
9126         * archive.cc: Formatting fixes: Remove whitespace between
9127         typename and following asterisk.  Remove whitespace between
9128         function name and opening parenthesis.
9129         * archive.h: Likewise.
9130         * arm.cc: Likewise.
9131         * attributes.cc: Likewise.
9132         * attributes.h: Likewise.
9133         * common.cc: Likewise.
9134         * copy-relocs.cc: Likewise.
9135         * dirsearch.h: Likewise.
9136         * dynobj.cc: Likewise.
9137         * ehframe.cc: Likewise.
9138         * ehframe.h: Likewise.
9139         * expression.cc: Likewise.
9140         * fileread.cc: Likewise.
9141         * fileread.h: Likewise.
9142         * gc.h: Likewise.
9143         * gold-threads.cc: Likewise.
9144         * gold.cc: Likewise.
9145         * i386.cc: Likewise.
9146         * icf.h: Likewise.
9147         * incremental-dump.cc: Likewise.
9148         * incremental.cc: Likewise.
9149         * layout.cc: Likewise.
9150         * layout.h: Likewise.
9151         * main.cc: Likewise.
9152         * merge.cc: Likewise.
9153         * merge.h: Likewise.
9154         * object.cc: Likewise.
9155         * object.h: Likewise.
9156         * options.cc: Likewise.
9157         * options.h: Likewise.
9158         * output.cc: Likewise.
9159         * output.h: Likewise.
9160         * plugin.cc: Likewise.
9161         * plugin.h: Likewise.
9162         * powerpc.cc: Likewise.
9163         * reloc.cc: Likewise.
9164         * script-c.h: Likewise.
9165         * script-sections.cc: Likewise.
9166         * script.cc: Likewise.
9167         * stringpool.cc: Likewise.
9168         * symtab.cc: Likewise.
9169         * symtab.h: Likewise.
9170         * target.cc: Likewise.
9171         * timer.cc: Likewise.
9172         * timer.h: Likewise.
9173         * version.cc: Likewise.
9174         * x86_64.cc: Likewise.
9175
9176 2010-08-24  Nick Clifton  <nickc@redhat.com>
9177
9178         PR 11899
9179         * layout.cc (segment_precedes): Sort segments by their physical
9180         addresses, if they have been set.
9181
9182 2010-08-23  Cary Coutant  <ccoutant@google.com>
9183
9184         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
9185         symbols data.
9186         (Lib_group::include_member): Unlock object after deleting its
9187         symbols data.
9188         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
9189         the bug fixed here.
9190
9191 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
9192             Cary Coutant  <ccoutant@google.com>
9193
9194         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
9195         constructor, and set_blocker.
9196         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
9197         readsyms_blocker_.
9198         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
9199         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
9200         * testsuite/Makefile.am (start_lib_test): New test case.
9201         * testsuite/Makefile.in: Regenerate.
9202         * testsuite/start_lib_test_main.c: New file.
9203         * testsuite/start_lib_test_1.c: New file.
9204         * testsuite/start_lib_test_2.c: New file.
9205         * testsuite/start_lib_test_3.c: New file.
9206
9207 2010-08-19  Ian Lance Taylor  <iant@google.com>
9208
9209         * Makefile.in: Rebuild with automake 1.11.1.
9210         * aclocal.m4: Likewise.
9211         * testsuite/Makefile.in: Likewise.
9212
9213 2010-08-19  Ian Lance Taylor  <iant@google.com>
9214
9215         PR 10893
9216         * i386.cc (class Output_data_plt_i386): Update declarations.
9217         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
9218         local_ifuncs_ fields.
9219         (Target_i386::do_plt_section_for_global): New function.
9220         (Target_i386::do_plt_section_for_local): New function.
9221         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
9222         parameter; change all callers.  Initialize global_ifuncs_ and
9223         local_ifuncs_.  If doing a static link define __rel_iplt_start and
9224         __rel_iplt_end.
9225         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
9226         (Output_data_plt_i386::add_local_ifunc_entry): New function.
9227         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
9228         symbols.
9229         (Target_i386::make_plt_section): New function, broken out of
9230         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
9231         (Target_i386::make_plt_entry): Call make_plt_section.
9232         (Target_i386::make_local_ifunc_plt_entry): New function.
9233         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
9234         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
9235         R_386_IRELATIVE to switch.
9236         (Target_i386::Scan::global): Likewise.
9237         (Target_i386::Relocate::relocate): Likewise.
9238         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
9239         switch.
9240         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
9241         (Target_x86_64::do_plt_section_for_global): New function.
9242         (Target_x86_64::do_plt_section_for_local): New function.
9243         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
9244         parameter; change all callers.  If doing a static link define
9245         __rela_iplt_start and __rela_iplt_end.
9246         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
9247         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
9248         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
9249         to point to .plt.
9250         (Target_x86_64::make_local_ifunc_plt_entry): New function.
9251         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
9252         switch.
9253         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
9254         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
9255         R_X86_64_IRELATIVE to switch.
9256         (Target_x86_64::Scan::global): Likewise.
9257         (Target_x86_64::Relocate::relocate): Likewise.
9258         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
9259         switch.
9260         * target.h (class Target): Add plt_section_for_global and
9261         plt_section_for_local functions.  Add do_plt_section_for_global
9262         and do_plt_section_for_local virtual functions.
9263         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
9264         clarifying comments.
9265         (Symbol::use_plt_offset): Handle IFUNC symbol.
9266         * object.cc (Sized_relobj::Sized_relobj): Initialize
9267         local_plt_offsets_.
9268         (Sized_relobj::local_has_plt_offset): New function.
9269         (Sized_relobj::local_plt_offset): New function.
9270         (Sized_relobj::set_local_plt_offset): New function.
9271         (Sized_relobj::do_count): Handle IFUNC symbol.
9272         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
9273         a bit away from input_shndx_ field.  Add set_is_func_symbol and
9274         is_ifunc_symbol functions.
9275         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
9276         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
9277         local_plt_offsets_ field.
9278         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
9279         * output.h (class Output_section_data): Add non-const
9280         output_section function.
9281         (class Output_data_got): Update declarations.
9282         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
9283         Add use_plt_offset parameter to global and local constructors.
9284         Change all callers.  Change local_sym_index_ field to 31 bits.
9285         Change GSYM_CODE and CONSTANT_CODE accordingly.
9286         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
9287         doing a static link don't set sh_link field.
9288         (Output_data_got::Got_entry::write): Use PLT offset if
9289         appropriate.
9290         (Output_data_got::add_global_plt): New function.
9291         (Output_data_got::add_local_plt): New function.
9292         * target-reloc.h (relocate_section): Handle IFUNC symbol.
9293         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
9294         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
9295         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
9296         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
9297         IFUNC conditional.
9298         * testsuite/ifunc-sel.h: New file.
9299         * testsuite/ifuncmain1.c: New file.
9300         * testsuite/ifuncmain1vis.c: New file.
9301         * testsuite/ifuncmod1.c: New file.
9302         * testsuite/ifuncdep2.c: New file.
9303         * testsuite/ifuncmain2.c: New file.
9304         * testsuite/ifuncmain3.c: New file.
9305         * testsuite/ifuncmod3.c: New file.
9306         * testsuite/ifuncmain4.c: New file.
9307         * testsuite/ifuncmain5.c: New file.
9308         * testsuite/ifuncmod5.c: New file.
9309         * testsuite/ifuncmain6pie.c: New file.
9310         * testsuite/ifuncmod6.c: New file.
9311         * testsuite/ifuncmain7.c: New file.
9312         * configure, testsuite/Makefile.in: Rebuild.
9313
9314 2010-08-18  Ian Lance Taylor  <iant@google.com>
9315
9316         * incremental.cc
9317         (Output_section_incremental_inputs::write_input_files): Add cast
9318         to avoid signed/unsigned comparison warning.
9319         (Output_section_incremental_inputs::write_info_blocks): Likewise.
9320
9321 2010-08-12  Cary Coutant  <ccoutant@google.com>
9322
9323         * common.cc (Sort_commons::operator()): Remove unnecessary code.
9324
9325 2010-08-13  Ian Lance Taylor  <iant@google.com>
9326
9327         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
9328
9329 2010-08-12  Cary Coutant  <ccoutant@google.com>
9330             Doug Kwan  <dougkwan@google.com>
9331
9332         * resolve.cc (Symbol_table::should_override): When a weak dynamic
9333         defintion overrides non-weak undef, remember that the original undef
9334         is not weak.
9335         * symtab.cc (Symbol_table::sized_write_global): For undef without
9336         an original weak binding, set binding to global in output.
9337         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
9338         * testsuite/Makefile.in: Regenerate.
9339         * testsuite/strong_ref_weak_def.sh: New file.
9340         * testsuite/strong_ref_weak_def_1.c: Ditto.
9341         * testsuite/strong_ref_weak_def_2.c: Ditto.
9342
9343 2010-08-12  Cary Coutant  <ccoutant@google.com>
9344
9345         * testsuite/incremental_test.sh: Rewrite.
9346         * testsuite/incremental_test_1.c: Rewrite.
9347         * testsuite/incremental_test_2.c: Rewrite.
9348
9349 2010-08-12  Cary Coutant  <ccoutant@google.com>
9350
9351         * arm.cc (Target_arm::got_size): Add const.
9352         (Target_arm::got_entry_count): New function.
9353         (Target_arm::plt_entry_count): New function.
9354         (Target_arm::first_plt_entry_offset): New function.
9355         (Target_arm::plt_entry_size): New function.
9356         (Output_data_plt_arm::entry_count): New function.
9357         (Output_data_plt_arm::first_plt_entry_offset): New function.
9358         (Output_data_plt_arm::get_plt_entry_size): New function.
9359         * i386.cc (Target_i386::got_size): Add const.
9360         (Target_i386::got_entry_count): New function.
9361         (Target_i386::plt_entry_count): New function.
9362         (Target_i386::first_plt_entry_offset): New function.
9363         (Target_i386::plt_entry_size): New function.
9364         (Output_data_plt_i386::entry_count): New function.
9365         (Output_data_plt_i386::first_plt_entry_offset): New function.
9366         (Output_data_plt_i386::get_plt_entry_size): New function.
9367         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
9368         find_incremental_inputs_sections.  Dump incremental_got_plt section.
9369         * incremental.cc: Include target.h.
9370         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
9371         parameter.  Adjust all callers.  Find incremental_got_plt section.
9372         (Incremental_inputs::create_data_sections): Create incremental_got_plt
9373         section.
9374         (Output_section_incremental_inputs::set_final_data_size): Calculate
9375         size of incremental_got_plt section.
9376         (Output_section_incremental_inputs::do_write): Write the
9377         incremental_got_plt section.
9378         (Got_plt_view_info): New struct.
9379         (Local_got_offset_visitor): New class.
9380         (Global_got_offset_visitor): New class.
9381         (Global_symbol_visitor_got_plt): New class.
9382         (Output_section_incremental_inputs::write_got_plt): New function.
9383         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
9384         Add parameter.  Adjust all callers.
9385         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9386         (Incremental_inputs::got_plt_section): New function.
9387         (Incremental_inputs::got_plt_section_): New data member.
9388         (Incremental_got_plt_reader): New class.
9389         * layout.cc (Layout::create_incremental_info_sections): Add the
9390         incremental_got_plt section.
9391         * object.h (Got_offset_list::get_list): New function.
9392         (Got offset_list::for_all_got_offsets): New function.
9393         (Sized_relobj::local_got_offset_list): New function.
9394         * powerpc.cc (Target_powerpc::got_size): Add const.
9395         (Target_powerpc::got_entry_count): New function.
9396         (Target_powerpc::plt_entry_count): New function.
9397         (Target_powerpc::first_plt_entry_offset): New function.
9398         (Target_powerpc::plt_entry_size): New function.
9399         (Output_data_plt_powerpc::entry_count): New function.
9400         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
9401         (Output_data_plt_powerpc::get_plt_entry_size): New function.
9402         * sparc.cc (Target_sparc::got_size): Add const.
9403         (Target_sparc::got_entry_count): New function.
9404         (Target_sparc::plt_entry_count): New function.
9405         (Target_sparc::first_plt_entry_offset): New function.
9406         (Target_sparc::plt_entry_size): New function.
9407         (Output_data_plt_sparc::entry_count): New function.
9408         (Output_data_plt_sparc::first_plt_entry_offset): New function.
9409         (Output_data_plt_sparc::get_plt_entry_size): New function.
9410         * symtab.h (Symbol::got_offset_list): New function.
9411         (Symbol_table::for_all_symbols): New function.
9412         * target.h (Sized_target::got_entry_count): New function.
9413         (Sized_target::plt_entry_count): New function.
9414         (Sized_target::plt_entry_size): New function.
9415         * x86_64.cc (Target_x86_64::got_size): Add const.
9416         (Target_x86_64::got_entry_count): New function.
9417         (Target_x86_64::plt_entry_count): New function.
9418         (Target_x86_64::first_plt_entry_offset): New function.
9419         (Target_x86_64::plt_entry_size): New function.
9420         (Output_data_plt_x86_64::entry_count): New function.
9421         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
9422         (Output_data_plt_x86_64::get_plt_entry_size): New function.
9423
9424 2010-08-12  Cary Coutant  <ccoutant@google.com>
9425
9426         * archive.cc: Include incremental.h.
9427         (Archive::Archive): Initialize incremental_info_.
9428         (Archive::include_member): Record archive members in incremental info.
9429         (Add_archive_symbols::run): Record begin and end of an archive in
9430         incremental info.
9431         (Lib_group::include_member): Record objects in incremental info.
9432         * archive.h (Incremental_archive_entry): Forward declaration.
9433         (Archive::set_incremental_info): New member function.
9434         (Archive::incremental_info): New member function.
9435         (Archive::Unused_symbol_iterator): New class.
9436         (Archive::unused_symbols_begin): New member function.
9437         (Archive::unused_symbols_end): New member function.
9438         (Archive::incremental_info_): New data member.
9439         * incremental-dump.cc (find_input_containing_global): New function.
9440         (dump_incremental_inputs): Dump new incremental info sections.
9441         * incremental.cc: Include symtab.h.
9442         (Output_section_incremental_inputs): New class.
9443         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
9444         new incremental info sections.
9445         (Sized_incremental_binary::do_check_inputs): Likewise.
9446         (Incremental_inputs::report_archive): Remove.
9447         (Incremental_inputs::report_archive_begin): New function.
9448         (Incremental_inputs::report_archive_end): New function.
9449         (Incremental_inputs::report_object): New function.
9450         (Incremental_inputs::finalize_inputs): Remove.
9451         (Incremental_inputs::report_input_section): New function.
9452         (Incremental_inputs::report_script): Rewrite.
9453         (Incremental_inputs::finalize): Do nothing but finalize string table.
9454         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9455         (Incremental_inputs::sized_create_inputs_section_data): Remove.
9456         (Incremental_inputs::create_data_sections): New function.
9457         (Incremental_inputs::relocs_entsize): New function.
9458         (Output_section_incremental_inputs::set_final_data_size): New function.
9459         (Output_section_incremental_inputs::do_write): New function.
9460         (Output_section_incremental_inputs::write_header): New function.
9461         (Output_section_incremental_inputs::write_input_files): New function.
9462         (Output_section_incremental_inputs::write_info_blocks): New function.
9463         (Output_section_incremental_inputs::write_symtab): New function.
9464         * incremental.h (Incremental_script_entry): Forward declaration.
9465         (Incremental_object_entry): Forward declaration.
9466         (Incremental_archive_entry): Forward declaration.
9467         (Incremental_inputs): Forward declaration.
9468         (Incremental_inputs_header_data): Remove.
9469         (Incremental_inputs_header): Remove.
9470         (Incremental_inputs_header_write): Remove.
9471         (Incremental_inputs_entry_data): Remove.
9472         (Incremental_inputs_entry): Remove.
9473         (Incremental_inputs_entry_write): Remove.
9474         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
9475         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
9476         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9477         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
9478         Likewise.
9479         (Incremental_input_entry): New class.
9480         (Incremental_script_entry): New class.
9481         (Incremental_object_entry): New class.
9482         (Incremental_archive_entry): New class.
9483         (Incremental_inputs::Incremental_inputs): Initialize new data members.
9484         (Incremental_inputs::report_inputs): Remove.
9485         (Incremental_inputs::report_archive): Remove.
9486         (Incremental_inputs::report_archive_begin): New function.
9487         (Incremental_inputs::report_archive_end): New function.
9488         (Incremental_inputs::report_object): Change prototype.
9489         (Incremental_inputs::report_input_section): New function.
9490         (Incremental_inputs::report_script): Change prototype.
9491         (Incremental_inputs::get_reloc_count): New function.
9492         (Incremental_inputs::set_reloc_count): New function.
9493         (Incremental_inputs::create_data_sections): New function.
9494         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9495         (Incremental_inputs::inputs_section): New function.
9496         (Incremental_inputs::symtab_section): New function.
9497         (Incremental_inputs::relocs_section): New function.
9498         (Incremental_inputs::get_stringpool): Add const.
9499         (Incremental_inputs::command_line): Add const.
9500         (Incremental_inputs::inputs): Remove.
9501         (Incremental_inputs::command_line_key): New function.
9502         (Incremental_inputs::input_file_count): New function.
9503         (Incremental_inputs::input_files): New function.
9504         (Incremental_inputs::relocs_entsize): New function.
9505         (Incremental_inputs::sized_create_inputs_section_data): Remove.
9506         (Incremental_inputs::finalize_inputs): Remove.
9507         (Incremental_inputs::Input_info): Remove.
9508         (Incremental_inputs::lock_): Remove.
9509         (Incremental_inputs::inputs_): Change type.
9510         (Incremental_inputs::inputs_map_): Remove.
9511         (Incremental_inputs::current_object_entry_): New data member.
9512         (Incremental_inputs::inputs_section_): New data member.
9513         (Incremental_inputs::symtab_section_): New data member.
9514         (Incremental_inputs::relocs_section_): New data member.
9515         (Incremental_inputs::reloc_count_): New data member.
9516         (Incremental_inputs_reader): New class.
9517         (Incremental_symtab_reader): New class.
9518         (Incremental_relocs_reader): New class.
9519         * layout.cc (Layout::finalize): Move finalization of incremental info
9520         and creation of incremental info sections to follow finalization of
9521         symbol table.  Set offsets for postprocessing sections.
9522         (Layout::create_incremental_info_sections): Call
9523         Incremental_inputs::create_data_sections.  Add incremental symtab
9524         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
9525         sections to layout after input sections.
9526         * layout.h (struct Timespec): Forward declaration.
9527         (Layout::incremental_inputs): Add const.
9528         (Layout::create_incremental_info_sections): Add parameter.
9529         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
9530         * object.cc: Include incremental.h.
9531         (Relobj::finalize_incremental_relocs): New function.
9532         (Sized_relobj::do_layout): Record input sections in incremental info.
9533         * object.h (Object::output_section): New function.
9534         (Object::output_section_offset): Moved from Relobj.
9535         (Object::get_incremental_reloc_base): New function.
9536         (Object::get_incremental_reloc_count): New function.
9537         (Object::do_output_section): New function.
9538         (Object::do_output_section_offset): Moved from Relobj.
9539         (Object::do_get_incremental_reloc_base): New function.
9540         (Object::do_get_incremental_reloc_count): New function.
9541         (Object::Object): Initialize new data members.
9542         (Relobj::output_section): Renamed do_output_section and moved to
9543         protected.
9544         (Relobj::output_section_offset): Moved to Object.
9545         (Relobj::do_get_incremental_reloc_base): New function.
9546         (Relobj::do_get_incremental_reloc_count): New function.
9547         (Relobj::allocate_incremental_reloc_counts): New function.
9548         (Relobj::count_incremental_reloc): New function.
9549         (Relobj::finalize_incremental_relocs): New function.
9550         (Relobj::next_incremental_reloc_index): New function.
9551         (Relobj::reloc_counts_): New data member.
9552         (Relobj::reloc_bases_): New data member.
9553         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
9554         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
9555         (Sized_relobj::incremental_relocs_scan): New function.
9556         (Sized_relobj::incremental_relocs_scan_reltype): New function.
9557         (Sized_relobj::incremental_relocs_write): New function.
9558         (Sized_relobj::incremental_relocs_write_reltype): New function.
9559         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
9560         incremental link.
9561         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
9562         archives and object files elsewhere.
9563         (Add_symbols::run): Report object files here.
9564         (Finish_group::run): Report end of archive at end of group.
9565         * reloc.cc: Include layout.h, incremental.h.
9566         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
9567         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
9568         (Sized_relobj::incremental_relocs_scan): New function.
9569         (Sized_relobj::incremental_relocs_scan_reltype): New function.
9570         (Sized_relobj::do_relocate_sections): Write incremental relocations.
9571         (Sized_relobj::incremental_relocs_write): New function.
9572         (Sized_relobj::incremental_relocs_write_reltype): New function.
9573         * script.cc (read_input_script): Rewrite test for incremental link.
9574         Change call to Incremental_inputs::report_script.
9575         * symtab.h (Symbol_table::first_global_index): New function.
9576         (Symbol_table::output_count): New function.
9577
9578 2010-08-12  Doug Kwan  <dougkwan@google.com>
9579
9580         * arm.cc (Target_arm::merge_object_attributes): Check command line
9581         options --no-wchar-size-warning and --no-enum-size-warning.
9582         * options.h (General_options): Add ld-compatible options
9583         --no-enum-size-warning and --no-wchar-size-warning.
9584
9585 2010-08-04  Ian Lance Taylor  <iant@google.com>
9586
9587         * x86_64.cc (Target_x86_64::Scan::local): Use
9588         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
9589         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
9590         (Target_x86_64::Scan::global): Likewise.
9591         (Target_x86_64::Relocate::relocate): Likewise.
9592         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
9593         Likewise.
9594
9595 2010-08-03  Cary Coutant  <ccoutant@google.com>
9596
9597         * merge.cc (Output_merge_string::do_add_input_section): Count strings
9598         to reserve space in merged_strings vector. Keep total input size
9599         for stats.
9600         (Output_merge_string::do_print_merge_stats): Print total input size.
9601         * merge.h (Output_merge_string): Add input_size_ field.
9602         * stringpool.cc (Stringpool_template::string_length): Move
9603         implementations out of Stringpool_template class and place in
9604         stringpool.h.
9605         * stringpool.h (string_length): Move out of Stringpool_template.
9606
9607 2010-08-03  Ian Lance Taylor  <iant@google.com>
9608
9609         PR 11712
9610         * layout.cc (relaxation_loop_body): If address of load segment is
9611         set, adjust address to include headers if possible.
9612
9613 2010-08-03  Ian Lance Taylor  <iant@google.com>
9614
9615         * version.cc (version_string): Bump to 1.10.
9616
9617 2010-08-03  Ian Lance Taylor  <iant@google.com>
9618
9619         PR 11805
9620         * layout.h (enum Output_section_order): Define.
9621         (class Layout): Update declarations.
9622         * layout.cc (Layout::get_output_section): Add order parameter.
9623         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
9624         is_first_non_relro parameters.  Change all callers.
9625         (Layout::choose_output_section): Likewise.
9626         (Layout::add_output_section_data): Likewise.
9627         (Layout::make_output_section): Likewise.  Set order.
9628         (Layout::default_section_order): New function.
9629         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
9630         * output.cc (Output_section::Output_section): Initialize order_.
9631         Don't initialize deleted fields.
9632         (Output_segment::Output_segment): Don't initialize deleted
9633         fields.
9634         (Output_segment::add_output_section_to_load): New function
9635         replacing add_output_section.  Change all callers to call this or
9636         add_output_section_to_nonload.
9637         (Output_segment::add_output_section_to_nonload): New function.
9638         (Output_segment::remove_output_section): Rewrite.
9639         (Output_segment::add_initial_output_data): Likewise.
9640         (Output_segment::has_any_data_sections): Likewise.
9641         (Output_segment::is_first_section_relro): Likewise.
9642         (Output_segment::maximum_alignment): Likewise.
9643         (Output_segment::has_dynamic_reloc): New function replacing
9644         dynamic_reloc_count.  Change all callers.
9645         (Output_segment::has_dynamic_reloc_list): New function replacing
9646         dynamic_reloc_count_list.  Change all callers.
9647         (Output_segment::set_section_addresses): Rewrite.
9648         (Output_segment::set_offset): Rewrite.
9649         (Output_segment::find_first_and_last_list): Remove.
9650         (Output_segment::set_tls_offsets): Rewrite.
9651         (Output_segment::first_section_load_address): Likewise.
9652         (Output_segment::output_section_count): Likewise.
9653         (Output_segment::section_with_lowest_load_address): Likewise.
9654         (Output_segment::write_section_headers): Likewise.
9655         (Output_segment::print_sections_to_map): Likewise.
9656         * output.h (class Output_data): Remove dynamic_reloc_count_
9657         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
9658         (Output_data::add_dynamic_reloc): Rewrite.
9659         (Output_data::has_dynamic_reloc): New function.
9660         (Output_data::dynamic_reloc_count): Remove.
9661         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
9662         is_last_relro_, is_first_non_relro_, is_interp_,
9663         is_dynamic_linker_section_ fields.  Add order and set_order
9664         functions.  Remove is_relro_local, set_is_relro_local,
9665         is_last_relro, set_is_last_relro, is_first_non_relro,
9666         set_is_first_non_relro functions, is_interp, set_is_interp,
9667         is_dynamic_linker_section, and set_is_dynamic_linker_section
9668         functions.
9669         (class Output_segment): Change Output_data_list from std::list to
9670         std:;vector.  Add output_lists_ field.  Remove output_data_ and
9671         output_bss_ fields.  Update declarations.
9672
9673 2010-08-02  Ian Lance Taylor  <iant@google.com>
9674
9675         * arm.cc (Target_arm::gc_process_relocs): Use typename.
9676         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
9677         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
9678
9679 2010-08-02  Ian Lance Taylor  <iant@google.com>
9680
9681         PR 11855
9682         * script.cc (Script_options::Script_options): Initialize
9683         symbol_definitions_ and symbol_references_.
9684         (Script_options::add_symbol_assignment): Update
9685         symbol_definitions_ and symbol_references_.
9686         (Script_options::add_symbol_reference): New function.
9687         (script_symbol): New function.
9688         * script.h (class Script_options): Add symbol_definitions_ and
9689         symbol_references_ fields.
9690         (Script_options::referenced_const_iterator): New type.
9691         (Script_options::referenced_begin): New function.
9692         (Script_options::referenced_end): New function.
9693         (Script_options::is_referenced): New function.
9694         (Script_options::any_unreferenced): New function.
9695         * script-c.h (script_symbol): Declare.
9696         * yyscript.y (exp): Call script_symbol.
9697         * symtab.cc: Include "script.h".
9698         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
9699         Change all callers.  Check symbols referenced by scripts.
9700         (Symbol_table::add_undefined_symbols_from_command_line): Add
9701         layout parameter.  Change all callers.
9702         (Symbol_table::do_add_undefined_symbols_from_command_line):
9703         Likewise.  Break out loop body.  Check symbols referenced by
9704         scripts.
9705         (Symbol_table::add_undefined_symbol_from_command_line): New
9706         function broken out of
9707         do_add_undefined_symbols_from_command_line.
9708         * symtab.h (class Symbol_table): Update declarations.
9709         * archive.cc: Include "layout.h".
9710         (Archive::should_include_member): Add layout parameter.  Change
9711         all callers.  Check for symbol mentioned in expression.
9712         * archive.h (class Archive): Update declaration.
9713         * object.cc (Sized_relobj::do_should_include_member): Add layout
9714         parameter.
9715         * object.h (Object::should_include_member): Add layout parameter.
9716         Change all callers.
9717         (Object::do_should_include_member): Add layout parameter.
9718         (class Sized_relobj): Update declaration.
9719         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
9720         parameter.
9721         * dynobj.h (class Sized_dynobj): Update declaration.
9722         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
9723         layout parameter.
9724         * plugin.h (class Sized_pluginobj): Update declaration.
9725
9726 2010-08-02  Ian Lance Taylor  <iant@google.com>
9727
9728         PR 11866
9729         * output.cc (Output_segment::set_offset): Search for the first and
9730         last sections rather than assuming that the list is in order.
9731         (Output_segment::find_first_and_last_list): New function.
9732         * output.h (class Output_segment): Update declarations.
9733         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
9734         (relro_strip_test_SOURCES): New variable.
9735         (relro_strip_test_DEPENDENCIES): New variable.
9736         (relro_strip_test_LDFLAGS): New variable.
9737         (relro_strip_test_LDADD): New variable.
9738         (relro_strip_test.so): New target.
9739
9740 2010-08-02  Ian Lance Taylor  <iant@google.com>
9741
9742         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
9743         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
9744         (Target_i386::got_tlsdesc_section): New function.
9745         (Target_i386::got_section): Create space for GOT entries for
9746         TLSDESC relocations.
9747         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
9748         R_386_TLS_GOTDESC.
9749         (Target_i386::Scan::global): Likewise.
9750         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
9751         using TLSDESC GOT.
9752         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
9753         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
9754         (Target_x86_64::got_tlsdesc_section): New function.
9755         (Target_x86_64::got_section): Create space for GOT entries for
9756         TLSDESC relocations.
9757         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
9758         R_386_TLS_GOTDESC.
9759         (Target_x86_64::Scan::global): Likewise.
9760         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
9761         using TLSDESC GOT.
9762
9763 2010-08-02  Ian Lance Taylor  <iant@google.com>
9764
9765         * testsuite/final_layout.sh: Use dc to convert from hex to
9766         decimal.
9767
9768 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
9769
9770         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
9771         paramter to the call to gold::gc_process_relocs.
9772         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
9773         paramter to the call to gold::gc_process_relocs.
9774         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
9775         parameter to the call to gold::gc_process_relocs.
9776         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
9777         template parameter to the call to gold::gc_process_relocs.
9778         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
9779         paramter to the call to gold::gc_process_relocs.
9780         * gc.h (get_embedded_addend_size): New function.
9781         (gc_process_relocs): Save the size of the reloc for use by ICF.
9782         * icf.cc (get_section_contents): Get the addend from the text section
9783         for SHT_REL relocation sections.
9784         * icf.h (Icf::Reloc_addend_size_info): New typedef.
9785         (Icf::Reloc_info): Add new member reloc_addend_size_info.
9786         * int_encoding.h (read_from_pointer): New overloaded function.
9787         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
9788         * testsuite/icf_sht_rel_addend_test.sh: New file.
9789         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
9790         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
9791
9792 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9793
9794         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
9795         * Makefile.in: Regenerate.
9796         * testsuite/Makefile.in: Regenerate.
9797
9798 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
9799
9800         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
9801         * gold/testsuite/debug_msg.cc: Likewise.
9802         * gold/testsuite/odr_violation1.cc
9803         * gold/testsuite/odr_violation2.cc
9804
9805 2010-07-21  Cary Coutant  <ccoutant@google.com>
9806
9807         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
9808         string, and length fields.
9809         (Output_merge_string::Merged_strings_list): New type.
9810         (Output_merge_string::Merged_strings_lists): New typedef.
9811         (Output_merge_string): Replace merged_strings_ with
9812         merged_strings_lists_.
9813         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
9814         Merged_strings_list per input object and section.  Don't store pointer
9815         to the string.  Don't store length with each merged string entry.
9816         (Output_merge_string::finalize_merged_data): Loop over list of merged
9817         strings lists.  Recompute length of each merged string.
9818
9819 2010-07-15  Cary Coutant  <ccoutant@google.com>
9820
9821         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
9822         here.
9823
9824 2010-07-14  Ian Lance Taylor  <iant@google.com>
9825
9826         * descriptors.cc (Descriptors::open): Report correct name in error
9827         message.
9828
9829 2010-07-13  Doug Kwan  <dougkwan@google.com>
9830
9831         * arm.cc (Arm_input_section::Arm_input_section): For a
9832         SHT_ARM_EXIDX section, always keeps the input sections.
9833         (Arm_input_section::set_exidx_section_link): New method.
9834         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
9835         has_errors_ to false.
9836         (Arm_exidx_input_section::has_errors,
9837         Arm_exidx_input_section::set_has_errors): New methods.
9838         (Arm_exidx_input_section::has_errors_): New data member.
9839         (Arm_relobj::get_exidx_shndx_list): New method.
9840         (Arm_output_section::append_text_sections_to_list): Do not skip
9841         section without SHF_EXECINSTR.
9842         (Arm_output_section::fix_exidx_coverage): Skip input sections with
9843         errors.
9844         (Arm_relobj::make_exidx_input_section): Add new parameter for text
9845         section header.  Make error messages more verbose.  Check for
9846         a non-executable section linked to an EXIDX section.
9847         (Arm_relobj::do_read_symbols): Remove error checking, which has been
9848         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
9849         check that there is no deferred EXIDX section if we exit early.
9850         Instead of not making an EXIDX section in case of an error, make one
9851         and set the has_errors flag of it.
9852         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
9853         in a relocatable link.
9854         (Target_arm::do_relax): Look for the EXIDX output section instead of
9855         assuming that it is called .ARM.exidx.
9856         (Target_arm::fix_exidx_coverage): Add a new parameter for input
9857         section list.  Do not check for SHF_EXECINSTR section flags but
9858         skip any input section with errors.
9859         * output.cc (Output_section::Output_section): Initialize
9860         always_keeps_input_sections_ to false.
9861         (Output_section::add_input_section): Check for
9862         always_keeps_input_sections_.
9863         *  output.h (Output_section::always_keeps_input_sections,
9864         Output_section::set_always_keeps_input_sections): New methods.
9865         (Output_section::always_keeps_input_sections): New data member.
9866
9867 2010-07-13  Rafael Espindola  <espindola@google.com>
9868
9869         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
9870         * fileread.h (Input_file): Add try_extra_search_path and find_file.
9871
9872 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
9873             Ian Lance Taylor  <iant@google.com>
9874
9875         * output.h (Output_section_lookup_maps::add_merge_section):
9876         Correct check of whether value was inserted.
9877         (Output_section_lookup_maps::add_merge_input_section): Likewise.
9878         (Output_section_lookup_maps::add_relaxed_input_section):
9879         Likewise.
9880         * arm.cc (Target_arm::got_section): Remove used local os.
9881         * i386.cc (Target_i386::got_section): Likewise.
9882         * x86_64.cc (Target_x86_64::got_section): Likewise.
9883         * sparc.cc (Target_sparc::got_section): Likewise.
9884         (Target_sparc::relocate): Remove unused local have_got_offset.
9885         * powerpc.cc (Target_powerpc::relocate): Likewise.
9886
9887 2010-07-13  Ian Lance Taylor  <iant@google.com>
9888
9889         * compressed_output.cc (zlib_decompress): Fix signature in
9890         !HAVE_ZLIB_H case.
9891
9892         * archive.cc (Archive::include_member): Unlock an external member
9893         of a thin archive.  Don't bother to delete an object we know is
9894         NULL.
9895
9896 2010-07-12  Cary Coutant  <ccoutant@google.com>
9897
9898         * compressed_output.cc (zlib_decompress): New function.
9899         (get_uncompressed_size): New function.
9900         (decompress_input_section): New function.
9901         * compressed_output.h (get_uncompressed_size): New function.
9902         (decompress_input_section): New function.
9903         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
9904         Handle compressed debug sections.
9905         * layout.cc (is_compressed_debug_section): New function.
9906         (Layout::output_section_name): Map compressed section names to
9907         canonical names.
9908         * layout.h (is_compressed_debug_section): New function.
9909         (is_debug_info_section): Recognize compressed debug sections.
9910         * merge.cc: Include compressed_output.h.
9911         (Output_merge_data::do_add_input_section): Handle compressed
9912         debug sections.
9913         (Output_merge_string::do_add_input_section): Handle compressed
9914         debug sections.
9915         * object.cc: Include compressed_output.h.
9916         (Sized_relobj::Sized_relobj): Initialize new data members.
9917         (build_compressed_section_map): New function.
9918         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
9919         * object.h (Object::section_is_compressed): New method.
9920         (Object::do_section_is_compressed): New method.
9921         (Sized_relobj::Compressed_section_map): New type.
9922         (Sized_relobj::do_section_is_compressed): New method.
9923         (Sized_relobj::compressed_sections_): New data member.
9924         * output.cc (Output_section::add_input_section): Handle compressed
9925         debug sections.
9926         * reloc.cc: Include compressed_output.h.
9927         (Sized_relobj::write_sections): Handle compressed debug sections.
9928
9929 2010-07-08  Cary Coutant  <ccoutant@google.com>
9930
9931         * resolve.cc (Symbol_table::resolve): Remember whether undef was
9932         weak when resolving to a dynamic def.
9933         (Symbol_table::should_override): Add adjust_dyndef flag; set it
9934         for weak undef/dynamic def cases. Adjust callers.
9935         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
9936         undef_binding_weak_.
9937         (Symbol_table::sized_write_globals): Adjust symbol binding.
9938         (Symbol_table::sized_write_symbol): Add binding parameter.
9939         * symtab.h (Symbol::set_undef_binding): New method.
9940         (Symbol::is_undef_binding_weak): New method.
9941         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
9942         (Symbol_table::should_override): Add new parameter.
9943         (Symbol_table::sized_write_symbol): Add new parameter.
9944
9945         * testsuite/weak_undef_file1.cc: Add new test case.
9946         * testsuite/weak_undef_file2.cc: Fix header comment.
9947         * testsuite/weak_undef_test.cc: Add new test case.
9948
9949 2010-06-29  Doug Kwan  <dougkwan@google.com>
9950
9951         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
9952         Initialize USE_SYMBOL_.
9953         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
9954         definition.
9955         (Arm_reloc_property::uses_symbol_): New data member declaration.
9956         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
9957         uses symbol value and symbol is undefined but not weakly undefined.
9958
9959 2010-06-28  Rafael Espindola  <espindola@google.com>
9960
9961         * plugin.cc (Plugin::load): Use dlerror.
9962
9963 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
9964
9965         * symtab.cc (detect_odr_violations): When reporting an ODR
9966         violation, report an object where the symbol is defined.
9967
9968 2010-06-25  Doug Kwan  <dougkwan@google.com>
9969
9970         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
9971         (Target_arm::section_may_have_icf_unsafe_pointers): New method
9972         definition.
9973         (Target_arm::Scan::local_reloc_may_be_function_pointer,
9974         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
9975         target hook to detect function points.
9976         (Target_arm::Scan::possible_function_pointer_reloc): New method.
9977         * icf.h (Icf::check_section_for_function_pointers): Change type of
9978         parameter SECTION_NAME to const reference to std::string.  Use
9979         target hook to determine if section may have unsafe pointers.
9980         * target.h (Target::section_may_have_icf_unsafe_pointers): New
9981         method definition.
9982
9983 2010-06-21  Rafael Espindola  <espindola@google.com>
9984
9985         * fileread.cc (Input_file::find_fie): New
9986         (Input_file::open): Use Input_file::find_fie.
9987         * fileread.h (Input_file::find_fie): New
9988         * plugin.cc (set_extra_library_path): New.
9989         (Plugin::load): Add set_extra_library_path to the transfer vector.
9990         (Plugin_manager::set_extra_library_path): New.
9991         (Plugin_manager::add_input_file): Use the extra search path if set.
9992         (set_extra_library_path(): New.
9993         * plugin.h (Plugin_manager): Add set_extra_library_path and
9994         extra_search_path_.
9995
9996 2010-06-19  Cary Coutant  <ccoutant@google.com>
9997
9998         * layout.cc (gdb_sections): Add .debug_types.
9999         (lines_only_debug_sections): Likewise.
10000
10001 2010-06-18  Rafael Espindola  <espindola@google.com>
10002
10003         * plugin.cc (add_input_file,add_input_library)
10004         (Plugin_manager::add_input_file): Make filename arguments const.
10005         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
10006         const.
10007
10008 2010-06-16  Doug Kwan  <dougkwan@google.com>
10009
10010         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
10011         .ARM.attributes section if we have not merged any input
10012         attributes sections.
10013
10014 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10015
10016         * arm.cc: Allow combining objects with no EABI version
10017         information.
10018
10019 2010-06-15  Rafael Espindola  <espindola@google.com>
10020
10021         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
10022
10023 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10024
10025         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
10026         (struct iovec): Correct !HAVE_READV definition.
10027
10028 2010-06-10  Cary Coutant  <ccoutant@google.com>
10029
10030         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
10031         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
10032         reloc sections.
10033         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
10034
10035         PR 11683
10036         * symtab.h (Symbol::is_placeholder): New member function.
10037         * target-reloc.h (relocate_section): Check for placeholder symbols.
10038
10039         * testsuite/Makefile.am (plugin_test_8): New test.
10040         (plugin_test_9): New test.
10041         * testsuite/Makefile.in: Regenerate.
10042
10043 2010-06-09  Nick Clifton  <nickc@redhat.com>
10044
10045         * yyscript.y (input_list_element): Allow strings prefixed with
10046         the '-' character.  Treat these as libraries.
10047         * script.cc (script_add_library): New function.  Adds a library
10048         specified by "-l<name>" found in an input script.
10049         * script-c.h: Add prototype for script_add_library.
10050
10051 2010-06-07  Doug Kwan  <dougkwan@google.com>
10052
10053         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
10054         Restrict stub-group size to be within long conditional branch
10055         range when working around cortex-A8 erratum.
10056
10057 2010-06-07  Damien Diederen  <dd@crosstwine.com>
10058
10059         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
10060         #ifdef typo.
10061
10062 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
10063
10064         PR gold/11658
10065         * output.cc
10066         (Output_section::Input_section_sort_entry::compare_section_ordering):
10067         Change to return non-zero correctly.
10068         (Output_section::Input_section_sort_section_order_index_compare
10069         ::operator()): Change to fix ambiguity in comparisons.
10070
10071 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
10072
10073         * gold.h (is_wildcard_string): New function.
10074         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
10075         (Layout::layout_eh_frame): Ditto.
10076         (Layout::find_section_order_index): New method.
10077         (Layout::read_layout_from_file): New method.
10078         * layout.h (Layout::find_section_order_index): New method.
10079         (Layout::read_layout_from_file): New method.
10080         (Layout::input_section_position_): New private member.
10081         (Layout::input_section_glob_): New private member.
10082         * main.cc (main): Call read_layout_from_file here.
10083         * options.h (--section-ordering-file): New option.
10084         * output.cc (Output_section::input_section_order_specified_): New
10085         member.
10086         (Output_section::Output_section): Initialize new member.
10087         (Output_section::add_input_section): Add new parameter.
10088         Keep input sections when --section-ordering-file is used.
10089         (Output_section::set_final_data_size): Sort input sections when
10090         section ordering file is specified.
10091         (Output_section::Input_section_sort_entry): Add new parameter.
10092         Check sorting type.
10093         (Output_section::Input_section_sort_entry::compare_section_ordering):
10094         New method.
10095         (Output_section::Input_section_sort_compare::operator()): Change to
10096         consider section_order_index.
10097         (Output_section::Input_section_sort_init_fini_compare::operator()):
10098         Change to consider section_order_index.
10099         (Output_section::Input_section_sort_section_order_index_compare
10100         ::operator()): New method.
10101         (Output_section::sort_attached_input_sections): Change to sort
10102         according to section order when specified.
10103         (Output_section::add_input_section<32, true>): Add new parameter.
10104         (Output_section::add_input_section<64, true>): Add new parameter.
10105         (Output_section::add_input_section<32, false>): Add new parameter.
10106         (Output_section::add_input_section<64, false>): Add new parameter.
10107         * output.h (Output_section::add_input_section): Add new parameter.
10108         (Output_section::input_section_order_specified): New
10109         method.
10110         (Output_section::set_input_section_order_specified): New method.
10111         (Input_section::Input_section): Initialize section_order_index_.
10112         (Input_section::section_order_index): New method.
10113         (Input_section::set_section_order_index): New method.
10114         (Input_section::section_order_index_): New member.
10115         (Input_section::Input_section_sort_section_order_index_compare): New
10116         struct.
10117         (Output_section::input_section_order_specified_): New member.
10118         * script-sections.cc (is_wildcard_string): Delete and move modified
10119         method to gold.h.
10120         (Output_section_element_input::Output_section_element_input): Modify
10121         call to is_wildcard_string.
10122         (Output_section_element_input::Input_section_pattern
10123         ::Input_section_pattern): Ditto.
10124         (Output_section_element_input::Output_section_element_input): Ditto.
10125         * testsuite/Makefile.am (final_layout): New test case.
10126         * testsuite/Makefile.in: Regenerate.
10127         * testsuite/final_layout.cc: New file.
10128         * testsuite/final_layout.sh: New file.
10129
10130 2010-06-01  Rafael Espindola  <espindola@google.com>
10131
10132         * plugin.cc (Plugin::load): Pass the output name to the plugin.
10133
10134 2010-06-01  Rafael Espindola  <espindola@google.com>
10135
10136         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
10137         visibility of symbols.
10138
10139 2010-05-27  Doug Kwan  <dougkwan@google.com>
10140
10141         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
10142         from start of output section instead of address for a local symbol
10143         in a merged or relaxed section when doing a relocatable link.
10144
10145 2010-05-26  Rafael Espindola  <espindola@google.com>
10146
10147         PR 11604
10148         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
10149         adding sections the garbage collector removed.
10150         * gold/testsuite/Makefile.am: Add test.
10151         * gold/testsuite/Makefile.in: Regenerate.
10152         * gold/testsuite/plugin_test_7.sh: New.
10153         * gold/testsuite/plugin_test_7_1.c: New.
10154         * gold/testsuite/plugin_test_7_2.c: New.
10155
10156 2010-05-26  Rafael Espindola  <espindola@google.com>
10157
10158         * script-sections.cc (Output_section_definition::set_section_addresses):
10159         Check for --section-start.
10160
10161 2010-05-26  Doug Kwan  <dougkwan@google.com>
10162
10163         * arm.cc (Arm_scan_relocatable_relocs): New class.
10164         (Target_arm::relocate_special_relocatable): New method.
10165         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
10166         (Arm_relocate_functions::thumb_branch_common): Same.
10167         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
10168         instead of Default_scan_relocatable_relocs.
10169         * target-reloc.h (relocate_for_relocatable): Let target handle
10170         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
10171         * target.h (Sized_target::relocate_special_relocatable): New method.
10172
10173 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10174
10175         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
10176
10177 2010-05-23  Doug Kwan  <dougkwan@google.com>
10178
10179         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
10180         instead of a cast.
10181         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
10182         with a direct branch, not a conditional branch, to a stub.
10183         * merge.cc (Output_merge_base::record_input_section): New method
10184         defintion.
10185         (Output_merge_data::do_add_input_section): Record input section if
10186         keeps-input-sections flag is set.
10187         (Output_merge_string::do_add_input_section): Ditto.
10188         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
10189         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
10190         INPUT_SECTIONS_.
10191         (Output_merge_base::keeps_input_sections,
10192         Output_merge_base::set_keeps_input_sections,
10193         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
10194         method definitions.
10195         (Output_merge_base::Input_sections): New type declaration.
10196         (Output_merge_base::input_sections_begin,
10197         Output_merge_base::input_sections_end,
10198         Output_merge_base::do_set_keeps_input_sections): New method definitions.
10199         (Output_merge_base::bool keeps_input_sections_,
10200         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
10201         Output_merge_base::input_sections_): New data members.
10202         (Output_merge_data::do_set_keeps_input_sections): New method
10203         defintion.
10204         (Output_merge_string::do_set_keeps_input_sections): Ditto.
10205         * output.cc (Output_section::Input_section::relobj): Move method
10206         defintion from class declaration to here and handle merge sections.
10207         (Output_section::Input_section::shndx): Ditto.
10208         (Output_section::Output_section): Remove initializations of removed
10209         data members and initialize new data member LOOKUP_MAPS_.
10210         (Output_section::add_input_section): Set keeps-input-sections flag
10211         for a newly created merge output section as appropriate.  Adjust code
10212         to use Output_section_lookup_maps class.
10213         (Output_section::add_relaxed_input_section): Adjst code for lookup
10214         maps code refactoring.
10215         (Output_section::add_merge_input_section): Add a new parameter
10216         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
10217         class.  If adding input section to a newly created merge output
10218         section fails, remove the new merge section.
10219         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
10220         Adjust code for use of the Output_section_lookup_maps class.
10221         (Output_section::find_merge_section): Ditto.
10222         (Output_section::build_lookup_maps): New method defintion.
10223         (Output_section::find_relaxed_input_section): Adjust code to use
10224         Output_section_lookup_maps class.
10225         (Output_section::get_input_sections): Export merge sections.  Adjust
10226         code to use Output_section_lookup_maps class.
10227         (Output_section:::add_script_input_section): Adjust code to use
10228         Output_section_lookup_maps class.  Update lookup maps for merge
10229         sections also.
10230         (Output_section::discard_states): Use Output_section_lookup_maps.
10231         (Output_section::restore_states): Same.
10232         * output.h (Merge_section_properties): Move class defintion out of
10233         Output_section.
10234         (Output_section_lookup_maps): New class.
10235         (Output_section::Input_section::is_merge_section): New method
10236         defintion.
10237         (Output_section::Input_section::relobj): Move defintion out of class
10238         defintion.  Declare method only.
10239         (Output_section::Input_section::shndx): Ditto.
10240         (Output_section::Input_section::output_merge_base): New method defintion.
10241         (Output_section::Input_section::u2_.pomb): New union field.
10242         (Output_section::Merge_section_by_properties_map,
10243         Output_section::Output_section_data_by_input_section_map,
10244         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
10245         Remove types.
10246         (Output_section::add_merge_input_section): Add new parameter
10247         KEEPS_INPUT_SECTIONS.
10248         (Output_section::build_lookup_maps): New method declaration.
10249         (Output_section::merge_section_map_,
10250         Output_section::merge_section_by_properties_map_,
10251         Output_section::relaxed_input_section_map_,
10252         Output_section::is_relaxed_input_section_map_valid_): Remove data
10253         members.
10254         (Output_section::lookup_maps_): New data member.
10255
10256 2010-05-21  Doug Kwan  <dougkwan@google.com>
10257
10258         PR gold/11619
10259         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
10260         avoid a compilation error.
10261
10262 2010-05-19  Rafael Espindola  <espindola@google.com>
10263
10264         * script-sections.cc (Output_section_definition::allocate_to_segment):
10265         Update the phdrs_list even when the output section is NULL.
10266         * testsuite/Makefile.am: Add test.
10267         * testsuite/Makefile.in: Regenerate.
10268         * testsuite/script_test_9.cc: New.
10269         * testsuite/script_test_9.sh: New.
10270         * testsuite/script_test_9.t: New.
10271
10272 2010-05-19  Doug Kwan  <dougkwan@google.com>
10273
10274         * arm.cc (Arm_input_section::original_size): New method.
10275         (Arm_input_section::do_addralign): Add a cast.
10276         (Arm_input_section::do_output_offset): Remove static cast.
10277         (Arm_input_section::original_addralign,
10278          Arm_input_section::original_size_): Change type to uint32_t.
10279         (Arm_input_section::init): Add safe casts for section alignment
10280         and size.
10281         (Arm_input_section::set_final_data_size): Do not set address and
10282         offset of stub table.
10283         (Arm_output_section::fix_exidx_coverage): Change use of of
10284         Output_section::Simple_input_section to that of
10285         Output_section::Input_section.
10286         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
10287         except for the first pass.
10288         * output.cc (Output_section::get_input_sections): Change type of
10289         input_sections to std::list<Input_section>.
10290         (Output_section::add_script_input_section): Rename from
10291         Output_section::add_simple_input_section.  Change type of SIS
10292         parameter from Simple_input_section to Input_section.
10293         * output.h (Output_section::Simple_input_section): Remove class.
10294         (Output_section::Input_section): Change class visibility to public.
10295         (Output_section::Input_section::addralign): Use stored alignments
10296         for special input sections if set.
10297         (Output_section::Input_section::set_addralign): New method.
10298         (Output_section::get_input_sections): Change parameter type from
10299         list of Simple_input_section to list of Input_section.
10300         (Output_section::add_script_input_section): Rename from
10301         Output_section::add_simple_input_section. Change first parameter's
10302         type from Simple_input_section to Input_section and remove the
10303         second and third parameters.
10304         * script-sections.cc (Input_section::Input_section_list): Change
10305         type to list of Output_section::Input_section/
10306         (Input_section_info::Input_section_info): Change parameter type of
10307         INPUT_SECTION to Output_section::Input_section.
10308         (Input_section_info::input_section): Change return type.
10309         (Input_section_info::input_section_): Change type to
10310         Output_section::Input_section.
10311         (Output_section_element_input::set_section_addresses): Adjust code
10312         to use Output_section::Input_section instead of
10313         Output_section::Simple_input_section.  Adjust code for renaming
10314         of Output_section::add_simple_input_section.
10315         (Orphan_output_section::set_section_addresses): Ditto.
10316
10317 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10318
10319         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
10320         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
10321
10322 2010-05-18  Rafael Espindola  <espindola@google.com>
10323
10324         * options.cc (General_options::finalize): Handle -nostdlib.
10325         * options.h (nostdlib): New option.
10326         * script.cc (script_add_search_dir): Handle -nostdlib.
10327
10328 2010-05-12  Doug Kwan  <dougkwan@google.com>
10329
10330         * arm.cc (Target_arm::do_finalize_sections): Create an empty
10331         attributes section only if there no attributes section after merging.
10332         (Target_arm::merge_object_attributes): Move value of
10333         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
10334         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
10335         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
10336         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
10337         and arm_attr_merge_7.stdout.
10338         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
10339         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
10340         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
10341         arm_attr_merge_7b.o): New rules.
10342         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
10343         arm_attr_merge_7
10344         * testsuite/Makefile.in: Regenerate.
10345         * testsuite/arm_attr_merge.sh: New file.
10346         * testsuite/arm_attr_merge_[67][ab].s: Same.
10347
10348 2010-05-05  Nick Clifton  <nickc@redhat.com>
10349
10350         * po/es.po: Updated Spanish translation.
10351
10352 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
10353
10354         * Makefile.am (install-exec-local): Properly install gold as
10355         default cross linker.
10356         * Makefile.in: Regenerated.
10357
10358 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
10359             Nick Clifton  <nickc@redhat.com>
10360
10361         * configure.ac (install_as_default): Define and set to false
10362         unless --enable-gold or --enable-gold=both/gold has been
10363         specified.
10364         * configure: Regenerate.
10365
10366         * Makefile.am (install-exec-local): Install the executable as
10367         'ld.gold'.  If install_as_default is true then also install it as
10368         'ld'.
10369         * Makefile.in: Regenerated.
10370
10371 2010-04-24  Ian Lance Taylor  <iant@google.com>
10372
10373         * layout.cc (Layout::layout_reloc): In relocatable link don't
10374         combine reloc sections for grouped sections.
10375
10376 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
10377
10378         * gc.h (gc_process_relocs): Pass information on relocs pointing to
10379         sections that are not ordinary to icf.
10380         * icf.cc (get_section_contents): Handle relocation pointing to section
10381         with no object or shndx information.
10382         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
10383         * testsuite/Makefile.in: Regenerate.
10384         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
10385         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
10386
10387 2010-04-22  Ian Lance Taylor  <iant@google.com>
10388
10389         * expression.cc (Expression::Expression_eval_info): Add
10390         result_alignment_pointer field.
10391         (Expression::eval_with_dot): Add result_alignment_pointer
10392         parameter.  Change all callers.
10393         (Expression::eval_maybe_dot): Likewise.
10394         (class Binary_expression): Add alignment_pointer parameter to
10395         left_value and right_value.  Change all callers.
10396         (BINARY_EXPRESSION): Set result alignment.
10397         (class Trinary_expression): Add alignment_pointer parameter to
10398         arg2_value and arg3_value.  Change all callers.
10399         (Trinary_cond::value): Set result alignment.
10400         (Max_expression::value, Min_expression::value): Likewise.
10401         (Align_expression::value): Likewise.
10402         * script-sections.cc (class Sections_element): Add dot_alignment
10403         parameter to set_section_addresses virtual function.  Update
10404         instantiations.
10405         (class Output_section_element): Likewise.
10406         (Script_sections::create_segments): Add dot_alignment parameter.
10407         Change all callers.
10408         (Script_sections::create_segments_from_phdrs_clause): Likewise.
10409         (Script_sections::set_phdrs_clause_addresses): Likewise.
10410         * script-sections.h: Update declarations.
10411         * script.h: Update declarations.
10412         * output.h (Output_segment::set_minimum_p_align): Don't decrease
10413         min_p_align.
10414         * testsuite/script_test_3.t: Set large alignment.
10415         * testsuite/script_test_3.sh: Make sure that at least one LOAD
10416         segment has expected alignment.
10417
10418 2010-04-22  Nick Clifton  <nickc@redhat.com>
10419
10420         * po/gold.pot: Updated by the Translation project.
10421         * po/vi.po: Updated Vietnamese translation.
10422
10423 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
10424
10425         * testsuite/Makefile.am (check_PROGRAMS): Add
10426         icf_virtual_function_folding_test.
10427         * testsuite/Makefile.in: Regenerated.
10428
10429 2010-04-15  Andrew Haley  <aph@redhat.com>
10430
10431         * options.h (merge_exidx_entries): New option.
10432         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
10433         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
10434         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
10435         (Target_arm::merge_exidx_entries): New function.
10436         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
10437         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
10438         to Arm_exidx_fixup constructor.
10439         Add new arg, merge_exidx_entries.
10440         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
10441         Arm_output_section::fix_exidx_coverage.
10442
10443 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
10444
10445         * icf.cc (get_section_contents): Check for preemptible functions.
10446         Ignore addend when appropriate.
10447         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
10448         section folded.
10449         (add_from_relobj): Check for section folded.
10450         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
10451         * symtab.h (should_add_dynsym_entry): Add new parameter.
10452         * target-reloc.h (scan_relocs): Check for section folded.
10453         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
10454         Check reloc types for function pointers in shared objects.
10455         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
10456         case.
10457         (icf_preemptible_functions_test): New test case.
10458         (icf_string_merge_test): New test case.
10459         * testsuite.Makefile.in: Regenerate.
10460         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
10461         bar_glob.  Refactor code.
10462         * testsuite/icf_preemptible_functions_test.cc: New file.
10463         * testsuite/icf_preemptible_functions_test.sh: New file.
10464         * testsuite/icf_string_merge_test.cc: New file.
10465         * testsuite/icf_string_merge_test.sh: New file.
10466         * testsuite/icf_virtual_function_folding_test.cc: New file.
10467         * testsuite/icf_virtual_function_folding_test.sh: New file.
10468
10469 2010-04-14  Doug Kwan  <dougkwan@google.com>
10470
10471         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
10472         for local symbol recounting if we remove a section due to ICF.
10473         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
10474         there are no regular objects in input.
10475
10476 2010-04-13  Doug Kwan  <dougkwan@google.com>
10477
10478         * arm.cc (Arm_input_section::set_final_data_size): Compute
10479         accurate final data size instead of using current data size.
10480
10481 2010-04-09  Doug Kwan  <dougkwan@google.com>
10482
10483         * layout.cc (Layout::choose_output_section): Handle script section
10484         types.
10485         (Layout::make_output_section_for_script): Add section type parameter.
10486         Handle script section types.
10487         * layout.h (Layout::make_output_section_for_script): Add section
10488         type parameter.
10489         * output.cc (Output_section::Output_section): Initialize data member
10490         is_noload_.
10491         (Output_section::do_reset_address_and_file_offset): Do not set address
10492         to 0 if section is a NOLOAD section.
10493         * output.h (Output_section::is_noload): New method.
10494         (Output_section::set_is_noload): Ditto.
10495         (Output_section::is_noload_): New data member.
10496         * script-c.h (Script_section_type): New enum type.
10497         (struct Parser_output_section_header): Add new file section_type.
10498         * script-sections.cc (Sections_element::output_section_name): Add
10499         parameter for returning script section type.
10500         (Output_section_definition::output_section_name): Ditto.
10501         (Output_section_definition::section_type)P; New method.
10502         (Output_section_definiton::script_section_type_name): Ditto.
10503         (Output_section_definition::script_section_type_): New data member.
10504         (Output_section_definition::Output_section_definition): Initialize
10505         data member Output_section_definition::script_section_type_.
10506         (Output_section_definition::create_sections): Pass script section type
10507         to Layout::make_output_section_for_script.
10508         (Output_section_definition::output_section_name): Return script
10509         section type to caller.
10510         (Output_section_definition::set_section_address): Do not advance
10511         dot value and load address if section type is NOLOAD.  Set address
10512         of NOLOAD sections regardless of section flags.
10513         (Output_section_definition::print): Print section type if it is
10514         not SCRIPT_SECTION_TYPE_NONE.
10515         (Output_section_definition::section_type): New method.
10516         (Output_section_definition::script_section_type_name): Ditto.
10517         (Script_sections::output_section_name): Add new parameter
10518         PSECTION_TYPE for returning script section type.  Pass it to
10519         section elements.  Handle discard sections.
10520         (Sort_output_sections::operator()): Handle NOLOAD sections.
10521         * script-sections.h (Script_sections::Section_type): New enum type.
10522         (Script_sections::output_section_name): Add a new parameter for
10523         returning script section type.
10524         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
10525         INFO and NOLOAD.
10526         * yyscript.y (union): Add new field SECTION_TYPE.
10527         (COPY, DSECT, INFO, NOLOAD): New tokens.
10528         (opt_address_and_section_type): Change type to output_section_header.
10529         (section_type): New non-terminal
10530         (section_header): Handle section type.
10531         (opt_address_and_section_type): Return section type value.
10532
10533 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
10534
10535         * testsuite/plugin_common_test_1.c (foo): Add prototype.
10536         * testsuite/plugin_common_test_2.c (foo): Likewise.
10537
10538 2010-04-08  Doug Kwan  <dougkwan@google.com>
10539
10540         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
10541         Output_merge_data.
10542         * output.cc (Output_section::add_merge_input_section): Simplify
10543         code and return status of Output_merge_base::add_input_section.
10544         Update merge section map only if Output_merge_base::add_input_section
10545         returns true.
10546
10547 2010-04-07  Doug Kwan  <dougkwan@google.com>
10548
10549         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
10550         if section is marked as containing instructions but has no mapping
10551         symbols.
10552         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
10553         correct section index.
10554         (Arm_relobj::find_linked_text_section): Ditto.
10555
10556 2010-04-07  Cary Coutant  <ccoutant@google.com>
10557
10558         * archive.cc (include_member): Destroy Read_symbols_data object before
10559         releasing file.
10560         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
10561         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
10562         (Read_symbols_data::~Read_symbols_data) New destructor.
10563         (Section_relocs::Section_relocs) New constructor.
10564         (Section_relocs::~Section_relocs) New destructor.
10565         (Read_relocs_data::Read_relocs_data) New constructor.
10566         (Read_relocs_data::~Read_relocs_data) New destructor.
10567         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
10568         pointers to NULL after deleting.
10569
10570 2010-04-07  Doug Kwan  <dougkwan@google.com>
10571
10572         * arm.cc: Replace "endianity" with "endianness" in comments.
10573         (Arm_exidx_cantunwind): Ditto.
10574         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
10575         (Arm_relobj::merge_flags_and_attributes): New method.
10576         (Arm_relobj::merge_flags_and_attributes_): New data member.
10577         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
10578         (Arm_relobj::scan_sections_for_stubs): Ditto.
10579         (Arm_relobj::do_read_symbols): Check to see if we really want to
10580         merge processor-specific flags and attributes.  Exit early if
10581         an object is empty except for section names and the undefined symbol.
10582         (Target_arm::do_finalize_sections): Move check for ELF format to
10583         Arm_relobj::do_read_symbols.  Merge processor specific flags and
10584         attributes from a regular object only when we have determined that
10585         it is aapropriate.  Do not create an .ARM.attributes section in
10586         output if there is no regular input object.
10587         (Target_arm::merge_processor_specific_flags): Check
10588         --warn-mismatch before printing any error.
10589         (Target_arm::merge_object_attributes): Ditto.
10590         * gold.cc (queue_middle_tasks): Handle the case in which there is
10591         no regular object in input.
10592         * options.cc (General_options::parse_EB): New method.
10593         (General_options::parse_EL): Same.
10594         (General_options::General_options): Initialize endianness_.
10595         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
10596         New options.
10597         (General_options::Endianness): New enum.
10598         (General_options::endianness): New method.
10599         (General_options::endianness_): New data member.
10600         * parameters.cc (Parameters::set_options): Check target endianness.
10601         (Parameters::set_target_once): Ditto.
10602         (Parameters::check_target_endianness): New method.
10603         (parameters_force_valid_target): If either -EL or -EB is specified,
10604         use it to define endianness of default target.
10605         * parameters.h (Parameters::check_target_endianness): New method
10606         declaration.
10607         * target.h (class Target): Change "endianity" to "endianness"
10608         in comments.
10609
10610 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10611
10612         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
10613         * configure: Regenerate.
10614         * Makefile.in: Regenerate.
10615         * testsuite/Makefile.in: Regenerate.
10616
10617 2010-04-06  Cary Coutant  <ccoutant@google.com>
10618
10619         gcc PR lto/42757
10620         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
10621         prevailing definitions of common symbols.
10622         * testsuite/plugin_test_6.sh: New test case.
10623         * testsuite/plugin_common_test_1.c: New test case.
10624         * testsuite/plugin_common_test_2.c: New test case.
10625         * testsuite/Makefile.am (plugin_test_6): New test case.
10626         * testsuite/Makefile.in: Regenerate.
10627
10628 2010-04-06  Nick Clifton  <nickc@redhat.com>
10629
10630         * po/vi.po: New Vietnamese translation.
10631
10632 2010-03-30  Doug Kwan  <dougkwan@google.com>
10633
10634         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
10635
10636 2010-03-25  Doug Kwan  <dougkwan@google.com>
10637
10638         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
10639         to avoid a conversion warning on a 32-bit host.
10640
10641 2010-03-24  Ian Lance Taylor  <iant@google.com>
10642
10643         * testsuite/script_test_3.t: Add a TLS segment.
10644         * testsuite/Makefile.am (check_PROGRAMS): Add
10645         tls_phdrs_script_test.
10646         (tls_phdrs_script_test_SOURCES): Define.
10647         (tls_phdrs_script_test_DEPENDENCIES): Define.
10648         (tls_phdrs_script_test_LDFLAGS): Define.
10649         (tls_phdrs_script_test_LDADD): Define.
10650         * testsuite/Makefile.in: Rebuild.
10651
10652 2010-03-23  Cary Coutant  <ccoutant@google.com>
10653
10654         * fileread.cc (find_or_make_view): Fix comment.
10655
10656 2010-03-23  Ian Lance Taylor  <iant@google.com>
10657
10658         * script-sections.cc (class Orphan_section_placement): Define
10659         PLACE_TLS and PLACE_TLS_BSS.
10660         (Orphan_section_placement::Orphan_section_placement): Initialize
10661         new places.
10662         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
10663         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
10664         (tls_script_test_SOURCES): Define.
10665         (tls_script_test_DEPENDENCIES): Define.
10666         (tls_script_test_LDFLAGS): Define.
10667         (tls_script_test_LDADD): Define.
10668         * testsuite/Makefile.in: Rebuild.
10669
10670 2010-03-22  Doug Kwan  <dougkwan@google.com>
10671
10672         * arm.cc (Arm_relocate_functions::abs8,
10673         Arm_relocate_functions::abs16): Use correct check for overflow
10674         specified in the ARM ELF specs.
10675         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
10676         target of a BLX instruction specially.
10677         (Reloc_stub::stub_type_for_reloc): Ditto.
10678         (Relocate::relocate): Use symbolic names instead of numeric relocation
10679         codes to report error.
10680         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
10681         workaround.
10682         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
10683         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
10684         thumb2_blx_out_of_range.stdout
10685         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
10686         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
10687         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
10688         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
10689         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
10690         thumb2_blx_in_range, thumb2_blx_in_range.o,
10691         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
10692         thumb2_blx_out_of_range.o): New rules.
10693         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
10694         thumb2_blx_in_range and thumb2_blx_out_of_range.
10695         * testsuite/Makefile.in: Regenerate.
10696         * arm_branch_in_range.sh: Add tests for THUMB BLX.
10697         * testsuite/thumb_blx_in_range.s: New file.
10698         * testsuite/thumb_blx_out_of_range.s: New file.
10699
10700 2010-03-22  Rafael Espindola  <espindola@google.com>
10701
10702         * archive.cc (Should_include): Move to archive.h.
10703         (should_include_member): Make it a member of Archive.
10704         (Lib_group): New.
10705         (Add_lib_group_symbols): New.
10706         * archive.h: Include options.h.
10707         (Archive_member): Moved from Archive.
10708         (Should_include): Moved from archive.cc.
10709         (Lib_group): New.
10710         (Add_lib_group_symbols): New.
10711         * dynobj.cc (do_should_include_member): New.
10712         * dynobj.h (do_should_include_member): New.
10713         * gold.cc (queue_initial_tasks): Update call to queue.
10714         * main.cc (main): Print lib group stats.
10715         * object.cc (do_should_include_member): New.
10716         * object.h: Include archive.h.
10717         (Object::should_include_member): New.
10718         (Object::do_should_include_member): New.
10719         (Sized_relobj::do_should_include_member): New.
10720         * options.cc (General_options::parse_start_lib): New.
10721         (General_options::parse_end_lib): New.
10722         (Input_arguments::add_file): Handle lib groups.
10723         (Input_arguments::start_group): Check we are not in a lib.
10724         (Input_arguments::start_lib): New.
10725         (Input_arguments::end_lib): New.
10726         * options.h (General_options): Add start_lib and end_lib.
10727         (Input_argument::lib_): New.
10728         (Input_argument::lib): New.
10729         (Input_argument::is_lib): New.
10730         (Input_file_lib): New.
10731         (Input_arguments::in_lib_): New.
10732         (Input_arguments::in_lib): New.
10733         (Input_arguments::start_lib): New.
10734         (Input_arguments::end_lib_): New.
10735         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
10736         in unused members as preempted.
10737         (Sized_pluginobj::do_should_include_member): New.
10738         * plugin.h (Sized_pluginobj::do_should_include_member): New.
10739         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
10740         return the blocker.
10741         (Read_symbols::do_whole_lib_group): New.
10742         (Read_symbols::do_lib_group): New.
10743         (Read_symbols::do_read_symbols): Handle lib groups.
10744         (Read_symbols::get_name): Handle lib groups.
10745         * readsyms.h (Read_symbols): Add an archive member pointer.
10746         (Read_symbols::do_whole_lib_group): New.
10747         (Read_symbols::do_lib_group): New.
10748         (Read_symbols::member_): New.
10749         * script.cc (read_input_script): Update call to queue_soon.
10750
10751 2010-03-19  Doug Kwan  <dougkwan@google.com>
10752
10753         * arm.cc (Stub_table::Stub_table): Initialize new data members
10754         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10755         (Stub_table::add_reloc_stub): Assign stub offset and update
10756         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10757         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
10758         New data members.
10759         (Stub_table::update_data_size_and_addralign): Use
10760         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
10761         instead of going over all reloc stubs.
10762         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
10763         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10764         Stringpool_template::offset_ to size of Stringpool_char.
10765         (Stringpool_template::new_key_offset): Remove code to initialize
10766         Stringpool_template::offset_.
10767         * stringpool.h (Stringpool_template::set_no_zero_null): Set
10768         Stringpool_template::offset_ to zero.
10769
10770 2010-03-15  Doug Kwan  <dougkwan@google.com>
10771
10772         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10773         offset_.
10774         (Stringpool_template::new_key_offset): New method.
10775         (Stringpool_template::add_string): Assign offsets when adding new
10776         strings.
10777         (Stringpool_template::set_string_offsets): Do not set string offsets
10778         when not optimizing.
10779         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
10780         member size_.
10781         (Chunked_vector::clear): Clear size_.
10782         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
10783         (Chunked_vector::size): Return size_.
10784         (Chunked_vector::push_back): Use size_ to find insert position.
10785         (Chunked_vector::size_): New data member.
10786         (Stringpool_template::set_no_zero_null): Assert string set is empty.
10787         (Stringpool_template::new_key_offset): New method declaration.
10788         (Stringpool_template::offset_): New data member.
10789
10790 2010-03-15   Rafael Espindola  <espindola@google.com>
10791
10792         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
10793         Add_symbols' constructor.
10794         * readsyms.h (Add_symbols): Remove the input_group member.
10795
10796 2010-03-10  Ian Lance Taylor  <iant@google.com>
10797
10798         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
10799         target to ask whether a reference to a symbol requires a stack
10800         split.
10801         * target.h (Target::is_call_to_non_split): New function.
10802         (Target::do_is_call_to_non_split): Declare virtual function.
10803         * target.cc: Include "symtab.h".
10804         (Target::do_is_call_to_non_split): New function.
10805         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
10806
10807 2010-03-10  Cary Coutant  <ccoutant@google.com>
10808
10809         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
10810         (File_read::open[1]): Remove initial mapping of whole_file_view_.
10811         (File_read::open[2]): Add whole_file_view_ to list of views.
10812         (File_read::make_view): Remove test of whole_file_view_.
10813         (File_read::find_or_make_view): Create whole_file_view_ if
10814         necessary.
10815         (File_read::clear_views): Replace bool parameter with enum;
10816         adjust all callers.  Don't delete views with permanent data;
10817         do delete cached views and views from archives if
10818         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
10819         if clearing the corresponding view.
10820         * fileread.h (File_read::Clear_views_mode): New enum.
10821         (File_read::View::is_permanent_view): New method.
10822         (File_read::clear_views): Replace bool parameter
10823         with enum; adjust all callers.
10824         * options.h (General_options): Change keep_files_mapped option;
10825         add map_whole_files.
10826         * readsyms.cc (Add_symbols::run): Delete sd_ object before
10827         releasing the file.
10828         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
10829         the file.
10830
10831 2010-03-10  David S. Miller  <davem@davemloft.net>
10832
10833         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
10834
10835 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
10836
10837         * icf.cc (get_section_contents): Add '@' marker after processing the
10838         merge reloc.
10839
10840 2010-03-08  Doug Kwan  <dougkwan@google.com>
10841
10842         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
10843         due to a conversion warning.
10844         (Arm_relobj::update_output_local_symbol_count): Check for local
10845         symbol with unset output index.
10846
10847 2010-03-05  Ian Lance Taylor  <iant@google.com>
10848
10849         * options.h (class General_options): Add --spare-dynamic-tags.
10850         * output.cc (Output_data_dynamic::set_final_data_size): Implement
10851         --spare-dynamic-tags.
10852
10853 2010-03-05  Ian Lance Taylor  <iant@google.com>
10854
10855         * incremental.cc: Include "libiberty.h".
10856
10857 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
10858
10859         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
10860         function, is_info_ member.
10861         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
10862         (Versions::Versions): Update caller.
10863         (Versions::define_base_version): Likewise.
10864         (Versions::add_def): Likewise.
10865
10866 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
10867
10868         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
10869         (Scan::possible_function_pointer_reloc): New function.
10870         (Scan::local_reloc_may_be_function_pointer): Change to call
10871         possible_function_pointer_reloc.
10872         (Scan::global_reloc_may_be_function_pointer): Ditto.
10873         * icf.h (Icf::check_section_for_function_pointers): Change to reject
10874         relocations in ".data.rel.ro._ZTV" section.
10875         * testsuite/icf_safe_so_test.sh: Change to pass i386.
10876         * testsuite/icf_safe_so_test.cc: Ditto.
10877         * testsuite/icf_safe_test.cc: Ditto.
10878         * testsuite/icf_safe_test.sh: Ditto.
10879
10880 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10881             Ian Lance Taylor  <iant@google.com>
10882
10883         * target-reloc.h (relocate_section): Check the symbol table index
10884         for -1U before setting the local symbol index.
10885         (scan_relocatable_relocs): If copying the relocation, record that
10886         the local symbol is required.
10887         * object.h (Symbol_value::is_output_symtab_index_set): New
10888         function.
10889         (Symbol_value::may_be_discarded_from_output_symtab): New
10890         function.
10891         (Symbol_value::has_output_symtab_entry): New function.
10892         (Symbol_value::needs_output_symtab_entry): Remove.
10893         (Symbol_value::output_symtab_index): Make sure the symbol index is
10894         set.
10895         (Symbol_value::set_output_symtab_index): Make sure the symbol
10896         index is not set.  Make sure the new index is valid.
10897         (Symbol_value::set_must_have_output_symtab_entry): New function.
10898         (Symbol_value::has_output_dynsym_entry): New function.
10899         (Symbol_value::set_output_dynsym_index): Make sure the new index
10900         is valid.
10901         (Sized_relobj::set_must_have_output_symtab_entry): New function.
10902         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
10903         local symbol if permitted.
10904         (Sized_relobj::do_finalize_local_symbols): Call
10905         is_output_symtab_index_set rather than needs_output_symtab_entry.
10906         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
10907         rather than needs_output_symtab_entry.  Call
10908         has_output_dynsym_entry rather than needs_output_dynsym_entry.
10909         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
10910         is_output_symtab_index_set rather than needs_output_symtab_entry.
10911         * testsuite/discard_locals_relocatable_test.c: New file.
10912         * testsuite/discard_locals_test.sh: Test -r.
10913         * testsuite/Makefile.am (check_DATA): Add
10914         discard_locals_relocatable_test1.syms,
10915         discard_local_relocatable_test2.syms.
10916         (MOSTLYCLEANFILES): Likewise.  Also add
10917         discard_locals_relocatable_test1.lout and
10918         discard_locals_relocatable_test2.out.
10919         (discard_locals_relocatable_test1.syms): New target.
10920         (discard_locals_relocatable_test.o): New target.
10921         (discard_locals_relocatable_test1.out): New target.
10922         (discard_locals_relocatable_test2.syms): New target.
10923         (discard_locals_relocatable_test2.out): New target.
10924         (various): Add missing ../ld-new dependencies.
10925         * testsuite/Makefile.in: Rebuild.
10926
10927 2010-03-03  Nick Clifton  <nickc@redhat.com>
10928
10929         * po/fi.po: New Finnish translation.
10930
10931 2010-03-01  Doug Kwan  <dougkwan@google.com>
10932
10933         * layout.cc (Layout::Layout): Force section types of .init_array*,
10934         .preinit_array* and .fini_array* sections.
10935         * output.cc (Output_section::Input_section_sort_entry::has_priority):
10936         Fix check of return value of std::string::find.().
10937         (Output_section::Input_section_sort_compare::operator()): Remove
10938         comment about .init_array.
10939         (Output_section::Input_section_sort_init_fini_compare::operator()):
10940         New method.
10941         (Output_section::sort_attached_input_sections): Handle .init_array
10942         and .fini_array specially.
10943         * output.h (Output_section::Inut_section_sort_compare): Update
10944         comment.
10945         (Output_section::Input_section_sort_init_fini_compare): New struct.
10946
10947 2010-02-26  Doug Kwan  <dougkwan@google.com>
10948
10949         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
10950         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
10951         * testsuite/debug_msg.sh: Avoid matching source line number for
10952         use of global variable undef_int.
10953
10954 2010-02-26  Doug Kwan  <dougkwan@google.com>
10955
10956         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
10957         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
10958         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
10959         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
10960         * options.cc (General_options::General_options): Initialize member
10961         fix_v4bx_.
10962         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
10963         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
10964         and rm_no_fix_v4bx.stdout
10965         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
10966         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
10967         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
10968         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
10969         and arm_no_fix_v4bx.
10970         * Makefile.in: Regenerate.
10971         * testsuite/arm_fix_v4bx.s: New file.
10972         * testsuite/arm_fix_v4bx.sh: Ditto.
10973
10974 2010-02-24  Doug Kwan  <dougkwan@google.com>
10975
10976         * arm.cc (Target_arm::got_section): Make the .got section the first
10977         non RELRO section in the data segment.
10978         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
10979         suffixes of section names.
10980
10981 2010-02-24  Doug Kwan  <dougkwan@google.com>
10982
10983         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
10984         flags and attributes merging if an input file is a binary file.
10985         * fileread.cc (Input_file::open): Record format of original file.
10986         * fileread.h (Input_file::Format): New enum type.
10987         (Input_file::Input_file): Initialize data member format_.
10988         (Input_file::format): New method definition.
10989         (Input_file::format_):: New data member.
10990
10991 2010-02-24  Doug Kwan  <dougkwan@google.com>
10992
10993         * arm.cc (Arm_output_data_got): New class.
10994         (ARM_TCB_SIZE): New constant
10995         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
10996         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10997         If user uses a script with a SECTIONS clause, issue only a warning
10998         for a misplaced EXIDX input section.  Otherwise, issue an error.
10999         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
11000         garbage collection.
11001         (Target_arm::got_mode_index_entry): Handle static linking.
11002         (Target_arm::Scan::local): Ditto.
11003         (Target_arm::Scan::global): Ditto.
11004         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
11005         all incorrectly implemented relocations.
11006         (Target_arm::fix_exidx_coverage): Pass layout to
11007         Arm_output_section::fix_exidx_coverage.
11008         * layout.cc (Layout::section_name_mapping): Remove trailing dots
11009         from ".ARM.exidx." and ".ARM.extab.".
11010
11011 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11012
11013         * arm.cc (Target_arm::do_finalize_sections): Create attribute
11014         section if it does not already exist.
11015         * attributes.cc (Attributes_section_data::Attributes_section_data):
11016         Don't crash if size is zero.
11017
11018 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11019             Ian Lance Taylor  <iant@google.com>
11020
11021         * gold.cc (queue_middle_tasks): If no input files were opened,
11022         exit.
11023         * workqueue.h (Task_function::Task_function): Assert that there is
11024         a blocker.
11025
11026 2010-02-22  Doug Kwan  <dougkwan@google.com>
11027
11028         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
11029         * icf.cc (get_section_contents): Cast snprintf arguments to long long
11030         types to avoid warnings due to different uint64_t implementations
11031         on different hosts.
11032
11033 2010-02-21  Doug Kwan  <dougkwan@google.com>
11034
11035         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
11036         handling of the maximum backward branch offset.
11037         (Arm_relocate_functions::thumb_branch_common): Ditto.
11038         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
11039         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
11040         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
11041         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
11042         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
11043         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
11044         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
11045         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
11046         thumb_bl_out_of_range thumb_bl_out_of_range.o,
11047         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
11048         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
11049         thumb2_bl_out_of_range.o): New rules.
11050         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
11051         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
11052         thumb2_bl_out_of_range
11053         * testsuite/Makefile.in: Regenerate.
11054         * testsuite/arm_bl_in_range.s: New file.
11055         * testsuite/arm_bl_out_of_range.s: Ditto.
11056         * testsuite/arm_branch_in_range.sh: Ditto.
11057         * testsuite/arm_branch_range.t: Ditto.
11058         * testsuite/thumb2_branch_range.t: Ditto.
11059         * testsuite/thumb_bl_in_range.s: Ditto.
11060         * testsuite/thumb_bl_out_of_range.s: Ditto.
11061         * testsuite/thumb_branch_range.t: Ditto.
11062
11063 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
11064
11065         * gc.h (gc_process_relocs): Change vectors to point to the new list.
11066         Add reloc offset information.
11067         * icf.cc (get_section_contents): Change iterators to point to the new
11068         vectors. Add reloc offset information to the contents.
11069         * icf.h (Icf::Sections_reachable_info): New typedef.
11070         (Icf::Sections_reachable_list): New typedef.
11071         (Icf::Offset_info): New typedef.
11072         (Icf::Reloc_info): New struct typedef.
11073         (Icf::Reloc_info_list): New typedef.
11074         (Icf::symbol_reloc_list): Delete method.
11075         (Icf::addend_reloc_list): Delete method.
11076         (Icf::section_reloc_list): Delete method.
11077         (Icf::reloc_info_list): New method.
11078         (Icf::reloc_info_list_): New member.
11079
11080 2010-02-19  Doug Kwan  <dougkwan@google.com>
11081
11082         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
11083         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
11084         * arm.cc (Arm_relocation_functions): New forward declaration.
11085         (Target_arm::Target_arm): Initialize new data members
11086         got_mod_index_offset_ and tls_base_symbol_defined_.
11087         (Target_arm::Relocate::relocate_tls): New method.
11088         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
11089          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
11090         New methods.
11091         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
11092         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
11093         (Target_arm::got_mod_index_offset_,
11094         Target_arm::tls_base_symbol_defined_): New data members.
11095         (Target_arm::Scan::local, Target::Scan::global,
11096         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
11097         relocations.
11098
11099 2010-02-18  Doug Kwan  <dougkwan@google.com>
11100
11101         * arm.cc (Arm_relobj::find_linked_text_section): New method.
11102         (Arm_relobj::make_exidx_input_section): Pass section index of linked
11103         text section as a parameter becuase some broken tools may not set
11104         the link in section header.
11105         (Target_arm::has_got_section): New method.
11106         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
11107         without any mapping symbol as data only.  Remove warning.
11108         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
11109         link in its section header, try to discover the link by inspecting the
11110         REL31 relocation at the beginning of the section.
11111         (Target_arm::Scan::check_non_pic): Report name of offending relocation
11112         in error message.
11113         (Target_arm::Scan::global): Treat any reference to the symbol
11114         _GLOBAL_OFFSET_TABLE_ as a GOT access.
11115
11116 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
11117
11118         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
11119         (Scan::global_reloc_may_be_function_pointer): New function.
11120         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
11121         (Scan::global_reloc_may_be_function_pointer): New function.
11122         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
11123         (Scan::global_reloc_may_be_function_pointer): New function.
11124         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
11125         (Scan::global_reloc_may_be_function_pointer): New function.
11126         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
11127         (Scan::global_reloc_may_be_function_pointer): New function.
11128         (Scan::possible_function_pointer_reloc): New function.
11129         (Target_x86_64::can_check_for_function_pointers): New function.
11130         * gc.h (gc_process_relocs): Scan relocation types to determine if
11131         function pointers were taken for targets that support it.
11132         * icf.cc (Icf::find_identical_sections): Include functions for
11133         folding in safe ICF whose pointer is not taken.
11134         * icf.h (Secn_fptr_taken_set): New typedef.
11135         (fptr_section_id_): New member.
11136         (section_has_function_pointers): New function.
11137         (set_section_has_function_pointers): New function.
11138         (check_section_for_function_pointers): New function.
11139         * options.h: Fix comment for safe ICF option.
11140         * target.h (can_check_for_function_pointers): New function.
11141         * testsuite/Makefile.am: Add icf_safe_so_test test case.
11142         Modify icf_safe_test for X86-64.
11143         * testsuite/Makefile.in: Regenerate.
11144         * testsuite/icf_safe_so_test.cc: New file.
11145         * testsuite/icf_safe_so_test.sh: New file.
11146         * testsuite/icf_safe_test.cc (kept_func_3): New function.
11147         (main): Change to take pointer to function kept_func_3.
11148         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
11149         folding is done correctly for X86-64.
11150
11151 2010-02-12  David S. Miller  <davem@davemloft.net>
11152
11153         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
11154         is_symbolless parameter.
11155         (Output_reloc<SHT_REL>::is_symbolless): New.
11156         (Output_reloc<SHT_REL>::is_symbolless_): New.
11157         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
11158         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
11159         (Output_reloc<SHT_RELA>::is_symbolless): New.
11160         (Output_data_reloc::add_global): Handle is_symbolless.
11161         (Output_data_reloc::add_global_relative): Likewise.
11162         (Output_data_reloc::add_local): Likewise.
11163         (Output_data_reloc::add_local_relative): Likewise.
11164         (Output_data_reloc::add_symbolless_global_addend): New.
11165         (Output_data_reloc::add_symbolless_local_addend): New.
11166         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
11167         is_symbolless.
11168         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
11169         instead of ->is_relative_
11170         (Output_reloc::write): Likewise.
11171         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
11172         (Output_reloc::write_rel): Simplify.
11173
11174         * sparc.cc (Target_sparc::Scan::local): Use
11175         ->add_symbolless_local_addend as needed.
11176         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
11177         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
11178         based upon relocation offset.
11179
11180 2010-02-11  Doug Kwan  <dougkwan@google.com>
11181
11182         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
11183         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
11184         beginning of function.
11185         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
11186         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
11187         parameter is_32bit in calls to should_apply_static_reloc.
11188         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
11189         (check_DATA): Add arm_abs_global.stdout.
11190         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
11191         arm_abs_global.stdout): New rules.
11192         (MOSTLLYCLEANFILES): Add arm_abs_global
11193         * Makefile.in: Regenerate.
11194         * testsuite/arm_abs_global.s: New file.
11195         * testsuite/arm_abs_global.sh: Ditto.
11196         * testsuite/arm_abs_lib.s: Ditto.
11197
11198 2010-02-11  Ian Lance Taylor  <iant@google.com>
11199
11200         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
11201         Read_relocs task.
11202         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
11203         Allocate_commons_task first.
11204         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
11205         task, rather than symtab_lock_.
11206         (Gc_process_relocs::~Gc_process_relocs): New function.
11207         (Gc_process_relocs::is_runnable): Check this_blocker_.
11208         (Gc_process_relocs::locks): Use next_blocker_ rather than
11209         blocker_.
11210         (Scan_relocs::~Scan_relocs): New function.
11211         (Scan_relocs::is_runnable): Check this_blocker_ rather than
11212         symtab_lock_.
11213         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
11214         next_blocker_.
11215         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
11216         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
11217         constructor accordingly.
11218         (class Gc_process_relocs): Likewise.
11219         (class Scan_relocs): Likewise.
11220         * common.h (class Allocate_commons_task): Remove symtab_lock_
11221         field, and corresponding constructor parameter.
11222         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
11223         symtab_lock_.
11224         (Allocate_commons_task::locks): Likewise.
11225
11226 2010-02-11  Ian Lance Taylor  <iant@google.com>
11227
11228         * gold-threads.h (class Once): Define.
11229         (class Initialize_lock): Rewrite as child of Once.
11230         * gold-threads.cc (class Once_initialize): Define.
11231         (once_pointer_control): New static variable.
11232         (once_pointer, once_arg): New static variables.
11233         (c_run_once): New static function.
11234         (Once::Once, Once::run_once, Once::internal_run): New functions.
11235         (class Initialize_lock_once): Remove.
11236         (initialize_lock_control): Remove.
11237         (initialize_lock_pointer): Remove.
11238         (initialize_lock_once): Remove.
11239         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
11240         (Initialize_lock::initialize): Rewrite.
11241         (Initialize_lock::do_run_once): New function.
11242         * archive.cc (Archive::interpret_header): Only clear name if it is
11243         not already empty.
11244         * fileread.cc: Include "gold-threads.h"
11245         (file_counts_lock): New static variable.
11246         (file_counts_initialize_lock): Likewise.
11247         (File_read::release): Only increment counts when using --stats.
11248         Use a lock around the increment.
11249         * parameters.cc (class Set_parameters_target_once): Define.
11250         (set_parameters_target_once): New static variable.
11251         (Parameters::Parameters): Move here from parameters.h.
11252         (Parameters::set_target): Rewrite.
11253         (Parameters::set_target_once): New function.
11254         (Parameters::clear_target): Move here and rewrite.
11255         * parameters.h (class Parameters): Update declarations.  Add
11256         set_parameters_target_once_ field.
11257         (Parameters::Parameters): Move to parameters.cc.
11258         (Parameters::clear_target): Likewise.
11259         * readsyms.cc (Read_symbols::do_group): Create a Start_group
11260         task.
11261         (Start_group::~Start_group): New function.
11262         (Start_group::is_runnable): New function.
11263         (Start_group::locks, Start_group::run): New functions.
11264         (Finish_group::run): Change saw_undefined to size_t.
11265         * readsyms.h (class Start_group): Define.
11266         (class Finish_group): Change saw_undefined_ field to size_t.
11267         (Finish_group::Finish_group): Remove saw_undefined and
11268         this_blocker parameters.  Change all callers.
11269         (Finish_group::set_saw_undefined): New function.
11270         (Finish_group::set_blocker): New function.
11271         * symtab.h (class Symbol_table): Change saw_undefined to return
11272         size_t.  Change saw_undefined_ field to size_t.
11273         * target-select.cc (Set_target_once::do_run_once): New function.
11274         (Target_selector::Target_selector): Initialize set_target_once_
11275         field.  Don't initialize lock_ and initialize_lock_ fields.
11276         (Target_selector::instantiate_target): Rewrite.
11277         (Target_selector::set_target): New function.
11278         * target-select.h (class Set_target_once): Define.
11279         (class Target_selector): Update declarations.  Make
11280         Set_target_once a friend.  Remove lock_ and initialize_lock_
11281         fields.  Add set_target_once_ field.
11282
11283 2010-02-10  Ian Lance Taylor  <iant@google.com>
11284
11285         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
11286         queueing any tasks.
11287         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
11288         (queue_middle_tasks): Add all blockers before queueing any tasks.
11289         (queue_final_tasks): Likewise.
11290         * token.h (Task_token::add_blockers): New function.
11291         * object.h (Input_objects::number_of_relobjs): New function.
11292
11293 2010-02-10  Ian Lance Taylor  <iant@google.com>
11294
11295         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
11296         shared, not if not position independent.
11297         * x86_64.cc (Relocate::relocate_tls): Likewise.
11298         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
11299         (tls_pie_pic_test): New target.
11300         * testsuite/Makefile.in: Rebuild.
11301
11302         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
11303         (tls_test_main_pie.o, tls_test_pie.o): New targets.
11304         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
11305         * testsuite/Makefile.in: Rebuild.
11306
11307 2010-02-09  David S. Miller  <davem@davemloft.net>
11308
11309         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
11310         R_SPARC_RELATIVE using ->add_local_relative().
11311         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
11312
11313         * output.h (Output_data_dynamic::add_section_size): New method
11314         that takes two Output_data objects.
11315         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
11316         entry param.  Handle it in initializers.
11317         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
11318         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
11319         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
11320         arg.
11321         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
11322         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
11323         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
11324         for dynrel_includes_plt.
11325         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11326         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11327         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
11328         before .rela.plt
11329         (Target_sparc::do_finalize_sections): Update to pass true for
11330         dynrel_includes_plt.
11331         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
11332         output before .rela.plt
11333         (Target_powerpc::do_finalize_sections): Update to pass true for
11334         dynrel_includes_plt when 32-bit.
11335
11336 2010-02-08  Doug Kwan  <dougkwan@google.com>
11337
11338         * arm.cc (Arm_relobj::simple_input_section_output_address): New
11339         method.
11340         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
11341         Arm_relobj::scan_section_for_cortex_a8_stubs,
11342         Arm_relobj::do_relocation_section): Instead of calling
11343         Output_section::output_address, use faster
11344         Arm_relobj::simple_input_section_output_address.
11345
11346 2010-02-08  David S. Miller  <davem@davemloft.net>
11347
11348         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
11349         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
11350         relocation helper function.
11351
11352         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
11353         just like R_SPARC_GOT{10,13,22}.
11354         (Target_sparc::Scan::local): Likewise.
11355         (Target_sparc::Relocate:relocate): Likewise.
11356
11357 2010-02-06  Ian Lance Taylor  <iant@google.com>
11358
11359         * configure.ac: Rewrite targetobjs duplicate removal code to use
11360         only shell constructs.
11361         * configure: Rebuild.
11362
11363 2010-02-05  Doug Kwan  <dougkwan@google.com>
11364
11365         PR 11247
11366         * arm.cc (Arm_relobj::section_is_scannable): New method.
11367         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
11368         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
11369
11370 2010-02-04  Doug Kwan  <dougkwan@google.com>
11371
11372         PR 11247
11373         * arm-reloc-property.cc (cstdio): Include.
11374         * configure.ac (targetobjs): Remove duplicates.
11375         * configure: Regenerate.
11376         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
11377         big and little endian version for a given address size.
11378
11379 2010-02-03  Doug Kwan  <dougkwan@google.com>
11380
11381         * arm-reloc-property.cc
11382         (Arm_reloc_property_table::reloc_name_in_error_message): New method
11383         definition.
11384         * arm-reloc-property.h
11385         (Arm_reloc_property_table::get_implemented_static_reloc_property):
11386         New method definition.
11387         (Arm_reloc_property_table::reloc_name_in_error_message): New method
11388         declaration.
11389         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
11390         overflow to N.
11391         (GOT_PREL): Change implemented to Y.
11392         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
11393         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
11394         (Arm_relocate_functions::movw_abs_nc): Remove method.
11395         (Arm_relocate_functions::movt_abs): Ditto.
11396         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
11397         (Arm_relocate_functions::thm_movt_abs): Ditto.
11398         (Arm_relocate_functions::movw_rel_nc): Ditto.
11399         (Arm_relocate_functions::movw_rel): Ditto.
11400         (Arm_relocate_functions::movt_rel): Ditto.
11401         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
11402         (Arm_relocate_functions:thm_movw_rel): Ditto.
11403         (Arm_relocate_functions:thm_movt_rel): Ditto.
11404         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
11405         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
11406         New method definitions.
11407         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
11408         (Arm_relocation_functions::arm_grp_ldr): Ditto.
11409         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
11410         (Arm_relocation_functions::arm_grp_ldc): Ditto.
11411         (Target_arm::Relocate::relocate): Check for non-static or
11412         unimplemented relocation code and exit early.  Change calls to
11413         Target_arm::reloc_uses_thumb_bit and
11414         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
11415         instead.  Refactor code to handle similar relocations to increase
11416         code sharing.  Remove check for unsupported relocation code in switch
11417         statement.
11418         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
11419         relocation property table to find out size.  Change error message to
11420         print out the name of a relocation code instead of the numeric value.
11421         (Target_arm::scan_reloc_for_stub): Use relocation property table
11422         instead of calling Target_arm::reloc_uses_thumb_bit().
11423
11424 2010-02-02  Doug Kwan  <dougkwan@google.com>
11425
11426         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
11427         types of relaxed input section.
11428
11429 2010-02-02  Doug Kwan  <dougkwan@google.com>
11430
11431         * Makefile.am (HFILES): Add arm-reloc-property.h.
11432         (DEFFILES): New.
11433         (TARGETSOURCES): Add arm-reloc-property.cc
11434         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
11435         (libgold_a_SOURCES): $(DEFFILES)
11436         * Makefile.in: Regenerate.
11437         * arm-reloc-property.cc: New file.
11438         * arm-reloc-property.h: New file.
11439         * arm-reloc.def: New file.
11440         * arm.cc: Update comments.
11441         (arm-reloc-property.h): New included header.
11442         (arm_reloc_property_table): New global variable.
11443         (Target_arm::do_select_as_default_target): New method definition.
11444         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
11445         arm-reloc-property to targ_extra_obj.
11446         * parameters.cc (set_parameters_target): Call
11447         Target::select_as_default_target().
11448         * target.h (Target::select_as_default_target): New method definition.
11449         (Target::do_select_as_default_target): Same.
11450
11451 2010-02-01  Doug Kwan  <dougkwan@google.com>
11452
11453         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
11454         first_output_text_section_.
11455         (Arm_exidx_fixup::first_output_text_section): New method definition.
11456         (Arm_exidx_fixup::first_output_text_section_): New data member.
11457         (Arm_exidx_fixup::process_exidx_section): Record the first text
11458         output section seen.
11459         (Arm_output_section::fix_exidx_coverage): Set correct linked section
11460         and entsize in output section header.
11461
11462 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11463
11464         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
11465         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
11466         (Arm_relocate_functions::thm_alu11): New Method.
11467         (Arm_relocate_functions::thm_pc8): New Method.
11468         (Arm_relocate_functions::thm_pc12): New Method.
11469         (Target_arm::Scan::local): Handle the relocations.
11470         (Target_arm::Scan::global): Likewise.
11471         (Target_arm::Relocate::relocate): Likewise.
11472         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11473
11474 2010-01-29  Doug Kwan  <dougkwan@google.com>
11475
11476         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
11477         of relocation types as ld.
11478
11479 2010-01-29  Doug Kwan  <dougkwan@google.com>
11480
11481         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
11482         to public.
11483         (Arm_relocate_functions::thumb_branch_common): Ditto.
11484         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
11485         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
11486         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
11487         Arm_relocate_functions::jump24): Remove.
11488         (Target_arm::Relocate::relocate): Adjust code to call
11489         Arm_relocation_functions::arm_branch_common and
11490         Arm_relocation_functions::thumb_branch_common instead of their removed
11491         wrappers.  Merge switch-cases together to reduce source code size.
11492
11493 2010-01-29  Doug Kwan  <dougkwan@google.com>
11494
11495         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
11496         output_local_symbol_count_needs_update_.
11497         (Arm_relobj::output_local_symbol_count_needs_update,
11498          Arm_relobj::set_output_local_symbol_count_needs_update,
11499          Arm_relobj::update_output_local_symbol_count): New methods.
11500         (Arm_relobj::output_local_symbol_count_needs_update_): New data
11501         member.
11502         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
11503         of pointed function as in a R_ARM_PREL31 relocation.
11504         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
11505         for output local symbol count updating.
11506         (Target_arm::do_relax): Update output local symbol counts in objects
11507         if necessary.
11508         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
11509
11510 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11511
11512         * arm.cc: Added support for the ARM relocations:
11513         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
11514         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
11515         (Arm_relocate_functions::movw_rel_nc): Renamed (was
11516         movw_prel_nc).
11517         (Arm_relocate_functions::movw_rel): New method.
11518         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
11519         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
11520         thm_movw_prel_nc).
11521         (Arm_relocate_functions::thm_movw_rel): New method.
11522         (Arm_relocate_functions::thm_movt_rel): Renamed (was
11523         thm_movt_prel).
11524         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
11525         relocations.
11526         (Target_arm::Scan::global): Likewise.
11527         (Target_arm::Relocate::relocate): Likewise.
11528         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11529         Likewise.
11530
11531 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11532
11533         * arm.cc: Added support for ARM group relocations.
11534         (Target_arm::reloc_needs_sym_origin): New method.
11535         (Arm_relocate_functions::calc_grp_kn): New method.
11536         (Arm_relocate_functions::calc_grp_residual): New method.
11537         (Arm_relocate_functions::calc_grp_gn): New method.
11538         (Arm_relocate_functions::arm_grp_alu): New Method.
11539         (Arm_relocate_functions::arm_grp_ldr): New Method.
11540         (Arm_relocate_functions::arm_grp_ldrs): New Method.
11541         (Arm_relocate_functions::arm_grp_ldc): New Method.
11542         (Target_arm::Scan::local): Handle the ARM group relocations.
11543         (Target_arm::Scan::global): Likewise.
11544         (Target_arm::Relocate::relocate): Likewise.
11545         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11546         Likewise.
11547
11548 2010-01-26  Doug Kwan  <dougkwan@google.com>
11549
11550         * arm.cc (set): Include.
11551         (class Arm_exidx_fixup): Change type of last_input_section_ to const
11552         pointer type.
11553         (Arm_output_section::Text_section_list): New type.
11554         (Arm_output_section::append_text_sections_to_list): New method.
11555         (Arm_output_section::fix_exidx_coverage): Ditto.
11556         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
11557         (Arm_relobj::convert_input_section_to_relaxed_section): Use
11558         Relobj::set_section_offset() instead of
11559         Sized_relobj::invalidate_section_offset().
11560         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
11561         parameter for section headers. Ignore relocation sections for
11562         unallocated sections and EXIDX sections.
11563         (Target_arm::fix_exidx_coverage): New method.
11564         (Target_arm::output_section_address_less_than): New type.
11565         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
11566         linked text section instead of the EXIDX section.
11567         (Arm_output_section::create_stub_group): Add an assertion to check
11568         that this is not an EXIDX output section.
11569         (Arm_output_section::append_text_sections_to_list): New method.
11570         (Arm_output_section::fix_exidx_coverage): Ditto.
11571         (Arm_relobj::scan_sections_for_stubs): Adjust call to
11572         Arm_relobj::section_needs_reloc_stub_scanning.
11573         (Target_arm::do_relax): Fix EXIDX output section coverage in the
11574         first pass.
11575         (Target_arm::fix_exidx_coverage): New method.
11576         * object.h (Relobj::set_output_section): New method.
11577         (Sized_relobj::invalidate_section_offset): Remove method.
11578         (Sized_relobj::do_invalidate_section_offset): Remove method.
11579         (Sized_relobj::do_set_section_offset): Handle offset value -1.
11580
11581 2010-01-25  Doug Kwan  <dougkwan@google.com>
11582
11583         * arm.cc (Arm_exidx_merged_section::do_output_offset):
11584         Fix warning due to signed and unsigned comparison on a 32-bit host.
11585
11586 2010-01-22  Doug Kwan  <dougkwan@google.com>
11587
11588         * arm.cc (Target_arm::do_relax): Record an output section for section
11589         offset adjustment it contains any stub table that has changed.
11590         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
11591         offsets in an output section if necessary.
11592         * output.cc (Output_section::Output_section): Initialize
11593         section_offsets_need_adjustments_.
11594         (Output_section::add_input_section_for_script): Renamed to
11595         Output_section::add_simple_input_section.
11596         (Output_section::save_states): Add a comment.
11597         (Output_section::discard_states): New method defintion.
11598         (Output_section::adjust_section_offsets): Same.
11599         * output.h (Output_section::add_input_section_for_script): Renamed to
11600         Output_section::add_simple_input_section.
11601         (Output_section::discard_states): New method declaration.
11602         (Output_section::adjust_section_offsets): Same.
11603         (Output_section::section_offsets_need_adjustment,
11604         Output_section::set_section_offsets_need_adjustment): New method
11605         definitions.
11606         (Output_section::section_offsets_need_adjustment_): New data member.
11607         * script-sections.cc
11608         (Output_section_element_input::set_section_address): Adjust code for
11609         renaming of Output_section::add_input_section_for_script.
11610         (Orphan_output_section::set_section_address): Same.
11611
11612 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11613
11614         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
11615         Fix_v4bx enum values .
11616         * gold/options.h (General_options): New option definitions.
11617         (General_options::fix_v4bx): New method.
11618         (General_options::Fix_v4bx): New enum.
11619         * gold/options.cc (General_options::parse_fix_v4bx): New method.
11620         (General_options::parse_fix_v4bx_interworking): New method.
11621
11622 2010-01-22  Doug Kwan  <dougkwan@google.com>
11623
11624         * arm.cc (Arm_exidx_fixup): New class.
11625
11626 2010-01-21  Doug Kwan  <dougkwan@google.com>
11627
11628         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
11629         classes.
11630         (Arm_exidx_section_offset_map): New type.
11631
11632 2010-01-21  Doug Kwan  <dougkwan@google.com>
11633
11634         * arm.cc (Arm_exidx_input_section): New class.
11635         (Arm_relobj::exidx_input_section_by_link,
11636         Arm_relobj::exidx_input_section_by_shndx,
11637         Arm_relobj::make_exidx_input_section): New methods.
11638         (read_arm_attributes_section): Remove.
11639         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
11640         information about them.
11641         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
11642         to here.
11643
11644 2010-01-20  Doug Kwan  <dougkwan@google.com>
11645
11646         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
11647         Input_section_specifier to Section_id.
11648         (Target_arm::new_arm_input_section: Adjust code for change of key
11649         type.
11650         (Target_arm::find_arm_input_section): Ditto.
11651         * gc.h (object.h): Include for Section_id nand Section_id_hash.
11652         (Section_id): Remove.
11653         (Garbage_collection::Section_id_hash): Remove.
11654         * icf.h (object.h): Include for Section_id nand Section_id_hash.
11655         (Section_id): Remove.
11656         (Icf::Section_id_hash): Remove.
11657         * object.h (Section_id, Const_section_id, Section_id_hash,
11658         Const_section_id_hash): New type definitions.
11659         * output.cc (Output_section::add_relaxed_input_section): Change to
11660         use Const_section_id instead of Input_section_specifier as key type.
11661         (Output_section::add_merge_input_section): Ditto.
11662         (Output_section::build_relaxation_map): Change to use Section_id
11663         instead of Input_section_specifier as key type.
11664         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11665         Ditto.
11666         (Output_section::convert_input_sections_to_relaxed_sections): Change
11667         to use Const_section_id instead of Input_section_specifier as key type.
11668         (Output_section::find_merge_section): Ditto.
11669         (Output_section::find_relaxed_input_section): Ditto.
11670         * output.h (Input_section_specifier): Remove class.
11671         (Output_section::Output_section_data_by_input_section_map): Change
11672         key type to Const_section_id.
11673         (Output_section::Output_relaxed_input_section_by_input_section_map):
11674         Ditto.
11675         (Output_section::Relaxation_map): Change key type to Section_id.
11676
11677 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11678
11679         * gold/arm.cc: Added support for R_ARM_V4BX relocation
11680         (class Arm_v4bx_stub): New class.
11681         (DEF_STUBS): Updated definition to support v4_veneer_bx.
11682         (Stub_factory::make_arm_v4bx_stub): New method.
11683         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
11684         (Stub_table::empty): Handle v4bx stubs.
11685         (Stub_table::add_arm_v4bx_stub): New method.
11686         (Stub_table::find_arm_v4bx_stub): New method.
11687         (Arm_relocate_functions::v4bx): New method.
11688         (Target_arm::fix_v4bx): New method.
11689         (Target_arm::Target_arm): Handle R_ARM_V4BX.
11690         (Stub_table::relocate_stubs): Likewise.
11691         (Stub_table::do_write): Likewise.
11692         (Stub_table::update_data_size_and_addralign): Likewise.
11693         (Stub_table::finalize_stubs):  Likewise.
11694         (Target_arm::Scan::local): Likewise.
11695         (Target_arm::Scan::global): Likewise.
11696         (Target_arm::do_finalize_sections): Likewise.
11697         (Target_arm::Relocate::relocate): Likewise.
11698         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11699         Likewise.
11700         (Target_arm::scan_reloc_for_stub): Likewise.
11701         (Target_arm::scan_reloc_section_for_stubs): Likewise.
11702
11703 2010-01-19  Ian Lance Taylor  <iant@google.com>
11704
11705         * output.cc (Output_section_headers::do_sized_write): Write large
11706         segment count to sh_info field.
11707         (Output_file_header::do_sized_write): For large segment count,
11708         write PN_XNUM to e_phnum field.
11709
11710 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11711
11712         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
11713         (Arm_relocate_functions::thm_jump8): New function.
11714         (Arm_relocate_functions::thm_jump11): New function.
11715         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
11716         R_ARM_THM_JUMP11.
11717         (Target_arm::Scan::global): Likewise.
11718         (Target_arm::Relocate::relocate): Likewise.
11719         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11720         Likewise.
11721
11722 2010-01-14  Doug Kwan  <dougkwan@google.com>
11723
11724         * arm.cc (map, utility): Include headers.
11725         (Target_arm::apply_cortex_a8_workaround): New method.
11726         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
11727         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
11728         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
11729         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
11730         the --[no-]fix-cortex-a8 command line options.
11731         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
11732         (Target_arm::relocate_stub): Use addend in instruction template.
11733         * options.h (DEFINE_bool): Set the user-set flag.
11734         (General_options): Add --[no-]-fix-cortex options.
11735         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
11736         : Update fast look-up map after conversion.
11737
11738 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
11739
11740         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
11741         in the first pass of do_layout.
11742
11743 2010-01-13  Doug Kwan  <dougkwan@google.com>
11744
11745         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11746         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
11747         apparent compiler problem of not folding static constant integral
11748         data members of elfcpp::Elf_sizes<32>.
11749
11750 2010-01-13  Doug Kwan  <dougkwan@google.com>
11751
11752         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11753         Arm_relobj::section_needs_cortex_a8_stub_scanning,
11754         Arm_relobj::scan_section_for_cortex_a8_erratum,
11755         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
11756         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
11757         sections to scan for relocation stubs into a new method
11758         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
11759         relocation and Cortex-A8 stub scanning.
11760         (Target_arm::do_relax): Force stubs to be after stubbed sections
11761         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
11762         the beginning of a new relaxation pass.  Update a comment.
11763         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
11764
11765 2010-01-12  Ian Lance Taylor  <iant@google.com>
11766
11767         * target-reloc.h (visibility_error): New inline function.
11768         (relocate_section): Call visibility_error.
11769         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
11770         (MOSTLYCLEANFILES): Likewise.
11771         (protected_4_pic.o, protected_3.err): New targets.
11772         * testsuite/protected_4.cc: New file.
11773
11774 2010-01-12  Doug Kwan  <dougkwan@google.com>
11775
11776         * arm.cc (Cortex_a8_reloc): New class.
11777         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
11778         and cortex_a8_relocs_info_.
11779         (Target_arm::fix_cortex_a8): New method definition.
11780         (Target_arm::Cortex_a8_relocs_info): New type.
11781         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
11782         New data member declarations.
11783         (Target_arm::scan_reloc_for_stub): Record information about
11784         relocations for THUMB branches that might be exempted from the
11785         Cortex-A8 workaround.
11786         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
11787         at the beginning of a relaxation pass.
11788
11789 2010-01-12  Doug Kwan  <dougkwan@google.com>
11790
11791         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
11792         (Arm_relobj::Mapping_symbol_position,
11793          Arm_reloj::Mapping_symbol_position_less,
11794          Arm_relobj::Mapping_symbols_info): New types.
11795         (Target_arm::is_mapping_symbol_name): New method definition.
11796         (Arm_relobj::do_count_local_symbols): Save information about mapping
11797         symbols.
11798
11799 2010-01-11  Doug Kwan  <dougkwan@google.com>
11800
11801         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
11802         Arm_relocate_functions::thumb32_branch_upper,
11803         Arm_relocate_functions::thumb32_branch_lower,
11804         Arm_relocate_functions::thumb32_cond_branch_offset,
11805         Arm_relocate_functions::thumb32_cond_branch_upper,
11806         Arm_relocate_functions::thumb32_cond_branch_lower,
11807         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
11808         branch offset encoding.
11809         (Arm_relocate_functions::thumb_branch_common): Use new branch
11810         offset encoding methods to avoid code duplication.
11811         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
11812         (Stub_addend_reader::operator()): Use new branch encoding method
11813         to avoid code duplication.
11814
11815 2010-01-11  Doug Kwan  <dougkwan@google.com>
11816
11817         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
11818         (Target_arm::do_finalize_sections): Define special EXIDX section
11819         symbols only if referenced.
11820         * gc.h (Garbage_collection::add_reference): New method.
11821         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
11822         code duplication.
11823
11824 2010-01-11  Ian Lance Taylor  <iant@google.com>
11825
11826         * script.cc (Version_script_info::build_expression_list_lookup):
11827         Change complaing about duplicate wildcard match from error to
11828         warning.
11829
11830         * script.cc (class Lazy_demangler): Recreate--revert part of patch
11831         of 2009-12-30.
11832         (Version_script_info::Version_script_info): Initialize globs_,
11833         default_version_, default_is_global_, and exact_.  Don't
11834         initialize globals_ or locals_.
11835         (Version_script_info::build_lookup_tables): Build local symbols
11836         first.
11837         (Version_script_info::unquote): New function.
11838         (Version_script_info::add_exact_match): New function.
11839         (Version_script_info::build_expression_list_lookup): Remove lookup
11840         parameter.  Add is_global parameter.  Change all callers.  Handle
11841         wildcard pattern specially.  Unquote pattern.  Call
11842         add_exact_match.
11843         (Version_script_info::get_name_to_match): New function.
11844         (Version_script_info::get_symbol_version): New function.
11845         (Version_script_info::get_symbol_version_helper): Remove.
11846         (Version_script_info::check_unmatched_names): Call unquote.
11847         * script.h (class Version_script_info): Change get_symbol_version
11848         to be non-inline and add is_global parameter; change all callers.
11849         Rewrite symbol_is_local.  Update declarations.  Define struct
11850         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
11851         Remove globals_ and locals_ members.  Add exact_, globs_,
11852         default_version_, is_global_.
11853         (Version_script_info::Glob): Remove pattern, add expression and
11854         is_global.  Update constructor.  Change all callers.
11855         * dynobj.cc (Versions::finalize): Mark the version symbol as the
11856         default version.
11857         (Versions::symbol_section_contents): If a symbol is undefined, or
11858         defined in a dynamic object, set the version index to
11859         VER_NDX_LOCAL.
11860         * symtab.cc (Symbol_table::add_from_relobj): Don't call
11861         symbol_is_local.
11862         (Symbol_table::add_from_pluginobj): Likewise.
11863         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
11864
11865 2010-01-11  Doug Kwan  <dougkwan@google.com>
11866
11867         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
11868         (incremental_dump_LDADD): Add linking option for libintl.
11869         * Makefile.in: Regenerate.
11870
11871 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
11872
11873         PR gold/11144
11874         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
11875         instead of -Ds.
11876         * testsuite/Makefile.in: Regenerated.
11877
11878 2010-01-10  Doug Kwan  <dougkwan@google.com>
11879
11880         * options.h (DEFINE_var): Use parentheses around argument varname__
11881         in macro body to avoid any unintended subsequent substitutions.
11882
11883 2010-01-10  Ian Lance Taylor  <iant@google.com>
11884
11885         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
11886         candidates before doing symbol resolution.
11887
11888         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
11889         ODR candidates if only one is weak.
11890
11891 2010-01-08  Ian Lance Taylor  <iant@google.com>
11892
11893         * script.cc (Version_script_info::build_expression_list_lookup):
11894         Don't warn about ambiguous version, just record the ambiguity.
11895         (Version_script_info::get_symbol_version_helper): Give error if
11896         version is ambiguous.
11897
11898 2010-01-08  Doug Kwan  <dougkwan@google.com>
11899
11900         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
11901         prev_data_size_ and prev_addralign_.  Remove initializer for
11902         deleted data member has_been_changed_.
11903         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
11904         to determine if the table is empty.
11905         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
11906         Remove.
11907         (Stub_table::add_reloc_stub): Define method in class definition
11908         instead of just declaring it there.
11909         (Stub_table::add_cortex_a8_stub): New method definition.
11910         (Stub_table::update_data_size_and_addralign): Ditto.
11911         (Stub_table::finalize_stubs): Ditto.
11912         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
11913         (Stub_table::do_addralign_): Return address alignment in the
11914         (Stub_table::do_reset_address_and_file_offset): Define method in
11915         class definition instead of declaring it there.  Set current data
11916         size to be the data size of the previous pass.
11917         (Stub_table::set_final_data_size): Use current data size as the
11918         final data size.
11919         (Stub_table::relocate_stub): Change parameter type of stub from
11920         Reloc_stub pointer to Stub pointer.
11921         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
11922         (Stub_table::Cortex_a8_stub_list): New typedef.
11923         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
11924          Stub_table::prev_addralign_): New data member.
11925         (Arm_relobj::Arm_relobj): Initialize data member
11926         section_has_cortex_a8_workaround_.
11927         (Arm_relobj::section_has_cortex_a8_workaround,
11928          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
11929          definitions.
11930         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
11931         declarations.
11932         (Target_arm::relocate_stub): Change parameter type of stub from
11933         Reloc_stub pointer to Stub pointer.
11934         (Insn_template::size, Insn_template::alignment): Handle
11935         THUMB16_SPECIAL_TYPE.
11936         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
11937          Stub_table::update_data_size_and_addralign,
11938          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
11939         definitions.
11940         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
11941         (Stub_table::do_write): Ditto.
11942         (Target_arm::do_relax): Adjust code for changes in Stub_table.
11943
11944 2010-01-08  Ian Lance Taylor  <iant@google.com>
11945
11946         PR 11108
11947         * symtab.h (class Symbol): Remove fields is_target_special_ and
11948         has_plt_offset_.  Add field is_defined_in_discarded_section_.
11949         (Symbol::is_defined_in_discarded_section): New function.
11950         (Symbol::set_is_defined_in_discarded_section): New function.
11951         (Symbol::has_plt_offset): Rewrite.
11952         (Symbol::set_plt_offset): Verify that new offset is not -1U.
11953         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
11954         Don't initialize is_target_special_ or has_plt_offset_.
11955         Initialize is_defined_in_discarded_section_.
11956         (Symbol_table::add_from_relobj): If appropriate, set
11957         is_defined_in_discarded_section.
11958         * resolve.cc (Symbol::override_base_with_special): Don't test
11959         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
11960         * target-reloc.h (relocate_section): Do special handling for
11961         symbols defined in discarded sections for global symbols as well
11962         as local symbols.
11963
11964 2010-01-08  Ian Lance Taylor  <iant@google.com>
11965
11966         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
11967         the SHT_SYMTAB case.
11968
11969 2010-01-08  Ian Lance Taylor  <iant@google.com>
11970
11971         * object.cc (Sized_relobj::do_layout): Don't get confused if
11972         layout_eh_frame returns NULL.
11973
11974 2010-01-08  Ian Lance Taylor  <iant@google.com>
11975
11976         PR 11084
11977         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
11978         dynamic symbol table, use the normal symbol table.
11979         (Sized_dynobj::do_read_symbols): Remove assertion about type of
11980         symbol table.
11981
11982 2010-01-08  Ian Lance Taylor  <iant@google.com>
11983
11984         PR 11072
11985         * layout.cc (Layout::include_section): Remove .gnu_debuglink
11986         sections.
11987
11988 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
11989
11990         * version.cc (print_version): Change to "Copyright 2010".
11991
11992 2010-01-08  Ian Lance Taylor  <iant@google.com>
11993
11994         PR 10287
11995         PR 11063
11996         * i386.cc (class Target_i386): Change return type of plt_section
11997         to be non-const.
11998         (class Output_data_plt_i386): Add tls_desc_rel_ field.
11999         (Output_data_plt_i386::Output_data_plt_i386): Initialize
12000         tls_desc_rel_ field.
12001         (Output_data_plt_i386::rel_tls_desc): New function.
12002         (Target_i386::rel_tls_desc_section): New function.
12003         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
12004         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
12005         R_386_TLS_DESC reloc in rel_tls_desc_section.
12006         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
12007         Define struct Tlsdesc_info.
12008         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
12009         (Target_x86_64::do_reloc_symbol_index): New function.
12010         (Target_x86_64::add_tlsdesc_info): New function.
12011         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
12012         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
12013         tlsdesc_rel_ field.
12014         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
12015         all callers.
12016         (Output_data_plt_x86_64::rela_tlsdesc): New function.
12017         (Target_x86_64::rela_tlsdesc_section): New function.
12018         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
12019         handling.
12020         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
12021         (Target_x86_64::do_reloc_addend): New function.
12022         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
12023         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
12024         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
12025         (Output_reloc::type): New function.
12026         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
12027         (Output_reloc::is_target_specific): New function.
12028         (Output_reloc::target_arg): New function.
12029         (class Output_reloc) [SHT_RELA]: Add four new constructors for
12030         absolute relocs and target specific relocs.
12031         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
12032         add_target_specific.
12033         (class Output_data_reloc) [SHT_RELA]: Likewise.
12034         * output.cc (Output_reloc::Output_reloc): Add four new versions
12035         for absolute relocs and target specific relocs.
12036         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
12037         (Output_reloc::get_symbol_index): Likewise.
12038         (Output_reloc::local_section_offset): Check that local_sym_index_
12039         is not TARGET_CODE or 0.
12040         (Output_reloc::symbol_value): Likewise.
12041         (Output_reloc::write) [SHT_RELA]: Call target for target specific
12042         reloc.
12043         * target.h (class Target): Add reloc_symbol_index and reloc_addend
12044         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
12045         functions.
12046         * layout.cc (add_target_dynamic_tags): Use output section for
12047         DT_PLTRELSZ and DT_JMPREL.
12048
12049 2010-01-07  Ian Lance Taylor  <iant@google.com>
12050
12051         PR 11061
12052         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
12053         function.
12054         (class Output_data_reloc_generic): Define.
12055         (class Output_data_reloc_base): Change base class to
12056         Output_data_reloc_generic.  Change add() method to call
12057         bump_relative_reloc_count for a relative reloc.  Remove
12058         sort_relocs_ field.
12059         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
12060         to sort_relocs().
12061         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
12062         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
12063         appropriate.
12064         * layout.h (class Layout): Update declaration.
12065
12066 2010-01-07  Ian Lance Taylor  <iant@google.com>
12067
12068         * output.h (class Output_data): Add const version of
12069         output_section and do_output_section.
12070         (class Output_section_data): Add const version of
12071         do_output_section.
12072         (class Output_section): Likewise.
12073         * layout.cc (Layout::add_target_dynamic_tags): New function.
12074         * layout.h (class Layout): Update declarations.
12075         * arm.cc (Target_arm::do_finalize_sections): Use
12076         add_target_dynamic_tags.
12077         * i386.cc (Target_i386::do_finalize_sections): Likewise.
12078         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12079         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12080         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12081
12082 2010-01-07  Ian Lance Taylor  <iant@google.com>
12083
12084         PR 11042
12085         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
12086         object as needed.
12087
12088 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
12089             Ian Lance Taylor  <iant@google.com>
12090
12091         PR 11019
12092         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
12093         Xindex::read_symtab_xindex.
12094
12095 2010-01-07  Doug Kwan  <dougkwan@google.com>
12096
12097         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
12098         (Insn_template::thumb16_bcond_insn): New method declaration.
12099         (Insn_template): Fix spelling.
12100         (Stub::thumb16_special): New method declaration.
12101         (Stub::do_write): Define virtual method which was previously pure
12102         virtual.
12103         (Stub::do_thumb16_special): New method declaration.
12104         (Stub::do_fixed_endian_write): New template member.
12105         (Reloc_stub::do_write): Remove.
12106         (Reloc_stub::do_fixed_endian_write): Remove.
12107         (Cortex_a8_stub): New class definition.
12108         (Stub_factory::make_cortex_a8_stub): New method definition.
12109         (Stub_factory::Stub_factory): Add missing static storage class
12110         qualifier for elf32_arm_stub_a8_veneer_blx.
12111
12112 2010-01-07  Ian Lance Taylor  <iant@google.com>
12113
12114         PR 10980
12115         * options.h (class General_options): Add --warn-unresolved-symbols
12116         and --error-unresolved-symbols.
12117         * errors.cc (Errors::undefined_symbol): Implement
12118         --warn-unresolved-symbols.
12119
12120         * options.h (class General_options): Add -z text and -z textoff.
12121         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
12122
12123 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
12124
12125         * gc.h (Garbage_collection::Cident_section_map): New typedef.
12126         (Garbage_collection::cident_sections): New function.
12127         (Garbage_collection::add_cident_section): New function.
12128         (Garbage_collection::cident_sections_): New member.
12129         (gc_process_relocs): Add references to sections whose names are C
12130         identifiers.
12131         * gold.h (cident_section_start_prefix): New constant.
12132         (cident_section_stop_prefix): New constant.
12133         (is_cident): New function.
12134         * layout.cc (Layout::define_section_symbols): Replace string constants
12135         with the newly defined constants.
12136         * object.cc (Sized_relobj::do_layout): Track sections whose names are
12137         C identifiers.
12138         * testsuite/Makefile.am: Add gc_orphan_section_test.
12139         * testsuite/Makefile.in: Regenerate.
12140         * testsuite/gc_orphan_section_test.cc: New file.
12141         * testsuite/gc_orphan_section_test.sh: New file.
12142
12143 2010-01-06  Ian Lance Taylor  <iant@google.com>
12144
12145         PR 10980
12146         * options.h (class General_options): Add --warn-shared-textrel.
12147         * layout.cc (Layout::finish_dynamic_section): Implement
12148         --warn-shared-textrel.
12149
12150         PR 10980
12151         * options.h (class General_options): Add --warn-multiple-gp.
12152
12153 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12154
12155         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
12156         $(THREADSLIB) and $(LIBDL).
12157         * Makefile.in: Rebuild.
12158
12159 2010-01-06  Ian Lance Taylor  <iant@google.com>
12160
12161         PR 10980
12162         * options.cc (General_options::parse_section_start): New function.
12163         (General_options::section_start): New function.
12164         (General_options::General_options): Initialize all members.
12165         * options.h: Include <map>
12166         (class General_options): Add --section-start.  Add section_starts_
12167         member.
12168         * layout.cc (Layout::attach_allocated_section_to_segment): If
12169         --section-start was used, set the address of the segment.  Remove
12170         local sort_sections.
12171         (Layout::relaxation_loop_body): If the address of the load segment
12172         has been set by --section-start, don't use it.
12173         * output.h (Output_segment::update_flags_for_output_section): New
12174         function.
12175         * output.cc (Output_segment::add_output_section): Call
12176         update_flags_for_output_section.
12177
12178 2010-01-05  Ian Lance Taylor  <iant@google.com>
12179
12180         PR 10980
12181         * options.h (class General_options): Add --undefined-version.
12182         * script.cc (struct Version_expression): Add was_matched_by_symbol
12183         field.
12184         (Version_script_info::matched_symbol): New function.
12185         (Version_script_info::get_symbol_version_helper): Call
12186         matched_symbol.
12187         (Version_script_info::check_unmatched_names): New function.
12188         * script.h (class Version_script_info): Update declarations.
12189         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
12190
12191         * options.h (class General_options): Use DEFINE_bool_alias for
12192         allow_multiple_definition.
12193         * resolve.cc (Symbol_table::should_override): Don't test
12194         allow_multiple_definition.
12195
12196         PR 10980
12197         * options.h (class General_options): Add --cref.
12198         * main.cc (main): Print cref table if --cref.  Don't close mapfile
12199         until after printing cref table.
12200         * cref.cc: Include "symtab.h".
12201         (class Cref_inputs): Define Cref_table_compare and Cref_table.
12202         (Cref_table_compare::operator()): New function.
12203         (Cref_inputs::gather_cref): New function.
12204         (filecol): New static const.
12205         (Cref_inputs::print_cref): New function.
12206         (Cref::print_cref): New function.
12207         * cref.h: Include <cstdio>.
12208         (class Cref): Update declarations.
12209         * mapfile.h (Mapfile::file): New function.
12210         * object.h (class Object): Define Symbols.  Declare virtual
12211         do_get_global_symbols.
12212         (Object::get_global_symbols): New function.
12213         * object.cc (Input_objects::add_object): Pass object to cref_ if
12214         --cref.
12215         (Input_objects::archive_start): Likewise.
12216         (Input_objects::archive_stop): Likewise.
12217         (Input_objects::print_cref): New function.
12218         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
12219         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
12220         --cref.
12221         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
12222         function.
12223         * plugin.h (class Sized_pluginobj): Update declarations.
12224
12225 2010-01-05  Ian Lance Taylor  <iant@google.com>
12226
12227         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
12228         to is_default_version.  Rename insdef to insdefault.
12229         (Symbol_table::add_from_relobj): Rename def to is_default_version
12230         and local to is_forced_local.
12231         (Symbol_table::add_from_pluginobj): Likewise.
12232         (Symbol_table::add_from_dynobj): Likewise.
12233         (Symbol_table::define_special_symbol): Rename insdef to
12234         insdefault.
12235
12236 2010-01-04  Ian Lance Taylor  <iant@google.com>
12237
12238         PR 10980
12239         * options.h (class General_options): Add
12240         --allow-multiple-definition and -z muldefs.
12241         * resolve.cc (Symbol_table::should_override): Don't warn about a
12242         multiple symbol definition if --allow-multiple-definition or -z
12243         muldefs.
12244
12245         PR 10980
12246         * options.h (class General_options): Add --add-needed and
12247         --copy-dt-needed-entries.  Tweak --as-needed help entry.
12248         * object.cc (Input_objects::check_dynamic_dependencies): Give an
12249         error if --copy-dt-needed-entries aka --add-needed is used and
12250         would cause a change in behaviour.
12251
12252         PR 10980
12253         * options.h (class General_options): Add -G as a short version of
12254         --shared.  Add no-op options -assert, -g, and -i.
12255
12256 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
12257
12258         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
12259         check for .text or .gnu.linkonce.t sections.
12260         * icf.cc (Icf::find_identical_sections): Ditto.
12261         Change the detection for mangled function name within the section
12262         name.
12263         * icf.h (is_section_foldable_candidate): New function.
12264
12265 2009-12-30  Ian Lance Taylor  <iant@google.com>
12266
12267         PR 10980
12268         * options.h (class General_options): Permit two dashes with
12269         --retain-symbols-file.
12270
12271 2009-12-30  Ian Lance Taylor  <iant@google.com>
12272
12273         PR 10979
12274         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
12275         don't put the file header and segment headers in the text
12276         segment.
12277
12278         PR 10979
12279         * common.cc (Sort_commons::operator()): Stabilize sort when both
12280         entries are NULL.
12281         (Symbol_table::do_allocate_commons_list): When allocating common
12282         symbols, skip a symbol which is no longer common.
12283         * symtab.h (Symbol::is_common): Test whether the symbol comes from
12284         an object before checking its type.
12285         * testsuite/common_test_2.c: New file.
12286         * testsuite/common_test_3.c: New file.
12287         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
12288         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
12289         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
12290         (common_test_2_pic.o, common_test_2.so): New targets.
12291         (common_test_3_pic.o, common_test_3.so): New targets.
12292         * testsuite/Makefile.in: Rebuild.
12293
12294         PR 10979
12295         * script.cc (read_input_script): If we see a new SECTIONS clause,
12296         and we have added an input section, give an error.
12297         * layout.h (class Layout): Add have_added_input_section function.
12298         Add have_added_input_section_ field.
12299         * layout.cc (Layout::Layout): Initialize
12300         have_added_input_section_.
12301         (Layout::layout): Set have_added_input_section_.
12302         (Layout::layout_eh_frame): Likewise.
12303
12304 2009-12-30  Ian Lance Taylor  <iant@google.com>
12305
12306         PR 10931
12307         * options.h (class General_options): Add --sort-common option.
12308         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
12309         * common.cc (Sort_common): Add sort_order parameter to
12310         constructor.  Add sort_order_ field.
12311         (Sort_commons::operator): Check sort_order_.
12312         (Symbol_table::allocate_commons): Determine the sort order.
12313         (Symbol_table::do_allocate_commons): Add sort_order parameter.
12314         Change all callers.
12315         (Symbol_table::do_allocate_commons_list): Likewise.
12316
12317 2009-12-30  Ian Lance Taylor  <iant@google.com>
12318
12319         PR 10916
12320         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
12321         symbols from this object, don't change the visibility of an
12322         undefined symbol.
12323         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
12324
12325 2009-12-30  Ian Lance Taylor  <iant@google.com>
12326
12327         PR 10861
12328         * script.h (class Version_script_info): Define Language enum.
12329         Update declarations.  Define Glob, Exact, and Lookup types.  Add
12330         new fields globals_, locals_, and is_finalized_.
12331         * script.cc: Various formatting fixes.
12332         (class Parser_closure): Change language_stack_ from a vector of
12333         std::string to one of Version_script_info::Language.  Adjust all
12334         uses accordingly.
12335         (class Lazy_demangler): Remove.
12336         (struct Version_expression): Change language from std::string to
12337         Version_script_info::Language.
12338         (Version_script_info::Version_script_info): New function.
12339         (Version_script_info::~Version_script_info): Don't call clear.
12340         (Version_script_info::finalize): New function.
12341         (Version_script_info::build_lookup_tables): New function.
12342         (Version_script_info::build_expression_list_lookup): New
12343         function.
12344         (Version_script_info::get_symbol_version_helper): Rewrite to use
12345         lookup tables.
12346         (Version_script_info::print_expression_list): Adjust to use
12347         Version_script_info::Language.
12348         (script_push_lex_into_version_mode): Check that the version script
12349         has not been finalized.
12350         (version_script_push_lang): Change language string to
12351         Version_script_info::Language.
12352         * options.cc (Command_line::version_script): New function.
12353         * options.h (class General_options): Add finalize_dynamic_list
12354         function.  Change version_script from declaration to definition.
12355         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
12356         * testsuite/version_script.map: Remove duplicate def of foo.
12357         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
12358         version_script.map.
12359         * testsuite/Makefile.in: Rebuild.
12360
12361 2009-12-30  Ian Lance Taylor  <iant@google.com>
12362
12363         PR 10843
12364         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
12365         if the input symbol index is 0, make the output symbol index 0.
12366
12367 2009-12-30  Ian Lance Taylor  <iant@google.com>
12368
12369         PR 10670
12370         * options.h (class General_options): Add -x/--discard-all.
12371         * object.cc (Sized_relobj::do_count_local_symbols): Handle
12372         --discard-all.  If the local symbol needs a dynamic entry, check
12373         that before handling --discard-locals.
12374
12375 2009-12-30  Ian Lance Taylor  <iant@google.com>
12376
12377         PR 10450
12378         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
12379         flags to PF_R.
12380         (Output_segment::add_output_section): Don't change the flags if
12381         the type is PT_TLS.
12382
12383         PR 10450
12384         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
12385         GNU hash table if they need a dynamic value.  Otherwise, don't add
12386         them if they are defined in a dynamic object or are forced local.
12387
12388 2009-12-29  Ian Lance Taylor  <iant@google.com>
12389
12390         PR 10450
12391         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
12392         .gnu.hash table for a 32-bit target.
12393
12394         PR 10450
12395         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
12396         regular and a dynamic object only needs a dynamic symbol table
12397         entry if it is externally visible.
12398
12399         PR 10450
12400         * i386.cc (class Target_i386): Initialize global_offset_table_ in
12401         constructor.  Add global_offset_table_ field.
12402         (Target_i386::got_section): Set global_offset_table_.
12403         (Target_i386::do_finalize_sections): Set global_offset_table_
12404         size.
12405         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
12406         in constructor.  Add global_offset_table_ field.
12407         (Target_x86_64::got_section): Set global_offset_table_.
12408         (Target_x86_64::do_finalize_sections): Set global_offset_table_
12409         size.
12410
12411         * layout.cc (Layout::Layout): Initialize increase_relro_.
12412         (Layout::get_output_section): Add is_relro, is_last_relro, and
12413         is_first_non_relro parameters.  Change all callers.
12414         (Layout::choose_output_section): Likewise.
12415         (Layout::add_output_section_data): Likewise.
12416         (Layout::make_output_section): Likewise.
12417         (Layout::set_segment_offsets): Clear increase_relro when using a
12418         linker script.
12419         * layout.h (class Layout): Add increase_relro method.  Add
12420         increase_relro_ field.  Update declarations.
12421         * output.cc (Output_section::Output_section): Initialize
12422         is_last_relro_ and is_first_non_relro_.
12423         (Output_segment::add_output_section): Group relro sections is
12424         do_sort is true.  Handle is_last_relro and is_first_non_relro.
12425         (Output_segment::maximum_alignment): Remove relro handling.
12426         (Output_segment::set_section_addresses): Add increase_relro
12427         parameter.  Change all callers.  Add initial alignment to align
12428         relro sections on separate page.  Remove old relro handling.
12429         (Output_segment::set_section_list_addresses): Remove in_relro
12430         parameter.  Change all callers.
12431         (Output_segment::set_offset): Add increase parameter.  Change all
12432         callers.  Remove old relro handling.
12433         * output.h (class Output_section): Add new methods: is_last_relro,
12434         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
12435         Add is_last_relro_ and is_first_non_relro_ fields.
12436         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
12437         Create separate .got.plt section.  Call increase_relro.
12438         * x86_64.cc (Target_x86_64::got_section): Likewise.
12439         * testsuite/relro_script_test.t: Add .got.plt.
12440
12441         PR 10450
12442         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
12443         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
12444         (Layout::finalize): Call set_dynamic_symbol_size.
12445         (Layout::set_dynamic_symbol_size): New function.
12446         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
12447         set_dynamic_symbol_size.
12448
12449         PR 10450
12450         * output.h (class Output_section): Add is_entsize_zero_ field.
12451         * output.cc (Output_section::Output_section): Initialize
12452         is_entsize_zero_.
12453         (Output_section::set_entsize): If two different entsizes are
12454         requested, force it to zero.
12455         (Output_section::add_input_section): Set flags for .debug_str
12456         before updating section flags.  Set entsize.
12457         (Output_section::update_flags_for_input_section): Set SHF_MERGE
12458         and SHF_STRING if all input sections have those flags.
12459
12460 2009-12-29   Rafael Espindola  <espindola@google.com>
12461
12462         * main.cc (main): Fix the sys time reporting.
12463         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
12464         reporting.
12465
12466 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
12467
12468         * options.cc (General_options::parse_version): Allow -v to exit
12469         without an error if there is nothing to link.
12470
12471 2009-12-29  Ian Lance Taylor  <iant@google.com>
12472
12473         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
12474         using a version of gcc before 4.1.
12475         * configure: Rebuild.
12476
12477 2009-12-28  Chris Demetriou  <cgd@google.com>
12478
12479         * attributes.cc (Output_attributes_section_data::do_write): Use
12480         std::vector::front rather than std::vector::data.
12481
12482 2009-12-28  Ian Lance Taylor  <iant@google.com>
12483
12484         * symtab.h (class Symbol_table): Add enum Defined.
12485         * resolve.cc (Symbol_table::should_override): Add defined
12486         parameter.  Change all callers.  Test whether object is NULL
12487         before calling a method on it.
12488         (Symbol_table::report_resolve_problem): Add defined parameter.
12489         Change all callers.
12490         (Symbol_table::should_override_with_special): Likewise.
12491         * symtab.cc (Symbol_table::define_in_output_data): Add defined
12492         parameter.  Change all callers.
12493         (Symbol_table::do_define_in_output_data): Likewise.
12494         (Symbol_table::define_in_output_segment): Likewise.
12495         (Symbol_table::do_define_in_output_segment): Likewise.
12496         (Symbol_table::define_as_constant): Likewise.
12497         (Symbol_table::do_define_as_constant): Likewise.
12498         * script.h (class Symbol_assignment): Add is_defsym parameter to
12499         constructor; change all callers.
12500         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
12501         parameter.  Change all callers.  Add is_defsym_ field.
12502         (class Parser_closure): Add parsing_defsym parameter to
12503         constructor; change all callers.  Add parsing_defsym accessor
12504         function.  Add parsing_defsym_ field.
12505
12506 2009-12-28  Ian Lance Taylor  <iant@google.com>
12507
12508         * gold.cc (queue_middle_tasks): Fix formatting.
12509         * object.cc (Relobj::is_section_name_included): Likewise.
12510
12511 2009-12-23  Ian Lance Taylor  <iant@google.com>
12512
12513         * i386.cc (Target_i386::do_calls_non_split): Recognize
12514         -fsplit-stack prologue for a function with a static chain.
12515         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
12516         -fsplit-stack prologue when using %r11.
12517
12518 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
12519
12520         * options.cc (General_options::parse_version): Make -v continue and do
12521         the link like GNU ld does.
12522
12523 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
12524
12525         * Makefile.am (CCFILES): Add timer.cc.
12526         (HFILES): Add timer.h.
12527         * configure.ac: Check for sysconf and times.
12528         * main.cc: include timer.h.
12529         (main): Use Timer instead of get_run_time.
12530         * timer.cc: New.
12531         * timer.h: New.
12532         * workqueue.cc: include timer.h.
12533         (Workqueue::find_and_run_task):
12534         Report user, sys and wall time.
12535         * Makefile.in: Regenerate.
12536         * config.in: Regenerate.
12537         * configure: Regenerate.
12538
12539 2009-12-16  Doug Kwan  <dougkwan@google.com>
12540
12541         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
12542         sections.
12543         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
12544         relaxed input sections.
12545         * output.cc (Output_section::find_relaxed_input_section): Change
12546         return type to Output_relaxed_input_section pointer.  Adjust code
12547         for new type of relaxed_input_section_map_.
12548         * output.h (Output_section::find_relaxed_input_section): Change
12549         return type to Output_relaxed_input_section pointer.
12550         (Output_section::Output_relaxed_input_section_by_input_section_map):
12551         New type.
12552         (Output_section::relaxed_input_section_map_): Change type to
12553         Output_section::Output_relaxed_input_section_by_input_section_map.
12554         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
12555         input section.
12556
12557 2009-12-15  Ian Lance Taylor  <iant@google.com>
12558
12559         * layout.cc (Layout::create_shstrtab): Only write out after input
12560         sections if we are compressing debug sections.
12561
12562 2009-12-15  Ian Lance Taylor  <iant@google.com>
12563
12564         * archive.cc (Archive::add_symbols): Only look up a symbol without
12565         a version if there is, in fact, a version.
12566
12567 2009-12-14  Ian Lance Taylor  <iant@google.com>
12568
12569         Revert -Wshadow changes, all changes from:
12570         2009-12-11  Doug Kwan  <dougkwan@google.com>
12571         2009-12-11  Nick Clifton  <nickc@redhat.com>
12572         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
12573
12574 2009-12-11  Doug Kwan  <dougkwan@google.com>
12575
12576         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
12577         due to -Wshadow.
12578         * attributes.cc (Object_attribute::size): Ditto.
12579         (Attributes_section_data::size): Ditto.
12580         (Attributes_section_data::Attributes_section_data): Ditto.
12581         (Output_attributes_section_data::do_write): Ditto.
12582         * attributes.h (Object_attribute::set_type): Ditto.
12583         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
12584
12585 2009-12-11  Nick Clifton  <nickc@redhat.com>
12586
12587         * archive.cc: Fix shadowed variable warnings.
12588         * arm.cc: Likewise.
12589         * compressed_output.cc: Likewise.
12590         * compressed_output.h: Likewise.
12591         * configure: Likewise.
12592         * dwarf_reader.cc: Likewise.
12593         * dynobj.cc: Likewise.
12594         * dynobj.h: Likewise.
12595         * ehframe.cc: Likewise.
12596         * ehframe.h: Likewise.
12597         * errors.cc: Likewise.
12598         * expression.cc: Likewise.
12599         * fileread.cc: Likewise.
12600         * fileread.h: Likewise.
12601         * freebsd.h: Likewise.
12602         * i386.cc: Likewise.
12603         * icf.cc: Likewise.
12604         * incremental.h: Likewise.
12605         * layout.cc: Likewise.
12606         * layout.h: Likewise.
12607         * mapfile.cc: Likewise.
12608         * merge.cc: Likewise.
12609         * merge.h: Likewise.
12610         * object.cc: Likewise.
12611         * object.h: Likewise.
12612         * options.h: Likewise.
12613         * output.cc: Likewise.
12614         * output.h: Likewise.
12615         * parameters.cc: Likewise.
12616         * plugin.cc: Likewise.
12617         * powerpc.cc: Likewise.
12618         * reduced_debug_output.cc: Likewise.
12619         * reduced_debug_output.h: Likewise.
12620         * reloc.cc: Likewise.
12621         * reloc.h: Likewise.
12622         * resolve.cc: Likewise.
12623         * script-sections.cc: Likewise.
12624         * script.cc: Likewise.
12625         * script.h: Likewise.
12626         * sparc.cc: Likewise.
12627         * symtab.cc: Likewise.
12628         * symtab.h: Likewise.
12629         * target-select.cc: Likewise.
12630         * target-select.h: Likewise.
12631         * token.h: Likewise.
12632         * workqueue.cc: Likewise.
12633         * workqueue.h: Likewise.
12634         * x86_64.cc: Likewise.
12635
12636 2009-12-10  Doug Kwan  <dougkwan@google.com>
12637
12638         * arm.cc (attributes.h): New include.
12639         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
12640         (Arm_relobj::~Arm_relobj): Delete object pointed by
12641         attributes_section_data_.
12642         (Arm_relobj::attributes_section_data): New method definition.
12643         (Arm_relobj::attributes_section_data_): New data member declaration.
12644         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
12645         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
12646         attributes_section_data_.
12647         (Arm_dynobj::attributes_section_data): New method definition.
12648         (Arm_dynobj::attributes_section_data_): New data member declaration.
12649         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
12650         initialization value of may_use_blx_ to false.
12651         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
12652         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
12653         object attributes to compute results instead of hard-coding.
12654         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
12655         Target_arm::get_secondary_compatible_arch,
12656         Target_arm::set_secondary_compatible_arch
12657         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12658         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
12659         New method declarations.
12660         (Target_arm::get_aeabi_object_attribute): New method definition.
12661         (Target_arm::attributes_section_data_): New data member declaration.
12662         (read_arm_attributes_section): New template definition.
12663         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
12664         (Arm_dynobj::do_read_symbols): Ditto.
12665         (Target_arm::do_finalize_sections): Merge attributes sections from
12666         input.  Check for BLX use after attributes section merging.
12667         Fix __exidx_start and __exidx_end visibility.  Create an
12668         .ARM.attributes section if necessary.
12669         (Target_arm::get_secondary_compatible_arch,
12670         Target_arm::set_secondary_compatible_arch,
12671         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12672         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
12673         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
12674         New method definitions.
12675
12676 2009-12-09  Ian Lance Taylor  <iant@google.com>
12677
12678         * plugin.cc (Plugin::load): Don't cast from void* to a function
12679         pointer.
12680
12681 2009-12-09  Ian Lance Taylor  <iant@google.com>
12682
12683         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
12684         information fields.
12685
12686 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
12687
12688         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
12689         Replace two_file_shared_1.so with two_file_shared_2.so.
12690         * testsuite/Makefile.in: Regenerated.
12691
12692 2009-12-08  Doug Kwan  <dougkwan@google.com>
12693
12694         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
12695         (HFILES): Add attributes.h and int_encoding.h.
12696         * Makefile.in: Regenerate.
12697         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
12698         function definitions to int_encoding.cc
12699         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
12700         prototypes to int_encoding.h
12701         * reduced_debug_output.cc (int_encoding.h): New include.
12702         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
12703         function definitions to int_encoding.cc
12704         (insert_into_vector, read_from_pointer): Move template definitions to
12705         int_encoding.h
12706         * attributes.cc: New file.
12707         * attributes.h: New file.
12708         * int_encoding.cc: New file.
12709         * int_encoding.h: New file.
12710
12711 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
12712
12713         PR gold/11055
12714         * incremental-dump.cc (dump_incremental_inputs): New.
12715         (main): Use dump_incremental_inputs.
12716
12717 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
12718
12719         PR gold/10893
12720         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
12721         checking elfcpp::STT_FUNC.
12722         (Target_i386::Relocate::relocate): Likewise.
12723         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
12724
12725         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
12726         symbols from shared libraries into normal FUNC symbols.
12727
12728         * symtab.h (Symbol): Add is_func and use it.
12729
12730 2009-12-05  Doug Kwan  <dougkwan@google.com>
12731
12732         * arm.cc (Target_arm::arm_info): Initialize new fields
12733         attributes_section and attributes_vendor.
12734         * i386.cc (Target_i386::i386_info): Same.
12735         * object.cc (Sized_relobj::do_layout): Skip attribute section.
12736         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
12737         fields attributes_section and attributes_vendor.
12738         * sparc.cc (Target_sparc::sparc_info): Same.
12739         * target.h (Target::attributes_section, Target::attributes_vendor,
12740         Target::is_attributes_section, Target::attribute_arg_type,
12741         Target::attributes_order): New method definitions.
12742         (Target::Target_info::attributes_section,
12743         Target::Target_info::attributes_vendor): New fields.
12744         (Target::do_attribute_arg_type, Target::do_attributes_order): New
12745         virtual method definitions.
12746         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
12747         attributes_section and attributes_vendor.
12748         * testsuite/testfile.cc (Target_test::test_target_info): Same.
12749
12750 2009-12-05  Doug Kwan  <dougkwan@google.com>
12751
12752         * arm.cc: Update comments about interworking and stub generation.
12753         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
12754         considered as non-PIC.
12755         (Arm_relocate_functions::base_abs): Fix formatting.
12756         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
12757         of function to use GOT entry address instead of offset.
12758         (Target_arm::Scan::global): Issue an error if a symbol would need a
12759         PLT does not get one because it is untyped.  Remove code to create
12760         dynamic symbols for relative branches.
12761         (Target_arm::Relocate::relocate: Use 0 instead of false since function
12762         takes unsigned integer instead of boolean.
12763
12764 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
12765
12766         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
12767         (two_file_test_LDADD): Likewise.
12768         (common_test_1_LDADD): Likewise.
12769         (exception_test_LDADD) Likewise.
12770         (weak_test_LDADD): Likewise.
12771         (many_sections_test_LDADD): Likewise.
12772         (initpri1_LDADD): Likewise.
12773         (script_test_1_LDADD): Likewise.
12774         (script_test_2_LDADD): Likewise.
12775         (justsyms_LDADD): Likewise.
12776         (binary_test_LDADD): Likewise.
12777         (large_LDADD): Likewise.
12778         * testsuite/Makefile.in: Regenerated.
12779
12780 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
12781
12782         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
12783         (Symbol_table::override_with_special): Likewise.
12784         (Symbol_table::add_from_object): Likewise.
12785
12786 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12787
12788         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12789         Don't set the data_offset twice.
12790
12791 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12792
12793         * testsuite/Makefile.in: Regenerate.
12794
12795 2009-12-03  Doug Kwan  <dougkwan@google.com>
12796
12797         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
12798         (Target_arm::do_finalize_sections): Add parameter for symbol table
12799         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
12800         * i386.cc (Target_i386::do_finalize_sections): Add an additional
12801         parameter for symbol table pointer.
12802         * layout.cc (Layout::finalize): Call Target::finalize_sections with
12803         an additional parameter for a pointer to symbol table.
12804         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
12805         parameter for a symbol table pointer.
12806         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
12807         * target.h (Target::finalize_sections, Target::do_finalize_sections):
12808         Ditto.
12809         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
12810         parameter for a symbol table pointer.
12811
12812 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
12813
12814         * incremental.cc (Incremental_inputs_header)
12815         (Incremental_inputs_header_write, Incremental_inputs_entry)
12816         (Incremental_inputs_entry_write): Move ...
12817         * incremental.h (Incremental_inputs_header)
12818         (Incremental_inputs_header_write, Incremental_inputs_entry)
12819         (Incremental_inputs_entry_write): here.
12820
12821 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12822
12823         * incremental.cc (make_sized_incremental_binary): Set the target.
12824         Error if it is incompatible.
12825         * output.h (Output_file): Add filename method.
12826
12827 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12828
12829         * incremental.cc (Incremental_inputs_entry): Remove unused argument
12830         from the get_* methods.
12831
12832 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12833
12834         * incremental-dump.cc (main): Check that the offeset of a script is 0.
12835         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12836         Write 0 for the data_offset of scripts.
12837
12838 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12839
12840         * testsuite/Makefile.am: Add the incremental_test.sh test.
12841         * testsuite/incremental_test.sh: New.
12842         * testsuite/incremental_test_1.c: New.
12843         * testsuite/incremental_test_2.c: New.
12844
12845 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
12846
12847         * incremental-dump.cc (main): Fix typos.
12848
12849 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
12850
12851         PR gold/11025
12852         * incremental-dump.cc (main): Use llu to print 64 bit values.
12853
12854 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
12855             H.J. Lu  <hongjiu.lu@intel.com>
12856
12857         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
12858         $(LIBDL).
12859         (incremental_dump_LDADD): Likewise.
12860         * Makefile.in: Regenerated.
12861
12862 2009-11-25  Doug Kwan  <dougkwan@google.com>
12863
12864         Revert:
12865
12866         2009-11-25  Doug Kwan  <dougkwan@google.com>
12867
12868                 * arm.cc (Target_arm::Target_arm): Move method definition
12869                 outside of class definition.  Add code to handle
12870                 --target1-rel, --target1-abs and --target2= options.
12871                 (Target_arm::get_reloc_reloc_type): Change method to be
12872                 non-static and const.
12873                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
12874                 New data member declaration.
12875                 (Target_arm::Scan::local, Target_arm::Scan::global,
12876                 Target_arm::Relocate::relocate,
12877                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12878                 Adjust call to Target_arm::get_real_reloc_type.
12879                 (Target_arm::get_real_reloc_type): Use command line options
12880                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12881                 * options.h (--target1-rel, --target1-abs, --target2): New
12882                 ARM-only options.
12883
12884 2009-11-25  Doug Kwan  <dougkwan@google.com>
12885
12886         * arm.cc (Target_arm::Target_arm): Move method definition outside of
12887         class definition.  Add code to handle --target1-rel, --target1-abs
12888         and --target2= options.
12889         (Target_arm::get_reloc_reloc_type): Change method to be non-static
12890         and const.
12891         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
12892         member declaration.
12893         (Target_arm::Scan::local, Target_arm::Scan::global,
12894         Target_arm::Relocate::relocate,
12895         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
12896         call to Target_arm::get_real_reloc_type.
12897         (Target_arm::get_real_reloc_type): Use command line options to
12898         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12899         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
12900         options.
12901
12902 2009-11-25  Doug Kwan  <dougkwan@google.com>
12903
12904         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
12905         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
12906         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
12907         formatting.
12908         (Arm_relocate_functions::thm_call): Replace body with a call to
12909         Arm_relocate_functions::thumb_branch_common.
12910         (Arm_relocate_functions::thm_jump24,
12911         Arm_relocate_functions::thm_xpc22): New method definitions.
12912         (Arm_relocate_functions::thumb_branch_common): New method definition.
12913         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
12914         operator.
12915         (Target_arm::Relocate::relocate): Adjust call to thm_call.
12916         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
12917
12918 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12919
12920         * Makefile.am: Build incremental-dump
12921         * Makefile.in: Regenerate.
12922         * incremental-dump.cc: New.
12923         * incremental.cc (Incremental_inputs_header_data,
12924         Incremental_inputs_entry_data): Move to incremental.h
12925         * incremental.h: (Incremental_inputs_header_data,
12926         Incremental_inputs_entry_data): Move from incremental.cc
12927
12928 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12929
12930         * incremental.cc (Incremental_inputs_header,
12931         Incremental_inputs_header_write, Incremental_inputs_entry,
12932         Incremental_inputs_entry_write): Add a typedef with the data type.
12933
12934 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12935
12936         * incremental.cc (Incremental_inputs_header,
12937         Incremental_inputs_header_write, Incremental_inputs_entry,
12938         Incremental_inputs_entry_write): Update comment about which
12939         type has the filed descriptions.
12940
12941 2009-11-15  Doug Kwan  <dougkwan@google.com>
12942
12943         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
12944         (Arm_relocate_functions::arm_branch_common): Change method defintion
12945         in class definition to a method declaration and update list of formal
12946         parameters.
12947         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
12948         Arm_relocation_functions::jump24): Adjust call to
12949         Arm_relocate_functions::arm_branch_common.  Update list of formal
12950         parameters.
12951         (Arm_relocate_functions::xpc25): New method definition.
12952         (Arm_relocate_functions::arm_branch_common): Move method defintion
12953         out from class definition.  Use stubs for mode-switching and extending
12954         branch ranges.
12955         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
12956         specially.  Change code to enable use of stubs in ARM branches.
12957
12958 2009-11-10  Doug Kwan  <dougkwan@google.com>
12959
12960         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
12961         in method declaration.
12962         (Target_arm::relocate_stub): New method declaration.
12963         (Target_arm::default_target): Change to return a pointer instead of
12964         a const reference.
12965         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
12966         Target_arm::default_target.
12967         (Arm_Relobj::do_relocate_sections): Remove options paramater in
12968         method definition.
12969         (Target_arm::relocate_section): Adjust view.
12970         (Target_arm::relocate_stub): New method definition.
12971
12972 2009-11-10  Doug Kwan  <dougkwan@google.com>
12973
12974         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
12975         a format warning.
12976         * incremental.cc (open_incremental_binary): Initialized local
12977         variables to avoid warnings.
12978         * object.cc (make_elf_object): Ditto.
12979         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
12980         a format warning.
12981
12982 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
12983
12984         PR gold/10930
12985         * testsuite/plugin_test.c: Include "config.h".
12986
12987 2009-11-09  Doug Kwan  <dougkwan@google.com>
12988
12989         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
12990         (arm_symbol_value): Remove.
12991         (Arm_relocate_functions::arm_branch_common,
12992         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
12993         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
12994         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
12995         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
12996         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12997         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12998         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12999         Arm_relocate_functions::thm_mobw_abs_nc,
13000         Arm_relocate_functions::thm_mov_abs,
13001         Arm_relocate_functions::movw_prel_nc,
13002         Arm_relocate_functions::thm_movt_abs,
13003         Arm_relocate_functions::movt_prel,
13004         Arm_relocate_functions::thm_movw_prel_nc,
13005         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
13006         (Target_arm::Relocate::relocate): Only decompose address into two
13007         parts if relocation type uses the thumb-bit and pass the actual
13008         bit instead of a flag indicating that the thumb-bit is used.  Adjust
13009         calls to methods in Arm_relocate_functions for this change.
13010
13011 2009-11-08  Ian Lance Taylor  <iant@google.com>
13012
13013         PR 10925
13014         * reloc.cc: Instantiate
13015         Sized_relobj::initialize_input_to_output_maps and
13016         Sized_relobj:free_input_to_output_maps.
13017
13018 2009-11-06  Ian Lance Taylor  <iant@google.com>
13019
13020         PR 10876
13021         * defstd.cc (in_segment): Set only_if_ref true for "end".
13022
13023 2009-11-06  Doug Kwan  <dougkwan@google.com>
13024
13025         * arm.cc (class Reloc_stub): Correct a comment.
13026         (Target_arm::Target_arm): Initialize arm_input_section_map_.
13027         (Target_arm::scan_section_for_stubs): New method declaration.
13028         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
13029         Change methods from private to protected.
13030         (Target_arm::do_may_relax): New method definition.
13031         (Target_arm::do_relax, Target_arm::group_sections,
13032         Target_arm::scan_reloc_for_stub,
13033         Target_arm::scan_reloc_section_for_stubs): New method declarations.
13034         (Target_arm::arm_input_section_map_): New data member declaration.
13035         (Target_arm::scan_reloc_for_stub,
13036         Target_arm::scan_reloc_section_for_stubs,
13037         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
13038         Target_arm::do_relax): New method definitions.
13039
13040 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
13041
13042         * configure.ac: Check for (struct stat)::st_mtim
13043         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
13044         * config.in: Regenerate.
13045         * configure: Regenerate.
13046
13047 2009-11-05  Ian Lance Taylor  <iant@google.com>
13048
13049         PR 10910
13050         * output.cc (Output_segment::add_output_section): Add missing
13051         return statement.
13052
13053 2009-11-04  Ian Lance Taylor  <iant@google.com>
13054
13055         PR 10880
13056         * object.h (class Object): Add is_needed and set_is_needed
13057         methods.  Add is_needed_ field.  Make bool fields into bitfields.
13058         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
13059         defined in a dynamic object and referenced by a regular object,
13060         set is_needed for the dynamic object.
13061         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
13062         if the file is marked with as_needed and it is not needed.
13063
13064 2009-11-04  Ian Lance Taylor  <iant@google.com>
13065
13066         PR 10887
13067         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
13068         tags if data is discarded by linker script.
13069         * i386.cc (Target_i386::do_finalize_sections): Likewise.
13070         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
13071         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
13072         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
13073
13074 2009-11-04  Ian Lance Taylor  <iant@google.com>
13075
13076         * layout.cc (Layout::get_output_section): Add is_interp and
13077         is_dynamic_linker_section parameters.  Change all callers.
13078         (Layout::choose_output_section): Likewise.
13079         (Layout::make_output_section): Likewise.
13080         (Layout::add_output_section_data): Add is_dynamic_linker_section
13081         parameter.  Change all callers.
13082         * layout.h (class Layout): Update declarations.
13083         * output.h (class Output_section): Add is_interp, set_is_interp,
13084         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
13085         Add is_interp_, is_dynamic_linker_section_ fields.  Change
13086         generate_code_fills_at_write_ to a bitfield.
13087         * output.cc (Output_section::Output_sections): Initialize new
13088         fields.
13089         (Output_segment::add_output_section): Add do_sort parameter.
13090         Change all callers.
13091
13092 2009-11-03  Ian Lance Taylor  <iant@google.com>
13093
13094         PR 10860
13095         * options.h (class General_options): Add --warn-common.
13096         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
13097         merging two common symbols.
13098         (Symbol_table::should_override): Handle --warn-common when merging
13099         a common symbol with a defined symbol.  Use report_resolve_problem
13100         for multiple definitions.
13101         (Symbol_table::report_resolve_problem): New function.
13102         * symtab.h (class Symbol_table): Declare report_resolve_problem.
13103
13104 2009-11-03  Doug Kwan  <dougkwan@google.com>
13105
13106         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
13107         stub_factory_.
13108         (Target_arm::stub_factory): New method definition.
13109         (Target_arm::new_arm_input_section,
13110         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
13111         Target_arm::reloc_uses_thumb_bit): New method declarations.
13112         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
13113         New type definitions.
13114         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
13115         member declarations.
13116         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
13117         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
13118         New method definitions.
13119
13120 2009-11-03  Ian Lance Taylor  <iant@google.com>
13121
13122         * options.h (class General_options): Add --warn_constructors.
13123
13124 2009-11-03  Ian Lance Taylor  <iant@google.com>
13125
13126         PR 10893
13127         * defstd.cc (in_section): Add entries for __rel_iplt_start,
13128         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
13129
13130 2009-11-03  Ian Lance Taylor  <iant@google.com>
13131
13132         PR 10895
13133         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
13134         --msgid-bugs-address.
13135         (install-pdf): New target.
13136         (install-data_yes): Look up one directory to find mkinstalldirs.
13137
13138 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
13139
13140         * po/Make-in (.po.gmo): Don't generate .gmo files in source
13141         tree.
13142
13143 2009-10-30  Doug Kwan  <dougkwan@google.com>
13144
13145         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
13146
13147 2009-10-30  Doug Kwan  <dougkwan@google.com>
13148
13149         * arm.cc (Stub_addend_reader): New struct template definition
13150         and partial specializations.
13151         (Stub_addend_reader::operator()): New method definition for a
13152         partially specialized template.
13153
13154 2009-10-30  Doug Kwan  <dougkwan@google.com>
13155
13156         * arm.cc (Arm_relobj::processor_specific_flags): New method
13157         definition.
13158         (Arm_relobj::do_read_symbols): New method declaration.
13159         (Arm_relobj::processor_specific_flags_): New data member declaration.
13160         (Arm_dynobj): New class definition.
13161         (Target_arm::do_finalize_sections): Add input_objects parameter.
13162         (Target_arm::do_adjust_elf_header): New method declaration.
13163         (Target_arm::are_eabi_versions_compatible,
13164         (Target_arm::merge_processor_specific_flags): New method declaration.
13165         (Target_arm::do_make_elf_object): New overloaded method definitions
13166         and declaration.
13167         (Arm_relobj::do_read_symbols): New method definition.
13168         (Arm_dynobj::do_read_symbols): Ditto.
13169         (Target_arm::do_finalize_sections): Add input_objects parameters.
13170         Merge processor-specific flags from all input objects.
13171         (Target_arm::are_eabi_versions_compatible,
13172         Target_arm::merge_processor_specific_flags,
13173         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
13174         New method definitions.
13175         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
13176         Input_objects pointer type parameter.
13177         * layout.cc (Layout::finalize): Pass input objects to target's.
13178         finalize_sections function.
13179         * output.cc (Output_file_header::do_sized_write): Set ELF file
13180         header's processor-specific flags.
13181         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
13182         Input_objects pointer type parameter.
13183         * sparc.cc (Target_sparc::do_finalize_sections): Same.
13184         * target.h (Input_objects): New forward class declaration.
13185         (Target::processor_specific_flags,
13186         Target::are_processor_specific_flags_sect): New method definitions.
13187         (Target::finalize_sections): Add input_objects parameter.
13188         (Target::Target): Initialize processor_specific_flags_ and
13189         are_processor_specific_flags_set_.
13190         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
13191         parameter.
13192         (Target::set_processor_specific_flags): New method definition.
13193         (Target::processor_specific_flags_,
13194         Target::are_processor_specific_flags_set_): New data member
13195         declarations.
13196         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
13197         Input_objects pointer type parameter.
13198
13199 2009-10-30  Doug Kwan  <dougkwan@google.com>
13200
13201         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
13202
13203 2009-10-28  Ian Lance Taylor  <iant@google.com>
13204
13205         * object.h (class Relobj): Drop options parameter from
13206         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
13207         do_scan_relocs, do_relocate.  Change all callers.
13208         (class Sized_relobj): Drop options parameters from
13209         do_gc_process_relocs, do_scan_relocs, do_relocate,
13210         do_relocate_sections, relocate_sections, emit_relocs_scan,
13211         emit_relocs_scan_reltype.  Change all callers.
13212         (struct Relocate_info): Remove options field and all references to
13213         it.
13214         * reloc.h (class Read_relocs): Remove options constructor
13215         parameter and options_ field.  Change all callers.
13216         (class Gc_process_relocs, class Scan_relocs): Likewise.
13217         (class Relocate_task): Likewise.
13218         * target-reloc.h (scan_relocs): Remove options parameter.  Change
13219         all callers.
13220         (scan_relocatable_relocs): Likewise.
13221         * target.h (class Sized_target): Remove options parameter from
13222         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
13223         all callers.
13224         * gc.h (gc_process_relocs): Remove options parameter.  Change all
13225         callers.
13226         * arm.cc: Update functions to remove options parameters.
13227         * i386.cc: Likewise.
13228         * powerpc.cc: Likewise.
13229         * sparc.cc: Likewise.
13230         * x86_64.cc: Likewise.
13231         * testsuite/testfile.cc: Likewise.
13232
13233 2009-10-28  Doug Kwan  <dougkwan@google.com>
13234
13235         * arm.cc (Arm_relobj): New class definition.
13236         (Arm_relobj::scan_sections_for_stubs,
13237         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
13238         New method definitions.
13239
13240 2009-10-28  Cary Coutant  <ccoutant@google.com>
13241
13242         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
13243         (Plugin::cleanup_done_): New member.
13244         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
13245         (Plugin_manager::cleanup_done_): Remove.
13246         (Plugin_manager::add_input_file): Edit error message.
13247         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
13248         (Plugin_manager::cleanup): Remove use of cleanup_done_.
13249
13250 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
13251
13252         * fileread.cc: (File_read::View::~View): Use the new
13253         data_ownership_ filed.
13254         (File_read::~File_read): Dispose the new whole_file_view_.
13255         (File_read::open): Mmap the whole file if needed.
13256         (File_read::open): Use whole_file_view_ instead of contents_.
13257         (File_read::find_view): Use whole_file_view_ if applicable.
13258         (File_read::do_read): Use whole_file_view_ instead of contents_.
13259         (File_read::make_view): Use whole_file_view_ instead of contents_,
13260         update File_read::View::View call.
13261         (File_read::find_or_make_view): Update File_read::View::View
13262         call.
13263         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
13264         remove contents_
13265         (File_read::View::Data_ownership): New enum.
13266         (File_read::View::View): Replace bool mapped_ with Data_ownership
13267         argument.
13268         (File_read::View::mapped_): Remove (replaced by data_ownership_).
13269         (File_read::View::data_ownership_): New field.
13270         (File_read::contents_): Remove (replaced by whole_file_view_).
13271         (File_read::whole_file_view_): New field.
13272         * options.h (class General_options): Add --keep-files-mapped.
13273
13274 2009-10-27  Cary Coutant  <ccoutant@google.com>
13275
13276         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
13277         * testsuite/Makefile.am (plugin_test_5): New test case.
13278         * testsuite/Makefile.in: Regenerate.
13279
13280 2009-10-25  Doug Kwan  <dougkwan@google.com>
13281
13282         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
13283         from private to protected to allow access by child class.
13284         (Sized_relobj::do_relocate_sections): New method declaration.
13285         (Sized_relobj::relocate_sections): Virtualize.
13286         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
13287         Sized_relobj::relocate_sections.  Instantiate template explicitly
13288         for different target sizes and endianity.
13289
13290 2009-10-24  Doug Kwan  <dougkwan@google.com>
13291
13292         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
13293         (Arm_input_section::as_arm_input_section): New method.
13294         (Arm_output_section): New class definition.
13295         (Arm_output_section::create_stub_group,
13296         Arm_output_section::group_sections): New method definitions.
13297
13298 2009-10-22  Doug Kwan  <dougkwan@google.com>
13299
13300         * arm.cc (Arm_input_section): New class definition.
13301         (Arm_input_section::init, Arm_input_section:do_write,
13302         Arm_input_section::set_final_data_size,
13303         Arm_input_section::do_reset_address_and_file_offset): New method
13304         definitions.
13305
13306 2009-10-21  Doug Kwan  <dougkwan@google.com>
13307
13308         * arm.cc (Stub_table, Arm_input_section): New forward class
13309         declarations.
13310         (Stub_table): New class defintion.
13311         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
13312         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
13313         New method definition.
13314
13315 2009-10-21  Doug Kwan  <dougkwan@google.com>
13316
13317         * arm.cc: Update copyright comments.
13318         (Target_arm): New forward class template declaration.
13319         (Arm_address): New type.
13320         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
13321         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
13322         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
13323         constants.
13324         (Insn_template): Same.
13325         (DEF_STUBS): New macro.
13326         (Stub_type): New enum type.
13327         (Stub_template): New class definition.
13328         (Stub): Same.
13329         (Reloc_stub): Same.
13330         (Stub_factory): Same.
13331         (Target_arm::Target_arm): Initialize may_use_blx_ and
13332         should_force_pic_veneer_.
13333         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
13334         Target_arm::should_force_pic_veneer,
13335         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
13336         Target_arm::using_thumb_only, Target_arm:;default_target): New
13337         method defintions.
13338         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
13339         New data member declarations.
13340         (Insn_template::size, Insn_template::alignment): New method defintions.
13341         (Stub_template::Stub_template): New method definition.
13342         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
13343         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
13344         (Stub_factory::Stub_factory): New method definition.
13345         * gold.h (string_hash): New template.
13346         * output.h (Input_section_specifier::hash_value): Use
13347         gold::string_hash.
13348         (Input_section_specifier::string_hash): Remove.
13349         * stringpool.cc (Stringpool_template::string_hash): Use
13350         gold::string_hash.
13351
13352 2009-10-20  Doug Kwan  <dougkwan@google.com>
13353
13354         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
13355         symbols of relaxed input sections.
13356         * output.h (Output_section::find_relaxed_input_section): Make
13357         method public.
13358
13359 2009-10-16  Doug Kwan  <dougkwan@google.com>
13360
13361         * dynobj.cc (Versions::Versions): Initialize version_script_.
13362         Only insert base version symbol definition for a shared object
13363         if version script defines any version versions.
13364         (Versions::define_base_version): New method definition.
13365         (Versions::add_def): Check that base version is not needed.
13366         (Versions::add_need): Define base version lazily.
13367         * dynobj.h (Versions::define_base_version): New method declaration.
13368         (Versions::needs_base_version_): New data member declaration.
13369         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
13370         (check_DATA): Add no_version_test.stdout.
13371         (libno_version_test.so, no_version_test.o no_version_test.stdout):
13372         New make rules.
13373         * testsuite/Makefile.in: Regenerate.
13374         * testsuite/no_version_test.c: New file.
13375         * testsuite/no_version_test.sh: Ditto.
13376
13377 2009-10-16  Doug Kwan  <dougkwan@google.com>
13378
13379         * expression.cc (class Segment_start_expression): New class definition.
13380         (Segment_start_expression::value): New method definition.
13381         (script_exp_function_segment_start): Return a new
13382         Segment_start_expression.
13383         * gold/script-c.h (script_saw_segment_start_expression): New function
13384         prototype.
13385         * script-sections.cc (Script_sections::Script_sections): Initialize
13386         SAW_SEGMENT_START_EXPRESSION_ to false.
13387         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
13388         and -Tbbs options to specify section addresses if given in
13389         command line and no SEGMENT_START expression is seen in a script.
13390         * script-sections.h (Script_sections::saw_segment_start_expression,
13391         Script_sections::set_saw_segment_start_expression): New method
13392         definition.
13393         (Script_sections::saw_segment_start_expression_): New data member
13394         declaration.
13395         * script.cc (script_saw_segment_start_expression): New function.
13396         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
13397         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
13398         script_test_7.sh and script_test_8.sh.
13399         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
13400         script_test_8.stdout.
13401         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
13402         (script_test_6, script_test_6.stdout, script_test_7,
13403         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
13404         * Makefile.in: Regenerate.
13405         * testsuite/script_test_6.sh: New file.
13406         * testsuite/script_test_6.t: Same.
13407         * testsuite/script_test_7.sh: Same.
13408         * testsuite/script_test_7.t: Same.
13409         * testsuite/script_test_8.sh: Same.
13410
13411 2009-10-16  Doug Kwan  <dougkwan@google.com>
13412
13413         * output.cc (Output_segment::set_section_list_address): Cast
13414         expressions to unsigned long long type to avoid format warnings.
13415
13416 2009-10-15  Ian Lance Taylor  <iant@google.com>
13417
13418         * script.cc (Script_options::add_symbol_assignment): Always add a
13419         dot assignment to script_sections_.
13420         * script-sections.cc (Script_sections::add_dot_assignment):
13421         Initialize if necessary.
13422
13423         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
13424         program headers with no load segment if there is a linker script.
13425
13426         * layout.cc (Layout::set_segment_offsets): Align the file offset
13427         to the segment aligment for -N or -n with no load segment.
13428         * output.cc (Output_segment::add_output_section): Don't crash if
13429         the first section is a TLS section.
13430         (Output_segment::set_section_list_addresses): Print an error
13431         message if the address moves backward in a linker script.
13432         * script-sections.cc
13433         (Output_section_element_input::set_section_addresses): Don't
13434         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
13435         (Orphan_output_section::set_section_addresses): Likewise.
13436
13437 2009-10-15  Doug Kwan  <dougkwan@google.com>
13438
13439         * layout.cc (Layout::finish_dynamic_section): Generate tags
13440         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
13441         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
13442         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
13443
13444 2009-10-14  Ian Lance Taylor  <iant@google.com>
13445
13446         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
13447         fields.
13448         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
13449         data_shdr fields of relinfo.
13450         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
13451         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
13452         R_386_TLS_LDO_32, adjust based on section flags.
13453         (Target_i386::Relocate::fix_up_ldo): Remove.
13454
13455 2009-10-13  Ian Lance Taylor  <iant@google.com>
13456
13457         Add support for -pie.
13458         * options.h (class General_options): Add -pie and
13459         --pic-executable.
13460         (General_options::output_is_position_independent): Test -pie.
13461         (General_options::output_is_executable): Return true if not shared
13462         and not relocatable.
13463         (General_options::output_is_pie): Remove.
13464         * options.cc (General_options::finalize): Reject incompatible uses
13465         of -pie.
13466         * gold.cc (queue_middle_tasks): A -pie link is not static.
13467         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
13468         * symtab.cc (Symbol::final_value_is_known): Return false if
13469         output_is_position_independent.
13470         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
13471         output_is_position_independent.
13472         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
13473         output_is_position_independent.
13474         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
13475         output_is_position_independent.
13476         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
13477         two_file_pie_test.
13478         (basic_pie_test.o, basic_pie_test): New targets.
13479         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
13480         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
13481         (two_file_pie_test): New target.
13482         * testsuite/Makefile.in: Rebuild.
13483         * README: Remove note saying that -pie is not supported.
13484
13485 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
13486
13487         * options.h (class General_options): Add -init and -fini.
13488         * layout.cc (Layout::finish_dynamic_section): Emit
13489         given init and fini functions.
13490
13491 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
13492
13493         * gc.h (gc_process_relocs): Check if icf is enabled using new
13494         function.
13495         * gold.cc (queue_initial_tasks): Likewise.
13496         (queue_middle_tasks): Likewise.
13497         * object.cc (do_layout): Likewise.
13498         * symtab.cc (is_section_folded): Likewise.
13499         * main.cc (main): Likewise.
13500         * reloc.cc (Read_relocs::run): Likewise.
13501         (Sized_relobj::do_scan_relocs): Likewise.
13502         * icf.cc (is_function_ctor_or_dtor): New function.
13503         (Icf::find_identical_sections): Check if function is ctor or dtor when
13504         safe icf is chosen.
13505         * options.h (General_options::icf): Change option to be an enum.
13506         (Icf_status): New enum.
13507         (icf_enabled): New method.
13508         (icf_safe_folding): New method.
13509         (set_icf_status): New method.
13510         (icf_status_): New variable.
13511         * (options.cc) (General_options::finalize): Set icf_status_.
13512         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
13513         icf_test and icf_keep_unique_test to use the --icf enum flag.
13514         * testsuite/icf_safe_test.sh: New file.
13515         * testsuite/icf_safe_test.cc: New file.
13516
13517 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
13518
13519         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
13520         includes to gc.h and icf.h.
13521         * arm.cc: Include gc.h.
13522         * gold.cc: Likewise.
13523         * i386.cc: Likewise.
13524         * powerpc.cc: Likewise.
13525         * sparc.cc: Likewise.
13526         * x86_64.cc: Likewise.
13527         * gc.h: Include icf.h.
13528
13529 2009-10-11  Ian Lance Taylor  <iant@google.com>
13530
13531         * plugin.cc: Include "gold.h" before other header files.
13532
13533 2009-10-10  Chris Demetriou  <cgd@google.com>
13534
13535         * options.h (Input_file_argument::Input_file_type): New enum.
13536         (Input_file_argument::is_lib_): Replace with...
13537         (Input_file_argument::type_): New member.
13538         (Input_file_argument::Input_file_argument): Take Input_file_type
13539         'type' rather than boolean 'is_lib' as second argument.
13540         (Input_file_argument::is_lib): Use type_.
13541         (Input_file_argument::is_searched_file): New function.
13542         (Input_file_argument::may_need_search): Handle is_searched_file.
13543         * options.cc (General_options::parse_library): Support -l:filename.
13544         (General_options::parse_just_symbols): Update for Input_file_argument
13545         changes.
13546         (Command_line::process): Likewise.
13547         * archive.cc (Archive::get_file_and_offset): Likewise.
13548         * plugin.cc (Plugin_manager::release_input_file): Likewise.
13549         * script.cc (read_script_file, script_add_file): Likewise.
13550         * fileread.cc (Input_file::Input_file): Likewise.
13551         (Input_file::will_search_for): Handle is_searched_file.
13552         (Input_file::open): Likewise.
13553         * readsyms.cc (Read_symbols::get_name): Likewise.
13554         * testsuite/Makefile.am (searched_file_test): New test.
13555         * testsuite/Makefile.in: Regenerate.
13556         * testsuite/searched_file_test.cc: New file.
13557         * testsuite/searched_file_test_lib.cc: New file.
13558
13559 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13560             Ian Lance Taylor  <iant@google.com>
13561
13562         * descriptor.cc: Include <cstdio> and "binary-io.h".
13563         (Descriptors::open): Open the files in binary mode always.
13564         * script.cc (Lex::get_token): Treat \r as whitespace.
13565
13566 2009-10-09  Ian Lance Taylor  <iant@google.com>
13567
13568         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
13569
13570 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13571             Ian Lance Taylor  <iant@google.com>
13572
13573         * configure.ac: Check for readv function also.
13574         * fileread.cc (readv): Define if not HAVE_READV.
13575         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
13576         does not exist.
13577         * config.in: Regenerate.
13578         * configure: Regenerate.
13579
13580 2009-10-09  Doug Kwan  <dougkwan@google.com>
13581
13582         * layout.cc (Layout::make_output_section): Call target hook to make
13583         ordinary output section.
13584         (Layout::finalize): Adjust parameter list of call the
13585         Target::may_relax().
13586         * layout.h (class Layout::section_list): New method.
13587         * merge.h (Output_merge_base::entsize): Change visibility to public.
13588         (Output_merge_base::is_string, Output_merge_base::do_is_string):
13589         New methods.
13590         (Output_merge_string::do_is_string): New method.
13591         * object.cc (Sized_relobj::do_setup): renamed from
13592         Sized_relobj::set_up.
13593         * object.h (Sized_relobj::adjust_shndx,
13594         Sized_relobj::initializ_input_to_output_maps,
13595         Sized_relobj::free_input_to_output_maps): Change visibilities to
13596         protected.
13597         (Sized_relobj::setup): Virtualize.
13598         (Sized_relobj::do_setup): New method declaration.
13599         (Sized_relobj::invalidate_section_offset,
13600         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
13601         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
13602         * options.cc (parse_int): New function.
13603         * options.h (parse_int): New declaration.
13604         (DEFINE_int): New macro.
13605         (stub_group_size): New option.
13606         * output.cc (Output_section::Output_section): Initialize memebers
13607         merge_section_map_, merge_section_by_properties_map_,
13608         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
13609         (Output_section::add_input_section): Handled deferred code-fill
13610         generation and remove an old comment.
13611         (Output_section::add_relaxed_input_section): New method definition.
13612         (Output_section::add_merge_input_section): Use merge section by
13613         properties map to speed to search.  Update merge section maps
13614         as appropriate.
13615         (Output_section::build_relaxation_map): New method definition.
13616         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
13617         Same.
13618         (Output_section::relax_input_section): Renamed to
13619         Output_section::convert_input_sections_to_relaxed_sections and change
13620         interface to take a vector of pointers to relaxed sections.
13621         (Output_section::find_merge_section,
13622         Output_section::find_relaxed_input_section): New method definitions.
13623         (Output_section::is_input_address_mapped,
13624         Output_section::output_offset, Output_section::output_address):
13625         Use output section data maps to speed up searching.
13626         (Output_section::find_starting_output_address): Add comments.
13627         (Output_section::do_write,
13628         Output_section::write_to_postprocessing_buffer): Do code-fill
13629         generation as appropriate.
13630         (Output_section::get_input_sections): Invalidate relaxed input section
13631         map.
13632         (Output_section::restore_states): Adjust type of checkpoint .
13633         Invalidate relaxed input section map.
13634         * output.h (Output_merge_base): New class declaration.
13635         (Input_section_specifier): New class defintion.
13636         (class Output_relaxed_input_section) Change base class to
13637         Output_section_data_build.
13638         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
13639         base class initializer.
13640         (Output_section::add_relaxed_input_section): New method declaration.
13641         (Output_section::Input_section): Change visibility to protected.
13642         (Output_section::Input_section::relobj,
13643         Output_section::Input_section::shndx): Handle relaxed input sections.
13644         Output_section::input_sections) Change visibility to protected.  Also
13645         define overload to return a non-const pointer.
13646         (Output_section::Merge_section_properties): New class defintion.
13647         (Output_section::Merge_section_by_properties_map,
13648         Output_section::Output_section_data_by_input_section_map,
13649         Output_section::Relaxation_map): New types.
13650         (Output_section::relax_input_section): Rename method to
13651         Output_section::convert_input_sections_to_relaxed_sections and change
13652         interface to take a vector of relaxed section pointers.
13653         (Output_section::find_merge_section,
13654         Output_section::find_relaxed_input_section,
13655         Output_section::build_relaxation_map,
13656         Output_section::convert_input_sections_in_list_to_relaxed_sections):
13657         New method declarations.
13658         (Output_section::merge_section_map_
13659         Output_section::merge_section_by_properties_map_,
13660         Output_section::relaxed_input_section_map_,
13661         Output_section::is_relaxed_input_section_map_valid_,
13662         Output_section::generate_code_fills_at_write_): New data members.
13663         * script-sections.cc
13664         (Output_section_element_input::set_section_addresses): Call
13665         current_data_size and addralign methods of relaxed input sections.
13666         (Orphan_output_section::set_section_addresses): Call current_data_size
13667         and addralign methods of relaxed input sections.
13668         * symtab.cc (Symbol_table::compute_final_value): Extract template
13669         from the body of Symbol_table::sized_finalize_symbol.
13670         (Symbol_table::sized_finalized_symbol): Call
13671         Symbol_table::compute_final_value.
13672         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
13673         (Symbol_table::compute_final_value): New templated method declaration.
13674         * target.cc (Target::do_make_output_section): New method defintion.
13675         * target.h (Target::make_output_section): New method declaration.
13676         (Target::relax): Add more parameters for input objects, symbol table
13677         and layout.  Adjust call to do_relax.
13678         (Target::do_make_output_section): New method declaration.
13679         (Target::do_relax): Add parameters for input objects, symbol table
13680         and layout.
13681
13682 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13683
13684         * pread.c: Include stdio.h.
13685
13686 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13687
13688         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
13689         defined.
13690
13691 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13692
13693         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
13694         Change read_shndx type to unsigned int.
13695         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13696         int.
13697         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13698         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
13699         Change read_shndx type to unsigned int.
13700         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13701         int.
13702         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13703         * layout.cc (Layout::create_symtab_sections): Cast the result of
13704         local_symcount * symsize to off_t in the gold_assert.
13705
13706 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13707
13708         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
13709         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
13710         R_ARM_BASE_ABS.
13711         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
13712         (Arm_relocate_functions::thm_abs5): New function.
13713         (Arm_relocate_functions::abs12): New function.
13714         (Arm_relocate_functions::abs16): New function.
13715         (Arm_relocate_functions::base_abs): New function.
13716         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
13717         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
13718         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
13719         R_ARM_BASE_ABS.
13720         (Scan::global): Likewise.
13721         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
13722         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
13723         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
13724         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
13725         R_ARM_BASE_ABS.
13726
13727 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13728
13729         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
13730         (Arm_relocate_functions::movt_prel): New function.
13731         (Arm_relocate_functions::thm_movw_prel_nc): New function.
13732         (Arm_relocate_functions::thm_movt_prel): New function.
13733         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
13734         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
13735         (Scan::global, Relocate::relocate): Likewise.
13736         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13737
13738 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13739
13740         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
13741         Incremental_checker.
13742         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
13743         unsigned int.
13744         (class Incremental_inputs_header): New class.
13745         (Incremental_inputs_header_writer): Edit comment.
13746         (Incremental_inputs_entry): New class.
13747         (Incremental_inputs_entry_writer): Edit comment.
13748         (Sized_incremental_binary::do_find_incremental_inputs_section):
13749         Add *strtab_shndx parameter, fill it.
13750         (Sized_incremental_binary::do_check_inputs): New method.
13751         (Incremental_checker::can_incrementally_link_output_file): Use
13752         Sized_incremental_binary::check_inputs.
13753         (Incremental_inputs::report_command_line): Save command line in
13754         command_line_.
13755         * incremental.h:
13756         (Incremental_binary::find_incremental_inputs_section): New
13757         method.
13758         (Incremental_binary::do_find_incremental_inputs_section): Add
13759         strtab_shndx parameter.
13760         (Incremental_binary::do_check_inputs): New pure virtual method.
13761         (Sized_incremental_binary::do_check_inputs): Declare.
13762         (Incremental_checker::Incremental_checker): Add incremental_inputs
13763         parameter, use it to initialize incremental_inputs_.
13764         (Incremental_checker::incremental_inputs_): New field.
13765         (Incremental_checker::command_line): New method.
13766         (Incremental_checker::inputs): New method.
13767         (Incremental_checker::command_line_): New field.
13768
13769 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13770
13771         * incremental.cc: Include <cstdarg> and "target-select.h".
13772         (vexplain_no_incremental): New function.
13773         (explain_no_incremental): New function.
13774         (Incremental_binary::error): New method.
13775         (Sized_incremental_binary::do_find_incremental_inputs_section): New
13776         method.
13777         (make_sized_incremental_binary): New function.
13778         (open_incremental_binary): New function.
13779         (can_incrementally_link_file): Add checks if output is ELF and has
13780         inputs section.
13781         * incremental.h: Include "elfcpp_file.h" and "output.h".
13782         (Incremental_binary): New class.
13783         (Sized_incremental_binary): New class.
13784         (open_incremental_binary): Declare.
13785         * object.cc (is_elf_object): Use
13786         elfcpp::Elf_recognizer::is_elf_file.
13787         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
13788         * output.h (Output_file::filesize): New method.
13789
13790 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13791
13792         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
13793         New function.
13794         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
13795         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
13796         function.
13797         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
13798         function.
13799         (Arm_relocate_functions::movw_abs_nc): New function.
13800         (Arm_relocate_functions::movt_abs): New function.
13801         (Arm_relocate_functions::thm_movw_abs_nc): New function.
13802         (Arm_relocate_functions::thm_movt_abs): New function.
13803         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
13804         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
13805         (Scan::global): Likewise.
13806         (Relocate::relocate): Likewise.
13807         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13808
13809 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13810
13811         * arm.cc (Arm_relocate_functions::got_prel) New function.
13812         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
13813         (Relocate::relocate): Likewise.
13814         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13815
13816 2009-10-06  Ian Lance Taylor  <iant@google.com>
13817
13818         * options.h (class General_options): Define
13819         split_stack_adjust_size parameter.
13820         * object.h (class Object): Add uses_split_stack_ and
13821         has_no_split_stack_ fields.  Add uses_split_stack and
13822         has_no_split_stack accessor functions.  Declare
13823         handle_split_stack_section.
13824         (class Reloc_symbol_changes): Define.
13825         (class Sized_relobj): Define Function_offsets.  Declare
13826         split_stack_adjust, split_stack_adjust_reltype, and
13827         find_functions.
13828         * object.cc (Object::handle_split_stack_section): New function.
13829         (Sized_relobj::do_layout): Call handle_split_stack_section.
13830         * dynobj.cc (Sized_dynobj::do_layout): Call
13831         handle_split_stack_section.
13832         * reloc.cc (Sized_relobj::relocate_sections): Call
13833         split_stack_adjust for executable sections in split_stack
13834         objects.  Pass reloc_map to relocate_section.
13835         (Sized_relobj::split_stack_adjust): New function.
13836         (Sized_relobj::split_stack_adjust_reltype): New function.
13837         (Sized_relobj::find_functions): New function.
13838         * target-reloc.h: Include "object.h".
13839         (relocate_section): Add reloc_symbol_changes parameter.  Change
13840         all callers.
13841         * target.h (class Target): Add calls_non_split method.  Declare
13842         do_calls_non_split virtual method.  Declare match_view and
13843         set_view_to_nop.
13844         * target.cc: Include "elfcpp.h".
13845         (Target::do_calls_non_split): New function.
13846         (Target::match_view): New function.
13847         (Target::set_view_to_nop): New function.
13848         * gold.cc (queue_middle_tasks): Give an error if mixing
13849         split-stack and non-split-stack objects with -r.
13850         * i386.cc (Target_i386::relocate_section): Add
13851         reloc_symbol_changes parameter.
13852         (Target_i386::do_calls_non_split): New function.
13853         * x86_64.cc (Target_x86_64::relocate_section): Add
13854         reloc_symbol_changes parameter.
13855         (Target_x86_64::do_calls_non_split): New function.
13856         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
13857         parameter.
13858         * powerpc.cc (Target_powerpc::relocate_section): Add
13859         reloc_symbol_changes parameter.
13860         * sparc.cc (Target_sparc::relocate_section): Add
13861         reloc_symbol_changes parameter.
13862         * configure.ac: Call AM_CONDITIONAL for the default target.
13863         * configure: Rebuild.
13864         * testsuite/Makefile.am (TEST_AS): New variable.
13865         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
13866         (check_DATA): Add split_i386 and split_x86_64 files.
13867         (SPLIT_DEFSYMS): Define.
13868         (split_i386_[1234n].o): New targets.
13869         (split_i386_[124]): New targets.
13870         (split_i386_[1234r].stdout): New targets.
13871         (split_x86_64_[1234n].o): New targets.
13872         (split_x86_64_[124]): New targets.
13873         (split_x86_64_[1234r].stdout): New targets.
13874         (MOSTLYCLEANFILES): Add new executables.
13875         * testsuite/split_i386.sh: New file.
13876         * testsuite/split_x86_64.sh: New file.
13877         * testsuite/split_i386_1.s: New file.
13878         * testsuite/split_i386_2.s: New file.
13879         * testsuite/split_i386_3.s: New file.
13880         * testsuite/split_i386_4.s: New file.
13881         * testsuite/split_i386_n.s: New file.
13882         * testsuite/split_x86_64_1.s: New file.
13883         * testsuite/split_x86_64_2.s: New file.
13884         * testsuite/split_x86_64_3.s: New file.
13885         * testsuite/split_x86_64_4.s: New file.
13886         * testsuite/split_x86_64_n.s: New file.
13887         * testsuite/testfile.cc (Target_test): Update relocation_section
13888         function.
13889         * testsuite/Makefile.in: Rebuild.
13890
13891 2009-10-06  Ian Lance Taylor  <iant@google.com>
13892
13893         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
13894         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
13895         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
13896         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
13897         the address on ldo_addrs_.
13898         (Target_i386::Relocate::fix_up_ldo): New function.
13899
13900 2009-10-06   Rafael Espindola  <espindola@google.com>
13901
13902         * plugin.cc (add_input_library): New.
13903         (Plugin::load): Add add_input_library to tv.
13904         (Plugin_manager::add_input_file): Add the is_lib argument.
13905         (add_input_file): Update call to Plugin_manager::add_input_file.
13906         (add_input_library): New.
13907         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
13908
13909 2009-09-30  Doug Kwan  <dougkwan@google.com>
13910
13911         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
13912         symbol and call Symbol::may_need_copy_reloc to determine if
13913         a copy reloc is needed.
13914         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
13915         nocopyreloc is given in command line.
13916         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
13917         given in command line.
13918         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
13919         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
13920         of the removed Target_i386::may_need_copy_reloc.
13921         * options.h (copyreloc): New option with default value false.
13922         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13923         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
13924         instead of the removed Target_powerpc::may_need_copy_reloc.
13925         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13926         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
13927         instead of the removed Target_sparc::may_need_copy_reloc.
13928         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
13929         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
13930         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
13931         instead of the removed Target_x86_64::may_need_copy_reloc.
13932
13933 2009-09-30  Ian Lance Taylor  <iant@google.com>
13934
13935         * object.h (class Object): Remove target_ field, and target,
13936         sized_target, and set_target methods.
13937         (Object::sized_target): Remove.
13938         (class Sized_relobj): Update declarations.  Remove sized_target.
13939         * object.cc (Sized_relobj::setup): Remove target parameter.
13940         Change all callers.
13941         (Input_objects::add_object): Don't do anything with the target.
13942         (make_elf_sized_object): Add punconfigured parameter.  Change all
13943         callers.  Set or test parameter target.
13944         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
13945         Change all callers.
13946         * parameters.cc (Parameters::set_target): Change parameter type to
13947         be non-const.
13948         (Parameters::default_target): Remove.
13949         (set_parameters_target): Change parameter type to be non-const.
13950         (parameters_force_valid_target): New function.
13951         (parameters_clear_target): New function.
13952         * parameters.h (class Parameters): Update declarations.  Remove
13953         default_target method.  Add sized_target and clear_target
13954         methods.  Change target_ to be non-const.
13955         (set_parameters_target): Update declaration.
13956         (parameters_force_valid_target): Declare.
13957         (parameters_clear_target): Declare.
13958         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
13959         as NULL if we aren't searching.
13960         (Add_symbols::run): Don't check for compatible target.
13961         * fileread.cc (Input_file::open_binary): Call
13962         parameters_force_valid_target.
13963         * gold.cc (queue_middle_tasks): Likewise.
13964         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
13965         set_target on object.
13966         * dynobj.h (class Sized_dynobj): Update declarations.
13967         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
13968         make_elf_object returns NULL.
13969         (Archive::include_member): Don't check whether object target is
13970         compatible.
13971         * output.cc (Output_section::add_input_section): Get target from
13972         parameters.
13973         (Output_section::relax_input_section): Likewise.
13974         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
13975         parameters.
13976         (Sized_relobj::do_scan_relocs): Likewise.
13977         (Sized_relobj::relocate_sections): Likewise.
13978         * resolve.cc (Symbol_table::resolve): Likewise.
13979         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
13980         parameter.  Change all callers.
13981         (Symbol_table::add_from_object): Get target from parameters.
13982         (Symbol_table::add_from_relobj): Don't check object target.
13983         (Symbol_table::add_from_dynobj): Likewise.
13984         (Symbol_table::define_special_symbol): Get target from
13985         parameters.
13986         * symtab.h (class Symbol_table): Update declaration.
13987         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
13988         parameter.  Change all callers.  Clear parameter target.
13989         (Binary_test): Test target here.
13990         * testsuite/object_unittest.cc (gold_testsuite): Remove
13991         target_test_pointer parameter.  Change all callers.
13992         (Object_test): Test target here.
13993
13994 2009-09-26  Ian Lance Taylor  <iant@google.com>
13995
13996         * testsuite/initpri1.c: Don't try to use constructor priorities if
13997         compiling with gcc before 4.3.
13998
13999 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
14000
14001         * testsuite/retain_symbols_file_test.sh (check_present): Change
14002         output file name to retain_symbols_file_test.stdout.
14003         (check_absent): Likewise.
14004
14005 2009-09-18  Craig Silverstein  <csilvers@google.com>
14006
14007         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
14008         * options.cc: Include <cerrno> and <fstream>.
14009         (General_options::finalize): Parse -retain-symbols-file tag.
14010         * options.h: New flag.
14011         (General_options): New method should_retain_symbol, new
14012         variable symbols_to_retain.
14013         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
14014         should_retain_symbol map.
14015         * testsuite/Makefile.am (retain_symbols_file_test): New test.
14016         * testsuite/Makefile.in: Regenerate.
14017         * testsuite/retain_symbols_file_test.sh: New file.
14018
14019 2009-09-18  Nick Clifton  <nickc@redhat.com>
14020
14021         * po/es.po: Updated Spanish translation.
14022
14023 2009-09-17  Doug Kwan  <dougkwan@google.com>
14024
14025         * debug.h (DEBUG_RELAXATION): New constant.
14026         (DEBUG_ALL): Add DEBUG_RELAXATION.
14027         (debug_string_to_enum): Add relaxation debug option.
14028         * layout.cc
14029         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
14030         Layout::Relaxation_debug_check::read_sections,
14031         Layout::Relaxation_debug_check::read_sections): New method definitions.
14032         (Layout::Layout): Initialize data members
14033         record_output_section_data_from_scrips_,
14034         script_output_section_data_list_ and relaxation_debug_check_.
14035         (Layout::save_segments, Layout::restore_segments,
14036         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
14037         Layout::relaxation_loop_body): New method definitions.
14038         (Layout::finalize): Support relaxation.  Move section layout code to
14039         Layout::relaxation_loop_body.
14040         (Layout::set_asection_address_from_script): Move code for orphan
14041         section placement out.
14042         (Layout::place_orphan_sections_in_script): New method definition.
14043         * layout.h (Output_segment_headers, Output_file_header):
14044         New forward class declarations.
14045         (Layout::~Layout): Define.
14046         (Layout::new_output_section_data_from_script): New method definition.
14047         (Layout::place_orphan_sections_in_script): New method declaration.
14048         (Layout::Segment_states): New type declaration.
14049         (Layout::save_segments, Layout::restore_segments,
14050         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
14051         Layout::relaxation_loop_body): New method declarations.
14052         (Layout::Output_section_data_list): New type declaration.
14053         (Layout::Relaxation_debug_check): New class definition.
14054         (Layout::record_output_section_data_from_script_,
14055         Layout::script_output_section_data_list_, Layout::segment_states_,
14056         Layout::relaxation_debug_check_): New data members.
14057         * output.cc: (Output_section_headers::do_size): New method definition.
14058         (Output_section_headers::Output_section_headers): Move size
14059         computation to Output_section_headers::do_size.
14060         (Output_segment_headers::do_size): New method definition.
14061         (Output_file_header::Output_file_header): Move size computation to
14062         Output_file_header::do_size and call it.
14063         (Output_file_header::do_size): New method definition.
14064         (Output_data_group::Output_data_group): Adjust call to
14065         Output_section_data.
14066         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
14067         (Output_symtab_xindex::do_write): Add array bound check.
14068         (Output_section::Input_section::print_to_mapfile): Handle
14069         RELAXED_INPUT_SECTION_CODE.
14070         (Output_section::Output_section): Initialize data member checkpoint_.
14071         (Output_section::~Output_section): Delete checkpoint object pointed
14072         by checkpoint_.
14073         (Output_section::add_input_section): Always add an Input_section if
14074         relaxing.
14075         (Output_section::add_merge_input_section): Add assert.
14076         (Output_section::relax_input_section): New method definition.
14077         (Output_section::set_final_data_size): Set load address to zero for
14078         an unallocated section.
14079         (Output_section::do_address_and_file_offset_have_reset_values):
14080         New method definition.
14081         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
14082         Handle relaxed input section.
14083         (Output_section::sort_attached_input_sections): Checkpoint input
14084         section list lazily.
14085         (Output_section::get_input_sections): Change type of input_sections to
14086         list of Simple_input_section pointers.  Checkpoint input section list
14087         lazily.  Also handle relaxed input sections.
14088         (Output_section::add_input_section_for_script): Take a reference to
14089         a Simple_input_section object instead of Relobj pointer and section
14090         index as parameter.  Handle relaxed input sections.
14091         (Output_section::save_states, Output_section::restore_states): New
14092         method definitions.
14093         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
14094         (Output_data::is_data_size_fixed): New method definition.
14095         (Output_data::reset_addresss_and_file_offset): Do not reset data size
14096         if it is fixed.
14097         (Output_data::address_and_file_offset_have_reset_values): New method
14098         definition.
14099         (Output_data::do_address_and_file_offset_have_reset_values): New method
14100         definition.
14101         (Output_data::set_data_size): Check that data size is not fixed.
14102         (Output_data::fix_data_size): New method definition.
14103         (Output_data::is_data_size_fixed_): New data member.
14104         (Output_section_headers::set_final_data_size): New method definition.
14105         (Output_section_headers::do_size): New method declaration.
14106         (Output_segment_headers::set_final_data_size): New method definition.
14107         (Output_segment_headers::do_size): New method declaration.
14108         (Output_file_header::set_final_data_size)::New method definition.
14109         (Output_file_header::do_size)::New method declaration.
14110         (Output_section_data::Output_section_data): Add new parameter
14111         is_data_size_fixed and use it to fix data size.
14112         (Output_data_const::Output_data_const): Adjust call to base class
14113         constructor and fix data size.
14114         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
14115         base class constructor and fix data size.
14116         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
14117         base class constructor and fix data size.
14118         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
14119         class constructor and fix data size.
14120         (Output_data_group::set_final_data_size): New method definition.
14121         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
14122         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
14123         class constructor and fix data size.
14124         (Output_relaxed_input_section): New class definition.
14125         (Output_section::Simple_input_section): New class definition.
14126         (Output_section::get_input_sections): Adjust parameter list.
14127         (Output_section::add_input_section_for_script): Same.
14128         (Output_section::save_states, Output_section::restore_states,
14129         Output_section::do_address_and_file_offset_have_reset_values,
14130         (Output_section::Input_section::Input_section): Handle
14131         RELAXED_INPUT_SECTION_CODE.  Add new overload for
14132         Output_relaxed_input_section.
14133         (Output_section::Input_section::is_input_section,
14134         Output_section::Input_section::set_output_section): Handle relaxed
14135         input section.
14136         (Output_section::Input_section::is_relaxed_input_section,
14137         Output_section::Input_section::output_section_data,
14138         Output_section::Input_section::relaxed_input_section): New method
14139         definitions.
14140         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
14141         value.
14142         (Output_section::Input_section::u1_): Update comments.
14143         (Output_section::Input_section::u2_): Add new union member poris.
14144         (Output_section::Checkpoint_output_section): New classs definition.
14145         (Output_section::relax_input_section): New method declaration.
14146         (Output_section::checkpoint_): New data member.
14147         (Output_segment): Update comments.
14148         (Output_segment::Output_segment): Un-privatize copy constructor.
14149         (Output_segment::operator=): Un-privatize.
14150         * script-sections.cc (Output_section_element::Input_section_list):
14151         Change element type to Output_section::Simple_input_section.
14152         (Output_section_element_dot_assignment::set_section_addresses):
14153         Register output section data for relaxation clean up.
14154         (Output_data_exression::Output_data_expression): Adjust call to base
14155         constructor to fix data size.
14156         (Output_section_element_data::set_section_addresses): Register
14157         Output_data_expression object for relaxation clean up.
14158         (struct Input_section_info): Replace Relobj pointer and section index
14159         pair with Output_section::Simple_input_section and Convert struct to a
14160         class.
14161         (Input_section_sorter::operator()): Adjust access to
14162         Input_section_info data member to use accessors.
14163         (Output_section_element_input::set_section_addresses): Use layout
14164         parameter.  Adjust code to use Output_section::Simple_input_section
14165         and Input_secction_info classes.  Register filler for relaxation
14166         clean up.
14167         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
14168         and section index pair with Output_section::Simple_input_section
14169         class.  Adjust code accordingly.
14170         (Phdrs_element::release_segment): New method definition.
14171         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
14172         segment list.
14173         (Script_sections::release_segments): New method definition.
14174         * gold/script-sections.h (Script_sections::release_segments): New
14175         method declaration.
14176         * gold/target.h (Target::may_relax, Target::relax,
14177         Target::do_may_relax, Target::do_relax): New method definitions.
14178
14179 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
14180
14181         * arm.cc (has_signed_unsigned_overflow): New function.
14182         (Arm_relocate_functions::abs8): New function.
14183         (Target_arm::Scan::local): Handle R_ARM_ABS8.
14184         (Target_arm::Scan::global): Likewise.
14185         (Target_arm::relocate::relocate): Likewise.
14186         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
14187         Likewise.
14188
14189 2009-09-16  Cary Coutant  <ccoutant@google.com>
14190
14191         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
14192         * testsuite/Makefile.in: Regenerate.
14193
14194 2009-09-11  Nick Clifton  <nickc@redhat.com>
14195
14196         * po/gold.pot: Updated by the Translation project.
14197
14198 2009-09-08  Cary Coutant  <ccoutant@google.com>
14199
14200         * output.cc (Output_file::open): Add execute permission to empty file.
14201         * testsuite/Makefile.am (permission_test): New test.
14202         * testsuite/Makefile.in: Regenerate.
14203
14204 2009-09-02  Ian Lance Taylor  <iant@google.com>
14205
14206         * output.cc (Output_file::resize): Call map_no_anonymous rather
14207         than map.
14208
14209 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
14210
14211         * gold.cc: Include "incremental.h".
14212         (queue_initial_tasks): Call Incremental_checker methods.
14213         * incremental.cc: Include "output.h".
14214         (Incremental_checker::can_incrementally_link_output_file): New
14215         method.
14216         * incremental.h (Incremental_checker): New class.
14217
14218         * output.cc (Output_file::open_for_modification): New method.
14219         (Output_file::map_anonymous): Changed return type to bool.  Record
14220         map in base_ field.
14221         (Output_file::map_no_anonymous): New method, broken out of map.
14222         (Output_file::map): Use map_no_anonymous and map_anonymous.
14223         * output.h (class Output_file): Update declarations.
14224
14225 2009-08-24  Cary Coutant  <ccoutant@google.com>
14226
14227         * options.h (Command_line::Pre_options): New class.
14228         (Command_line::pre_options): New member.
14229         * options.cc (gold::options::ready_to_register): New variable.
14230         (One_option::register_option): Do nothing if not registering options.
14231         Assert if same short option registered twice.
14232         (General_options::General_options): Turn off option registration when
14233         done constructing.
14234         (Command_line::Pre_options::Pre_options): New constructor.
14235
14236 2009-08-24  Cary Coutant  <ccoutant@google.com>
14237
14238         * options.h (General_options::no_keep_memory): Remove incorrect
14239         short option.
14240
14241 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
14242
14243         * Makefile.am (am__skiplex, am__skipyacc): New.
14244         * Makefile.in: Regenerate.
14245
14246 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
14247
14248         * Makefile.am (AM_CPPFLAGS): Renamed from ...
14249         (INCLUDES): ... this.
14250         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
14251         (AM_CPPFLAGS): Renamed from ...
14252         (INCLUDE): ... this.
14253         * Makefile.in, testsuite/Makefile.in: Regenerate.
14254
14255         * Makefile.in: Regenerate.
14256         * aclocal.m4: Likewise.
14257         * config.in: Likewise.
14258         * configure: Likewise.
14259         * testsuite/Makefile.in: Likewise.
14260
14261         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
14262         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
14263         * Makefile.in: Regenerate.
14264         * testsuite/Makefile.in: Regenerate.
14265
14266 2009-08-19  Cary Coutant  <ccoutant@google.com>
14267
14268         * resolve.cc (Symbol_table::resolve): Don't complain about defined
14269         symbols in shared libraries overridden by hidden or internal symbols
14270         in the main program.
14271
14272 2009-08-19  Chris Demetriou  <cgd@google.com>
14273
14274         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
14275         checking source file names in error messages.
14276
14277 2009-08-18  Doug Kwan  <dougkwan@google.com>
14278
14279         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
14280         an elcpp::Ehdr as parameter.  Adjust call to set_target.
14281         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
14282         an elfcpp::Ehdr as parameter.
14283         * object.cc (Object::set_target): Remove the version that looks up
14284         a target and sets it.
14285         (Sized_relobj::setup): Take a Target object instead of
14286         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
14287         (make_elf_sized_object): Find target and ask target to
14288         make an ELF object.
14289         * object.h: (Object::set_target): Remove the version that looks up
14290         a target and sets it.
14291         (Sized_relobj::setup): Take a Target object instead of
14292         an elfcpp:Ehdr as parameter.
14293         * target.cc: Include dynobj.h.
14294         (Target::do_make_elf_object_implementation): New.
14295         (Target::do_make_elf_object): New.
14296         * target.h (Target::make_elf_object): New template declaration.
14297         (Target::do_make_elf_object): New method declarations.
14298         (Target::do_make_elf_object_implementation): New template declaration.
14299
14300 2009-08-14  Ian Lance Taylor  <iant@google.com>
14301
14302         * gold.h (FUNCTION_NAME): Define.
14303         (gold_unreachable): Use FUNCTION_NAME.
14304
14305 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
14306
14307         * icf.cc (Icf::find_identical_sections): Issue a warning when a
14308         symbol in the --keep-unique list is not found.
14309
14310 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
14311
14312         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
14313         been maked as --keep-unique.
14314         (Icf::unfold_section): New function.
14315         * icf.h (Icf::unfold_section): New function.
14316         * options.h (General_options::keep_unique): New option.
14317         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
14318         * testsuite/Makefile.in: Regenerate.
14319         * testsuite/icf_keep_unique_test.sh: New file.
14320         * testsuite/icf_keep_unique_test.cc: New file.
14321
14322 2009-08-12  Cary Coutant  <ccoutant@google.com>
14323
14324         PR 10471
14325         * resolve.cc (Symbol_table::resolve): Check for references from
14326         dynamic objects to hidden and internal symbols.
14327         * testsuite/Makefile.am (hidden_test.sh): New test.
14328         * testsuite/Makefile.in: Regenerate.
14329         * testsuite/hidden_test.sh: New script.
14330         * testsuite/hidden_test_1.c: New test source.
14331         * testsuite/hidden_test_main.c: New test source.
14332
14333 2009-08-11  Doug Kwan  <dougkwan@google.com>
14334
14335         * arm.cc: Update comments.
14336         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
14337         segment to locate the .ARM.exidx section if present.
14338
14339 2009-08-09  Doug Kwan  <dougkwan@google.com>
14340
14341         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
14342         patch.
14343
14344 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
14345         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
14346         compiler warnings.
14347
14348 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
14349
14350         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
14351         valid tls_segment only for non-debug-section relocations.
14352         * testsuite/Makefile.am: Add gc_tls_test.
14353         * testsuite/Makefile.in: Regenerate.
14354         * testsuite/gc_tls_test.cc: New file.
14355         * testsuite/gc_tls_test.sh: New file.
14356
14357 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
14358
14359         * icf.cc: New file.
14360         * icf.h: New file.
14361         * Makefile.am (CCFILES): Add icf.cc.
14362         (HFILES): Add icf.h
14363         * Makefile.in: Regenerate.
14364         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
14365         * gc.h (gc_process_relocs): Populate lists used by icf to contain
14366         section, symbol and addend information for the relocs.
14367         * gold.cc (queue_middle_tasks): Call identical code folding.
14368         * gold.h: Add defines for multimap.
14369         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
14370         to the call of finalize_local_symbols.
14371         * main.cc (main): Create object of class Icf.
14372         * object.cc (Sized_relobj::do_layout): Allow this function to be
14373         called twice during icf.
14374         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
14375         to sections marked as identical by icf.
14376         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
14377         when available.
14378         (Sized_relobj::do_section_entsize): New function.
14379         * object.h (Object::section_entsize): New function.
14380         (Object::do_section_entsize): New pure virtual function.
14381         (Relobj::finalize_local_symbols): Add new parameter.
14382         (Relobj::do_section_entsize): New function.
14383         * options.h (General_options::icf): New option.
14384         (General_options::icf_iterations): New option.
14385         (General_options::print_icf_sections): New option.
14386         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
14387         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
14388         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
14389         icf.
14390         * symtab.cc (Symbol_table::is_section_folded): New function.
14391         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
14392         to sections marked as identical by icf.
14393         * symtab.h (Symbol_table::set_icf): New function.
14394         (Symbol_table::icf): New function.
14395         (Symbol_table::is_section_folded): New function.
14396         (Symbol_table::icf_): New data member.
14397         * target-reloc.h (relocate_section): Ignore sections folded by icf.
14398         * testsuite/Makefile.am: Add commands to build icf_test.
14399         * testsuite/Makefile.in: Regenerate.
14400         * testsuite/icf_test.sh: New file.
14401         * testsuite/icf_test.cc: New file.
14402
14403 2009-07-24  Chris Demetriou  <cgd@google.com>
14404
14405         * layout.cc (is_compressible_debug_section): Fix incorrect
14406         comment about compressed section names.
14407
14408 2009-07-20  Ian Lance Taylor  <ian@airs.com>
14409
14410         PR 10419
14411         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
14412
14413 2009-07-16  Ian Lance Taylor  <iant@google.com>
14414
14415         PR 10400
14416         * layout.h: #include <map>.
14417         (class Kept_section): Change from struct to class.  Add accessors
14418         and setters.  Add section size to Comdat_group mapping.  Change
14419         Comdat_group to std::map.  Add is_comdat_ field.  Add
14420         linkonce_size field in union.
14421         (class Layout): Update declaration of find_or_add_kept_section.
14422         Don't declare find_kept_object.
14423         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
14424         parameter.  Add object, shndx, is_comdat, and is_group_name
14425         parameters.  Change all callers.  Adjust for new Kept_section.
14426         (Layout::find_kept_object): Remove.
14427         * object.cc (Sized_relobj::include_section_group): Update use of
14428         Kept_section.  Rename secnum to shndx.  Only record
14429         Kept_comdat_section if sections are the same size.
14430         (Sized_relobj::include_linkonce_section): Update use of
14431         Kept_section.  Only record Kept_comdat_section if sections are the
14432         same size.  Set size of linkonce section.
14433         (Sized_relobj::map_to_kept_section): Update call to
14434         get_kept_comdat_section.
14435         * object.h (class Sized_relobj): Rename fields in
14436         Kept_comdat_section to drop trailing underscores; change object
14437         field to Relobj*.  Change Kept_comdat_section_table to store
14438         struct rather than pointer.
14439         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
14440         Add kept_object and kept_shndx parameters.  Change all callers.
14441         (Sized_relobj::get_kept_comdat_section): Change return type to
14442         bool.  Add kept_object and kept_shndx parameters.  Change all
14443         callers.
14444         * plugin.cc (Pluginobj::include_comdat_group): Update call to
14445         Layout::find_or_add_kept_section.
14446
14447 2009-07-09  Ian Lance Taylor  <iant@google.com>
14448
14449         * merge.cc (Object_merge_map::initialize_input_to_output_map):
14450         Reserve space in the hash table.
14451
14452 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
14453
14454         * fileread.cc (File_read::get_mtime): New method.
14455         * fileread.h (Timespec): New structure.
14456         (File_read::get_mtime): New method.
14457         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
14458         Renamed from timestamp_nsec.
14459         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
14460         Elf_Xword.
14461         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
14462         timestamp_nsec.
14463         (Incremental_inputs::report_archive): Save mtime; style fix.
14464         (Incremental_inputs::report_obejct): Save mtime; style fix.
14465         (Incremental_inputs::report_script): Save mtime; style fix.
14466         (Incremental_inputs::finalize_inputs): Style fix.
14467         (Incremental_inputs::finalize): Style fix.
14468         (Incremental_inputs::create_input_section_data): Store inputs
14469         mtime.
14470         * incremental.h (Incremental_inputs::report_script): Add mtime
14471         argument.
14472         (Incremental_inputs::Input_info::Input_info): Intialize only one
14473         union member.
14474         (Incremental_inputs::Input_info::archive): Move to nameless
14475         union.
14476         (Incremental_inputs::Input_info::obejct): Move to nameless union.
14477         (Incremental_inputs::Input_info::script): Move to nameless union.
14478         (Incremental_inputs::mtime): New field.
14479         * script.cc (read_input_script): Pass file mtime to
14480         Incremental_input.
14481         * script.h (Script_info::inputs): Style fix.
14482
14483 2009-07-01  Ian Lance Taylor  <ian@airs.com>
14484
14485         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
14486         instead of 32.
14487
14488 2009-06-24  Ian Lance Taylor  <iant@google.com>
14489
14490         PR 10156
14491         * layout.cc (Layout::choose_output_section): If we find an
14492         existing section, update the flags.
14493         (Layout::create_notes): New function, broken out of
14494         Layout::finalize.
14495         (Layout::finalize): Don't create note sections.
14496         (Layout::create_note): Don't crash if linker script discards
14497         section.
14498         (Layout::create_gold_note): Likewise.
14499         (Layout::create_build_id): Likewise.  Don't set
14500         after_input_sections on the section.
14501         (Layout::create_executable_stack_info): Remove target parameter.
14502         Change caller.
14503         * layout.h (class Layout): Declare create_notes.  Update
14504         declaration of create_executable_stack_info.
14505         * gold.cc (queue_middle_tasks): Call create_notes.
14506         * output.cc (Output_section::update_flags_for_input_section): Move
14507         here from output.h.  If SHF_ALLOC flag is newly set, mark address
14508         invalid.
14509         * output.h (Output_data::mark_address_invalid): New function.
14510         (class Output_section): Only declare, not define,
14511         update_flags_for_input_section.  Remove set_flags.
14512
14513 2009-06-24  Ian Lance Taylor  <iant@google.com>
14514
14515         * script-sections.cc (Output_section_definition::
14516         set_section_addresses): Rename shadowing local load_address to
14517         laddr.
14518
14519 2009-06-24  Ian Lance Taylor  <iant@google.com>
14520
14521         PR 10244
14522         * reloc.cc (relocate_sections): Skip empty relocation sections.
14523
14524 2009-06-23  Ian Lance Taylor  <iant@google.com>
14525
14526         PR 10156
14527         * layout.cc (Layout::create_note): Use choose_output_section
14528         rather than make_output_section.
14529
14530 2009-06-23  Ian Lance Taylor  <iant@google.com>
14531
14532         PR 10237
14533         * options.cc (General_options::parse_V): Set printed_version_.
14534         (General_options::General_options): Initialize printed_version_.
14535         * options.h (class General_options): Add printed_version_ field.
14536         * gold.cc (queue_initial_tasks): If there are no input files,
14537         don't give a fatal error if we printed the version information.
14538         (queue_middle_tasks): If using -r with a shared object, give a
14539         fatal error rather than an ordinary error.
14540
14541 2009-06-23  Ian Lance Taylor  <iant@google.com>
14542
14543         PR 10219
14544         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
14545         (Layout::make_output_section): Set have_stabstr_section_ if we see
14546         a .stab*str section.
14547         (Layout::finalize): Call link_stabs_sections.
14548         (Layout::link_stabs_sections): New file.
14549         * layout.h (class Layout): Add have_stabstr_section_ field.
14550         Declare link_stabs_sections.
14551
14552 2009-06-23  Doug Kwan  <dougkwan@google.com>
14553
14554         * Makefile.am (libgold_a_LIBADD): New.
14555         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
14556         * Makefile.in: Regenerate.
14557         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
14558         * configure: Regenerate.
14559         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
14560         * fileread.cc: Include sys/state.h
14561         * gold.h: Declare memmem and strndup if found missing.
14562         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
14563
14564 2009-06-23  Ian Lance Taylor  <iant@google.com>
14565
14566         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
14567         * configure: Rebuild.
14568
14569 2009-06-23  Ian Lance Taylor  <iant@google.com>
14570
14571         PR 10147
14572         * object.cc (Object::section_contents): Don't try to get a view if
14573         the section has length zero.
14574         (Object::handle_gnu_warning_section): If the section is empty, use
14575         the name of the section as the warning.
14576
14577 2009-06-23  Ian Lance Taylor  <iant@google.com>
14578
14579         PR 10133
14580         * stringpool.h (class Stringpool_template): Add optimize_ field.
14581         (Stringpool_template::set_optimize): New function.
14582         * stringpool.cc (Stringpool_template::Stringpool_template):
14583         Initialize optimize_ field.
14584         (Stringpool_template::set_string_offsets): Test local optimize
14585         fild rather than parameter.
14586         * layout.cc (Layout::Layout): Call set_optimize on the section
14587         name stringpool.
14588
14589 2009-06-22  Ian Lance Taylor  <iant@google.com>
14590
14591         PR 10030
14592         * yyscript.y: Parse TARGET.
14593         * script.cc (script_set_target): New function.
14594         * script-c.h (script_set_target): Declare.
14595         * options.cc (General_options::string_to_object_format): Rename
14596         from string_to_object_format in anonymous namespace.  Change
14597         callers.
14598         * options.h (class General_options): Declare
14599         string_to_object_format.
14600
14601 2009-06-22  Ian Lance Taylor  <iant@google.com>
14602
14603         * script-sections.cc (Script_sections::create_segments): Don't put
14604         program headers in a PT_LOAD segment if -n or -N.
14605
14606 2009-06-22  Ian Lance Taylor  <iant@google.com>
14607
14608         PR 10141
14609         * options.h (class General_options): Add -z lazy and -z now.  Sort
14610         -z options into alphabetical order.
14611         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
14612
14613 2009-06-21  Ian Lance Taylor  <iant@google.com>
14614
14615         * layout.cc (Layout::make_output_section): Call
14616         Target::new_output_section.
14617         (Layout::attach_allocated_section_to_segment): Put large section
14618         sections in a separate load segment with the large segment flag
14619         set.
14620         (Layout::segment_precedes): Sort large data segments after other
14621         load segments.
14622         (align_file_offset): New static function.
14623         (Layout::set_segment_offsets): Use align_file_offset.
14624         * output.h (class Output_section): Add is_small_section_ and
14625         is_large_section_ fields.
14626         (Output_section::is_small_section): New function.
14627         (Output_section::set_is_small_section):  New function.
14628         (Output_section::is_large_section): New function.
14629         (Output_section::set_is_large_section): New function.
14630         (Output_section::is_large_data_section): New function.
14631         (class Output_segment): Add is_large_data_segment_ field.
14632         (Output_segment::is_large_data_segment): New function.
14633         (Output_segment::set_is_large_data_segment): New function.
14634         * output.cc (Output_section::Output_section): Initialize new
14635         fields.
14636         (Output_segment::Output_segment): Likewise.
14637         (Output_segment::add_output_section): Add assertion that large
14638         data sections always go in large data segments.  Force small data
14639         sections to the end of the list of data sections.  Force small BSS
14640         sections to the start of the list of BSS sections.  For large BSS
14641         sections to the end of the list of BSS sections.
14642         * symtab.h (class Symbol): Declare is_common_shndx.
14643         (Symbol::is_defined): Check Symbol::is_common_shndx.
14644         (Symbol::is_common): Likewise.
14645         (class Symbol_table): Define enum Commons_section_type.  Update
14646         declarations.  Add small_commons_ and large_commons_ fields.
14647         * symtab.cc (Symbol::is_common_shndx): New function.
14648         (Symbol_table::Symbol_table): Initialize new fields.
14649         (Symbol_table::add_from_object): Put small and large common
14650         symbols in the right list.
14651         (Symbol_table::sized_finalized_symbol): Check
14652         Symbol::is_common_shndx.
14653         (Symbol_table::sized_write_globals): Likewise.
14654         * common.cc (Symbol_table::do_allocate_commons): Allocate new
14655         common symbol lists.  Don't call do_allocate_commons_list if the
14656         list is empty.
14657         (Symbol_table::do_allocate_commons_list): Remove is_tls
14658         parameter.  Add comons_section_type parameter.  Change all
14659         callers.  Handle small and large common symbols.
14660         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
14661         Symbol::is_common_shndx.
14662         * resolve.cc (symbol_to_bits): Likewise.
14663         * target.h (Target::small_common_shndx): New function.
14664         (Target::small_common_section_flags): New function.
14665         (Target::large_common_shndx): New function.
14666         (Target::large_common_section_flags): New function.
14667         (Target::new_output_section): New function.
14668         (Target::Target_info): Add small_common_shndx, large_common_shndx,
14669         small_common_section_flags, and large_common_section_flags
14670         fields.
14671         (Target::do_new_output_section): New virtual function.
14672         * arm.cc (Target_arm::arm_info): Initialize new fields.
14673         * i386.cc (Target_i386::i386_info): Likewise.
14674         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
14675         Likewise.
14676         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
14677         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14678         (Target_x86_64::do_new_output_section): New function.
14679         * configure.ac: Define conditional MCMODEL_MEDIUM.
14680         * testsuite/Makefile.am (check_PROGRAMS): Add large.
14681         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
14682         (large_LDFLAGS): Define.
14683         * testsuite/large.c: New file.
14684         * testsuite/testfile.cc (Target_test::test_target_info):
14685         Initialize new fields.
14686         * configure, testsuite/Makefile.in: Rebuild.
14687
14688 2009-06-05  Doug Kwan  <dougkwan@google.com>
14689
14690         * Makefile.am (CCFILES): Add target.cc.
14691         * Makefile.in: Regenerate.
14692         * i386.cc (class Target_i386): Define new virtual method to
14693         override do_is_local_label_name in parent.
14694         * object.cc (Sized_relobj::do_count_local_symbols): Discard
14695         local symbols if --discard-locals or -X is given.
14696         * options.h (class General_options): Declare new options
14697         '--discard-locals' and '-X' for discarding locals.
14698         * target.h (class Target): Define new methods is_local_label_name.
14699         Declare new virtual method do_is_local_label_name.
14700         * target.cc: New file.
14701         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
14702         (check_SCRIPTS): Add discard_locals_test.sh.
14703         (check_DATA): Add discard_local_tests.syms.
14704         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
14705         (discard_local_tests.syms, discard_locals_test.o): New make rules.
14706         * testsuite/Makefile.in: Regenerate.
14707         * testsuite/discard_locals_test.c: New file.
14708         * testsuite/discard_locals_test.sh: Same.
14709
14710 2009-06-05  Doug Kwan  <dougkwan@google.com>
14711
14712         * object.cc (Sized_relobj::Sized_relobj): Initialize
14713         discarded_eh_frame_shndx_ to -1U.
14714         (Sized_relobj::do_layout): Record index of a discard .eh_frame
14715         section.
14716         (Sized_relobj::do_count_local_symbols): Skip local symbols in
14717         a discarded .eh_frame section.
14718         (Sized_relobj::do_finalize_local_symbols): Ditto.
14719         * object.h (class Sized_relobj): Declare new member
14720         discarded_eh_frame_shndx_.
14721         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
14722         (local_labels_test.o, local_labels_test): New rules.
14723         * testsuite/Makefile.in: Regenerate.
14724
14725 2009-06-04  Doug Kwan  <dougkwan@google.com>
14726
14727         * layout.cc (Layout::section_name_mapping): Add mapping for
14728         special ARM sections.
14729
14730 2009-06-03  Doug Kwan  <dougkwan@google.com>
14731
14732         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
14733         (utils::has_overflow): Same.
14734
14735 2009-06-03  Ian Lance Taylor  <iant@google.com>
14736
14737         * layout.cc (Layout::section_name_mapping): New array, replacing
14738         Layout::linkonce_mapping.
14739         (Layout::section_name_mapping_count): New variable, replacing
14740         Layout::linkonce_mapping_count.
14741         (Layout::linkonce_output_name): Remove.
14742         (Layout::output_section_name): Rewrite.
14743         * layout.h (class Layout): Rename Linkonce_mapping to
14744         Section_name_mapping, linkonce_mapping to section_name_mapping,
14745         linkonce_mapping_count to section_name_mapping_count.  Don't
14746         declare linkonce_output_name.
14747
14748 2009-06-03  Doug Kwan  <dougkwan@google.com>
14749
14750         * gold/arm.cc (namespace utils): New.
14751         (Target_arm::reloc_is_non_pic): Define new method.
14752         (class Arm_relocate_functions): New.
14753         (Target_arm::Relocate::relocate): Handle relocation types used by
14754         Android.
14755
14756 2009-06-03  Ian Lance Taylor  <iant@google.com>
14757
14758         * arm.cc (Target_arm::scan::global): Use || instead of |.
14759
14760 2009-06-02  Doug Kwan  <dougkwan@google.com>
14761
14762         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
14763         issued_non_pic_error_.
14764         (class Target_arm::Scan): Declare new method check_non_pic.
14765         Define new method symbol_needs_plt_entry.
14766         Declare new data member issued_non_pic_error_.
14767         (class Target_arm::Relocate): Declare new method
14768         should_apply_static_reloc.
14769         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
14770         (Target_arm::Scan::check_non_pic): Define new method.
14771         (Target_arm::Scan::local): Handle a small subset of reloc types used
14772         by Android.
14773         (Target_arm::Scan::local): Same.
14774         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
14775
14776 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
14777
14778         * incremental.cc (Incremental_inputs::report_command_line): Filter
14779         out --incremental-* options.
14780
14781 2009-05-29  Doug Kwan  <dougkwan@google.com>
14782
14783         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
14784         template class.
14785         (class Target_arm): Update comment.
14786         (Target_arm::Target_arm): Initialize new data members GOT_,
14787         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
14788         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
14789         and Target_arm::rel_dyn_section.
14790         Declare new_enum Target_arm::Got_type.
14791         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
14792         and DYNBSS_.
14793         Update commments for member do_dynsym_value.
14794         (Target_arm::got_size, Target_arm::plt_section,
14795         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
14796         new methods inside class defintion.
14797         (Target_arm::got_section): Define new method.
14798         (Target_arm::rel_dyn_section): Same.
14799         (Output_data_plt_arm): New template class.
14800         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
14801         (Output_data_plt_arm:do_adjust_output_section): Define new method.
14802         (Output_data_plt_arm::add_entry): Same.
14803         (Output_data_plt_arm::first_plt_entry): Define new
14804         static data member for PLT instruction template.
14805         (Output_data_plt_arm::plt_entry): Same.
14806         (Output_data_plt_arm::do_write): Define new method.
14807         (Target_arm::make_plt_entry): Same.
14808         (Target_arm::do_finalize_sections): Same.
14809         (Target_arm::do_dynsym_value): Same.
14810
14811 2009-05-28  Doug Kwan  <dougkwan@google.com>
14812
14813         * Makefile.am (TARGETSOURCES): Add arm.cc.
14814         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
14815         * Makefile.in: Regenerate.
14816         * arm.cc: New file.
14817         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
14818
14819 2009-05-26  Doug Kwan  <dougkwan@google.com>
14820
14821         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
14822         (General_options::check_excluded_libs): Strip off directories in
14823         archive name before matching like GNU ld does.
14824         * testsuite/Makefile.am (MOSTLYCLEANFILES,
14825         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
14826         (exclude_libs_test_LDFLAGS): Add linker option
14827         -Wl,--exclude-libs,libexclude_libs_test_3
14828         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
14829         an explicit archive without using -l.
14830         (alt/libexclude_libs_test_3.a): New make rule.
14831         * testsuite/Makefile.in: Regenerate.
14832         * testsuite/exclude_libs_test.c : Declare lib3_default().
14833         (main): Call it.
14834         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
14835         * exclude_libs_test_3.c: New file.
14836
14837 2009-05-26  Nick Clifton  <nickc@redhat.com>
14838
14839         * po/id.po: New Indonesian translation.
14840         * po/gold.pot: Updated template file.
14841
14842 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
14843
14844         * testsuite/Makefile.am: Add -ffunction-sections to compile
14845         gc_comdat_test files.  Add -Wl,--gc-sections to build
14846         gc_comdat_test.
14847         * testsuite/Makefile.in: Regenerate.
14848         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
14849
14850 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
14851
14852         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
14853         kept comdat section was garbage collected.
14854         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
14855         * testsuite/Makefile.in: Regenerate.
14856         * testsuite/gc_comdat_test.sh: New file.
14857         * testsuite/gc_comdat_test_1.cc: New file.
14858         * testsuite/gc_comdat_test_2.cc: New file.
14859
14860 2009-05-19  Doug Kwan  <dougkwan@google.com>
14861
14862         * archive.cc (Archive::Archive): Move constructor from archive.h
14863         to here.  Initialize no_export_.
14864         (Archive::get_elf_object_for_member): Set no_export flag of object.
14865         * archive.h (Archive::Archive): Move constructor body to
14866         archive.cc.
14867         (Archive::no_export): New method.
14868         (Archive::no_export_): New field.
14869         * object.h (Object::Object): Initialize no_export_ to false.
14870         (Object::no_export, Object::set_no_export): New methods.
14871         (Object::no_export_): New field.
14872         * options.cc (General_options::parse_exclude_libs): New method.
14873         (General_options::check_excluded_libs) Same.
14874         * options.h (exclude_libs): New option.
14875         (General_options::check_excluded_libs): New method declaration.
14876         (General_options::excluded_libs_): New field.
14877         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
14878         default or protected visibility if an object has no-export flag set.
14879         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
14880         (check_SCRIPTS): Add exclude_libs_test.sh.
14881         (check_DATA): Add exclude_libs_test.syms.
14882         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
14883         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
14884         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
14885         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
14886         (exclude_libs_test.syms, libexclude_libs_test_1.a,
14887         libexclude_libs_test_2.a): New rules.
14888         * testsuite/Makefile.in: Regenerate.
14889         * testsuite/exclude_libs_test.c: New file.
14890         * testsuite/exclude_libs_test.sh: Ditto.
14891         * testsuite/exclude_libs_test_1.c: Ditto.
14892         * testsuite/exclude_libs_test_2.c: Ditto.
14893
14894 2009-05-15  Ian Lance Taylor  <iant@google.com>
14895
14896         * configure.ac: Check for declarations for cases where libiberty.h
14897         checks HAVE_DECL_xxx.
14898         * configure, config.in: Rebuild.
14899
14900 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
14901
14902         * gold.h (Incremental_argument_list): Remove (invalid) forward
14903         declaration.
14904         * incremental.cc (Incremental_inputs::report_achive): New method.
14905         (Incremental_inputs::report_object): New method.
14906         (Incremental_inputs::report_script): New method.
14907         (Incremental_inputs::finalize_inputs): New method.
14908         (Incremental_inputs::finalize): Call finalize_inputs().
14909         (Incremental_inputs::sized_create_incremental_inputs_section_data):
14910         Create inputs entries.
14911         * incremental.h (Incremental_input_type): New enum.
14912         (Incremental_inputs::Incremental_input): Initialize new fields.
14913         (Incremental_inputs::report_inputs): New method.
14914         (Incremental_inputs::report_achive): New method.
14915         (Incremental_inputs::report_object): New method.
14916         (Incremental_inputs::report_script): New method.
14917         (Incremental_inputs::finalize_inputs): New method.
14918         (Incremental_inputs::Input_info): New struct.
14919         (Incremental_inputs::Input_info_map): New typedef.
14920         (Incremental_inputs::lock_): New field.
14921         (Incremental_inputs::Inputs_): New field.
14922         (Incremental_inputs::Inputs_map): New field.
14923         * main.cc (main): Call Incremental_input::report_inputs.
14924         * options.h (Input_argument_list): Typedef moved from
14925         Input_arguments.
14926         (Input_file_group::Files): Remove, use ::Input_argument_list.
14927         (Input_file_group::Input_argument_list): Remove, use
14928         ::Input_argument_list.
14929         * plugin.cc (Plugin_manager::add_input_file): Add error in
14930         incremental build.
14931         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
14932         functions.
14933         * script.cc (read_input_script): Call
14934         Incremental_input::report_script.
14935         * script.h (Script_info): New class.
14936
14937 2009-04-27  Ian Lance Taylor  <iant@google.com>
14938
14939         * x86_64.cc (do_adjust_output_section): Set entsize to
14940         plt_entry_size.
14941
14942 2009-04-23  Elliott Hughes  <enh@google.com>
14943
14944         * output.cc (Output_file::close): After short writes, continue
14945         writing from the correct offset in the buffer being written.
14946
14947 2009-04-23  Chris Demetriou  <cgd@google.com>
14948
14949         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
14950         * configure: Regenerate.
14951         * config.in: Regenerate.
14952         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
14953         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
14954
14955 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
14956
14957         * incremental.cc (Incremental_inputs_header_data): Renamed from
14958         Incremental_input_header_data.
14959         (Incremental_inputs_header_data::data_size): New field.
14960         (Incremental_inputs_header_data::put_input_file_count): Renamed
14961         from input_file_count.
14962         (Incremental_inputs_header_data::put_command_line_offset): Renamed
14963         from command_line_offset.
14964         (Incremental_inputs_header_data::put_reserved): Renamed from
14965         put_reserved.
14966         (Incremental_inputs_entry_data): Renamed from
14967         Incremental_input_entry_data.
14968         (Incremental_inputs_entry_data::data_size): New field.
14969         (Incremental_inputs::report_command_line): New method.
14970         (Incremental_inputs::finalize): New method.
14971         (Incremental_inputs::create_incremental_inputs_data): New method.
14972         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
14973         * incremental.h: New file.
14974         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
14975         (Layout::finalize): Create incremental inputs section in
14976         incremental builds.
14977         (Layout::create_incremental_info_sections): New method.
14978         * layout.h (Layout::incremental_inputs): New method.
14979         (Layout::create_incremental_info_sections): New method.
14980         (Layout::incremental_inputs_): New field.
14981         * main.cc (main): Notify Incremental_input of the command line.
14982
14983 2009-04-01  Ian Lance Taylor  <iant@google.com>
14984             Mikolaj Zalewski  <mikolajz@google.com>
14985
14986         * gold.h (reserve_unordered_map): Define, three versions, one for
14987         each version of Unordered_map.
14988         * layout.cc (Layout::Layout): Remove options parameter.  Add
14989         number_of_input_files parameter.  Don't initialize options_.
14990         Initialize number_of_input_files_ and resized_signatures_.  Move
14991         sections_are_attached_.
14992         (Layout::layout_group): Reserve space for group_signatures_.
14993         (Layout::find_or_add_kept_section): Change name parameter to be a
14994         reference.  Resize signatures_ map when it gets large enough.
14995         (Layout::layout_eh_frame): Use parameters->options() instead of
14996         this->options_.
14997         (Layout::make_output_section): Likewise.
14998         (Layout::attach_allocated_section_to_segment): Likewise.
14999         (Layout::finalize, Layout::create_executable_stack): Likewise.
15000         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
15001         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
15002         * layout.h (class Layout): Update declarations.  Remove options_
15003         field.  Add number_of_input_files_ and resized_signatures_
15004         fields.  Move sections_are_attached_ field.
15005         * main.cc (main): Pass number of input files to Layout
15006         constructor.  Don't pass options.
15007
15008 2009-03-30  Ian Lance Taylor  <iant@google.com>
15009
15010         * ffsll.c (ffsll): Correct implementation.
15011
15012 2009-03-27  Ian Lance Taylor  <iant@google.com>
15013
15014         * ffsll.c: New file.
15015         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
15016         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
15017         * ftruncate.c (ftruncate): Declare before definition.
15018         * mremap.c (mremap): Likewise.
15019         * pread.c (pread): Likewise.
15020         * configure, Makefile.in, config.in: Rebuild.
15021
15022         * mremap.c: New file.
15023         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
15024         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
15025         (mremap): Declare if HAVE_MREMAP is not defined.
15026         * configure, Makefile.in, config.in: Rebuild.
15027
15028 2009-03-27  Cary Coutant  <ccoutant@google.com>
15029
15030         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
15031         position independent.
15032         * sparc.cc (Target_sparc::check_non_pic): Likewise.
15033         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
15034
15035 2009-03-24  Cary Coutant  <ccoutant@google.com>
15036
15037         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
15038         an executable.
15039         (needs_dynamic_reloc): Likewise.
15040
15041 2009-03-24  Ian Lance Taylor  <iant@google.com>
15042
15043         * yyscript.y (file_cmd): Recognize EXTERN.
15044         (extern_name_list, extern_name_list_body): New nonterminals.
15045         * script.cc (script_add_extern): Define.
15046         * script-c.h (script_add_extern): Declare.
15047
15048 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
15049
15050         * object.cc (is_elf_object): Define.
15051         * object.h (is_elf_object): Declare.
15052         * archive.cc (Archive::get_elf_object_for_member): Call
15053         is_elf_object.
15054         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
15055
15056 2009-03-24  Elliott Hughes  <enh@google.com>
15057
15058         * output.cc (Output_file::map_anonymous): Define.
15059         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
15060         try an anonymous one.  Report the size if the mmap fails.
15061         * output.h (class Output_file): Declare map_anonymous.
15062
15063 2009-03-24  Ian Lance Taylor  <iant@google.com>
15064
15065         * target-select.cc (instantiate_target): Don't acquire the lock if
15066         the instantiated_target_ field has already been set.
15067
15068 2009-03-23  Ian Lance Taylor  <iant@google.com>
15069
15070         * gold-threads.h (class Initialize_lock): Define.
15071         * gold-threads.cc (class Initialize_lock_once): Define.
15072         (initialize_lock_control): New static variable.
15073         (initialize_lock_pointer): New static variable.
15074         (initialize_lock_once): New static function.
15075         (Initialize_lock::Initialize_lock): Define.
15076         (Initialize_lock::initialize): Define.
15077         * target-select.h: Include "gold-threads.h".
15078         (class Target_selector): Add lock_ and initialize_lock_ fields.
15079         Don't define instantiate_target, just declare it.
15080         * target-select.cc (Target_selector::Target_selector): Initialize
15081         new fields.
15082         (Target_selector::instantiate_target): Define.
15083         * descriptors.h: Include "gold-threads.h".
15084         (class Descriptors): Add initialize_lock_ field.
15085         * descriptors.cc (Descriptors::Descriptors): Initialize new
15086         field.
15087         (Descriptors::open): Use initialize_lock_ field
15088         * errors.h (class Errors): Add initialize_lock_ field.
15089         * errors.cc (Errors::Errors): Initialize new field.
15090         (Errors::initialize_lock): Use initialize_lock_ field.
15091         * powerpc.cc (class Target_selector_powerpc): Remove
15092         instantiated_target_ field.  In do_recognize call
15093         instantiate_target rather than do_instantiate_target.  In
15094         do_instantiate_target just allocate a new target.
15095         * sparc.cc (class Target_selector_sparc): Likewise.
15096
15097         * freebsd.h: New file.
15098         * i386.cc: Include "freebsd.h".
15099         (Target_i386): Derive from Target_freebsd rather than
15100         Sized_target.
15101         (Target_selector_i386): Derive from Target_selector_freebsd rather
15102         than Target_selector.
15103         * x86_64.cc: Include "freebsd.h".
15104         (Target_x86_64): Derive from Target_freebsd rather than
15105         Sized_target.
15106         (Target_selector_x86_64): Derive from Target_selector_freebsd
15107         rather than Target_selector.
15108         * target.h (class Target): Add adjust_elf_header and
15109         do_adjust_elf_header.
15110         * output.cc (Output_file_header:: do_sized_write): Call target
15111         adjust_elf_header routine.
15112         * configure.tgt: Set targ_osabi.
15113         * configure.ac: Define GOLD_DEFAULT_OSABI.
15114         * parameters.cc (Parameters::default_target): Pass
15115         GOLD_DEFAULT_OSABI to select_target.
15116         * target-select.h (class Target_selector): Make instantiate_target
15117         protected rather than private.
15118         * Makefile.am (HFILES): Add freebsd.h.
15119         * configure, Makefile.in, config.in: Rebuild.
15120
15121         * merge.cc (do_add_input_section): Correct pend value.  Change
15122         message about last entry not being null terminated from error to
15123         warning.
15124
15125 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
15126
15127         * incremental.cc: New file.
15128         * Makefile.am (CCFILES): Add incremental.cc.
15129         * Makefile.in: Rebuild.
15130
15131 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
15132
15133         * layout.cc (Layout::output_section_name): Preserve names
15134         of '.note.' sections.
15135
15136 2009-03-19  Ian Lance Taylor  <iant@google.com>
15137
15138         * descriptors.cc (Descriptors::open): Check that the options are
15139         valid before using them.
15140
15141 2009-03-18  Ian Lance Taylor  <iant@google.com>
15142
15143         * script-sections.h: Include <list>.
15144         (class Script_sections): Change Sections_elements from std::vector
15145         to std::list.  Typedef public Elements_iterator.  Add
15146         orphan_section_placement_, data_segment_align_start_, and
15147         saw_data_segment_align_ fields.  Remove data_segment_align_index_
15148         field.
15149         * script-sections.cc (class Orphan_section_placement): New class.
15150         (class Sections_element): Add virtual functions is_relro and
15151         orphan_section_init.  Remove virtual function place_orphan_here.
15152         (class Output_section_definition): Add is_relro and
15153         orphan_section_init.  Remove place_orphan_here.
15154         (class Orphan_output_section): Likewise.
15155         (Script_sections::Script_sections): Update for field changes.
15156         (Script_sections::data_segment_align): Set saw_data_segment_align_
15157         and data_segment_align_start_, not data_segment_align_index.
15158         (Script_sections::data_segment_relro_end): Check
15159         saw_data_segment_align_.  Use data_segment_align_start_ rather
15160         than data_segment_align_index_.
15161         (Script_sections::place_orphan): Rewrite to use
15162         Orphan_section_placement.
15163
15164 2009-03-17  Ian Lance Taylor  <iant@google.com>
15165
15166         * archive.cc (Archive::add_symbols): Check for a version attached
15167         to the symbol name in the archive map.
15168         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
15169         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
15170         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
15171         (ver_test_11.a): New target.
15172         * testsuite/Makefile.in: Rebuild.
15173
15174         * configure.ac: Check for chsize and posix_fallocate.  Replace
15175         ftruncate.
15176         * ftruncate.c: New file, from gnulib.
15177         * output.cc (posix_fallocate): Define dummy version if not
15178         HAVE_POSIX_FALLOCATE.
15179         (Output_file::map): Call posix_fallocate rather than lseek and
15180         write.
15181         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
15182         * configure, Makefile.in, config.in: Rebuild.
15183
15184 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
15185
15186         * layout.h (Layout::create_note): Add section_name parameter.
15187         * layout.cc (Layout::create_note): Likewise.
15188         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
15189
15190 2009-03-17  Ian Lance Taylor  <iant@google.com>
15191
15192         * descriptors.cc: Include "options.h".
15193         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
15194         (Descriptors::open): Always use O_CLOEXEC when opening a new
15195         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
15196         then set FD_CLOEXEC.
15197
15198         * sparc.cc (class Target_sparc): Add has_got_section.
15199         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
15200         make sure we have a GOT section.
15201
15202         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
15203         (Target_sparc::Scan::local): Likewise.
15204         (Target_sparc::Scan::global): Likewise.
15205         (Target_sparc::Relocate::relocate): Likewise.
15206         (Target_sparc::Relocate::relocate_tls): Likewise.
15207
15208         * symtab.cc (Symbol_table::define_default_version): New function,
15209         broken out of add_from_object.
15210         (Symbol_table::add_from_object): Call define_default_version.
15211         (Symbol_table::define_special_symbol): Add resolve_oldsym
15212         parameter.  Change all callers.  If the version for a symbol comes
15213         from a version script, resolve it with the symbol with the same
15214         name with no version.  Also add the symbol without a version if
15215         appropriate.
15216         (do_define_in_output_data): If resolving with oldsym, don't delete
15217         sym.
15218         (do_define_in_output_segment): Likewise.
15219         (do_define_as_constant): Likewise.
15220         * symtab.h (class Symbol_table): Update declarations.
15221
15222 2009-03-13  Ian Lance Taylor  <iant@google.com>
15223
15224         * readsyms.cc (Read_symbols::incompatible_warning): New function.
15225         (Read_symbols::requeue): New function.
15226         (Read_symbols::do_read_symbols): If make_elf_object fails because
15227         the target type is not configured, and the file was searched for,
15228         issue a warning and retry with the next directory.
15229         (Add_symbols::run): If the file has an incompatible format, and
15230         it was searched for, requeue the Read_symbols task.  On error,
15231         release the object.
15232         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
15233         dirindex parameter to constructor.  Change all callers.  Declare
15234         incompatible_warning and requeue.
15235         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
15236         input_argument_ and input_group_ fields.  Add them to
15237         constructor.  Change all callers.
15238         (class Read_script): Add dirindex_ field.  Add it to constructor.
15239         Change all callers.
15240         * archive.cc (Archive::setup): Remove input_objects parameter.
15241         Change all callers.
15242         (Archive::get_file_and_offset): Likewise.
15243         (Archive::read_all_symbols): Likewise.
15244         (Archive::read_symbols): Likewise.
15245         (Archive::get_elf_object_for_member): Remove input_objects
15246         parameter.  Add punconfigured parameter.  Change all callers.
15247         (Archive::add_symbols): Change return type to bool.  Check return
15248         value of include_member.
15249         (Archive::include_all_members): Likewise.
15250         (Archive::include_member): Change return type to bool.  Return
15251         false if first included object has incompatible target.  Set
15252         included_member_ field.
15253         (Add_archive_symbols::run): If add_symbols returns false, requeue
15254         Read_symbols task.
15255         * archive.h (class Archive): Add included_member_ field.
15256         Initialize it in constructor.  Add input_file and searched_for
15257         methods.  Update declarations.
15258         (class Add_archive_symbols): Add dirpath_, dirindex_, and
15259         input_argument_ fields.  Add them to constructor.  Change all
15260         callers.
15261         * script.cc: Include "target-select.h".
15262         (class Parser_closure): Add skip_on_incompatible_target_ and
15263         found_incompatible_target_ fields.  Add
15264         skip_on_incompatible_target parameter to constructor.  Change all
15265         callers.  Add methods skip_on_incompatible_target,
15266         clear_skip_on_incompatible_target, found_incompatible_target, and
15267         set_found_incompatible_target.
15268         (read_input_script): Add dirindex parameter.  Change all callers.
15269         If parser finds an incompatible target, requeue Read_symbols
15270         task.
15271         (script_set_symbol): Clear skip_on_incompatible_target in
15272         closure.
15273         (script_add_assertion, script_parse_option): Likewise.
15274         (script_start_sections, script_add_phdr): Likewise.
15275         (script_check_output_format): New function.
15276         * script.h (read_input_script): Update declaration.
15277         * script-c.h (script_check_output_format): Declare.
15278         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
15279         (ignore_cmd): Remove OUTPUT_FORMAT.
15280         * fileread.cc (Input_file::Input_file): Add explicit this.
15281         (Input_file::will_search_for): New function.
15282         (Input_file::open): Add pindex parameter.  Change all callers.
15283         * fileread.h (class Input_file): Add input_file_argument method.
15284         Declare will_search_for.  Update declarations.
15285         * object.cc (make_elf_object): Add punconfigured parameter.
15286         Change all callers.
15287         * object.h (class Object): Make input_file public.  Add
15288         searched_for method.
15289         (make_elf_object): Update declaration.
15290         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
15291         restart search.
15292         * dirsearch.h (class Dirsearch): Update declaration.
15293         * options.h (class General_options): Add --warn-search-mismatch.
15294         * parameters.cc (Parameters::is_compatible_target): New function.
15295         * parameters.h (class Parameters): Declare is_compatible_target.
15296         * workqueue.cc (Workqueue::add_blocker): New function.
15297         * workqueue.h (class Workqueue): Declare add_blocker.
15298
15299         * fileread.cc (Input_file::open): Remove options parameter.
15300         Change all callers.
15301         (Input_file::open_binary): Likewise.
15302         * script.cc (read_input_script): Likewise.
15303         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
15304         options parameter from constructor.  Change all callers.
15305         (class Read_script): Likewise.
15306         * fileread.h (class Input_file): Update declarations.
15307         * script.h (read_input_script): Update declaration.
15308
15309 2009-03-10  Nick Clifton  <nickc@redhat.com>
15310
15311         * po/es.po: New Spanish translation.
15312
15313 2009-03-06  Cary Coutant  <ccoutant@google.com>
15314
15315         * options.cc (parse_short_option): Keep dash_z from registering itself.
15316
15317 2009-03-03  Ian Lance Taylor  <iant@google.com>
15318
15319         PR 9918
15320         * target-reloc.h (relocate_section): Pass output_section to
15321         relocate.
15322         * i386.cc (Target_i386::should_apply_static_reloc): Add
15323         output_section parameter.  Change all callers.
15324         (Target_i386::Relocate::relocate): Add output_section parameter.
15325         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15326         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
15327         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
15328         * testsuite/two_file_shared.sh: New script.
15329         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
15330         (check_DATA): Add two_file_shared.dbg.
15331         (two_file_shared.dbg): New target.
15332         * testsuite/Makefile.in: Rebuild.
15333
15334 2009-03-01  Ian Lance Taylor  <iant@google.com>
15335
15336         * configure.ac: Check for byteswap.h.
15337         * configure: Rebuild.
15338         * config.in: Rebuild.
15339
15340 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
15341
15342         * layout.cc (Layout::find_or_add_kept_section): New function.
15343         (Layout::add_comdat): Removed.
15344         * layout.h (struct Kept_section): Move out of class Layout.
15345         Remove trailing underscores from field names.  Add group_sections
15346         field.  Rename group_ field to is_group.  Change all uses.
15347         (class Layout): Declare find_or_add_kept_section, not add_comdat.
15348         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
15349         comdat_groups_ field.
15350         (Sized_relobj::include_section_group): Use
15351         find_or_add_kept_section and Kept_section::group_sections.
15352         (Sized_relobj::include_linkonce_section): Likewise.
15353         * object.cc (class Sized_relobj): Don't define Comdat_group or
15354         Comdat_group_table.  Remove find_comdat_group and
15355         add_comdat_group.  Remove comdat_groups_ field.
15356         * plugin.cc (include_comdat_group): Use
15357         Layout::find_or_add_kept_section.
15358
15359 2009-02-28  Ian Lance Taylor  <iant@google.com>
15360
15361         * README: --gc-sections and map files are now supported.  Document
15362         some build requirements.
15363
15364         PR 6992
15365         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
15366         relocatable link set the value of the section symbol to zero.
15367         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
15368         relocatable link don't include the section address in the local
15369         symbol value.
15370
15371 2009-02-27  Ian Lance Taylor  <iant@google.com>
15372
15373         PR 6811
15374         * options.h (class Search_directory): Add is_system_directory.
15375         (class General_options): Declare is_in_system_directory.
15376         * options.cc (get_relative_sysroot): Make static.
15377         (get_default_sysroot): Make static.
15378         (General_optoins::is_in_system_directory): New function.
15379         * fileread.cc (Input_file::is_in_system_directory): New function.
15380         * fileread.h (class Input_file): Declare is_in_system_directory.
15381         * object.h (class Object): Add is_in_system_directory.
15382         (class Input_objects): Remove system_library_directory_ field.
15383         * object.cc (Input_objects::add_object): Don't set
15384         system_library_directory_.
15385         (input_objects::found_in_system_library_directory): Remove.
15386         * symtab.cc (Symbol_table::write_globals): Remove input_objects
15387         parameter.  Change all callers.
15388         (Symbol_table::sized_write_globals): Likewise.
15389         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
15390         Call Object::is_in_system_directory.
15391         * symtab.h (class Symbol_table): Update declarations.
15392
15393         PR 5990
15394         * descriptors.h (Open_descriptor): Add is_on_stack field.
15395         * descriptors.cc (Descriptors::open): If the descriptor is on the
15396         top of the stack, remove it.  Initialize is_on_stack field.
15397         (Descriptors::release): Only add pod to stack if it is not on the
15398         stack already.
15399         (Descriptors::close_some_descriptor): Clear stack_next and
15400         is_on_stack fields.
15401
15402         PR 7091
15403         * output.cc (Output_section::find_starting_output_address): Rename
15404         from starting_output_address; add PADDR parameter; change return
15405         type.
15406         * output.h (class Output_section): Declare
15407         find_starting_output_address instead of starting_output_address.
15408         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
15409         section symbol for which we can't find a merge section.
15410
15411         PR 9836
15412         * symtab.cc (Symbol_table::add_from_object): If the visibility is
15413         hidden or internal, force the symbol to be local.
15414         * resolve.cc (Symbol::override_visibility): Define.
15415         (Symbol::override_base): Use override_visibility.
15416         (Symbol_table::resolve): Likewise.
15417         (Symbol::override_base_with_special): Likewise.
15418         (Symbol_table::override_with_special): If the visibility is hidden
15419         or internal, force the symbol to be local.
15420         * symtab.h (class Symbol): Add set_visibility and
15421         override_visibility.
15422         * testsuite/ver_test_1.sh: New file.
15423         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
15424         (check_DATA): Add ver_test_1.syms.
15425         (ver_test_1.syms): New target.
15426         * testsuite/Makefile.in: Rebuild.
15427
15428 2009-02-25  Cary Coutant  <ccoutant@google.com>
15429
15430         * layout.cc (Layout::choose_output_section): Don't rename sections
15431         when using a linker script that has a SECTIONS clause.
15432         * Makefile.in: Regenerate.
15433
15434         * testsuite/Makefile.am (script_test_5.sh): New test case.
15435         * testsuite/Makefile.in: Regenerate.
15436         * testsuite/script_test_5.cc: New file.
15437         * testsuite/script_test_5.sh: New file.
15438         * testsuite/script_test_5.t: New file.
15439
15440 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
15441
15442         * archive.cc (Archive::include_member): Update calls to add_symbols.
15443         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
15444         the Layout argument.
15445         * dynobj.h (do_add_symbols): Add the Layout argument.
15446         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
15447         Layout argument.
15448         * object.h (Object::add_symbols): Add the Layout argument.
15449         (Object::do_add_symbols): Add the Layout argument.
15450         (Sized_relobj::do_add_symbols): Add the Layout argument.
15451         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
15452         Unify the two versions.
15453         (Add_plugin_symbols): Remove.
15454         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
15455         (Sized_pluginobj::do_add_symbols): Unify the two versions.
15456         (Add_plugin_symbols): Remove.
15457         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
15458         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
15459         (Add_symbols::run): Make it work with Pulginobj.
15460
15461 2009-02-06  Ian Lance Taylor  <iant@google.com>
15462
15463         * object.cc (Sized_relobj::do_layout): Make info message start
15464         with lower case letter.
15465
15466 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
15467
15468         * binary.cc: Fix file comment.
15469
15470         * options.h (enum Incremental_disposition): Define.
15471         (class General_options): Add new options: --incremental,
15472         --incremental_changed, --incremental_unchanged,
15473         --incremental_unknown.  Add incremental_disposition_ and
15474         implicit_incremental_ fields.
15475         (General_options::incremental_disposition): New function.
15476         (class Position_dependent_options): Add incremental_disposition
15477         option.
15478         (Position_dependent_options::copy_from_options): Set incremental
15479         dispositions.
15480         * options.cc (General_options::parse_incremental_changed): New
15481         function.
15482         (General_options::parse_incremental_unchanged): New function.
15483         (General_options::parse_incremental_unknown): New function.
15484         (General_options::General_options): Initialize new fields
15485         incremental_disposition_ and implicit_incremental_.
15486         (General_options::finalize): Check for uasge of --incremental-*
15487         without --incremental.
15488
15489 2009-02-06  Chris Demetriou  <cgd@google.com>
15490
15491         * gold.h (gold_undefined_symbol): Change to take only a Symbol
15492         pointer and to report location as the file name associated with
15493         the symbol.
15494         (gold_undefined_symbol_at_location): New function to replace the
15495         old gold_undefined_symbol functionality.
15496         * target-reloc.h (relocate_section): Update to use
15497         gold_undefined_symbol_at_location.
15498         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15499         Call gold_undefined_symbol function rather than gold_error.
15500         * errors.h (Errors::undefined_symbol): Take location as a
15501         string, rather than calculating it from a relocation.
15502         * errors.cc (Errors::fatal): Print "fatal error:" before the
15503         formatted message.
15504         (Errors::error, Errors::error_at_location): Print "error: "
15505         before the formatted message.
15506         (Errors::undefined_symbol): Take location as a string, rather
15507         than calculating it from a relocation.
15508         (gold_undefined_symbol_at_location): New function akin to
15509         old gold_undefined_symbol, calculates location from relocation.
15510         (gold_undefined_symbol): Change to take only a Symbol pointer
15511         and to report location as the file name associated with the symbol.
15512         * testsuite/debug_msg.sh: Update for changed error messages.
15513         * testsuite/undef_symbol.sh: Likewise.
15514
15515 2009-02-04  Duncan Sands  <baldrick@free.fr>
15516
15517         PR 9812
15518         * reduced_debug_output.h
15519         (Output_reduced_debug_abbrev_section::failed): Use format for
15520         gold_warning.
15521         (Output_reduced_debug_info_section::faild): Likewise.
15522
15523 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
15524
15525         * script.cc (Lazy_demangler): New class.
15526         (Version_script_info::get_symbol_version_helper): Demangle a
15527         symbol only once.
15528
15529 2009-01-29  Cary Coutant  <ccoutant@google.com>
15530
15531         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
15532         to __tls_get_addr.
15533         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15534
15535 2009-01-28  Ian Lance Taylor  <iant@google.com>
15536
15537         * version.cc (version_string): Bump to 1.9.
15538
15539         * gold.h: Include <cstring> and <stdint.h>.
15540         * version.cc: Include <cstdio>.
15541         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
15542         warning.
15543         * reduced_debug_output.cc (insert_into_vector): Rename from
15544         Insert_into_vector; change all callers.  Use Swap_unaligned to
15545         avoid aliasing issue; remove union since it is unnecessary.
15546
15547 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
15548
15549         * Makefile.am (CCFILES): Add gc.cc.
15550         (HFILES): Add gc.h.
15551         * Makefile.in: Regenerate.
15552         * gold.cc (Gc_runner): New class.
15553         (queue_initial_tasks): Call garbage collection related tasks
15554         when corresponding options are invoked.
15555         (queue_middle_gc_tasks): New function.
15556         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
15557         processed early before laying out sections during garbage collection.
15558         * gold.h (queue_middle_gc_tasks): New function.
15559         (is_prefix_of): Move from "layout.cc".
15560         * i386.cc (Target_i386::gc_process_relocs): New function.
15561         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
15562         * main.cc (main): Create object of class "Garbage_collection".
15563         * object.cc (Relobj::copy_symbols_data): New function.
15564         (Relobj::is_section_name_included): New function.
15565         (Sized_relobj::do_layout): Allow this function to be called twice
15566         during garbage collection and defer layout of section during the
15567         first call.
15568         * object.h (Relobj::get_symbols_data): New function.
15569         (Relobj::is_section_name_included): New function.
15570         (Relobj::copy_symbols_data): New function.
15571         (Relobj::set_symbols_data): New function.
15572         (Relobj::get_relocs_data): New function.
15573         (Relobj::set_relocs_data): New function.
15574         (Relobj::is_output_section_offset_invalid): New pure virtual function.
15575         (Relobj::gc_process_relocs): New function.
15576         (Relobj::do_gc_process_relocs): New pure virtual function.
15577         (Relobj::sd_): New data member.
15578         (Sized_relobj::is_output_section_offset_invalid): New function.
15579         (Sized_relobj::do_gc_process_relocs): New function.
15580         * options.h (General_options::gc_sections): Modify to not be a no-op.
15581         (General_options::print_gc_sections): New option.
15582         * plugin.cc (Plugin_finish::run): Remove function call to
15583         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
15584         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
15585         * reloc.cc (Read_relocs::run): Add task to process relocs and
15586         determine unreferenced sections when doing garbage collection.
15587         (Gc_process_relocs): New class.
15588         (Sized_relobj::do_gc_process_relocs): New function.
15589         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
15590         sections that are garbage collected.
15591         * reloc.h (Gc_process_relocs): New class.
15592         * sparc.cc (Target_sparc::gc_process_relocs): New function.
15593         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
15594         symbols whose corresponding sections are garbage collected.
15595         (Symbol_table::Symbol_table): Add new parameter for the garbage
15596         collection object.
15597         (Symbol_table::gc_mark_undef_symbols): New function.
15598         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15599         (Symbol_table::gc_mark_dyn_syms): New function.
15600         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
15601         as garbage.
15602         (Symbol_table::add_from_object): Likewise.
15603         (Symbol_table::add_from_relobj): When building shared objects, do not
15604         treat externally visible symbols as garbage.
15605         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
15606         table information for static and relocatable links.
15607         * symtab.h (Symbol_table::set_gc): New function.
15608         (Symbol_table::gc): New function.
15609         (Symbol_table::gc_mark_undef_symbols): New function.
15610         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15611         (Symbol_table::gc_mark_dyn_syms): New function.
15612         (Symbol_table::gc_): New data member.
15613         * target.h (Sized_target::gc_process_relocs): New pure virtual
15614         function.
15615         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
15616         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
15617
15618 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
15619
15620         * options.h (General_options::gc_sections): Define as a no-op for now.
15621         (General_options::no_keep_memory): Ditto.
15622         (General_options::Bshareable): Define.
15623         * options.cc (General_options::finalize): Honor -Bshareable.
15624
15625 2009-01-20  Andreas Schwab  <schwab@suse.de>
15626
15627         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
15628         read the value in the contents, since we don't use it.  Use the
15629         template endianness when writing.
15630         (Relocate::relocate): Use it for R_PPC_REL16_HA.
15631
15632 2009-01-19  Andreas Schwab  <schwab@suse.de>
15633
15634         * configure.tgt (powerpc64-*): Fix targ_obj.
15635
15636 2009-01-15  Ian Lance Taylor  <iant@google.com>
15637
15638         * object.cc (Sized_relobj::write_local_symbols): Don't write out
15639         local symbols when stripping all symbols.
15640
15641 2009-01-14  Cary Coutant  <ccoutant@google.com>
15642
15643         * output.cc (Output_reloc): Add explicit instantiations.
15644
15645 2009-01-14  Cary Coutant  <ccoutant@google.com>
15646
15647         * archive.cc (Archive::get_elf_object_for_member): Remove call
15648         to File_read::claim_for_plugin.
15649         * descriptors.cc (Descriptors::open): Remove reference to
15650         is_claimed.
15651         (Descriptors::claim_for_plugin): Remove.
15652         * descriptors.h (Descriptors::claim_for_plugin): Remove.
15653         (Descriptors::is_claimed): Remove.
15654         (claim_descriptor_for_plugin): Remove.
15655         * fileread.cc (File_read::claim_for_plugin): Remove.
15656         * fileread.h (File_read::claim_for_plugin): Remove.
15657         (File_read::descriptor): Reopen descriptor if necessary.
15658         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
15659         (Plugin_manager::all_symbols_read): Add task parameter. Change
15660         all callers.
15661         (Plugin_manager::get_input_file): New function.
15662         (Plugin_manager::release_input_file): New function.
15663         (Pluginobj::Pluginobj): Add filesize parameter and initialize
15664         corresponding data member.
15665         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
15666         and pass to base constructor. Change all callers.
15667         (get_input_file, release_input_file): New functions.
15668         (make_sized_plugin_object): Add filesize parameter. Change all callers.
15669         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
15670         (Plugin_manager::all_symbols_read): Add task parameter.
15671         (Plugin_manager::get_input_file): New function.
15672         (Plugin_manager::release_input_file): New function.
15673         (Plugin_manager::task_): New data member.
15674         (Pluginobj::Pluginobj): Add filesize parameter.
15675         (Pluginobj::filename): New function.
15676         (Pluginobj::descriptor): New function.
15677         (Pluginobj::filesize): New function.
15678         (Pluginobj::filesize_): New data member.
15679         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
15680         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
15681         File_read::claim_for_plugin; use Object::unlock to unlock the file.
15682
15683         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
15684         with archive libraries.
15685         * testsuite/Makefile.in: Regenerate.
15686         * testsuite/plugin_test.c (struct sym_info): New type.
15687         (get_input_file, release_input_file): New static variables.
15688         (onload): Capture new transfer vector entries.
15689         (claim_file_hook): Stop reading at end of file according to filesize.
15690         Factor out parsing of readelf output into separate function.
15691         (all_symbols_read_hook): Exercise get_input_file and release_input_file
15692         APIs and get the source file name from the symbol table.  Convert
15693         source file name to corresponding object file name.  Print info
15694         message when adding new input files.
15695         (parse_readelf_line): New function.
15696         * testsuite/plugin_test_1.sh: Add checks for new info messages.
15697         * testsuite/plugin_test_2.sh: Likewise.
15698         * testsuite/plugin_test_3.sh: Likewise.
15699         * testsuite/plugin_test_4.sh: New test case.
15700
15701 2009-01-07  Ian Lance Taylor  <iant@google.com>
15702
15703         * version.cc (version_string): Bump to 1.8.
15704
15705 2008-12-23  Cary Coutant  <ccoutant@google.com>
15706
15707         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
15708         * plugin.cc (Plugin_manager::finish): Rename as
15709         layout_deferred_objects.  Move cleanup to separate function.
15710         (Plugin_manager::cleanup): New function.
15711         (Plugin_finish::run): Call layout_deferred_objects and cleanup
15712         separately.
15713         * plugin.h (Plugin_manager::finish): Rename as
15714         layout_deferred_objects.
15715         (Plugin_manager::cleanup): New function.
15716         (Plugin_manager::cleanup_done): New field.
15717
15718 2008-12-23  Cary Coutant  <ccoutant@google.com>
15719
15720         * plugin.cc (is_visible_from_outside): New function.
15721         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
15722         so we don't return "IR only" status for exported symbols or -r links.
15723
15724         * testsuite/Makefile.am (plugin_test_3): New test case.
15725         * testsuite/Makefile.in: Regenerate.
15726         * testsuite/plugin_test_3.sh: New file.
15727
15728 2008-12-22  Cary Coutant  <ccoutant@google.com>
15729
15730         * object.cc (Sized_relobj::layout_section): New function.
15731         (Sized_relobj::do_layout): Defer layout of input sections until after
15732         plugin has provided replacement files.
15733         (Sized_relobj::do_layout_deferred_sections): New function.
15734         * object.h (Relobj::set_section_offset): Remove virtual keyword.
15735         (Relobj::layout_deferred_sections): New function.
15736         (Relobj::do_layout_deferred_sections): New function.
15737         (Sized_relobj::do_layout_deferred_sections): New function.
15738         (Sized_relobj::layout_section): New function.
15739         (Sized_relobj::Deferred_layout): New structure.
15740         (Sized_relobj::deferred_layout_): New field.
15741         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
15742         Change all callers.  Layout deferred sections.
15743         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
15744         references.
15745         (Plugin_hook::run): Move code from do_plugin_hook inline.
15746         (Plugin_hook::do_plugin_hook): Remove.
15747         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
15748         (Plugin_manager::finish): Renamed, was cleanup.
15749         (Plugin_manager::should_defer_layout): New function.
15750         (Plugin_manager::add_deferred_layout_object): New function.
15751         (Plugin_manager::Deferred_layout_list): New type.
15752         (Plugin_manager::deferred_layout_objects_): New field.
15753         (Plugin_hook::do_plugin_hook): Remove.
15754
15755 2008-12-17  Ian Lance Taylor  <iant@google.com>
15756
15757         * options.h (class General_options): Add --no case for
15758         --export-dynamic.
15759
15760 2008-12-16  Cary Coutant  <ccoutant@google.com>
15761
15762         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
15763         vector.
15764         (Plugin_manager::claim_file): Create plugin object even if
15765         plugin did not call the add_symbols callback.
15766         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
15767         asking for more symbols than were added.
15768         * testsuite/Makefile.am (plugin_test_1): Add test case with
15769         no global symbols.
15770         (empty.syms): New target.
15771         * testsuite/Makefile.in: Regenerate.
15772         * testsuite/plugin_test.c (claim_file_hook): Add new debug
15773         message. Don't call add_symbols if no globals.
15774         (all_symbols_read_hook): Don't provide replacement for empty
15775         claimed file.
15776
15777 2008-12-12  Ian Lance Taylor  <iant@google.com>
15778
15779         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
15780         r_type == 0 for a local symbol with r_sym == 0.
15781         (scan_relocatable_relocs): Pass r_sym to
15782         local_non_section_strategy.
15783         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
15784         r_sym parameter.
15785
15786         * configure.ac: Update test for TLS descriptors: they are
15787         supported as of glibc 2.9.
15788         * configure: Rebuild.
15789
15790 2008-12-11  Ian Lance Taylor  <iant@google.com>
15791
15792         PR 7091
15793         * target-reloc.h (Default_scan_relocatable_relocs): For each
15794         function, map r_type == 0 to RELOC_DISCARD.
15795
15796 2008-12-10  Cary Coutant  <ccoutant@google.com>
15797
15798         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
15799         object to override a kept COMDAT group from a plugin object.
15800
15801 2008-12-09  Ian Lance Taylor  <iant@google.com>
15802
15803         PR 7088
15804         * yyscript.y (file_cmd): Handle INPUT.
15805
15806         * testsuite/initpri1.c: Change all declarations to be full
15807         prototypes by adding void, to avoid compiler warnings.
15808
15809 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
15810
15811         * options.cc (General_options::parse_plugin_opt): New.
15812         (General_options::add_plugin): The argument now is just the filename.
15813         (General_options::add_plugin_option): New.
15814         * options.h (plugin_opt): New.
15815         (add_plugin): Change argument name.
15816         (add_plugin_option): New.
15817         * plugin.cc (Plugin::load): Don't parse the plugin option.
15818         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
15819         (Plugin::add_option): New.
15820         (Plugin::args_): Change type.
15821         (Plugin::filename_): New.
15822         (Plugin_manager::add_plugin_option): New.
15823         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
15824         * testsuite/Makefile.in: Regenerate.
15825
15826 2008-12-05  Cary Coutant  <ccoutant@google.com>
15827
15828         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
15829         Handle --strip-lto-sections option.
15830         * options.h (strip_lto_sections): New option.
15831
15832 2008-12-01  Cary Coutant  <ccoutant@google.com>
15833
15834         * plugin.cc (ld_plugin_message): Change format parameter to const.
15835         Fix mismatch between new[] and delete.
15836
15837 2008-11-14  Cary Coutant  <ccoutant@google.com>
15838
15839         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
15840         instead of -1U.
15841
15842 2008-11-05  Craig Silverstein  <csilvers@google.com>
15843
15844         * options.cc (General_options::parse_dynamic_list): New function.
15845         * options.h (General_options): New flags dynamic_list,
15846         dynamic_list_data, dynamic_list_cpp_new, and
15847         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
15848         (General_options::in_dynamic_list): New function.
15849         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
15850         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
15851         (Lex::can_continue_name): Likewise.
15852         (yylex): Likewise.
15853         (read_script_file): New parameter script_options.
15854         (read_dynamic_list): New function.
15855         (Script_options::define_dynamic_list): New function.
15856         (dynamic_list_keyword_parsecodes): New variable.
15857         (dynamic_list_keywords): New variable.
15858         * script.h (Script_options::define_dynamic_list): New function
15859         prototype.
15860         (read_dynamic_list): New function prototype.
15861         * symtab.cc (strprefix): New macro.
15862         (Symbol::should_add_dynsym_entry): Support dynamic_list,
15863         dynamic_list_data, dynamic_list_cpp_new, and
15864         dynamic_list_cpp_typeinfo.
15865         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
15866         (dynamic_list_expr): New rule.
15867         (dynamic_list_nodes): Likewise.
15868         (dynamic_list_node): Likewise.
15869         * testsuite/Makefile.am (dynamic_list): New test.
15870         * testsuite/Makefile.in: Regenerated.
15871         * testsuite/dynamic_list.t: New file.
15872         * testsuite/dynamic_list.sh: New file.
15873
15874 2008-11-05  Craig Silverstein  <csilvers@google.com>
15875
15876         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
15877         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
15878         (t11_last): Likewise.
15879         * testsuite/ver_test_6.c (main): Likewise.
15880
15881 2008-10-07  Cary Coutant  <ccoutant@google.com>
15882
15883         * options.c (General_options::finalize): Add check for -static and
15884         -shared.
15885         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
15886         is not empty.
15887
15888 2008-10-02  Cary Coutant  <ccoutant@google.com>
15889
15890         * plugin.cc (make_sized_plugin_object): Fix conditional
15891         compilation to work when not all targets are enabled.
15892
15893 2008-09-29  Cary Coutant  <ccoutant@google.com>
15894
15895         * archive.cc (Archive::get_file_and_offset): Use filename instead
15896         of name to get library path.
15897         (Archive::include_member): Unlock external member of a thin archive.
15898
15899         * testsuite/Makefile.am (TEST_AR): New variable.
15900         (thin_archive_test_1): New test.
15901         (thin_archive_test_2): New test.
15902         * testsuite/Makefile.in: Regenerate.
15903         * testsuite/thin_archive_main.cc: New file.
15904         * testsuite/thin_archive_test_1.cc: New file.
15905         * testsuite/thin_archive_test_2.cc: New file.
15906         * testsuite/thin_archive_test_3.cc: New file.
15907         * testsuite/thin_archive_test_4.cc: New file.
15908
15909 2008-09-29  Cary Coutant  <ccoutant@google.com>
15910
15911         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
15912         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
15913         instead of -1U.
15914         (Sized_relobj::do_finalize_local_symbols): Likewise.
15915         (Sized_relobj::map_to_kept_section): Likewise.
15916         * object.h (Sized_relobj::invalid_address): New constant.
15917         (Sized_relobj::do_output_section_offset): Check for invalid_address
15918         and return -1ULL.
15919         * output.cc (Output_reloc::local_section_offset): Use constant
15920         invalid_address instead of -1U.
15921         (Output_reloc::get_address): Likewise.
15922         (Output_section::output_address): Change -1U to -1ULL.
15923         * output.h (Output_reloc::invalid_address): New constant.
15924         * reloc.cc (Sized_relobj::write_sections): Use constant
15925         invalid_address instead of -1U.
15926         (Sized_relobj::relocate_sections): Likewise.
15927         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
15928         values for merge sections.
15929         * target-reloc.h (relocate_for_relocatable): Use constant
15930         invalid_address instead of -1U.
15931
15932 2008-09-19  Cary Coutant  <ccoutant@google.com>
15933
15934         Add plugin functionality for link-time optimization (LTO).
15935         * configure.ac (plugins): Add --enable-plugins option.
15936         * configure: Regenerate.
15937         * config.in: Regenerate.
15938         * Makefile.am (LIBDL): New variable.
15939         (CCFILES): Add plugin.cc.
15940         (HFILES): Add plugin.h.
15941         (ldadd_var): Add LIBDL.
15942         * Makefile.in: Regenerate.
15943
15944         * archive.cc: Include "plugin.h".
15945         (Archive::setup): Don't preread archive symbols when using a plugin.
15946         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
15947         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
15948         files.
15949         (Archive::include_member): Add symbols from plugin objects.
15950         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
15951         * descriptors.cc (Descriptors::open): Check for file descriptors
15952         abandoned by plugins.
15953         (Descriptors::claim_for_plugin): New function.
15954         * descriptors.h (Descriptors::claim_for_plugin): New function.
15955         (Open_descriptor::is_claimed): New field.
15956         (claim_descriptor_for_plugin): New function.
15957         * fileread.cc (File_read::claim_for_plugin): New function.
15958         * fileread.h (File_read::claim_for_plugin): New function.
15959         (File_read::descriptor): New function.
15960         * gold.cc: Include "plugin.h".
15961         (queue_initial_tasks): Add task to call plugin hooks for generating
15962         new object files.
15963         * main.cc: Include "plugin.h".
15964         (main): Load plugin libraries.
15965         * object.h (Pluginobj): Declare.
15966         (Object::pluginobj): New function.
15967         (Object::do_pluginobj): New function.
15968         (Object::set_target): New function.
15969         * options.cc: Include "plugin.h".
15970         (General_options::parse_plugin): New function.
15971         (General_options::General_options): Initialize plugins_ field.
15972         (General_options::add_plugin): New function.
15973         * options.h (Plugin_manager): Declare.
15974         (General_options): Add --plugin option.
15975         (General_options::has_plugins): New function.
15976         (General_options::plugins): New function.
15977         (General_options::add_plugin): New function.
15978         (General_options::plugins_): New field.
15979         * plugin.cc: New file.
15980         * plugin.h: New file.
15981         * readsyms.cc: Include "plugin.h".
15982         (Read_symbols::do_read_symbols): Check for archive before checking
15983         for ELF file.  Call plugin hooks to claim files.
15984         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
15985         from a real object file; force override when processing replacement
15986         files.
15987         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
15988         (Symbol::init_base_object): Likewise.
15989         (Symbol::init_base_output_data): Likewise.
15990         (Symbol::init_base_output_segment): Likewise.
15991         (Symbol::init_base_constant): Likewise.
15992         (Symbol::init_base_undefined): Likewise.
15993         (Symbol::output_section): Assert that object is not a plugin.
15994         (Symbol_table::add_from_pluginobj): New function.
15995         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15996         undefined.
15997         (Symbol_table::sized_write_globals): Likewise.
15998         (Symbol_table::add_from_pluginobj): Instantiate template.
15999         * symtab.h (Sized_pluginobj): Declare.
16000         (Symbol::in_real_elf): New function.
16001         (Symbol::set_in_real_elf): New function.
16002         (Symbol::in_real_elf_): New field.
16003         (Symbol_table::add_from_pluginobj): New function.
16004
16005         * testsuite/Makefile.am (AM_CFLAGS): New variable.
16006         (LIBDL): New variable.
16007         (LDADD): Add LIBDL.
16008         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
16009         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
16010         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
16011         (MOSTLYCLEANFILES): Likewise.
16012         * testsuite/Makefile.in: Regenerate.
16013         * testsuite/plugin_test.c: New file.
16014         * testsuite/plugin_test_1.sh: New file.
16015         * testsuite/plugin_test_2.sh: New file.
16016
16017 2008-09-16  Ian Lance Taylor  <iant@google.com>
16018
16019         * target-reloc.h (relocate_section): Check whether a symbol is
16020         defined by the ABI before reporting an undefined symbol error.
16021         * target.h (Target::is_defined_by_abi): Make parameter const.
16022         (Target::do_is_defined_by_abi): Likewise.
16023         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
16024         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
16025         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
16026         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
16027         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
16028         * testsuite/Makefile.in: Rebuild.
16029
16030         * fileread.cc (make_view): Add casts to avoid warning.
16031
16032 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
16033
16034         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
16035         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
16036
16037 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
16038
16039         * options.h (General_options::output_is_executable): New.
16040         (General_options::output_is_pie): New.
16041         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
16042         for shared libraries.
16043         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
16044
16045 2008-09-11  Chris Demetriou  <cgd@google.com>
16046
16047         * options.h (origin): New -z option.
16048         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
16049         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
16050         in DT_FLAGS_1.
16051
16052 2008-09-05  Cary Coutant  <ccoutant@google.com>
16053
16054         * fileread.cc (File_read::make_view): Add check for attempt to map
16055         beyond end of file.
16056
16057 2008-09-05  Cary Coutant  <ccoutant@google.com>
16058
16059         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
16060         explicit instantiations.
16061
16062 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
16063
16064         PR gold/6858
16065         * options.cc (General_options::finalize): Allow undefined symbols
16066         in shlibs if linking -shared.
16067
16068         PR gold/6859
16069         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
16070         symbols as not needing a dynsym entry.
16071
16072 2008-08-20  Craig Silverstein  <csilvers@google.com>
16073
16074         * fileread.cc (File_read::open): Do not lock the file unless it
16075         was successfully opened.
16076
16077 2008-08-14  Cary Coutant  <ccoutant@google.com>
16078
16079         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
16080         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
16081         * testsuite/tls_test.cc (struct int128): 128-bit struct
16082         for testing TLS relocs with non-zero addend.
16083         (v12): New TLS variable.
16084         (t12): New test.
16085         (t_last): Add check for v12.
16086         * testsuite/tls_test.h (t12): New function.
16087         * testsuite/tls_test_main.cc (thread_routine): Call new test.
16088
16089 2008-08-13  Ian Lance Taylor  <iant@google.com>
16090
16091         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
16092         set tls_segment_ or relro_segment_.
16093         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
16094         when appropriate.
16095         * output.h (Output_section::clear_is_relro): New function.
16096         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
16097         sections specially even when output_data_ is empty.
16098         (Output_segment::maximum_alignment): When first section is relro,
16099         only force alignment for PT_LOAD segments.
16100         * script.cc (script_data_segment_align): New function.
16101         (script_data_segment_relro_end): New function.
16102         * script-c.h (script_data_segment_align): Declare.
16103         (script_data_segment_relro_end): Declare.
16104         * script-sections.h (class Script_sections): Declare
16105         data_segment_align and data_segment_relro_end.  Add fields
16106         segment_align_index_ and saw_relro_end_.
16107         * script-sections.cc (class Sections_element): Add set_is_relro
16108         virtual function.  Add new bool* parameter to place_orphan_here.
16109         Add get_output_section virtual function.
16110         (class Output_section_definition): Add set_is_relro.  Add new
16111         bool* parameter to place_orphan_here.  Add get_output_section.
16112         Add is_relro_ field.
16113         (Output_section_definition::Output_section_definition): Initialize
16114         evaluated_address_, evaluated_load_address, evaluated_addralign_,
16115         and is_relro_ fields.
16116         (Output_section_definition::place_orphan_here): Add is_relro
16117         parameter.
16118         (Output_section_definition::set_section_addresses): Set relro for
16119         output section.
16120         (Output_section_definition::alternate_constraint): Likewise.
16121         (class Orphan_output_section): Add new bool* parameter to
16122         place_orphan_here.  Add get_output_section.
16123         (Orphan_output_section::place_orphan_here): Add is_relro
16124         parameter.
16125         (Script_sections::Script_sections): Initialize
16126         data_segment_align_index_ and saw_relro_end_.
16127         (Script_sections::data_segment_align): New function.
16128         (Script_sections::data_segment_relro_end): New function.
16129         (Script_sections::place_orphan): Set or clear is_relro.
16130         (Script_sections::set_section_addresses): Force alignment of first
16131         TLS section.
16132         * yyscript.y (exp): Call script_data_segment_align and
16133         script_data_segment_relro_end.
16134         * testsuite/relro_script_test.t: New file.
16135         * testsuite/relro_test.cc (using_script): Declare.
16136         (t1, t2): Test using_script.
16137         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
16138         (relro_script_test_SOURCES): Define.
16139         (relro_script_test_DEPENDENCIES): Define.
16140         (relro_script_test_LDFLAGS): Define.
16141         (relro_script_test_LDADD): Define.
16142         (relro_script_test.so): New target.
16143         * testsuite/Makefile.in: Rebuild.
16144
16145 2008-08-06  Cary Coutant <ccoutant@google.com>
16146
16147         * archive.cc (Archive::total_archives, Archive::total_members)
16148         (Archive::total_members_loaded): New variables.
16149         (Archive::setup): Add parameter.  Add option to preread
16150         archive symbols.
16151         (Archive::read_armap): Add counter.
16152         (Archive::get_file_and_offset): New function.
16153         (Archive::get_elf_object_for_member): New function.
16154         (Archive::read_all_symbols): New function.
16155         (Archive::read_symbols): New function.
16156         (Archive::add_symbols): Add counters.
16157         (Archive::include_all_members): Use armap to find members if it's
16158         already built.
16159         (Archive::include_member): Skip reading symbols if already read.
16160         Factored code into Archive::get_file_and_offset and
16161         Archive::get_elf_object_for_member.  Changed call to
16162         Mapfile::report_include_archive_member.
16163         (Archive::print_stats): New function.
16164         * archive.h: Declare Object and Read_symbols_data classes.
16165         (Archive::Archive): Add initializers for new members.
16166         (Archive::setup): Add parameter.
16167         (Archive::print_stats): New function.
16168         (Archive::total_archives, Archive::total_members)
16169         (Archive::total_members_loaded): New variables.
16170         (Archive::get_file_and_offset): New function.
16171         (Archive::get_elf_object_for_member): New function.
16172         (Archive::read_all_symbols): New function.
16173         (Archive::read_symbols): New function.
16174         (Archive::Archive_member): New class.
16175         (Archive::members_): New member.
16176         (Archive::num_members_): New member.
16177         * main.cc: Include archive.h.
16178         (main): Call Archive::print_stats.
16179         * mapfile.cc (Mapfile::report_include_archive_member): Delete
16180         archive parameter; member_name is now the fully-decorated name.
16181         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
16182         * options.h: (General_options): Add --preread-archive-symbols option.
16183         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
16184         Archive::setup.
16185
16186 2008-08-04  Ian Lance Taylor  <iant@google.com>
16187
16188         * symtab.h (Symbol::use_plt_offset): New function.
16189         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
16190         * powerpc.cc (Relocate::relocate): Likewise.
16191         * sparc.cc (Relocate::relocate): Likewise.
16192         * x86_64.cc (Relocate::relocate): Likewise.
16193         * testsuite/weak_plt.sh: New test.
16194         * testsuite/weak_plt_main.cc: New test.
16195         * testsuite/weak_plt_shared.cc: New test.
16196         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
16197         (check_PROGRAMS): Add weak_plt.
16198         (check_DATA): Add weak_plt_shared.so.
16199         (weak_plt_main_pic.o, weak_plt): New targets.
16200         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
16201         * testsuite/Makefile.in: Rebuild.
16202
16203         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
16204         gcctestdir/ld.
16205         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
16206         * testsuite/Makefile.in: Rebuild.
16207
16208 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
16209
16210         * Makefile.am (POTFILES.in): Set LC_ALL=C.
16211         * Makefile.in: Regenerate.
16212         * po/POTFILES.in: Regenerate.
16213
16214 2008-07-29  Ian Lance Taylor  <iant@google.com>
16215
16216         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
16217         symbols before other symbols.
16218         * testsuite/script_test_2.cc (test_addr): Declare.
16219         (test_addr_alias): Declare.
16220         (main): Check that test_addr and test_addr_alias have the right
16221         values.
16222         * testsuite/script_test_2.t: Define test_addr_alias and
16223         test_addr.
16224
16225 2008-07-24  Ian Lance Taylor  <iant@google.com>
16226
16227         PR 5990
16228         * descriptors.cc: New file.
16229         * descriptors.h: New file.
16230         * gold-threads.h (class Hold_optional_lock): New class.
16231         * fileread.cc: Include "descriptors.h".
16232         (File_read::~File_read): Release descriptor rather than closing
16233         it.
16234         (File_read::open) [file]: Call open_descriptor rather than open.
16235         Set is_descriptor_opened_.
16236         (File_read::open) [memory]: Assert that descriptor is not open.
16237         (File_read::reopen_descriptor): New function.
16238         (File_read::release): Release descriptor.
16239         (File_read::do_read): Make non-const.  Reopen descriptor.
16240         (File_read::read): Make non-const.
16241         (File_read::make_view): Reopen descriptor.
16242         (File_read::do_readv): Likewise.
16243         * fileread.h (class File_read): Add is_descriptor_opened_ field.
16244         Update declarations.
16245         * layout.cc: Include "descriptors.h".
16246         (Layout::create_build_id): Use open_descriptor rather than open.
16247         * output.cc: Include "descriptors.h".
16248         (Output_file::open): Use open_descriptor rather than open.
16249         * archive.cc (Archive::const_iterator): Change Archive to be
16250         non-const.
16251         (Archive::begin, Archive::end): Make non-const.
16252         (Archive::count_members): Likewise.
16253         * archive.h (class Archive): Update declarations.
16254         * object.h (Object::read): Make non-const.
16255         * Makefile.am (CCFILES): Add descriptors.cc.
16256         (HFILES): Add descriptors.h.
16257         * Makefile.in: Rebuild.
16258
16259         PR 6716
16260         * gold.h: Always include <clocale>.  Add Solaris workarounds
16261         following code in binutils/sysdep.h.
16262
16263         PR 6048
16264         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
16265         this->eh_frame_hdr_ is NULL before using it.
16266
16267         * dynobj.cc (Versions::Versions): Update comment.
16268
16269         * dynobj.cc (Versions::Versions): If there is an soname, use it as
16270         the base version name.
16271
16272         * stringpool.cc (Stringpool_template::add_with_length): Set key to
16273         array size plus one.
16274         (Stringpool_template::set_string_offsets): Subtract one from key
16275         before using it as an array index.
16276         (Stringpool_template::get_offset_with_length): Likewise.
16277         (Stringpool_template::write_to_buffer): Likewise.
16278         * stringpool.h (Stringpool_template::get_offset_from_key):
16279         Likewise.
16280
16281 2008-07-23  Ian Lance Taylor  <iant@google.com>
16282
16283         PR 6658
16284         * object.h (Merged_symbol_value::value): Do our best to handle a
16285         negative addend.
16286
16287         PR 6647
16288         * script.cc (Version_script_info::get_versions): Don't add empty
16289         version tag to return value.
16290         (Version_script_info::get_symbol_version_helper): Change return
16291         type to bool.  Add pversion parameter.  Change all callers.
16292         (script_register_vers_node): Don't require a non-NULL tag.
16293         * script.h (class Version_script_info): Update declarations.
16294         (Version_script_info::get_symbol_version): Change return type to
16295         bool.  Add version parameter.  Change all callers.
16296         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
16297         handling.  Handle an empty version from a version script.
16298         (Symbol_table::define_special_symbol): Likewise.
16299         * testsuite/ver_test_10.script: New file.
16300         * testsuite/ver_test_10.sh: New file.
16301         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
16302         (check_DATA): Add ver_test_10.syms.
16303         (ver_test_10.syms, ver_test_10.so): New target.
16304         * testsuite/Makefile.in: Rebuild.
16305
16306 2008-07-23  Simon Baldwin  <simonb@google.com>
16307
16308         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
16309         to zero for undefined symbols from dynamic libraries.
16310
16311 2008-07-23  Ian Lance Taylor  <iant@google.com>
16312
16313         * symtab.cc (Symbol_table::resolve): Remove version parameter.
16314         Change all callers.
16315         * symtab.h (class Symbol_table): Update declaration.
16316         * testsuite/ver_test_9.cc: New file.
16317         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
16318         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
16319         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
16320         (ver_test_9.so, ver_test_9.o): New targets.
16321         * testsuite/Makefile.in: Rebuild.
16322
16323 2008-07-22  Ian Lance Taylor  <iant@google.com>
16324
16325         * options.h (class General_options): Define --check-sections.
16326         * layout.cc (Layout::set_segment_offsets): Handle
16327         --check-sections.
16328
16329         * options.h (class General_options): Define -n/--nmagic and
16330         -N/--omagic.
16331         * options.cc (General_options::finalize): For -n/--nmagic or
16332         -N/--omagic, set -static.
16333         * layout.cc (Layout::attach_allocated_section_to_segment): If
16334         -N/--omagic, don't put read-only and read-write sections in
16335         different segments.
16336         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
16337         finding a read-only segment.
16338         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
16339         don't set the minimum segment alignment to the common page size,
16340         and don't set the file offset to the address modulo the page size.
16341         * script-sections.cc (Script_sections::create_segments): If
16342         -n/--omagic, don't put read-only and read-write sections in
16343         different segments.
16344
16345         * cref.cc: New file.
16346         * cref.h: New file.
16347         * options.h (class General_options): Add --print-symbol-counts.
16348         * main.cc (main): Issue defined symbol report if requested.
16349         * archive.cc (Archive::interpret_header): Make into a const member
16350         function.
16351         (Archive::add_symbols): Call Input_objects::archive_start and
16352         archive_stop.
16353         (Archive::const_iterator): Define new class.
16354         (Archive::begin, Archive::end): New functions.
16355         (Archive::include_all_members): Rewrite to use iterator.
16356         (Archive::count_members): New function.
16357         * archive.h (class Archive): Update declarations.
16358         (Archive::filename): New function.
16359         * object.cc: Include "cref.h".
16360         (Sized_relobj::Sized_relobj): Initialize defined_count_.
16361         (Sized_relobj::do_get_global_symbol_counts): New function.
16362         (Input_objects::add_object): Add object to cross-referencer.
16363         (Input_objects::archive_start): New function.
16364         (Input_objects::archive_stop): New function.
16365         (Input_objects::print_symbol_counts): New function.
16366         * object.h: Declare Cref and Archive.
16367         (Object::get_global_symbol_counts): New function.
16368         (Object::do_get_global_symbol_counts): New pure virtual function.
16369         (class Sized_relobj): Add defined_count_ field.  Update
16370         declarations.
16371         (class Input_objects): Add cref_ field.  Update constructor.
16372         Update declarations.
16373         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
16374         defined_count_.
16375         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
16376         symbol counts.
16377         (Sized_dynobj::do_get_global_symbol_counts): New function.
16378         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
16379         defined_count_.  Update declarations.  Define Symbols typedef.
16380         * symtab.cc (Symbol_table::add_from_relobj): Add defined
16381         parameter.  Change all callers.
16382         (Symbol_table::add_from_dynobj): Add sympointers and defined
16383         parameters.  Change all callers.
16384         * symtab.h (class Symbol_table): Update declarations.
16385         * Makefile.am (CCFILES): Add cref.cc.
16386         (HFILES): Add cref.h.
16387         * Makefile.in: Rebuild.
16388
16389 2008-07-22  Simon Baldwin  <simonb@google.com>
16390
16391         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
16392         to zero when writing undefined symbols.
16393
16394 2008-07-22  Ian Lance Taylor  <iant@google.com>
16395
16396         * output.cc (Output_section::add_input_section): Don't try to
16397         merge empty merge sections.
16398
16399 2008-07-21  Craig Silverstein  <csilvers@google.com>
16400
16401         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
16402         Include symbol version in error message.
16403
16404 2008-07-20  Chris Demetriou  <cgd@google.com>
16405
16406         * configure.ac (gold_cv_c_random_seed): New configured variable.
16407         (RANDOM_SEED_CFLAGS): New substituted variable.
16408         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
16409         * configure: Rebuild.
16410         * Makefile.in: Likewise.
16411         * testsuite/Makefile.in: Likewise.
16412
16413 2008-07-18  Ian Lance Taylor  <iant@google.com>
16414
16415         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
16416         where we see NAME/NULL and NAME/VERSION  as separate symbols.
16417         * testsuite/ver_test_main.cc (main): Call t4.
16418         (t4, t4_2a): Define.
16419         * testsuite/ver_test_2.cc (t4_2): Define.
16420         * testsuite/ver_test_2.script: Put t4_2a in VER2.
16421         * testsuite/ver_test_4.cc (t4_2a): Define.
16422         * testsuite/ver_test_4.script: Put t4_2a in VER2.
16423         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
16424
16425 2008-07-17  Ian Lance Taylor  <iant@google.com>
16426
16427         * dynobj.cc (Versions::add_def): If we give an error about a
16428         missing version, go ahead and create the version anyhow.
16429
16430 2008-07-10  Ian Lance Taylor  <iant@google.com>
16431
16432         Handle output sections with more than 0x7fffffff bytes.
16433         * object.h (class Relobj): Change map_to_output_ to
16434         output_sections_, and just keep a section pointer.  Change all
16435         uses.  Move comdat group support to Sized_relobj.
16436         (Relobj::is_section_specially_mapped): Remove.
16437         (Relobj::output_section): Remove poff parameter.  Change all
16438         callers.
16439         (Relobj::output_section_offset): New function.
16440         (Relobj::set_section_offset): Rewrite.
16441         (Relobj::map_to_output): Remove.
16442         (Relobj::output_sections): New function.
16443         (Relobj::do_output_section_offset): New pure virtual function.
16444         (Relobj::do_set_section_offset): Likewise.
16445         (class Sized_relobj): Add section_offsets_ field.  Add comdat
16446         group support from Relobj.  Update declarations.
16447         (Sized_relobj::get_output_section_offset): New function.
16448         (Sized_relobj::do_output_section_offset): New function.
16449         (Sized_relobj::do_set_section_offset): New function.
16450         * object.cc (Relobj::output_section_address): Remove.
16451         (Sized_relobj::Sized_relobj): Initialize new fields.
16452         (Sized_relobj::include_section_group): Cast find_kept_object to
16453         Sized_relobj.
16454         (Sized_relobj::include_linkonce_section): Likewise.
16455         (Sized_relobj::do_layout): Use separate arrays for output section
16456         and output offset.
16457         (Sized_relobj::do_count_local_symbols): Change map_to_output to
16458         output_sections.
16459         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
16460         output_sections and section_offsets.
16461         (Sized_relobj::write_local_symbols): Likewise.
16462         (map_to_kept_section): Compute output address directly.
16463         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
16464         output_sections and section_offsets.
16465         (Sized_relobj::write_sections): Likewise.
16466         (Sized_relobj::relocate_sections): Likewise.
16467         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
16468         * output.h (class Output_reloc): Update declarations.  Change
16469         u2_.relobj to Sized_relobj*.
16470         (class Output_data_reloc): Change add functions to use
16471         Sized_relobj*.
16472         * output.cc (Output_reloc::Output_reloc): Change relobj to
16473         Sized_relobj*.
16474         (Output_reloc::local_section_offset): Change return type to
16475         Elf_Addr.  Use get_output_section_offset.
16476         (Output_reloc::get_address): Likewise.
16477         (Output_section::is_input_address_mapped): Don't call
16478         is_section_specially_mapped.
16479         (Output_section::output_offset): Likewise.
16480         (Output_section::output_address): Likewise.
16481         (Output_section::starting_output_address): Likewise.
16482         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
16483         parameter to Sized_relobj*.
16484         (Copy_relocs::need_copy_reloc): Likewise.
16485         (Copy_relocs::save): Likewise.
16486         * copy-relocs.h (class Copy_relocs): Update declarations.
16487         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
16488         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
16489         * target-reloc.h (relocate_for_relocatable): Change
16490         offset_in_output_section type to Elf_Addr.  Change code that uses
16491         it as well.
16492         * layout.cc (Layout::layout): Always set *off.
16493         * mapfile.cc (Mapfile::print_input_section): Use
16494         output_section_offset.
16495         * i386.cc (Target_i386::copy_reloc): Change object parameter to
16496         Sized_relobj*.
16497         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
16498         * sparc.cc (Target_sparc::copy_reloc): Likewise.
16499         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
16500
16501 2008-07-03  Ian Lance Taylor  <iant@google.com>
16502
16503         * layout.cc (Layout::include_section): Do not discard unrecognized
16504         SHT_STRTAB sections.
16505
16506 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
16507
16508         * script.cc (Lex::can_continue_name): Make '?' allowable in
16509         version-script names.
16510         * testsuite/version_script.map: Change glob pattern to use '?'
16511
16512 2008-06-30  Manish Singh  <yosh@gimp.org>
16513
16514         PR 6585
16515         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
16516         Correct typo.
16517
16518 2008-06-30  Ian Lance Taylor  <iant@google.com>
16519
16520         PR 6660
16521         PR 6682
16522         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
16523         versions]: Don't try to read the value in the contents, since we
16524         don't use it.  Use the template endianness when writing.
16525
16526 2008-06-25  Cary Coutant  <ccoutant@google.com>
16527
16528         * fileread.cc (File_read::make_view): Assert on zero-length view.
16529         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
16530         symbol table when there are no symbols to read.
16531
16532 2008-06-23  Craig Silverstein  <csilvers@google.com>
16533
16534         * version.cc (version_string): Bump to 1.7
16535
16536 2008-06-18  Craig Silverstein  <csilvers@google.com>
16537
16538         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
16539         constant 0xFFFF to type Valtype.
16540         (Powerpc_relocate_functions::rel16_ha): Likewise.
16541
16542 2008-06-17  Ian Lance Taylor  <iant@google.com>
16543
16544         * output.h (Output_section::Input_section): Initialize p2align_ to
16545         zero for Output_section_data constructors.
16546         (Output_section::Input_section::addralign): If not an input
16547         section, return the alignment of the Output_section_data.
16548         * testsuite/copy_test.cc: New file.
16549         * testsuite/copy_test_1.cc: New file.
16550         * testsuite/copy_test_2.cc: New file.
16551         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
16552         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
16553         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
16554         (copy_test_1_pic.o, copy_test_1.so): New targets.
16555         (copy_test_2_pic.o, copy_test_2.so): New targets.
16556         * testsuite/Makefile.in: Rebuild.
16557
16558         * script-sections.cc (Script_sections::place_orphan): Initialize
16559         local variable exact.
16560
16561 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
16562
16563         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
16564
16565 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
16566             David S. Miller  <davem@davemloft.net>
16567
16568         * powerpc.cc: New file.
16569         * Makefile.am (TARGETSOURCES): Add powerpc.cc
16570         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
16571         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
16572         * Makefile.in: Rebuild.
16573
16574 2008-06-09  Ian Lance Taylor  <iant@google.com>
16575
16576         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
16577         <exception>.
16578         (throwing, orig_terminate): New static variables.
16579         (terminate_handler): New static function.
16580         (t2): Set terminate handler.
16581
16582 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
16583
16584         PR 6584
16585         * binary.cc (Binary_to_elf::sized_convert): Fix .data
16586         alignment.
16587
16588 2008-05-30  Cary Coutant  <ccoutant@google.com>
16589
16590         * archive.cc (Archive::include_all_members) Correct to step
16591         over symbol table and extended name table in thin archives.
16592
16593 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
16594
16595         PR 6407
16596         * target-reloc.h (relocate_for_relocatable): Fix new_offset
16597         calculation.
16598
16599 2008-05-28  Caleb Howe  <cshowe@google.com>
16600
16601         * reduced_debug_output.cc: New file.
16602         * reduced_debug_output.h: New file.
16603         * options.h (class General_options): Add --strip-debug-non-line.
16604         * options.cc (General_options::finalize): Add strip_debug_non_line
16605         to the strip heirarchy.
16606         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
16607         fields.
16608         * layout.cc: Include "reduced_debug_output.h".
16609         (Layout::Layout): Initialize new fields.
16610         (line_only_debug_sections): New static array.
16611         (is_lines_only_debug_sections): New static inline function.
16612         (Layout::include_section): Handle --strip-debug-non-line.
16613         (Layout::make_output_section): If --strip-debug-non-line, build
16614         new output sections for .debug_abbrev and .debug_info.
16615         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
16616         gold.  Warn about possible overflow.
16617         (read_signed_LEB_128): Likewise.
16618         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
16619         (read_signed_LEB_128): Declare.
16620         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
16621         (HFILES): Add reduced_debug_output.h.
16622         * Makefile.in: Rebuild.
16623
16624 2008-05-21  Ian Lance Taylor  <iant@google.com>
16625
16626         * mapfile.cc: New file.
16627         * mapfile.h: New file.
16628         * options.h (class General_options): Add -M/--print-map and -Map.
16629         * options.cc (General_options::finalize): Make -M equivalent to
16630         -Map -.
16631         * main.cc: Include <cstdio> and "mapfile.h".
16632         (main): Open mapfile if requested.
16633         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
16634         constructor.  Change caller.
16635         (queue_initial_tasks): Add mapfile parameter.  Change caller.
16636         (queue_middle_tasks): Likewise.
16637         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
16638         declarations.
16639         * archive.cc: Include "mapfile.h".
16640         (Archive::add_symbols): Add mapfile parameter.  Change all
16641         callers.  Pass mapfile, symbol, and reason to include_member.
16642         (Archive::include_all_members): Add mapfile parameter.  Change all
16643         callers.
16644         (Archive::include_member): Add mapfile, sym, and why parameters.
16645         Change all callers.  Report inclusion to map file.
16646         * archive.h: Include "fileread.h".
16647         (class Archive): Update declarations.
16648         (Archive::file): New const method.
16649         (class Add_archive_symbols): Add mapfile_ field.  Update
16650         constructor.  Change all callers.
16651         * readsyms.h (class Read_symbols): Likewise.
16652         (class Finish_group): Likewise.
16653         (class Read_script): Likewise.
16654         * common.cc: Include "mapfile.h".
16655         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
16656         all callers.
16657         (Symbol_table::do_allocate_commons): Likewise.
16658         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
16659         symbol allocation to mapfile.
16660         * common.h (class Allocate_commons_task): Add mapfile_ field.
16661         Update constructor.  Change all callers.
16662         * symtab.h (class Symbol_table): Update declarations.
16663         * layout.cc: Include "mapfile.h".
16664         (Layout_task_runner::run): Print information to mapfile.
16665         (Layout::create_gold_note): Change Output_data_fixed_space to
16666         Output_data_zero_fill.
16667         (Layout::create_build_id): Likewise.
16668         (Layout::print_to_mapfile): New function.
16669         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
16670         constructor.  Change caller.
16671         (class Layout): Declare print_to_mapfile.
16672         * output.cc (Output_section::Input_section::print_to_mapfile): New
16673         function.
16674         (Output_section::add_input_section): If producing a map, always
16675         add to input_sections_ list.
16676         (Output_section::do_print_to_mapfile): New function.
16677         (Output_segment::print_sections_to_mapfile): New function.
16678         (Output_segment::print_section_list_to_mapfile): New function.
16679         * output.h: Include "mapfile.h".
16680         (Output_data::print_to_mapfile): New function.
16681         (Output_data::do_print_to_mapfile): New virtual function.
16682         (Output_segment_headers::do_print_to_mapfile): New function.
16683         (Output_file_header::do_print_to_mapfile): New function.
16684         (Output_data_const::do_print_to_mapfile): New function.
16685         (class Output_data_const_buffer): Add map_name_ field.  Update
16686         constructor.  Change all callers.  Add do_print_to_mapfile
16687         function.
16688         (class Output_data_fixed_space): Likewise.
16689         (class Output_data_space): Likewise.
16690         (class Output_data_zero_fill): New class.
16691         (Output_data_strtab::do_print_to_mapfile): New function.
16692         (Output_data_reloc_base::do_print_to_mapfile): New function.
16693         (Output_relocatable_relocs::do_print_to_mapfile): New function.
16694         (Output_data_group::do_print_to_mapfile): New function.
16695         (Output_data_got::do_print_to_mapfile): New function.
16696         (Output_data_dynamic::do_print_to_mapfile): New function.
16697         (Output_symtab_xindex::do_print_to_mapfile): New function.
16698         (class Output_section): Declare do_print_to_mapflie.  Declare
16699         print_to_mapfile in Input_section.
16700         (class Output_segment): Declare new functions.
16701         * object.h (Sized_relobj::symbol_count): New function.
16702         * script-sections.cc
16703         (Output_section_element_dot_assignment::set_section_addresses):
16704         Change Output_data_fixed_space to Output_data_zero_fill.
16705         (Output_data_expression::do_print_to_mapfile): New function.
16706         * script.cc (read_input_script): Add mapfile parameter.  Change
16707         all callers.
16708         * script.h (read_input_script): Update declaration.
16709         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
16710         (Eh_frame::do_print_to_mapfile): New function.
16711         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
16712         (Output_merge_string::do_print_to_mapfile): New function.
16713         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
16714         function.
16715         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
16716         function.
16717         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
16718         function.
16719         * Makefile.am (CCFILES): Add mapfile.cc.
16720         (HFILES): Add mapfile.h.
16721         * Makefile.in: Rebuild.
16722
16723 2008-05-19  Ian Lance Taylor  <iant@google.com>
16724
16725         * options.h (class General_options): Add -z relro.
16726         * layout.cc (Layout::Layout): Initialize relro_segment_.
16727         (Layout::add_output_section_data): Return the output section.
16728         (Layout::make_output_section): Rcognize relro sections and mark
16729         them appropriately.
16730         (Layout::attach_allocated_section_to_segment): Put relro sections
16731         in a PT_GNU_RELRO segment.
16732         (Layout::create_initial_dynamic_sections): Mark the .dynamic
16733         section as relro.
16734         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
16735         PT_TLS segments.
16736         (Layout::linkonce_mapping): Map d.rel.ro.local to
16737         .data.rel.ro.local.
16738         (Layout::output_section_name): Us .data.rel.ro.local for any
16739         section which begins with that.
16740         * layout.h (class Layout): Update add_output_section_data
16741         declaration.  Add relro_segment_ field.
16742         * output.cc (Output_section::Output_section): Initialize is_relro_
16743         and is_relro_local_ fields.
16744         (Output_segment::add_output_section): Group relro sections.
16745         (Output_segment::is_first_section_relro): New function.
16746         (Output_segment::maximum_alignment): If there is a relro section,
16747         align the segment to the common page size.
16748         (Output_segment::set_section_addresses): Track whether we are
16749         looking at relro sections.  If the last section is a relro
16750         section, align to the common page size.
16751         (Output_segment::set_section_list_addresses): Add in_relro
16752         parameter.  Change all callers.  Align to the page size when
16753         moving from relro to non-relro section.
16754         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
16755         segment.
16756         * output.h (class Output_section): Add is_relro_ and
16757         is_relro_local_ fields.
16758         (Output_section::is_relro): New function.
16759         (Output_section::set_is_relro): New function.
16760         (Output_section::is_relro_local): New function.
16761         (Output_section::set_is_relro_local): New function.
16762         (class Output_segment): Update declarations.
16763         * i386.cc (Target_i386::got_section): Mark .got section as relro.
16764         * sparc.cc (Target_sparc::got_section): Likewise.
16765         * x86_64.cc (Target_x86_64::got_section): Likewise.
16766         * testsuite/relro_test_main.cc: New file.
16767         * testsuite/relro_test.cc: New file.
16768         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
16769         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
16770         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
16771         (relro_test.so, relro_test_pic.o): New targets.
16772         * testsuite/Makefile.in: Rebuild.
16773
16774 2008-05-16  Ian Lance Taylor  <iant@google.com>
16775
16776         * output.cc (Output_segment::add_output_section): Remove front
16777         parameter.
16778         * output.h (class Output_segment): Remove
16779         add_initial_output_section and overloaded add_output_section.
16780         Update declaration of remaining add_output_section.
16781         * layout.cc (Layout::create_interp): Call add_output_section
16782         rather than add_initial_output_section.
16783         (Layout::finish_dynamic_section): Likewise.
16784
16785         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
16786         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
16787         know the dynamic type.
16788         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
16789         field.  Initialize it in constructor.
16790         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
16791         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
16792         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
16793         reloc.
16794
16795         * output.cc (Output_reloc::get_address): Change return type to
16796         Elf_Addr.
16797         * output.h (class Output_reloc): Update get_address declaration.
16798         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
16799         for section addresses.
16800
16801 2008-05-09  Ian Lance Taylor  <iant@google.com>
16802
16803         PR 6493
16804         * gold.cc (gold_nomem): Use return value of write.
16805
16806 2008-05-08  Ian Lance Taylor  <iant@google.com>
16807
16808         * symtab.c (Symbol::init_base_output_data): Add version
16809         parameter.  Change all callers.
16810         (Symbol::init_base_output_segment): Likewise.
16811         (Symbol::init_base_constant): Likewise.
16812         (Symbol::init_base_undefined): Likewise.
16813         (Sized_symbol::init_output_data): Likewise.
16814         (Sized_symbol::init_output_segment): Likewise.
16815         (Sized_symbol::init_constant): Likewise.
16816         (Sized_symbol::init_undefined): Likewise.
16817         (Symbol_table::do_define_in_output_data): If the new symbol has a
16818         version, mark it as the default.
16819         (Symbol_table::do_define_in_output_segment): Likewise.
16820         (Symbol_table::do_define_as_constant): Likewise.
16821         * symtab.h (class Symbol): Update declarations.
16822         (class Sized_symbol): Likewise.
16823         * resolve.cc (Symbol::override_version): New function.
16824         (Symbol::override_base): Call override_version.
16825         (Symbol::override_base_with_special): Likewise.
16826         * testsuite/ver_script_8.script: New file.
16827         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
16828         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
16829         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
16830         (ver_test_8_1.so, ver_test_8_2.so): New targets.
16831
16832 2008-05-06  Ian Lance Taylor  <iant@google.com>
16833
16834         PR 6049
16835         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
16836         functions.
16837         (class General_options): Remove existing --undefined, and add
16838         --no-undefined instead.  Add new --undefined as synonym for -u.
16839         * archive.cc (Archive::add_symbols): Check whether symbol was
16840         named with -u.
16841         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
16842         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
16843         all uses.  Add IS_UNDEFINED.  Update declarations to split
16844         different versions of init_base.  Declare init_base_undefined.
16845         (Symbol::is_defined): Handle IS_UNDEFINED.
16846         (Symbol::is_undefined): Likewise.
16847         (Symbol::is_weak_undefined): Call is_undefined.
16848         (Symbol::is_absolute): Handle IS_CONSTANT.
16849         (class Sized_symbol): Update declarations to split different
16850         versions of init.  Declare init_undefined.
16851         (class Symbol_table): Declare new functions.
16852         * symtab.cc (Symbol::init_base_object): Rename from init_base.
16853         Change all callers.
16854         (Symbol::init_base_output_data): Likewise.
16855         (Symbol::init_base_output_segment): Likewise.
16856         (Symbol::init_base_constant): Likewise.
16857         (Symbol::init_base_undefined): New function.
16858         (Sized_symbol::init_object): Rename from init.  Change all
16859         callers.
16860         (Sized_symbol::init_output_data): Likewise.
16861         (Sized_symbol::init_output_segment): Likewise.
16862         (Sized_symbol::init_constant): Likewise.
16863         (Sized_symbol::init_undefined): New function.
16864         (Symbol_table::add_undefined_symbols_from_command_line): New
16865         function.
16866         (Symbol_table::do_add_undefined_symbols_from_command_line): New
16867         function.
16868         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
16869         (Symbol::output_section): Likewise.
16870         (Symbol::set_output_section): Likewise.
16871         (Symbol_table::sized_finalize_symbol): Likewise.
16872         (Symbol_table::sized_write_globals): Likewise.
16873         * resolve.cc (Symbol_table::should_override): Likewise.
16874         (Symbol::override_base_with_special): Likewise.
16875
16876         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
16877         symbol, change it to have default visibility.
16878         * testsuite/protected_1.cc: New file.
16879         * testsuite/protected_2.cc: New file.
16880         * testsuite/protected_3.cc: New file.
16881         * testsuite/protected_main_1.cc: New file.
16882         * testsuite/protected_main_2.cc: New file.
16883         * testsuite/protected_main_3.cc: New file.
16884         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
16885         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
16886         (protected_1_LDFLAGS, protected_1_LDADD): Define.
16887         (protected_1.so): New target.
16888         (protected_1_pic.o, protected_2_pic.o): New targets.
16889         (protected_3_pic.o): New target.
16890         (check_PROGRAMS): Add protected_2.
16891         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
16892         (protected_2_LDFLAGS, protected_2_LDADD): Define.
16893         * testsuite/Makefile.in: Rebuild.
16894
16895         * options.h (DEFINE_var): Add set_user_set_##varname__.
16896         (DEFINE_bool_alias): New macro.
16897         (class General_options): Define -Bstatic using DEFINE_bool_alias
16898         rather than DEFINE_special.  Add --undefined as an alias for -z
16899         defs.
16900         * options.cc (General_options::parse_Bstatic): Remove.
16901
16902         * options.h (class General_options): Add --fatal-warnings.
16903         * main.cc (main): Implement --fatal-warnings.
16904         * errors.h (Errors::warning_count): New function.
16905
16906         * options.h (class General_options): Add -Bsymbolic-functions.
16907         * symtab.h (Symbol::is_preemptible): Check for
16908         -Bsymbolic-functions.
16909
16910 2008-05-05  Ian Lance Taylor  <iant@google.com>
16911
16912         * options.h (DEFINE_bool): For DASH_Z, create the negative option
16913         as noVARNAME rather than no-VARNAME.
16914         (class General_options): Add option -z combreloc.
16915         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
16916         get_address.
16917         (Output_reloc::sort_before) [SHT_REL]: New function.
16918         (Output_reloc::sort_before) [SHT_RELA]: New function.
16919         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
16920         Sort_relocs_comparison.
16921         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
16922         parameter.  Change all callers.
16923         (Output_data_reloc::Output_data_reloc) [both versions]: Add
16924         sort_relocs parameter.  Change all callers.
16925         * output.cc (Output_reloc::get_address): New function, broken out
16926         of write_rel.
16927         (Output_reloc::write_rel): Call it.
16928         (Output_reloc::compare): New function.
16929         (Output_data_reloc_base::do_write): Optionally sort relocs.
16930
16931         * configure.ac: If targ_extra_obj is set, link it in.
16932         * configure.tgt: Initialize all variables.
16933         (x86_64*): Set targ_extra_obj and targ_extra_size.
16934         * configure: Rebuild.
16935
16936         * object.cc (Sized_relobj::include_section_group): Adjust section
16937         indexes read from group data.  Build vector to pass to
16938         layout_group.
16939         * layout.cc (Layout::layout_group): Add flags and shndxes
16940         parameters.  Remove contents parameter.  Change caller.  Update
16941         explicit instantiations.
16942         * layout.h (class Layout): Update layout_group declaration.
16943         * output.cc (Output_data_group::Output_data_group): Add flags and
16944         input_shndxes parameters.  Remove contents parameter.  Change
16945         caller.
16946         (Output_data_group::do_write): Change input_sections_ to
16947         input_shndxes_.
16948         * output.h (class Output_data_group): Update constructor
16949         declaration.  Rename input_sections_ to input_shndxes_.
16950         * testsuite/many_sections_test.cc: Add template.
16951
16952 2008-04-30  Cary Coutant  <ccoutant@google.com>
16953
16954         * target-reloc.h (relocate_section): Fix dead-pointer bug.
16955
16956         * layout.cc (Layout::include_section): Refactored check for debug
16957         info section.
16958         (Layout::add_comdat): Add new parameters.  Change type
16959         of signature parameter.  Add object and shndx to signatures table.
16960         (Layout::find_kept_object): New function.
16961         * layout.h: Include <cstring>.
16962         (Layout::is_debug_info_section): New function.
16963         (Layout::add_comdat): Add new parameters.
16964         (Layout::find_kept_object): New function.
16965         (Layout::Kept_section): New struct.
16966         (Layout::Signatures): Change type of map range.
16967         * object.cc (Relobj::output_section_address): New function.
16968         (Sized_relobj::include_section_group): Add new parameters.  Change
16969         calls to Layout::add_comdat.  Change to build table of kept comdat
16970         groups and table mapping discarded sections to kept sections.
16971         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
16972         (Sized_relobj::do_layout): Change calls to include_section_group and
16973         include_linkonce_section.
16974         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
16975         value to zero when section is discarded.
16976         (Sized_relobj::map_to_kept_section): New function.
16977         * object.h (Relobj::output_section_address): New function.
16978         (Relobj::Comdat_group): New type.
16979         (Relobj::find_comdat_group): New function.
16980         (Relobj::Comdat_group_table): New type.
16981         (Relobj::Kept_comdat_section): New type.
16982         (Relobj::Kept_comdat_section_table): New type.
16983         (Relobj::add_comdat_group): New function.
16984         (Relobj::set_kept_comdat_section): New function.
16985         (Relobj::get_kept_comdat_section): New function.
16986         (Relobj::comdat_groups_): New field.
16987         (Relobj::kept_comdat_sections_): New field.
16988         (Symbol_value::input_value): Update comment.
16989         (Sized_relobj::map_to_kept_section) New function.
16990         (Sized_relobj::include_linkonce_section): Add new parameter.
16991         * target-reloc.h (Comdat_behavior): New type.
16992         (get_comdat_behavior): New function.
16993         (relocate_section): Add code to map a discarded section to the
16994         corresponding kept section when applying a relocation.
16995
16996 2008-04-30  Craig Silverstein  <csilvers@google.com>
16997
16998         * dwarf_reader.cc (next_generation_count): New static var.
16999         (Addr2line_cache_entry): New struct.
17000         (addr2line_cache): New static var.
17001         (Dwarf_line_info::one_addr2line): Added caching.
17002         (Dwarf_line_info::clear_addr2line_cache): New function.
17003         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
17004         cache-size parameter.
17005         (Dwarf_line_info::one_addr2line_cache): New function.
17006         * symtab.cc (Symbol_table::detect_odr_violations): Pass
17007         new cache-size argument to one_addr2line(), and clear cache.
17008
17009 2008-04-28  Cary Coutant  <ccoutant@google.com>
17010
17011         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
17012         R_386_PC8 relocations.
17013
17014 2008-04-23  Ian Lance Taylor  <iant@google.com>
17015
17016         * object.cc (Sized_relobj::include_section_group): Check for
17017         invalid section group.
17018
17019         * object.cc (make_elf_object): Correct test for 64-bit ELF file
17020         header size.
17021
17022         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
17023         than read for file header.
17024         * archive.cc (Archive::include_member): Likewise.
17025
17026 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
17027
17028         * aclocal.m4: Regenerate.
17029         * configure: Regenerate.
17030
17031 2008-04-19  Ian Lance Taylor  <iant@google.com>
17032
17033         * version.cc (version_string): Bump to 1.6.
17034
17035         * testsuite/Makefile.am (many_sections_r_test): New target.
17036         (many_sections_r_test_SOURCES): Remove.
17037         (many_sections_r_test_DEPENDENCIES): Remove.
17038         (many_sections_r_test_LDFLAGS): Remove.
17039         (many_sections_r_test_LDADD): Remove.
17040
17041         * object.cc (Sized_relobj::do_add_symbols): Always pass
17042         local_symbol_count_ to add_from_relobj.
17043
17044         * testsuite/Makefile.am (many_sections_check.h): Only check one in
17045         every thousand variables.
17046         * testsuite/Makefile.in: Rebuild.
17047
17048         * object.cc (Xindex::initialize_symtab_xindex): New function.
17049         (Xindex::read_symtab_xindex): New function.
17050         (Xindex::sym_xindex_to_shndx): New function.
17051         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
17052         available.
17053         (Sized_relobj::do_initialize_xindex): New function.
17054         (Sized_relobj::do_read_symbols): Adjust section links.
17055         (Sized_relobj::symbol_section_and_value): Add is_ordinary
17056         parameter.  Change all callers.
17057         (Sized_relobj::include_section_group): Adjust section links and
17058         symbol section indexes.
17059         (Sized_relobj::do_layout): Adjust section links.
17060         (Sized_relobj::do_count_local_symbols): Adjust section links and
17061         symbol section indexes.
17062         (Sized_relobj::do_finalize_local_symbols): Distinguish between
17063         ordinary and special symbols.
17064         (Sized_relobj::write_local_symbols): Add symtab_xindex and
17065         dynsym_xindex parameters.  Change all callers.  Adjust section
17066         links.  Use SHN_XINDEX when needed.
17067         (Sized_relobj::get_symbol_location_info): Adjust section links.
17068         Don't get fooled by special symbols.
17069         * object.h (class Xindex): Define.
17070         (class Object): Add xindex_ parameter.  Declare virtual functoin
17071         do_initialize_xindex.
17072         (Object::adjust_sym_shndx): New function.
17073         (Object::set_xindex): New protected function.
17074         (class Symbol_value): Add is_ordinary_shndx_ field.
17075         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
17076         (Symbol_value::value): Assert ordinary section.
17077         (Symbol_value::initialize_input_to_output_map): Likewise.
17078         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
17079         Change all callers.
17080         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
17081         all callers.
17082         (class Sized_relobj): Update declarations.
17083         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
17084         parameter.  Change all callers.
17085         (Sized_relobj::adjust_shndx): New function.
17086         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
17087         field.
17088         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
17089         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
17090         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
17091         (Sized_dynobj::read_dynsym_section): Adjust section links.
17092         (Sized_dynobj::read_dynamic): Likewise.
17093         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
17094         section links.
17095         (Sized_dynobj::do_initialize_xindex): New function.
17096         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
17097         do_initialize_xindex.
17098         (Sized_dynobj::adjust_shndx): New function.
17099         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
17100         dynsym_xindex_ fields.
17101         (Layout::finalize): Add a call to set_section_indexes before
17102         creating the symtab sections.
17103         (Layout::set_section_indexes): Don't do anything if the section
17104         already has a section index.
17105         (Layout::create_symtab_sections): Add shnum parameter.  Change
17106         caller.  Create .symtab_shndx section if needed.
17107         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
17108         caller.
17109         (Layout::allocated_output_section_count): New function.
17110         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
17111         needed.
17112         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
17113         fields.  Update declarations.
17114         (Layout::symtab_xindex): New function.
17115         (Layout::dynsym_xindex): New function.
17116         (class Write_symbols_task): Add layout_ field.
17117         (Write_symbols_task::Write_symbols_task): Add layout parameter.
17118         Change caller.
17119         * output.cc (Output_section_headers::Output_section_headers): Add
17120         shstrtab_section parameter.  Change all callers.
17121         (Output_section_headers::do_sized_write): Store overflow values
17122         for section count and section string table section index in
17123         section header zero.
17124         (Output_file_header::do_sized_write): Check for overflow of
17125         section count and section string table section index.
17126         (Output_symtab_xindex::do_write): New function.
17127         (Output_symtab_xindex::endian_do_write): New function.
17128         * output.h (class Output_section_headers): Add shstrtab_section_.
17129         Update declarations.
17130         (class Output_symtab_xindex): Define.
17131         (Output_section::has_out_shndx): New function.
17132         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
17133         field.
17134         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
17135         Change all callers.
17136         (Sized_symbol::init): Likewise.
17137         (Symbol::output_section): Check for ordinary symbol.
17138         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
17139         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
17140         callers.
17141         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
17142         Change all callers.  Simplify handling of symbols from sections
17143         not included in the link.
17144         (Symbol_table::add_from_dynobj): Handle ordinary symbol
17145         distinction.
17146         (Weak_alias_sorter::operator()): Assert that symbols are
17147         ordinary.
17148         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
17149         distinction.
17150         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
17151         parameters.  Change all callers.
17152         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
17153         symbol distinction.  Use SHN_XINDEX when needed.
17154         (Symbol_table::write_section_symbol): Add symtab_xindex
17155         parameter.  Change all callers.
17156         (Symbol_table::sized_write_section_symbol): Likewise.  Use
17157         SHN_XINDEX when needed.
17158         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
17159         declarations.
17160         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
17161         (Symbol::is_defined): Check is_ordinary.
17162         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
17163         (Symbol::is_absolute, Symbol::is_common): Likewise.
17164         (class Sized_symbol): Update declarations.
17165         (class Symbol_table): Update declarations.
17166         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
17167         parameters.  Change all callers.
17168         (Sized_symbol::override): Likewise.
17169         (Symbol_table::override): Likewise.
17170         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
17171         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
17172         is_ordinary, and orig_st_shndx parameters.  Change all callers.
17173         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
17174         to be in an ordinary section.
17175         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
17176         object and is_ordinary parameters.  Change all callers.
17177         (Sized_dwarf_line_info::read_relocs): Add object parameter.
17178         Change all callers.  Don't add undefined or non-ordinary symbols
17179         to reloc_map_.
17180         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
17181         Change all callers.
17182         * dwarf_reader.h (class Sized_dwarf_line_info): Update
17183         declarations.
17184         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
17185         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
17186         (Sized_relobj::relocate_sections): Likewise.
17187         * target-reloc.h (scan_relocs): Adjust section symbol index.
17188         (scan_relocatable_relocs): Likewise.
17189         * i386.cc (Scan::local): Check for ordinary symbols.
17190         * sparc.cc (Scan::local): Likewise.
17191         * x86_64.cc (Scan::local): Likewise.
17192         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
17193         to symbol_section_and_value.
17194         * testsuite/many_sections_test.cc: New file.
17195         * testsuite/Makefile.am (BUILT_SOURCES): Define.
17196         (check_PROGRAMS): Add many_sections_test.
17197         (many_sections_test_SOURCES): Define.
17198         (many_sections_test_DEPENDENCIES): Define.
17199         (many_sections_test_LDFLAGS): Define.
17200         (BUILT_SOURCES): Add many_sections_define.h.
17201         (many_sections_define.h): New target.
17202         (BUILT_SOURCES): Add many_sections_check.h.
17203         (many_sections_check.h): New target.
17204         (check_PROGRAMS): Add many_sections_r_test.
17205         (many_sections_r_test_SOURCES): Define.
17206         (many_sections_r_test_DEPENDENCIES): Define.
17207         (many_sections_r_test_LDFLAGS): Define.
17208         (many_sections_r_test_LDADD): Define.
17209         (many_sections_r_test.o): New target.
17210         * testsuite/Makefile.in: Rebuild.
17211
17212 2008-04-17  Cary Coutant  <ccoutant@google.com>
17213
17214         * errors.cc (Errors::info): New function.
17215         (gold_info): New function.
17216         * errors.h (Errors::info): New function.
17217         * gold.h (gold_info): New function.
17218         * object.cc (Input_objects::add_object): Print trace output.
17219         * options.cc (options::parse_set): New function.
17220         (General_options::parse_wrap): Deleted.
17221         (General_options::General_options): Deleted initializer.
17222         * options.h (options::String_set): New typedef.
17223         (options::parse_set): New function.
17224         (DEFINE_set): New macro.
17225         (General_options::wrap): Changed to use DEFINE_set. Changed
17226         callers of any_wrap_symbols and is_wrap_symbol.
17227         (General_options::trace, General_options::trace_symbol):
17228         New options.
17229         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
17230         (General_options::wrap_symbols_): Deleted.
17231         * symtab.cc (Symbol_table::add_from_object): Print trace output.
17232
17233 2008-04-17  David S. Miller  <davem@davemloft.net>
17234
17235         * options.cc (General_options::parse_V): New function.
17236         * options.h: Add entries for -V and -Qy.
17237
17238 2008-04-17  Ian Lance Taylor  <iant@google.com>
17239
17240         * common.cc (Symbol_table::allocate_commons): Remove options
17241         parameter.  Change caller.
17242         (Symbol_table::do_allocate_commons): Remove options parameter.
17243         Change caller.  Just call do_allocate_commons_list twice.
17244         (Symbol_table::do_allocate_commons_list): New function, broken out
17245         of do_allocate_commons.
17246         * common.h (class Allocate_commons_task): Remove options_ field.
17247         Update constructor.
17248         * symtab.cc (Symbol_table::Symbol_table): Initialize
17249         tls_commons_.
17250         (Symbol_table::add_from_object): Put TLS common symbols on
17251         tls_commons_ list.
17252         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
17253         which are IN_OUTPUT_DATA.
17254         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
17255         allocate_commons and do_allocate_commons declarations.  Declare
17256         do_allocate_commons_list.
17257         * gold.cc (queue_middle_tasks): Update creation of
17258         Allocate_commons_task to not pass options.
17259         * testsuite/Makefile.am (INCLUDES): Add -I.. .
17260         (TLS_TEST_C_FLAGS): New variable.
17261         (tls_test_c_pic.o): New target.
17262         (tls_test_shared.so): Link in tls_test_c_pic.o.
17263         (tls_test_c_pic_ie.o): New target.
17264         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
17265         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
17266         (tls_test_c.o): New target.
17267         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
17268         (tls_pic_test_LDADD): Likewise.
17269         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
17270         (tls_shared_gd_to_ie_test_LDADD): Likewise.
17271         (tls_test_c_gnu2.o): New target.
17272         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
17273         tls_test_c_gnu2.o.
17274         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
17275         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
17276         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
17277         * testsuite/tls_test.cc: Include "config.h".
17278         (t_last): Call t11_last.
17279         * testsuite/tls_test.h (t11, t11_last): Declare.
17280         * testsuite/tls_test_c.c: New file.
17281         * testsuite/tls_test_main.cc (thread_routine): Call t11.
17282         * configure.ac: Check for OpenMP support.
17283         * configure, config.in, Makefile.in: Rebuild.
17284         * testsuite/Makefile.in: Rebuild.
17285
17286 2008-04-16  Cary Coutant  <ccoutant@google.com>
17287
17288         * i386.cc (Target_i386::define_tls_base_symbol): New function.
17289         (Target_i386::tls_base_symbol_defined_): New field.
17290         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
17291         (Target_i386::Scan::global): Likewise.
17292         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
17293         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
17294         (Target_x86_64::tls_base_symbol_defined_): New field.
17295         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
17296         (Target_x86_64::Scan::global): Likewise.
17297
17298 2008-04-16  Cary Coutant  <ccoutant@google.com>
17299
17300         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
17301         (Symbol::needs_plt_entry): Allow weak undefined symbols.
17302         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
17303         building shared libraries.
17304         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
17305         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
17306         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
17307         * testsuite/Makefile.in: Rebuild.
17308         * testsuite/weak_undef.h: New file.
17309         * testsuite/weak_undef_file1.cc: Add extra test cases.
17310         * testsuite/weak_undef_file2.cc: Likewise.
17311         * testsuite/weak_undef_test.cc: Likewise.
17312
17313 2008-04-16  David S. Miller  <davem@davemloft.net>
17314
17315         * sparc.cc (Target_sparc::Scan): Change from struct to class.
17316         Add issued_non_pic_error_ field.  Declare check_non_pic.
17317         (Target_sparc::Scan::check_non_pic): New function.
17318         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
17319         (Target_sparc::Scan::global): Likewise.
17320
17321         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
17322         * configure: Rebuild.
17323
17324         * options.h (DEFINE_enable): New macro.
17325         (new_dtags): New enable option.
17326         (initfirst, interpose, loadfltr, nodefaultlib,
17327         nodelete, nodlopen, nodump): New -z options.
17328         * layout.cc (Layout:finish_dynamic_section): If new
17329         dtags enabled, emit DT_RUNPATH.  Also, emit a
17330         DT_FLAGS_1 containing any specified -z flags.
17331
17332 2008-04-16  Ian Lance Taylor  <iant@google.com>
17333
17334         * copy-relocs.cc: New file.
17335         * copy-relocs.h: New file.
17336         * reloc.cc: Remove Copy_relocs code.
17337         * reloc.h: Likewise.
17338         * reloc-types.h (struct Reloc_types) [both versions]: Add
17339         get_reloc_addend_noerror.
17340         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
17341         variants of add_global which take an addend which must be zero.
17342         * i386.cc: Include "copy-relocs.h".
17343         (class Target_i386): Change type of copy_relocs_ to variable,
17344         update initializer.
17345         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
17346         Change all callers.
17347         (Target_i386::do_finalize_sections): Change handling of
17348         copy_relocs_.
17349         * sparc.cc: Include "copy-relocs.h".
17350         (class Target_sparc): Change type of copy_relocs_ to variable,
17351         update initializer.
17352         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
17353         Change all callers.
17354         (Target_sparc::do_finalize_sections): Change handling of
17355         copy_relocs_.
17356         * x86_64.cc: Include "copy-relocs.h".
17357         (class Target_x86_64): Change type of copy_relocs_ to variable,
17358         update initializer.
17359         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
17360         class.  Change all callers.
17361         (Target_x86_64::do_finalize_sections): Change handling of
17362         copy_relocs_.
17363         * Makefile.am (CCFILES): Add copy-relocs.cc.
17364         (HFILES): Add copy-relocs.h.
17365
17366         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
17367
17368         * testsuite/script_test_4.sh: Permit leading zeroes.
17369
17370 2008-04-15  Ian Lance Taylor  <iant@google.com>
17371
17372         * script-sections.cc (Script_sections::create_segments): Use
17373         header_size_adjustment even when there is enough room for the
17374         headers.
17375         * testsuite/script_test_4.sh: New file.
17376         * testsuite/script_test_4.t: New file.
17377         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
17378         (check_DATA): Add script_test_4.stdout.
17379         (MOSTLYCLEANFILES): Likewise.
17380         (script_test_4): New target.
17381         (script_test_4.stdout): New target.
17382         * testsuite/Makefile.in: Rebuild.
17383
17384         * sparc.cc: Add definitions for Output_data_plt_sparc class
17385         constants.
17386
17387 2008-04-14  David S. Miller  <davem@davemloft.net>
17388
17389         * sparc.cc: New file.
17390         * Makefile.am (TARGETSOURCES): Add sparc.cc
17391         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
17392         * configure.tgt: Document targ_extra_size and
17393         targ_extra_big_endian.  Add entries for sparc-* and
17394         sparc64-*.
17395         * configure.ac: Handle targ_extra_size and
17396         targ_extra_big_endian.
17397         * Makefile.in: Rebuild.
17398         * configure: Likewise.
17399         * po/POTFILES.in: Likewise.
17400         * po/gold.pot: Likewise.
17401
17402 2008-04-14  Ian Lance Taylor  <iant@google.com>
17403
17404         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
17405         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
17406         in the name/type/flags to section mapping.  Don't call
17407         allocate_output_section.
17408         (Layout::choose_output_section): Change parameter from adjust_name
17409         to is_input_section.  Don't permit input sections after sections
17410         are attached to segments.  Don't call allocate_output_section.
17411         (Layout::layout_eh_frame): Call update_flags_for_input_section,
17412         not write_enable_output_section.
17413         (Layout::make_output_section): Don't push to
17414         unattached_section_list_ nor call attach_to_segment.  Call
17415         attach_section_to_segment if sections are attached.
17416         (Layout::attach_sections_to_segments): New function.
17417         (Layout::attach_section_to_segment): New function.
17418         (Layout::attach_allocated_section_to_segment): Rename from
17419         attach_to_segment.  Remove flags parameter.
17420         (Layout::allocate_output_section): Remove function.
17421         (Layout::write_enable_output_section): Remove function.
17422         * layout.h (class Layout): Update for above changes.  Add new
17423         field sections_are_attached_.
17424         * output.h (Output_section::update_flags_for_input_section): New
17425         function.
17426         * output.cc (Output_section::add_input_section): Call
17427         update_flags_for_input_section.
17428         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
17429
17430 2008-04-11  Cary Coutant  <ccoutant@google.com>
17431
17432         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
17433         thought unnecessary.
17434         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
17435
17436 2008-04-11  Ian Lance Taylor  <iant@google.com>
17437
17438         * output.h (class Output_section_data): Remove inline definition
17439         of set_addralign.
17440         * output.cc (Output_section_data::set_addralign): New function.
17441
17442 2008-04-11  Cary Coutant  <ccoutant@google.com>
17443
17444         Add support for TLS descriptors for i386 and x86_64.
17445         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
17446         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
17447         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
17448         GOT_TYPE_TLS_DESC.
17449         (Target_i386::got_mod_index_entry): Remove unnecessary code.
17450         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
17451         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
17452         relocations.
17453         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
17454         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
17455         Fix problem with initial-exec relocations.
17456         (Target_i386::Relocate::relocate_tls): Likewise.
17457         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
17458         relaxation.
17459         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
17460         support for section-plus-offset dynamic table entries.
17461         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
17462         (Output_data_dynamic::Dynamic_entry): Add support for
17463         section-plus-offset dynamic table entries.
17464         (Output_data_dynamic::Classification): Likewise.
17465         (Output_data_dynamic::classification_): Renamed offset_.
17466         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
17467         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
17468         (Target_x86_64::make_plt_section): New function.
17469         (Target_x86_64::reserve_tlsdesc_entries): New function.
17470         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
17471         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
17472         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
17473         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
17474         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
17475         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
17476         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
17477         add extra PLT entry for TLS descriptors.
17478         (Output_data_plt_x86_64::got_): New field.
17479         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
17480         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
17481         fields.
17482         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
17483         descriptors.
17484         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
17485         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
17486         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
17487         R_386_TLS_DESC_CALL relocations.
17488         (Target_x86_64::Scan::global): Likewise.
17489         (Target_x86_64::do_finalize_sections): Add dynamic table entries
17490         for TLS descriptors.
17491         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
17492         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
17493         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
17494         GD-to-IE relaxation.
17495         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
17496         and TLS_DESCRIPTORS.
17497         * Makefile.in: Rebuild.
17498         * configure: Rebuild.
17499         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
17500         (tls_test_shared2.so): New target.
17501         (tls_shared_gd_to_ie_test_SOURCES): New variable.
17502         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
17503         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
17504         (tls_shared_gd_to_ie_test_LDADD): New variable.
17505         (tls_shared_gnu2_gd_to_ie_test): New target.
17506         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
17507         New targets.
17508         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
17509         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
17510         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
17511         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
17512         (tls_shared_gnu2_test): New target.
17513         (tls_test_gnu2_shared.so): New target.
17514         (tls_shared_gnu2_test_SOURCES): New variable.
17515         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
17516         (tls_shared_gnu2_test_LDFLAGS): New variable.
17517         (tls_shared_gnu2_test_LDADD): New variable.
17518         * testsuite/Makefile.in: Rebuild.
17519         * testsuite/Makefile.
17520
17521 2008-04-11  Ian Lance Taylor  <iant@google.com>
17522
17523         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
17524         justsyms.t.
17525         * testsuite/Makefile.in: Rebuild.
17526
17527         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
17528         long.
17529         * testsuite/script_test_2.cc (main): Adjust test.
17530
17531 2008-04-11  David S. Miller  <davem@davemloft.net>
17532             Ian Lance Taylor  <iant@google.com>
17533
17534         * options.h (General_options): Add entries for '-Y' and
17535         '-relax'.
17536         * options.cc (General_options:finalize): If -Y was used, add those
17537         entries to the library path instead of the default "/lib" and
17538         "/usr/lib".
17539
17540 2008-04-11  David S. Miller  <davem@davemloft.net>
17541
17542         * testsuite/justsyms.t: Start at 0x100.
17543         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
17544         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
17545         long.
17546         * testsuite/script_test_2.cc: Adjust string and section length
17547         checks.
17548
17549 2008-04-09  Ian Lance Taylor  <iant@google.com>
17550
17551         PR gold/5996
17552         * script-sections.cc (Sections_element::allocate_to_segment): Add
17553         orphan parameter.
17554         (Output_section_definition::allocate_to_segment): Likewise.
17555         (Orphan_output_section::allocate_to_segment): Likewise.
17556         (Script_sections::attach_sections_using_phdrs_clause): Don't
17557         propagate non-PT_LOAD segments to orphan sections.
17558         * testsuite/Makefile.am (script_test_3.stdout): Generate using
17559         readelf rather than objdump.
17560         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
17561         .interp section and PT_INTERP segment are the same size.
17562         * testsuite/Makefile.in: Rebuild.
17563
17564         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
17565         aliases for symbols defined in the same object.
17566         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
17567         (weak_alias_test_SOURCES): New variable.
17568         (weak_alias_test_DEPENDENCIES): New variable.
17569         (weak_alias_test_LDFLAGS): New variable.
17570         (weak_alias_test_LDADD): New variable.
17571         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
17572         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
17573         (weak_alias_test_3.o): New target.
17574         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
17575         * testsuite/weak_alias_test_main.cc: New file.
17576         * testsuite/weak_alias_test_1.cc: New file.
17577         * testsuite/weak_alias_test_2.cc: New file.
17578         * testsuite/weak_alias_test_3.cc: New file.
17579
17580 2008-04-08  Ian Lance Taylor  <iant@google.com>
17581
17582         * options.h (class General_options): Add --noinhibit-exec option.
17583         * main.cc (main): Check --noinhibit-exec.
17584
17585         * options.h (class General_options): Define --wrap as a special
17586         option.  Add wrap_symbols_ field.
17587         (General_options::any_wrap_symbols): New function.
17588         (General_options::is_wrap_symbol): New function.
17589         * options.cc (General_options::parse_wrap): New function.
17590         (General_options::General_options): Initialize wrap_symbols_.
17591         * symtab.cc (Symbol_table::wrap_symbol): New function.
17592         (Symbol_table::add_from_object): Handle --wrap.
17593         * symtab.h (class Symbol_table): Declare wrap_symbol.
17594         * target.h (Target::wrap_char): New function.
17595         (Target::Target_info): Add wrap_char field.
17596         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
17597         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
17598         * testsuite/testfile.cc (Target_test::test_target_info):
17599         Likewise.
17600
17601         * errors.cc (Errors::undefined_symbol): Mention symbol version if
17602         there is one.
17603
17604         * layout.h (class Layout): Add added_eh_frame_data_ field.
17605         * layout.cc (Layout::Layout): Initialize new field.
17606         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
17607         output section until we find a section we merged successfully.
17608         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
17609         that the size be non-zero.
17610
17611         * merge.cc (Object_merge_map::get_output_offset): Remove inline
17612         qualifier.
17613
17614 2008-04-08  Craig Silverstein  <csilvers@google.com>
17615
17616         * configure.ac: Export new conditional variable HAVE_ZLIB.
17617         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
17618         on HAVE_ZLIB.
17619         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
17620         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17621
17622 2008-04-07  Ian Lance Taylor  <iant@google.com>
17623
17624         * version.cc (version_string): Set to "1.5".
17625
17626         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
17627         Add issued_non_pic_error_ field.  Declare check_non_pic.
17628         (Target_x86_64::Scan::check_non_pic): New function.
17629         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
17630         (Target_x86_64::Scan::global): Likewise.
17631
17632         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
17633         addend parameter.  Change caller.  Handle merge sections.
17634         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
17635         Address to Addend.  Don't add in the result of
17636         local_section_offset, pass down the addend and use the returned
17637         value.
17638         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
17639         Update declarations of local_section_offset and symbol_value.
17640         * testsuite/two_file_test_1.cc (t18): New function.
17641         * testsuite/two_file_test_2.cc (f18): New function.
17642         * testsuite/two_file_test_main.cc (main): Call t18.
17643         * testsuite/two_file_test.h (t18, f18): Declare.
17644
17645         * configure.ac: Don't test for objdump, c++filt, or readelf.
17646         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
17647         conditionals.
17648         (TEST_READELF): New variable.
17649         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
17650         (check_PROGRAMS): Add two_file_strip_test.
17651         (two_file_strip_test): New target.
17652         (check_PROGRAMS): Add two_file_same_shared_strip_test.
17653         (two_file_same_shared_strip_test_SOURCES): New variable.
17654         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
17655         (two_file_same_shared_strip_test_LDFLAGS): New variable.
17656         (two_file_same_shared_strip_test_LDADD): New variable.
17657         (two_file_shared_strip.so): New target.
17658         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
17659         (ver_test_5.syms, ver_test_7.syms): Likewise.
17660         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
17661         (strip_test_3.stdout): Use TEST_OBJDUMP.
17662         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17663
17664 2008-04-04  Cary Coutant  <ccoutant@google.com>
17665
17666         * symtab.h (Symbol::is_weak_undefined): New function.
17667         (Symbol::is_strong_undefined): New function.
17668         (Symbol::is_absolute): New function.
17669         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
17670         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
17671         absolute symbols.
17672         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
17673         (weak_undef_test): New target.
17674         * testsuite/Makefile.in: Rebuild.
17675         * testsuite/weak_undef_file1.cc: New file.
17676         * testsuite/weak_undef_file2.cc: New file.
17677         * testsuite/weak_undef_test.cc: New file.
17678
17679 2008-04-03  Craig Silverstein  <csilvers@google.com>
17680
17681         * compressed_output.h (class Output_compressed_section): Use
17682         unsigned buffer.
17683         * compressed_output.cc (zlib_compress): Use unsigned buffers,
17684         add zlib header.
17685         (zlib_compressed_suffix): Removed.
17686         (Output_compressed_section::set_final_data_size): Use unsigned
17687         buffers.
17688         * testsuite/Makefile.am (flagstest_compress_debug_sections):
17689         Fix linker invocation.
17690         (flagstest_o_specialfile_and_compress_debug_sections):
17691         Likewise.
17692         * testsuite/Makefile.in: Regenerated.
17693
17694 2008-04-02  David S. Miller  <davem@davemloft.net>
17695
17696         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
17697         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
17698
17699 2008-04-02  Craig Silverstein  <csilvers@google.com>
17700
17701         * TODO: New file.
17702
17703 2008-04-02  Ian Lance Taylor  <iant@google.com>
17704
17705         * fileread.cc (File_read::find_view): Add byteshift and vshifted
17706         parameters.  Update for new key type to views_.  Change all
17707         callers.
17708         (File_read::read): Adjust for byteshift in returned view.
17709         (File_read::add_view): New function, broken out of
17710         find_and_make_view.
17711         (File_read::make_view): New function, broken out of
17712         find_and_make_view.
17713         (File_read::find_or_make_view): Add offset and aligned
17714         parameters.  Rewrite accordingly.  Change all callers.
17715         (File_read::get_view): Add offset and aligned parameters.  Adjust
17716         for byteshift in return value.
17717         (File_read::get_lasting_view): Likewise.
17718         * fileread.h (class File_read): Update declarations.
17719         (class File_read::View): Add byteshift_ field.  Add byteshift to
17720         constructor.  Add byteshift method.
17721         * archive.h (Archive::clear_uncached_views): New function.
17722         (Archive::get_view): Add aligned parameter.  Change all callers.
17723         * object.h (Object::get_view): Add aligned parameter.  Change all
17724         callers.
17725         (Object::get_lasting_view): Likewise.
17726
17727         * fileread.cc (File_read::release): Don't call clear_views if
17728         there are multiple objects.
17729         * fileread.h (File_read::clear_uncached_views): New function.
17730         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
17731         on the archive.
17732
17733 2008-03-31  Cary Coutant  <ccoutant@google.com>
17734
17735         Add thin archive support.
17736         * archive.cc (Archive::armagt): New const.
17737         (Archive::setup): Remove task parameter and calls to unlock.
17738         (Archive::unlock_nested_archives): New function.
17739         (Archive::read_header): Add nested_off parameter. Change
17740         all callers.
17741         (Archive::interpret_header): Likewise.
17742         (Archive::include_all_members): Change to handle thin
17743         archives.
17744         (Archive::include_member): Likewise.
17745         * archive.h (Archive::Archive): Add new parameters and
17746         initializers.
17747         (Archive::armagt): New const.
17748         (Archive::setup): Remove task parameter.
17749         (Archive::unlock_nested_archives): New function.
17750         (Archive::read_header): Add nested_off parameter.
17751         (Archive::interpret_header): Likewise.
17752         (Archive::Nested_archive_table): New typedef.
17753         (Archive::is_thin_archive_): New field.
17754         (Archive::nested_archives_): New field.
17755         (Archive::options_): New field.
17756         (Archive::dirpath_): New field.
17757         (Archive::task_): New field.
17758         * readsyms.cc (Read_symbols::do_read_symbols): Add check
17759         for thin archives.  Pass additional parameters to
17760         Archive::Archive.  Unlock the archive file after calling
17761         Archive::setup.
17762
17763 2008-03-29  Ian Lance Taylor  <iant@google.com>
17764
17765         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
17766         version symbol to be local.
17767         * testsuite/ver_test_4.sh: New file.
17768         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
17769         (check_DATA): Add ver_test_4.syms.
17770         (ver_test_4.syms): New target.
17771         * testsuite/Makefile.in: Rebuild.
17772
17773         * output.cc
17774         (Output_section::Input_section_sort_entry::has_priority): New
17775         function.
17776         (Output_section::Input_section_sort_entry::match_file_name): New
17777         function.
17778         (Output_section::Input_section_sort_entry::match_section_name):
17779         Remove.
17780         (Output_section::Input_section_sort_entry::match_section_name_prefix):
17781         Remove.
17782         (Output_section::Input_section_sort_entry::match_section_file):
17783         Remove.
17784         (Output_section::Input_section_sort_compare::operator()): Rewrite
17785         using new Input_section_sort_entry functions.  Sort crtbegin and
17786         crtend first.  Sort sections with no priority before sections with
17787         a priority.
17788         * testsuite/initpri1.c (d3): Check j != 4.
17789         (cd5): New constructor/destructor function.
17790         (main): Check j != 2.
17791
17792         * symtab.cc (Symbol_table::add_from_object): If we don't use the
17793         new symbol when resolving, don't call set_is_default.
17794         * testsuite/ver_test_7.cc: New file.
17795         * testsuite/ver_test_7.sh: New file.
17796         * testsuite/Makefile.am (ver_test_7.so): New target.
17797         (ver_test_7.o): New target.
17798         (check_SCRIPTS): Add ver_test_7.sh.
17799         (check_DATA): Add ver_test_7.syms.
17800         (ver_test_7.syms): New target.
17801
17802 2008-03-28  Ian Lance Taylor  <iant@google.com>
17803
17804         * layout.cc (Layout::layout): If we see an input section with a
17805         name that needs sorting, set the must_sort flag for the output
17806         section.
17807         (Layout::make_output_section): If the name of the output section
17808         indicates that it might require sorting, set the may_sort flag.
17809         * output.h (Output_section::may_sort_attached_input_sections): New
17810         function.
17811         (Output_section::set_may_sort_attached_input_sections): New
17812         function.
17813         (Output_section::must_sort_attached_input_sections): New
17814         function.
17815         (Output_section::set_must_sort_attached_input_sections): New
17816         function.
17817         (class Output_section): Declare Input_section_sort_entry.  Define
17818         Input_section_sort_compare.  Declare
17819         sort_attached_input_sections.  Add new fields:
17820         may_sort_attached_input_sections_,
17821         must_sort_attached_input_sections_,
17822         attached_input_sections_are_sorted_.
17823         * output.cc (Output_section::Output_section): Initialize new
17824         fields.
17825         (Output_section::add_input_section): Add an entry to
17826         input_sections_ if may_sort or must_sort are true.
17827         (Output_section::set_final_data_size): Call
17828         sort_attached_input_sections if necessary.
17829         (Output_section::Input_section_sort_entry): Define new class.
17830         (Output_section::Input_section_sort_compare::operator()): New
17831         function.
17832         (Output_section::sort_attached_input_sections): New function.
17833         * configure.ac: Check whether the compiler supports constructor
17834         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
17835         * testsuite/initpri1.c: New file.
17836         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
17837         CONSTRUCTOR_PRIORITY.
17838         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
17839         (initpri1_LDFLAGS): New variable.
17840         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17841
17842 2008-03-27  Ian Lance Taylor  <iant@google.com>
17843
17844         * common.cc (Sort_commons::operator): Correct sorting algorithm.
17845         * testsuite/common_test_1.c: New file.
17846         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
17847         (common_test_1_SOURCES): New variable.
17848         (common_test_1_DEPENDENCIES): New variable.
17849         (common_test_1_LDFLAGS): New variable.
17850
17851         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
17852         and commons_ correctly when NAME/VERSION does not override
17853         NAME/NULL.
17854         * testsuite/ver_test_6.c: New file.
17855         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
17856         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
17857         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
17858
17859 2008-03-26  Ian Lance Taylor  <iant@google.com>
17860
17861         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
17862         of an undefined symbol from a version script.
17863         * testsuite/Makefile.am (ver_test_5.so): New target.
17864         (ver_test_5.o): New target.
17865         (check_SCRIPTS): Add ver_test_5.sh.
17866         (check_DATA): Add ver_test_5.syms.
17867         (ver_test_5.syms): New target.
17868         * testsuite/ver_test_5.cc: New file.
17869         * testsuite/ver_test_5.script: New file.
17870         * testsuite/ver_test_5.sh: New file.
17871         * Makefile.in, testsuite/Makefile.in: Rebuild.
17872
17873         PR gold/5986
17874         Fix problems building gold with gcc 4.3.0.
17875         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
17876         (gold_error_at_location, gold_warning_at_location): Use it.
17877         * configure.ac: Check whether we can compile and use a template
17878         function with a printf attribute.
17879         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
17880         when jumping over bytes.
17881         * object.cc: Instantiate Object::read_section_data.
17882         * debug.h: Include <cstring>
17883         * dwarf_reader.cc: Include <algorithm>
17884         * main.cc: Include <cstring>.
17885         * options.cc: Include <cstring>.
17886         * output.cc: Include <cstring>.
17887         * script.cc: Include <cstring>.
17888         * script.h: Include <string>.
17889         * symtab.cc: Include <cstring> and <algorithm>.
17890         * target-select.cc: Include <cstring>.
17891         * version.cc: Include <string>.
17892         * testsuite/testmain.cc: Include <cstdlib>.
17893         * configure, config.in: Rebuild.
17894
17895 2008-03-25  Ian Lance Taylor  <iant@google.com>
17896
17897         * options.cc: Include "../bfd/bfdver.h".
17898         (options::help): Print bug reporting address.
17899
17900         * version.cc (print_version): Adjust output for current value of
17901         BFD_VERSION_STRING.
17902
17903         * NEWS: New file.
17904
17905         * options.cc (options::help): Print list of supported targets.
17906         * target-select.h: Include <vector>.
17907         (class Target_selector): Make machine_, size_, and is_big_endian_
17908         fields const.  Add bfd_name_ and instantiated_target_ fields.
17909         (Target_selector::Target_selector): Add bfd_name parameter.
17910         (Target_selector::recognize): Make non-virtual, call
17911         do_recognize.
17912         (Target_selector::recognize_by_name): Make non-virtual, call
17913         do_recognize_by_name.
17914         (Target_selector::supported_names): New function.
17915         (Target_selector::bfd_name): New function.
17916         (Target_selector::do_instantiate_target): New pure virtual
17917         function.
17918         (Target_selector::do_recognize): New virtual function.
17919         (Target_selector::do_recognize_by_name): New virtual function.
17920         (Target_selector::instantiate_target): New private function.
17921         (supported_target_names): Declare.
17922         * target-select.cc (Target_selector::Target_selector): Update for
17923         new parameter and fields.
17924         (select_target_by_name): Check that the name matches before
17925         calling recognize_by_name.
17926         (supported_target_names): New function.
17927         * i386.cc (class Target_selector_i386): Update Target_selector
17928         constructor call.  Remove recognize and recognize_by_name.  Add
17929         do_instantiate_target.
17930         * x86_64.cc (class Target_selector_x86_64): Likewise.
17931         * testsuite/testfile.cc (class Target_selector_test): Update for
17932         changes to Target_selector.
17933
17934         * README: Rewrite, with some notes on unsupported features.
17935
17936 2008-03-24  Cary Coutant  <ccoutant@google.com>
17937
17938         * i386.cc (Target_i386::Got_type): New enum declaration.
17939         (Target_i386::Scan::local): Updated callers of Output_data_got
17940         member functions.
17941         (Target_i386::Scan::global): Likewise.
17942         (Target_i386::Relocate::relocate): Likewise.
17943         (Target_i386::Relocate::relocate_tls): Likewise.
17944         * object.h (Got_offset_list): New class.
17945         (Sized_relobj::local_has_got_offset): Added got_type parameter.
17946         (Sized_relobj::local_got_offset): Likewise.
17947         (Sized_relobj::set_local_got_offset): Likewise.
17948         (Sized_relobj::local_has_tls_got_offset): Removed.
17949         (Sized_relobj::local_tls_got_offset): Removed.
17950         (Sized_relobj::set_local_tls_got_offset): Removed.
17951         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
17952         * output.cc (Output_data_got::add_global): Added got_type parameter.
17953         (Output_data_got::add_global_with_rel): Likewise.
17954         (Output_data_got::add_global_with_rela): Likewise.
17955         (Output_data_got::add_global_pair_with_rel): New function.
17956         (Output_data_got::add_global_pair_with_rela): New function.
17957         (Output_data_got::add_local): Added got_type parameter.
17958         (Output_data_got::add_local_with_rel): Likewise.
17959         (Output_data_got::add_local_with_rela): Likewise.
17960         (Output_data_got::add_local_pair_with_rel): New function.
17961         (Output_data_got::add_local_pair_with_rela): New function.
17962         (Output_data_got::add_global_tls): Removed.
17963         (Output_data_got::add_global_tls_with_rel): Removed.
17964         (Output_data_got::add_global_tls_with_rela): Removed.
17965         (Output_data_got::add_local_tls): Removed.
17966         (Output_data_got::add_local_tls_with_rel): Removed.
17967         (Output_data_got::add_local_tls_with_rela): Removed.
17968         * output.h (Output_data_got::add_global): Added got_type parameter.
17969         (Output_data_got::add_global_with_rel): Likewise.
17970         (Output_data_got::add_global_with_rela): Likewise.
17971         (Output_data_got::add_global_pair_with_rel): New function.
17972         (Output_data_got::add_global_pair_with_rela): New function.
17973         (Output_data_got::add_local): Added got_type parameter.
17974         (Output_data_got::add_local_with_rel): Likewise.
17975         (Output_data_got::add_local_with_rela): Likewise.
17976         (Output_data_got::add_local_pair_with_rel): New function.
17977         (Output_data_got::add_local_pair_with_rela): New function.
17978         (Output_data_got::add_global_tls): Removed.
17979         (Output_data_got::add_global_tls_with_rel): Removed.
17980         (Output_data_got::add_global_tls_with_rela): Removed.
17981         (Output_data_got::add_local_tls): Removed.
17982         (Output_data_got::add_local_tls_with_rel): Removed.
17983         (Output_data_got::add_local_tls_with_rela): Removed.
17984         * resolve.cc (Symbol::override_base_with_special): Removed
17985         reference to has_got_offset_ field.
17986         * symtab.cc (Symbol::init_fields): Replaced initialization
17987         of got_offset_ with got_offsets_.  Removed initialization
17988         of has_got_offset_
17989         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
17990         (Symbol::got_offset): Likewise.
17991         (Symbol::set_got_offset): Likewise.
17992         (Symbol::has_tls_got_offset): Removed.
17993         (Symbol::tls_got_offset): Removed.
17994         (Symbol::set_tls_got_offset): Removed.
17995         (Symbol::got_offset_): Removed.
17996         (Symbol::tls_mod_got_offset_): Removed.
17997         (Symbol::tls_pair_got_offset_): Removed.
17998         (Symbol::got_offsets_): New field.
17999         (Symbol::has_got_offset): Removed.
18000         (Symbol::has_tls_mod_got_offset): Removed.
18001         (Symbol::has_tls_pair_got_offset): Removed.
18002         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
18003         (Target_x86_64::Scan::local): Updated callers of Output_data_got
18004         member functions.
18005         (Target_x86_64::Scan::global): Likewise.
18006         (Target_x86_64::Relocate::relocate): Likewise.
18007         (Target_x86_64::Relocate::relocate_tls): Likewise.
18008
18009 2008-03-25  Ben Elliston  <bje@au.ibm.com>
18010
18011         * yyscript.y: Fix spelling error in comment.
18012
18013 2008-03-24  Ian Lance Taylor  <iant@google.com>
18014
18015         * options.h (class General_options): Define build_id option.
18016         * layout.h (class Layout): Declare write_build_id, create_note,
18017         create_build_id.  Add build_id_note_ member.
18018         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
18019         "libiberty.h", "md5.h", "sha1.h".
18020         (Layout::Layout): Initialize eh_frame_data_,
18021         eh_frame_hdr_section_, and build_id_note_.
18022         (Layout::finalize): Call create_build_id.
18023         (Layout::create_note): New function, broken out of
18024         Layout::create_gold_note.
18025         (Layout::create_gold_note): Call create_note.
18026         (Layout::create_build_id): New function.
18027         (Layout::write_build_id): New function.
18028         (Close_task_runner::run): Call write_build_id.
18029
18030         * x86_64.cc: Correct license to GPLv3.
18031
18032 2008-03-23  Ian Lance Taylor  <iant@google.com>
18033
18034         * options.cc: Include "demangle.h".
18035         (parse_optional_string): New function.
18036         (parse_long_option): Handle takes_optional_argument.
18037         (parse_short_option): Update dash_z initializer.  Handle
18038         takes_optional_argument.
18039         (General_options::General_options): Initialize do_demangle_.
18040         (General_options::finalize): Set do_demangle_.  Handle demangling
18041         style.
18042         * options.h (parse_optional_string): Declare.
18043         (struct One_option): Add optional_arg field.  Update constructor.
18044         Update call constructor calls.  Add takes_optional_argument
18045         function.
18046         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
18047         (DEFINE_optional_string): Define.
18048         (General_options::demangle): Change from DEFINE_bool to
18049         DEFINE_optional_string.
18050         (General_options::no_demangle): New function.
18051         (General_options::do_demangle): New function.
18052         (General_options::set_do_demangle): New function.
18053         (General_options::execstack_status_): Move definition to end of
18054         class definition.
18055         (General_options::static_): Likewise.
18056         (General_options::do_demangle_): New field.
18057         * object.cc (big_endian>::get_symbol_location_info): Call
18058         Options::do_demangle, not Options::demangle.
18059         * symtab.cc (demangle): Likewise.
18060
18061 2008-03-22  Ian Lance Taylor  <iant@google.com>
18062
18063         * gold.h: Include <cstddef> and <sys/types.h>
18064         * options.h: Include <cstring>.
18065
18066 2008-03-21  Ian Lance Taylor  <iant@google.com>
18067
18068         * Added source code to GNU binutils.
18069 \f
18070 Copyright (C) 2008-2015 Free Software Foundation, Inc.
18071
18072 Copying and distribution of this file, with or without modification,
18073 are permitted in any medium without royalty provided the copyright
18074 notice and this notice are preserved.
18075
18076 Local Variables:
18077 mode: change-log
18078 left-margin: 8
18079 fill-column: 74
18080 version-control: never
18081 End: